Optional OLED splash screen and fixed OLED i2c execution time saving (#12294)
* Made OLED splash screen optional to reduce memory and fixed OLED i2c execution time saving * moved OLED address updates into their respective conditional checks
This commit is contained in:
parent
a913db63aa
commit
6e1ed1c9d3
1 changed files with 16 additions and 11 deletions
|
@ -70,7 +70,10 @@ static uint8_t micro_oled_screen_current[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||||
D6 D6.............D6 /
|
D6 D6.............D6 /
|
||||||
D7 D7.............D7 ----
|
D7 D7.............D7 ----
|
||||||
*/
|
*/
|
||||||
|
#ifdef NO_LCD_SPLASH
|
||||||
|
// do not initialize with a splash screen
|
||||||
|
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||||
|
#else
|
||||||
# if LCDWIDTH == 64
|
# if LCDWIDTH == 64
|
||||||
# if LCDHEIGHT == 48
|
# if LCDHEIGHT == 48
|
||||||
static uint8_t micro_oled_screen_buffer[] = {
|
static uint8_t micro_oled_screen_buffer[] = {
|
||||||
|
@ -104,6 +107,7 @@ static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0x00, 0x00,
|
||||||
// catchall for custom screen sizes
|
// catchall for custom screen sizes
|
||||||
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void micro_oled_init(void) {
|
void micro_oled_init(void) {
|
||||||
i2c_init();
|
i2c_init();
|
||||||
|
@ -145,7 +149,7 @@ void micro_oled_init(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
send_command(MEMORYMODE);
|
send_command(MEMORYMODE);
|
||||||
send_command(0x10);
|
send_command(0x02); // 0x02 = 10b, Page addressing mode
|
||||||
|
|
||||||
send_command(SETCOMPINS); // 0xDA
|
send_command(SETCOMPINS); // 0xDA
|
||||||
if (LCDHEIGHT > 32) {
|
if (LCDHEIGHT > 32) {
|
||||||
|
@ -250,13 +254,14 @@ void send_buffer(void) {
|
||||||
if (micro_oled_screen_buffer[i * LCDWIDTH + j] != micro_oled_screen_current[i * LCDWIDTH + j]) {
|
if (micro_oled_screen_buffer[i * LCDWIDTH + j] != micro_oled_screen_current[i * LCDWIDTH + j]) {
|
||||||
if (page_addr != i) {
|
if (page_addr != i) {
|
||||||
set_page_address(i);
|
set_page_address(i);
|
||||||
|
page_addr = i;
|
||||||
}
|
}
|
||||||
if (col_addr != j) {
|
if (col_addr != j) {
|
||||||
set_column_address(j);
|
set_column_address(j);
|
||||||
|
col_addr = j + 1;
|
||||||
}
|
}
|
||||||
send_data(micro_oled_screen_buffer[i * LCDWIDTH + j]);
|
send_data(micro_oled_screen_buffer[i * LCDWIDTH + j]);
|
||||||
micro_oled_screen_current[i * LCDWIDTH + j] = micro_oled_screen_buffer[i * LCDWIDTH + j];
|
micro_oled_screen_current[i * LCDWIDTH + j] = micro_oled_screen_buffer[i * LCDWIDTH + j];
|
||||||
col_addr = j + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue