Show the firmware's reset-cause name in the gimbal view too, not just the dump

This commit is contained in:
pgdalmeida 2026-09-21 21:55:34 +02:00
parent 575e3c590b
commit c2a2459f81
Signed by: pedro.almeida
GPG Key ID: D4A6C394DF13F1D7
1 changed files with 12 additions and 3 deletions

View File

@ -992,9 +992,18 @@ Element gimbalDetailPanel(const GimbalView& g, const DumpView& dump, const Calib
return nullptr;
};
std::string reset;
// 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<std::chrono::milliseconds>(