Show the calibration actually in use, not just a fit from this session

This commit is contained in:
pgdalmeida 2026-09-17 18:14:54 +02:00
parent 31da8012d7
commit f9e209bf2a
Signed by: pedro.almeida
GPG Key ID: D4A6C394DF13F1D7
1 changed files with 17 additions and 8 deletions

View File

@ -909,7 +909,7 @@ Element axisDumpDetail(const DumpAxis& ax) {
// (incl. RAMP_STAT, the last one) is visible without scrolling. // (incl. RAMP_STAT, the last one) is visible without scrolling.
Element axisColumn(const std::string& title, const AxisView& live, const DumpData& d, Element axisColumn(const std::string& title, const AxisView& live, const DumpData& d,
char letter, bool calib_has, const CalibAxisView& cal, char letter, bool calib_has, const CalibAxisView& cal,
const DiagAxisView* diag, ScrollState& st) { const AxisMapView& live_map, const DiagAxisView* diag, ScrollState& st) {
auto fmt = [](const char* f, double v) { auto fmt = [](const char* f, double v) {
char b[32]; char b[32];
std::snprintf(b, sizeof(b), f, v); std::snprintf(b, sizeof(b), f, v);
@ -957,13 +957,21 @@ Element axisColumn(const std::string& title, const AxisView& live, const DumpDat
// Last calibration result for this axis. // Last calibration result for this axis.
col.push_back(separator()); col.push_back(separator());
col.push_back(text("CALIBRATION") | bold | color(Color::Magenta)); col.push_back(text("CALIBRATION") | bold | color(Color::Magenta));
// The values actually in use, always. They are what every bearing is computed
// from, so showing nothing here because no fit happened today told the
// operator the axis was uncalibrated when it was not.
col.push_back(kvRow("cnt/deg", fmt("%.3f", live_map.counts_per_deg)));
col.push_back(kvRow("deg@ctr", fmt("%.3f", live_map.deg_at_center)));
if (calib_has && cal.ok) { if (calib_has && cal.ok) {
col.push_back(kvRow("cnt/deg", fmt("%.3f", cal.counts_per_deg))); // A fit ran this session: add its quality, and flag if the live map has
col.push_back(kvRow("deg@ctr", fmt("%.3f", cal.deg_at_center))); // since moved away from it (a homing derivation, or a manual offset).
col.push_back(kvRow("R2", fmt("%.4f", cal.r2), cal.r2 >= 0.99 ? Color::Green : Color::Yellow)); col.push_back(kvRow("R2", fmt("%.4f", cal.r2), cal.r2 >= 0.99 ? Color::Green : Color::Yellow));
col.push_back(kvRow("points", std::to_string(cal.n))); col.push_back(kvRow("points", std::to_string(cal.n)));
col.push_back(text("from a fit this session") | dim);
} else if (calib_has) {
col.push_back(text("last fit this session FAILED") | color(Color::Yellow));
} else { } else {
col.push_back(text(calib_has ? "fit failed" : "uncalibrated this session") | dim); col.push_back(text("from config, no fit this session") | dim);
} }
// Each axis keeps its own frame so the YAW/PITCH titles stay put; framing the // Each axis keeps its own frame so the YAW/PITCH titles stay put; framing the
@ -985,7 +993,7 @@ Element gimbalDetailPanel(const GimbalView& g, const DumpView& dump, const Calib
std::string reset; std::string reset;
for (size_t i = 0; i < d.reset_flags.size(); ++i) for (size_t i = 0; i < d.reset_flags.size(); ++i)
reset += (i ? " " : "") + d.reset_flags[i]; reset += (i ? " " : "") + d.reset_flags[i];
std::string calib_note = "uncalibrated this session"; std::string calib_note = "calibration from config";
if (calib.has) { if (calib.has) {
long long now = std::chrono::duration_cast<std::chrono::milliseconds>( long long now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()).count(); std::chrono::system_clock::now().time_since_epoch()).count();
@ -1002,10 +1010,11 @@ Element gimbalDetailPanel(const GimbalView& g, const DumpView& dump, const Calib
}); });
std::vector<Element> cols; std::vector<Element> cols;
cols.push_back(axisColumn("YAW", g.yaw, d, 'Y', calib.has, calib.yaw, diagFor('Y'), st[0])); cols.push_back(axisColumn("YAW", g.yaw, d, 'Y', calib.has, calib.yaw, calib.live_yaw,
diagFor('Y'), st[0]));
if (g.pitch_present) if (g.pitch_present)
cols.push_back( cols.push_back(axisColumn("PITCH", g.pitch, d, 'P', calib.has, calib.pitch,
axisColumn("PITCH", g.pitch, d, 'P', calib.has, calib.pitch, diagFor('P'), st[1])); calib.live_pitch, diagFor('P'), st[1]));
return window(overlayTitle("GIMBAL", "g/Esc:close d:refresh dump", st[0]), return window(overlayTitle("GIMBAL", "g/Esc:close d:refresh dump", st[0]),
vbox({header, separator(), hbox(std::move(cols)) | flex})); vbox({header, separator(), hbox(std::move(cols)) | flex}));