From 70ff8e55ba6f97ce77b84f74dff405575148a0f0 Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Wed, 26 Aug 2026 09:02:56 +0200 Subject: [PATCH] Power-on indicator: flash the green LED while the screen is dark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the display doesn't stay lit — any backlight mode where the screen goes dark, including "None" — the green LED now flashes for 100 ms every 3 s, so a dark screen doesn't leave you wondering whether the radio is still switched on. The flash stands down whenever the LEDs are already in use: while receiving (DMR slot RX or an analog/digital signal), while transmitting, and while muted (which flashes the red LED instead). On standing down it restores the green LED to the current RX state, matching the existing mute-indicator handling. Writes go through LedWrite(), so the CPS "all LEDs disabled" option still applies. Docs (README, MANUAL, CHANGELOG) updated. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01JCK7s3WnwRHZNtQLdyyWBu --- CHANGELOG.md | 6 +++- MANUAL.md | 8 +++++ .../application/source/applicationMain.c | 31 +++++++++++++++++++ README.md | 3 ++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c50be..92dc17f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,11 @@ single running list until the first versioned release. ## Unreleased -_Nothing yet._ +- **Power-on indicator** — when the display doesn't stay lit (any backlight mode + where the screen goes dark, including **None**), the green LED flashes for + **100 ms every 3 s** so it's obvious the radio is still switched on. The flash + pauses whenever the LEDs are already in use: while receiving, while + transmitting, and while muted (which flashes the red LED instead). ## 0.12.0 diff --git a/MANUAL.md b/MANUAL.md index 1b34e88..85f6eed 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -99,6 +99,14 @@ fixed. Every element (S-meter, frequencies, menus) follows the selected theme. ### Mute indicator — 🟢 [FreeTRX] While muted, the **red LED flashes** (0.5 s every 2 s). See *Mute* below. +### Power-on indicator — 🟢 [FreeTRX] +Whenever the backlight is off — any backlight mode where the screen goes dark, +including **None** — the **green LED flashes** for **100 ms every 3 s**, so a dark +screen doesn't leave you wondering whether the radio is still on. The flash pauses +while the LEDs are needed for something else: while receiving, while transmitting, +and while muted (which flashes the red LED instead). It also follows the CPS +"disable all LEDs" option. + --- ## Audio diff --git a/MDUV380_firmware/application/source/applicationMain.c b/MDUV380_firmware/application/source/applicationMain.c index 45ab1a4..028c988 100644 --- a/MDUV380_firmware/application/source/applicationMain.c +++ b/MDUV380_firmware/application/source/applicationMain.c @@ -1541,6 +1541,37 @@ void applicationMainTask(void) } } + // Power-on indicator: when the display doesn't stay lit, flash the GREEN LED for + // 100ms every 3s, so it's still obvious the radio is switched on while the screen + // is dark. Only while nothing else owns the LEDs: a LED lit by RX/TX already shows + // the radio is alive, and muting flashes the RED one. + { + static bool heartbeatFlashOn = false; + + bool rxGreen = (slotState == DMR_STATE_RX_1) || (slotState == DMR_STATE_RX_2) || + currentRadioDevice->analogSignalReceived || currentRadioDevice->digitalSignalReceived; + bool ledsAreFree = (rxGreen == false) && ((trxTransmissionEnabled || trxIsTransmitting) == false) && + (audioAmpIsMuted() == false) && (lastVolume != -99); + + if ((displayIsBacklightLit() == false) && ledsAreFree) + { + bool flashOn = ((ticksGetMillis() % 3000) < 100); + + if (flashOn != heartbeatFlashOn) + { + heartbeatFlashOn = flashOn; + LedWrite(LED_GREEN, (flashOn ? 1 : 0)); + } + } + else if (heartbeatFlashOn) + { + // The backlight came on, or RX/TX/mute took the LEDs over: end our flash and + // restore the green LED to whatever the current RX state requires. + heartbeatFlashOn = false; + LedWrite(LED_GREEN, (rxGreen ? 1 : 0)); + } + } + while(ticksGetMillis() < startTime + 1) // ensure this Task runs at 1ms intervals. Regardless of clock speed. { vTaskDelay(0U); diff --git a/README.md b/README.md index ea46ddd..d79661d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,9 @@ FreeTRX keeps OpenGD77's core (DMR/FM, hotspot, CPS compatibility) and adds: - **Battery bars display** — a third battery status option alongside % and voltage: a battery-shaped icon with up to four 25 % segments (Display Options → Battery). +- **Power-on indicator** — whenever the backlight is off, the **green LED flashes** + for 100 ms every 3 s, so a dark screen never leaves you guessing whether the + radio is still on. It pauses while receiving, transmitting or muted. - **DMR reliability fix** — resolves a hard-fault (freeze needing a battery pull) on the DMR path that affected recent self-built OpenGD77 revisions.