Tiny4kOLED icon indicating copy to clipboard operation
Tiny4kOLED copied to clipboard

How to center my bitmap with 128x64 oled screen?

Open Naografix opened this issue 1 year ago • 1 comments

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

Naografix avatar Jun 30 '24 15:06 Naografix

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.

datacute avatar Jul 01 '24 04:07 datacute