diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index b614648e77..7e2ab850a9 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -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); diff --git a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp index e981e01ad4..70a6aa6aa8 100644 --- a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp +++ b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp @@ -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: diff --git a/libraries/AP_IOMCU/iofirmware/ioprotocol.h b/libraries/AP_IOMCU/iofirmware/ioprotocol.h index 4256b6d195..85d4b9c4bc 100644 --- a/libraries/AP_IOMCU/iofirmware/ioprotocol.h +++ b/libraries/AP_IOMCU/iofirmware/ioprotocol.h @@ -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)