Fix universal display driver too early power control

This commit is contained in:
Theo Arends 2023-02-04 18:24:21 +01:00
parent cfd34aa02c
commit 36b9e4ab78
2 changed files with 5 additions and 16 deletions

View File

@ -1838,21 +1838,14 @@ void DisplayLocalSensor(void)
* Public
\*********************************************************************************************/
void DisplayInitDriver(void) {
uint8_t devices_present = TasmotaGlobal.devices_present; // Save devices_present
TasmotaGlobal.devices_present++;
if (!PinUsed(GPIO_BACKLIGHT)) {
if (TasmotaGlobal.light_type && (4 == Settings->display_model)) {
TasmotaGlobal.devices_present--; // Assume PWM channel is used for backlight
}
}
disp_device = TasmotaGlobal.devices_present; // Set display device
void DisplayInitDriver(void)
{
XdspCall(FUNC_DISPLAY_INIT_DRIVER);
// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings->display_model);
if (Settings->display_model) {
// ApplyDisplayDimmer(); // Not allowed here. Way too early in initi sequence. IE power state has not even been set at this point in time
#ifdef USE_MULTI_DISPLAY
Set_display(0);
@ -1881,7 +1874,6 @@ void DisplayInitDriver(void) {
for (uint8_t count = 0; count < NUM_GRAPHS; count++) { graph[count] = 0; }
#endif
/*
TasmotaGlobal.devices_present++;
if (!PinUsed(GPIO_BACKLIGHT)) {
if (TasmotaGlobal.light_type && (4 == Settings->display_model)) {
@ -1889,16 +1881,12 @@ void DisplayInitDriver(void) {
}
}
disp_device = TasmotaGlobal.devices_present;
*/
#ifndef USE_DISPLAY_MODES1TO5
Settings->display_mode = 0;
#else
DisplayLogBufferInit();
#endif // USE_DISPLAY_MODES1TO5
} else {
TasmotaGlobal.devices_present = devices_present; // Restore devices_present
disp_device = 0;
}
}
@ -2021,6 +2009,7 @@ void ApplyDisplayDimmer(void) {
// still call Berry virtual display in case it is not managed entirely by renderer
Xdsp18(FUNC_DISPLAY_DIM);
#endif // USE_BERRY
} else {
XdspCall(FUNC_DISPLAY_DIM);
}

View File

@ -436,7 +436,7 @@ int8_t cs;
Settings->display_width = renderer->width();
Settings->display_height = renderer->height();
ApplyDisplayDimmer();
// ApplyDisplayDimmer(); // Not allowed here. Way too early in initi sequence. IE power state has not even been set at this point in time
#ifdef SHOW_SPLASH
if (!Settings->flag5.display_no_splash) {