diff --git a/lib/lv_drivers/display/monitor.h b/lib/lv_drivers/display/monitor.h index 9156c32a..b8f618de 100644 --- a/lib/lv_drivers/display/monitor.h +++ b/lib/lv_drivers/display/monitor.h @@ -43,7 +43,10 @@ extern "C" { void monitor_init(void); void monitor_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p); void monitor_flush2(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p); + +// HASP Customized functions void monitor_backlight(uint8_t level); +void monitor_title(const char* title); /********************** * MACROS diff --git a/src/dev/esp32/esp32.cpp b/src/dev/esp32/esp32.cpp index bc9bb28a..f9ef5ff1 100644 --- a/src/dev/esp32/esp32.cpp +++ b/src/dev/esp32/esp32.cpp @@ -42,7 +42,7 @@ const char* Esp32Device::get_display_driver() void Esp32Device::set_backlight_pin(uint8_t pin) { - Esp32Device::_backlight_pin = pin; + _backlight_pin = pin; /* Setup Backlight Control Pin */ if(pin < GPIO_NUM_MAX) { @@ -81,7 +81,7 @@ bool Esp32Device::get_backlight_power() void Esp32Device::update_backlight() { - if(pin < GPIO_NUM_MAX) { + if(_backlight_pin < GPIO_NUM_MAX) { uint32_t duty = _backlight_power ? map(_backlight_level, 0, 100, 0, 4095) : 0; ledcWrite(BACKLIGHT_CHANNEL, duty); // ledChannel and value } diff --git a/src/dev/win32/hasp_win32.cpp b/src/dev/win32/hasp_win32.cpp index 7654e2e2..c75f36dc 100644 --- a/src/dev/win32/hasp_win32.cpp +++ b/src/dev/win32/hasp_win32.cpp @@ -40,9 +40,13 @@ void Win32Device::set_backlight_pin(uint8_t pin) void Win32Device::set_backlight_level(uint8_t level) { - _backlight_level = level >= 0 ? level : 0; - _backlight_level = _backlight_level <= 100 ? _backlight_level : 100; - update_backlight(); + uint8_t new_level = level >= 0 ? level : 0; + new_level = new_level <= 100 ? new_level : 100; + + if(_backlight_level != new_level) { + _backlight_level = new_level; + update_backlight(); + } } uint8_t Win32Device::get_backlight_level() diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index 7c920419..bf2c2dcb 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -897,32 +897,20 @@ void dispatch_output_statusupdate(const char*, const char*) { char buffer[128]; - printf("%s %d\n", __FILE__, __LINE__); - fflush(stdout); - haspGetVersion(buffer, sizeof(buffer)); snprintf_P(data, sizeof(data), PSTR("{\"node\":\"%s\",\"status\":\"available\",\"version\":\"%s\",\"uptime\":%lu,"), haspDevice.get_hostname(), buffer, long(millis() / 1000)); - printf("%s %d\n", __FILE__, __LINE__); - fflush(stdout); - #if HASP_USE_WIFI > 0 network_get_statusupdate(buffer, sizeof(buffer)); strcat(data, buffer); #endif - printf("%s %d\n", __FILE__, __LINE__); - fflush(stdout); - snprintf_P(buffer, sizeof(buffer), PSTR("\"heapFree\":%u,\"heapFrag\":%u,\"espCore\":\"%s\","), haspDevice.get_free_heap(), haspDevice.get_heap_fragmentation(), haspDevice.get_core_version()); strcat(data, buffer); - printf("%s %d\n", __FILE__, __LINE__); - fflush(stdout); - snprintf_P(buffer, sizeof(buffer), PSTR("\"espCanUpdate\":\"false\",\"page\":%u,\"numPages\":%u,"), haspGetPage(), (HASP_NUM_PAGES)); strcat(data, buffer); @@ -932,9 +920,6 @@ void dispatch_output_statusupdate(const char*, const char*) strcat(data, buffer); #endif - printf("%s %d\n", __FILE__, __LINE__); - fflush(stdout); - snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"), haspDevice.get_display_driver(), (TFT_WIDTH), (TFT_HEIGHT)); strcat(data, buffer); @@ -1019,7 +1004,7 @@ void dispatchSetup() void dispatchLoop() { - // Not used + lv_task_handler(); // process animations } #if 1 || ARDUINO diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index 9b3cc7ff..cc9f2706 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -205,6 +205,7 @@ void guiSetup(void) /* Setup Backlight Control Pin */ haspDevice.set_backlight_pin(gui_settings.backlight_pin); + // if(gui_settings.backlight_pin >= 0) { // LOG_VERBOSE(TAG_GUI, F("Backlight : Pin %d"), gui_settings.backlight_pin); @@ -290,7 +291,6 @@ void guiLoop(void) // tick.update(); #endif - lv_task_handler(); // process animations #if !defined(WINDOWS) drv_touch_loop(); // update touch #endif