Skip to content

Display buffer returned by getBuffer() method #200

@alexpeissel

Description

@alexpeissel

Hi all!

Is there a canonical way of 'restoring' display contents from a dumped buffer?

My current attempt looks like the following, (from an STM32 board connected to an 128x32 OLED over I2C):

// Our duplicate buffer
static uint8_t displayBuffer[(SCREEN_WIDTH * SCREEN_HEIGHT + 7) / 8];

// ...draw bitmaps, images, etc and show with display.display();...

// Copy over the contents of the display buffer to the duplicate
memcpy(displayBuffer, display.getBuffer(), sizeof(displayBuffer));

// Write out the buffer
display.drawBitmap(0, 0, displayBuffer, 128, 32, WHITE);

I then get garbled output on the screen, but it seems to be consistent based on the display content at the time memcpy is called.

My first take on this would be if there should be some way to set the buffer directly, similar to this PR: here. Alternately, does something need to be done with the displayBuffer to play nicely with the drawBitmap method?

To close, I believe this is worthy of an issue as it would close/complement the getBuffer use-case.

Any pointers or suggestions would be great; thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions