AP_Periph: always call airspeed init to allow param conversion

This commit is contained in:
Iampete1 2022-12-30 19:40:03 +00:00 committed by Andrew Tridgell
parent e4f3720e9b
commit cb6891821e
2 changed files with 10 additions and 12 deletions

View File

@ -183,23 +183,21 @@ void AP_Periph_FW::init()
#endif #endif
#ifdef HAL_PERIPH_ENABLE_AIRSPEED #ifdef HAL_PERIPH_ENABLE_AIRSPEED
if (airspeed.enabled()){
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS #if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
const bool pins_enabled = ChibiOS::I2CBus::check_select_pins(0x01); const bool pins_enabled = ChibiOS::I2CBus::check_select_pins(0x01);
if (pins_enabled) { if (pins_enabled) {
ChibiOS::I2CBus::set_bus_to_floating(0); ChibiOS::I2CBus::set_bus_to_floating(0);
#ifdef HAL_GPIO_PIN_LED_CAN_I2C #ifdef HAL_GPIO_PIN_LED_CAN_I2C
palWriteLine(HAL_GPIO_PIN_LED_CAN_I2C, 1); palWriteLine(HAL_GPIO_PIN_LED_CAN_I2C, 1);
#endif #endif
} else { } else {
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here
airspeed.init();
}
#else
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here // Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here
airspeed.init(); airspeed.init();
#endif
} }
#else
// Note: logging of ARSPD is not enabled currently. To enable, call airspeed.set_log_bit(); here
airspeed.init();
#endif
#endif #endif

View File

@ -2223,7 +2223,7 @@ void AP_Periph_FW::can_airspeed_update(void)
static uint32_t last_probe_ms; static uint32_t last_probe_ms;
if (now - last_probe_ms >= 1000) { if (now - last_probe_ms >= 1000) {
last_probe_ms = now; last_probe_ms = now;
airspeed.init(); airspeed.allocate();
} }
} }
#endif #endif