diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index bba40257a..66ab35bac 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -52,11 +52,28 @@ int8_t uDisplay::color_type(void) { return col_type; } - uDisplay::~uDisplay(void) { - if (framebuffer) { - free(framebuffer); +#ifdef UDSP_DEBUG + Serial.printf("dealloc\n"); +#endif + if (frame_buffer) { + free(frame_buffer); } + + if (lut_full) { + free(lut_full); + } + + if (lut_partial) { + free(lut_partial); + } + + for (uint16_t cnt = 0; cnt < MAX_LUTS; cnt++ ) { + if (lut_array[cnt]) { + free(lut_array[cnt]); + } + } + #ifdef USE_ESP32_S3 if (_dmadesc) { heap_caps_free(_dmadesc); @@ -66,18 +83,6 @@ uDisplay::~uDisplay(void) { if (_i80_bus) { esp_lcd_del_i80_bus(_i80_bus); } - - if (lut_full) { - free(lut_full); - } - if (lut_partial) { - free(lut_partial); - } - for (uint16_t cnt = 0; cnt < MAX_LUTS; cnt++ ) { - if (lut_array[cnt]) { - free(lut_array[cnt]); - } - } #endif // USE_ESP32_S3 } @@ -124,7 +129,10 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { for (uint32_t cnt = 0; cnt < MAX_LUTS; cnt++) { lut_cnt[cnt] = 0; lut_cmd[cnt] = 0xff; + lut_array[cnt] = 0; } + lut_partial = 0; + lut_full = 0; char linebuff[128]; while (*lp) { @@ -498,7 +506,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { } #ifdef UDSP_DEBUG - + Serial.printf("Device : %s\n", dname); Serial.printf("xs : %d\n", gxs); Serial.printf("ys : %d\n", gys); Serial.printf("bpp: %d\n", bpp); @@ -635,6 +643,10 @@ void uDisplay::delay_arg(uint32_t args) { #define EP_SEND_DATA 0x66 #define EP_CLR_FRAME 0x67 #define EP_SEND_FRAME 0x68 +#define EP_BREAK_RR_EQU 0x69 +#define EP_BREAK_RR_NEQ 0x6a + +extern int32_t ESP_ResetInfoReason(); void uDisplay::send_spi_cmds(uint16_t cmd_offset, uint16_t cmd_size) { uint16_t index = 0; @@ -692,6 +704,26 @@ uint16_t index = 0; case EP_SEND_FRAME: SetFrameMemory(framebuffer); break; + case EP_BREAK_RR_EQU: + if (args & 1) { + iob = dsp_cmds[cmd_offset++]; + index++; + if (iob == ESP_ResetInfoReason()) { + ep_update_mode = DISPLAY_INIT_PARTIAL; + goto exit; + } + } + break; + case EP_BREAK_RR_NEQ: + if (args & 1) { + iob = dsp_cmds[cmd_offset++]; + index++; + if (iob != ESP_ResetInfoReason()) { + ep_update_mode = DISPLAY_INIT_PARTIAL; + goto exit; + } + } + break; } #ifdef UDSP_DEBUG if (args & 1) { @@ -731,9 +763,12 @@ uint16_t index = 0; } if (index >= cmd_size) break; } + +exit: #ifdef UDSP_DEBUG Serial.printf("end send cmd table\n"); #endif + return; } Renderer *uDisplay::Init(void) { @@ -756,6 +791,7 @@ Renderer *uDisplay::Init(void) { } #endif // ESP8266 } + frame_buffer = framebuffer; if (interface == _UDSP_I2C) { if (wire_n == 0) { diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h index de5a8479c..2f11044f1 100755 --- a/lib/lib_display/UDisplay/uDisplay.h +++ b/lib/lib_display/UDisplay/uDisplay.h @@ -301,6 +301,7 @@ class uDisplay : public Renderer { uint8_t lut_siz_full; uint8_t *lut_partial; uint8_t lut_siz_partial; + uint8_t *frame_buffer; uint8_t epcoffs_full; uint8_t epc_full_cnt; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index bac7dd575..ecfc0d418 100755 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -4124,6 +4124,10 @@ extern void W8960_SetGain(uint8_t sel, uint16_t value); } goto strexit; } + if (!strncmp(lp, "rrsn", 4)) { + fvar = ESP_ResetInfoReason(); + goto exit; + } if (!strncmp(lp, "rax", 3)) { TasmotaGlobal.no_autoexec = 0; goto exit; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino b/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino index 547fdde95..05bc7db16 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino @@ -636,7 +636,9 @@ void DisplayText(void) model = Settings->display_model; fp.read((uint8_t*)fdesc, size); fp.close(); + Renderer *svptr = renderer; Get_display(temp); + renderer = svptr; if (rot >= 0) { srot = Settings->display_rotate; Settings->display_rotate = rot; @@ -646,7 +648,7 @@ void DisplayText(void) Settings->display_rotate = srot; } Set_display(temp); - AddLog(LOG_LEVEL_INFO, PSTR("DSP: File descriptor loaded %x"),renderer); + AddLog(LOG_LEVEL_INFO, PSTR("DSP: File descriptor loaded")); free(fdesc); Settings->display_model = model; }