AP_Airspeed: add send text for change of primary

This commit is contained in:
Iampete1
2026-01-13 11:38:42 +11:00
committed by Andrew Tridgell
parent ac8bf67281
commit 8ce2cbda94
+8 -3
View File
@@ -340,6 +340,9 @@ void AP_Airspeed::init()
convert_per_instance();
// Set primary from parameter to avoid primary changed message at boot
primary = primary_sensor.get();
#if ENABLE_PARAMETER
// if either type is set then enable if not manually set
if (!_enable.configured() && ((param[0].type.get() != TYPE_NONE) || (param[1].type.get() != TYPE_NONE))) {
@@ -776,14 +779,16 @@ void AP_Airspeed::update()
// Check for failures possibly marking sensors and unhealthy
check_sensor_failures();
#if HAL_LOGGING_ENABLED
// Record old primary sensor for logging
// Record old primary sensor for reporting
const uint8_t old_primary = primary;
#endif
// Select primary sensor based on user parameters and health
primary = select_primary();
if (primary != old_primary) {
GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Airspeed primary changed: %i", primary+1);
}
#if HAL_LOGGING_ENABLED
if (primary != old_primary) {
AP::logger().Write_Event(LogEvent::AIRSPEED_PRIMARY_CHANGED);