Added track # display to the LCD screen.

This commit is contained in:
Stephen White 2018-06-06 19:09:13 +10:00
parent 091c785875
commit b3088df3d2
5 changed files with 31 additions and 3 deletions

View file

@ -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() void SSD1306::ClearScreen()
{ {
memset(frame, 0, sizeof(frame)); memset(frame, 0, sizeof(frame));

View file

@ -25,9 +25,9 @@ extern "C"
} }
// 8 pages * (128 columns * 8 bits) // 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 //7777777 | 7
//6666666 | 6 //6666666 | 6
@ -82,6 +82,7 @@ public:
void ClearScreen(); void ClearScreen();
void RefreshScreen(); void RefreshScreen();
void RefreshRows(u8 start, u8 amountOfRows);
protected: protected:
void SendCommand(u8 command); void SendCommand(u8 command);

View file

@ -97,3 +97,7 @@ void ScreenLCD::SwapBuffers()
ssd1306->RefreshScreen(); ssd1306->RefreshScreen();
} }
void ScreenLCD::RefreshRows(u8 start, u8 amountOfRows)
{
ssd1306->RefreshRows(start, amountOfRows);
}

View file

@ -51,6 +51,8 @@ public:
void SwapBuffers(); void SwapBuffers();
void RefreshRows(u8 start, u8 amountOfRows);
private: private:
SSD1306* ssd1306 = 0; SSD1306* ssd1306 = 0;
}; };

View file

@ -492,6 +492,13 @@ void UpdateScreen()
snprintf(tempBuffer, tempBufferSize, "%02d.%d", (oldTrack >> 1) + 1, oldTrack & 1 ? 5 : 0); snprintf(tempBuffer, tempBufferSize, "%02d.%d", (oldTrack >> 1) + 1, oldTrack & 1 ? 5 : 0);
screen.PrintText(false, 20 * 8, y, tempBuffer, textColour, bgColour); screen.PrintText(false, 20 * 8, y, tempBuffer, textColour, bgColour);
//refreshUartStatusDisplay = true; //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) if (emulating)