From 2eb9fb9ed6e43acd1fb1af2b0405cf59feff2d4c Mon Sep 17 00:00:00 2001 From: Claudio Micheli Date: Thu, 8 Aug 2019 17:36:57 +0200 Subject: [PATCH] Commander: move esc_status as local variable. Signed-off-by: Claudio Micheli --- msg/vehicle_status_flags.msg | 1 - src/modules/commander/Commander.cpp | 7 ++++--- src/modules/commander/Commander.hpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/msg/vehicle_status_flags.msg b/msg/vehicle_status_flags.msg index 69ef47e47d..a5dd3dec1e 100644 --- a/msg/vehicle_status_flags.msg +++ b/msg/vehicle_status_flags.msg @@ -22,7 +22,6 @@ bool circuit_breaker_engaged_gpsfailure_check bool circuit_breaker_flight_termination_disabled bool circuit_breaker_engaged_usb_check bool circuit_breaker_engaged_posfailure_check # set to true when the position valid checks have been disabled -bool circuit_breaker_engaged_escs_check bool offboard_control_signal_found_once bool offboard_control_signal_lost diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 4f9024d81c..0cb335f3ba 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -150,7 +150,6 @@ static uint8_t _last_sp_man_arm_switch = 0; static struct vtol_vehicle_status_s vtol_status = {}; static struct cpuload_s cpuload = {}; -static struct esc_status_s esc_status = {}; static bool last_overload = false; @@ -1624,8 +1623,10 @@ Commander::run() if (esc_status_sub.updated()) { /* ESCs status changed */ + esc_status_s esc_status = {}; + esc_status_sub.copy(&esc_status); - esc_status_check(); + esc_status_check(esc_status); } estimator_check(&status_changed); @@ -4366,7 +4367,7 @@ Commander::offboard_control_update(bool &status_changed) } -void Commander::esc_status_check() +void Commander::esc_status_check(const esc_status_s &esc_status) { char esc_fail_msg[50]; esc_fail_msg[0] = '\0'; diff --git a/src/modules/commander/Commander.hpp b/src/modules/commander/Commander.hpp index f1d9bbf954..0c00870a0d 100644 --- a/src/modules/commander/Commander.hpp +++ b/src/modules/commander/Commander.hpp @@ -65,6 +65,7 @@ #include #include #include +#include using math::constrain; @@ -217,7 +218,7 @@ private: void battery_status_check(); - void esc_status_check(); + void esc_status_check(const esc_status_s &esc_status); /** * Checks the status of all available data links and handles switching between different system telemetry states.