From daf49ca58e6d1d5157294ecf4f4399723d96eba8 Mon Sep 17 00:00:00 2001 From: Eric Katzfey Date: Mon, 23 Dec 2024 11:18:13 -0800 Subject: [PATCH] AP_HAL_QURT: Added support for PWM channels 4 to 8 when using the IO board --- libraries/AP_HAL_QURT/RCOutput.cpp | 12 ++++-------- libraries/AP_HAL_QURT/RCOutput.h | 8 +++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libraries/AP_HAL_QURT/RCOutput.cpp b/libraries/AP_HAL_QURT/RCOutput.cpp index 70b9ceee8188e..2728d19b20ad2 100644 --- a/libraries/AP_HAL_QURT/RCOutput.cpp +++ b/libraries/AP_HAL_QURT/RCOutput.cpp @@ -153,7 +153,7 @@ void RCOutput::send_esc_command(void) // We don't set any LEDs data[4] = 0; - for (uint8_t i=0; iget_safety_mask(); } - for (uint8_t i=0; i>4; - if (idx >= ARRAY_SIZE(period)) { + if (idx >= esc_channel_count) { return; } update_rpm(idx, pkt.rpm); diff --git a/libraries/AP_HAL_QURT/RCOutput.h b/libraries/AP_HAL_QURT/RCOutput.h index c2be76ccb7fd6..e3da9b143f4f1 100644 --- a/libraries/AP_HAL_QURT/RCOutput.h +++ b/libraries/AP_HAL_QURT/RCOutput.h @@ -105,9 +105,11 @@ class QURT::RCOutput : public AP_HAL::RCOutput, AP_ESC_Telem_Backend int fd = -1; uint16_t enable_mask; - static const uint8_t channel_count = 4; - uint16_t period[channel_count]; - uint16_t pwm_output[channel_count]; + static const uint8_t max_channel_count = 8; + static const uint8_t esc_channel_count = 4; + static const uint8_t io_channel_count = 8; + uint16_t period[max_channel_count]; + uint16_t pwm_output[max_channel_count]; volatile bool need_write; bool corked; HAL_Semaphore mutex;