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

switchFrame vs setUnicodeFontX2? #41

Closed
outdever opened this issue Jan 25, 2022 · 4 comments
Closed

switchFrame vs setUnicodeFontX2? #41

outdever opened this issue Jan 25, 2022 · 4 comments

Comments

@outdever
Copy link

Hello. There is a need to use both of these functions together. When applied at the same time, the first area is not drawn. Example of non-working code:

#define TINY4KOLED_NO_PRINT
#define SDA_PIN 6
#define SCL_PIN 4

#include <Tiny4kOLED_bitbang.h>
//#include <USIWire.h>
//#include <Tiny4kOLED.h>

uint8_t width = 128;
uint8_t height = 32;


// Fonts from this TinyOLED-Fonts library

// 2386 bytes in font + 3184 bytes for the program = 5570 byte total
#include "Open_Sans_Light_13_5_Unicode.h"
const DCUnicodeFont *currentFont = FONTOPENSANSLIGHT135;
//#define SAMPLE "Кириллические\nшрифты.\n"
#define SAMPLE "ЗАРЯД\n"

uint8_t currentCharacter;
uint8_t prc=0;

void setup() {
  // put your setup code here, to run once:
  oled.begin(width, height, sizeof(tiny4koled_init_128x32br), tiny4koled_init_128x32br);
 
  //oled.begin(128, 64, sizeof(tiny4koled_init_defaults), tiny4koled_init_defaults);
  oled.enableChargePump();
  oled.setRotation(1);
  oled.setUnicodeFont(currentFont);
  //oled.setUnicodeFontX2(currentFont);
  
  oled.on();
  oled.switchRenderFrame();
}

void loop() {
  drawScreen();
  delay(500);
  oled.switchFrame();
  //while(1);
}

void drawScreen() {
  //oled.setCursor(0, 0);
  oled.clear();
  oled.setUnicodeFontX2Smooth(currentFont);
  oled.setCursor(0, 0);
  
#ifndef TINY4KOLED_NO_PRINT
  oled.println(F(SAMPLE));

#else
  PGM_P p = reinterpret_cast<PGM_P>(F(SAMPLE));
  while (1) {
    byte c = pgm_read_byte(p++);
    if (c == 0) break;
    oled.write(c);
  }
#endif
}
@datacute
Copy link
Owner

Thanks for reporting that. I think I know the reason, and will work on a fix.

@datacute
Copy link
Owner

@outdever can you please test with version 2.2.2?

@outdever
Copy link
Author

outdever commented Jan 26, 2022 via email

@outdever
Copy link
Author

Thank you very much! Everything works great

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