AP_BoardConfig: support multiple heater pins

This commit is contained in:
Andrew Tridgell 2023-02-09 17:27:21 +11:00 committed by Peter Barker
parent a32180f709
commit eb4f544535
1 changed files with 6 additions and 0 deletions

View File

@ -42,6 +42,9 @@ void AP_BoardConfig::set_imu_temp(float current)
// nothing to do, make sure heater is left off
#if defined(HAL_HEATER_GPIO_PIN)
hal.gpio->write(HAL_HEATER_GPIO_PIN, !HAL_HEATER_GPIO_ON);
#endif
#if defined(HAL_HEATER2_GPIO_PIN)
hal.gpio->write(HAL_HEATER2_GPIO_PIN, !HAL_HEATER_GPIO_ON);
#endif
return;
}
@ -62,6 +65,9 @@ void AP_BoardConfig::set_imu_temp(float current)
// prevent a periodic change to magnetic field
bool heater_on = (get_random16() < uint32_t(heater.output) * 0xFFFFU / 100U);
hal.gpio->write(HAL_HEATER_GPIO_PIN, heater_on?HAL_HEATER_GPIO_ON : !HAL_HEATER_GPIO_ON);
#if defined(HAL_HEATER2_GPIO_PIN)
hal.gpio->write(HAL_HEATER2_GPIO_PIN, heater_on?HAL_HEATER_GPIO_ON : !HAL_HEATER_GPIO_ON);
#endif
#endif
return;
}