mirror of https://github.com/ArduPilot/ardupilot
AP_BoardConfig: allow for heater polarity setting on FMU
This commit is contained in:
parent
5b3dc03cf6
commit
e1c9da85b9
|
@ -27,6 +27,10 @@
|
||||||
|
|
||||||
extern const AP_HAL::HAL& hal;
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
|
#ifndef HAL_HEATER_GPIO_ON
|
||||||
|
#define HAL_HEATER_GPIO_ON 1
|
||||||
|
#endif
|
||||||
|
|
||||||
void AP_BoardConfig::set_imu_temp(float current)
|
void AP_BoardConfig::set_imu_temp(float current)
|
||||||
{
|
{
|
||||||
int8_t target = heater.imu_target_temperature.get();
|
int8_t target = heater.imu_target_temperature.get();
|
||||||
|
@ -37,7 +41,7 @@ void AP_BoardConfig::set_imu_temp(float current)
|
||||||
if (target == -1) {
|
if (target == -1) {
|
||||||
// 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, false);
|
hal.gpio->write(HAL_HEATER_GPIO_PIN, !HAL_HEATER_GPIO_ON);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +61,7 @@ void AP_BoardConfig::set_imu_temp(float current)
|
||||||
// output as duty cycle to local pin. Use a random sequence to
|
// output as duty cycle to local pin. Use a random sequence to
|
||||||
// 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.gpio->write(HAL_HEATER_GPIO_PIN, heater_on?HAL_HEATER_GPIO_ON : !HAL_HEATER_GPIO_ON);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue