Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to center my bitmap with 128x64 oled screen? #64

Open
Naografix opened this issue Jun 30, 2024 · 1 comment
Open

How to center my bitmap with 128x64 oled screen? #64

Naografix opened this issue Jun 30, 2024 · 1 comment

Comments

@Naografix
Copy link

Naografix commented Jun 30, 2024

Hey,

I'm trying your amazing lib to my oled 128x64 screen and my ATTINY85 but I have a little problem with battery animation, take a look:

448740887_903720268228729_997421146227043813_n

How can I center my bitmap? I tried to increase the Y but it not work.
It seems I have a problem with a double buffer...

#include <Tiny4kOLED.h>
#include "SolomonSystech.h"
 
const uint8_t* batteryImages[] = {battery1, battery2, battery3, batteryfull};
int index = 0;

void setup() {  
  Serial.begin(9600);
  oled.begin(128, 64, sizeof(tiny4koled_init_128x64r), tiny4koled_init_128x64r); 
  oled.clear();   
  oled.on();  
  oled.switchRenderFrame();
} 

void loop() {
  index = (index + 1) % 4;
  oled.bitmap(32, 2, 95, 5, batteryImages[index]);
  delay(500);
}

Thanks for your help

@datacute
Copy link
Owner

datacute commented Jul 1, 2024

Don't call oled.switchRenderFrame();
That's for choosing which half of the memory to show on 128x32 displays.
On a 128x64 display, you typically want to display all the memory all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants