AP_IOMCU: support forcing heater to enabled with a feature bit

This commit is contained in:
Andrew Tridgell 2023-03-01 15:05:02 +11:00 committed by Peter Barker
parent 9fd4298377
commit 2f1c38e13a
3 changed files with 16 additions and 0 deletions

View File

@ -44,6 +44,10 @@ enum ioevents {
// an error
#define IOMCU_MAX_REPEATED_FAILURES 20
#ifndef AP_IOMCU_FORCE_ENABLE_HEATER
#define AP_IOMCU_FORCE_ENABLE_HEATER 0
#endif
AP_IOMCU::AP_IOMCU(AP_HAL::UARTDriver &_uart) :
uart(_uart)
{
@ -142,6 +146,14 @@ void AP_IOMCU::thread_main(void)
event_failed(mask);
continue;
}
#if AP_IOMCU_FORCE_ENABLE_HEATER
if (!modify_register(PAGE_SETUP, PAGE_REG_SETUP_FEATURES, 0,
P_SETUP_FEATURES_HEATER)) {
event_failed(mask);
continue;
}
#endif
}
mask &= ~EVENT_MASK(IOEVENT_INIT);

View File

@ -536,6 +536,9 @@ bool AP_IOMCU_FW::handle_code_write()
} else {
palSetLine(HAL_GPIO_PIN_SBUS_OUT_EN);
}
if (reg_setup.features & P_SETUP_FEATURES_HEATER) {
has_heater = true;
}
break;
case PAGE_REG_SETUP_HEATER_DUTY_CYCLE:

View File

@ -66,6 +66,7 @@ enum iopage {
#define P_SETUP_FEATURES_ADC_RSSI 8
#define P_SETUP_FEATURES_ONESHOT 16
#define P_SETUP_FEATURES_BRUSHED 32
#define P_SETUP_FEATURES_HEATER 64
#define PAGE_REG_SETUP_ARMING 1
#define P_SETUP_ARMING_IO_ARM_OK (1<<0)