From 1df6262d58969610a02adf9e32f57716a63cdeaa Mon Sep 17 00:00:00 2001 From: akalinin-softvelum <142931037+akalinin-softvelum@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:21:11 +0000 Subject: [PATCH] companion: enable e-ink refresh loop only with EINK_REFRESH_LOOP Only builds that define EINK_REFRESH_LOOP install the busy hook; for now the T-Echo companion BLE/USB envs. --- examples/companion_radio/main.cpp | 6 ++++-- variants/lilygo_techo/platformio.ini | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 9ed3bdcd7..cfc2b2bf9 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -132,7 +132,7 @@ void halt() { bool wifi_enabled = false; // set at boot from prefs; false also when the effective SSID is blank #endif -#ifdef DISPLAY_CLASS +#if defined(DISPLAY_CLASS) && defined(EINK_REFRESH_LOOP) static void loopDuringDisplayRefresh(); #endif @@ -288,7 +288,9 @@ void setup() { #ifdef DISPLAY_CLASS ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved the_mesh.setListener(&ui_task); +#ifdef EINK_REFRESH_LOOP if (disp != NULL) disp->setBusyHook(loopDuringDisplayRefresh); +#endif #endif board.onBootComplete(); @@ -302,7 +304,7 @@ static void loopCore() { sensors.loop(); } -#ifdef DISPLAY_CLASS +#if defined(DISPLAY_CLASS) && defined(EINK_REFRESH_LOOP) // Runs from inside the e-ink busy wait, so radio/BLE/sensors keep going during a panel refresh. // Must not touch the display: UI listener callbacks only update state and schedule the next frame. static void loopDuringDisplayRefresh() { diff --git a/variants/lilygo_techo/platformio.ini b/variants/lilygo_techo/platformio.ini index 896e42a65..2c2a3e430 100644 --- a/variants/lilygo_techo/platformio.ini +++ b/variants/lilygo_techo/platformio.ini @@ -93,6 +93,7 @@ build_flags = ${LilyGo_T-Echo.build_flags} -I src/helpers/ui -I examples/companion_radio/ui-new + -D EINK_REFRESH_LOOP -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -D QSPIFLASH=1 @@ -120,6 +121,7 @@ build_flags = ${LilyGo_T-Echo.build_flags} -I src/helpers/ui -I examples/companion_radio/ui-new + -D EINK_REFRESH_LOOP -D MAX_CONTACTS=350 -D MAX_GROUP_CHANNELS=40 -D OFFLINE_QUEUE_SIZE=256