Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/main/fc/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ static const char * const hardwareSensorStatusNames[] = {
"NONE", "OK", "UNAVAILABLE", "FAILING"
};

// A sensor that is detected and healthy, but has never been calibrated, is reported as
// UNCALIBRATED. Every other state is reported exactly as hardwareSensorStatus_e defines it.
static const char * hardwareSensorStatusName(hardwareSensorStatus_e status, bool isCalibrated)
{
if ((status == HW_SENSOR_OK) && !isCalibrated) {
return "UNCALIBRATED";
}

return hardwareSensorStatusNames[status];
}

static const char * const *sensorHardwareNames[] = {
gyroNames,
table_acc_hardware,
Expand Down Expand Up @@ -4184,10 +4195,16 @@ static void cliStatus(char *cmdline)
#endif // for if at32
#endif // for SITL

#ifdef USE_MAG
const bool compassIsCalibrated = compassIsCalibrationComplete();
#else
const bool compassIsCalibrated = true;
#endif

cliPrintLinef("Sensor status: GYRO=%s, ACC=%s, MAG=%s, BARO=%s, RANGEFINDER=%s, OPFLOW=%s, PITOT=%s, GPS=%s",
hardwareSensorStatusNames[getHwGyroStatus()],
hardwareSensorStatusNames[getHwAccelerometerStatus()],
hardwareSensorStatusNames[getHwCompassStatus()],
hardwareSensorStatusName(getHwGyroStatus(), gyroIsCalibrationComplete()),
hardwareSensorStatusName(getHwAccelerometerStatus(), STATE(ACCELEROMETER_CALIBRATED)),
hardwareSensorStatusName(getHwCompassStatus(), compassIsCalibrated),
hardwareSensorStatusNames[getHwBarometerStatus()],
hardwareSensorStatusNames[getHwRangefinderStatus()],
hardwareSensorStatusNames[getHwOpticalFlowStatus()],
Expand Down