From c2a2459f81c9fc0ac7c128c74a4e5862b8b83cd1 Mon Sep 17 00:00:00 2001 From: pgdalmeida Date: Mon, 21 Sep 2026 21:55:34 +0200 Subject: [PATCH] Show the firmware's reset-cause name in the gimbal view too, not just the dump --- src/ui/TuiUi.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ui/TuiUi.cpp b/src/ui/TuiUi.cpp index caa09f1..2f0dae9 100644 --- a/src/ui/TuiUi.cpp +++ b/src/ui/TuiUi.cpp @@ -992,9 +992,18 @@ Element gimbalDetailPanel(const GimbalView& g, const DumpView& dump, const Calib return nullptr; }; - std::string reset; - for (size_t i = 0; i < d.reset_flags.size(); ++i) - reset += (i ? " " : "") + d.reset_flags[i]; + // The firmware's own name for the reset cause wins. reset_flags is an AVR + // MCUSR bit decode, and on the RP2040 that field is getResetReason() - a + // plain enum - so decoding it as bits showed every post-flash soft reset here + // as "PORF (power-on) EXTRF (external)". Only the board knows its encoding. + std::string reset = d.reset_text; + if (reset.empty()) { + for (size_t i = 0; i < d.reset_flags.size(); ++i) + reset += (i ? " " : "") + d.reset_flags[i]; + // Firmware predating `reset=`: the decode is an assumption, so say so + // rather than presenting it as fact. + if (!reset.empty()) reset += "?"; + } std::string calib_note = "calibration from config"; if (calib.has) { long long now = std::chrono::duration_cast(