mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_BoardConfig: support multiple heater pins
This commit is contained in:
parent
a32180f709
commit
eb4f544535
@ -42,6 +42,9 @@ void AP_BoardConfig::set_imu_temp(float current)
|
|||||||
// nothing to do, make sure heater is left off
|
// nothing to do, make sure heater is left off
|
||||||
#if defined(HAL_HEATER_GPIO_PIN)
|
#if defined(HAL_HEATER_GPIO_PIN)
|
||||||
hal.gpio->write(HAL_HEATER_GPIO_PIN, !HAL_HEATER_GPIO_ON);
|
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
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,6 +65,9 @@ void AP_BoardConfig::set_imu_temp(float current)
|
|||||||
// prevent a periodic change to magnetic field
|
// prevent a periodic change to magnetic field
|
||||||
bool heater_on = (get_random16() < uint32_t(heater.output) * 0xFFFFU / 100U);
|
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);
|
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
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user