From b6e9d48a35ce76c85c37c2a042daba195e93e561 Mon Sep 17 00:00:00 2001 From: Shaw Innes Date: Fri, 28 Aug 2026 21:42:53 +1000 Subject: [PATCH] Fix standalone mode button trigger on non-PM5 platforms The 1-second button hold that launches a standalone mode has been a no-op on every platform except PM5 since e3511c535 ("Used HAL layer"). That commit repurposed the long press as a power-off gesture for PM5, but commented out the RunMod() call unconditionally while guarding only the new power-off code with #ifdef PM5. On PM3 builds the BUTTON_HOLD branch therefore compiles down to an empty block, leaving CMD_STANDALONE (the client's `hw standalone` command) as the only remaining entry point to a standalone mode -- which defeats their purpose, since standalone modes exist to run without a host attached. Restore the call under #ifndef PM5 and move the PM5 power-off code to the #else branch, matching the guard style used elsewhere in the same commit. Verified: PM3RDV4 and PM3GENERIC images now have two RunMod call sites (AppMain + CMD_STANDALONE); PM5 still has one and retains its power-off path. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 1 + armsrc/appmain.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db02144a2..5dd9716af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed standalone modes - the one second button hold trigger was a no-op on all non-PM5 platforms, leaving `hw standalone` over USB as the only entry point (@ShawInnes) - Added `sim022.bin` - enabled burst mode transfers, which allows us to do TA1=96 in speeds (@iceman1001) - Fixed `hf felica liteauth` - empty long option names for `-c` and `-k` made argtable read past the string (found by ASAN on `--fulltext`) (@Msprg) - Added `sim020.bin` - v4.60 of sim module firmware, better T=0 handling and clock etu handling (@iceman1001) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 82ff672e0..f21931ce8 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -3907,11 +3907,11 @@ void __attribute__((noreturn)) AppMain(void) { * So this is the trigger to execute a standalone mod. Generic entrypoint by following the standalone/standalone.h headerfile * All standalone mod "main loop" should be the RunMod() function. */ - // allow_send_wtx = false; - // RunMod(); - // allow_send_wtx = true; - -#ifdef PM5 // TODO DXL Test long press to device shutdown, temporarily blocking standalone mod +#ifndef PM5 + allow_send_wtx = false; + RunMod(); + allow_send_wtx = true; +#else // TODO DXL Test long press to device shutdown, temporarily blocking standalone mod /* StartTicks();