diff --git a/Tactility/Source/service/displayidle/DisplayIdle.cpp b/Tactility/Source/service/displayidle/DisplayIdle.cpp index 8add6b92..94daafff 100644 --- a/Tactility/Source/service/displayidle/DisplayIdle.cpp +++ b/Tactility/Source/service/displayidle/DisplayIdle.cpp @@ -25,13 +25,20 @@ class DisplayIdleService final : public Service { // Settings are now cached and event-driven (no file I/O in timer callback!) // This prevents watchdog timeout from blocking the Timer Service task + if (lv_disp_get_default() == nullptr) { + return; + } + // Query LVGL inactivity once for both checks uint32_t inactive_ms = 0; if (lvgl::lock(100)) { inactive_ms = lv_disp_get_inactive_time(nullptr); lvgl::unlock(); + } else { + return; } + // TODO: The following logic only works with the first display. There might be multiple displays. // Handle display backlight auto display = getDisplay(); if (display != nullptr && display->supportsBacklightDuty()) { diff --git a/TactilityC/Private/symbols/string.h b/TactilityC/Private/symbols/string.h new file mode 100644 index 00000000..e9d6a12b --- /dev/null +++ b/TactilityC/Private/symbols/string.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +extern const esp_elfsym string_symbols[]; diff --git a/TactilityC/Source/symbols/string.cpp b/TactilityC/Source/symbols/string.cpp new file mode 100644 index 00000000..f560855c --- /dev/null +++ b/TactilityC/Source/symbols/string.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include + +extern "C" void _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcjPKcjj(void*, char*, unsigned int, char const*, unsigned int, unsigned int); + +const esp_elfsym string_symbols[] = { + // Note: You have to use the mangled names here + { "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcjPKcjj", (void*)&_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcjPKcjj}, + // { "", (void*)&(std::) }, + // delimiter + ESP_ELFSYM_END +}; diff --git a/TactilityC/Source/tt_init.cpp b/TactilityC/Source/tt_init.cpp index d92157b6..30c9a766 100644 --- a/TactilityC/Source/tt_init.cpp +++ b/TactilityC/Source/tt_init.cpp @@ -25,6 +25,7 @@ #include "symbols/esp_http_client.h" #include "symbols/pthread.h" #include "symbols/stl.h" +#include "symbols/string.h" #include "symbols/cplusplus.h" #include "symbols/freertos.h" #ifndef CONFIG_IDF_TARGET_ESP32P4 @@ -633,10 +634,11 @@ uintptr_t tt_symbol_resolver(const char* symbolName) { #endif stl_symbols, cplusplus_symbols, - esp_event_symbols, - esp_http_client_symbols, pthread_symbols, freertos_symbols, + string_symbols, + esp_event_symbols, + esp_http_client_symbols, }; for (const auto* symbols : all_symbols) {