From 9537fd2359af6b3b8a04f0e0054f320b4923b08f Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Thu, 19 Nov 2026 12:28:56 +1000 Subject: [PATCH] fix(firmware): don't judge a pending update on a reconnect before reset tedge_fw_on_connected() runs on every session start. If the MQTT session dropped and came back after the download had written the marker but before the reset, the old image was still running, so the check read the update as rolled back, reported it, and cleared the marker. The new image then booted with nothing to report, and the operation stayed EXECUTING. Skip the check while this boot's own update is running. Co-Authored-By: Claude Opus 5.5 --- core/src/tedge_firmware.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/tedge_firmware.c b/core/src/tedge_firmware.c index 74b8a8e..08d4c82 100644 --- a/core/src/tedge_firmware.c +++ b/core/src/tedge_firmware.c @@ -412,6 +412,14 @@ void tedge_fw_on_connected(void) bool confirmed = tedge_port_fw_is_confirmed(); char *sep; + /* A reconnect while this boot's own update is still running (the + * download, or the moments between writing the marker and the reset) + * must leave the marker alone: it is for the next boot to judge. Read + * now, it would look like a rollback, since the old image is still + * running, and the new image would then have nothing to report. */ + if (job_running) { + return; + } if (marker[0] == '\0') { marker_load(); }