From 397d280c3bdf524134726f644111108a3bc1f5f9 Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:25:31 +0100 Subject: [PATCH 1/3] stop OLED powering on every message if connected to phone --- examples/companion_radio/ui-new/UITask.cpp | 9 ++++++++- examples/companion_radio/ui-orig/UITask.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 7c75a0892..886823ff8 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -596,9 +596,16 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i setCurrScreen(msg_preview); if (_display != NULL) { - if (!_display->isOn()) _display->turnOn(); + // Only turn on display if it's off AND not connected to phone via BLE + // If connected to phone, user will see messages there, so don't wake the OLED + if (!_display->isOn() && !hasConnection()) { + _display->turnOn(); + } + // Always extend auto-off timer and trigger refresh if display is on + if (_display->isOn()) { _auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer _next_refresh = 100; // trigger refresh + } } } diff --git a/examples/companion_radio/ui-orig/UITask.cpp b/examples/companion_radio/ui-orig/UITask.cpp index 045c955d3..20d45bec7 100644 --- a/examples/companion_radio/ui-orig/UITask.cpp +++ b/examples/companion_radio/ui-orig/UITask.cpp @@ -136,9 +136,16 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i StrHelper::strncpy(_msg, text, sizeof(_msg)); if (_display != NULL) { - if (!_display->isOn()) _display->turnOn(); + // Only turn on display if it's off AND not connected to phone via BLE + // If connected to phone, user will see messages there, so don't wake the OLED + if (!_display->isOn() && !hasConnection()) { + _display->turnOn(); + } + // Always extend auto-off timer and trigger refresh if display is on + if (_display->isOn()) { _auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer _need_refresh = true; + } } } From eae16cfc5f0690cb20bcce92918c04f39d348e9c Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:39:35 +0100 Subject: [PATCH 2/3] less unnecessary comments, less lines of code :) --- examples/companion_radio/ui-new/UITask.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 886823ff8..27734135d 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -596,12 +596,9 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i setCurrScreen(msg_preview); if (_display != NULL) { - // Only turn on display if it's off AND not connected to phone via BLE - // If connected to phone, user will see messages there, so don't wake the OLED if (!_display->isOn() && !hasConnection()) { _display->turnOn(); } - // Always extend auto-off timer and trigger refresh if display is on if (_display->isOn()) { _auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer _next_refresh = 100; // trigger refresh From 99a34731693432e844db03622ded3b739de705dc Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:41:11 +0100 Subject: [PATCH 3/3] even less comments \o/ --- examples/companion_radio/ui-orig/UITask.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/companion_radio/ui-orig/UITask.cpp b/examples/companion_radio/ui-orig/UITask.cpp index 20d45bec7..3b36e45dc 100644 --- a/examples/companion_radio/ui-orig/UITask.cpp +++ b/examples/companion_radio/ui-orig/UITask.cpp @@ -136,12 +136,9 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i StrHelper::strncpy(_msg, text, sizeof(_msg)); if (_display != NULL) { - // Only turn on display if it's off AND not connected to phone via BLE - // If connected to phone, user will see messages there, so don't wake the OLED if (!_display->isOn() && !hasConnection()) { _display->turnOn(); } - // Always extend auto-off timer and trigger refresh if display is on if (_display->isOn()) { _auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer _need_refresh = true;