AirPlay fix & misc

- Spectrum scale fix
- Initialize more display parameters
- Reboot after 30s of no connection
- Reboot after IP address change
This commit is contained in:
philippe44
2020-03-07 14:01:53 -08:00
parent fae613eb33
commit 8e95bd3dd2
13 changed files with 127 additions and 62 deletions

View File

@@ -74,7 +74,7 @@ static void Update( struct GDS_Device* Device ) {
CurrentPage = p + 1;
// actual write
Device->WriteData( Device, Private->Shadowbuffer + p*width + first, last - first + 1);
Device->WriteData( Device, Private->Shadowbuffer + p*width + first, last - first + 1 );
}
}
#else
@@ -114,6 +114,10 @@ static bool Init( struct GDS_Device* Device ) {
// charge pump regulator, do direct init
Device->WriteCommand( Device, 0x8D );
Device->WriteCommand( Device, 0x14 );
// set Clocks
Device->WriteCommand( Device, 0xD5 );
Device->WriteCommand( Device, ( 0x08 << 4 ) | 0x00 );
// COM pins HW config (alternative:EN if 64, DIS if 32, remap:DIS) - some display might need something different
Device->WriteCommand( Device, 0xDA );
@@ -122,6 +126,10 @@ static bool Init( struct GDS_Device* Device ) {
// MUX Ratio
Device->WriteCommand( Device, 0xA8 );
Device->WriteCommand( Device, Device->Height - 1);
// Page & GDDRAM Start Column High/Low
Device->WriteCommand( Device, 0x00 );
Device->WriteCommand( Device, 0x10 );
Device->WriteCommand( Device, 0xB0 );
// Display Offset
Device->WriteCommand( Device, 0xD3 );
Device->WriteCommand( Device, 0 );
@@ -133,9 +141,6 @@ static bool Init( struct GDS_Device* Device ) {
Device->SetHFlip( Device, false );
// no Display Inversion
Device->WriteCommand( Device, 0xA6 );
// set Clocks
Device->WriteCommand( Device, 0xD5 );
Device->WriteCommand( Device, ( 0x08 << 4 ) | 0x00 );
// set Adressing Mode Horizontal
Device->WriteCommand( Device, 0x20 );
Device->WriteCommand( Device, 0 );

View File

@@ -126,6 +126,7 @@ static void Update1( struct GDS_Device* Device ) {
// not sure the compiler does not have to redo all calculation in for loops, so local it is
int width = Device->Width / 8, rows = Device->Height;
uint8_t *optr = Private->Shadowbuffer, *iptr = Device->Framebuffer;
int CurrentRow = -1, FirstCol = -1, LastCol = -1;
// by row, find first and last columns that have been updated
for (int r = 0; r < rows; r++) {
@@ -140,9 +141,22 @@ static void Update1( struct GDS_Device* Device ) {
// now update the display by "byte rows"
if (first--) {
SetColumnAddress( Device, first, last );
SetRowAddress( Device, r, r);
Device->WriteData( Device, Private->Shadowbuffer + r*width + first, last - first + 1);
// only set column when useful, saves a fair bit of CPU
if (first > FirstCol && first <= FirstCol + 4 && last < LastCol && last >= LastCol - 4) {
first = FirstCol;
last = LastCol;
} else {
SetColumnAddress( Device, first, last );
FirstCol = first;
LastCol = last;
}
// Set row only when needed, otherwise let auto-increment work
if (r != CurrentRow) SetRowAddress( Device, r, Device->Height - 1 );
CurrentRow = r + 1;
// actual write
Device->WriteData( Device, Private->Shadowbuffer + r*width + first, last - first + 1 );
}
}
#else

View File

@@ -201,8 +201,8 @@ static void displayer_task(void *args) {
displayer.tick = tick;
displayer.elapsed += elapsed / 1000;
xSemaphoreGive(displayer.mutex);
if (displayer.elapsed < 3600) sprintf(counter, "%5u:%02u", displayer.elapsed / 60, displayer.elapsed % 60);
else sprintf(counter, "%2u:%02u:%02u", displayer.elapsed / 3600, (displayer.elapsed % 3600) / 60, displayer.elapsed % 60);
if (displayer.elapsed < 3600) snprintf(counter, 16, "%5u:%02u", displayer.elapsed / 60, displayer.elapsed % 60);
else snprintf(counter, 16, "%2u:%02u:%02u", displayer.elapsed / 3600, (displayer.elapsed % 3600) / 60, displayer.elapsed % 60);
GDS_TextLine(display, 1, GDS_TEXT_RIGHT, (GDS_TEXT_CLEAR | GDS_TEXT_CLEAR_EOL) | GDS_TEXT_UPDATE, counter);
timer_sleep = 1000;
} else timer_sleep = max(1000 - elapsed, 0);