From bf4358f34035aa6c2d59bf1b1a8403aab4059cdd Mon Sep 17 00:00:00 2001 From: Philippe G Date: Fri, 31 Jul 2020 14:50:56 -0700 Subject: [PATCH] fix ST7789 + move VFLip/HFlip tp "Layout" option - release --- components/display/SH1106.c | 12 ++-- components/display/SSD1306.c | 12 ++-- components/display/SSD1322.c | 18 ++--- components/display/SSD132x.c | 24 +++---- components/display/SSD1351.c | 32 ++++----- components/display/ST77xx.c | 83 ++++++++++++++---------- components/display/core/gds.c | 3 +- components/display/core/gds.h | 3 +- components/display/core/gds_private.h | 9 ++- components/display/display.c | 3 +- components/squeezelite/decode_external.c | 1 - components/squeezelite/display.c | 4 +- main/cmd_squeezelite.c | 3 +- 13 files changed, 104 insertions(+), 103 deletions(-) diff --git a/components/display/SH1106.c b/components/display/SH1106.c index 089efa1a..a08a3116 100644 --- a/components/display/SH1106.c +++ b/components/display/SH1106.c @@ -73,8 +73,11 @@ static void Update( struct GDS_Device* Device ) { #endif } -static void SetHFlip( struct GDS_Device* Device, bool On ) { Device->WriteCommand( Device, On ? 0xA1 : 0xA0 ); } -static void SetVFlip( struct GDS_Device *Device, bool On ) { Device->WriteCommand( Device, On ? 0xC8 : 0xC0 ); } +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { + Device->WriteCommand( Device, HFlip ? 0xA1 : 0xA0 ); + Device->WriteCommand( Device, VFlip ? 0xC8 : 0xC0 ); +} + static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAE ); } @@ -117,8 +120,7 @@ static bool Init( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x40 + 0x00 ); Device->SetContrast( Device, 0x7F ); // set flip modes - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + Device->SetLayout( Device, false, false, false ); // no Display Inversion Device->WriteCommand( Device, 0xA6 ); // set Clocks @@ -135,7 +137,7 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device SH1106 = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update, .Init = Init, .Depth = 1, #if !defined SHADOW_BUFFER && defined USE_IRAM diff --git a/components/display/SSD1306.c b/components/display/SSD1306.c index 90eb5afe..eb85e6f3 100644 --- a/components/display/SSD1306.c +++ b/components/display/SSD1306.c @@ -85,8 +85,11 @@ static void Update( struct GDS_Device* Device ) { #endif } -static void SetHFlip( struct GDS_Device* Device, bool On ) { Device->WriteCommand( Device, On ? 0xA1 : 0xA0 ); } -static void SetVFlip( struct GDS_Device *Device, bool On ) { Device->WriteCommand( Device, On ? 0xC8 : 0xC0 ); } +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { + Device->WriteCommand( Device, HFlip ? 0xA1 : 0xA0 ); + Device->WriteCommand( Device, VFlip ? 0xC8 : 0xC0 ); +} + static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAE ); } @@ -129,8 +132,7 @@ static bool Init( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x40 + 0x00 ); Device->SetContrast( Device, 0x7F ); // set flip modes - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + Device->SetLayout( Device, false, false, false); // no Display Inversion Device->WriteCommand( Device, 0xA6 ); // set Clocks @@ -150,7 +152,7 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device SSD1306 = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update, .Init = Init, .Mode = GDS_MONO, .Depth = 1, #if !defined SHADOW_BUFFER && defined USE_IRAM diff --git a/components/display/SSD1322.c b/components/display/SSD1322.c index e2290604..b7d33bb6 100644 --- a/components/display/SSD1322.c +++ b/components/display/SSD1322.c @@ -96,22 +96,15 @@ static void Update( struct GDS_Device* Device ) { #endif } -static void SetHFlip( struct GDS_Device* Device, bool On ) { +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->ReMap = On ? (Private->ReMap & ~(1 << 1)) : (Private->ReMap | (1 << 1)); + Private->ReMap = HFlip ? (Private->ReMap & ~(1 << 1)) : (Private->ReMap | (1 << 1)); + Private->ReMap = VFlip ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); Device->WriteCommand( Device, 0xA0 ); Device->WriteData( Device, &Private->ReMap, 1 ); WriteDataByte( Device, 0x11 ); } -static void SetVFlip( struct GDS_Device *Device, bool On ) { - struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->ReMap = On ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); - Device->WriteCommand( Device, 0xA0 ); - Device->WriteData( Device, &Private->ReMap, 1 ); - WriteDataByte( Device, 0x11 ); -} - static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAE ); } @@ -152,8 +145,7 @@ static bool Init( struct GDS_Device* Device ) { // set flip modes Private->ReMap = 0; - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + Device->SetLayout( Device, false, false, false); // set Clocks Device->WriteCommand( Device, 0xB3 ); @@ -187,7 +179,7 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device SSD1322 = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update, .Init = Init, .Mode = GDS_GRAYSCALE, .Depth = 4, }; diff --git a/components/display/SSD132x.c b/components/display/SSD132x.c index 021e03a3..bec7186d 100644 --- a/components/display/SSD132x.c +++ b/components/display/SSD132x.c @@ -222,22 +222,19 @@ static void DrawBitmapCBR(struct GDS_Device* Device, uint8_t *Data, int Width, i } } -static void SetHFlip( struct GDS_Device* Device, bool On ) { +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - if (Private->Model == SSD1326) Private->ReMap = On ? (Private->ReMap | ((1 << 0) | (1 << 2))) : (Private->ReMap & ~((1 << 0) | (1 << 2))); - else Private->ReMap = On ? (Private->ReMap | ((1 << 0) | (1 << 1))) : (Private->ReMap & ~((1 << 0) | (1 << 1))); + if (Private->Model == SSD1326) { + Private->ReMap = HFlip ? (Private->ReMap | ((1 << 0) | (1 << 2))) : (Private->ReMap & ~((1 << 0) | (1 << 2))); + Private->ReMap = HFlip ? (Private->ReMap | (1 << 1)) : (Private->ReMap & ~(1 << 1)); + } else { + Private->ReMap = VFlip ? (Private->ReMap | ((1 << 0) | (1 << 1))) : (Private->ReMap & ~((1 << 0) | (1 << 1))); + Private->ReMap = VFlip ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); + } Device->WriteCommand( Device, 0xA0 ); Device->WriteCommand( Device, Private->ReMap ); } -static void SetVFlip( struct GDS_Device *Device, bool On ) { - struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - if (Private->Model == SSD1326) Private->ReMap = On ? (Private->ReMap | (1 << 1)) : (Private->ReMap & ~(1 << 1)); - else Private->ReMap = On ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); - Device->WriteCommand( Device, 0xA0 ); - Device->WriteCommand( Device, Private->ReMap ); -} - static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAE ); } @@ -291,8 +288,7 @@ static bool Init( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x00 ); Device->SetContrast( Device, 0x7F ); // set flip modes - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + Device->SetLayout( Device, false, false, false ); // no Display Inversion Device->WriteCommand( Device, 0xA6 ); // set Clocks @@ -316,7 +312,7 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device SSD132x = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update4, .Init = Init, .Mode = GDS_GRAYSCALE, .Depth = 4, }; diff --git a/components/display/SSD1351.c b/components/display/SSD1351.c index a48c7d6c..a7f0440d 100644 --- a/components/display/SSD1351.c +++ b/components/display/SSD1351.c @@ -164,34 +164,31 @@ static void Update24( struct GDS_Device* Device ) { #else // always update by full lines SetColumnAddress( Device, 0, Device->Width - 1); - Device->WriteCommand(Device, ENABLE_WRITE); - for (int r = 0; r < Device->Height; r += Private->PageSize) { - SetRowAddress( Device, r, r + Private->PageSize - 1 ); + for (int r = 0; r < Device->Height; r += min(Private->PageSize, Device->Height - r)) { + int Height = min(Private->PageSize, Device->Height - r); + + SetRowAddress( Device, r, r + Height - 1 ); + Device->WriteCommand(Device, ENABLE_WRITE); + if (Private->iRAM) { - memcpy(Private->iRAM, Device->Framebuffer + r * Device->Width * 3, Private->PageSize * Device->Width * 3 ); - Device->WriteData( Device, Private->iRAM, Private->PageSize * Device->Width * 3 ); + memcpy(Private->iRAM, Device->Framebuffer + r * Device->Width * 3, Height * Device->Width * 3 ); + Device->WriteData( Device, Private->iRAM, Height * Device->Width * 3 ); } else { - Device->WriteData( Device, Device->Framebuffer + r * Device->Width * 3, Private->PageSize * Device->Width * 3 ); + Device->WriteData( Device, Device->Framebuffer + r * Device->Width * 3, Height * Device->Width * 3 ); } } #endif } -static void SetHFlip( struct GDS_Device* Device, bool On ) { +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->ReMap = On ? (Private->ReMap & ~(1 << 1)) : (Private->ReMap | (1 << 1)); + Private->ReMap = HFlip ? (Private->ReMap & ~(1 << 1)) : (Private->ReMap | (1 << 1)); + Private->ReMap = VFlip ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); Device->WriteCommand( Device, 0xA0 ); WriteByte( Device, Private->ReMap ); } -static void SetVFlip( struct GDS_Device *Device, bool On ) { - struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->ReMap = On ? (Private->ReMap | (1 << 4)) : (Private->ReMap & ~(1 << 4)); - Device->WriteCommand( Device, 0xA0 ); - WriteByte( Device, Private->ReMap ); -} - static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAF ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0xAE ); } @@ -242,8 +239,7 @@ static bool Init( struct GDS_Device* Device ) { // set flip modes & contrast Device->SetContrast( Device, 0x7F ); - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + Device->SetLayout( Device, false, false, false ); // set Adressing Mode Horizontal Private->ReMap |= (0 << 2); @@ -265,7 +261,7 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device SSD1351 = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update16, .Init = Init, .Mode = GDS_RGB565, .Depth = 16, }; diff --git a/components/display/ST77xx.c b/components/display/ST77xx.c index 0a4a79a4..8c21dbf5 100644 --- a/components/display/ST77xx.c +++ b/components/display/ST77xx.c @@ -29,6 +29,9 @@ enum { ST7735, ST7789 }; struct PrivateSpace { uint8_t *iRAM, *Shadowbuffer; + struct { + uint16_t Height, Width; + } Offset; uint8_t MADCtl, PageSize; uint8_t Model; }; @@ -75,8 +78,8 @@ static void Update16( struct GDS_Device* Device ) { FirstCol *= 2; LastCol = LastCol * 2 + 1; - SetRowAddress( Device, FirstRow, LastRow ); - SetColumnAddress( Device, FirstCol, LastCol ); + SetRowAddress( Device, FirstRow + Private->Offset.Height, LastRow + Private->Offset.Height); + SetColumnAddress( Device, FirstCol + Private->Offset.Width, LastCol + Private->Offset.Width ); Device->WriteCommand( Device, ENABLE_WRITE ); int ChunkSize = (LastCol - FirstCol + 1) * 2; @@ -100,12 +103,12 @@ static void Update16( struct GDS_Device* Device ) { } #else // always update by full lines - SetColumnAddress( Device, 0, Device->Width - 1); + SetColumnAddress( Device, Private->Offset.Width, Device->Width - 1); for (int r = 0; r < Device->Height; r += min(Private->PageSize, Device->Height - r)) { int Height = min(Private->PageSize, Device->Height - r); - SetRowAddress( Device, r, r + Height - 1 ); + SetRowAddress( Device, Private->Offset.Height + r, Private->Offset.Height + r + Height - 1 ); Device->WriteCommand(Device, ENABLE_WRITE); if (Private->iRAM) { @@ -142,8 +145,8 @@ static void Update24( struct GDS_Device* Device ) { FirstCol = (FirstCol * 2) / 3; LastCol = (LastCol * 2 + 1) / 3; - SetRowAddress( Device, FirstRow, LastRow ); - SetColumnAddress( Device, FirstCol, LastCol ); + SetRowAddress( Device, FirstRow + Private->Offset.Height, LastRow + Private->Offset.Height); + SetColumnAddress( Device, FirstCol + Private->Offset.Width, LastCol + Private->Offset.Width ); Device->WriteCommand( Device, ENABLE_WRITE ); int ChunkSize = (LastCol - FirstCol + 1) * 3; @@ -167,41 +170,55 @@ static void Update24( struct GDS_Device* Device ) { } #else // always update by full lines - SetColumnAddress( Device, 0, Device->Width - 1); - Device->WriteCommand(Device, ENABLE_WRITE); + SetColumnAddress( Device, Private->Offset.Width, Device->Width - 1); - for (int r = 0; r < Device->Height; r += Private->PageSize) { - SetRowAddress( Device, r, r + Private->PageSize - 1 ); + for (int r = 0; r < Device->Height; r += min(Private->PageSize, Device->Height - r)) { + int Height = min(Private->PageSize, Device->Height - r); + + SetRowAddress( Device, Private->Offset.Height + r, Private->Offset.Height + r + Height - 1 ); + Device->WriteCommand(Device, ENABLE_WRITE); + if (Private->iRAM) { - memcpy(Private->iRAM, Device->Framebuffer + r * Device->Width * 3, Private->PageSize * Device->Width * 3 ); - Device->WriteData( Device, Private->iRAM, Private->PageSize * Device->Width * 3 ); + memcpy(Private->iRAM, Device->Framebuffer + r * Device->Width * 3, Height * Device->Width * 3 ); + Device->WriteData( Device, Private->iRAM, Height * Device->Width * 3 ); } else { - Device->WriteData( Device, Device->Framebuffer + r * Device->Width * 3, Private->PageSize * Device->Width * 3 ); + Device->WriteData( Device, Device->Framebuffer + r * Device->Width * 3, Height * Device->Width * 3 ); } } #endif } -static void SetHFlip( struct GDS_Device* Device, bool On ) { +static void SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->MADCtl = On ? (Private->MADCtl & ~(1 << 7)) : (Private->MADCtl | (1 << 7)); + + Private->MADCtl = HFlip ? (Private->MADCtl | (1 << 7)) : (Private->MADCtl & ~(1 << 7)); + Private->MADCtl = VFlip ? (Private->MADCtl | (1 << 6)) : (Private->MADCtl & ~(1 << 6)); + Private->MADCtl = Rotate ? (Private->MADCtl | (1 << 5)) : (Private->MADCtl & ~(1 << 5)); + Device->WriteCommand( Device, 0x36 ); WriteByte( Device, Private->MADCtl ); + + if (Private->Model == ST7789) { + if (Rotate) Private->Offset.Width = HFlip ? 320 - Device->Width : 0; + else Private->Offset.Height = HFlip ? 320 - Device->Height : 0; + } + +#ifdef SHADOW_BUFFER + // force a full refresh (almost ...) + memset(Private->Shadowbuffer, 0xAA, Device->FramebufferSize); +#endif } -static void SetVFlip( struct GDS_Device *Device, bool On ) { - struct PrivateSpace *Private = (struct PrivateSpace*) Device->Private; - Private->MADCtl = On ? (Private->MADCtl | (1 << 6)) : (Private->MADCtl & ~(1 << 6)); - Device->WriteCommand( Device, 0x36 ); - WriteByte( Device, Private->MADCtl ); -} - static void DisplayOn( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x29 ); } static void DisplayOff( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x28 ); } static void SetContrast( struct GDS_Device* Device, uint8_t Contrast ) { Device->WriteCommand( Device, 0x51 ); WriteByte( Device, Contrast ); + + Device->SetContrast = NULL; + GDS_SetContrast( Device, Contrast ); + Device->SetContrast = SetContrast; } static bool Init( struct GDS_Device* Device ) { @@ -209,7 +226,7 @@ static bool Init( struct GDS_Device* Device ) { int Depth = (Device->Depth + 8 - 1) / 8; Private->PageSize = min(8, PAGE_BLOCK / (Device->Width * Depth)); - + #ifdef SHADOW_BUFFER Private->Shadowbuffer = malloc( Device->FramebufferSize ); memset(Private->Shadowbuffer, 0xFF, Device->FramebufferSize); @@ -224,21 +241,21 @@ static bool Init( struct GDS_Device* Device ) { Device->WriteCommand( Device, 0x11 ); // need BGR & Address Mode - Private->MADCtl = (1 << 3) | ((Device->Width > Device->Height ? 1 : 0) << 5); + Private->MADCtl = 1 << 3; Device->WriteCommand( Device, 0x36 ); WriteByte( Device, Private->MADCtl ); // set flip modes & contrast - GDS_SetContrast( Device, 0x7F ); - Device->SetVFlip( Device, false ); - Device->SetHFlip( Device, false ); + GDS_SetContrast( Device, 0x7f ); + Device->SetLayout( Device, false, false, false ); // set screen depth (16/18) Device->WriteCommand( Device, 0x3A ); - WriteByte( Device, Device->Depth == 24 ? 0x06 : 0x05 ); + if (Private->Model == ST7789) WriteByte( Device, Device->Depth == 24 ? 0x066 : 0x55 ); + else WriteByte( Device, Device->Depth == 24 ? 0x06 : 0x05 ); // no Display Inversion - Device->WriteCommand( Device, 0x20 ); + Device->WriteCommand( Device, Private->Model == ST7735 ? 0x20 : 0x21 ); // gone with the wind Device->DisplayOn( Device ); @@ -249,15 +266,15 @@ static bool Init( struct GDS_Device* Device ) { static const struct GDS_Device ST77xx = { .DisplayOn = DisplayOn, .DisplayOff = DisplayOff, - .SetVFlip = SetVFlip, .SetHFlip = SetHFlip, + .SetLayout = SetLayout, .Update = Update16, .Init = Init, .Mode = GDS_RGB565, .Depth = 16, -}; +}; struct GDS_Device* ST77xx_Detect(char *Driver, struct GDS_Device* Device) { uint8_t Model; int Depth; - + if (strcasestr(Driver, "ST7735")) Model = ST7735; else if (strcasestr(Driver, "ST7789")) Model = ST7789; else return NULL; @@ -275,6 +292,6 @@ struct GDS_Device* ST77xx_Detect(char *Driver, struct GDS_Device* Device) { } if (Model == ST7789) Device->SetContrast = SetContrast; - + return Device; } \ No newline at end of file diff --git a/components/display/core/gds.c b/components/display/core/gds.c index e2bccfa0..5c739b72 100644 --- a/components/display/core/gds.c +++ b/components/display/core/gds.c @@ -236,8 +236,7 @@ void GDS_SetContrast( struct GDS_Device* Device, uint8_t Contrast ) { } } -void GDS_SetHFlip( struct GDS_Device* Device, bool On ) { if (Device->SetHFlip) Device->SetHFlip( Device, On ); } -void GDS_SetVFlip( struct GDS_Device* Device, bool On ) { if (Device->SetVFlip) Device->SetVFlip( Device, On ); } +void GDS_SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ) { if (Device->SetLayout) Device->SetLayout( Device, HFlip, VFlip, Rotate ); } void GDS_SetDirty( struct GDS_Device* Device ) { Device->Dirty = true; } int GDS_GetWidth( struct GDS_Device* Device ) { return Device->Width; } int GDS_GetHeight( struct GDS_Device* Device ) { return Device->Height; } diff --git a/components/display/core/gds.h b/components/display/core/gds.h index 952b6609..d79ade04 100644 --- a/components/display/core/gds.h +++ b/components/display/core/gds.h @@ -35,8 +35,7 @@ void GDS_SetContrast( struct GDS_Device* Device, uint8_t Contrast ); void GDS_DisplayOn( struct GDS_Device* Device ); void GDS_DisplayOff( struct GDS_Device* Device ); void GDS_Update( struct GDS_Device* Device ); -void GDS_SetHFlip( struct GDS_Device* Device, bool On ); -void GDS_SetVFlip( struct GDS_Device* Device, bool On ); +void GDS_SetLayout( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ); void GDS_SetDirty( struct GDS_Device* Device ); int GDS_GetWidth( struct GDS_Device* Device ); int GDS_GetHeight( struct GDS_Device* Device ); diff --git a/components/display/core/gds_private.h b/components/display/core/gds_private.h index 09292655..756e1674 100644 --- a/components/display/core/gds_private.h +++ b/components/display/core/gds_private.h @@ -101,7 +101,7 @@ struct GDS_Device { uint8_t Alloc; uint8_t* Framebuffer; - uint16_t FramebufferSize; + uint32_t FramebufferSize; bool Dirty; // default fonts when using direct draw @@ -117,8 +117,7 @@ struct GDS_Device { void (*SetContrast)( struct GDS_Device* Device, uint8_t Contrast ); void (*DisplayOn)( struct GDS_Device* Device ); void (*DisplayOff)( struct GDS_Device* Device ); - void (*SetHFlip)( struct GDS_Device* Device, bool On ); - void (*SetVFlip)( struct GDS_Device* Device, bool On ); + void (*SetLayout)( struct GDS_Device* Device, bool HFlip, bool VFlip, bool Rotate ); // must provide for depth other than 1 (vertical) and 4 (may provide for optimization) void (*DrawPixelFast)( struct GDS_Device* Device, int X, int Y, int Color ); void (*DrawBitmapCBR)(struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color ); @@ -130,8 +129,8 @@ struct GDS_Device { WriteCommandProc WriteCommand; WriteDataProc WriteData; - // 16 bytes for whatever the driver wants (should be aligned as it's 32 bits) - uint32_t Private[4]; + // 32 bytes for whatever the driver wants (should be aligned as it's 32 bits) + uint32_t Private[8]; }; bool GDS_Reset( struct GDS_Device* Device ); diff --git a/components/display/display.c b/components/display/display.c index 575adc04..afc19ccc 100644 --- a/components/display/display.c +++ b/components/display/display.c @@ -119,8 +119,7 @@ void display_init(char *welcome) { static DRAM_ATTR StaticTask_t xTaskBuffer __attribute__ ((aligned (4))); static EXT_RAM_ATTR StackType_t xStack[DISPLAYER_STACK_SIZE] __attribute__ ((aligned (4))); - GDS_SetHFlip(display, strcasestr(config, "HFlip") ? true : false); - GDS_SetVFlip(display, strcasestr(config, "VFlip") ? true : false); + GDS_SetLayout( display, strcasestr(config, "HFlip"), strcasestr(config, "VFlip"), strcasestr(config, "rotate")); GDS_SetFont(display, &Font_droid_sans_fallback_15x17 ); GDS_TextPos(display, GDS_FONT_MEDIUM, GDS_TEXT_CENTERED, GDS_TEXT_CLEAR | GDS_TEXT_UPDATE, welcome); diff --git a/components/squeezelite/decode_external.c b/components/squeezelite/decode_external.c index d76abf75..67336134 100644 --- a/components/squeezelite/decode_external.c +++ b/components/squeezelite/decode_external.c @@ -28,7 +28,6 @@ extern struct buffer *outputbuf; // this is the only system-wide loglevel variable extern log_level loglevel; - static bool enable_bt_sink; static bool enable_airplay; diff --git a/components/squeezelite/display.c b/components/squeezelite/display.c index ee4c8ac1..d83d13f6 100644 --- a/components/squeezelite/display.c +++ b/components/squeezelite/display.c @@ -426,7 +426,7 @@ static void server(in_addr_t ip, u16_t hport, u16_t cport) { */ static bool handler(u8_t *data, int len){ bool res = true; - + if (!strncmp((char*) data, "vfdc", 4)) { vfdc_handler(data, len); } else if (!strncmp((char*) data, "grfe", 4)) { @@ -444,7 +444,7 @@ static bool handler(u8_t *data, int len){ } else { res = false; } - + // chain protocol handlers (bitwise or is fine) if (*slimp_handler_chain) res |= (*slimp_handler_chain)(data, len); diff --git a/main/cmd_squeezelite.c b/main/cmd_squeezelite.c index 0399ae2f..e46a52a0 100644 --- a/main/cmd_squeezelite.c +++ b/main/cmd_squeezelite.c @@ -69,10 +69,11 @@ static void * squeezelite_thread(){ ESP_LOGV(TAG ,"Freeing argv pointer"); free(thread_parms.argv); isRunning=false; - ESP_LOGE(TAG, "Exited from squeezelite thread, something's wrong ... rebooting"); + ESP_LOGE(TAG, "Exited from squeezelite thread, something's wrong ... rebooting (wait 30s for user to take action)"); if(!wait_for_commit()){ ESP_LOGW(TAG,"Unable to commit configuration. "); } + vTaskDelay( pdMS_TO_TICKS( 30*1000 ) ); esp_restart(); return NULL; }