Merge pull request #50 from penfold42/128x32fix

Fix for 128x32 displays during emulation
This commit is contained in:
Stephen White 2018-07-29 14:58:40 +10:00 committed by GitHub
commit 2b142c3e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 39 deletions

View File

@ -60,6 +60,8 @@ GraphIEC = 1
// If you are using a LCD screen then specify it here
//LCDName = ssd1306_128x64
//LCDName = ssd1306_128x32
//LCDName = sh1106_128x64
// 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

View File

@ -32,6 +32,8 @@ static char buffer[256] = { 0 };
static u32 white = RGBA(0xff, 0xff, 0xff, 0xff);
static u32 red = RGBA(0xff, 0, 0, 0xff);
#define LCDFONTHEIGHT 16
bool DiskCaddy::Empty()
{
int x;
@ -62,7 +64,7 @@ bool DiskCaddy::Empty()
snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += 16;
y += LCDFONTHEIGHT;
snprintf(buffer, 256, "%s ", disks[index].GetName());
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers();
@ -91,7 +93,7 @@ bool DiskCaddy::Empty()
snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += 16;
y += LCDFONTHEIGHT;
snprintf(buffer, 256, "Complete ");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers();
@ -130,7 +132,7 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
snprintf(buffer, 256, "Loading");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += 16;
y += LCDFONTHEIGHT;
snprintf(buffer, 256, "%s ", fileInfo->fname);
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers();
@ -282,24 +284,22 @@ void DiskCaddy::ShowSelectedImage(u32 index)
if (screenLCD)
{
unsigned numberOfImages = GetNumberOfImages();
unsigned numberOfDisplayedImages = screenLCD->Height()/LCDFONTHEIGHT-1;
unsigned caddyIndex;
if (screenLCD)
{
RGBA BkColour = RGBA(0, 0, 0, 0xFF);
//screenLCD->Clear(BkColour);
x = 0;
y = 0;
//snprintf(buffer, 256, "Emulating %d/%d ", index + 1, numberOfImages);
snprintf(buffer, 256, " D %d/%d ", index + 1, numberOfImages);
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), RGBA(0xff, 0xff, 0xff, 0xff));
y += 16;
y += LCDFONTHEIGHT;
if (numberOfImages > 3 && index > 2)
if (numberOfImages > numberOfDisplayedImages && index > numberOfDisplayedImages-1)
{
if (numberOfImages - index < 3)
caddyIndex = numberOfImages - 3;
if (numberOfImages - index < numberOfDisplayedImages)
caddyIndex = numberOfImages - numberOfDisplayedImages;
else
caddyIndex = index;
}
@ -316,14 +316,13 @@ void DiskCaddy::ShowSelectedImage(u32 index)
{
snprintf(buffer, 256, "%d %s ", caddyIndex + 1, name);
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour);
y += 16;
y += LCDFONTHEIGHT;
}
if (y >= screenLCD->Height())
break;
}
screenLCD->SwapBuffers();
}
}
}
bool DiskCaddy::Update()