From de837a02e8a80fa643936f7599d91911640685cb Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 15 Jan 2017 22:34:39 +0100 Subject: [PATCH 1/4] LP-402 systemmod: properly init task and callback info variables avoids random data for unused optional callbacks --- flight/modules/System/systemmod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flight/modules/System/systemmod.c b/flight/modules/System/systemmod.c index a09a77fa3..b6fa8d89b 100644 --- a/flight/modules/System/systemmod.c +++ b/flight/modules/System/systemmod.c @@ -244,7 +244,9 @@ static void systemTask(__attribute__((unused)) void *parameters) #ifdef DIAG_TASKS TaskInfoData taskInfoData; + memset(&taskInfoData, 0, sizeof(TaskInfoData)); CallbackInfoData callbackInfoData; + memset(&callbackInfoData, 0, sizeof(CallbackInfoData)); #endif // Main system loop while (1) { From c95e718ff58947a9b492f0daf940b92959355d03 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 15 Jan 2017 22:35:55 +0100 Subject: [PATCH 2/4] LP-402 gcs: better report invalid UAVO Enum errors --- ground/gcs/src/plugins/uavobjects/uavobjectfield.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/gcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/gcs/src/plugins/uavobjects/uavobjectfield.cpp index 404b5798f..a600f8579 100644 --- a/ground/gcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/gcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -1024,7 +1024,7 @@ QVariant UAVObjectField::getValue(quint32 index) quint8 tmpenum; memcpy(&tmpenum, &data[offset + numBytesPerElement * index], numBytesPerElement); if (tmpenum >= options.length()) { - qDebug() << "Invalid value for" << name; + qDebug() << "Invalid enum" << tmpenum << "for field" << (obj->getName() + ":" + name + "[" + elementNames[index] + "]"); tmpenum = 0; } return QVariant(options[tmpenum]); From 1c222bdf0952391747d83472d77c121e887ebb48 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 15 Jan 2017 22:37:22 +0100 Subject: [PATCH 3/4] LP-402 remove unused taskinfo and callbackinfo includes --- flight/libraries/pid/pidcontroldown.cpp | 2 -- flight/libraries/sanitycheck.c | 1 - flight/modules/Airspeed/baro_airspeed_ms4525do.c | 1 - flight/modules/GPS/ubx_autoconfig.c | 1 - flight/modules/Osd/osdinput/osdinput.c | 1 - flight/modules/PathFollower/grounddrivecontroller.cpp | 2 -- flight/modules/PathFollower/pidcontrolne.cpp | 2 -- flight/modules/PathFollower/vtolautotakeoffcontroller.cpp | 2 -- flight/modules/PathFollower/vtolautotakeofffsm.cpp | 2 -- flight/modules/PathFollower/vtolbrakecontroller.cpp | 2 -- flight/modules/PathFollower/vtolbrakefsm.cpp | 2 -- flight/modules/PathFollower/vtolflycontroller.cpp | 2 -- flight/modules/PathFollower/vtollandcontroller.cpp | 2 -- flight/modules/PathFollower/vtollandfsm.cpp | 2 -- flight/modules/PathFollower/vtolvelocitycontroller.cpp | 2 -- flight/targets/boards/gpsplatinum/firmware/pios_board.c | 1 - 16 files changed, 27 deletions(-) diff --git a/flight/libraries/pid/pidcontroldown.cpp b/flight/libraries/pid/pidcontroldown.cpp index de86bba5b..93e218371 100644 --- a/flight/libraries/pid/pidcontroldown.cpp +++ b/flight/libraries/pid/pidcontroldown.cpp @@ -31,8 +31,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index 08d8a67d2..09739ce7b 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -41,7 +41,6 @@ #include #include #include -#include // a number of useful macros #define ADDSEVERITY(check) severity = (severity != SYSTEMALARMS_ALARM_OK ? severity : ((check) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_CRITICAL)) diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index 181f07c47..6c93b07d8 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -41,7 +41,6 @@ #include "airspeedsettings.h" #include "airspeedsensor.h" // object that will be updated by the module #include "airspeedalarm.h" -#include "taskinfo.h" #if defined(PIOS_INCLUDE_MS4525DO) diff --git a/flight/modules/GPS/ubx_autoconfig.c b/flight/modules/GPS/ubx_autoconfig.c index e4be2cda8..b1dee67ad 100644 --- a/flight/modules/GPS/ubx_autoconfig.c +++ b/flight/modules/GPS/ubx_autoconfig.c @@ -34,7 +34,6 @@ #include "inc/ubx_autoconfig.h" #include -#include "taskinfo.h" // private type definitions diff --git a/flight/modules/Osd/osdinput/osdinput.c b/flight/modules/Osd/osdinput/osdinput.c index f46c61a57..09d5e2c95 100644 --- a/flight/modules/Osd/osdinput/osdinput.c +++ b/flight/modules/Osd/osdinput/osdinput.c @@ -35,7 +35,6 @@ #include "osdinput.h" #include "attitudestate.h" -#include "taskinfo.h" #include "flightstatus.h" #include "fifo_buffer.h" diff --git a/flight/modules/PathFollower/grounddrivecontroller.cpp b/flight/modules/PathFollower/grounddrivecontroller.cpp index 3397a630e..f511db304 100644 --- a/flight/modules/PathFollower/grounddrivecontroller.cpp +++ b/flight/modules/PathFollower/grounddrivecontroller.cpp @@ -27,8 +27,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/pidcontrolne.cpp b/flight/modules/PathFollower/pidcontrolne.cpp index 5aa6f7460..6a8968f24 100644 --- a/flight/modules/PathFollower/pidcontrolne.cpp +++ b/flight/modules/PathFollower/pidcontrolne.cpp @@ -31,8 +31,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolautotakeoffcontroller.cpp b/flight/modules/PathFollower/vtolautotakeoffcontroller.cpp index 0c0bc6490..06146c954 100644 --- a/flight/modules/PathFollower/vtolautotakeoffcontroller.cpp +++ b/flight/modules/PathFollower/vtolautotakeoffcontroller.cpp @@ -28,8 +28,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolautotakeofffsm.cpp b/flight/modules/PathFollower/vtolautotakeofffsm.cpp index 524686d1f..9b9189096 100644 --- a/flight/modules/PathFollower/vtolautotakeofffsm.cpp +++ b/flight/modules/PathFollower/vtolautotakeofffsm.cpp @@ -27,8 +27,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolbrakecontroller.cpp b/flight/modules/PathFollower/vtolbrakecontroller.cpp index 960e330de..9e41760c5 100644 --- a/flight/modules/PathFollower/vtolbrakecontroller.cpp +++ b/flight/modules/PathFollower/vtolbrakecontroller.cpp @@ -31,8 +31,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolbrakefsm.cpp b/flight/modules/PathFollower/vtolbrakefsm.cpp index 543f526fb..a8e92e7d2 100644 --- a/flight/modules/PathFollower/vtolbrakefsm.cpp +++ b/flight/modules/PathFollower/vtolbrakefsm.cpp @@ -27,8 +27,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolflycontroller.cpp b/flight/modules/PathFollower/vtolflycontroller.cpp index 2ba3592a9..bb17b68c0 100644 --- a/flight/modules/PathFollower/vtolflycontroller.cpp +++ b/flight/modules/PathFollower/vtolflycontroller.cpp @@ -26,8 +26,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtollandcontroller.cpp b/flight/modules/PathFollower/vtollandcontroller.cpp index 7362526bf..31740669f 100644 --- a/flight/modules/PathFollower/vtollandcontroller.cpp +++ b/flight/modules/PathFollower/vtollandcontroller.cpp @@ -28,8 +28,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtollandfsm.cpp b/flight/modules/PathFollower/vtollandfsm.cpp index 267299bc6..acfa675a0 100644 --- a/flight/modules/PathFollower/vtollandfsm.cpp +++ b/flight/modules/PathFollower/vtollandfsm.cpp @@ -27,8 +27,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/modules/PathFollower/vtolvelocitycontroller.cpp b/flight/modules/PathFollower/vtolvelocitycontroller.cpp index 3934335ce..46d21228f 100644 --- a/flight/modules/PathFollower/vtolvelocitycontroller.cpp +++ b/flight/modules/PathFollower/vtolvelocitycontroller.cpp @@ -26,8 +26,6 @@ extern "C" { #include -#include - #include #include #include diff --git a/flight/targets/boards/gpsplatinum/firmware/pios_board.c b/flight/targets/boards/gpsplatinum/firmware/pios_board.c index 11b99d825..d8b29bd22 100644 --- a/flight/targets/boards/gpsplatinum/firmware/pios_board.c +++ b/flight/targets/boards/gpsplatinum/firmware/pios_board.c @@ -31,7 +31,6 @@ #include #include #include -#include /* * Pull in the board-specific static HW definitions. From 02d7d0493245a6dd23a02ff7314e8b62da502767 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 16 Jan 2017 09:03:25 +0100 Subject: [PATCH 4/4] LP-402 systemmod: remove commented out cruft --- flight/modules/System/systemmod.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/flight/modules/System/systemmod.c b/flight/modules/System/systemmod.c index b6fa8d89b..8d499bc17 100644 --- a/flight/modules/System/systemmod.c +++ b/flight/modules/System/systemmod.c @@ -272,13 +272,9 @@ static void systemTask(__attribute__((unused)) void *parameters) PIOS_TASK_MONITOR_ForEachTask(taskMonitorForEachCallback, &taskInfoData); TaskInfoSet(&taskInfoData); // Update the callback status object -// if(FALSE){ PIOS_CALLBACKSCHEDULER_ForEachCallback(callbackSchedulerForEachCallback, &callbackInfoData); CallbackInfoSet(&callbackInfoData); -// } #endif -// } - UAVObjEvent ev; int delayTime = SYSTEM_UPDATE_PERIOD_MS;