LcdLogoName = 1541ii (or 1541classic)

This commit is contained in:
penfold42 2018-07-03 21:26:01 +10:00
parent 418f8707e9
commit 34c75658eb
6 changed files with 42 additions and 4 deletions

View file

@ -55,6 +55,9 @@ GraphIEC = 1
// If you are using a LCD screen and you would like PageUp and PageDown keys to work with it then specify this option
//KeyboardBrowseLCDScreen = 1
// change startup logo on oled - 1541ii or 1541classic
//LcdLogoName = 1541ii
// If you are using I2C LCD you can optionally change what pins it is connected to.
// (defaults to 0 for non-split lines (Option A) or 1 for split lines (Option B))
//i2cBusMaster = 0 //SDA - pin 27 SCL - pin 28

View file

@ -42,10 +42,6 @@ void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int B
ssd1306 = new SSD1306(BSCMaster, LCDAddress, LCDFlip, LCDType);
ssd1306->DisplayOn();
// ssd1306->Plottext(5, 0, "Pi1541", false);
// ssd1306->PlotImage(logo_ssd_1541ii);
ssd1306->PlotImage(logo_ssd_1541classic);
ssd1306->RefreshScreen();
opened = true;
@ -85,6 +81,14 @@ void ScreenLCD::PlotImage(u32* image, int x, int y, int w, int h)
{
}
void ScreenLCD::PlotRawImage(const u8* image, int x, int y, int w, int h)
{
if (x==0 && y==0 && w==128 && h==64)
{
ssd1306->PlotImage(image);
}
}
u32 ScreenLCD::PrintText(bool petscii, u32 x, u32 y, char *ptr, RGBA TxtColour, RGBA BkColour, bool measureOnly, u32* width, u32* height)
{
int len = 0;
@ -102,6 +106,11 @@ u32 ScreenLCD::GetFontHeight()
return 16;
}
void ScreenLCD::RefreshScreen()
{
ssd1306->RefreshScreen();
}
void ScreenLCD::SwapBuffers()
{
ssd1306->RefreshScreen();

View file

@ -49,9 +49,12 @@ public:
void PlotImage(u32* image, int x, int y, int w, int h);
void PlotRawImage(const u8* image, int x, int y, int w, int h);
u32 GetFontHeight();
void SwapBuffers();
void RefreshScreen();
void RefreshRows(u8 start, u8 amountOfRows);

View file

@ -43,6 +43,7 @@ extern "C"
#include "logo.h"
#include "sample.h"
#include "ssd_logo.h"
unsigned versionMajor = 1;
unsigned versionMinor = 7;
@ -355,6 +356,20 @@ void InitialiseLCD()
{
screenLCD = new ScreenLCD();
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, 1306);
if (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0)
{
screenLCD->PlotRawImage(logo_ssd_1541ii, 0, 0, 128, 64);
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
screenLCD->PrintText(0, 16, 0, tempBuffer, 0xffffffff);
screenLCD->RefreshScreen();
}
if (strcasecmp(options.GetLcdLogoName(), "1541classic") == 0)
{
screenLCD->PlotRawImage(logo_ssd_1541classic, 0, 0, 128, 64);
screenLCD->RefreshScreen();
}
screenLCD->SetContrast(i2cLcdOnContrast);
}
else if (strcasecmp(options.GetLCDName(), "sh1106_128x64") == 0)
@ -1060,6 +1075,8 @@ void DisplayOptions(int y_pos)
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
snprintf(tempBuffer, tempBufferSize, "LCDName = %s\r\n", options.GetLCDName());
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
snprintf(tempBuffer, tempBufferSize, "LcdLogoName = %s\r\n", options.GetLcdLogoName());
screen.PrintText(false, 0, y_pos += 16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
}
static void CheckOptions()

View file

@ -221,6 +221,10 @@ void Options::Process(char* buffer)
{
strncpy(starFileName, pValue, 255);
}
else if ((strcasecmp(pOption, "LCDLogoName") == 0))
{
strncpy(LcdLogoName, pValue, 255);
}
else if ((strcasecmp(pOption, "LCDName") == 0))
{
strncpy(LCDName, pValue, 255);

View file

@ -76,6 +76,7 @@ public:
inline unsigned int I2CLcdOnContrast() const { return i2cLcdOnContrast; }
inline unsigned int I2CLcdDimContrast() const { return i2cLcdDimContrast; }
inline unsigned int I2CLcdDimTime() const { return i2cLcdDimTime; }
inline const char* GetLcdLogoName() const { return LcdLogoName; }
// Page up and down will jump a different amount based on the maximum number rows displayed.
// Perhaps we should use some keyboard modifier to the the other screen?
@ -119,6 +120,7 @@ private:
char starFileName[256];
char LCDName[256];
char LcdLogoName[256];
char autoMountImageName[256];
char ROMFontName[256];