From 672d09c9658aff2ad8f35314d9f7d08bad805a8c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 27 Aug 2019 17:41:50 +1000 Subject: [PATCH] AP_IOMCU: use AP::RC() for AP_RCProtocol --- libraries/AP_IOMCU/iofirmware/iofirmware.cpp | 2 +- libraries/AP_IOMCU/iofirmware/iofirmware.h | 2 -- libraries/AP_IOMCU/iofirmware/rc.cpp | 10 ++++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp index e07049c2f9..9bc91db920 100644 --- a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp +++ b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp @@ -305,7 +305,7 @@ void AP_IOMCU_FW::rcin_update() rc_input.pwm[i] = hal.rcin->read(i); } rc_last_input_ms = last_ms; - rc_input.rc_protocol = (uint16_t)rcprotocol->protocol_detected(); + rc_input.rc_protocol = (uint16_t)AP::RC().protocol_detected(); } else if (last_ms - rc_last_input_ms > 200U) { rc_input.flags_rc_ok = false; } diff --git a/libraries/AP_IOMCU/iofirmware/iofirmware.h b/libraries/AP_IOMCU/iofirmware/iofirmware.h index 1ff84cced2..8bf1c156ed 100644 --- a/libraries/AP_IOMCU/iofirmware/iofirmware.h +++ b/libraries/AP_IOMCU/iofirmware/iofirmware.h @@ -117,8 +117,6 @@ public: uint32_t sbus_last_ms; uint32_t sbus_interval_ms; - AP_RCProtocol *rcprotocol; - uint32_t fmu_data_received_time; uint32_t last_heater_ms; uint32_t reboot_time; diff --git a/libraries/AP_IOMCU/iofirmware/rc.cpp b/libraries/AP_IOMCU/iofirmware/rc.cpp index 3a47f44644..e3d373639c 100644 --- a/libraries/AP_IOMCU/iofirmware/rc.cpp +++ b/libraries/AP_IOMCU/iofirmware/rc.cpp @@ -68,12 +68,10 @@ void AP_IOMCU_FW::rcin_serial_init(void) &sd3_listener, EVENT_MASK(1), SD_PARITY_ERROR); - rcprotocol = AP_RCProtocol::get_singleton(); - // disable input for SBUS with pulses, we will use the UART for // SBUS. - rcprotocol->disable_for_pulses(AP_RCProtocol::SBUS); - rcprotocol->disable_for_pulses(AP_RCProtocol::SBUS_NI); + AP::RC().disable_for_pulses(AP_RCProtocol::SBUS); + AP::RC().disable_for_pulses(AP_RCProtocol::SBUS_NI); } static struct { @@ -96,7 +94,7 @@ void AP_IOMCU_FW::rcin_serial_update(void) n = MIN(n, sizeof(b)); rc_stats.num_dsm_bytes += n; for (uint8_t i=0; iprocess_byte(b[i], 115200); + AP::RC().process_byte(b[i], 115200); } //BLUE_TOGGLE(); } @@ -111,7 +109,7 @@ void AP_IOMCU_FW::rcin_serial_update(void) n = MIN(n, sizeof(b)); rc_stats.num_sbus_bytes += n; for (uint8_t i=0; iprocess_byte(b[i], 100000); + AP::RC().process_byte(b[i], 100000); } } }