From fbf5ecfe8c1279980a4d867fb0384a92b6b93d72 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sat, 10 Aug 2019 12:39:11 +0900 Subject: [PATCH] AP_ToshibaCAN: ensure motors are off when vehicle is disarmed --- libraries/AP_ToshibaCAN/AP_ToshibaCAN.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/AP_ToshibaCAN/AP_ToshibaCAN.cpp b/libraries/AP_ToshibaCAN/AP_ToshibaCAN.cpp index 10bea6c730..1006aa0f5f 100644 --- a/libraries/AP_ToshibaCAN/AP_ToshibaCAN.cpp +++ b/libraries/AP_ToshibaCAN/AP_ToshibaCAN.cpp @@ -401,9 +401,11 @@ void AP_ToshibaCAN::update() // take semaphore and update outputs { WITH_SEMAPHORE(_rc_out_sem); + const bool armed = hal.util->get_soft_armed(); for (uint8_t i = 0; i < MIN(TOSHIBACAN_MAX_NUM_ESCS, 16); i++) { SRV_Channel *c = SRV_Channels::srv_channel(i); if (c == nullptr) { + if (!armed || (c == nullptr)) { _scaled_output[i] = 0; } else { uint16_t pwm_out = c->get_output_pwm();