diff --git a/src/SSD1306.cpp b/src/SSD1306.cpp index 19ea061..d1106b9 100644 --- a/src/SSD1306.cpp +++ b/src/SSD1306.cpp @@ -185,6 +185,20 @@ void SSD1306::RefreshScreen() } } +void SSD1306::RefreshRows(u8 start, u8 amountOfRows) +{ + MoveCursorCharacter(start, 0); + start *= 128; + + int i; + int end = start + amountOfRows * 128; + + for (i = start * 128; i < end; i++) + { + SendData(frame[i]); + } +} + void SSD1306::ClearScreen() { memset(frame, 0, sizeof(frame)); diff --git a/src/SSD1306.h b/src/SSD1306.h index ec17f63..99fec95 100644 --- a/src/SSD1306.h +++ b/src/SSD1306.h @@ -25,9 +25,9 @@ extern "C" } // 8 pages * (128 columns * 8 bits) -//0 127 -//0 127 -//0 127 +//0 127 0 127 +//0 127 0 127 +//0 127 0 127 //________________________________________________________ //7777777 | 7 //6666666 | 6 @@ -82,6 +82,7 @@ public: void ClearScreen(); void RefreshScreen(); + void RefreshRows(u8 start, u8 amountOfRows); protected: void SendCommand(u8 command); diff --git a/src/ScreenLCD.cpp b/src/ScreenLCD.cpp index 2c79e7e..8a5216f 100644 --- a/src/ScreenLCD.cpp +++ b/src/ScreenLCD.cpp @@ -97,3 +97,7 @@ void ScreenLCD::SwapBuffers() ssd1306->RefreshScreen(); } +void ScreenLCD::RefreshRows(u8 start, u8 amountOfRows) +{ + ssd1306->RefreshRows(start, amountOfRows); +} diff --git a/src/ScreenLCD.h b/src/ScreenLCD.h index 598d9f9..9f48aaf 100644 --- a/src/ScreenLCD.h +++ b/src/ScreenLCD.h @@ -51,6 +51,8 @@ public: void SwapBuffers(); + void RefreshRows(u8 start, u8 amountOfRows); + private: SSD1306* ssd1306 = 0; }; diff --git a/src/main.cpp b/src/main.cpp index 5d50628..fb652af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -492,6 +492,13 @@ void UpdateScreen() snprintf(tempBuffer, tempBufferSize, "%02d.%d", (oldTrack >> 1) + 1, oldTrack & 1 ? 5 : 0); screen.PrintText(false, 20 * 8, y, tempBuffer, textColour, bgColour); //refreshUartStatusDisplay = true; + + if (screenLCD) + { + screenLCD->PrintText(false, 0, 0, tempBuffer, RGBA(0xff, 0xff, 0xff, 0xff), RGBA(0xff, 0xff, 0xff, 0xff)); + screenLCD->RefreshRows(0, 2); //SwapBuffers(); + } + } if (emulating)