From 04fa8ed59360f432384da331ee73af0ad5bcbac0 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Fri, 17 Nov 2023 18:04:48 +0000 Subject: [PATCH] AP_HAL_SITL: return success status from serial_led_send and set_serial_led_rgb_data --- libraries/AP_HAL_SITL/RCOutput.cpp | 12 +++++++----- libraries/AP_HAL_SITL/RCOutput.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libraries/AP_HAL_SITL/RCOutput.cpp b/libraries/AP_HAL_SITL/RCOutput.cpp index 3a39d31c2b..423c4ea57e 100644 --- a/libraries/AP_HAL_SITL/RCOutput.cpp +++ b/libraries/AP_HAL_SITL/RCOutput.cpp @@ -125,34 +125,36 @@ bool RCOutput::set_serial_led_num_LEDs(const uint16_t chan, uint8_t num_leds, ou return false; } -void RCOutput::set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue) +bool RCOutput::set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue) { if (chan > 15) { - return; + return false; } SITL::SIM *sitl = AP::sitl(); if (led == -1) { for (uint8_t i=0; i < sitl->led.num_leds[chan]; i++) { set_serial_led_rgb_data(chan, i, red, green, blue); } - return; + return true; } if (led < -1 || led >= sitl->led.num_leds[chan]) { - return; + return false; } if (sitl) { sitl->led.rgb[chan][led].rgb[0] = red; sitl->led.rgb[chan][led].rgb[1] = green; sitl->led.rgb[chan][led].rgb[2] = blue; } + return true; } -void RCOutput::serial_led_send(const uint16_t chan) +bool RCOutput::serial_led_send(const uint16_t chan) { SITL::SIM *sitl = AP::sitl(); if (sitl) { sitl->led.send_counter++; } + return true; } #endif //CONFIG_HAL_BOARD == HAL_BOARD_SITL diff --git a/libraries/AP_HAL_SITL/RCOutput.h b/libraries/AP_HAL_SITL/RCOutput.h index 34b124c241..fe6324d4ba 100644 --- a/libraries/AP_HAL_SITL/RCOutput.h +++ b/libraries/AP_HAL_SITL/RCOutput.h @@ -42,8 +42,8 @@ public: Serial LED emulation */ bool set_serial_led_num_LEDs(const uint16_t chan, uint8_t num_leds, output_mode mode = MODE_PWM_NONE, uint32_t clock_mask = 0) override; - void set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue) override; - void serial_led_send(const uint16_t chan) override; + bool set_serial_led_rgb_data(const uint16_t chan, int8_t led, uint8_t red, uint8_t green, uint8_t blue) override; + bool serial_led_send(const uint16_t chan) override; private: SITL_State *_sitlState;