mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-05-02 11:29:49 +01:00
scroller correction + JPEG improvements
This commit is contained in:
@@ -21,6 +21,10 @@
|
||||
|
||||
static char TAG[] = "SSD1306";
|
||||
|
||||
struct SSD1306_Private {
|
||||
uint8_t *Shadowbuffer;
|
||||
};
|
||||
|
||||
// Functions are not deckared to minimize # of lines
|
||||
|
||||
static void SetColumnAddress( struct GDS_Device* Device, uint8_t Start, uint8_t End ) {
|
||||
@@ -36,9 +40,10 @@ static void SetPageAddress( struct GDS_Device* Device, uint8_t Start, uint8_t En
|
||||
|
||||
static void Update( struct GDS_Device* Device ) {
|
||||
#ifdef SHADOW_BUFFER
|
||||
struct SSD1306_Private *Private = (struct SSD1306_Private*) Device->Private;
|
||||
// not sure the compiler does not have to redo all calculation in for loops, so local it is
|
||||
int width = Device->Width, rows = Device->Height / 8;
|
||||
uint8_t *optr = Device->Shadowbuffer, *iptr = Device->Framebuffer;
|
||||
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
|
||||
@@ -54,7 +59,6 @@ static void Update( struct GDS_Device* Device ) {
|
||||
|
||||
// now update the display by "byte rows"
|
||||
if (first--) {
|
||||
|
||||
// only set column when useful, saves a fair bit of CPU
|
||||
if (first > FirstCol && first <= FirstCol + 4 && last < LastCol && last >= LastCol - 4) {
|
||||
first = FirstCol;
|
||||
@@ -70,7 +74,7 @@ static void Update( struct GDS_Device* Device ) {
|
||||
CurrentRow = r + 1;
|
||||
|
||||
// actual write
|
||||
Device->WriteData( Device, Device->Shadowbuffer + r*width + first, last - first + 1);
|
||||
Device->WriteData( Device, Private->Shadowbuffer + r*width + first, last - first + 1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -94,17 +98,18 @@ static void SetContrast( struct GDS_Device* Device, uint8_t Contrast ) {
|
||||
static bool Init( struct GDS_Device* Device ) {
|
||||
Device->FramebufferSize = ( Device->Width * Device->Height ) / 8;
|
||||
|
||||
// benchmarks showed little gain to have SPI memory already in IRAL vs letting driver copy
|
||||
// benchmarks showed little gain to have SPI memory already in IRAL vs letting driver copy
|
||||
#ifdef SHADOW_BUFFER
|
||||
struct SSD1306_Private *Private = (struct SSD1306_Private*) Device->Private;
|
||||
Device->Framebuffer = calloc( 1, Device->FramebufferSize );
|
||||
NullCheck( Device->Framebuffer, return false );
|
||||
#ifdef USE_IRAM
|
||||
if (Device->IF == IF_SPI) Device->Shadowbuffer = heap_caps_malloc( Device->FramebufferSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA );
|
||||
if (Device->IF == IF_SPI) Private->Shadowbuffer = heap_caps_malloc( Device->FramebufferSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA );
|
||||
else
|
||||
#endif
|
||||
Device->Shadowbuffer = malloc( Device->FramebufferSize );
|
||||
NullCheck( Device->Shadowbuffer, return false );
|
||||
memset(Device->Shadowbuffer, 0xFF, Device->FramebufferSize);
|
||||
Private->Shadowbuffer = malloc( Device->FramebufferSize );
|
||||
NullCheck( Private->Shadowbuffer, return false );
|
||||
memset(Private->Shadowbuffer, 0xFF, Device->FramebufferSize);
|
||||
#else // not SHADOW_BUFFER
|
||||
#ifdef USE_IRAM
|
||||
// benchmarks showed little gain to have SPI memory already in IRAL vs letting driver copy
|
||||
|
||||
Reference in New Issue
Block a user