From b5007b5cc9df8310cc94329b0c3fe0c802fd6812 Mon Sep 17 00:00:00 2001 From: Cliff Geerdes Date: Sat, 11 Jan 2014 16:56:09 -0500 Subject: [PATCH 001/131] OP-1157 bugfix for sin_lookup_deg() --- flight/libraries/math/sin_lookup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flight/libraries/math/sin_lookup.c b/flight/libraries/math/sin_lookup.c index 6233dc592..e0d6d499c 100644 --- a/flight/libraries/math/sin_lookup.c +++ b/flight/libraries/math/sin_lookup.c @@ -105,8 +105,12 @@ float sin_lookup_deg(float angle) return 0; } - int i_ang = ((int32_t)angle) % 360; - if (i_ang >= 180) { // for 180 to 360 deg + // 1073741760 is a multiple of 360 that is close to 0x3fffffff + // so angle can be a very large number of positive or negative rotations + // we could halve the lookup table size + // we could interpolate for greater accuracy + int i_ang = ((int32_t)(angle + 0.5f) + (int32_t)1073741760) % 360; + if (i_ang >= 180) { // for 180 to 359 deg return -sin_table[i_ang - 180]; } else { // for 0 to 179 deg return sin_table[i_ang]; From 4414d11417a58b7b8a1c020798fd7b66d201a9e6 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sat, 18 Jan 2014 12:30:24 +0100 Subject: [PATCH 002/131] OP-1172 Some fonts are not defined in config files Fix all font names not defined in default Gcs config files --- .../openpilotgcs/default_configurations/Developer.xml | 10 +++++----- .../default_configurations/OpenPilotGCS.xml | 10 +++++----- .../default_configurations/OpenPilotGCS_wide.xml | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml index 430eeac3f..75aed52ed 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml @@ -1126,7 +1126,7 @@ %%DATAPATH%%dials/default/arm-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1149,7 +1149,7 @@ %%DATAPATH%%dials/default/textonly.svg 0 0.001 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1172,7 +1172,7 @@ %%DATAPATH%%dials/default/flightmode-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1195,7 +1195,7 @@ %%DATAPATH%%dials/default/gps-signal.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 0 0 12 @@ -1218,7 +1218,7 @@ %%DATAPATH%%dials/default/gps-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml index 827ea2a1c..b44cf5470 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml @@ -1146,7 +1146,7 @@ %%DATAPATH%%dials/default/arm-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1169,7 +1169,7 @@ %%DATAPATH%%dials/default/textonly.svg 0 0.001 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1192,7 +1192,7 @@ %%DATAPATH%%dials/default/flightmode-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1215,7 +1215,7 @@ %%DATAPATH%%dials/default/gps-signal.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 0 0 12 @@ -1238,7 +1238,7 @@ %%DATAPATH%%dials/default/gps-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml index c66b7188a..010917c66 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml @@ -1143,7 +1143,7 @@ %%DATAPATH%%dials/default/arm-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1166,7 +1166,7 @@ %%DATAPATH%%dials/default/textonly.svg 0 0.001 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1189,7 +1189,7 @@ %%DATAPATH%%dials/default/flightmode-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 @@ -1212,7 +1212,7 @@ %%DATAPATH%%dials/default/gps-signal.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 0 0 12 @@ -1235,7 +1235,7 @@ %%DATAPATH%%dials/default/gps-status.svg 0 1 - ,12,-1,5,50,0,0,0,0,0 + MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 100 66 100 From 6e6f5804b5296c16f51641eb5ffa8b22731cef64 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Thu, 23 Jan 2014 19:15:50 +0100 Subject: [PATCH 003/131] OP-1172 Remove unused configurations files --- .../default_configurations/Developer.xml | 2859 ----------------- .../OpenPilotGCS_wide.xml | 2842 ---------------- 2 files changed, 5701 deletions(-) delete mode 100644 ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml delete mode 100644 ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml deleted file mode 100644 index 75aed52ed..000000000 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml +++ /dev/null @@ -1,2859 +0,0 @@ - - - true - true - Developer -
Developer mode configuration
- true - OPMapGadget - default - true - 628 - 697 - default - false -
- - - - 9000 - 0 - - 1 - - - - 0 - - - #666666 - false - true - - - 91 - 90 - 89 - 88 - 87 - 86 - 100 - - - - - false - 1.0.0 - - - - - default - AccelState - 0 - false - - -1 - 0 - 0 - - - - %%DATAPATH%%sounds - - 0 - - 1 - - false - - 0 - - - - - - 57600 - - - - - - false - 0.0.0 - - - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/attitude.svg - foreground - needle - needle - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/altimeter.svg - foreground - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/barometer.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/vsi.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 12 - -12 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/compass.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/attitude.svg - foreground - needle - needle - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/altimeter.svg - foreground - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/barometer.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/vsi.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 11.2 - -11.2 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/compass.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/speed.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/thermometer.svg - foreground - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - /home/lafargue/OP/OpenPilot/trunk/artwork/Dials/deluxe/turncoordinator.svg - foreground - needle - needle2 - needle2 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AccelState - 1 - 20 - -20 - Horizontal - x - AccelState - -1 - 360 - 0 - Rotate - x - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/speed.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/attitude.svg - foreground - needle - needle - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/altimeter.svg - foreground - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/barometer.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/vsi.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 12 - -12 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/compass.svg - foreground - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/speed.svg - - needle - - - Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/thermometer.svg - - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/thermometer.svg - - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - ManualControlCommand - 1 - 2000 - 1000 - Rotate - Channel-3 - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/thermometer.svg - - needle - needle2 - needle3 - Lucida Grande,13,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - - - false - 0.0.0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0.1 - 3 - 0 - 0.1 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - false - false - true - false - false - false - false - false - - 0 - 2 - 1 - 0 - 2 - 3 - - - - - - - false - 0.0.0 - - - Telemetry - 3 - 0 - 0 - /dev/cu.Bluetooth-Modem - 11 - 0 - - - - - false - 0.0.0 - - - Serial - 3 - 0 - 0 - /dev/cu.Bluetooth-Modem - 17 - 0 - - - - - - - false - 0.0.0 - - - \usr\games\fgfs - \usr\share\games\FlightGear - 127.0.0.1 - 9009 - - - false - 9010 - 127.0.0.1 - FG - true - - - - - false - 0.0.0 - - - \home\lafargue\X-Plane 9\X-Plane-i686 - \usr\share\games\FlightGear - 127.0.0.3 - 6756 - - - false - 49000 - 127.0.0.1 - X-Plane - false - - - - - - - false - 0.0.0 - - - false - false - true - true - true - 20 - - - true - 200 - true - 0 - true - 127.0.0.1 - 40100 - true - false - false - 40200 - 20 - 127.0.0.1 - ASimRC - 50 - false - @Variant(AAAAh0CgAAA=) - - - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,8,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - x - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,6,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - y - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,8,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - z - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/arm-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - FlightStatus - Armed - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/textonly.svg - 0 - 0.001 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - SystemStats - FlightTime - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/flightmode-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - FlightStatus - FlightMode - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/gps-signal.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 0 - 0 - 12 - 0 - 0 - 0 - GPSPositionSensor - Satellites - false - 0 - 0 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/gps-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - GPSPositionSensor - Status - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 90 - 0 - 100 - 0 - 100 - 95 - SystemStats - CPULoad - false - 95 - 90 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Pitch - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Pitch - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.8 - 0.3 - 90 - -90 - 1 - 0 - AttitudeState - Pitch - false - 0.9 - 0.1 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Roll - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Roll - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 650 - 0 - 1200 - 0 - 1200 - 900 - GCSTelemetryStats - RxDataRate - false - 900 - 650 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 650 - 0 - 1200 - 0 - 1200 - 900 - GCSTelemetryStats - TxDataRate - false - 900 - 650 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - 0 - 1 - 0 - 1 - 0.75 - ManualControlCommand - Throttle - false - 0.75 - 0.5 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Yaw - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Yaw - false - 0.8 - -0.8 - - - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/aeroquad/aeroquad_+.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/boards/CC3D/CC3D.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/boards/CopterControl/CopterControl.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/dankers_quad/dankers_quad.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/easy_quad/easy_quad_X.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/Easystar/easystar.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/firecracker/firecracker.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/funjet/funjet.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/gaui_330x/gaui_330x.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/helis/t-rex/t-rex_450_xl.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mikrokopter/MK_Hexa.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-Q_+.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-Q_X.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-QT_+.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-QT_X.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mattL_Y6/mattL_Y6.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mikrokopter/MK_L4-ME.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/ricoo/ricoo.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/scorpion_tricopter/scorpion_tricopter.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/test_quad/test_quad_+.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/test_quad/test_quad_X.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - - - false - 0.0.0 - - - ServerAndCache - %%STOREPATH%%mapscache/ - 0 - 0 - 2 - GoogleSatellite - 2000 - 1 - false - mapquad.png - true - false - - - - - false - 0.0.0 - - - CacheOnly - %%STOREPATH%%mapscache/ - 0 - 0 - 2 - GoogleMap - 2000 - 1 - false - airplanepip.png - true - false - - - - - false - 0.0.0 - - - ServerAndCache - %%STOREPATH%%mapscache/ - 29.97 - 95.35 - 7 - GoogleMap - 2000 - 1 - false - mapquad.png - true - true - - - - - - - false - 0.0.0 - - - false - 2000 - 1 - false - %%DATAPATH%%pfd/default/readymap.earth - 46.6715 - 10.1589 - true - %%DATAPATH%%pfd/default/Pfd.qml - 1 - false - - - - - false - 0.0.0 - - - false - 2000 - false - %%DATAPATH%%pfd/default/readymap.earth - 46.6715 - 10.1589 - true - %%DATAPATH%%pfd/default/Pfd.qml - false - - - - - - - false - 0.0.0 - - - Unknown - true - - - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4294901760 - None - x - AccelState - 0 - 1 - 6.92920863607354e-310 - 0 - - - 4283782655 - None - y - AccelState - 1.78017180972965e-306 - 1 - 9.34609790258712e-307 - 0 - - - 4283804160 - None - z - AccelState - 2.6501977682312e-318 - 1 - 6.92920723246466e-310 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - - 1000 - 20 - - 4294901760 - None - Channel-4 - ActuatorCommand - 1.72723371101889e-77 - 1 - 6.02760087926321e-322 - 0 - - - 4294901760 - None - Channel-5 - ActuatorCommand - 3.55727265005698e-322 - 1 - 2.19822614387826e-314 - 0 - - - 4289374847 - None - Channel-6 - ActuatorCommand - 1.72723371101889e-77 - 1 - 1.72723371101889e-77 - 0 - - - 4289374847 - None - Channel-7 - ActuatorCommand - 6.92916505779426e-310 - 1 - 4.22277162500408e-312 - 0 - - 4 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4283760895 - None - Roll - AttitudeState - 6.92921152826347e-310 - 1 - 6.92921152826031e-310 - 0 - - - 4278233600 - None - Yaw - AttitudeState - 0 - 1 - 0 - 0 - - - 4294901760 - None - Pitch - AttitudeState - 0 - 1 - 0 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4278190080 - None - Pressure - BaroSensor - 1.72723371102043e-77 - 1 - 3.86203233966055e-312 - 0 - - 1 - 1 - 1000 - - - - - false - 0.0.0 - - - false - false - - 1000 - 40 - - 4278190207 - None - Channel-1 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-4 - ManualControlCommand - 6.92916505599784e-310 - 1 - 7.21478569792807e-313 - 0 - - - 4294901760 - None - Channel-5 - ManualControlCommand - 8.34448532677451e-308 - 1 - 1.78019353780608e-306 - 0 - - - 4294901760 - None - Channel-6 - ManualControlCommand - 6.9291650571421e-310 - 1 - 4.22277162500408e-312 - 0 - - - 4294901760 - None - Channel-7 - ManualControlCommand - 4.24399158193054e-314 - 1 - 4.172013484701e-309 - 0 - - - 4283825920 - None - Channel-2 - ManualControlCommand - 1.72723371101889e-77 - 1 - 2.48782786590693e-310 - 0 - - - 4294923520 - None - Channel-3 - ManualControlCommand - 6.92921442541857e-310 - 1 - 6.92921441189619e-310 - 0 - - - 4294967040 - None - Channel-0 - ManualControlCommand - 6.92921439506975e-310 - 1 - 1.72723371101889e-77 - 0 - - 8 - 1 - 200 - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4294901760 - None - x - AccelState - 0 - 1 - 0 - 0 - - - 4283782655 - None - y - AccelState - 0 - 1 - 0 - 0 - - - 4283804160 - None - z - AccelState - 0 - 1 - 0 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4283804160 - None - z - gyroState - 1.02360527502876e-306 - 1 - 6.92921152846347e-310 - 0 - - - 4283782655 - None - y - gyroState - 0 - 1 - 0 - 0 - - - 4294901760 - None - x - gyroState - 0 - 1 - 0 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - - 1000 - 60 - - 4294901760 - None - x - MagState - 6.92916505601691e-310 - 1 - 3.86203233966055e-312 - 0 - - - 4283782655 - None - y - MagState - 1.72723371101889e-77 - 1 - -1 - 0 - - - 4283804160 - None - z - MagState - 1.72723371102028e-77 - 1 - 7.21478569792807e-313 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - - 1000 - 240 - - 4294945280 - None - StackRemaining-System - TaskInfo - 1.02360527502876e-306 - 1 - 6.92921153577169e-310 - 0 - - - 4294945280 - None - StackRemaining-Actuator - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Guidance - TaskInfo - 6.92921442421083e-310 - 1 - -1.29073709209104e-231 - 0 - - - 4294945280 - None - StackRemaining-Watchdog - TaskInfo - 6.92920724098472e-310 - 1 - 3.91299991506267e-321 - 0 - - - 4294945280 - None - StackRemaining-TelemetryTx - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-TelemetryTxPri - TaskInfo - 1.72723371101889e-77 - 1 - 1.72723371101889e-77 - 0 - - - 4294945280 - None - StackRemaining-TelemetryRx - TaskInfo - 6.92921438535612e-310 - 1 - 1.72723371101889e-77 - 0 - - - 4294945280 - None - StackRemaining-GPS - TaskInfo - 1.72723371101889e-77 - 1 - 1.03979250816176e-312 - 0 - - - 4294945280 - None - StackRemaining-ManualControl - TaskInfo - 6.92921438705062e-310 - 1 - 6.92921152810932e-310 - 0 - - - 4294945280 - None - StackRemaining-Altitude - TaskInfo - 7.4109846876187e-323 - 1 - 1.72723371101889e-77 - 0 - - - 4294945280 - None - StackRemaining-AHRSComms - TaskInfo - 5.43472210425371e-323 - 1 - 1.72723371101889e-77 - 0 - - - 4294945280 - None - StackRemaining-Stabilization - TaskInfo - 1.72723371101889e-77 - 1 - 1.72723371101889e-77 - 0 - - 12 - 1 - 1000 - - - - - false - 0.0.0 - - - false - false - - 1000 - 20 - - 4289374847 - None - TxFailures - GCSTelemetryStats - 0 - 1 - 0 - 0 - - - 4283782655 - None - RxFailures - GCSTelemetryStats - 0 - 1 - 0 - 0 - - - 4294901760 - None - TxRetries - GCSTelemetryStats - 0 - 1 - 0 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - - 1000 - 240 - - 4294945407 - None - FlightTime - SystemStats - 1.02360527502876e-306 - 1 - 6.92921153586022e-310 - 0 - - - 0 - - - - 0 - 1 - 0 - 0 - - 2 - 1 - 800 - - - - - - - false - 0.0.0 - - - %%DATAPATH%%diagrams/default/system-health.svg - - - - - - - false - 0.0.0 - - - false - false - #5baa56 - false - #ff7957 - 500 - false - - - - - - - false - 0.0.0 - - - 3 - 0 - 0 - /dev/ttyS0 - 14 - 0 - - - - - false - 1.2.0 - - - - - false - - - - - - LineardialGadget - - Flight Time - - uavGadget - - - - LineardialGadget - - Arm Status - - uavGadget - - - LineardialGadget - - Flight mode - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAAYwAAAAIAAAB7) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAAAZgAAAAIAAADf) - splitter - - - PFDGadget - - raw - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAAQAAAAAIAAAG4) - splitter - - - - ModelViewGadget - - Test Quad X - - uavGadget - - - SystemHealthGadget - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAABIAAAAAIAAAFV) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAAB7wAAAAIAAAEf) - splitter - - - OPMapGadget - - Google Sat - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAACdgAAAAIAAAMp) - splitter - - UAVGadgetManagerV1 - - - false - - - ConfigGadget - - default - - uavGadget - - - UAVObjectBrowser - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAADRgAAAAIAAAJV) - splitter - - UAVGadgetManagerV1 - - - false - - - UAVObjectBrowser - - default - - uavGadget - - - - - LoggingGadget - uavGadget - - - GpsDisplayGadget - - Flight GPS - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAAcAAAAAIAAAHo) - splitter - - - DebugGadget - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAB3wAAAAIAAAEp) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAACJgAAAAIAAADo) - splitter - - UAVGadgetManagerV1 - - - false - - - - ScopeGadget - - Accel - - uavGadget - - - ScopeGadget - - Raw gyroState - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - - - ScopeGadget - - Attitude - - uavGadget - - - ScopeGadget - - Uptimes - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAClQAAAAIAAAB3) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAACjQAAAAIAAAKU) - splitter - - UAVGadgetManagerV1 - - - false - - - - HITL - - XPlane HITL - - uavGadget - - - HITLv2 - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAA=) - splitter - - - - EmptyGadget - uavGadget - - - GCSControlGadget - - MS Sidewinder - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAB6AAAAAIAAADC) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAADDAAAAAIAAAJJ) - splitter - - UAVGadgetManagerV1 - - - false - - - Uploader - - default - - uavGadget - - - - - LineardialGadget - - Flight Time - - uavGadget - - - SystemHealthGadget - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAABQgAAAAIAAAGM) - splitter - - - - - DialGadget - - Deluxe Attitude - - uavGadget - - - DialGadget - - Deluxe Baro Altimeter - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - - - DialGadget - - Deluxe Compass - - uavGadget - - - DialGadget - - Deluxe Climbrate - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - 1 - @Variant(AAAACQAAAAA=) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAABLwAAAAIAAAHf) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAADVQAAAAIAAAJK) - splitter - - UAVGadgetManagerV1 - - - - false - :/core/images/ah.png - :/core/images/openpilot_logo_64.png - :/core/images/config.png - :/core/images/cog.png - :/core/images/scopes.png - :/core/images/joystick.png - :/core/images/cpu.png - :/core/images/openpilot_logo_64.png - :/core/images/openpilot_logo_64.png - :/core/images/openpilot_logo_64.png - 6 - 1 - Flight data - Workspace10 - Configuration - System - Scopes - HITL - Firmware - Workspace7 - Workspace8 - Workspace9 - -
diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml deleted file mode 100644 index 010917c66..000000000 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml +++ /dev/null @@ -1,2842 +0,0 @@ - - - true - true - Wide configuration -
Default configuration built for wide screens (17" and up)
- false - - - true - 600 - 800 - default - false -
- - - - 9000 - 0 - - 1 - - - - 0 - - - #666666 - false - true - - - 91 - 90 - 89 - 88 - 87 - 86 - 100 - - - - - false - 1.0.0 - - - - - default - FlightStatus - 0 - false - Armed - 0 - 0 - 0 - armed - - - %%DATAPATH%%sounds - Armed - 0 - - 1 - - true - - - default - FlightStatus - 15 - false - Armed - 0 - 0 - 0 - armed - - - %%DATAPATH%%sounds - Armed - 0 - - 1 - - - - - - 57600 - - - - - - false - 0.0.0 - - - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/attitude.svg - foreground - needle - needle - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/altimeter.svg - foreground - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/barometer.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/vsi.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 12 - -12 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/compass.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/attitude.svg - foreground - needle - needle - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/altimeter.svg - foreground - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/barometer.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/vsi.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 11.2 - -11.2 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/compass.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/speed.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/deluxe/thermometer.svg - foreground - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - /home/lafargue/OP/OpenPilot/trunk/artwork/Dials/deluxe/turncoordinator.svg - foreground - needle - needle2 - needle2 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AccelState - 1 - 20 - -20 - Horizontal - x - AccelState - -1 - 360 - 0 - Rotate - x - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/speed.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/attitude.svg - foreground - needle - needle - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Roll - AttitudeState - 75 - 20 - 0 - Vertical - Pitch - AttitudeState - -1 - 360 - 0 - Rotate - Roll - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/altimeter.svg - foreground - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 10 - 0 - Rotate - Altitude - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/barometer.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 10 - 1120 - 1000 - Rotate - Pressure - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/vsi.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - VelocityState - 0.01 - 12 - -12 - Rotate - Down - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/compass.svg - foreground - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - AttitudeState - -1 - 360 - 0 - Rotate - Yaw - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/speed.svg - needle - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPositionSensor - 3.6 - 120 - 0 - Rotate - Groundspeed - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/hi-contrast/thermometer.svg - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/thermometer.svg - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - ManualControlCommand - 1 - 2000 - 1000 - Rotate - Channel-3 - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - false - 0.0.0 - - - false - background - %%DATAPATH%%dials/default/thermometer.svg - needle - needle2 - needle3 - MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - BaroSensor - 1 - 120 - 0 - Rotate - Temperature - BaroSensor - 1 - 100 - 0 - Rotate - Altitude - BaroSensor - 1 - 1000 - 0 - Rotate - Altitude - false - - - - - - - false - 0.0.0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0.1 - 3 - 0 - 0.1 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - false - false - true - false - false - false - false - false - 0 - 2 - 1 - 0 - 2 - 3 - - - - - - - false - 0.0.0 - - - Telemetry - 3 - 0 - 0 - Communications Port (COM1) - 11 - 0 - - - - - false - 0.0.0 - - - Serial - 3 - 0 - 0 - Communications Port (COM1) - 17 - 0 - - - - - - - false - 0.0.0 - - - false - false - false - true - true - true - 20 - 50 - false - - - true - 100 - false - true - 100 - 0.0.0.0 - 40100 - true - - - false - false - 40 - 40200 - 127.0.0.1 - ASimRC - false - - - - - false - 0.0.0 - - - false - false - false - true - true - true - 20 - 50 - false - \usr\games\fgfs - \usr\share\games\FlightGear - false - 100 - false - true - 100 - 127.0.0.1 - 9009 - true - - - true - false - 40 - 9010 - 127.0.0.1 - FG - true - - - - - false - 0.0.0 - - - false - false - false - true - true - true - 20 - 50 - false - - - false - 100 - false - true - 100 - 0.0.0.0 - 6756 - true - - - true - false - 40 - 49000 - 127.0.0.1 - X-Plane - false - - - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,8,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - x - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,6,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - y - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 2 - 1 - Andale Mono,8,-1,5,50,0,0,0,0,0 - -9 - -10 - 11 - -11 - 11 - -11 - AccelState - z - false - -5 - -11 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/arm-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - FlightStatus - Armed - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/textonly.svg - 0 - 0.001 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - SystemStats - FlightTime - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/flightmode-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - FlightStatus - FlightMode - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/gps-signal.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 0 - 0 - 12 - 0 - 0 - 0 - GPSPositionSensor - Satellites - false - 0 - 0 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/default/gps-status.svg - 0 - 1 - MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0 - 100 - 66 - 100 - 0 - 33 - 0 - GPSPositionSensor - Status - false - 66 - 33 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 90 - 0 - 100 - 0 - 100 - 95 - SystemStats - CPULoad - false - 95 - 90 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Pitch - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Pitch - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.8 - 0.3 - 90 - -90 - 1 - 0 - AttitudeState - Pitch - false - 0.9 - 0.1 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Roll - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Roll - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 650 - 0 - 1200 - 0 - 1200 - 900 - GCSTelemetryStats - RxDataRate - false - 900 - 650 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-horizontal.svg - 0 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 650 - 0 - 1200 - 0 - 1200 - 900 - GCSTelemetryStats - TxDataRate - false - 900 - 650 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - 0 - 1 - 0 - 1 - 0.75 - ManualControlCommand - Throttle - false - 0.75 - 0.5 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ActuatorDesired - Yaw - false - 0.8 - -0.8 - - - - - false - 0.0.0 - - - %%DATAPATH%%dials/deluxe/lineardial-vertical.svg - 2 - 1 - Andale Mono,12,-1,5,75,0,0,0,0,0 - 0.5 - -0.5 - 1 - -1 - 1 - -1 - ManualControlCommand - Yaw - false - 0.8 - -0.8 - - - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/aeroquad/aeroquad_+.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/boards/CC3D/CC3D.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/boards/CopterControl/CopterControl.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/dankers_quad/dankers_quad.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/easy_quad/easy_quad_X.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/Easystar/easystar.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/firecracker/firecracker.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/planes/funjet/funjet.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/gaui_330x/gaui_330x.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/helis/t-rex/t-rex_450_xl.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mikrokopter/MK_Hexa.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-Q_+.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-Q_X.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-QT_+.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/joes_cnc/J14-QT_X.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mattL_Y6/mattL_Y6.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/mikrokopter/MK_L4-ME.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/ricoo/ricoo.3DS - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/scorpion_tricopter/scorpion_tricopter.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/test_quad/test_quad_+.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - false - 0.0.0 - - - %%DATAPATH%%models/multi/test_quad/test_quad_X.3ds - %%DATAPATH%%models/backgrounds/default_background.png - false - - - - - - - false - 0.0.0 - - - ServerAndCache - %%STOREPATH%%mapscache/ - 0 - 0 - 2 - GoogleSatellite - 2000 - 1 - false - mapquad.png - true - true - - - - - false - 0.0.0 - - - CacheOnly - %%STOREPATH%%mapscache/ - 0 - 0 - 2 - GoogleMap - 2000 - 1 - false - airplanepip.png - true - true - - - - - false - 0.0.0 - - - ServerAndCache - %%STOREPATH%%mapscache/ - 0 - 0 - 2 - GoogleMap - 2000 - 1 - false - mapquad.png - true - true - - - - - - - false - 0.0.0 - - - false - 2000 - 1 - false - %%DATAPATH%%pfd/default/readymap.earth - 46.6715 - 10.1589 - true - %%DATAPATH%%pfd/default/Pfd.qml - 1 - false - - - - - false - 0.0.0 - - - false - 2000 - false - %%DATAPATH%%pfd/default/readymap.earth - 46.6715 - 10.1589 - true - %%DATAPATH%%pfd/default/Pfd.qml - false - - - - - - - false - 0.0.0 - - - Unknown - true - - - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4294901760 - None - x - AccelState - 0 - 1 - 0 - 0 - - - 4283782655 - None - y - AccelState - 0 - 1 - 0 - 0 - - - 4283804160 - None - z - AccelState - 0 - 1 - 0 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - 1000 - 20 - - 4294901760 - None - Channel-4 - ActuatorCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-5 - ActuatorCommand - 0 - 1 - 0 - 0 - - - 4289374847 - None - Channel-6 - ActuatorCommand - 0 - 1 - 0 - 0 - - - 4289374847 - None - Channel-7 - ActuatorCommand - 0 - 1 - 0 - 0 - - 4 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4283760895 - None - Roll - AttitudeState - 0 - 1 - 0 - 0 - - - 4278233600 - None - Yaw - AttitudeState - 0 - 1 - 0 - 0 - - - 4294901760 - None - Pitch - AttitudeState - 0 - 1 - 0 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4278190080 - None - Pressure - BaroSensor - 0 - 1 - 0 - 0 - - 1 - 1 - 1000 - - - - - false - 0.0.0 - - - false - false - 1000 - 40 - - 4278190207 - None - Channel-1 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-4 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-5 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-6 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294901760 - None - Channel-7 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4283825920 - None - Channel-2 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294923520 - None - Channel-3 - ManualControlCommand - 0 - 1 - 0 - 0 - - - 4294967040 - None - Channel-0 - ManualControlCommand - 0 - 1 - 0 - 0 - - 8 - 1 - 200 - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4294901760 - None - x - AccelState - 0 - 1 - 0 - 0 - - - 4283782655 - None - y - AccelState - 0 - 1 - 0 - 0 - - - 4283804160 - None - z - AccelState - 0 - 1 - 0 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4283804160 - None - z - GyroState - 0 - 1 - 0 - 0 - - - 4283782655 - None - y - GyroState - 0 - 1 - 0 - 0 - - - 4294901760 - None - x - GyroState - 0 - 1 - 0 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - 1000 - 60 - - 4294901760 - None - x - MagState - 0 - 1 - 0 - 0 - - - 4283782655 - None - y - MagState - 0 - 1 - 0 - 0 - - - 4283804160 - None - z - MagState - 0 - 1 - 0 - 0 - - 3 - 1 - 500 - - - - - false - 0.0.0 - - - false - false - 1000 - 240 - - 4294945280 - None - StackRemaining-System - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Actuator - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Guidance - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Watchdog - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-TelemetryTx - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-TelemetryTxPri - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-TelemetryRx - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-GPS - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-ManualControl - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Altitude - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-AHRSComms - TaskInfo - 0 - 1 - 0 - 0 - - - 4294945280 - None - StackRemaining-Stabilization - TaskInfo - 0 - 1 - 0 - 0 - - 12 - 1 - 1000 - - - - - false - 0.0.0 - - - false - false - 1000 - 20 - - 4289374847 - None - TxFailures - GCSTelemetryStats - 0 - 1 - 0 - 0 - - - 4283782655 - None - RxFailures - GCSTelemetryStats - 0 - 1 - 0 - 0 - - - 4294901760 - None - TxRetries - GCSTelemetryStats - 0 - 1 - 0 - 0 - - 3 - 1 - 100 - - - - - false - 0.0.0 - - - false - false - 1000 - 240 - - 4294945407 - None - FlightTime - SystemStats - 0 - 1 - 0 - 0 - - 1 - 1 - 800 - - - - - - - false - 0.0.0 - - - %%DATAPATH%%diagrams/default/system-health.svg - - - - - - - false - 0.0.0 - - - false - false - #5baa56 - false - #ff7957 - 500 - false - - - - - false - 1.2.0 - - - - - false - - - - - - LineardialGadget - - Flight Time - - uavGadget - - - - LineardialGadget - - Arm Status - - uavGadget - - - LineardialGadget - - Flight mode - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAAYwAAAAIAAAB7) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAAAZgAAAAIAAADf) - splitter - - - PfdQmlGadget - - NoTerrain - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAAQAAAAAIAAAG4) - splitter - - - - ModelViewGadget - - Test Quad X - - uavGadget - - - SystemHealthGadget - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAB1AAAAAIAAAGI) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAACegAAAAIAAAFC) - splitter - - - OPMapGadget - - Google Sat - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAADXgAAAAIAAAQd) - splitter - - UAVGadgetManagerV1 - - - false - - - ConfigGadget - - default - - uavGadget - - - UAVObjectBrowser - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAEeQAAAAIAAAMC) - splitter - - UAVGadgetManagerV1 - - - false - - - UAVObjectBrowser - - default - - uavGadget - - - - LoggingGadget - uavGadget - - - GpsDisplayGadget - - Flight GPS - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAAAVAAAAAIAAAGu) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAAEvwAAAAIAAAK8) - splitter - - UAVGadgetManagerV1 - - - false - - - - ScopeGadget - - Accel - - uavGadget - - - ScopeGadget - - Raw GyroState - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - - - ScopeGadget - - Attitude - - uavGadget - - - ScopeGadget - - Uptimes - - uavGadget - - 2 - @Variant(AAAACQAAAAIAAAACAAABhAAAAAIAAAGE) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAACjQAAAAIAAAKU) - splitter - - UAVGadgetManagerV1 - - - false - - - - HITL - - XPlane HITL - - uavGadget - - - HITLv2 - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAA=) - splitter - - - - - PfdQmlGadget - - NoTerrain - - uavGadget - - - MagicWaypointGadget - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAAB7wAAAAIAAAGU) - splitter - - - GCSControlGadget - - MS Sidewinder - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAADhAAAAAIAAAIX) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAADDAAAAAIAAAJJ) - splitter - - UAVGadgetManagerV1 - - - false - - - Uploader - - default - - uavGadget - - - - - LineardialGadget - - Flight Time - - uavGadget - - - SystemHealthGadget - - default - - uavGadget - - 1 - @Variant(AAAACQAAAAIAAAACAAABQgAAAAIAAAGM) - splitter - - - - - DialGadget - - Deluxe Attitude - - uavGadget - - - DialGadget - - Deluxe Baro Altimeter - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - - - DialGadget - - Deluxe Compass - - uavGadget - - - DialGadget - - Deluxe Climbrate - - uavGadget - - 2 - @Variant(AAAACQAAAAA=) - splitter - - 1 - @Variant(AAAACQAAAAA=) - splitter - - 2 - @Variant(AAAACQAAAAIAAAACAAABLwAAAAIAAAHf) - splitter - - 1 - @Variant(AAAACQAAAAIAAAACAAADVQAAAAIAAAJK) - splitter - - UAVGadgetManagerV1 - - - - false - :/core/images/ah.png - :/core/images/openpilot_logo_64.png - :/core/images/config.png - :/core/images/cog.png - :/core/images/scopes.png - :/core/images/joystick.png - :/core/images/cpu.png - :/core/images/openpilot_logo_64.png - :/core/images/openpilot_logo_64.png - :/core/images/openpilot_logo_64.png - 6 - 1 - Flight data - Workspace10 - Configuration - System - Scopes - HITL - Firmware - Workspace7 - Workspace8 - Workspace9 - -
From bc3636bbd673f81b44e030cf74858909de1a6d23 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 23 Feb 2014 13:04:39 +0100 Subject: [PATCH 004/131] OP-1235 gives better names to state variables Conflicts: flight/modules/StateEstimation/filteraltitude.c --- .../modules/StateEstimation/filteraltitude.c | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/flight/modules/StateEstimation/filteraltitude.c b/flight/modules/StateEstimation/filteraltitude.c index 2b46b35af..aba721ec6 100644 --- a/flight/modules/StateEstimation/filteraltitude.c +++ b/flight/modules/StateEstimation/filteraltitude.c @@ -47,7 +47,10 @@ // Private types struct data { - float state[4]; // state = altitude,velocity,accel_offset,accel + float altitudeState; // state = altitude,velocity,accel_offset,accel + float velocityState; + float accelBiasState; + float accelState; float pos[3]; // position updates from other filters float vel[3]; // position updates from other filters @@ -81,10 +84,10 @@ static int32_t init(stateFilter *self) { struct data *this = (struct data *)self->localdata; - this->state[0] = 0.0f; - this->state[1] = 0.0f; - this->state[2] = 0.0f; - this->state[3] = 0.0f; + this->altitudeState = 0.0f; + this->velocityState = 0.0f; + this->accelBiasState = 0.0f; + this->accelState = 0.0f; this->pos[0] = 0.0f; this->pos[1] = 0.0f; this->pos[2] = 0.0f; @@ -115,13 +118,13 @@ static int32_t filter(stateFilter *self, stateEstimation *state) this->pos[0] = state->pos[0]; this->pos[1] = state->pos[1]; this->pos[2] = state->pos[2]; - state->pos[2] = -this->state[0]; + state->pos[2] = -this->altitudeState; } if (IS_SET(state->updated, SENSORUPDATES_vel)) { this->vel[0] = state->vel[0]; this->vel[1] = state->vel[1]; this->vel[2] = state->vel[2]; - state->vel[2] = -this->state[1]; + state->vel[2] = -this->velocityState; } if (IS_SET(state->updated, SENSORUPDATES_accel)) { // rotate accels into global coordinate frame @@ -132,51 +135,51 @@ static int32_t filter(stateFilter *self, stateEstimation *state) float current = -(Rbe[0][2] * state->accel[0] + Rbe[1][2] * state->accel[1] + Rbe[2][2] * state->accel[2] + 9.81f); // low pass filter accelerometers - this->state[3] = (1.0f - this->settings.AccelLowPassKp) * this->state[3] + this->settings.AccelLowPassKp * current; + this->accelState = (1.0f - this->settings.AccelLowPassKp) * this->accelState + this->settings.AccelLowPassKp * current; // correct accel offset (low pass zeroing) - this->state[2] = (1.0f - this->settings.AccelDriftKi) * this->state[2] + this->settings.AccelDriftKi * this->state[3]; + this->accelBiasState = (1.0f - this->settings.AccelDriftKi) * this->accelBiasState + this->settings.AccelDriftKi * this->accelState; // correct velocity and position state (integration) // low pass for average dT, compensate timing jitter from scheduler // float dT = PIOS_DELTATIME_GetAverageSeconds(&this->dt1config); - float speedLast = this->state[1]; + float speedLast = this->velocityState; - this->state[1] += 0.5f * (this->accelLast + (this->state[3] - this->state[2])) * dT; - this->accelLast = this->state[3] - this->state[2]; + this->velocityState += 0.5f * (this->accelLast + (this->accelState - this->accelBiasState)) * dT; + this->accelLast = this->accelState - this->accelBiasState; - this->state[0] += 0.5f * (speedLast + this->state[1]) * dT; + this->altitudeState += 0.5f * (speedLast + this->velocityState) * dT; state->pos[0] = this->pos[0]; state->pos[1] = this->pos[1]; - state->pos[2] = -this->state[0]; + state->pos[2] = -this->altitudeState; state->updated |= SENSORUPDATES_pos; state->vel[0] = this->vel[0]; state->vel[1] = this->vel[1]; - state->vel[2] = -this->state[1]; + state->vel[2] = -this->velocityState; state->updated |= SENSORUPDATES_vel; } if (IS_SET(state->updated, SENSORUPDATES_baro)) { // correct the altitude state (simple low pass) - this->state[0] = (1.0f - this->settings.BaroKp) * this->state[0] + this->settings.BaroKp * state->baro[0]; + this->altitudeState = (1.0f - this->settings.BaroKp) * this->altitudeState + this->settings.BaroKp * state->baro[0]; // correct the velocity state (low pass differentiation) // low pass for average dT, compensate timing jitter from scheduler float dT = PIOS_DELTATIME_GetAverageSeconds(&this->dt2config); - this->state[1] = (1.0f - (this->settings.BaroKp * this->settings.BaroKp)) * this->state[1] + (this->settings.BaroKp * this->settings.BaroKp) * (state->baro[0] - this->baroLast) / dT; + this->velocityState = (1.0f - (this->settings.BaroKp * this->settings.BaroKp)) * this->velocityState + (this->settings.BaroKp * this->settings.BaroKp) * (state->baro[0] - this->baroLast) / dT; this->baroLast = state->baro[0]; state->pos[0] = this->pos[0]; state->pos[1] = this->pos[1]; - state->pos[2] = -this->state[0]; + state->pos[2] = -this->altitudeState; state->updated |= SENSORUPDATES_pos; state->vel[0] = this->vel[0]; state->vel[1] = this->vel[1]; - state->vel[2] = -this->state[1]; + state->vel[2] = -this->velocityState; state->updated |= SENSORUPDATES_vel; } } From a2386f548b2aed950f0b71881798d5d670041039 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 22 Feb 2014 21:24:27 +0100 Subject: [PATCH 005/131] OP-1235 allow for live update of altitude estimation settings --- flight/modules/StateEstimation/filteraltitude.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/flight/modules/StateEstimation/filteraltitude.c b/flight/modules/StateEstimation/filteraltitude.c index aba721ec6..d05caaff6 100644 --- a/flight/modules/StateEstimation/filteraltitude.c +++ b/flight/modules/StateEstimation/filteraltitude.c @@ -44,6 +44,7 @@ #define DT_MIN 1e-6f #define DT_MAX 1.0f #define DT_AVERAGE 1e-3f +static volatile bool reloadSettings; // Private types struct data { @@ -68,6 +69,7 @@ struct data { static int32_t init(stateFilter *self); static int32_t filter(stateFilter *self, stateEstimation *state); +static void settingsUpdatedCb(UAVObjEvent *ev); int32_t filterAltitudeInitialize(stateFilter *handle) @@ -77,6 +79,8 @@ int32_t filterAltitudeInitialize(stateFilter *handle) handle->localdata = pvPortMalloc(sizeof(struct data)); AttitudeStateInitialize(); AltitudeFilterSettingsInitialize(); + AltitudeFilterSettingsConnectCallback(&settingsUpdatedCb); + reloadSettings = true; return STACK_REQUIRED; } @@ -99,7 +103,6 @@ static int32_t init(stateFilter *self) this->baroLast = 0.0f; this->accelLast = 0.0f; this->first_run = 1; - AltitudeFilterSettingsGet(&this->settings); return 0; } @@ -107,6 +110,11 @@ static int32_t filter(stateFilter *self, stateEstimation *state) { struct data *this = (struct data *)self->localdata; + if (reloadSettings) { + reloadSettings = false; + AltitudeFilterSettingsGet(&this->settings); + } + if (this->first_run) { // Initialize to current altitude reading at initial location if (IS_SET(state->updated, SENSORUPDATES_baro)) { @@ -187,6 +195,12 @@ static int32_t filter(stateFilter *self, stateEstimation *state) return 0; } +void settingsUpdatedCb(UAVObjEvent *ev) +{ + if (ev->obj == AltitudeFilterSettingsHandle()) { + reloadSettings = true; + } +} /** * @} From 7f6175d81773e93180419a38b663e2c62b98d0b2 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 23 Feb 2014 12:57:59 +0100 Subject: [PATCH 006/131] OP-1235 allows AccelBiasValue to quickly reach the target value at initialization --- flight/modules/StateEstimation/filteraltitude.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/flight/modules/StateEstimation/filteraltitude.c b/flight/modules/StateEstimation/filteraltitude.c index d05caaff6..0bea2411f 100644 --- a/flight/modules/StateEstimation/filteraltitude.c +++ b/flight/modules/StateEstimation/filteraltitude.c @@ -60,6 +60,7 @@ struct data { float accelLast; float baroLast; bool first_run; + portTickType initTimer; AltitudeFilterSettingsData settings; }; @@ -119,6 +120,7 @@ static int32_t filter(stateFilter *self, stateEstimation *state) // Initialize to current altitude reading at initial location if (IS_SET(state->updated, SENSORUPDATES_baro)) { this->first_run = 0; + this->initTimer = xTaskGetTickCount(); } } else { // save existing position and velocity updates so GPS will still work @@ -143,11 +145,14 @@ static int32_t filter(stateFilter *self, stateEstimation *state) float current = -(Rbe[0][2] * state->accel[0] + Rbe[1][2] * state->accel[1] + Rbe[2][2] * state->accel[2] + 9.81f); // low pass filter accelerometers - this->accelState = (1.0f - this->settings.AccelLowPassKp) * this->accelState + this->settings.AccelLowPassKp * current; - - // correct accel offset (low pass zeroing) - this->accelBiasState = (1.0f - this->settings.AccelDriftKi) * this->accelBiasState + this->settings.AccelDriftKi * this->accelState; - + this->accelState = (1.0f - this->settings.AccelLowPassKp) * this->accelState + this->settings.AccelLowPassKp * current; + if (((xTaskGetTickCount() - this->initTimer) / portTICK_RATE_MS) < 5000) { + // allow the offset to reach quickly the target value in case of small AccelDriftKi + this->accelBiasState = (1.0f - 0.2f) * this->accelBiasState + 0.2f * this->accelState; + } else { + // correct accel offset (low pass zeroing) + this->accelBiasState = (1.0f - this->settings.AccelDriftKi) * this->accelBiasState + this->settings.AccelDriftKi * this->accelState; + } // correct velocity and position state (integration) // low pass for average dT, compensate timing jitter from scheduler // From 607466f93772874f3521ea5d53a8721a10fd9ccd Mon Sep 17 00:00:00 2001 From: m_thread Date: Wed, 26 Feb 2014 14:44:45 +0100 Subject: [PATCH 007/131] OP-1245 Adjustments to qml dialog design to accomodate log settings and control. --- .../src/plugins/flightlog/FlightLogDialog.qml | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 9f33efebd..8b9c80501 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -30,6 +30,7 @@ Rectangle { TableView { Layout.fillWidth: true Layout.fillHeight: true + Layout.preferredHeight: 1000; model: logManager.logEntries itemDelegate: Text { @@ -88,6 +89,7 @@ Rectangle { RowLayout { anchors.margins: 10 spacing: 10 + ColumnLayout { spacing: 10 Text { @@ -101,6 +103,18 @@ Rectangle { text: "" + qsTr("Entries logged (free): ") + "" + logStatus.UsedSlots + " (" + logStatus.FreeSlots + ")" } + Rectangle { + Layout.fillHeight: true + } + CheckBox { + id: exportRelativeTimeCB + enabled: !logManager.disableControls && !logManager.disableExport + text: qsTr("Adjust timestamps") + activeFocusOnPress: true + checked: logManager.adjustExportedTimestamps + onCheckedChanged: logManager.setAdjustExportedTimestamps(checked) + } + } Rectangle { Layout.fillWidth: true @@ -123,11 +137,17 @@ Rectangle { } } RowLayout { - Layout.fillWidth: true - Layout.fillHeight: true + spacing: 10 Rectangle { Layout.fillWidth: true } + Button { + id: clearButton + enabled: !logManager.disableControls + text: qsTr("Clear all logs") + activeFocusOnPress: true + onClicked: logManager.clearAllLogs() + } Button { text: qsTr("Download logs") enabled: !logManager.disableControls @@ -135,6 +155,21 @@ Rectangle { onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1) } } + Rectangle { + Layout.fillHeight: true + } + RowLayout { + Rectangle { + Layout.fillWidth: true + } + Button { + id: exportButton + enabled: !logManager.disableControls && !logManager.disableExport + text: qsTr("Export logs...") + activeFocusOnPress: true + onClicked: logManager.exportLogs() + } + } } } } @@ -143,29 +178,6 @@ Rectangle { RowLayout { Layout.fillWidth: true height: 40 - Button { - id: exportButton - enabled: !logManager.disableControls && !logManager.disableExport - text: qsTr("Export...") - activeFocusOnPress: true - onClicked: logManager.exportLogs() - } - CheckBox { - id: exportRelativeTimeCB - enabled: !logManager.disableControls && !logManager.disableExport - text: qsTr("Adjust timestamps") - activeFocusOnPress: true - checked: logManager.adjustExportedTimestamps - onCheckedChanged: logManager.setAdjustExportedTimestamps(checked) - } - - Button { - id: clearButton - enabled: !logManager.disableControls - text: qsTr("Clear all logs") - activeFocusOnPress: true - onClicked: logManager.clearAllLogs() - } Rectangle { Layout.fillWidth: true } From 749703d1879e3f856462921c87ebf14fd9c6ce56 Mon Sep 17 00:00:00 2001 From: m_thread Date: Wed, 26 Feb 2014 15:56:20 +0100 Subject: [PATCH 008/131] OP-1245 GUI fixing. --- .../src/plugins/flightlog/FlightLogDialog.qml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 8b9c80501..0901aa8f4 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -25,7 +25,6 @@ Rectangle { Text { Layout.fillWidth: true text: "" + qsTr("Log entries") + "" - font.pixelSize: 12 } TableView { Layout.fillWidth: true @@ -94,12 +93,10 @@ Rectangle { spacing: 10 Text { id: totalFlights - font.pixelSize: 12 text: "" + qsTr("Flights recorded: ") + "" + (logStatus.Flight + 1) } Text { id: totalEntries - font.pixelSize: 12 text: "" + qsTr("Entries logged (free): ") + "" + logStatus.UsedSlots + " (" + logStatus.FreeSlots + ")" } @@ -114,7 +111,6 @@ Rectangle { checked: logManager.adjustExportedTimestamps onCheckedChanged: logManager.setAdjustExportedTimestamps(checked) } - } Rectangle { Layout.fillWidth: true @@ -126,7 +122,6 @@ Rectangle { Layout.fillWidth: true } Text { - font.pixelSize: 12 text: "" + qsTr("Flight to download:") + "" } @@ -141,13 +136,6 @@ Rectangle { Rectangle { Layout.fillWidth: true } - Button { - id: clearButton - enabled: !logManager.disableControls - text: qsTr("Clear all logs") - activeFocusOnPress: true - onClicked: logManager.clearAllLogs() - } Button { text: qsTr("Download logs") enabled: !logManager.disableControls @@ -162,6 +150,13 @@ Rectangle { Rectangle { Layout.fillWidth: true } + Button { + id: clearButton + enabled: !logManager.disableControls + text: qsTr("Clear all logs") + activeFocusOnPress: true + onClicked: logManager.clearAllLogs() + } Button { id: exportButton enabled: !logManager.disableControls && !logManager.disableExport From b2168a49826556c08aee93c0817842a0fd5da027 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 2 Mar 2014 14:46:01 +0100 Subject: [PATCH 009/131] OP-1033 moved f1 specific usb include files to stm32f10x/inc directory --- flight/pios/{ => stm32f10x}/inc/pios_usb_hid_istr.h | 0 flight/pios/{ => stm32f10x}/inc/pios_usb_hid_pwr.h | 0 flight/pios/{ => stm32f10x}/inc/pios_usb_rctx.h | 0 flight/pios/{ => stm32f10x}/inc/pios_usb_rctx_priv.h | 0 flight/pios/{ => stm32f10x}/inc/usb_conf.h | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename flight/pios/{ => stm32f10x}/inc/pios_usb_hid_istr.h (100%) rename flight/pios/{ => stm32f10x}/inc/pios_usb_hid_pwr.h (100%) rename flight/pios/{ => stm32f10x}/inc/pios_usb_rctx.h (100%) rename flight/pios/{ => stm32f10x}/inc/pios_usb_rctx_priv.h (100%) rename flight/pios/{ => stm32f10x}/inc/usb_conf.h (100%) diff --git a/flight/pios/inc/pios_usb_hid_istr.h b/flight/pios/stm32f10x/inc/pios_usb_hid_istr.h similarity index 100% rename from flight/pios/inc/pios_usb_hid_istr.h rename to flight/pios/stm32f10x/inc/pios_usb_hid_istr.h diff --git a/flight/pios/inc/pios_usb_hid_pwr.h b/flight/pios/stm32f10x/inc/pios_usb_hid_pwr.h similarity index 100% rename from flight/pios/inc/pios_usb_hid_pwr.h rename to flight/pios/stm32f10x/inc/pios_usb_hid_pwr.h diff --git a/flight/pios/inc/pios_usb_rctx.h b/flight/pios/stm32f10x/inc/pios_usb_rctx.h similarity index 100% rename from flight/pios/inc/pios_usb_rctx.h rename to flight/pios/stm32f10x/inc/pios_usb_rctx.h diff --git a/flight/pios/inc/pios_usb_rctx_priv.h b/flight/pios/stm32f10x/inc/pios_usb_rctx_priv.h similarity index 100% rename from flight/pios/inc/pios_usb_rctx_priv.h rename to flight/pios/stm32f10x/inc/pios_usb_rctx_priv.h diff --git a/flight/pios/inc/usb_conf.h b/flight/pios/stm32f10x/inc/usb_conf.h similarity index 100% rename from flight/pios/inc/usb_conf.h rename to flight/pios/stm32f10x/inc/usb_conf.h From 9a0f28d1386bb19940b6d492d6082812e647d09e Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 2 Mar 2014 14:47:17 +0100 Subject: [PATCH 010/131] OP-1033 removed useless self inclusion of f4 usb_conf.h --- flight/pios/stm32f4xx/inc/usb_conf.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/flight/pios/stm32f4xx/inc/usb_conf.h b/flight/pios/stm32f4xx/inc/usb_conf.h index 8bb0d25c3..8b209e24e 100644 --- a/flight/pios/stm32f4xx/inc/usb_conf.h +++ b/flight/pios/stm32f4xx/inc/usb_conf.h @@ -32,8 +32,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx.h" -#include "usb_conf.h" - /** @addtogroup USB_OTG_DRIVER * @{ */ From e9dc5fac9a30c700fabc74958283ea22b683a48d Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 2 Mar 2014 14:51:34 +0100 Subject: [PATCH 011/131] OP-1033 added more descriptive comment for usb end points (f1) --- flight/pios/stm32f10x/inc/usb_conf.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/flight/pios/stm32f10x/inc/usb_conf.h b/flight/pios/stm32f10x/inc/usb_conf.h index 6c9ec9008..898eb4034 100644 --- a/flight/pios/stm32f10x/inc/usb_conf.h +++ b/flight/pios/stm32f10x/inc/usb_conf.h @@ -29,25 +29,24 @@ /* -------------- Buffer Description Table -----------------*/ /*-------------------------------------------------------------*/ /* buffer table base address */ -/* buffer table base address */ #define BTABLE_ADDRESS (0x00) -/* EP0 */ +/* EP0 (Control) */ /* rx/tx buffer base address */ #define ENDP0_RXADDR (0x20) #define ENDP0_TXADDR (0x40) -/* EP1 */ +/* EP1 (HID) */ /* rx/tx buffer base address */ #define ENDP1_TXADDR (0x60) #define ENDP1_RXADDR (0x80) -/* EP2 */ +/* EP2 (CDC Call Control) */ /* rx/tx buffer base address */ #define ENDP2_TXADDR (0x100) #define ENDP2_RXADDR (0x140) -/* EP3 */ +/* EP3 (CDC Data) */ /* rx/tx buffer base address */ #define ENDP3_TXADDR (0x180) #define ENDP3_RXADDR (0x1C0) From 4f42a1e950bdc5a35f407db3918440e48dba8cc8 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 3 Mar 2014 20:54:45 +0100 Subject: [PATCH 012/131] OP-1033 added TODOs to validate that f1 USB end points configuration is consistent --- flight/pios/stm32f10x/pios_usbhook.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flight/pios/stm32f10x/pios_usbhook.c b/flight/pios/stm32f10x/pios_usbhook.c index c1173db7d..3090aff2e 100644 --- a/flight/pios/stm32f10x/pios_usbhook.c +++ b/flight/pios/stm32f10x/pios_usbhook.c @@ -200,10 +200,12 @@ static void PIOS_USBHOOK_Reset(void) #if defined(PIOS_INCLUDE_USB_HID) /* Initialize Endpoint 1 (HID) */ SetEPType(ENDP1, EP_INTERRUPT); + // TODO Validate that address and length are consistent SetEPTxAddr(ENDP1, ENDP1_TXADDR); SetEPTxCount(ENDP1, PIOS_USB_BOARD_HID_DATA_LENGTH); SetEPTxStatus(ENDP1, EP_TX_NAK); + // TODO Validate that address and length are consistent SetEPRxAddr(ENDP1, ENDP1_RXADDR); SetEPRxCount(ENDP1, PIOS_USB_BOARD_HID_DATA_LENGTH); SetEPRxStatus(ENDP1, EP_RX_VALID); From ef137a27b3cdc5441883640029c7bbd4f3d7edf7 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 3 Mar 2014 22:01:13 +0100 Subject: [PATCH 013/131] OP-1033 Added note where appropriate that changing USB buffer length will require changes to the USB buffer setup --- .../boards/coptercontrol/bootloader/inc/pios_usb_board_data.h | 1 + .../boards/coptercontrol/firmware/inc/pios_usb_board_data.h | 1 + .../boards/oplinkmini/bootloader/inc/pios_usb_board_data.h | 1 + .../targets/boards/oplinkmini/firmware/inc/pios_usb_board_data.h | 1 + flight/targets/boards/osd/bootloader/inc/pios_usb_board_data.h | 1 + flight/targets/boards/osd/firmware/inc/pios_usb_board_data.h | 1 + .../boards/revolution/bootloader/inc/pios_usb_board_data.h | 1 + .../targets/boards/revolution/firmware/inc/pios_usb_board_data.h | 1 + .../boards/revoproto/bootloader/inc/pios_usb_board_data.h | 1 + .../targets/boards/revoproto/firmware/inc/pios_usb_board_data.h | 1 + 10 files changed, 10 insertions(+) diff --git a/flight/targets/boards/coptercontrol/bootloader/inc/pios_usb_board_data.h b/flight/targets/boards/coptercontrol/bootloader/inc/pios_usb_board_data.h index 6be4c4b70..5a40bf4cf 100644 --- a/flight/targets/boards/coptercontrol/bootloader/inc/pios_usb_board_data.h +++ b/flight/targets/boards/coptercontrol/bootloader/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 #define PIOS_USB_BOARD_EP_NUM 2 diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_usb_board_data.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_usb_board_data.h index 248ef57d7..1fac7c659 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_usb_board_data.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 #define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 diff --git a/flight/targets/boards/oplinkmini/bootloader/inc/pios_usb_board_data.h b/flight/targets/boards/oplinkmini/bootloader/inc/pios_usb_board_data.h index e32e8fd9e..d3a32b6c7 100644 --- a/flight/targets/boards/oplinkmini/bootloader/inc/pios_usb_board_data.h +++ b/flight/targets/boards/oplinkmini/bootloader/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 #define PIOS_USB_BOARD_EP_NUM 2 diff --git a/flight/targets/boards/oplinkmini/firmware/inc/pios_usb_board_data.h b/flight/targets/boards/oplinkmini/firmware/inc/pios_usb_board_data.h index 736a7dbca..e3dcb39f1 100644 --- a/flight/targets/boards/oplinkmini/firmware/inc/pios_usb_board_data.h +++ b/flight/targets/boards/oplinkmini/firmware/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 #define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 diff --git a/flight/targets/boards/osd/bootloader/inc/pios_usb_board_data.h b/flight/targets/boards/osd/bootloader/inc/pios_usb_board_data.h index d7b10fea5..e87233d37 100644 --- a/flight/targets/boards/osd/bootloader/inc/pios_usb_board_data.h +++ b/flight/targets/boards/osd/bootloader/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 #define PIOS_USB_BOARD_EP_NUM 2 diff --git a/flight/targets/boards/osd/firmware/inc/pios_usb_board_data.h b/flight/targets/boards/osd/firmware/inc/pios_usb_board_data.h index 32e9f0ea6..0c92f9a9b 100644 --- a/flight/targets/boards/osd/firmware/inc/pios_usb_board_data.h +++ b/flight/targets/boards/osd/firmware/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 #define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 diff --git a/flight/targets/boards/revolution/bootloader/inc/pios_usb_board_data.h b/flight/targets/boards/revolution/bootloader/inc/pios_usb_board_data.h index 4e9c7c063..8aa5d2f9d 100644 --- a/flight/targets/boards/revolution/bootloader/inc/pios_usb_board_data.h +++ b/flight/targets/boards/revolution/bootloader/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 #define PIOS_USB_BOARD_EP_NUM 2 diff --git a/flight/targets/boards/revolution/firmware/inc/pios_usb_board_data.h b/flight/targets/boards/revolution/firmware/inc/pios_usb_board_data.h index 2e607ad2c..351eaf5e2 100644 --- a/flight/targets/boards/revolution/firmware/inc/pios_usb_board_data.h +++ b/flight/targets/boards/revolution/firmware/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 #define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 diff --git a/flight/targets/boards/revoproto/bootloader/inc/pios_usb_board_data.h b/flight/targets/boards/revoproto/bootloader/inc/pios_usb_board_data.h index 4e9c7c063..8aa5d2f9d 100644 --- a/flight/targets/boards/revoproto/bootloader/inc/pios_usb_board_data.h +++ b/flight/targets/boards/revoproto/bootloader/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 #define PIOS_USB_BOARD_EP_NUM 2 diff --git a/flight/targets/boards/revoproto/firmware/inc/pios_usb_board_data.h b/flight/targets/boards/revoproto/firmware/inc/pios_usb_board_data.h index 2e607ad2c..351eaf5e2 100644 --- a/flight/targets/boards/revoproto/firmware/inc/pios_usb_board_data.h +++ b/flight/targets/boards/revoproto/firmware/inc/pios_usb_board_data.h @@ -31,6 +31,7 @@ #ifndef PIOS_USB_BOARD_DATA_H #define PIOS_USB_BOARD_DATA_H +// Note : changing below length will require changes to the USB buffer setup #define PIOS_USB_BOARD_CDC_DATA_LENGTH 64 #define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32 #define PIOS_USB_BOARD_HID_DATA_LENGTH 64 From 1e3e8a29a92cb3cfa4444e474b9f7a8bd093bcd5 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 09:49:34 +0100 Subject: [PATCH 014/131] OP-1246 fixed clumsy error handling of UAVTalkSendObject calls from RadioComBridge --- flight/modules/RadioComBridge/RadioComBridge.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index 2be3764cb..c0d17593b 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -342,11 +342,11 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters) updateRadioComBridgeStats(); } // Send update (with retries) + int32_t ret = -1; uint32_t retries = 0; - int32_t success = -1; - while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendObject(data->telemUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS) == 0; - if (success == -1) { + while (retries <= MAX_RETRIES && ret == -1) { + ret = UAVTalkSendObject(data->telemUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS); + if (ret == -1) { ++retries; } } @@ -376,11 +376,11 @@ static void radioTxTask(__attribute__((unused)) void *parameters) if (xQueueReceive(data->radioEventQueue, &ev, MAX_PORT_DELAY) == pdTRUE) { if ((ev.event == EV_UPDATED) || (ev.event == EV_UPDATE_REQ)) { // Send update (with retries) + int32_t ret = -1; uint32_t retries = 0; - int32_t success = -1; - while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendObject(data->radioUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS) == 0; - if (success == -1) { + while (retries <= MAX_RETRIES && ret == -1) { + ret = UAVTalkSendObject(data->radioUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS); + if (ret == -1) { ++retries; } } From 29198e17cffc9b373fea69714f7ca4c6717cfc8a Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 09:51:45 +0100 Subject: [PATCH 015/131] OP-1246 fixed wrong logic for telemtryTxRetries and radioTxRetries : was wrongly accumulated --- flight/modules/RadioComBridge/RadioComBridge.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index c0d17593b..3aa6297b9 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -299,10 +299,12 @@ static void updateRadioComBridgeStats() // Get stats object data RadioComBridgeStatsGet(&radioComBridgeStats); + radioComBridgeStats.TelemetryTxRetries = data->telemetryTxRetries; + radioComBridgeStats.RadioTxRetries = data->radioTxRetries; + // Update stats object radioComBridgeStats.TelemetryTxBytes += telemetryUAVTalkStats.txBytes; radioComBridgeStats.TelemetryTxFailures += telemetryUAVTalkStats.txErrors; - radioComBridgeStats.TelemetryTxRetries += data->telemetryTxRetries; radioComBridgeStats.TelemetryRxBytes += telemetryUAVTalkStats.rxBytes; radioComBridgeStats.TelemetryRxFailures += telemetryUAVTalkStats.rxErrors; @@ -311,7 +313,6 @@ static void updateRadioComBridgeStats() radioComBridgeStats.RadioTxBytes += radioUAVTalkStats.txBytes; radioComBridgeStats.RadioTxFailures += radioUAVTalkStats.txErrors; - radioComBridgeStats.RadioTxRetries += data->radioTxRetries; radioComBridgeStats.RadioRxBytes += radioUAVTalkStats.rxBytes; radioComBridgeStats.RadioRxFailures += radioUAVTalkStats.rxErrors; From 067cb6f098537482ed76b398b52978a1cd30a026 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 09:56:42 +0100 Subject: [PATCH 016/131] OP-1246 made updating of RadioComBridgeStats thread safe --- flight/modules/RadioComBridge/RadioComBridge.c | 6 ++---- flight/modules/Telemetry/telemetry.c | 6 ++---- flight/uavtalk/inc/uavtalk.h | 4 ++-- flight/uavtalk/uavtalk.c | 14 ++++++++++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index 3aa6297b9..7e10557ea 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -289,12 +289,10 @@ static void updateRadioComBridgeStats() RadioComBridgeStatsData radioComBridgeStats; // Get telemetry stats - UAVTalkGetStats(data->telemUAVTalkCon, &telemetryUAVTalkStats); - UAVTalkResetStats(data->telemUAVTalkCon); + UAVTalkGetStats(data->telemUAVTalkCon, &telemetryUAVTalkStats, true); // Get radio stats - UAVTalkGetStats(data->radioUAVTalkCon, &radioUAVTalkStats); - UAVTalkResetStats(data->radioUAVTalkCon); + UAVTalkGetStats(data->radioUAVTalkCon, &radioUAVTalkStats, true); // Get stats object data RadioComBridgeStatsGet(&radioComBridgeStats); diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index b07bb85a5..7a6844e8b 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -542,12 +542,10 @@ static void updateTelemetryStats() uint32_t timeNow; // Get stats - UAVTalkGetStats(uavTalkCon, &utalkStats); + UAVTalkGetStats(uavTalkCon, &utalkStats, true); #ifdef PIOS_INCLUDE_RFM22B - UAVTalkAddStats(radioUavTalkCon, &utalkStats); - UAVTalkResetStats(radioUavTalkCon); + UAVTalkAddStats(radioUavTalkCon, &utalkStats, true); #endif - UAVTalkResetStats(uavTalkCon); // Get object data FlightTelemetryStatsGet(&flightStats); diff --git a/flight/uavtalk/inc/uavtalk.h b/flight/uavtalk/inc/uavtalk.h index e54231735..9dc92187c 100644 --- a/flight/uavtalk/inc/uavtalk.h +++ b/flight/uavtalk/inc/uavtalk.h @@ -61,8 +61,8 @@ UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connection, uint8_t r UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connection, uint8_t rxbyte); UAVTalkRxState UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle); int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle); -void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats); -void UAVTalkAddStats(UAVTalkConnection connection, UAVTalkStats *stats); +void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset); +void UAVTalkAddStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset); void UAVTalkResetStats(UAVTalkConnection connection); void UAVTalkGetLastTimestamp(UAVTalkConnection connection, uint16_t *timestamp); uint32_t UAVTalkGetPacketObjId(UAVTalkConnection connection); diff --git a/flight/uavtalk/uavtalk.c b/flight/uavtalk/uavtalk.c index 0f9dd3d0e..47c668461 100644 --- a/flight/uavtalk/uavtalk.c +++ b/flight/uavtalk/uavtalk.c @@ -133,7 +133,7 @@ UAVTalkOutputStream UAVTalkGetOutputStream(UAVTalkConnection connectionHandle) * \param[in] connection UAVTalkConnection to be used * @param[out] statsOut Statistics counters */ -void UAVTalkGetStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut) +void UAVTalkGetStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut, bool reset) { UAVTalkConnectionData *connection; @@ -145,6 +145,11 @@ void UAVTalkGetStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut) // Copy stats memcpy(statsOut, &connection->stats, sizeof(UAVTalkStats)); + if (reset) { + // Clear stats + memset(&connection->stats, 0, sizeof(UAVTalkStats)); + } + // Release lock xSemaphoreGiveRecursive(connection->lock); } @@ -154,7 +159,7 @@ void UAVTalkGetStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut) * \param[in] connection UAVTalkConnection to be used * @param[out] statsOut Statistics counters */ -void UAVTalkAddStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut) +void UAVTalkAddStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut, bool reset) { UAVTalkConnectionData *connection; @@ -175,6 +180,11 @@ void UAVTalkAddStats(UAVTalkConnection connectionHandle, UAVTalkStats *statsOut) statsOut->rxSyncErrors += connection->stats.rxSyncErrors; statsOut->rxCrcErrors += connection->stats.rxCrcErrors; + if (reset) { + // Clear stats + memset(&connection->stats, 0, sizeof(UAVTalkStats)); + } + // Release lock xSemaphoreGiveRecursive(connection->lock); } From d37854dceb0d533401c6d36a83468d67c1974e0c Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 10:01:13 +0100 Subject: [PATCH 017/131] OP-1246 fixed UAVTalkRelayPacket return type to match documentation --- flight/uavtalk/inc/uavtalk.h | 2 +- flight/uavtalk/uavtalk.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flight/uavtalk/inc/uavtalk.h b/flight/uavtalk/inc/uavtalk.h index 9dc92187c..f66eb4a00 100644 --- a/flight/uavtalk/inc/uavtalk.h +++ b/flight/uavtalk/inc/uavtalk.h @@ -59,7 +59,7 @@ int32_t UAVTalkSendObjectTimestamped(UAVTalkConnection connectionHandle, UAVObjH int32_t UAVTalkSendObjectRequest(UAVTalkConnection connection, UAVObjHandle obj, uint16_t instId, int32_t timeoutMs); UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connection, uint8_t rxbyte); UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connection, uint8_t rxbyte); -UAVTalkRxState UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle); +int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle); int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle); void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset); void UAVTalkAddStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset); diff --git a/flight/uavtalk/uavtalk.c b/flight/uavtalk/uavtalk.c index 47c668461..4de5a32d5 100644 --- a/flight/uavtalk/uavtalk.c +++ b/flight/uavtalk/uavtalk.c @@ -599,7 +599,7 @@ UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uin * \return 0 Success * \return -1 Failure */ -UAVTalkRxState UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle) +int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle) { UAVTalkConnectionData *inConnection; @@ -666,17 +666,17 @@ UAVTalkRxState UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkC outConnection->stats.txBytes += (rc > 0) ? rc : 0; // evaluate return value before releasing the lock - UAVTalkRxState rxState = 0; + int32_t ret = 0; if (rc != (int32_t)(headerLength + inIproc->length + UAVTALK_CHECKSUM_LENGTH)) { outConnection->stats.txErrors++; - rxState = -1; + ret = -1; } // Release lock xSemaphoreGiveRecursive(outConnection->lock); // Done - return rxState; + return ret; } /** From 7ab38eacb6ad438d9887d09727a766b5637f138a Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 10:02:43 +0100 Subject: [PATCH 018/131] OP-1246 removed now uneeded FIXME tag in RadioComBridge --- flight/modules/RadioComBridge/RadioComBridge.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index 7e10557ea..66cb22a19 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -412,8 +412,8 @@ static void radioRxTask(__attribute__((unused)) void *parameters) } } else if (PIOS_COM_TELEMETRY) { // Send the data straight to the telemetry port. - // FIXME following call can fail (with -2 error code) if buffer is full - // it is the caller responsibility to retry in such cases... + // Following call can fail with -2 error code (buffer full) or -3 error code (could not acquire send mutex) + // It is the caller responsibility to retry in such cases... int32_t ret = -2; uint8_t count = 5; while (count-- > 0 && ret < -1) { @@ -512,8 +512,8 @@ static void serialRxTask(__attribute__((unused)) void *parameters) if (bytes_to_process > 0) { // Send the data over the radio link. - // FIXME following call can fail (with -2 error code) if buffer is full - // it is the caller responsibility to retry in such cases... + // Following call can fail with -2 error code (buffer full) or -3 error code (could not acquire send mutex) + // It is the caller responsibility to retry in such cases... int32_t ret = -2; uint8_t count = 5; while (count-- > 0 && ret < -1) { @@ -546,8 +546,8 @@ static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length) } #endif /* PIOS_INCLUDE_USB */ if (outputPort) { - // FIXME following call can fail (with -2 error code) if buffer is full - // it is the caller responsibility to retry in such cases... + // Following call can fail with -2 error code (buffer full) or -3 error code (could not acquire send mutex) + // It is the caller responsibility to retry in such cases... ret = -2; uint8_t count = 5; while (count-- > 0 && ret < -1) { @@ -576,8 +576,8 @@ static int32_t RadioSendHandler(uint8_t *buf, int32_t length) // Don't send any data unless the radio port is available. if (outputPort && PIOS_COM_Available(outputPort)) { - // FIXME following call can fail (with -2 error code) if buffer is full - // it is the caller responsibility to retry in such cases... + // Following call can fail with -2 error code (buffer full) or -3 error code (could not acquire send mutex) + // It is the caller responsibility to retry in such cases... int32_t ret = -2; uint8_t count = 5; while (count-- > 0 && ret < -1) { From 5d7e37f6b85b306c53312b991e97b67d1a429ab0 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 10:03:45 +0100 Subject: [PATCH 019/131] OP-1246 removed left over crc_table member from ground uavtalk --- ground/openpilotgcs/src/plugins/uavtalk/uavtalk.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.h b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.h index 4d27399f9..ecda5e3f5 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.h +++ b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.h @@ -105,8 +105,6 @@ private: static const int TX_BUFFER_SIZE = 2 * 1024; - static const quint8 crc_table[256]; - // Types typedef enum { STATE_SYNC, STATE_TYPE, STATE_SIZE, STATE_OBJID, STATE_INSTID, STATE_DATA, STATE_CS, STATE_COMPLETE, STATE_ERROR From 37a09bbd349c33f9de2825d83247d2c2dcc750b5 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 4 Mar 2014 10:05:17 +0100 Subject: [PATCH 020/131] OP-1246 minor cleanups in flight uavtalk --- flight/uavtalk/uavtalk.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/flight/uavtalk/uavtalk.c b/flight/uavtalk/uavtalk.c index 4de5a32d5..35e4361ef 100644 --- a/flight/uavtalk/uavtalk.c +++ b/flight/uavtalk/uavtalk.c @@ -872,7 +872,7 @@ static int32_t sendObject(UAVTalkConnectionData *connection, uint8_t type, uint3 { uint32_t numInst; uint32_t n; - uint32_t ret = -1; + int32_t ret = -1; // Important note : obj can be null (when type is NACK for example) so protect all obj dereferences. @@ -890,8 +890,8 @@ static int32_t sendObject(UAVTalkConnectionData *connection, uint8_t type, uint3 // This allows the receiver to detect when the last object has been received (i.e. when instance 0 is received) ret = 0; for (n = 0; n < numInst; ++n) { - if (sendSingleObject(connection, type, objId, numInst - n - 1, obj) == -1) { - ret = -1; + ret = sendSingleObject(connection, type, objId, numInst - n - 1, obj); + if (ret == -1) { break; } } @@ -914,8 +914,7 @@ static int32_t sendObject(UAVTalkConnectionData *connection, uint8_t type, uint3 * \param[in] connection UAVTalkConnection to be used * \param[in] type Transaction type * \param[in] objId The object ID - * \param[in] instId The instance ID (can NOT be UAVOBJ_ALL_INSTANCES, use - () instead) + * \param[in] instId The instance ID (can NOT be UAVOBJ_ALL_INSTANCES, use () instead) * \param[in] obj Object handle to send (null when type is NACK) * \return 0 Success * \return -1 Failure @@ -992,7 +991,7 @@ static int32_t sendSingleObject(UAVTalkConnectionData *connection, uint8_t type, connection->stats.txBytes += tx_msg_len; } else { connection->stats.txErrors++; - // TDOD rc == -1 connection not open, -2 buffer full should retry + // TODO rc == -1 connection not open, -2 buffer full should retry connection->stats.txBytes += (rc > 0) ? rc : 0; return -1; } From 0c61fd35c8d175c2ca4bbfd1e45c4960b1cfe5eb Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 6 Mar 2014 00:41:48 +0100 Subject: [PATCH 021/131] OP-1245 Added table with UAVOs. Re-factored some UAVObject code. --- .../src/plugins/flightlog/FlightLogDialog.qml | 55 +++++++++++++++++++ .../src/plugins/flightlog/flightlogdialog.cpp | 2 + .../plugins/flightlog/flightlogmanager.cpp | 40 ++++++++++++++ .../src/plugins/flightlog/flightlogmanager.h | 26 ++++++++- .../src/plugins/logging/loggingplugin.cpp | 2 +- .../vehicleconfigurationhelper.cpp | 2 +- .../uavobjectbrowser/uavobjecttreemodel.cpp | 6 +- .../src/plugins/uavobjects/uavdataobject.cpp | 33 ++++++----- .../src/plugins/uavobjects/uavdataobject.h | 14 +++-- .../src/plugins/uavobjects/uavmetaobject.cpp | 5 ++ .../src/plugins/uavobjects/uavmetaobject.h | 2 + .../src/plugins/uavobjects/uavobject.cpp | 15 +++++ .../src/plugins/uavobjects/uavobject.h | 5 ++ .../uavobjectwidgetutils/smartsavebutton.cpp | 2 +- .../uavsettingsimportexportfactory.cpp | 6 +- .../src/plugins/uavtalk/telemetrymonitor.cpp | 2 +- 16 files changed, 185 insertions(+), 32 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 0901aa8f4..4018e0e09 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -20,8 +20,10 @@ Rectangle { border.width: 1 radius: 4 ColumnLayout { + id: exportTab anchors.margins: 10 anchors.fill: parent + visible: true Text { Layout.fillWidth: true text: "" + qsTr("Log entries") + "" @@ -168,11 +170,64 @@ Rectangle { } } } + ColumnLayout { + id: settingsTab + visible: false + anchors.margins: 10 + anchors.fill: parent + Text { + Layout.fillWidth: true + text: "" + qsTr("Log entries") + "" + } + TableView { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.preferredHeight: 1000; + model: logManager.uavoEntries + + TableViewColumn { + role: "Name"; + title: qsTr("UAVObject"); + width: 150; + delegate: + Text { + anchors.fill: parent + anchors.margins: 2 + anchors.leftMargin: 5 + font.pixelSize: 12 + text: styleData.value + } + + } + /* + TableViewColumn { + role: "Setting"; title: qsTr("Settings"); width: 150; + delegate: + ComboBox { + model: logManager.logSettings + } + } + */ + } + } } RowLayout { Layout.fillWidth: true height: 40 + Button { + id: settingsButton + enabled: !logManager.disableControls + text: qsTr("Log settings...") + activeFocusOnPress: true + property bool showSettings: false + onClicked: { + showSettings = !showSettings; + settingsTab.visible = showSettings; + exportTab.visible = !showSettings; + text = (showSettings ? qsTr("View logs...") : qsTr("Log settings...")); + } + } Rectangle { Layout.fillWidth: true } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index 65f04f575..2397c744d 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -35,11 +35,13 @@ #include #include "flightlogmanager.h" +#include "uavobject.h" FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) : QDialog(parent) { qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); + qmlRegisterUncreatableType("org.openpilot", 1, 0, "UAVObject", ""); setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("Manage flight side logs")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 60578532a..f34a931d5 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -57,6 +57,8 @@ FlightLogManager::FlightLogManager(QObject *parent) : Q_ASSERT(m_flightLogEntry); updateFlightEntries(m_flightLogStatus->getFlight()); + + updateUAVOS(); } FlightLogManager::~FlightLogManager() @@ -92,6 +94,32 @@ QQmlListProperty FlightLogManager::logEntries() return QQmlListProperty(this, &m_logEntries, &addLogEntries, &countLogEntries, &logEntryAt, &clearLogEntries); } +void addUAVOEntries(QQmlListProperty *list, UAVObject *entry) +{ + Q_UNUSED(list); + Q_UNUSED(entry); +} + +int countUAVOEntries(QQmlListProperty *list) +{ + return static_cast< QList *>(list->data)->size(); +} + +UAVObject *uavoEntryAt(QQmlListProperty *list, int index) +{ + return static_cast< QList *>(list->data)->at(index); +} + +void clearUAVOEntries(QQmlListProperty *list) +{ + return static_cast< QList *>(list->data)->clear(); +} + +QQmlListProperty FlightLogManager::uavoEntries() +{ + return QQmlListProperty(this, &m_uavoEntries, &addUAVOEntries, &countUAVOEntries, &uavoEntryAt, &clearUAVOEntries); +} + QStringList FlightLogManager::flightEntries() { return m_flightEntries; @@ -274,6 +302,18 @@ void FlightLogManager::updateFlightEntries(quint16 currentFlight) } } +void FlightLogManager::updateUAVOS() +{ + foreach(QList objectList , m_objectManager->getObjects()) { + UAVObject* object = objectList.at(0); + if (!object->isMetaDataObject() && !object->isSettingsObject()) { + m_uavoEntries.append(object); + qDebug() << objectList.at(0)->getName(); + } + } + emit uavoEntriesChanged(); +} + ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(), m_object(0) {} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index af01dd7e7..4458c4cc3 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -39,7 +39,8 @@ #include "debuglogcontrol.h" class ExtendedDebugLogEntry : public DebugLogEntry { - Q_OBJECT Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated) + Q_OBJECT + Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated) public: explicit ExtendedDebugLogEntry(); @@ -67,18 +68,25 @@ private: }; class FlightLogManager : public QObject { - Q_OBJECT Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus) + Q_OBJECT + Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus) Q_PROPERTY(QQmlListProperty logEntries READ logEntries NOTIFY logEntriesChanged) Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged) Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged) Q_PROPERTY(bool disableExport READ disableExport WRITE setDisableExport NOTIFY disableExportChanged) Q_PROPERTY(bool adjustExportedTimestamps READ adjustExportedTimestamps WRITE setAdjustExportedTimestamps NOTIFY adjustExportedTimestampsChanged) + Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) + Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged) + + public: explicit FlightLogManager(QObject *parent = 0); ~FlightLogManager(); QQmlListProperty logEntries(); + QQmlListProperty uavoEntries(); + QStringList flightEntries(); DebugLogStatus *flightLogStatus() const @@ -103,9 +111,18 @@ public: return m_adjustExportedTimestamps; } + QStringList logSettings() const + { + return m_logSettings; + } + signals: void logEntriesChanged(); void flightEntriesChanged(); + + void uavoEntriesChanged(); + void logSettingsChanged(); + void disableControlsChanged(bool arg); void disableExportChanged(bool arg); @@ -143,15 +160,20 @@ public slots: private slots: void updateFlightEntries(quint16 currentFlight); + void updateUAVOS(); private: UAVObjectManager *m_objectManager; DebugLogControl *m_flightLogControl; DebugLogStatus *m_flightLogStatus; DebugLogEntry *m_flightLogEntry; + QList m_logEntries; QStringList m_flightEntries; + QList m_uavoEntries; + QStringList m_logSettings; + static const int UAVTALK_TIMEOUT = 4000; bool m_disableControls; bool m_disableExport; diff --git a/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp b/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp index 74239e5c6..749038014 100644 --- a/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp +++ b/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp @@ -230,7 +230,7 @@ void LoggingThread::retrieveSettings() QList< QList > objs = objMngr->getDataObjects(); for (int n = 0; n < objs.length(); ++n) { UAVDataObject *obj = objs[n][0]; - if (obj->isSettings()) { + if (obj->isSettingsObject()) { queue.enqueue(obj); } } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index 6d8e0fd7d..c4a670704 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -517,7 +517,7 @@ bool VehicleConfigurationHelper::saveChangesToController(bool save) m_transactionOK = false; UAVDataObject *obj = objPair->first; QString objDescription = objPair->second; - if (UAVObject::GetGcsAccess(obj->getMetadata()) != UAVObject::ACCESS_READONLY && obj->isSettings()) { + if (UAVObject::GetGcsAccess(obj->getMetadata()) != UAVObject::ACCESS_READONLY && obj->isSettingsObject()) { emit saveProgress(m_modifiedObjects.count() + 1, ++m_progress, objDescription); m_currentTransactionObjectID = obj->getObjID(); diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp index f1665bd59..ee835daf6 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp @@ -99,7 +99,7 @@ void UAVObjectTreeModel::newObject(UAVObject *obj) void UAVObjectTreeModel::addDataObject(UAVDataObject *obj) { - TopTreeItem *root = obj->isSettings() ? m_settingsTree : m_nonSettingsTree; + TopTreeItem *root = obj->isSettingsObject() ? m_settingsTree : m_nonSettingsTree; TreeItem *parent = root; @@ -461,7 +461,7 @@ ObjectTreeItem *UAVObjectTreeModel::findObjectTreeItem(UAVObject *object) DataObjectTreeItem *UAVObjectTreeModel::findDataObjectTreeItem(UAVDataObject *obj) { - TopTreeItem *root = obj->isSettings() ? m_settingsTree : m_nonSettingsTree; + TopTreeItem *root = obj->isSettingsObject() ? m_settingsTree : m_nonSettingsTree; return root->findDataObjectTreeItemByObjectId(obj->getObjID()); } @@ -471,7 +471,7 @@ MetaObjectTreeItem *UAVObjectTreeModel::findMetaObjectTreeItem(UAVMetaObject *ob UAVDataObject *dataObject = qobject_cast(obj->getParentObject()); Q_ASSERT(dataObject); - TopTreeItem *root = dataObject->isSettings() ? m_settingsTree : m_nonSettingsTree; + TopTreeItem *root = dataObject->isSettingsObject() ? m_settingsTree : m_nonSettingsTree; return root->findMetaObjectTreeItemByObjectId(obj->getObjID()); } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.cpp index 8a74eb97f..aaefd9926 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.cpp @@ -30,40 +30,40 @@ /** * Constructor */ -UAVDataObject::UAVDataObject(quint32 objID, bool isSingleInst, bool isSet, const QString & name) : +UAVDataObject::UAVDataObject(quint32 objID, bool isSingleInst, bool isSettings, const QString & name) : UAVObject(objID, isSingleInst, name) { - mobj = NULL; - this->isSet = isSet; + m_metaObject = NULL; + this->m_isSettings = isSettings; } /** * Initialize instance ID and assign a metaobject */ -void UAVDataObject::initialize(quint32 instID, UAVMetaObject *mobj) +void UAVDataObject::initialize(quint32 instID, UAVMetaObject *metaObject) { QMutexLocker locker(mutex); - this->mobj = mobj; + this->m_metaObject = metaObject; UAVObject::initialize(instID); } /** * Assign a metaobject */ -void UAVDataObject::initialize(UAVMetaObject *mobj) +void UAVDataObject::initialize(UAVMetaObject *metaObject) { QMutexLocker locker(mutex); - this->mobj = mobj; + this->m_metaObject = metaObject; } /** * Returns true if this is a data object holding module settings */ -bool UAVDataObject::isSettings() +bool UAVDataObject::isSettingsObject() { - return isSet; + return m_isSettings; } /** @@ -71,8 +71,8 @@ bool UAVDataObject::isSettings() */ void UAVDataObject::setMetadata(const Metadata & mdata) { - if (mobj != NULL) { - mobj->setData(mdata); + if (m_metaObject != NULL) { + m_metaObject->setData(mdata); } } @@ -81,8 +81,8 @@ void UAVDataObject::setMetadata(const Metadata & mdata) */ UAVObject::Metadata UAVDataObject::getMetadata(void) { - if (mobj != NULL) { - return mobj->getData(); + if (m_metaObject != NULL) { + return m_metaObject->getData(); } else { return getDefaultMetadata(); } @@ -93,5 +93,10 @@ UAVObject::Metadata UAVDataObject::getMetadata(void) */ UAVMetaObject *UAVDataObject::getMetaObject() { - return mobj; + return m_metaObject; +} + +bool UAVDataObject::isDataObject() +{ + return true; } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h index fc679b7e1..34ca83569 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h @@ -38,19 +38,21 @@ class UAVOBJECTS_EXPORT UAVDataObject : public UAVObject { Q_OBJECT public: - UAVDataObject(quint32 objID, bool isSingleInst, bool isSet, const QString & name); - void initialize(quint32 instID, UAVMetaObject *mobj); - void initialize(UAVMetaObject *mobj); - bool isSettings(); + UAVDataObject(quint32 objID, bool isSingleInst, bool isSettingsObject, const QString & name); + void initialize(quint32 instID, UAVMetaObject *metaObject); + void initialize(UAVMetaObject *metaObject); void setMetadata(const Metadata & mdata); Metadata getMetadata(); UAVMetaObject *getMetaObject(); virtual UAVDataObject *clone(quint32 instID = 0) = 0; virtual UAVDataObject *dirtyClone() = 0; + bool isSettingsObject(); + bool isDataObject(); + private: - UAVMetaObject *mobj; - bool isSet; + UAVMetaObject *m_metaObject; + bool m_isSettings; }; #endif // UAVDATAOBJECT_H diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp index 80e4d5ed6..5c7d2755d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp @@ -107,3 +107,8 @@ UAVObject::Metadata UAVMetaObject::getData() return parentMetadata; } + +bool UAVMetaObject::isMetaDataObject() +{ + return true; +} diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.h index ef3be6a00..0c622ba90 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.h @@ -43,6 +43,8 @@ public: void setData(const Metadata & mdata); Metadata getData(); + bool isMetaDataObject(); + private: UAVObject *parent; Metadata ownMetadata; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index 90a42be9e..200d4900d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -535,6 +535,21 @@ void UAVObject::emitNewInstance(UAVObject *obj) emit newInstance(obj); } +bool UAVObject::isSettingsObject() +{ + return false; +} + +bool UAVObject::isDataObject() +{ + return false; +} + +bool UAVObject::isMetaDataObject() +{ + return false; +} + /** * Initialize a UAVObjMetadata object. * \param[in] metadata The metadata object diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h index 9c34271c0..fd40c2940 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h @@ -54,6 +54,7 @@ class UAVOBJECTS_EXPORT UAVObject : public QObject { Q_OBJECT public: + Q_PROPERTY(QString Name READ getName) /** * Object update mode @@ -130,6 +131,10 @@ public: void emitTransactionCompleted(bool success); void emitNewInstance(UAVObject *); + virtual bool isSettingsObject(); + virtual bool isDataObject(); + virtual bool isMetaDataObject(); + // Metadata accessors static void MetadataInitialize(Metadata & meta); static AccessMode GetFlightAccess(const Metadata & meta); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp index eb421b9ef..454743191 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp @@ -114,7 +114,7 @@ void SmartSaveButton::processOperation(QPushButton *button, bool save) sv_result = false; current_objectID = obj->getObjID(); - if (save && (obj->isSettings())) { + if (save && (obj->isSettingsObject())) { for (int i = 0; i < 3; ++i) { qDebug() << "Saving" << obj->getName() << "to board."; connect(utilMngr, SIGNAL(saveCompleted(int, bool)), this, SLOT(saving_finished(int, bool))); diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp index e3b058fae..b1d803aa3 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexportfactory.cpp @@ -276,8 +276,8 @@ QString UAVSettingsImportExportFactory::createXMLDocument(const enum storedData QList< QList > objList = objManager->getDataObjects(); foreach(QList list, objList) { foreach(UAVDataObject * obj, list) { - if (((what == Settings) && obj->isSettings()) || - ((what == Data) && !obj->isSettings()) || + if (((what == Settings) && obj->isSettingsObject()) || + ((what == Data) && !obj->isSettingsObject()) || (what == Both)) { // add each object to the XML QDomElement o = doc.createElement("object"); @@ -319,7 +319,7 @@ QString UAVSettingsImportExportFactory::createXMLDocument(const enum storedData } // append to the settings or data element - if (obj->isSettings()) { + if (obj->isSettingsObject()) { settings.appendChild(o); } else { data.appendChild(o); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp index ad1148654..b488dc9b9 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp @@ -78,7 +78,7 @@ void TelemetryMonitor::startRetrievingObjects() if (mobj != NULL) { queue.enqueue(obj); } else if (dobj != NULL) { - if (dobj->isSettings()) { + if (dobj->isSettingsObject()) { queue.enqueue(obj); } else { if (UAVObject::GetFlightTelemetryUpdateMode(mdata) == UAVObject::UPDATEMODE_ONCHANGE) { From e5332157862a516ee081b06bd0b719181190619d Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 6 Mar 2014 23:30:55 +0100 Subject: [PATCH 022/131] OP-1245 Added debuglog settings wrapper and GUI. --- .../src/plugins/flightlog/FlightLogDialog.qml | 61 +++++++++-------- .../src/plugins/flightlog/flightlogdialog.cpp | 4 +- .../plugins/flightlog/flightlogmanager.cpp | 43 ++++++++---- .../src/plugins/flightlog/flightlogmanager.h | 66 +++++++++++++++---- 4 files changed, 122 insertions(+), 52 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 4018e0e09..68f0aeb58 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -34,11 +34,13 @@ Rectangle { Layout.preferredHeight: 1000; model: logManager.logEntries + rowDelegate: Rectangle { + height: 22 + color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee") + } + itemDelegate: Text { - anchors.fill: parent - anchors.margins: 2 - anchors.leftMargin: 5 - font.pixelSize: 12 + verticalAlignment: Text.AlignVCenter text: styleData.value } @@ -46,33 +48,24 @@ Rectangle { role: "Flight"; title: qsTr("Flight"); width: 50; delegate: Text { - anchors.fill: parent - anchors.margins: 2 - anchors.leftMargin: 5 - font.pixelSize: 12 + verticalAlignment: Text.AlignVCenter text: styleData.value + 1 } } TableViewColumn { - role: "FlightTime"; title: qsTr("Time"); width: 80; + role: "FlightTime"; title: qsTr("Time"); width: 100; delegate: Text { - anchors.fill: parent - anchors.margins: 2 - anchors.leftMargin: 5 - font.pixelSize: 12 + verticalAlignment: Text.AlignVCenter text: Functions.millisToTime(styleData.value) } } TableViewColumn { - role: "Type"; title: "Type"; width: 50; + role: "Type"; title: "Type"; width: 60; delegate: Text { - anchors.fill: parent - anchors.margins: 2 - anchors.leftMargin: 5 - font.pixelSize: 12 + verticalAlignment: Text.AlignVCenter text: { switch(styleData.value) { case 0 : text: qsTr("Empty"); break; @@ -84,7 +77,11 @@ Rectangle { } } - TableViewColumn { role: "LogString"; title: qsTr("Data"); width: 280} + TableViewColumn { + role: "LogString"; + title: qsTr("Data"); + width: 280 + } } RowLayout { @@ -177,7 +174,7 @@ Rectangle { anchors.fill: parent Text { Layout.fillWidth: true - text: "" + qsTr("Log entries") + "" + text: "" + qsTr("Log settings") + "" } TableView { Layout.fillWidth: true @@ -185,29 +182,37 @@ Rectangle { Layout.preferredHeight: 1000; model: logManager.uavoEntries + rowDelegate: Rectangle { + height: 22 + color: styleData.selected ? "#ccc" : (styleData.alternate ? "#fff" : "#eee") + } + TableViewColumn { - role: "Name"; + role: "name"; title: qsTr("UAVObject"); - width: 150; + width: 200; delegate: Text { - anchors.fill: parent - anchors.margins: 2 + verticalAlignment: Text.AlignVCenter anchors.leftMargin: 5 - font.pixelSize: 12 text: styleData.value } } - /* + TableViewColumn { - role: "Setting"; title: qsTr("Settings"); width: 150; + role: "setting"; + title: qsTr("Settings"); + width: 200; delegate: ComboBox { + anchors.leftMargin: 5 model: logManager.logSettings + currentIndex: styleData.value + //onCurrentIndexChanged: } } - */ + } } } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index 2397c744d..dab94c474 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -40,8 +40,10 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) : QDialog(parent) { - qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); + qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); + qmlRegisterType("org.openpilot", 1, 0, "UAVOLogSettingsWrapper"); qmlRegisterUncreatableType("org.openpilot", 1, 0, "UAVObject", ""); + qRegisterMetaType("UAVOLogSettingsWrapper::UAVLogSetting"); setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("Manage flight side logs")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index f34a931d5..27ced5b10 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -58,7 +58,9 @@ FlightLogManager::FlightLogManager(QObject *parent) : updateFlightEntries(m_flightLogStatus->getFlight()); - updateUAVOS(); + setupUAVOWrappers(); + + setupLogSettings(); } FlightLogManager::~FlightLogManager() @@ -94,30 +96,30 @@ QQmlListProperty FlightLogManager::logEntries() return QQmlListProperty(this, &m_logEntries, &addLogEntries, &countLogEntries, &logEntryAt, &clearLogEntries); } -void addUAVOEntries(QQmlListProperty *list, UAVObject *entry) +void addUAVOEntries(QQmlListProperty *list, UAVOLogSettingsWrapper *entry) { Q_UNUSED(list); Q_UNUSED(entry); } -int countUAVOEntries(QQmlListProperty *list) +int countUAVOEntries(QQmlListProperty *list) { - return static_cast< QList *>(list->data)->size(); + return static_cast< QList *>(list->data)->size(); } -UAVObject *uavoEntryAt(QQmlListProperty *list, int index) +UAVOLogSettingsWrapper *uavoEntryAt(QQmlListProperty *list, int index) { - return static_cast< QList *>(list->data)->at(index); + return static_cast< QList *>(list->data)->at(index); } -void clearUAVOEntries(QQmlListProperty *list) +void clearUAVOEntries(QQmlListProperty *list) { - return static_cast< QList *>(list->data)->clear(); + return static_cast< QList *>(list->data)->clear(); } -QQmlListProperty FlightLogManager::uavoEntries() +QQmlListProperty FlightLogManager::uavoEntries() { - return QQmlListProperty(this, &m_uavoEntries, &addUAVOEntries, &countUAVOEntries, &uavoEntryAt, &clearUAVOEntries); + return QQmlListProperty(this, &m_uavoEntries, &addUAVOEntries, &countUAVOEntries, &uavoEntryAt, &clearUAVOEntries); } QStringList FlightLogManager::flightEntries() @@ -302,18 +304,24 @@ void FlightLogManager::updateFlightEntries(quint16 currentFlight) } } -void FlightLogManager::updateUAVOS() +void FlightLogManager::setupUAVOWrappers() { foreach(QList objectList , m_objectManager->getObjects()) { UAVObject* object = objectList.at(0); if (!object->isMetaDataObject() && !object->isSettingsObject()) { - m_uavoEntries.append(object); + m_uavoEntries.append(new UAVOLogSettingsWrapper(object)); qDebug() << objectList.at(0)->getName(); } } emit uavoEntriesChanged(); } +void FlightLogManager::setupLogSettings() +{ + m_logSettings << tr("Disabled") << tr("When updated") << tr("Every 10ms") << tr("Every 50ms") << tr("Every 100ms") + << tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute"); +} + ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(), m_object(0) {} @@ -348,3 +356,14 @@ void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVOb m_object->unpack(getData().Data); } } + + +UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() +{} + +UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVObject *object) : QObject(), + m_object(object), m_setting(EVERY_5S) +{} + +UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() +{} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 4458c4cc3..826b9b5d1 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -38,6 +38,48 @@ #include "debuglogstatus.h" #include "debuglogcontrol.h" +class UAVOLogSettingsWrapper : public QObject { + Q_OBJECT + Q_ENUMS(UAVLogSetting) + Q_PROPERTY(QString name READ name NOTIFY nameChanged) + Q_PROPERTY(UAVOLogSettingsWrapper::UAVLogSetting setting READ setting WRITE setSetting NOTIFY settingChanged) + +public: + enum UAVLogSetting {DISABLED = 0, ON_CHANGE, EVERY_10MS, EVERY_50MS, EVERY_100MS, + EVERY_500MS, EVERY_1S, EVERY_5S, EVERY_10S, EVERY_30S, EVERY_1M}; + + explicit UAVOLogSettingsWrapper(); + explicit UAVOLogSettingsWrapper(UAVObject* object); + ~UAVOLogSettingsWrapper(); + + QString name() const + { + return m_object->getName(); + } + + UAVOLogSettingsWrapper::UAVLogSetting setting() const + { + return m_setting; + } + +public slots: + void setSetting(UAVOLogSettingsWrapper::UAVLogSetting arg) + { + if (m_setting != arg) { + m_setting = arg; + emit settingChanged(arg); + } + } + +signals: + void settingChanged(UAVLogSetting arg); + void nameChanged(); + +private: + UAVObject *m_object; + UAVLogSetting m_setting; +}; + class ExtendedDebugLogEntry : public DebugLogEntry { Q_OBJECT Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated) @@ -76,7 +118,7 @@ class FlightLogManager : public QObject { Q_PROPERTY(bool disableExport READ disableExport WRITE setDisableExport NOTIFY disableExportChanged) Q_PROPERTY(bool adjustExportedTimestamps READ adjustExportedTimestamps WRITE setAdjustExportedTimestamps NOTIFY adjustExportedTimestampsChanged) - Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) + Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged) @@ -85,10 +127,14 @@ public: ~FlightLogManager(); QQmlListProperty logEntries(); - QQmlListProperty uavoEntries(); + QQmlListProperty uavoEntries(); QStringList flightEntries(); + QStringList logSettings() { + return m_logSettings; + } + DebugLogStatus *flightLogStatus() const { return m_flightLogStatus; @@ -111,17 +157,12 @@ public: return m_adjustExportedTimestamps; } - QStringList logSettings() const - { - return m_logSettings; - } - signals: void logEntriesChanged(); void flightEntriesChanged(); + void logSettingsChanged(); void uavoEntriesChanged(); - void logSettingsChanged(); void disableControlsChanged(bool arg); void disableExportChanged(bool arg); @@ -160,7 +201,8 @@ public slots: private slots: void updateFlightEntries(quint16 currentFlight); - void updateUAVOS(); + void setupUAVOWrappers(); + void setupLogSettings(); private: UAVObjectManager *m_objectManager; @@ -170,10 +212,10 @@ private: QList m_logEntries; QStringList m_flightEntries; - - QList m_uavoEntries; QStringList m_logSettings; + QList m_uavoEntries; + static const int UAVTALK_TIMEOUT = 4000; bool m_disableControls; bool m_disableExport; @@ -181,4 +223,6 @@ private: bool m_adjustExportedTimestamps; }; +Q_DECLARE_METATYPE(UAVOLogSettingsWrapper::UAVLogSetting) + #endif // FLIGHTLOGMANAGER_H From fe36fbf927f9a5b8f6370c6ab47ce8f56cfe01f0 Mon Sep 17 00:00:00 2001 From: m_thread Date: Fri, 7 Mar 2014 18:06:50 +0100 Subject: [PATCH 023/131] OP-1245 Added debuglog settings combo editor and databinding between C++ and qml. --- .../src/plugins/flightlog/FlightLogDialog.qml | 46 +++++++++++++++---- .../src/plugins/flightlog/flightlogdialog.cpp | 2 - .../plugins/flightlog/flightlogmanager.cpp | 2 +- .../src/plugins/flightlog/flightlogmanager.h | 19 ++++---- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 68f0aeb58..b5adb708e 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -176,7 +176,44 @@ Rectangle { Layout.fillWidth: true text: "" + qsTr("Log settings") + "" } + + Component { + id: comboEditableDelegate + Item { + + Text { + width: parent.width + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined ? logManager.logSettings[styleData.value] : "" + color: styleData.textColor + visible: !styleData.selected + } + Loader { + id: loaderEditor + anchors.fill: parent + Connections { + target: loaderEditor.item + onCurrentIndexChanged: { + logManager.uavoEntries[styleData.row].setting = loaderEditor.item.currentIndex + } + } + sourceComponent: styleData.selected ? editor : null + Component { + id: editor + ComboBox { + id: combo + model: logManager.logSettings + currentIndex: styleData.value + } + } + } + } + } + TableView { + id: settingsTable Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: 1000; @@ -204,15 +241,8 @@ Rectangle { role: "setting"; title: qsTr("Settings"); width: 200; - delegate: - ComboBox { - anchors.leftMargin: 5 - model: logManager.logSettings - currentIndex: styleData.value - //onCurrentIndexChanged: - } + delegate: comboEditableDelegate } - } } } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index dab94c474..d3b36029a 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -42,8 +42,6 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan { qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); qmlRegisterType("org.openpilot", 1, 0, "UAVOLogSettingsWrapper"); - qmlRegisterUncreatableType("org.openpilot", 1, 0, "UAVObject", ""); - qRegisterMetaType("UAVOLogSettingsWrapper::UAVLogSetting"); setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("Manage flight side logs")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 27ced5b10..a0b3152f6 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -362,7 +362,7 @@ UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVObject *object) : QObject(), - m_object(object), m_setting(EVERY_5S) + m_object(object), m_setting(DISABLED) {} UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 826b9b5d1..dbe57c599 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -40,9 +40,8 @@ class UAVOLogSettingsWrapper : public QObject { Q_OBJECT - Q_ENUMS(UAVLogSetting) Q_PROPERTY(QString name READ name NOTIFY nameChanged) - Q_PROPERTY(UAVOLogSettingsWrapper::UAVLogSetting setting READ setting WRITE setSetting NOTIFY settingChanged) + Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) public: enum UAVLogSetting {DISABLED = 0, ON_CHANGE, EVERY_10MS, EVERY_50MS, EVERY_100MS, @@ -57,27 +56,27 @@ public: return m_object->getName(); } - UAVOLogSettingsWrapper::UAVLogSetting setting() const + int setting() const { return m_setting; } public slots: - void setSetting(UAVOLogSettingsWrapper::UAVLogSetting arg) + void setSetting(int setting) { - if (m_setting != arg) { - m_setting = arg; - emit settingChanged(arg); + if (m_setting != (int)setting) { + m_setting = (int)setting; + emit settingChanged((int)setting); } } signals: - void settingChanged(UAVLogSetting arg); + void settingChanged(int setting); void nameChanged(); private: UAVObject *m_object; - UAVLogSetting m_setting; + int m_setting; }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -223,6 +222,4 @@ private: bool m_adjustExportedTimestamps; }; -Q_DECLARE_METATYPE(UAVOLogSettingsWrapper::UAVLogSetting) - #endif // FLIGHTLOGMANAGER_H From aa7a8f62c751818e1007bfa5c0584693e3b38426 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 7 Mar 2014 22:04:14 +0100 Subject: [PATCH 024/131] OP-1241 TxPID Does not work for Bank 3 PID settings (Typo) --- flight/modules/TxPID/txpid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index f0c269c01..c4b048721 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -326,7 +326,7 @@ static void updatePIDs(UAVObjEvent *ev) break; case 2: - StabilizationSettingsBank2Set((StabilizationSettingsBank2Data *)&bank); + StabilizationSettingsBank3Set((StabilizationSettingsBank3Data *)&bank); break; default: From ab183100d6b21ebbad452a5d753f49dee0497b52 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 7 Mar 2014 22:44:06 +0100 Subject: [PATCH 025/131] OP-1237 Blank/Black Buttons on Vehicle Configuration Multirotor Throttle Curve Removed stylesheet for MixerCurve in multirotor tab --- ground/openpilotgcs/src/plugins/config/airframe_multirotor.ui | 3 --- 1 file changed, 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/airframe_multirotor.ui b/ground/openpilotgcs/src/plugins/config/airframe_multirotor.ui index a8e038f74..f740d7df3 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe_multirotor.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe_multirotor.ui @@ -119,9 +119,6 @@ 50 - - background:transparent - From 4209f1d6b55363a34712fdae442d18dbbff5bc27 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 8 Mar 2014 10:50:32 +0100 Subject: [PATCH 026/131] Merge remote-tracking branch 'origin/next' into thread/OP-1245_FlightLog_Configuration_And_Control_GUI # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. --- ground/openpilotgcs/src/app/main.cpp | 1 + .../libs/eigen/Eigen/src/Core/util/Memory.h | 2 +- .../libs/opmapcontrol/src/internals/core.cpp | 2 +- .../internals/projections/lks94projection.cpp | 58 +++--- .../projections/mercatorprojectionyandex.cpp | 2 +- .../src/mapwidget/mapgraphicitem.cpp | 3 +- .../opmapcontrol/src/mapwidget/uavitem.cpp | 4 +- .../src/mapwidget/waypointcircle.cpp | 8 +- .../src/mapwidget/waypointitem.cpp | 2 +- .../src/mapwidget/waypointline.cpp | 8 +- ground/openpilotgcs/src/libs/qwt/src/src.pro | 3 + .../openpilotgcs/src/libs/utils/logfile.cpp | 4 +- .../openpilotgcs/src/libs/utils/xmlconfig.cpp | 4 +- .../cfg_vehicletypes/configccpmwidget.cpp | 2 +- .../cfg_vehicletypes/configcustomwidget.cpp | 9 +- .../config/cfg_vehicletypes/vehicleconfig.cpp | 1 - .../plugins/config/configccattitudewidget.cpp | 1 + .../src/plugins/config/configinputwidget.cpp | 10 +- .../src/plugins/config/configrevowidget.cpp | 3 - .../config/configstabilizationwidget.h | 2 +- .../src/plugins/config/fancytabwidget.cpp | 1 - .../openpilotgcs/src/plugins/config/input.ui | 2 +- .../src/plugins/config/mixercurve.ui | 10 - .../src/plugins/config/outputchannelform.h | 2 +- .../src/plugins/config/outputchannelform.ui | 2 +- .../src/plugins/config/stabilization.ui | 2 +- .../plugins/coreplugin/connectionmanager.cpp | 1 + .../src/plugins/coreplugin/mimedatabase.cpp | 2 +- .../src/plugins/coreplugin/uavconfiginfo.cpp | 2 +- .../plugins/debuggadget/debuggadgetwidget.cpp | 1 + .../plugins/flightlog/flightlogmanager.cpp | 185 ++++++++++++++---- .../src/plugins/flightlog/flightlogmanager.h | 9 + .../plugins/gcscontrol/gcscontrolgadget.cpp | 13 +- .../src/plugins/hitl/fgsimulator.cpp | 10 +- .../src/plugins/hitl/simulator.cpp | 14 +- .../lineardialgadgetconfiguration.h | 4 +- .../lineardial/lineardialgadgetoptionspage.ui | 2 +- .../src/plugins/logging/logginggadget.cpp | 4 +- .../plugins/magicwaypoint/positionfield.cpp | 5 +- .../src/plugins/notify/notificationitem.cpp | 2 +- .../src/plugins/notify/notifyitemdelegate.cpp | 1 + .../src/plugins/notify/notifyplugin.cpp | 7 - .../notify/notifypluginoptionspage.cpp | 3 +- .../src/plugins/notify/notifytablemodel.cpp | 7 +- .../src/plugins/notify/notifytablemodel.h | 1 + .../src/plugins/ophid/hidapi/libusb/hid.c | 4 +- .../src/plugins/opmap/modelmapproxy.cpp | 16 +- .../opmap/opmap_edit_waypoint_dialog.h | 2 +- .../plugins/opmap/opmapgadgetoptionspage.ui | 7 - .../pathactioneditortreemodel.cpp | 7 +- .../src/plugins/pathactioneditor/treeitem.cpp | 1 + .../src/plugins/pfdqml/pfdqmlgadgetwidget.cpp | 1 + .../plugins/setupwizard/connectiondiagram.cpp | 3 +- .../vehicleconfigurationhelper.cpp | 14 +- .../src/plugins/telemetry/monitorgadget.cpp | 1 + .../telemetry/monitorgadgetconfiguration.cpp | 1 + .../telemetry/monitorgadgetfactory.cpp | 1 + .../telemetry/monitorgadgetoptionspage.cpp | 4 +- .../uavobjectbrowserconfiguration.h | 2 +- .../uavobjectbrowserwidget.cpp | 14 +- .../uavobjectbrowser/uavobjecttreemodel.cpp | 2 +- .../uavobjectbrowser/uavobjecttreemodel.h | 4 +- .../src/plugins/uavobjects/uavobject.cpp | 13 ++ .../src/plugins/uavobjects/uavobject.h | 2 + .../src/plugins/uavobjects/uavobjectfield.cpp | 18 ++ .../src/plugins/uavobjects/uavobjectfield.h | 2 + .../uavobjectutil/uavobjectutilmanager.cpp | 5 +- .../uavobjectwidgetutils/configtaskwidget.cpp | 2 +- .../src/plugins/uploader/SSP/port.h | 2 +- .../src/plugins/uploader/SSP/qsspt.h | 2 +- .../src/plugins/uploader/devicewidget.cpp | 3 +- .../src/plugins/uploader/op_dfu.cpp | 10 +- .../src/plugins/uploader/op_dfu.h | 2 +- .../src/plugins/uploader/uploader.pro | 4 + 74 files changed, 354 insertions(+), 216 deletions(-) diff --git a/ground/openpilotgcs/src/app/main.cpp b/ground/openpilotgcs/src/app/main.cpp index e976375b3..23a06b1d7 100644 --- a/ground/openpilotgcs/src/app/main.cpp +++ b/ground/openpilotgcs/src/app/main.cpp @@ -211,6 +211,7 @@ inline QString msgSendArgumentFailed() void mainMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { + Q_UNUSED(context); QFile file(QDir::tempPath() + "/gcs.log"); if (file.open(QIODevice::Append | QIODevice::Text)) { diff --git a/ground/openpilotgcs/src/libs/eigen/Eigen/src/Core/util/Memory.h b/ground/openpilotgcs/src/libs/eigen/Eigen/src/Core/util/Memory.h index eff86a23f..6c45b7e61 100644 --- a/ground/openpilotgcs/src/libs/eigen/Eigen/src/Core/util/Memory.h +++ b/ground/openpilotgcs/src/libs/eigen/Eigen/src/Core/util/Memory.h @@ -229,7 +229,7 @@ template inline void ei_conditional_aligned_delete(T *pt template inline static Integer ei_alignmentOffset(const Scalar* array, Integer size) { - typedef typename ei_packet_traits::type Packet; + typedef typename ei_packet_traits::type Packet __attribute__ ((unused)); enum { PacketSize = ei_packet_traits::size, PacketAlignedMask = PacketSize-1 }; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index 0d81a8bdf..b56d84e75 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -34,7 +34,7 @@ using namespace projections; namespace internals { Core::Core() : MouseWheelZooming(false), currentPosition(0, 0), currentPositionPixel(0, 0), LastLocationInBounds(-1, -1), sizeOfMapArea(0, 0) - , minOfTiles(0, 0), maxOfTiles(0, 0), zoom(0), isDragging(false), TooltipTextPadding(10, 10), loaderLimit(5), maxzoom(21), started(false), runningThreads(0) + , minOfTiles(0, 0), maxOfTiles(0, 0), zoom(0), isDragging(false), TooltipTextPadding(10, 10), loaderLimit(5), maxzoom(21), runningThreads(0), started(false) { mousewheelzoomtype = MouseWheelZoomType::MousePositionAndCenter; SetProjection(new MercatorProjection()); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp index 415bbf7f6..760609ba3 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp @@ -88,14 +88,15 @@ QVector LKS94Projection::DTM10(const QVector & lonlat) double es; // Eccentricity squared : (a^2 - b^2)/a^2 double semiMajor = 6378137.0; // major axis double semiMinor = 6356752.3142451793; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2 - ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; + // double ab; // Semi_major / semi_minor + // double ba; // Semi_minor / semi_major + // double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 + + es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2 + // ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); + // ba = semiMinor / semiMajor; + // ab = semiMajor / semiMinor; // ... @@ -121,14 +122,14 @@ QVector LKS94Projection::MTD10(QVector & pnt) double es; // Eccentricity squared : (a^2 - b^2)/a^2 double semiMajor = 6378137.0; // major axis double semiMinor = 6356752.3141403561; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major + // double ab; // Semi_major / semi_minor + // double ba; // Semi_minor / semi_major double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); // e^2 ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; + // ba = semiMinor / semiMajor; + // ab = semiMajor / semiMinor; // ... @@ -201,11 +202,13 @@ QVector LKS94Projection::DTM00(QVector & lonlat) double metersPerUnit = 1.0; double e0, e1, e2, e3; // eccentricity constants - double e, es, esp; // eccentricity constants + // double e; + double es; + double esp; // eccentricity constants double ml0; // small value m es = 1.0 - pow(semiMinor / semiMajor, 2); - e = sqrt(es); + // e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); @@ -262,14 +265,15 @@ QVector LKS94Projection::DTM01(QVector & lonlat) double es; // Eccentricity squared : (a^2 - b^2)/a^2 double semiMajor = 6378137.0; // major axis double semiMinor = 6356752.3141403561; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major - double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 - es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); - ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; + // double ab; // Semi_major / semi_minor + // double ba; // Semi_minor / semi_major + // double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 + + es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); + // ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); + // ba = semiMinor / semiMajor; + // ab = semiMajor / semiMinor; // ... @@ -294,14 +298,14 @@ QVector LKS94Projection::MTD01(QVector & pnt) double es; // Eccentricity squared : (a^2 - b^2)/a^2 double semiMajor = 6378137.0; // major axis double semiMinor = 6356752.3142451793; // minor axis - double ab; // Semi_major / semi_minor - double ba; // Semi_minor / semi_major + // double ab; // Semi_major / semi_minor + // double ba; // Semi_minor / semi_major double ses; // Second eccentricity squared : (a^2 - b^2)/b^2 es = 1.0 - (semiMinor * semiMinor) / (semiMajor * semiMajor); ses = (pow(semiMajor, 2) - pow(semiMinor, 2)) / pow(semiMinor, 2); - ba = semiMinor / semiMajor; - ab = semiMajor / semiMinor; + // ba = semiMinor / semiMajor; + // ab = semiMajor / semiMinor; // ... @@ -378,12 +382,14 @@ QVector LKS94Projection::MTD11(QVector & p) double metersPerUnit = 1.0; double e0, e1, e2, e3; // eccentricity constants - double e, es, esp; // eccentricity constants + // double e; + double es; + double esp; // eccentricity constants double ml0; // small value m es = (semiMinor * semiMinor) / (semiMajor * semiMajor); es = 1.0 - es; - e = sqrt(es); + // e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp index 16dd65272..4d6017721 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp @@ -56,7 +56,7 @@ Point MercatorProjectionYandex::FromLatLngToPixel(double lat, double lng, const } internals::PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int &y, const int &zoom) { - Size s = GetTileMatrixSizePixel(zoom); + // Size s = GetTileMatrixSizePixel(zoom); // double mapSizeX = s.Width(); // double mapSizeY = s.Height(); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index 8544a67a5..cc338fc75 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -31,7 +31,8 @@ #include namespace mapcontrol { -MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1), maxZoom(17), minZoom(2), zoomReal(0), isSelected(false), rotation(0), zoomDigi(0) +MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1), + maxZoom(17), minZoom(2), zoomReal(0), zoomDigi(0), isSelected(false), rotation(0) { dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); showTileGridLines = false; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/uavitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/uavitem.cpp index 58190c735..4cf9975d5 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/uavitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/uavitem.cpp @@ -31,8 +31,8 @@ namespace mapcontrol { double UAVItem::groundspeed_mps_filt = 0; -UAVItem::UAVItem(MapGraphicItem *map, OPMapWidget *parent, QString uavPic) : map(map), mapwidget(parent), showtrail(true), showtrailline(true), trailtime(5), traildistance(50), autosetreached(true) - , autosetdistance(100), altitude(0), showUAVInfo(false) +UAVItem::UAVItem(MapGraphicItem *map, OPMapWidget *parent, QString uavPic) : map(map), mapwidget(parent), altitude(0), showtrail(true), showtrailline(true), + trailtime(5), traildistance(50), autosetreached(true), autosetdistance(100), showUAVInfo(false) { pic.load(uavPic); this->setFlag(QGraphicsItem::ItemIsMovable, false); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointcircle.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointcircle.cpp index 3748ab6d0..9cf9cc89e 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointcircle.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointcircle.cpp @@ -29,8 +29,8 @@ #include "homeitem.h" namespace mapcontrol { -WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool clockwise, MapGraphicItem *map, QColor color) : my_center(center), - my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise) +WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool clockwise, MapGraphicItem *map, QColor color) : QGraphicsEllipseItem(map), + my_center(center), my_radius(radius), my_map(map), myColor(color), myClockWise(clockwise) { connect(center, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations())); connect(radius, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations())); @@ -40,8 +40,8 @@ WayPointCircle::WayPointCircle(WayPointItem *center, WayPointItem *radius, bool connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal))); } -WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color) : my_center(center), - my_radius(radius), my_map(map), QGraphicsEllipseItem(map), myColor(color), myClockWise(clockwise) +WayPointCircle::WayPointCircle(HomeItem *radius, WayPointItem *center, bool clockwise, MapGraphicItem *map, QColor color) : QGraphicsEllipseItem(map), + my_center(center), my_radius(radius), my_map(map), myColor(color), myClockWise(clockwise) { connect(radius, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations())); connect(center, SIGNAL(localPositionChanged(QPointF)), this, SLOT(refreshLocations())); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp index c90670475..7a187685c 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp @@ -337,7 +337,7 @@ void WayPointItem::SetReached(const bool &value) picture.load(QString::fromUtf8(":/markers/images/bigMarkerGreen.png")); } else { if (!isMagic) { - if (this->flags() & QGraphicsItem::ItemIsMovable == QGraphicsItem::ItemIsMovable) { + if ((this->flags() & QGraphicsItem::ItemIsMovable) == QGraphicsItem::ItemIsMovable) { picture.load(QString::fromUtf8(":/markers/images/marker.png")); } else { picture.load(QString::fromUtf8(":/markers/images/waypoint_marker2.png")); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointline.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointline.cpp index eb750a1e6..62e595784 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointline.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/waypointline.cpp @@ -29,8 +29,8 @@ #include "homeitem.h" namespace mapcontrol { -WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : source(from), - destination(to), my_map(map), QGraphicsLineItem(map), myColor(color) +WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : QGraphicsLineItem(map), + source(from), destination(to), my_map(map), myColor(color) { this->setLine(to->pos().x(), to->pos().y(), from->pos().x(), from->pos().y()); connect(from, SIGNAL(localPositionChanged(QPointF, WayPointItem *)), this, SLOT(refreshLocations())); @@ -47,8 +47,8 @@ WayPointLine::WayPointLine(WayPointItem *from, WayPointItem *to, MapGraphicItem connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal))); } -WayPointLine::WayPointLine(HomeItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : source(from), - destination(to), my_map(map), QGraphicsLineItem(map), myColor(color) +WayPointLine::WayPointLine(HomeItem *from, WayPointItem *to, MapGraphicItem *map, QColor color) : QGraphicsLineItem(map), + source(from), destination(to), my_map(map), myColor(color) { this->setLine(to->pos().x(), to->pos().y(), from->pos().x(), from->pos().y()); connect(from, SIGNAL(homePositionChanged(internals::PointLatLng, float)), this, SLOT(refreshLocations())); diff --git a/ground/openpilotgcs/src/libs/qwt/src/src.pro b/ground/openpilotgcs/src/libs/qwt/src/src.pro index c8498533a..753b91f71 100644 --- a/ground/openpilotgcs/src/libs/qwt/src/src.pro +++ b/ground/openpilotgcs/src/libs/qwt/src/src.pro @@ -27,6 +27,9 @@ else { CONFIG += staticlib } +# disable all warnings (no need for warnings as qwt sources are imported) +CONFIG += exceptions warn_off + unix:!mac:LIBS += -lrt HEADERS += \ diff --git a/ground/openpilotgcs/src/libs/utils/logfile.cpp b/ground/openpilotgcs/src/libs/utils/logfile.cpp index 4c20b413f..4dad41bf3 100644 --- a/ground/openpilotgcs/src/libs/utils/logfile.cpp +++ b/ground/openpilotgcs/src/libs/utils/logfile.cpp @@ -105,7 +105,7 @@ void LogFile::timerFired() // TODO: going back in time will be a problem while ((m_lastPlayed + ((time - m_timeOffset) * m_playbackSpeed) > m_lastTimeStamp)) { m_lastPlayed += ((time - m_timeOffset) * m_playbackSpeed); - if (m_file.bytesAvailable() < sizeof(dataSize)) { + if (m_file.bytesAvailable() < (qint64)sizeof(dataSize)) { stopReplay(); return; } @@ -129,7 +129,7 @@ void LogFile::timerFired() emit readyRead(); - if (m_file.bytesAvailable() < sizeof(m_lastTimeStamp)) { + if (m_file.bytesAvailable() < (qint64)sizeof(m_lastTimeStamp)) { stopReplay(); return; } diff --git a/ground/openpilotgcs/src/libs/utils/xmlconfig.cpp b/ground/openpilotgcs/src/libs/utils/xmlconfig.cpp index dc349e726..4a61369da 100644 --- a/ground/openpilotgcs/src/libs/utils/xmlconfig.cpp +++ b/ground/openpilotgcs/src/libs/utils/xmlconfig.cpp @@ -63,7 +63,7 @@ bool XmlConfig::readXmlFile(QIODevice &device, QSettings::SettingsMap &map) .arg(errorLine) .arg(errorColumn) .arg(errorStr); - qFatal(err.toLatin1().data()); + qFatal("%s", err.toLatin1().data()); return false; } root = domDoc.documentElement(); @@ -99,7 +99,7 @@ void XmlConfig::handleNode(QDomElement *node, QSettings::SettingsMap &map, QStri } // qDebug() << "Node: " << ": " << path << " Children: " << node->childNodes().length(); - for (uint i = 0; i < node->childNodes().length(); ++i) { + for (int i = 0; i < node->childNodes().length(); ++i) { QDomNode child = node->childNodes().item(i); if (child.isElement()) { handleNode(static_cast(&child), map, path); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp index 838a1f782..ad8c4cdc7 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp @@ -1447,7 +1447,7 @@ void ConfigCcpmWidget::setSwashplateLevel(int percent) ActuatorCommand::DataFields actuatorCommandData = actuatorCommand->getData(); for (int i = 0; i < CCPM_MAX_SWASH_SERVOS; i++) { - double value; + double value = 0; if (level == 0) { value = newSwashLvlConfiguration.Neutral[i]; } else if (level > 0) { diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp index 020138ba3..05c0a4b1f 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configcustomwidget.cpp @@ -78,6 +78,7 @@ ConfigCustomWidget::~ConfigCustomWidget() void ConfigCustomWidget::setupUI(QString frameType) { + Q_UNUSED(frameType); Q_ASSERT(m_aircraft); } @@ -91,7 +92,9 @@ void ConfigCustomWidget::registerWidgets(ConfigTaskWidget &parent) } void ConfigCustomWidget::resetActuators(GUIConfigDataUnion *configData) -{} +{ + Q_UNUSED(configData); +} /** Helper function to refresh the UI widget values @@ -219,6 +222,7 @@ QString ConfigCustomWidget::updateConfigObjectsFromWidgets() */ bool ConfigCustomWidget::throwConfigError(int numMotors) { + Q_UNUSED(numMotors); return false; } @@ -265,6 +269,8 @@ SpinBoxDelegate::SpinBoxDelegate(QObject *parent) : QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { + Q_UNUSED(option); + Q_UNUSED(index); QSpinBox *editor = new QSpinBox(parent); editor->setMinimum(-127); @@ -295,5 +301,6 @@ void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, c void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const { + Q_UNUSED(index); editor->setGeometry(option.rect); } diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp index d37a2ed74..545d81d75 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp @@ -86,7 +86,6 @@ void VehicleConfig::setConfigData(GUIConfigDataUnion configData) // get an instance of systemsettings SystemSettings *systemSettings = SystemSettings::GetInstance(getUAVObjectManager()); Q_ASSERT(systemSettings); - SystemSettings::DataFields systemSettingsData = systemSettings->getData(); UAVObjectField *guiConfig = systemSettings->getField("GUIConfigData"); Q_ASSERT(guiConfig); diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp index 74e9ecaa5..e4429ab1d 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp @@ -214,6 +214,7 @@ void ConfigCCAttitudeWidget::openHelp() void ConfigCCAttitudeWidget::setAccelFiltering(bool active) { + Q_UNUSED(active); setDirty(true); } diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index c8400300f..1b0f6c62f 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -910,7 +910,7 @@ void ConfigInputWidget::setMoveFromCommand(int command) // CHANNELNUMBER_ACCESSORY1=6, // CHANNELNUMBER_ACCESSORY2=7 - txMovements movement; + txMovements movement = moveLeftVerticalStick; switch (command) { case ManualControlSettings::CHANNELNUMBER_ROLL: @@ -1028,10 +1028,10 @@ void ConfigInputWidget::setTxMovement(txMovements movement) void ConfigInputWidget::moveTxControls() { QTransform trans; - QGraphicsItem *item; - txMovementType move; - int limitMax; - int limitMin; + QGraphicsItem *item = NULL; + txMovementType move = vertical; + int limitMax = 0; + int limitMin = 0; static bool auxFlag = false; switch (currentMovement) { diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index 9f85cbf76..78b9553ac 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -896,11 +896,8 @@ void ConfigRevoWidget::doStartNoiseMeasurement() Q_UNUSED(lock); - RevoCalibration *revoCalibration = RevoCalibration::GetInstance(getObjectManager()); HomeLocation *homeLocation = HomeLocation::GetInstance(getObjectManager()); - Q_ASSERT(revoCalibration); Q_ASSERT(homeLocation); - RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData(); HomeLocation::DataFields homeLocationData = homeLocation->getData(); // check if Homelocation is set diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h index c2ae524b8..e4312df58 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h @@ -54,8 +54,8 @@ private: // Milliseconds between automatic 'Instant Updates' static const int AUTOMATIC_UPDATE_RATE = 500; - int m_pidBankCount; int boardModel; + int m_pidBankCount; int m_currentPIDBank; protected: QString mapObjectName(const QString objectName); diff --git a/ground/openpilotgcs/src/plugins/config/fancytabwidget.cpp b/ground/openpilotgcs/src/plugins/config/fancytabwidget.cpp index 998f5145e..a34d176e2 100644 --- a/ground/openpilotgcs/src/plugins/config/fancytabwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/fancytabwidget.cpp @@ -123,7 +123,6 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e) m_hoverRect = QRect(); if (m_hoverIndex >= 0) { - QRect oldHoverRect = m_hoverRect; m_hoverRect = tabRect(m_hoverIndex); m_hoverControl.start(); } diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index aa3d1a7f4..b6a1f765e 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -1756,7 +1756,7 @@ Setup the flight mode channel on the RC Input tab if you have not done so alread - + 120 diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.ui b/ground/openpilotgcs/src/plugins/config/mixercurve.ui index cd47bd04e..37d8925ee 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurve.ui +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.ui @@ -272,16 +272,6 @@ - GenerateCurve - CurveSettings - CurveType - CurveMin - minLabel - CurveMax - maxLabel - CurveStep - stepLabel - verticalSpacer diff --git a/ground/openpilotgcs/src/plugins/config/outputchannelform.h b/ground/openpilotgcs/src/plugins/config/outputchannelform.h index a669fc2f8..a537f55e7 100644 --- a/ground/openpilotgcs/src/plugins/config/outputchannelform.h +++ b/ground/openpilotgcs/src/plugins/config/outputchannelform.h @@ -56,10 +56,10 @@ signals: void channelChanged(int index, int value); private: + Ui::outputChannelForm ui; /// Channel index int m_index; bool m_inChannelTest; - Ui::outputChannelForm ui; private slots: void linkToggled(bool state); diff --git a/ground/openpilotgcs/src/plugins/config/outputchannelform.ui b/ground/openpilotgcs/src/plugins/config/outputchannelform.ui index 84ee3a2be..abe5d04dd 100644 --- a/ground/openpilotgcs/src/plugins/config/outputchannelform.ui +++ b/ground/openpilotgcs/src/plugins/config/outputchannelform.ui @@ -495,7 +495,7 @@ margin:1px; - + 45 diff --git a/ground/openpilotgcs/src/plugins/config/stabilization.ui b/ground/openpilotgcs/src/plugins/config/stabilization.ui index f89f15087..a4e85e8cb 100644 --- a/ground/openpilotgcs/src/plugins/config/stabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/stabilization.ui @@ -24133,7 +24133,7 @@ border-radius: 5; - + Cruise Control diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp index d19ad9e2c..a225b97e6 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp @@ -105,6 +105,7 @@ void ConnectionManager::addWidget(QWidget *widget) */ bool ConnectionManager::connectDevice(DevListItem device) { + Q_UNUSED(device); QString deviceName = m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString(); DevListItem connection_device = findDevice(deviceName); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mimedatabase.cpp b/ground/openpilotgcs/src/plugins/coreplugin/mimedatabase.cpp index 770f9c0f0..7896f5bd6 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mimedatabase.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/mimedatabase.cpp @@ -1110,7 +1110,7 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f) const // Returns a mime type or Null one if none found MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityPtr) const { - typedef QList MimeMapEntryList; + typedef QList MimeMapEntryList __attribute__((unused)); // Is the hierarchy set up in case we find several matches? if (m_maxLevel < 0) { diff --git a/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp b/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp index be05426f3..fdc7716cb 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/uavconfiginfo.cpp @@ -181,7 +181,7 @@ bool UAVConfigInfo::askToAbort(int compat, QString message) msgBox.setInformativeText(tr("Do you want to continue the import?")); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - int result; + int result = QMessageBox::Abort; switch (compat) { case FullyCompatible: diff --git a/ground/openpilotgcs/src/plugins/debuggadget/debuggadgetwidget.cpp b/ground/openpilotgcs/src/plugins/debuggadget/debuggadgetwidget.cpp index 81a8d1fe0..1958f3d0e 100644 --- a/ground/openpilotgcs/src/plugins/debuggadget/debuggadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/debuggadget/debuggadgetwidget.cpp @@ -43,6 +43,7 @@ QPointer m_textedit; void DebugGadgetWidget::customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { + Q_UNUSED(context); QString txt; QColor color = Qt::black; diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index a0b3152f6..71f8311da 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -223,6 +223,102 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve) setDisableControls(false); } +void FlightLogManager::exportToOPL(QString fileName) +{ + // Fix the file name + fileName.replace(QString(".opl"), QString("%1.opl")); + + // Loop and create a new file for each flight. + int currentEntry = 0; + int currentFlight = 0; + quint32 adjustedBaseTime = 0; + // Continue until all entries are exported + while (currentEntry < m_logEntries.count()) { + if (m_adjustExportedTimestamps) { + adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime(); + } + + // Get current flight + currentFlight = m_logEntries[currentEntry]->getFlight(); + + LogFile logFile; + logFile.useProvidedTimeStamp(true); + + // Set the file name to contain flight number + logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1))); + logFile.open(QIODevice::WriteOnly); + UAVTalk uavTalk(&logFile, m_objectManager); + + // Export entries until no more available or flight changes + while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) { + ExtendedDebugLogEntry *entry = m_logEntries[currentEntry]; + + // Only log uavobjects + if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) { + // Set timestamp that should be logged for this entry + logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime); + + // Use UAVTalk to log complete message to file + uavTalk.sendObject(entry->uavObject(), false, false); + qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief(); + } + currentEntry++; + } + + logFile.close(); + } +} + +void FlightLogManager::exportToCSV(QString fileName) +{ + QFile csvFile(fileName); + if (csvFile.open(QFile::WriteOnly | QFile::Truncate)) { + QTextStream csvStream(&csvFile); + quint32 baseTime = 0; + quint32 currentFlight = 0; + csvStream << "Flight" << '\t' << "Flight Time" << '\t' << "Entry" << '\t' << "Data" << '\n'; + foreach (ExtendedDebugLogEntry *entry , m_logEntries) { + if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + currentFlight = entry->getFlight(); + baseTime = entry->getFlightTime(); + } + entry->toCSV(&csvStream, baseTime); + } + csvStream.flush(); + csvFile.flush(); + csvFile.close(); + } +} + +void FlightLogManager::exportToXML(QString fileName) +{ + QFile xmlFile(fileName); + if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { + + QXmlStreamWriter xmlWriter(&xmlFile); + xmlWriter.setAutoFormatting(true); + xmlWriter.setAutoFormattingIndent(4); + + xmlWriter.writeStartDocument("1.0", true); + xmlWriter.writeStartElement("logs"); + xmlWriter.writeComment("This file was created by the flight log export in OpenPilot GCS."); + + quint32 baseTime = 0; + quint32 currentFlight = 0; + foreach (ExtendedDebugLogEntry *entry , m_logEntries) { + if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + currentFlight = entry->getFlight(); + baseTime = entry->getFlightTime(); + } + entry->toXML(&xmlWriter, baseTime); + } + xmlWriter.writeEndElement(); + xmlWriter.writeEndDocument(); + xmlFile.flush(); + xmlFile.close(); + } +} + void FlightLogManager::exportLogs() { if (m_logEntries.isEmpty()) { @@ -232,49 +328,31 @@ void FlightLogManager::exportLogs() setDisableControls(true); QApplication::setOverrideCursor(Qt::WaitCursor); - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log"), - tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")), - tr("OpenPilot Log (*.opl)")); + QString oplFilter = tr("OpenPilot Log file %1").arg("(*.opl)"); + QString csvFilter = tr("Text file %1").arg("(*.csv)"); + QString xmlFilter = tr("XML file %1").arg("(*.xml)"); + + QString selectedFilter = csvFilter; + + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Entries"), + QString("OP-%1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")), + QString("%1;;%2;;%3").arg(oplFilter, csvFilter, xmlFilter), &selectedFilter); if (!fileName.isEmpty()) { - // Loop and create a new file for each flight. - fileName = fileName.replace(QString(".opl"), QString("%1.opl")); - int currentEntry = 0; - int currentFlight = 0; - quint32 adjustedBaseTime = 0; - // Continue until all entries are exported - while (currentEntry < m_logEntries.count()) { - if (m_adjustExportedTimestamps) { - adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime(); + if (selectedFilter == oplFilter) { + if (!fileName.endsWith(".opl")) { + fileName.append(".opl"); } - - // Get current flight - currentFlight = m_logEntries[currentEntry]->getFlight(); - - LogFile logFile; - logFile.useProvidedTimeStamp(true); - - // Set the file name to contain flight number - logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1))); - logFile.open(QIODevice::WriteOnly); - UAVTalk uavTalk(&logFile, m_objectManager); - - // Export entries until no more available or flight changes - while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) { - ExtendedDebugLogEntry *entry = m_logEntries[currentEntry]; - - // Only log uavobjects - if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) { - // Set timestamp that should be logged for this entry - logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime); - - // Use UAVTalk to log complete message to file - uavTalk.sendObject(entry->uavObject(), false, false); - qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief(); - } - currentEntry++; + exportToOPL(fileName); + } else if (selectedFilter == csvFilter) { + if (!fileName.endsWith(".csv")) { + fileName.append(".csv"); } - - logFile.close(); + exportToCSV(fileName); + } else if (selectedFilter == xmlFilter) { + if (!fileName.endsWith(".xml")) { + fileName.append(".xml"); + } + exportToXML(fileName); } } @@ -345,6 +423,33 @@ QString ExtendedDebugLogEntry::getLogString() } } +void ExtendedDebugLogEntry::toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime) +{ + xmlWriter->writeStartElement("entry"); + xmlWriter->writeAttribute("flight", QString::number(getFlight() + 1)); + xmlWriter->writeAttribute("flighttime", QString::number(getFlightTime() - baseTime)); + xmlWriter->writeAttribute("entry", QString::number(getEntry())); + if (getType() == DebugLogEntry::TYPE_TEXT) { + xmlWriter->writeAttribute("type", "text"); + xmlWriter->writeTextElement("message", QString((const char *)getData().Data)); + } else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) { + xmlWriter->writeAttribute("type", "uavobject"); + m_object->toXML(xmlWriter); + } + xmlWriter->writeEndElement(); //entry +} + +void ExtendedDebugLogEntry::toCSV(QTextStream *csvStream, quint32 baseTime) +{ + QString data; + if (getType() == DebugLogEntry::TYPE_TEXT) { + data = QString((const char *)getData().Data); + } else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) { + data = m_object->toString().replace("\n", "").replace("\t", ""); + } + *csvStream << QString::number(getFlight() + 1) << '\t' << QString::number(getFlightTime() - baseTime) << '\t' << QString::number(getEntry()) << '\t' << data << '\n'; +} + void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVObjectManager *objectManager) { DebugLogEntry::setData(data); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index dbe57c599..956b52b06 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "uavobjectmanager.h" #include "debuglogentry.h" @@ -88,6 +90,8 @@ public: ~ExtendedDebugLogEntry(); QString getLogString(); + void toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime); + void toCSV(QTextStream *csvStream, quint32 baseTime); UAVDataObject *uavObject() { return m_object; @@ -220,6 +224,11 @@ private: bool m_disableExport; bool m_cancelDownload; bool m_adjustExportedTimestamps; + + void exportToOPL(QString fileName); + void exportToCSV(QString fileName); + void exportToXML(QString fileName); + }; #endif // FLIGHTLOGMANAGER_H diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadget.cpp b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadget.cpp index ce2629bba..ed095e5a4 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadget.cpp +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadget.cpp @@ -146,10 +146,10 @@ void GCSControlGadget::sticksChangedLocally(double leftX, double leftY, double r double oldYaw = obj->getField("Yaw")->getDouble(); double oldThrottle = obj->getField("Throttle")->getDouble(); - double newRoll; - double newPitch; - double newYaw; - double newThrottle; + double newRoll = 0.0; + double newPitch = 0.0; + double newYaw = 0.0; + double newThrottle = 0.0; // Remap left X/Y and right X/Y to RPYT depending on mode switch (controlsMode) { @@ -246,7 +246,10 @@ void GCSControlGadget::gamepads(quint8 count) void GCSControlGadget::readUDPCommand() { - double pitch, yaw, roll, throttle; + double pitch = 0.0; + double yaw = 0.0; + double roll = 0.0; + double throttle = 0.0; while (control_sock->hasPendingDatagrams()) { QByteArray datagram; diff --git a/ground/openpilotgcs/src/plugins/hitl/fgsimulator.cpp b/ground/openpilotgcs/src/plugins/hitl/fgsimulator.cpp index 3a1d9d2ae..5e65ede92 100644 --- a/ground/openpilotgcs/src/plugins/hitl/fgsimulator.cpp +++ b/ground/openpilotgcs/src/plugins/hitl/fgsimulator.cpp @@ -247,15 +247,15 @@ void FGSimulator::processUpdate(const QByteArray & inp) // Get rollRate (deg/s) float rollRate = fields[9].toFloat(); // Get yaw (deg) - float yaw = fields[10].toFloat(); + float yaw = fields[10].toFloat(); // Get yawRate (deg/s) - float yawRate = fields[11].toFloat(); + float yawRate = fields[11].toFloat(); // Get latitude (deg) - float latitude = fields[12].toFloat(); + float latitude = fields[12].toFloat(); // Get longitude (deg) - float longitude = fields[13].toFloat(); + float longitude = fields[13].toFloat(); // Get heading (deg) - float heading = fields[14].toFloat(); + // float heading = fields[14].toFloat(); // Get altitude (m) float altitude_msl = fields[15].toFloat() * FT2M; // Get altitudeAGL (m) diff --git a/ground/openpilotgcs/src/plugins/hitl/simulator.cpp b/ground/openpilotgcs/src/plugins/hitl/simulator.cpp index 355e76448..624bc0ca3 100644 --- a/ground/openpilotgcs/src/plugins/hitl/simulator.cpp +++ b/ground/openpilotgcs/src/plugins/hitl/simulator.cpp @@ -410,14 +410,10 @@ void Simulator::updateUAVOs(Output2Hardware out) homeData.Latitude = out.latitude; // Already in *10^7 integer format homeData.Longitude = out.longitude; // Already in *10^7 integer format homeData.Altitude = out.agl; - double LLA[3]; - LLA[0] = out.latitude; - LLA[1] = out.longitude; - LLA[2] = out.altitude; - homeData.Be[0] = 0; - homeData.Be[1] = 0; - homeData.Be[2] = 0; + homeData.Be[0] = 0; + homeData.Be[1] = 0; + homeData.Be[2] = 0; posHome->setData(homeData); posHome->updated(); @@ -498,13 +494,13 @@ void Simulator::updateUAVOs(Output2Hardware out) AttitudeSettings::DataFields attSettData = attSettings->getData(); float accelKp = attSettData.AccelKp * 0.1666666666666667; - float accelKi = attSettData.AccelKp * 0.1666666666666667; + // float accelKi = attSettData.AccelKp * 0.1666666666666667; float yawBiasRate = attSettData.YawBiasRate; // calibrate sensors on arming if (flightStatus->getData().Armed == FlightStatus::ARMED_ARMING) { accelKp = 2.0; - accelKi = 0.9; + // accelKi = 0.9; } float gyro[3] = { out.rollRate, out.pitchRate, out.yawRate }; diff --git a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetconfiguration.h b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetconfiguration.h index 3a85146a1..ae1c8b564 100644 --- a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetconfiguration.h +++ b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetconfiguration.h @@ -176,11 +176,9 @@ private: double yellowMax; double greenMin; double greenMax; - double factor; - bool useOpenGLFlag; - int decimalPlaces; + bool useOpenGLFlag; }; #endif // LINEARDIALGADGETCONFIGURATION_H diff --git a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui index 1b8353d29..db73d0a8c 100644 --- a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui +++ b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui @@ -78,7 +78,7 @@ - + 0 diff --git a/ground/openpilotgcs/src/plugins/logging/logginggadget.cpp b/ground/openpilotgcs/src/plugins/logging/logginggadget.cpp index a4fbc8d7d..d07152898 100644 --- a/ground/openpilotgcs/src/plugins/logging/logginggadget.cpp +++ b/ground/openpilotgcs/src/plugins/logging/logginggadget.cpp @@ -42,4 +42,6 @@ LoggingGadget::~LoggingGadget() } void LoggingGadget::loadConfiguration(IUAVGadgetConfiguration *config) -{} +{ + Q_UNUSED(config); +} diff --git a/ground/openpilotgcs/src/plugins/magicwaypoint/positionfield.cpp b/ground/openpilotgcs/src/plugins/magicwaypoint/positionfield.cpp index eb3a8a96a..dec30402b 100644 --- a/ground/openpilotgcs/src/plugins/magicwaypoint/positionfield.cpp +++ b/ground/openpilotgcs/src/plugins/magicwaypoint/positionfield.cpp @@ -48,9 +48,8 @@ PositionField::PositionField(QWidget *parent) : setScene(new QGraphicsScene(this)); setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); - m_renderer = new QSvgRenderer(); - bool success = m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg")); - Q_ASSERT(success); + m_renderer = new QSvgRenderer(); + m_renderer->load(QString(":/magicwaypoint/images/positionfield.svg")); m_background = new QGraphicsSvgItem(); m_background->setSharedRenderer(m_renderer); diff --git a/ground/openpilotgcs/src/plugins/notify/notificationitem.cpp b/ground/openpilotgcs/src/plugins/notify/notificationitem.cpp index b3d627838..358974388 100644 --- a/ground/openpilotgcs/src/plugins/notify/notificationitem.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notificationitem.cpp @@ -46,9 +46,9 @@ QStringList NotificationItem::retryValues; NotificationItem::NotificationItem(QObject *parent) : QObject(parent) - , _currentUpdatePlayed(false) , isNowPlaying(0) , _isPlayed(false) + , _currentUpdatePlayed(false) , _timer(NULL) , _expireTimer(NULL) , _soundCollectionPath("") diff --git a/ground/openpilotgcs/src/plugins/notify/notifyitemdelegate.cpp b/ground/openpilotgcs/src/plugins/notify/notifyitemdelegate.cpp index a39405e9e..b2440762b 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifyitemdelegate.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notifyitemdelegate.cpp @@ -144,6 +144,7 @@ void NotifyItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model void NotifyItemDelegate::selectRow(const QString & text) { + Q_UNUSED(text); QComboBox *combo = qobject_cast(sender()); QTableWidget *table = new QTableWidget; diff --git a/ground/openpilotgcs/src/plugins/notify/notifyplugin.cpp b/ground/openpilotgcs/src/plugins/notify/notifyplugin.cpp index 4eee0438e..56620a7b0 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifyplugin.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notifyplugin.cpp @@ -351,13 +351,6 @@ void SoundNotifyPlugin::stateChanged(QMediaPlayer::State newstate) playNotification(notification); qNotifyDebug() << "end playNotification"; } - } else { - if (newstate == QMediaPlayer::ServiceMissingError) { - if (phonon.mo->error() == 0) { - qDebug() << "Phonon::ErrorState: ErrorType = " << phonon.mo->error(); - phonon.mo->stop(); - } - } } } diff --git a/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp b/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp index 57eb4d21a..bca83ad8e 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp @@ -640,7 +640,8 @@ void NotifyPluginOptionsPage::on_FinishedPlaying() void NotifyPluginOptionsPage::on_toggled_checkEnableSound(bool state) { - bool state1 = 1 ^ state; + Q_UNUSED(state); + // bool state1 = 1 ^ state; // QList listOutputs = _testSound->outputPaths(); // Phonon::AudioOutput *audioOutput = (Phonon::AudioOutput *)listOutputs.last().sink(); diff --git a/ground/openpilotgcs/src/plugins/notify/notifytablemodel.cpp b/ground/openpilotgcs/src/plugins/notify/notifytablemodel.cpp index 8871f2352..380b1c942 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifytablemodel.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notifytablemodel.cpp @@ -186,6 +186,7 @@ QStringList NotifyTableModel::mimeTypes() const bool NotifyTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex & parent) { + Q_UNUSED(column); if (action == Qt::IgnoreAction) { return true; } @@ -233,11 +234,9 @@ bool NotifyTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action continue; } - bool success = insertRows(rows + direction, 1, QModelIndex()); - Q_ASSERT(success); + insertRows(rows + direction, 1, QModelIndex()); _list.replace(rows + direction, item); - success = removeRows(dragged, 1, QModelIndex()); - Q_ASSERT(success); + removeRows(dragged, 1, QModelIndex()); if (direction == UP_DIRECTION) { ++rows; } diff --git a/ground/openpilotgcs/src/plugins/notify/notifytablemodel.h b/ground/openpilotgcs/src/plugins/notify/notifytablemodel.h index 01974baab..9820b2deb 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifytablemodel.h +++ b/ground/openpilotgcs/src/plugins/notify/notifytablemodel.h @@ -45,6 +45,7 @@ public: NotifyTableModel(QList & parentList, QObject *parent = 0); int rowCount(const QModelIndex & parent = QModelIndex()) const { + Q_UNUSED(parent); return _list.count(); } diff --git a/ground/openpilotgcs/src/plugins/ophid/hidapi/libusb/hid.c b/ground/openpilotgcs/src/plugins/ophid/hidapi/libusb/hid.c index a25eaa6f3..13a4e5aa4 100644 --- a/ground/openpilotgcs/src/plugins/ophid/hidapi/libusb/hid.c +++ b/ground/openpilotgcs/src/plugins/ophid/hidapi/libusb/hid.c @@ -1205,9 +1205,9 @@ int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index } -HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) +HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev __attribute__ ((unused))) { - return NULL; + return NULL; } diff --git a/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp b/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp index ab829da75..73c495b34 100644 --- a/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp @@ -92,19 +92,14 @@ modelMapProxy::overlayType modelMapProxy::overlayTranslate(int type) case MapDataDelegate::MODE_DRIVEVECTOR: return OVERLAY_LINE; - break; case MapDataDelegate::MODE_FLYCIRCLERIGHT: case MapDataDelegate::MODE_DRIVECIRCLERIGHT: return OVERLAY_CIRCLE_RIGHT; - break; case MapDataDelegate::MODE_FLYCIRCLELEFT: case MapDataDelegate::MODE_DRIVECIRCLELEFT: - return OVERLAY_CIRCLE_LEFT; - - break; default: - break; + return OVERLAY_CIRCLE_LEFT; } } @@ -297,7 +292,11 @@ void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &b void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last) { Q_UNUSED(parent); - for (int x = first; x < last + 1; x++) { + Q_UNUSED(first); + Q_UNUSED(last); + + /* + for (int x = first; x < last + 1; x++) { QModelIndex index; WayPointItem *item; internals::PointLatLng latlng; @@ -325,7 +324,8 @@ void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last) } else { item = myMap->WPInsert(latlng, altitude, desc, x); } - } + } + */ refreshOverlays(); } void modelMapProxy::deleteWayPoint(int number) diff --git a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h index 46dadab97..84f7303ea 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h +++ b/ground/openpilotgcs/src/plugins/opmap/opmap_edit_waypoint_dialog.h @@ -51,10 +51,10 @@ public: void editWaypoint(mapcontrol::WayPointItem *waypoint_item); private: - Ui::opmap_edit_waypoint_dialog *ui; QDataWidgetMapper *mapper; QAbstractItemModel *model; QItemSelectionModel *itemSelection; + Ui::opmap_edit_waypoint_dialog *ui; private slots: private slots: diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetoptionspage.ui index e72bc2105..5d5285811 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetoptionspage.ui +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetoptionspage.ui @@ -490,13 +490,6 @@ - - - - - verticalSpacer - line - label_7 diff --git a/ground/openpilotgcs/src/plugins/pathactioneditor/pathactioneditortreemodel.cpp b/ground/openpilotgcs/src/plugins/pathactioneditor/pathactioneditortreemodel.cpp index 26580212f..476a1ab27 100644 --- a/ground/openpilotgcs/src/plugins/pathactioneditor/pathactioneditortreemodel.cpp +++ b/ground/openpilotgcs/src/plugins/pathactioneditor/pathactioneditortreemodel.cpp @@ -153,7 +153,7 @@ void PathActionEditorTreeModel::addSingleField(int index, UAVObjectField *field, data.append(QString("[%1]").arg((field->getElementNames())[index])); } - FieldTreeItem *item; + FieldTreeItem *item = NULL; UAVObjectField::FieldType type = field->getType(); // hack: list available actions in an enum if (field->getName().compare("Action") == 0 && type == UAVObjectField::UINT8) { @@ -423,8 +423,9 @@ void PathActionEditorTreeModel::newInstance(UAVObject *obj) void PathActionEditorTreeModel::objUpdated(UAVObject *obj) { - quint16 index = m_objManager->getObject("WaypointActive")->getField("Index")->getValue().toInt(); - quint16 action; + Q_UNUSED(obj); + quint16 index = m_objManager->getObject("WaypointActive")->getField("Index")->getValue().toInt(); + quint16 action = 0; foreach(TreeItem * child, m_waypointsTree->treeChildren()) { ObjectTreeItem *objItem = dynamic_cast(child); diff --git a/ground/openpilotgcs/src/plugins/pathactioneditor/treeitem.cpp b/ground/openpilotgcs/src/plugins/pathactioneditor/treeitem.cpp index 2fe0b7717..5dbdb2d1a 100644 --- a/ground/openpilotgcs/src/plugins/pathactioneditor/treeitem.cpp +++ b/ground/openpilotgcs/src/plugins/pathactioneditor/treeitem.cpp @@ -108,6 +108,7 @@ void TreeItem::apply() void TreeItem::setHighlight(bool highlight) { + Q_UNUSED(highlight) // m_highlight = highlight; m_changed = false; } diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp index 96fa900a4..ae0229ae2 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp @@ -162,6 +162,7 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor) void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg) { + Q_UNUSED(arg); setTerrainEnabled(m_terrainEnabled); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp index 4a19eb4cf..248ec3a97 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp @@ -155,7 +155,8 @@ void ConnectionDiagram::setupGraphicsScene() void ConnectionDiagram::setupGraphicsSceneItems(QList elementsToShow) { qreal z = 0; - QRectF backgBounds = m_renderer->boundsOnElement("background"); + + // QRectF backgBounds = m_renderer->boundsOnElement("background"); foreach(QString elementId, elementsToShow) { if (m_renderer->elementExists(elementId)) { diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index c4a670704..5198c537e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -392,10 +392,9 @@ void VehicleConfigurationHelper::applySensorBiasConfiguration() void VehicleConfigurationHelper::applyStabilizationConfiguration() { - StabilizationSettings *stabSettings = StabilizationSettings::GetInstance(m_uavoManager); + StabilizationSettings *stabSettings = StabilizationSettings::GetInstance(m_uavoManager); Q_ASSERT(stabSettings); - StabilizationSettings::DataFields data = stabSettings->getData(); StabilizationSettings defaultSettings; stabSettings->setData(defaultSettings.getData()); @@ -709,11 +708,6 @@ GUIConfigDataUnion VehicleConfigurationHelper::getGUIConfigData() { GUIConfigDataUnion configData; - SystemSettings *systemSettings = SystemSettings::GetInstance(m_uavoManager); - - Q_ASSERT(systemSettings); - SystemSettings::DataFields systemSettingsData = systemSettings->getData(); - for (int i = 0; i < (int)(SystemSettings::GUICONFIGDATA_NUMELEM); i++) { configData.UAVObject[i] = 0; // systemSettingsData.GUIConfigData[i]; } @@ -725,7 +719,7 @@ void VehicleConfigurationHelper::setupQuadCopter() { mixerChannelSettings channels[10]; GUIConfigDataUnion guiSettings = getGUIConfigData(); - SystemSettings::AirframeTypeOptions frame; + SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_QUADX; switch (m_configSource->getVehicleSubType()) { case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS: @@ -815,7 +809,7 @@ void VehicleConfigurationHelper::setupHexaCopter() { mixerChannelSettings channels[10]; GUIConfigDataUnion guiSettings = getGUIConfigData(); - SystemSettings::AirframeTypeOptions frame; + SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_HEXA; switch (m_configSource->getVehicleSubType()) { case VehicleConfigurationSource::MULTI_ROTOR_HEXA: @@ -994,7 +988,7 @@ void VehicleConfigurationHelper::setupOctoCopter() { mixerChannelSettings channels[10]; GUIConfigDataUnion guiSettings = getGUIConfigData(); - SystemSettings::AirframeTypeOptions frame; + SystemSettings::AirframeTypeOptions frame = SystemSettings::AIRFRAMETYPE_OCTO; switch (m_configSource->getVehicleSubType()) { case VehicleConfigurationSource::MULTI_ROTOR_OCTO: diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp index e23591da2..23423fe1c 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp @@ -46,6 +46,7 @@ MonitorGadget::~MonitorGadget() */ void MonitorGadget::loadConfiguration(IUAVGadgetConfiguration *config) { + Q_UNUSED(config); // MonitorGadgetConfiguration *m = qobject_cast(config); // m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp index 6a69905af..48b0efd37 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp @@ -47,6 +47,7 @@ IUAVGadgetConfiguration *MonitorGadgetConfiguration::clone() */ void MonitorGadgetConfiguration::saveConfig(QSettings *qSettings) const { + Q_UNUSED(qSettings); // qSettings->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename)); // qSettings->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename)); // qSettings->setValue("enableVbo", m_enableVbo); diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp index 62526cd1d..b6c33e7c5 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp @@ -81,5 +81,6 @@ IUAVGadgetConfiguration *MonitorGadgetFactory::createConfiguration(QSettings *qS IOptionsPage *MonitorGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) { + Q_UNUSED(config); return 0; // new MonitorGadgetOptionsPage(qobject_cast(config)); } diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp index 6601efd54..ca99c7c6e 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp @@ -32,7 +32,9 @@ MonitorGadgetOptionsPage::MonitorGadgetOptionsPage(MonitorGadgetConfiguration *config, QObject *parent) : IOptionsPage(parent) -{} +{ + Q_UNUSED(config); +} MonitorGadgetOptionsPage::~MonitorGadgetOptionsPage() {} diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserconfiguration.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserconfiguration.h index 6dcae4bf5..ff6237e7c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserconfiguration.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserconfiguration.h @@ -111,8 +111,8 @@ public slots: private: QColor m_recentlyUpdatedColor; QColor m_manuallyChangedColor; - int m_recentlyUpdatedTimeout; bool m_onlyHilightChangedValues; + int m_recentlyUpdatedTimeout; bool m_useCategorizedView; bool m_useScientificView; bool m_showMetaData; diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp index ecc9343bf..fd900591c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp @@ -94,13 +94,8 @@ void UAVObjectBrowserWidget::showMetaData(bool show) void UAVObjectBrowserWidget::categorize(bool categorize) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - - Q_ASSERT(pm); - UAVObjectManager *objManager = pm->getObject(); - Q_ASSERT(objManager); - UAVObjectTreeModel *tmpModel = m_model; + m_model = new UAVObjectTreeModel(0, categorize, m_viewoptions->cbScientific->isChecked()); m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor); m_model->setManuallyChangedColor(m_manuallyChangedColor); @@ -115,13 +110,8 @@ void UAVObjectBrowserWidget::categorize(bool categorize) void UAVObjectBrowserWidget::useScientificNotation(bool scientific) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - - Q_ASSERT(pm); - UAVObjectManager *objManager = pm->getObject(); - Q_ASSERT(objManager); - UAVObjectTreeModel *tmpModel = m_model; + m_model = new UAVObjectTreeModel(0, m_viewoptions->cbCategorized->isChecked(), scientific); m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor); m_model->setManuallyChangedColor(m_manuallyChangedColor); diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp index ee835daf6..b979fe4b4 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp @@ -207,7 +207,7 @@ void UAVObjectTreeModel::addSingleField(int index, UAVObjectField *field, TreeIt data.append(QString("[%1]").arg((field->getElementNames())[index])); } - FieldTreeItem *item; + FieldTreeItem *item = NULL; UAVObjectField::FieldType type = field->getType(); switch (type) { case UAVObjectField::BITFIELD: diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h index 775785c69..be7737e1d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h @@ -110,12 +110,12 @@ private: TreeItem *m_rootItem; TopTreeItem *m_settingsTree; TopTreeItem *m_nonSettingsTree; + bool m_useScientificFloatNotation; + bool m_categorize; int m_recentlyUpdatedTimeout; QColor m_recentlyUpdatedColor; QColor m_manuallyChangedColor; bool m_onlyHilightChangedValues; - bool m_useScientificFloatNotation; - bool m_categorize; // Highlight manager to handle highlighting of tree items. HighLightManager *m_highlightManager; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index 200d4900d..ebbfe1292 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -519,6 +519,19 @@ QString UAVObject::toStringData() return sout; } +void UAVObject::toXML(QXmlStreamWriter *xmlWriter) +{ + xmlWriter->writeStartElement("object"); + xmlWriter->writeAttribute("name", getName()); + xmlWriter->writeAttribute("id", QString("%1-%2").arg(getObjID(), 1, 16).toUpper().arg(getInstID())); + xmlWriter->writeStartElement("fields"); + foreach(UAVObjectField* field , fields) { + field->toXML(xmlWriter); + } + xmlWriter->writeEndElement(); // fields + xmlWriter->writeEndElement(); // object +} + /** * Emit the transactionCompleted event (used by the UAVTalk plugin) */ diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h index fd40c2940..fdbb458ca 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h @@ -37,6 +37,7 @@ #include #include #include +#include #include "uavobjectfield.h" #define UAVOBJ_ACCESS_SHIFT 0 @@ -128,6 +129,7 @@ public: QString toString(); QString toStringBrief(); QString toStringData(); + void toXML(QXmlStreamWriter *xmlWriter); void emitTransactionCompleted(bool success); void emitNewInstance(UAVObject *); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index e6c01d831..19ea0a563 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -654,6 +654,24 @@ QString UAVObjectField::toString() return sout; } +void UAVObjectField::toXML(QXmlStreamWriter *xmlWriter) +{ + xmlWriter->writeStartElement("field"); + xmlWriter->writeAttribute("name", getName()); + xmlWriter->writeAttribute("type", getTypeAsString()); + if (!getUnits().isEmpty()) { + xmlWriter->writeAttribute("unit", getUnits()); + } + for (unsigned int n = 0; n < numElements; ++n) { + xmlWriter->writeStartElement("value"); + if(getElementNames().size() > 1) { + xmlWriter->writeAttribute("name", getElementNames().at(n)); + } + xmlWriter->writeCharacters(getValue(n).toString()); + xmlWriter->writeEndElement(); // value + } + xmlWriter->writeEndElement(); // field +} qint32 UAVObjectField::pack(quint8 *dataOut) { diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h index c782a86f3..141fa6af7 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h @@ -34,6 +34,7 @@ #include #include #include +#include class UAVObject; @@ -72,6 +73,7 @@ public: bool isNumeric(); bool isText(); QString toString(); + void toXML(QXmlStreamWriter *xmlWriter); bool isWithinLimits(QVariant var, quint32 index, int board = 0); QVariant getMaxLimit(quint32 index, int board = 0); diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 74ddae50f..fc3758e7a 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -316,12 +316,11 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard) { double Be[3]; - int result = Utils::HomeLocationUtil().getDetails(LLA, Be); - - Q_ASSERT(result == 0); + Utils::HomeLocationUtil().getDetails(LLA, Be); // save the new settings HomeLocation *homeLocation = HomeLocation::GetInstance(obm); + Q_ASSERT(homeLocation != NULL); HomeLocation::DataFields homeLocationData = homeLocation->getData(); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index 84505cd26..156dd26e8 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -404,7 +404,7 @@ void ConfigTaskWidget::widgetsContentsChanged() { QWidget *emitter = ((QWidget *)sender()); emit widgetContentsChanged(emitter); - double scale; + double scale = 1.0; QVariant value; foreach(WidgetBinding * binding, m_widgetBindingsPerWidget.values(emitter)) { diff --git a/ground/openpilotgcs/src/plugins/uploader/SSP/port.h b/ground/openpilotgcs/src/plugins/uploader/SSP/port.h index 8f141625f..e9f3bf049 100644 --- a/ground/openpilotgcs/src/plugins/uploader/SSP/port.h +++ b/ground/openpilotgcs/src/plugins/uploader/SSP/port.h @@ -64,7 +64,7 @@ public: uint32_t TxError; uint16_t flags; port(QString name); - ~port(); + virtual ~port(); portstatus status(); private: portstatus mstatus; diff --git a/ground/openpilotgcs/src/plugins/uploader/SSP/qsspt.h b/ground/openpilotgcs/src/plugins/uploader/SSP/qsspt.h index 2a4714bcb..0ec228ce6 100644 --- a/ground/openpilotgcs/src/plugins/uploader/SSP/qsspt.h +++ b/ground/openpilotgcs/src/plugins/uploader/SSP/qsspt.h @@ -47,8 +47,8 @@ private: QQueue queue; QMutex mutex; QMutex sendbufmutex; - bool datapending; bool endthread; + bool datapending; uint16_t sendstatus; uint16_t receivestatus; QWaitCondition sendwait; diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index 9afbe5bdb..4e3312c72 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -225,6 +225,7 @@ void DeviceWidget::dfuStatus(QString str) void DeviceWidget::confirmCB(int value) { + Q_UNUSED(value); updateButtons(true); } @@ -277,7 +278,7 @@ void DeviceWidget::loadFirmware() QByteArray desc = loadedFW.right(100); QPixmap px; - if (loadedFW.length() > m_dfu->devices[deviceID].SizeOfCode) { + if (loadedFW.length() > (int)m_dfu->devices[deviceID].SizeOfCode) { myDevice->lblCRCL->setText(tr("Can't calculate, file too big for device")); } else { myDevice->lblCRCL->setText(QString::number(DFUObject::CRCFromQBArray(loadedFW, m_dfu->devices[deviceID].SizeOfCode))); diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp index c3dcd20ad..64bf57be8 100644 --- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp @@ -246,7 +246,7 @@ bool DFUObject::UploadData(qint32 const & numberOfBytes, QByteArray & data) buf[1] = OP_DFU::Upload; // DFU Command int packetsize; float percentage; - int laspercentage; + int laspercentage = 0; for (qint32 packetcount = 0; packetcount < numberOfPackets; ++packetcount) { percentage = (float)(packetcount + 1) / numberOfPackets * 100; if (laspercentage != (int)percentage) { @@ -433,7 +433,7 @@ bool DFUObject::StartDownloadT(QByteArray *fw, qint32 const & numberOfBytes, Tra qDebug() << "StartDownload:" << numberOfPackets << "packets" << " Last Packet Size=" << lastPacketCount << " " << result << " bytes sent"; } float percentage; - int laspercentage; + int laspercentage = 0; // Now get those packets: for (qint32 x = 0; x < numberOfPackets; ++x) { @@ -637,8 +637,8 @@ bool DFUObject::findDevices() buf[7] = 0; buf[8] = 0; buf[9] = 0; - int result = sendData(buf, BUF_LEN); - result = receiveData(buf, BUF_LEN); + sendData(buf, BUF_LEN); + receiveData(buf, BUF_LEN); devices[x].ID = buf[14]; devices[x].ID = devices[x].ID << 8 | (quint8)buf[15]; devices[x].BL_Version = buf[7]; @@ -749,7 +749,7 @@ OP_DFU::Status DFUObject::UploadFirmwareT(const QString &sfile, const bool &veri pad = pad - arr.length(); arr.append(QByteArray(pad, 255)); } - if (devices[device].SizeOfCode < arr.length()) { + if (devices[device].SizeOfCode < (quint32)arr.length()) { if (debug) { qDebug() << "ERROR file to big for device"; } diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.h b/ground/openpilotgcs/src/plugins/uploader/op_dfu.h index 33cef9abb..346582872 100644 --- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.h +++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.h @@ -115,7 +115,7 @@ public: // DFUObject(bool debug); DFUObject(bool debug, bool use_serial, QString port); - ~DFUObject(); + virtual ~DFUObject(); // Service commands: bool enterDFU(int const &devNumber); diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.pro b/ground/openpilotgcs/src/plugins/uploader/uploader.pro index 2b52a8649..20e358c8b 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.pro +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.pro @@ -11,6 +11,10 @@ macx { QMAKE_CXXFLAGS += -fpermissive } +!macx { + QMAKE_CXXFLAGS += -Wno-enum-compare +} + HEADERS += uploadergadget.h \ uploadergadgetconfiguration.h \ uploadergadgetfactory.h \ From 4f6d680810d0f53c437b2c631dc8053605281b7d Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 8 Mar 2014 12:14:19 +0100 Subject: [PATCH 027/131] OP-1245 Added check for board connected to enable disable controls. This function is only available for Revolution board at this point. --- .../src/plugins/flightlog/FlightLogDialog.qml | 12 ++++---- .../src/plugins/flightlog/flightlog.pro | 1 + .../plugins/flightlog/flightlogmanager.cpp | 24 +++++++++++++-- .../src/plugins/flightlog/flightlogmanager.h | 30 ++++++++++++++----- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index b5adb708e..533974393 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -33,6 +33,7 @@ Rectangle { Layout.fillHeight: true Layout.preferredHeight: 1000; model: logManager.logEntries + enabled: !logManager.disableControls && logManager.boardConnected rowDelegate: Rectangle { height: 22 @@ -104,7 +105,7 @@ Rectangle { } CheckBox { id: exportRelativeTimeCB - enabled: !logManager.disableControls && !logManager.disableExport + enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected text: qsTr("Adjust timestamps") activeFocusOnPress: true checked: logManager.adjustExportedTimestamps @@ -126,7 +127,7 @@ Rectangle { ComboBox { id: flightCombo - enabled: !logManager.disableControls + enabled: !logManager.disableControls && logManager.boardConnected model: logManager.flightEntries } } @@ -137,7 +138,7 @@ Rectangle { } Button { text: qsTr("Download logs") - enabled: !logManager.disableControls + enabled: !logManager.disableControls && logManager.boardConnected activeFocusOnPress: true onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1) } @@ -151,14 +152,14 @@ Rectangle { } Button { id: clearButton - enabled: !logManager.disableControls + enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Clear all logs") activeFocusOnPress: true onClicked: logManager.clearAllLogs() } Button { id: exportButton - enabled: !logManager.disableControls && !logManager.disableExport + enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected text: qsTr("Export logs...") activeFocusOnPress: true onClicked: logManager.exportLogs() @@ -218,6 +219,7 @@ Rectangle { Layout.fillHeight: true Layout.preferredHeight: 1000; model: logManager.uavoEntries + enabled: !logManager.disableControls && logManager.boardConnected rowDelegate: Rectangle { height: 22 diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro b/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro index dfae3248b..ae4b1e277 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro @@ -6,6 +6,7 @@ QT += qml quick include(../../openpilotgcsplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/uavobjectutil/uavobjectutil.pri) include(../../plugins/uavtalk/uavtalk.pri) HEADERS += flightlogplugin.h \ diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 71f8311da..a8ff55a83 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -35,17 +35,26 @@ #include "uavobjecthelper.h" #include "uavtalk/uavtalk.h" #include "utils/logfile.h" +#include FlightLogManager::FlightLogManager(QObject *parent) : QObject(parent), m_disableControls(false), m_disableExport(true), m_cancelDownload(false), m_adjustExportedTimestamps(true) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); + Q_ASSERT(pluginManager); - m_objectManager = pm->getObject(); + m_objectManager = pluginManager->getObject(); Q_ASSERT(m_objectManager); + m_telemtryManager = pluginManager->getObject(); + Q_ASSERT(m_telemtryManager); + + connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged())); + connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged())); + connectionStatusChanged(); + m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); Q_ASSERT(m_flightLogControl); @@ -400,6 +409,17 @@ void FlightLogManager::setupLogSettings() << tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute"); } +void FlightLogManager::connectionStatusChanged() +{ + if (m_telemtryManager->isConnected()) { + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectUtilManager *utilMngr = pm->getObject(); + setBoardConnected(utilMngr->getBoardModel() == 0x0903); + } else { + setBoardConnected(false); + } +} + ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(), m_object(0) {} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 956b52b06..b31271dc4 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -39,6 +39,7 @@ #include "debuglogentry.h" #include "debuglogstatus.h" #include "debuglogcontrol.h" +#include "uavtalk/telemetrymanager.h" class UAVOLogSettingsWrapper : public QObject { Q_OBJECT @@ -120,6 +121,7 @@ class FlightLogManager : public QObject { Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged) Q_PROPERTY(bool disableExport READ disableExport WRITE setDisableExport NOTIFY disableExportChanged) Q_PROPERTY(bool adjustExportedTimestamps READ adjustExportedTimestamps WRITE setAdjustExportedTimestamps NOTIFY adjustExportedTimestampsChanged) + Q_PROPERTY(bool boardConnected READ boardConnected WRITE setBoardConnected NOTIFY boardConnectedChanged) Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged) @@ -160,17 +162,20 @@ public: return m_adjustExportedTimestamps; } + bool boardConnected() const + { + return m_boardConnected; + } + signals: void logEntriesChanged(); void flightEntriesChanged(); void logSettingsChanged(); - void uavoEntriesChanged(); - void disableControlsChanged(bool arg); void disableExportChanged(bool arg); - void adjustExportedTimestampsChanged(bool arg); + void boardConnectedChanged(bool arg); public slots: void clearAllLogs(); @@ -202,13 +207,23 @@ public slots: } } + void setBoardConnected(bool arg) + { + if (m_boardConnected != arg) { + m_boardConnected = arg; + emit boardConnectedChanged(arg); + } + } + private slots: void updateFlightEntries(quint16 currentFlight); void setupUAVOWrappers(); void setupLogSettings(); + void connectionStatusChanged(); private: UAVObjectManager *m_objectManager; + TelemetryManager *m_telemtryManager; DebugLogControl *m_flightLogControl; DebugLogStatus *m_flightLogStatus; DebugLogEntry *m_flightLogEntry; @@ -219,15 +234,16 @@ private: QList m_uavoEntries; + void exportToOPL(QString fileName); + void exportToCSV(QString fileName); + void exportToXML(QString fileName); + static const int UAVTALK_TIMEOUT = 4000; bool m_disableControls; bool m_disableExport; bool m_cancelDownload; bool m_adjustExportedTimestamps; - - void exportToOPL(QString fileName); - void exportToCSV(QString fileName); - void exportToXML(QString fileName); + bool m_boardConnected; }; From cbe4eea01e8a6115fc4fd22956c509e2de46a479 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 8 Mar 2014 13:47:41 +0100 Subject: [PATCH 028/131] OP-1245 Added buttons and combobox to the logging settings panel. --- .../src/plugins/flightlog/FlightLogDialog.qml | 53 +++++++++++++++++-- .../src/plugins/flightlog/flightlogdialog.cpp | 2 + .../plugins/flightlog/flightlogmanager.cpp | 10 +++- .../src/plugins/flightlog/flightlogmanager.h | 25 ++++++++- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 533974393..aeabd5e24 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -175,7 +175,21 @@ Rectangle { anchors.fill: parent Text { Layout.fillWidth: true - text: "" + qsTr("Log settings") + "" + text: "" + qsTr("Settings") + "" + } + + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: true + Text { + text: qsTr("When to log: ") + } + ComboBox { + enabled: !logManager.disableControls && logManager.boardConnected + model: logManager.logStatuses + currentIndex: logSettings.getLoggingEnabled() + } + } Component { @@ -246,6 +260,39 @@ Rectangle { delegate: comboEditableDelegate } } + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: true + + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Load...") + activeFocusOnPress: true + } + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Save...") + activeFocusOnPress: true + } + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Reset") + activeFocusOnPress: true + } + Rectangle { + Layout.fillWidth: true + } + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Apply to board") + activeFocusOnPress: true + } + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Save to board") + activeFocusOnPress: true + } + } } } @@ -255,14 +302,14 @@ Rectangle { Button { id: settingsButton enabled: !logManager.disableControls - text: qsTr("Log settings...") + text: qsTr("Settings...") activeFocusOnPress: true property bool showSettings: false onClicked: { showSettings = !showSettings; settingsTab.visible = showSettings; exportTab.visible = !showSettings; - text = (showSettings ? qsTr("View logs...") : qsTr("Log settings...")); + text = (showSettings ? qsTr("Logs...") : qsTr("Settings...")); } } Rectangle { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index d3b36029a..3c87d624c 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -51,6 +51,8 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan QQuickView *view = new QQuickView(); view->rootContext()->setContextProperty("dialog", this); view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus()); + view->rootContext()->setContextProperty("logControl", flightLogManager->flightLogControl()); + view->rootContext()->setContextProperty("logSettings", flightLogManager->flightLogSettings()); view->rootContext()->setContextProperty("logManager", flightLogManager); view->setResizeMode(QQuickView::SizeRootObjectToView); view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index a8ff55a83..0823f4f94 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -65,11 +65,14 @@ FlightLogManager::FlightLogManager(QObject *parent) : m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager); Q_ASSERT(m_flightLogEntry); + m_flightLogSettings = DebugLogSettings::GetInstance(m_objectManager); + Q_ASSERT(m_flightLogSettings); + updateFlightEntries(m_flightLogStatus->getFlight()); setupUAVOWrappers(); - setupLogSettings(); + setupLogStatuses(); } FlightLogManager::~FlightLogManager() @@ -409,6 +412,11 @@ void FlightLogManager::setupLogSettings() << tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute"); } +void FlightLogManager::setupLogStatuses() +{ + m_logStatuses << tr("Never") << tr("Only when Armed") << tr("Always"); +} + void FlightLogManager::connectionStatusChanged() { if (m_telemtryManager->isConnected()) { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index b31271dc4..9589341d8 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -38,6 +38,7 @@ #include "uavobjectmanager.h" #include "debuglogentry.h" #include "debuglogstatus.h" +#include "debuglogsettings.h" #include "debuglogcontrol.h" #include "uavtalk/telemetrymanager.h" @@ -116,6 +117,8 @@ private: class FlightLogManager : public QObject { Q_OBJECT Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus) + Q_PROPERTY(DebugLogControl *flightLogControl READ flightLogControl) + Q_PROPERTY(DebugLogSettings *flightLogSettings READ flightLogSettings) Q_PROPERTY(QQmlListProperty logEntries READ logEntries NOTIFY logEntriesChanged) Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged) Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged) @@ -125,6 +128,7 @@ class FlightLogManager : public QObject { Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged) + Q_PROPERTY(QStringList logStatuses READ logStatuses NOTIFY logStatusesChanged) public: @@ -167,6 +171,21 @@ public: return m_boardConnected; } + QStringList logStatuses() const + { + return m_logStatuses; + } + + DebugLogControl * flightLogControl() const + { + return m_flightLogControl; + } + + DebugLogSettings * flightLogSettings() const + { + return m_flightLogSettings; + } + signals: void logEntriesChanged(); void flightEntriesChanged(); @@ -177,6 +196,8 @@ signals: void adjustExportedTimestampsChanged(bool arg); void boardConnectedChanged(bool arg); + void logStatusesChanged(QStringList arg); + public slots: void clearAllLogs(); void retrieveLogs(int flightToRetrieve = -1); @@ -219,6 +240,7 @@ private slots: void updateFlightEntries(quint16 currentFlight); void setupUAVOWrappers(); void setupLogSettings(); + void setupLogStatuses(); void connectionStatusChanged(); private: @@ -227,10 +249,12 @@ private: DebugLogControl *m_flightLogControl; DebugLogStatus *m_flightLogStatus; DebugLogEntry *m_flightLogEntry; + DebugLogSettings * m_flightLogSettings; QList m_logEntries; QStringList m_flightEntries; QStringList m_logSettings; + QStringList m_logStatuses; QList m_uavoEntries; @@ -244,7 +268,6 @@ private: bool m_cancelDownload; bool m_adjustExportedTimestamps; bool m_boardConnected; - }; #endif // FLIGHTLOGMANAGER_H From 0dff941cbe5fb69a222817775ed63829a01e1dc8 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 14:18:45 +0100 Subject: [PATCH 029/131] OP-1254 update toolchain installer to support Qt 5.2.1 --- make/tools.mk | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/make/tools.mk b/make/tools.mk index dc22f195f..adcbdbbce 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -58,13 +58,13 @@ endif ifeq ($(UNAME), Linux) ifeq ($(ARCH), x86_64) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-amd64.tar.bz2 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-linux-opensource-5.1.1-x86_64-offline.run - QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-linux-opensource-5.1.1-x86_64-offline.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x64-5.2.1.run.md5 QT_SDK_ARCH := gcc_64 else ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-i686.tar.bz2 - QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-linux-opensource-5.1.1-x86-offline.run - QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-linux-opensource-5.1.1-x86-offline.run.md5 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x86-5.2.1.run + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x86-5.2.1.md5 QT_SDK_ARCH := gcc endif UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60.tar.gz @@ -87,7 +87,7 @@ GTEST_URL := http://wiki.openpilot.org/download/attachments/18612236/gtest-1.6.0 # Changing PYTHON_DIR, also update it in ground/openpilotgcs/src/python.pri ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2013q1 -QT_SDK_DIR := $(TOOLS_DIR)/qt-5.1.1 +QT_SDK_DIR := $(TOOLS_DIR)/qt-5.2.1 MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw48_32 PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw48_32/opt/bin NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode @@ -329,16 +329,16 @@ qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0qt-project-url.7z" | grep -v Extracting $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep -v Extracting $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0readme.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1$(6)_qt5_essentials.7z" | grep -v Extracting - $(V1) if [ -f "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi - $(V1) if [ -f "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_51_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).essentials/5.1.1icu_path_patcher.sh.7z" | grep -v Extracting - $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.511.$(6).addons/5.1.1$(6)_qt5_addons.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1$(6)_qt5_essentials.7z" | grep -v Extracting + $(V1) if [ -f "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" | grep -v Extracting; fi + $(V1) if [ -f "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" ]; then $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" | grep -v Extracting; fi +# $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_path_patcher.sh.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).addons/5.2.1$(6)_qt5_addons.7z" | grep -v Extracting # go to OpenPilot/tools/5.1.1/gcc_64 and call patcher.sh @$(ECHO) @$(ECHO) "Running patcher in" $$(call toprel, $(QT_SDK_PREFIX)) $(V1) $(CD) $(QT_SDK_PREFIX) - $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX) +# $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX) # call qmake patcher @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) $(V1) $(DL_DIR)/$(5) --runoperation QtPatch linux $(QT_SDK_PREFIX) qt5 @@ -399,7 +399,6 @@ endef # Qt SDK # # Windows: native binary package has been provided -# Linux: user should install native Qt SDK package # Mac OS X: user should install native Qt SDK package # ############################## @@ -417,7 +416,7 @@ endef $(eval $(call TOOL_INSTALL_TEMPLATE,qt_sdk,$(QT_SDK_DIR),$(QT_SDK_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_CONFIGURE_TEMPLATE))) else ifeq ($(UNAME), Linux) -QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.1.1/$(QT_SDK_ARCH)" +QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH)" QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD $(eval $(call LINUX_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) @@ -428,7 +427,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR) .PHONY: qt_sdk_install qt_sdk_install: @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- - @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.1.x SDK using package manager + @$(ECHO) $(MSG_NOTICE) Please install native Qt 5.2.x SDK using package manager @$(ECHO) $(MSG_NOTICE) -------------------------------------------------------- .PHONY: qt_sdk_clean From a600ed93dc283ec344895e58173171dbf3e27d9a Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 14:19:24 +0100 Subject: [PATCH 030/131] OP-1254 Check if p7zip is installed, use 7zr rather than 7z --- make/tools.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/make/tools.mk b/make/tools.mk index adcbdbbce..5f2a534ca 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -145,7 +145,7 @@ OPENSSL := openssl ANT := ant JAVAC := javac JAR := jar -SEVENZIP := 7z +SEVENZIP := 7zr CD := cd GREP := grep # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases. @@ -317,7 +317,10 @@ define LINUX_QT_INSTALL_TEMPLATE .PHONY: $(addprefix qt_sdk_, install clean distclean) qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) - + if ! $(SEVENZIP) >/dev/null 2>&1; then \ + $(ECHO) $(MSG_NOTICE) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip." && \ + exit 1; \ + fi $(call DOWNLOAD_TEMPLATE,$(3),$(5),"$(4)") # Explode .run file into install packages @$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(1)) From 72e674bc098f1ec6c4dd00a1360987759fc911fe Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 14:20:14 +0100 Subject: [PATCH 031/131] OP-1254 Update linux copydata --- ground/openpilotgcs/copydata.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index a877da775..55cdda068 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -28,7 +28,6 @@ GCS_LIBRARY_PATH libQt5MultimediaWidgets.so.5 \ libQt5Quick.so.5 \ libQt5Qml.so.5 \ - libQt5V8.so.5 \ libQt5DBus.so.5 \ libQt5QuickParticles.so.5 \ libicui18n.so.51 \ From 4ac994085450dd26d28d06acfdba2961889bc67a Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 14:20:32 +0100 Subject: [PATCH 032/131] OP-1254 fix packaging rules --- package/linux/deb_common/rules | 1 - 1 file changed, 1 deletion(-) diff --git a/package/linux/deb_common/rules b/package/linux/deb_common/rules index e3fed4f80..4ee22cc13 100644 --- a/package/linux/deb_common/rules +++ b/package/linux/deb_common/rules @@ -36,7 +36,6 @@ install: cp -arp build/openpilotgcs_release/bin debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/lib debian/openpilot/usr/local/OpenPilot cp -arp build/openpilotgcs_release/share debian/openpilot/usr/local/OpenPilot - cp -arp build/openpilotgcs_release/.obj debian/openpilot/usr/local/OpenPilot cp -arp package/linux/qt.conf debian/openpilot/usr/local/OpenPilot/bin cp -arp package/linux/openpilot.desktop debian/openpilot/usr/share/applications cp -arp package/linux/openpilot.png debian/openpilot/usr/share/pixmaps From b1f1c4cd0fc13754e227004d03d0b720b94e4441 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 14:23:15 +0100 Subject: [PATCH 033/131] OP-1254 Hide 7z check command line from output --- make/tools.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/tools.mk b/make/tools.mk index 5f2a534ca..fdcd51086 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -317,7 +317,7 @@ define LINUX_QT_INSTALL_TEMPLATE .PHONY: $(addprefix qt_sdk_, install clean distclean) qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) - if ! $(SEVENZIP) >/dev/null 2>&1; then \ + $(V1) if ! $(SEVENZIP) >/dev/null 2>&1; then \ $(ECHO) $(MSG_NOTICE) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip." && \ exit 1; \ fi From d778e2612ca49beb061f9c5185ca168664dde98e Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 8 Mar 2014 15:06:17 +0100 Subject: [PATCH 034/131] OP-1254 fix md5 url --- make/tools.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/tools.mk b/make/tools.mk index fdcd51086..d0fbcad20 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -64,7 +64,7 @@ ifeq ($(UNAME), Linux) else ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-linux-i686.tar.bz2 QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x86-5.2.1.run - QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x86-5.2.1.md5 + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-linux-x86-5.2.1.run.md5 QT_SDK_ARCH := gcc endif UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60.tar.gz From d25eb01583b98ec02bfa7596d983c7679ebe83ed Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 8 Mar 2014 17:28:46 +0100 Subject: [PATCH 035/131] OP-1245 Added separate spinbox for period when throttled or periodically is chosen. Added empty placeholder methods for some functions. --- .../src/plugins/flightlog/FlightLogDialog.qml | 57 ++++++++++++++++++- .../plugins/flightlog/flightlogmanager.cpp | 35 +++++++++++- .../src/plugins/flightlog/flightlogmanager.h | 32 +++++++++-- 3 files changed, 113 insertions(+), 11 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index aeabd5e24..47cf5317d 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -227,6 +227,47 @@ Rectangle { } } + Component { + id: spinnerEditableDelegate + Item { + + Text { + width: parent.width + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined && (logManager.uavoEntries[styleData.row].setting > 1) ? + parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-" + color: styleData.textColor + //visible: !styleData.selected && (logManager.uavoEntries[styleData.row].setting <= 1) + enabled: (logManager.uavoEntries[styleData.row].setting > 1) + } + Loader { + id: loaderEditor + anchors.fill: parent + Connections { + target: loaderEditor.item + onValueChanged: { + logManager.uavoEntries[styleData.row].period = loaderEditor.item.value + } + } + sourceComponent: styleData.selected && (logManager.uavoEntries[styleData.row].setting > 1) ? editor : null + Component { + id: editor + SpinBox { + id: spinner + decimals: 0 + minimumValue: 0 + maximumValue: 1000 * 60 * 60 //1h + suffix: "ms" + stepSize: 10 + value: styleData.value + } + } + } + } + } + TableView { id: settingsTable Layout.fillWidth: true @@ -243,7 +284,7 @@ Rectangle { TableViewColumn { role: "name"; title: qsTr("UAVObject"); - width: 200; + width: 250; delegate: Text { verticalAlignment: Text.AlignVCenter @@ -256,9 +297,16 @@ Rectangle { TableViewColumn { role: "setting"; title: qsTr("Settings"); - width: 200; + width: 160; delegate: comboEditableDelegate } + + TableViewColumn { + role: "period"; + title: qsTr("Period"); + width: 120; + delegate: spinnerEditableDelegate + } } RowLayout { Layout.fillWidth: true @@ -268,16 +316,19 @@ Rectangle { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Load...") activeFocusOnPress: true + onClicked: logManager.loadSettings() } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Save...") activeFocusOnPress: true + onClicked: logManager.saveSettings() } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Reset") activeFocusOnPress: true + onClicked: logManager.resetSettings() } Rectangle { Layout.fillWidth: true @@ -286,11 +337,13 @@ Rectangle { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Apply to board") activeFocusOnPress: true + onClicked: logManager.applySettingsToBoard() } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Save to board") activeFocusOnPress: true + onClicked: logManager.saveSettingsToBoard() } } } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 0823f4f94..b836d4813 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -80,6 +80,9 @@ FlightLogManager::~FlightLogManager() while (!m_logEntries.isEmpty()) { delete m_logEntries.takeFirst(); } + while (!m_uavoEntries.isEmpty()) { + delete m_uavoEntries.takeFirst(); + } } void addLogEntries(QQmlListProperty *list, ExtendedDebugLogEntry *entry) @@ -377,6 +380,33 @@ void FlightLogManager::cancelExportLogs() m_cancelDownload = true; } +void FlightLogManager::loadSettings() +{ + +} + +void FlightLogManager::saveSettings() +{ + +} + +void FlightLogManager::resetSettings() +{ + foreach (UAVOLogSettingsWrapper *wrapper, m_uavoEntries) { + wrapper->setSetting(UAVOLogSettingsWrapper::DISABLED); + } +} + +void FlightLogManager::applySettingsToBoard() +{ + +} + +void FlightLogManager::saveSettingsToBoard() +{ + +} + void FlightLogManager::updateFlightEntries(quint16 currentFlight) { Q_UNUSED(currentFlight); @@ -408,8 +438,7 @@ void FlightLogManager::setupUAVOWrappers() void FlightLogManager::setupLogSettings() { - m_logSettings << tr("Disabled") << tr("When updated") << tr("Every 10ms") << tr("Every 50ms") << tr("Every 100ms") - << tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute"); + m_logSettings << tr("Disabled") << tr("When updated") << tr("Throttled") << tr("Periodically"); } void FlightLogManager::setupLogStatuses() @@ -495,7 +524,7 @@ UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVObject *object) : QObject(), - m_object(object), m_setting(DISABLED) + m_object(object), m_setting(DISABLED), m_period(0) {} UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 9589341d8..0a747fab1 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -46,10 +46,10 @@ class UAVOLogSettingsWrapper : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) + Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) public: - enum UAVLogSetting {DISABLED = 0, ON_CHANGE, EVERY_10MS, EVERY_50MS, EVERY_100MS, - EVERY_500MS, EVERY_1S, EVERY_5S, EVERY_10S, EVERY_30S, EVERY_1M}; + enum UAVLogSetting {DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY}; explicit UAVOLogSettingsWrapper(); explicit UAVOLogSettingsWrapper(UAVObject* object); @@ -65,22 +65,37 @@ public: return m_setting; } + int period() const + { + return m_period; + } + public slots: void setSetting(int setting) { - if (m_setting != (int)setting) { - m_setting = (int)setting; - emit settingChanged((int)setting); + if (m_setting != setting) { + m_setting = setting; + emit settingChanged(setting); + } + } + + void setPeriod(int arg) + { + if (m_period != arg) { + m_period = arg; + emit periodChanged(arg); } } signals: void settingChanged(int setting); - void nameChanged(); + void nameChanged(QString name); + void periodChanged(int period); private: UAVObject *m_object; int m_setting; + int m_period; }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -203,6 +218,11 @@ public slots: void retrieveLogs(int flightToRetrieve = -1); void exportLogs(); void cancelExportLogs(); + void loadSettings(); + void saveSettings(); + void resetSettings(); + void applySettingsToBoard(); + void saveSettingsToBoard(); void setDisableControls(bool arg) { From 7662cd75d285b2a9f69e2a6c56a696acbdc0200f Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 9 Mar 2014 10:06:47 +0100 Subject: [PATCH 036/131] OP-1257 No GCS Audio (Linux package) Libraries needed to play sound. --- ground/openpilotgcs/copydata.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index a877da775..b8f35a9bc 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -56,6 +56,10 @@ GCS_LIBRARY_PATH imageformats/libqmng.so \ imageformats/libqsvg.so \ imageformats/libqtiff.so \ + mediaservice/libgstaudiodecoder.so \ + mediaservice/libgstcamerabin.so \ + mediaservice/libgstmediacapture.so \ + mediaservice/libgstmediaplayer.so \ platforms/libqxcb.so \ sqldrivers/libqsqlite.so for(lib, QT_PLUGIN_LIBS) { From 4db48b7a5e6f759072952a1036eb07988ec7e19c Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 9 Mar 2014 10:41:21 +0100 Subject: [PATCH 037/131] OP-1245 Uncrustify --- .../src/plugins/flightlog/flightlogdialog.cpp | 2 +- .../plugins/flightlog/flightlogmanager.cpp | 42 +++++++++---------- .../src/plugins/flightlog/flightlogmanager.h | 26 ++++++------ .../src/plugins/uavobjects/uavobject.cpp | 2 +- .../src/plugins/uavobjects/uavobjectfield.cpp | 2 +- 5 files changed, 34 insertions(+), 40 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index 3c87d624c..8f411c45c 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -40,7 +40,7 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) : QDialog(parent) { - qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); + qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); qmlRegisterType("org.openpilot", 1, 0, "UAVOLogSettingsWrapper"); setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index b836d4813..e023e59e0 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -43,9 +43,10 @@ FlightLogManager::FlightLogManager(QObject *parent) : m_adjustExportedTimestamps(true) { ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); + Q_ASSERT(pluginManager); - m_objectManager = pluginManager->getObject(); + m_objectManager = pluginManager->getObject(); Q_ASSERT(m_objectManager); m_telemtryManager = pluginManager->getObject(); @@ -62,7 +63,7 @@ FlightLogManager::FlightLogManager(QObject *parent) : Q_ASSERT(m_flightLogStatus); connect(m_flightLogStatus, SIGNAL(FlightChanged(quint16)), this, SLOT(updateFlightEntries(quint16))); - m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager); + m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager); Q_ASSERT(m_flightLogEntry); m_flightLogSettings = DebugLogSettings::GetInstance(m_objectManager); @@ -287,13 +288,14 @@ void FlightLogManager::exportToOPL(QString fileName) void FlightLogManager::exportToCSV(QString fileName) { QFile csvFile(fileName); + if (csvFile.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream csvStream(&csvFile); quint32 baseTime = 0; quint32 currentFlight = 0; csvStream << "Flight" << '\t' << "Flight Time" << '\t' << "Entry" << '\t' << "Data" << '\n'; - foreach (ExtendedDebugLogEntry *entry , m_logEntries) { - if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + foreach(ExtendedDebugLogEntry * entry, m_logEntries) { + if (m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { currentFlight = entry->getFlight(); baseTime = entry->getFlightTime(); } @@ -308,8 +310,8 @@ void FlightLogManager::exportToCSV(QString fileName) void FlightLogManager::exportToXML(QString fileName) { QFile xmlFile(fileName); - if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { + if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { QXmlStreamWriter xmlWriter(&xmlFile); xmlWriter.setAutoFormatting(true); xmlWriter.setAutoFormattingIndent(4); @@ -320,8 +322,8 @@ void FlightLogManager::exportToXML(QString fileName) quint32 baseTime = 0; quint32 currentFlight = 0; - foreach (ExtendedDebugLogEntry *entry , m_logEntries) { - if(m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { + foreach(ExtendedDebugLogEntry * entry, m_logEntries) { + if (m_adjustExportedTimestamps && entry->getFlight() != currentFlight) { currentFlight = entry->getFlight(); baseTime = entry->getFlightTime(); } @@ -381,31 +383,23 @@ void FlightLogManager::cancelExportLogs() } void FlightLogManager::loadSettings() -{ - -} +{} void FlightLogManager::saveSettings() -{ - -} +{} void FlightLogManager::resetSettings() { - foreach (UAVOLogSettingsWrapper *wrapper, m_uavoEntries) { + foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { wrapper->setSetting(UAVOLogSettingsWrapper::DISABLED); } } void FlightLogManager::applySettingsToBoard() -{ - -} +{} void FlightLogManager::saveSettingsToBoard() -{ - -} +{} void FlightLogManager::updateFlightEntries(quint16 currentFlight) { @@ -426,8 +420,9 @@ void FlightLogManager::updateFlightEntries(quint16 currentFlight) void FlightLogManager::setupUAVOWrappers() { - foreach(QList objectList , m_objectManager->getObjects()) { - UAVObject* object = objectList.at(0); + foreach(QList objectList, m_objectManager->getObjects()) { + UAVObject *object = objectList.at(0); + if (!object->isMetaDataObject() && !object->isSettingsObject()) { m_uavoEntries.append(new UAVOLogSettingsWrapper(object)); qDebug() << objectList.at(0)->getName(); @@ -493,12 +488,13 @@ void ExtendedDebugLogEntry::toXML(QXmlStreamWriter *xmlWriter, quint32 baseTime) xmlWriter->writeAttribute("type", "uavobject"); m_object->toXML(xmlWriter); } - xmlWriter->writeEndElement(); //entry + xmlWriter->writeEndElement(); // entry } void ExtendedDebugLogEntry::toCSV(QTextStream *csvStream, quint32 baseTime) { QString data; + if (getType() == DebugLogEntry::TYPE_TEXT) { data = QString((const char *)getData().Data); } else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 0a747fab1..a8f91514e 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -43,16 +43,15 @@ #include "uavtalk/telemetrymanager.h" class UAVOLogSettingsWrapper : public QObject { - Q_OBJECT - Q_PROPERTY(QString name READ name NOTIFY nameChanged) + Q_OBJECT Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) public: - enum UAVLogSetting {DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY}; + enum UAVLogSetting { DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY }; explicit UAVOLogSettingsWrapper(); - explicit UAVOLogSettingsWrapper(UAVObject* object); + explicit UAVOLogSettingsWrapper(UAVObject *object); ~UAVOLogSettingsWrapper(); QString name() const @@ -99,8 +98,7 @@ private: }; class ExtendedDebugLogEntry : public DebugLogEntry { - Q_OBJECT - Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated) + Q_OBJECT Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated) public: explicit ExtendedDebugLogEntry(); @@ -130,10 +128,9 @@ private: }; class FlightLogManager : public QObject { - Q_OBJECT - Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus) - Q_PROPERTY(DebugLogControl *flightLogControl READ flightLogControl) - Q_PROPERTY(DebugLogSettings *flightLogSettings READ flightLogSettings) + Q_OBJECT Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus) + Q_PROPERTY(DebugLogControl * flightLogControl READ flightLogControl) + Q_PROPERTY(DebugLogSettings * flightLogSettings READ flightLogSettings) Q_PROPERTY(QQmlListProperty logEntries READ logEntries NOTIFY logEntriesChanged) Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged) Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged) @@ -155,7 +152,8 @@ public: QStringList flightEntries(); - QStringList logSettings() { + QStringList logSettings() + { return m_logSettings; } @@ -191,12 +189,12 @@ public: return m_logStatuses; } - DebugLogControl * flightLogControl() const + DebugLogControl *flightLogControl() const { return m_flightLogControl; } - DebugLogSettings * flightLogSettings() const + DebugLogSettings *flightLogSettings() const { return m_flightLogSettings; } @@ -269,7 +267,7 @@ private: DebugLogControl *m_flightLogControl; DebugLogStatus *m_flightLogStatus; DebugLogEntry *m_flightLogEntry; - DebugLogSettings * m_flightLogSettings; + DebugLogSettings *m_flightLogSettings; QList m_logEntries; QStringList m_flightEntries; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index ebbfe1292..8dc5754e2 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -525,7 +525,7 @@ void UAVObject::toXML(QXmlStreamWriter *xmlWriter) xmlWriter->writeAttribute("name", getName()); xmlWriter->writeAttribute("id", QString("%1-%2").arg(getObjID(), 1, 16).toUpper().arg(getInstID())); xmlWriter->writeStartElement("fields"); - foreach(UAVObjectField* field , fields) { + foreach(UAVObjectField * field, fields) { field->toXML(xmlWriter); } xmlWriter->writeEndElement(); // fields diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index 19ea0a563..235448a57 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -664,7 +664,7 @@ void UAVObjectField::toXML(QXmlStreamWriter *xmlWriter) } for (unsigned int n = 0; n < numElements; ++n) { xmlWriter->writeStartElement("value"); - if(getElementNames().size() > 1) { + if (getElementNames().size() > 1) { xmlWriter->writeAttribute("name", getElementNames().at(n)); } xmlWriter->writeCharacters(getValue(n).toString()); From 171abbb11191bdd029d67bf6b4f507d7d9a48079 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 9 Mar 2014 10:53:28 +0100 Subject: [PATCH 038/131] OP-1245 Cleaned up after a bad merge. --- ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index f2aa6a2d7..a8f91514e 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -286,10 +286,6 @@ private: bool m_cancelDownload; bool m_adjustExportedTimestamps; bool m_boardConnected; - - void exportToOPL(QString fileName); - void exportToCSV(QString fileName); - void exportToXML(QString fileName); }; #endif // FLIGHTLOGMANAGER_H From 41865d5e7894793c97a636352a9f0e4e8631e6c9 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 9 Mar 2014 13:15:17 +0100 Subject: [PATCH 039/131] OP-1245 Added functionality to save settings as xml file. --- .../src/plugins/flightlog/FlightLogDialog.qml | 5 ++- .../plugins/flightlog/flightlogmanager.cpp | 34 ++++++++++++++++++- .../src/plugins/flightlog/flightlogmanager.h | 29 ++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 47cf5317d..ceec842ff 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -187,7 +187,10 @@ Rectangle { ComboBox { enabled: !logManager.disableControls && logManager.boardConnected model: logManager.logStatuses - currentIndex: logSettings.getLoggingEnabled() + currentIndex: logSettings.loggingEnabled + onCurrentIndexChanged: { + logManager.setLoggingEnabled(currentIndex); + } } } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index e023e59e0..28bc24e16 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -386,7 +386,39 @@ void FlightLogManager::loadSettings() {} void FlightLogManager::saveSettings() -{} +{ + QString xmlFilter = tr("XML file %1").arg("(*.xml)"); + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Settings"), + QString("OP-FlightLogSettings"), QString("%1").arg(xmlFilter)); + if (!fileName.isEmpty()) { + if (!fileName.endsWith(".xml")) { + fileName.append(".xml"); + } + QFile xmlFile(fileName); + + if (xmlFile.open(QFile::WriteOnly | QFile::Truncate)) { + QXmlStreamWriter xmlWriter(&xmlFile); + xmlWriter.setAutoFormatting(true); + xmlWriter.setAutoFormattingIndent(4); + + xmlWriter.writeStartDocument("1.0", true); + xmlWriter.writeComment("This file was created by the flight log settings function in OpenPilot GCS."); + xmlWriter.writeStartElement("settings"); + xmlWriter.writeAttribute("enabled", QString::number(m_loggingEnabled)); + foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { + xmlWriter.writeStartElement("setting"); + xmlWriter.writeAttribute("name", wrapper->name()); + xmlWriter.writeAttribute("level", QString::number(wrapper->setting())); + xmlWriter.writeAttribute("period", QString::number(wrapper->period())); + xmlWriter.writeEndElement(); + } + xmlWriter.writeEndElement(); + xmlWriter.writeEndDocument(); + xmlFile.flush(); + xmlFile.close(); + } + } +} void FlightLogManager::resetSettings() { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index a8f91514e..91c6edea4 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -43,7 +43,9 @@ #include "uavtalk/telemetrymanager.h" class UAVOLogSettingsWrapper : public QObject { - Q_OBJECT Q_PROPERTY(QString name READ name NOTIFY nameChanged) + Q_OBJECT + Q_PROPERTY(UAVObject *object READ object NOTIFY objectChanged) + Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) @@ -69,6 +71,11 @@ public: return m_period; } + UAVObject *object() const + { + return m_object; + } + public slots: void setSetting(int setting) { @@ -89,7 +96,8 @@ public slots: signals: void settingChanged(int setting); void nameChanged(QString name); - void periodChanged(int period); + void periodChanged(int period); + void objectChanged(UAVObject * arg); private: UAVObject *m_object; @@ -141,6 +149,7 @@ class FlightLogManager : public QObject { Q_PROPERTY(QQmlListProperty uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged) Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged) Q_PROPERTY(QStringList logStatuses READ logStatuses NOTIFY logStatusesChanged) + Q_PROPERTY(int loggingEnabled READ loggingEnabled WRITE setLoggingEnabled NOTIFY loggingEnabledChanged) public: @@ -199,6 +208,11 @@ public: return m_flightLogSettings; } + int loggingEnabled() const + { + return m_loggingEnabled; + } + signals: void logEntriesChanged(); void flightEntriesChanged(); @@ -211,6 +225,8 @@ signals: void logStatusesChanged(QStringList arg); + void loggingEnabledChanged(int arg); + public slots: void clearAllLogs(); void retrieveLogs(int flightToRetrieve = -1); @@ -254,6 +270,14 @@ public slots: } } + void setLoggingEnabled(int arg) + { + if (m_loggingEnabled != arg) { + m_loggingEnabled = arg; + emit loggingEnabledChanged(arg); + } + } + private slots: void updateFlightEntries(quint16 currentFlight); void setupUAVOWrappers(); @@ -286,6 +310,7 @@ private: bool m_cancelDownload; bool m_adjustExportedTimestamps; bool m_boardConnected; + int m_loggingEnabled; }; #endif // FLIGHTLOGMANAGER_H From 2f097ab20bc5beae897e73d4a669c761d92f892f Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 9 Mar 2014 19:18:09 +0100 Subject: [PATCH 040/131] OP-1257 No GCS Audio (Linux package) Only one library is needed (mediaservice/libgstmediaplayer.so) --- ground/openpilotgcs/copydata.pro | 3 --- 1 file changed, 3 deletions(-) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index b8f35a9bc..aad939fbf 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -56,9 +56,6 @@ GCS_LIBRARY_PATH imageformats/libqmng.so \ imageformats/libqsvg.so \ imageformats/libqtiff.so \ - mediaservice/libgstaudiodecoder.so \ - mediaservice/libgstcamerabin.so \ - mediaservice/libgstmediacapture.so \ mediaservice/libgstmediaplayer.so \ platforms/libqxcb.so \ sqldrivers/libqsqlite.so From 44905fc0a947c52b3698d58f7f3731638fcbed82 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 9 Mar 2014 21:33:50 +0100 Subject: [PATCH 041/131] OP-1257 No GCS Audio (Linux package) QT5 dependencies : libqgsttools_p.so.1 --- ground/openpilotgcs/copydata.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index aad939fbf..ab574ab29 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -33,7 +33,8 @@ GCS_LIBRARY_PATH libQt5QuickParticles.so.5 \ libicui18n.so.51 \ libicuuc.so.51 \ - libicudata.so.51 + libicudata.so.51 \ + libqgsttools_p.so.1 data_copy.commands += -@$(MKDIR) $$targetPath(\"$$GCS_QT_LIBRARY_PATH\") $$addNewline() for(lib, QT_LIBS) { From 03df524e8331a70c573ae7b618a94acdff6439f8 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 9 Mar 2014 23:31:08 +0100 Subject: [PATCH 042/131] OP-1257 No GCS Audio (Linux package) added mediaservice/libgstaudiodecoder.so --- ground/openpilotgcs/copydata.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index ab574ab29..2b5980d7e 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -57,6 +57,7 @@ GCS_LIBRARY_PATH imageformats/libqmng.so \ imageformats/libqsvg.so \ imageformats/libqtiff.so \ + mediaservice/libgstaudiodecoder.so \ mediaservice/libgstmediaplayer.so \ platforms/libqxcb.so \ sqldrivers/libqsqlite.so From 9622358149a04cabec59bf0537187b222cbc0689 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Wed, 12 Mar 2014 20:51:19 +0100 Subject: [PATCH 043/131] OP-1250 Add Gps Protocol configuration --- .../src/plugins/config/cc_hw_settings.ui | 60 ++-- .../plugins/config/config_cc_hw_widget.cpp | 4 + .../src/plugins/config/configrevohwwidget.cpp | 23 ++ .../src/plugins/config/configrevohwwidget.ui | 329 ++++++++++-------- 4 files changed, 250 insertions(+), 166 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui b/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui index a5d9d9a83..a96e1f7a6 100644 --- a/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui +++ b/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui @@ -116,8 +116,8 @@ 0 0 - 624 - 516 + 622 + 519 @@ -227,14 +227,14 @@ - - - - Telemetry speed: + + + + Select the speed here. - + @@ -247,7 +247,28 @@ - + + + + Telemetry speed: + + + + + + + Select the speed here. + + + + + + + Select the speed here. + + + + @@ -260,26 +281,15 @@ - - - - Select the speed here. + + + + GPS protocol : - - - - Select the speed here. - - - - - - - Select the speed here. - - + + diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index 03a39355b..56b39b034 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -82,6 +82,10 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) addWidgetBinding("HwSettings", "USB_VCPPort", m_telemetry->cbUsbVcp); addWidgetBinding("HwSettings", "TelemetrySpeed", m_telemetry->telemetrySpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed); + /* OP-1250 : Add Gps protocol configuration to HwSettings --------------- */ + addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol); + /* OP-1250 : ending ----------------------------------------------------- */ + addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed); connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); enableSaveButtons(false); diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp index 54a0928fb..fa336e215 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp @@ -65,6 +65,11 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbMainGPSSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); + /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); + addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol); + /* OP-1250 : ending ---------------------------------------------------------- */ + connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); setupCustomCombos(); @@ -191,6 +196,11 @@ void ConfigRevoHWWidget::flexiPortChanged(int index) m_ui->cbFlexiComSpeed->setVisible(false); m_ui->lblFlexiSpeed->setVisible(true); + /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + m_ui->cbFlexiGPSProtocol->setVisible(false); + m_ui->lbFlexiGPSProtocol->setVisible(false); + /* OP-1250 : ending ---------------------------------------------------------- */ + switch (m_ui->cbFlexi->currentIndex()) { case HwSettings::RM_FLEXIPORT_TELEMETRY: m_ui->cbFlexiTelemSpeed->setVisible(true); @@ -199,6 +209,10 @@ void ConfigRevoHWWidget::flexiPortChanged(int index) } break; case HwSettings::RM_FLEXIPORT_GPS: + /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + m_ui->cbFlexiGPSProtocol->setVisible(true); + m_ui->lbFlexiGPSProtocol->setVisible(true); + /* OP-1250 : ending ---------------------------------------------------------- */ m_ui->cbFlexiGPSSpeed->setVisible(true); if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); @@ -234,6 +248,11 @@ void ConfigRevoHWWidget::mainPortChanged(int index) m_ui->cbMainComSpeed->setVisible(false); m_ui->lblMainSpeed->setVisible(true); + /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + m_ui->cbMainGPSProtocol->setVisible(false); + m_ui->lbMainGPSProtocol->setVisible(false); + /* OP-1250 : ending ---------------------------------------------------------- */ + switch (m_ui->cbMain->currentIndex()) { case HwSettings::RM_MAINPORT_TELEMETRY: m_ui->cbMainTelemSpeed->setVisible(true); @@ -242,6 +261,10 @@ void ConfigRevoHWWidget::mainPortChanged(int index) } break; case HwSettings::RM_MAINPORT_GPS: + /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + m_ui->cbMainGPSProtocol->setVisible(true); + m_ui->lbMainGPSProtocol->setVisible(true); + /* OP-1250 : ending ---------------------------------------------------------- */ m_ui->cbMainGPSSpeed->setVisible(true); if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS) { m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui index 6bd908f1e..71fe01a23 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.ui @@ -27,7 +27,16 @@ HW settings - + + 0 + + + 0 + + + 0 + + 0 @@ -113,16 +122,117 @@ 0 0 - 818 - 673 + 810 + 665 - + 12 + + 12 + + + 12 + + + 12 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 75 + true + + + + Changes on this page only take effect after board reset or power cycle + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + - + @@ -155,27 +265,7 @@ - - - - 0 - - - - - true - - - - - - - - - - - - + Qt::Horizontal @@ -191,13 +281,13 @@ - - + + - Speed + Protocol - Qt::AlignBottom|Qt::AlignHCenter + Qt::AlignCenter @@ -232,10 +322,46 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + 0 + + + + + true + + + + + + + + + + + - + Qt::Horizontal @@ -271,22 +397,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - @@ -471,7 +581,7 @@ - + Qt::Horizontal @@ -551,7 +661,7 @@ - + Qt::Horizontal @@ -564,100 +674,37 @@ + + + + Speed + + + Qt::AlignBottom|Qt::AlignHCenter + + + + + + + Protocol + + + Qt::PlainText + + + Qt::AlignCenter + + + + + + + + + - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 75 - true - - - - Changes on this page only take effect after board reset or power cycle - - - Qt::AlignCenter - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 10 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - From bee59c58d3ff9631e01fbbae6c2d48ab923a4941 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Thu, 13 Mar 2014 21:24:31 +0100 Subject: [PATCH 044/131] OP-1250 Add GPS protocol configuration (with minor corrections) --- .../src/plugins/config/config_cc_hw_widget.cpp | 3 +-- .../src/plugins/config/configrevohwwidget.cpp | 17 +++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index 56b39b034..7256861ac 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -82,9 +82,8 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) addWidgetBinding("HwSettings", "USB_VCPPort", m_telemetry->cbUsbVcp); addWidgetBinding("HwSettings", "TelemetrySpeed", m_telemetry->telemetrySpeed); addWidgetBinding("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed); - /* OP-1250 : Add Gps protocol configuration to HwSettings --------------- */ + // Add Gps protocol configuration addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol); - /* OP-1250 : ending ----------------------------------------------------- */ addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed); connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp index fa336e215..8ddcf7b4d 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp @@ -65,10 +65,9 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbMainGPSSpeed); addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_ui->cbMainComSpeed); - /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + // Add Gps protocol configuration addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol); addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol); - /* OP-1250 : ending ---------------------------------------------------------- */ connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp())); @@ -196,10 +195,9 @@ void ConfigRevoHWWidget::flexiPortChanged(int index) m_ui->cbFlexiComSpeed->setVisible(false); m_ui->lblFlexiSpeed->setVisible(true); - /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + // Add Gps protocol configuration m_ui->cbFlexiGPSProtocol->setVisible(false); m_ui->lbFlexiGPSProtocol->setVisible(false); - /* OP-1250 : ending ---------------------------------------------------------- */ switch (m_ui->cbFlexi->currentIndex()) { case HwSettings::RM_FLEXIPORT_TELEMETRY: @@ -209,10 +207,10 @@ void ConfigRevoHWWidget::flexiPortChanged(int index) } break; case HwSettings::RM_FLEXIPORT_GPS: - /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + // Add Gps protocol configuration m_ui->cbFlexiGPSProtocol->setVisible(true); m_ui->lbFlexiGPSProtocol->setVisible(true); - /* OP-1250 : ending ---------------------------------------------------------- */ + m_ui->cbFlexiGPSSpeed->setVisible(true); if (m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_GPS) { m_ui->cbMain->setCurrentIndex(HwSettings::RM_MAINPORT_DISABLED); @@ -248,10 +246,9 @@ void ConfigRevoHWWidget::mainPortChanged(int index) m_ui->cbMainComSpeed->setVisible(false); m_ui->lblMainSpeed->setVisible(true); - /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + // Add Gps protocol configuration m_ui->cbMainGPSProtocol->setVisible(false); m_ui->lbMainGPSProtocol->setVisible(false); - /* OP-1250 : ending ---------------------------------------------------------- */ switch (m_ui->cbMain->currentIndex()) { case HwSettings::RM_MAINPORT_TELEMETRY: @@ -261,10 +258,10 @@ void ConfigRevoHWWidget::mainPortChanged(int index) } break; case HwSettings::RM_MAINPORT_GPS: - /* OP-1250 : Add Gps protocol configuration ---------------------------------- */ + // Add Gps protocol configuration m_ui->cbMainGPSProtocol->setVisible(true); m_ui->lbMainGPSProtocol->setVisible(true); - /* OP-1250 : ending ---------------------------------------------------------- */ + m_ui->cbMainGPSSpeed->setVisible(true); if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_GPS) { m_ui->cbFlexi->setCurrentIndex(HwSettings::RM_FLEXIPORT_DISABLED); From 1dae98a378be63bee59d5954fe8208b1c604594e Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 15 Mar 2014 13:57:28 +0100 Subject: [PATCH 045/131] OP-1245 Added code to load settings from xml file. --- .../plugins/flightlog/flightlogmanager.cpp | 82 +++++++++++++++++-- .../src/plugins/flightlog/flightlogmanager.h | 4 + 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 28bc24e16..92a78dd34 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -30,6 +30,9 @@ #include #include +#include +#include +#include #include "debuglogcontrol.h" #include "uavobjecthelper.h" @@ -351,8 +354,7 @@ void FlightLogManager::exportLogs() QString selectedFilter = csvFilter; - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Entries"), - QString("OP-%1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")), + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Entries"), QDir::homePath(), QString("%1;;%2;;%3").arg(oplFilter, csvFilter, xmlFilter), &selectedFilter); if (!fileName.isEmpty()) { if (selectedFilter == oplFilter) { @@ -383,13 +385,68 @@ void FlightLogManager::cancelExportLogs() } void FlightLogManager::loadSettings() -{} +{ + QString xmlFilter = tr("XML file %1").arg("(*.xml)"); + QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load Log Settings"), QDir::homePath(), QString("%1").arg(xmlFilter)); + if (!fileName.isEmpty()) { + if (!fileName.endsWith(".xml")) { + fileName.append(".xml"); + } + QFile xmlFile(fileName); + QString errorString; + if (xmlFile.open(QFile::ReadOnly)) { + QXmlStreamReader xmlReader(&xmlFile); + while (xmlReader.readNextStartElement() && xmlReader.name() == "settings") { + bool ok; + + int version = xmlReader.attributes().value("version").toInt(&ok); + if (!ok || version != LOG_SETTINGS_FILE_VERSION) { + errorString = tr("The file has the wrong version or could not parse version information."); + break; + } + + setLoggingEnabled(xmlReader.attributes().value("enabled").toInt(&ok)); + if (!ok) { + errorString = tr("Could not parse enabled attribute."); + break; + } + + while (xmlReader.readNextStartElement()) { + if (xmlReader.name() == "setting") { + QString name = xmlReader.attributes().value("name").toString(); + int level = xmlReader.attributes().value("level").toInt(&ok); + if (ok) { + int period = xmlReader.attributes().value("period").toInt(&ok); + if (ok && updateLogWrapper(name, level, period)) { + } else { + errorString = tr("Could not parse period attribute, or object with name '%1' could not be found.").arg(name); + break; + } + } else { + errorString = tr("Could not parse level attribute on setting '%1'").arg(name); + break; + } + } + xmlReader.skipCurrentElement(); + } + xmlReader.skipCurrentElement(); + } + if (!xmlReader.atEnd() && (xmlReader.hasError() || !errorString.isEmpty())) { + QMessageBox::warning(NULL, tr("Settings file corrupt."), + tr("The file loaded is not in the correct format.\nPlease check the file.\n%1") + .arg(xmlReader.hasError() ? xmlReader.errorString() : errorString), + QMessageBox::Ok); + } + } + xmlFile.close(); + } +} void FlightLogManager::saveSettings() { QString xmlFilter = tr("XML file %1").arg("(*.xml)"); QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Settings"), - QString("OP-FlightLogSettings"), QString("%1").arg(xmlFilter)); + QDir::homePath(), QString("%1").arg(xmlFilter)); if (!fileName.isEmpty()) { if (!fileName.endsWith(".xml")) { fileName.append(".xml"); @@ -404,6 +461,7 @@ void FlightLogManager::saveSettings() xmlWriter.writeStartDocument("1.0", true); xmlWriter.writeComment("This file was created by the flight log settings function in OpenPilot GCS."); xmlWriter.writeStartElement("settings"); + xmlWriter.writeAttribute("version", QString::number(LOG_SETTINGS_FILE_VERSION)); xmlWriter.writeAttribute("enabled", QString::number(m_loggingEnabled)); foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { xmlWriter.writeStartElement("setting"); @@ -456,7 +514,9 @@ void FlightLogManager::setupUAVOWrappers() UAVObject *object = objectList.at(0); if (!object->isMetaDataObject() && !object->isSettingsObject()) { - m_uavoEntries.append(new UAVOLogSettingsWrapper(object)); + UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(object); + m_uavoEntries.append(wrapper); + m_uavoEntriesHash[wrapper->name()] = wrapper; qDebug() << objectList.at(0)->getName(); } } @@ -484,6 +544,18 @@ void FlightLogManager::connectionStatusChanged() } } +bool FlightLogManager::updateLogWrapper(QString name, int level, int period) +{ + UAVOLogSettingsWrapper *wrapper = m_uavoEntriesHash[name]; + if (wrapper) { + wrapper->setSetting(level); + wrapper->setPeriod(period); + qDebug() << "Wrapper" << name << ", level" << level << ", period" << period; + return true; + } + return false; +} + ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(), m_object(0) {} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 91c6edea4..3c4070a53 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -284,6 +285,7 @@ private slots: void setupLogSettings(); void setupLogStatuses(); void connectionStatusChanged(); + bool updateLogWrapper(QString name, int level, int period); private: UAVObjectManager *m_objectManager; @@ -299,12 +301,14 @@ private: QStringList m_logStatuses; QList m_uavoEntries; + QHash m_uavoEntriesHash; void exportToOPL(QString fileName); void exportToCSV(QString fileName); void exportToXML(QString fileName); static const int UAVTALK_TIMEOUT = 4000; + static const int LOG_SETTINGS_FILE_VERSION = 1; bool m_disableControls; bool m_disableExport; bool m_cancelDownload; From 2ee3780d0815ff2e4179e00dcaa711232728fe74 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 17 Mar 2014 20:43:38 +0100 Subject: [PATCH 046/131] OP-1263 SDL is now downloaded and installed independently and is not added to Qt anymore --- ground/openpilotgcs/copydata.pro | 10 +--- .../src/libs/sdlgamepad/copydata.pro | 18 +++++++ .../src/libs/sdlgamepad/sdlgamepad.pri | 15 ++++++ .../src/libs/sdlgamepad/sdlgamepad.pro | 49 ++++++++++--------- .../src/plugins/gcscontrol/gcscontrol.pro | 11 ----- make/tools.mk | 27 +++++++++- 6 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 55cdda068..6779190f5 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -113,10 +113,8 @@ GCS_LIBRARY_PATH data_copy.target = FORCE QMAKE_EXTRA_TARGETS += data_copy } - # Windows release only, no debug target DLLs ending with 'd' - # It is assumed that SDL.dll can be found in the same directory as mingw32-make.exe - win32 { + win32 { # set debug suffix if needed CONFIG(debug, debug|release):DS = "d" @@ -227,12 +225,6 @@ GCS_LIBRARY_PATH data_copy.commands += $(COPY_FILE) $$targetPath(\"$$[QT_INSTALL_QML]/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() } - # copy MinGW DLLs - MINGW_DLLS = SDL.dll - for(dll, MINGW_DLLS) { - data_copy.commands += $(COPY_FILE) $$targetPath(\"$$(QTMINGW)/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() - } - # copy OpenSSL DLLs OPENSSL_DLLS = \ ssleay32.dll \ diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro new file mode 100644 index 000000000..1f99c0a48 --- /dev/null +++ b/ground/openpilotgcs/src/libs/sdlgamepad/copydata.pro @@ -0,0 +1,18 @@ +equals(copydata, 1) { + + win32 { + # copy SDL DLL + SDL_DLLS = \ + SDL.dll + for(dll, SDL_DLLS) { + data_copy.commands += $(COPY_FILE) $$targetPath(\"$$(SDL_DIR)/bin/$$dll\") $$targetPath(\"$$GCS_APP_PATH/$$dll\") $$addNewline() + } + + # add make target + POST_TARGETDEPS += copydata + + data_copy.target = copydata + QMAKE_EXTRA_TARGETS += data_copy + } + +} diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri index a5d13203c..2e6add4fa 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri @@ -1 +1,16 @@ +macx { + # Ensures that SDL framework and header files are found when compiled with Qt5.1.1 + INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers + SDL = -F/Library/Frameworks + # Add SDL to CFLAGS fixes build problems on mac + QMAKE_CFLAGS += $$SDL + QMAKE_CXXFLAGS += $$SDL + # Let the linker know where to find the frameworks + LIBS += $$SDL +} + +win32 { + INCLUDEPATH += $(SDL_DIR)/include +} + LIBS *= -l$$qtLibraryName(sdlgamepad) diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro index 44e954565..7c18fd114 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro @@ -18,30 +18,35 @@ # mail.nalla@gmail.com # -TEMPLATE = lib -TARGET = sdlgamepad -DEFINES += SDLGAMEPAD_LIBRARY -macx { - # Workaround to ensure that SDL framework and associated header files are found - INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - SDL = -F/Library/Frameworks - # Add SDL to CFLAGS fixes build problems on mac - QMAKE_CFLAGS += $$SDL - QMAKE_CXXFLAGS += $$SDL - # Let the linker know where to find the frameworks - LIBS += $$SDL -} +TEMPLATE = lib +TARGET = sdlgamepad +DEFINES += SDLGAMEPAD_LIBRARY include(../../openpilotgcslibrary.pri) +include(../../sdlgamepad.pri) -SOURCES += sdlgamepad.cpp -HEADERS += sdlgamepad.h \ - sdlgamepad_global.h +macx { + # Let the linker know where to find the frameworks + LIBS += -framework OpenGL -framework SDL -framework Cocoa +} -macx:LIBS += -framework OpenGL -framework SDL -framework Cocoa -!macx:LIBS += -lSDL +win32 { + LIBS += -L$(SDL_DIR)/lib +} -OTHER_FILES += COPYING \ - README \ - sdlgamepad.dox \ - sdlgamepad.doc +!mac:LIBS += -lSDL + +SOURCES += \ + sdlgamepad.cpp + +HEADERS += \ + sdlgamepad.h \ + sdlgamepad_global.h + +OTHER_FILES += \ + COPYING \ + README \ + sdlgamepad.dox \ + sdlgamepad.doc + +include(copydata.pro) diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro index be6c80eae..b8d8f1450 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro @@ -9,17 +9,6 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/uavobjects/uavobjects.pri) include(../../libs/sdlgamepad/sdlgamepad.pri) -macx { - # Ensures that SDL framework and header files are found when compiled with Qt5.1.1 - INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - SDL = -F/Library/Frameworks - # Add SDL to CFLAGS fixes build problems on mac - QMAKE_CFLAGS += $$SDL - QMAKE_CXXFLAGS += $$SDL - # Let the linker know where to find the frameworks - LIBS += $$SDL -} - HEADERS += gcscontrolgadget.h \ gcscontrolgadgetconfiguration.h \ diff --git a/make/tools.mk b/make/tools.mk index d0fbcad20..977c6bf3c 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -78,6 +78,7 @@ else ifeq ($(UNAME), Windows) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-windows.tar.bz2 QT_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-5.1.1-windows.tar.bz2 NSIS_URL := http://wiki.openpilot.org/download/attachments/18612236/nsis-2.46-unicode.tar.bz2 + SDL_URL := http://wiki.openpilot.org/download/attachments/18612236/SDL-devel-1.2.15-mingw32.tar.gz OPENSSL_URL := http://wiki.openpilot.org/download/attachments/18612236/openssl-1.0.1e-win32.tar.bz2 UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60-windows.tar.bz2 DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2 @@ -91,6 +92,7 @@ QT_SDK_DIR := $(TOOLS_DIR)/qt-5.2.1 MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw48_32 PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw48_32/opt/bin NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode +SDL_DIR := $(TOOLS_DIR)/SDL-1.2.15 OPENSSL_DIR := $(TOOLS_DIR)/openssl-1.0.1e-win32 UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60 DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1 @@ -106,7 +108,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR) BUILD_SDK_TARGETS := arm_sdk qt_sdk ifeq ($(UNAME), Windows) - BUILD_SDK_TARGETS += mingw python nsis openssl + BUILD_SDK_TARGETS += mingw sdl python nsis openssl endif ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen @@ -401,7 +403,6 @@ endef # # Qt SDK # -# Windows: native binary package has been provided # Mac OS X: user should install native Qt SDK package # ############################## @@ -555,6 +556,28 @@ nsis_version: endif +############################## +# +# SDL (Windows only) +# +############################## + +ifeq ($(UNAME), Windows) + +$(eval $(call TOOL_INSTALL_TEMPLATE,sdl,$(SDL_DIR),$(SDL_URL),$(notdir $(SDL_URL)))) + +ifeq ($(shell [ -d "$(SDL_DIR)" ] && $(ECHO) "exists"), exists) + export SDL_DIR := $(SDL_DIR) +else + # not installed, hope it's in the path... + $(info $(EMPTY) WARNING $(call toprel, $(SDL_DIR)) not found (make sdl_install), using system PATH) +endif + +.PHONY: sdl_version +sdl_version: + -$(V1) $(ECHO) "SDL 1.2.15 $(SDL_DIR)" +endif + ############################## # # OpenSSL (Windows only) From 2903fb9ea784fb9b4db7b262dbe70f35444c9ae7 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 17 Mar 2014 20:44:00 +0100 Subject: [PATCH 047/131] OP-1263 cleaned up gcscontrol.pro --- .../src/plugins/gcscontrol/gcscontrol.pro | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro index b8d8f1450..3603aaa31 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro @@ -1,34 +1,35 @@ TEMPLATE = lib -TARGET = GCSControl -QT += svg -QT += opengl -QT += network +TARGET = GCSControl -include(../../openpilotgcsplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) +QT += svg opengl network + +include(../../openpilotgcsplugin.pri) +include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/uavobjects/uavobjects.pri) include(../../libs/sdlgamepad/sdlgamepad.pri) - -HEADERS += gcscontrolgadget.h \ +HEADERS += \ + gcscontrolgadget.h \ gcscontrolgadgetconfiguration.h \ - gcscontrolgadgetoptionspage.h -HEADERS += joystickcontrol.h -HEADERS += gcscontrolgadgetwidget.h -HEADERS += gcscontrolgadgetfactory.h -HEADERS += gcscontrolplugin.h + gcscontrolgadgetoptionspage.h \ + gcscontrolgadgetwidget.h \ + gcscontrolgadgetfactory.h \ + gcscontrolplugin.h \ + joystickcontrol.h -SOURCES += gcscontrolgadget.cpp \ +SOURCES += \ + gcscontrolgadget.cpp \ gcscontrolgadgetconfiguration.cpp \ - gcscontrolgadgetoptionspage.cpp -SOURCES += gcscontrolgadgetwidget.cpp -SOURCES += gcscontrolgadgetfactory.cpp -SOURCES += gcscontrolplugin.cpp -SOURCES += joystickcontrol.cpp + gcscontrolgadgetoptionspage.cpp \ + gcscontrolgadgetwidget.cpp \ + gcscontrolgadgetfactory.cpp \ + gcscontrolplugin.cpp \ + joystickcontrol.cpp OTHER_FILES += GCSControl.pluginspec -FORMS += gcscontrol.ui \ +FORMS += \ + gcscontrol.ui \ gcscontrolgadgetoptionspage.ui RESOURCES += gcscontrol.qrc From a327d490497c415f379930ca61e91bd89cf32ebc Mon Sep 17 00:00:00 2001 From: m_thread Date: Wed, 19 Mar 2014 17:08:33 +0100 Subject: [PATCH 048/131] OP-1245 Added code to read current log settings from uavos. --- .../src/plugins/flightlog/FlightLogDialog.qml | 18 ++++++-- .../plugins/flightlog/flightlogmanager.cpp | 45 ++++++++++++++----- .../src/plugins/flightlog/flightlogmanager.h | 34 +++++++++++--- .../src/plugins/uavobjects/uavobject.cpp | 20 +++++++++ .../src/plugins/uavobjects/uavobject.h | 2 + 5 files changed, 96 insertions(+), 23 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index ceec842ff..c328223b1 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -187,6 +187,7 @@ Rectangle { ComboBox { enabled: !logManager.disableControls && logManager.boardConnected model: logManager.logStatuses + Layout.preferredWidth: 200 currentIndex: logSettings.loggingEnabled onCurrentIndexChanged: { logManager.setLoggingEnabled(currentIndex); @@ -239,8 +240,9 @@ Rectangle { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter elide: styleData.elideMode - text: styleData.value !== undefined && (logManager.uavoEntries[styleData.row].setting > 1) ? - parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-" + text: styleData.value !== undefined && + (logManager.uavoEntries[styleData.row].setting === 1 || logManager.uavoEntries[styleData.row].setting === 3) ? + parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-" color: styleData.textColor //visible: !styleData.selected && (logManager.uavoEntries[styleData.row].setting <= 1) enabled: (logManager.uavoEntries[styleData.row].setting > 1) @@ -254,7 +256,8 @@ Rectangle { logManager.uavoEntries[styleData.row].period = loaderEditor.item.value } } - sourceComponent: styleData.selected && (logManager.uavoEntries[styleData.row].setting > 1) ? editor : null + sourceComponent: styleData.selected && + (logManager.uavoEntries[styleData.row].setting === 1 || logManager.uavoEntries[styleData.row].setting === 3) ? editor : null Component { id: editor SpinBox { @@ -292,6 +295,7 @@ Rectangle { Text { verticalAlignment: Text.AlignVCenter anchors.leftMargin: 5 + color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : "#000" text: styleData.value } @@ -331,7 +335,13 @@ Rectangle { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Reset") activeFocusOnPress: true - onClicked: logManager.resetSettings() + onClicked: logManager.resetSettings(false) + } + Button { + enabled: !logManager.disableControls && logManager.boardConnected + text: qsTr("Clear") + activeFocusOnPress: true + onClicked: logManager.resetSettings(true) } Rectangle { Layout.fillWidth: true diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 92a78dd34..3f8970f57 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -38,6 +38,7 @@ #include "uavobjecthelper.h" #include "uavtalk/uavtalk.h" #include "utils/logfile.h" +#include "uavdataobject.h" #include FlightLogManager::FlightLogManager(QObject *parent) : @@ -55,10 +56,6 @@ FlightLogManager::FlightLogManager(QObject *parent) : m_telemtryManager = pluginManager->getObject(); Q_ASSERT(m_telemtryManager); - connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged())); - connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged())); - connectionStatusChanged(); - m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); Q_ASSERT(m_flightLogControl); @@ -74,9 +71,12 @@ FlightLogManager::FlightLogManager(QObject *parent) : updateFlightEntries(m_flightLogStatus->getFlight()); - setupUAVOWrappers(); setupLogSettings(); setupLogStatuses(); + setupUAVOWrappers(); + + connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged())); + connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged())); } FlightLogManager::~FlightLogManager() @@ -478,10 +478,11 @@ void FlightLogManager::saveSettings() } } -void FlightLogManager::resetSettings() +void FlightLogManager::resetSettings(bool clear) { + setLoggingEnabled(clear ? 0 : m_flightLogSettings->getLoggingEnabled()); foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { - wrapper->setSetting(UAVOLogSettingsWrapper::DISABLED); + wrapper->reset(clear); } } @@ -514,7 +515,7 @@ void FlightLogManager::setupUAVOWrappers() UAVObject *object = objectList.at(0); if (!object->isMetaDataObject() && !object->isSettingsObject()) { - UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(object); + UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object)); m_uavoEntries.append(wrapper); m_uavoEntriesHash[wrapper->name()] = wrapper; qDebug() << objectList.at(0)->getName(); @@ -525,7 +526,15 @@ void FlightLogManager::setupUAVOWrappers() void FlightLogManager::setupLogSettings() { - m_logSettings << tr("Disabled") << tr("When updated") << tr("Throttled") << tr("Periodically"); + // Corresponds to: + // typedef enum { + // UPDATEMODE_MANUAL = 0, /** Manually update object, by calling the updated() function */ + // UPDATEMODE_PERIODIC = 1, /** Automatically update object at periodic intervals */ + // UPDATEMODE_ONCHANGE = 2, /** Only update object when its data changes */ + // UPDATEMODE_THROTTLED = 3 /** Object is updated on change, but not more often than the interval time */ + // } UpdateMode; + + m_logSettings << tr("Disabled") << tr("Periodically") << tr("When updated") << tr("Throttled"); } void FlightLogManager::setupLogStatuses() @@ -542,6 +551,9 @@ void FlightLogManager::connectionStatusChanged() } else { setBoardConnected(false); } + if(boardConnected()) { + resetSettings(false); + } } bool FlightLogManager::updateLogWrapper(QString name, int level, int period) @@ -623,9 +635,18 @@ void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVOb UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} -UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVObject *object) : QObject(), - m_object(object), m_setting(DISABLED), m_period(0) -{} +UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVDataObject *object) : QObject(), + m_object(object), m_setting(DISABLED), m_period(0), m_dirty(0) +{ + reset(false); +} UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() {} + +void UAVOLogSettingsWrapper::reset(bool clear) +{ + setSetting(clear ? 0 : m_object->GetLoggingUpdateMode(m_object->getMetadata())); + setPeriod(clear ? 0 : m_object->getMetadata().loggingUpdatePeriod); + setDirty(false); +} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 3c4070a53..19f7b5e12 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -45,16 +45,17 @@ class UAVOLogSettingsWrapper : public QObject { Q_OBJECT - Q_PROPERTY(UAVObject *object READ object NOTIFY objectChanged) + Q_PROPERTY(UAVDataObject *object READ object NOTIFY objectChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) + Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) public: enum UAVLogSetting { DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY }; explicit UAVOLogSettingsWrapper(); - explicit UAVOLogSettingsWrapper(UAVObject *object); + explicit UAVOLogSettingsWrapper(UAVDataObject *object); ~UAVOLogSettingsWrapper(); QString name() const @@ -72,16 +73,22 @@ public: return m_period; } - UAVObject *object() const + UAVDataObject *object() const { return m_object; } + bool dirty() const + { + return m_dirty; + } + public slots: void setSetting(int setting) { if (m_setting != setting) { m_setting = setting; + setDirty(true); emit settingChanged(setting); } } @@ -90,20 +97,34 @@ public slots: { if (m_period != arg) { m_period = arg; + setDirty(true); emit periodChanged(arg); } } + void setDirty(bool arg) + { + if (m_dirty != arg) { + m_dirty = arg; + emit dirtyChanged(arg); + } + } + + void reset(bool clear); + signals: void settingChanged(int setting); void nameChanged(QString name); void periodChanged(int period); - void objectChanged(UAVObject * arg); + void objectChanged(UAVDataObject * arg); + + void dirtyChanged(bool arg); private: - UAVObject *m_object; + UAVDataObject *m_object; int m_setting; int m_period; + bool m_dirty; }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -225,7 +246,6 @@ signals: void boardConnectedChanged(bool arg); void logStatusesChanged(QStringList arg); - void loggingEnabledChanged(int arg); public slots: @@ -235,7 +255,7 @@ public slots: void cancelExportLogs(); void loadSettings(); void saveSettings(); - void resetSettings(); + void resetSettings(bool clear); void applySettingsToBoard(); void saveSettingsToBoard(); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index 8dc5754e2..58483adea 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -701,3 +701,23 @@ void UAVObject::SetGcsTelemetryUpdateMode(UAVObject::Metadata & metadata, UAVObj { SET_BITS(metadata.flags, UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); } + +/** + * Get the UAVObject metadata logging update mode + * \param[in] metadata The metadata object + * \return the logging update mode + */ +UAVObject::UpdateMode UAVObject::GetLoggingUpdateMode(const UAVObject::Metadata & metadata) +{ + return UAVObject::UpdateMode((metadata.flags >> UAVOBJ_LOGGING_UPDATE_MODE_SHIFT) & UAVOBJ_UPDATE_MODE_MASK); +} + +/** + * Set the UAVObject metadata logging update mode member + * \param[in] metadata The metadata object + * \param[in] val The logging update mode + */ +void UAVObject::SetLoggingUpdateMode(UAVObject::Metadata & metadata, UAVObject::UpdateMode val) +{ + SET_BITS(metadata.flags, UAVOBJ_LOGGING_UPDATE_MODE_SHIFT, val, UAVOBJ_UPDATE_MODE_MASK); +} diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h index fdbb458ca..0c81ebd6c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h @@ -151,6 +151,8 @@ public: static void SetFlightTelemetryUpdateMode(Metadata & meta, UpdateMode val); static UpdateMode GetGcsTelemetryUpdateMode(const Metadata & meta); static void SetGcsTelemetryUpdateMode(Metadata & meta, UpdateMode val); + static UpdateMode GetLoggingUpdateMode(const Metadata & meta); + static void SetLoggingUpdateMode(Metadata & meta, UpdateMode val); public slots: void requestUpdate(); From 9e9673cde46d95c9227fef51d0a0117659decc24 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Wed, 19 Mar 2014 23:05:40 +0100 Subject: [PATCH 049/131] OP-1263 moved SDLGamepad members to new private class SDLGamepadPrivate so as to not expose SDL.h to users of this lib --- .../src/libs/sdlgamepad/sdlgamepad.cpp | 43 ++++++++++++----- .../src/libs/sdlgamepad/sdlgamepad.h | 48 ++++++++----------- .../src/libs/sdlgamepad/sdlgamepad.pri | 15 ------ .../src/libs/sdlgamepad/sdlgamepad.pro | 9 +++- .../gcscontrol/gcscontrolgadgetoptionspage.h | 1 - 5 files changed, 60 insertions(+), 56 deletions(-) diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp index a2fb03ed5..082081b0f 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp @@ -21,6 +21,25 @@ /**********************************************************************/ #include "sdlgamepad.h" +#include +//#undef main + +class SDLGamepadPrivate +{ +public: + SDLGamepadPrivate() : gamepad(0) + { + } + + /** + * SDL_Joystick object. + * + * This represents the currently opened SDL_Joystick object. + */ + SDL_Joystick *gamepad; + +}; + /**********************************************************************/ SDLGamepad::SDLGamepad() { @@ -29,7 +48,7 @@ SDLGamepad::SDLGamepad() index = -1; loop = false; tick = MIN_RATE; - gamepad = 0; + priv = new SDLGamepadPrivate; } /**********************************************************************/ @@ -37,8 +56,8 @@ SDLGamepad::~SDLGamepad() { loop = false; - if (gamepad) { - SDL_JoystickClose(gamepad); + if (priv->gamepad) { + SDL_JoystickClose(priv->gamepad); } SDL_Quit(); @@ -84,14 +103,14 @@ bool SDLGamepad::setGamepad(qint16 index) { if (index != this->index) { if (SDL_JoystickOpened(this->index)) { - SDL_JoystickClose(gamepad); + SDL_JoystickClose(priv->gamepad); } - gamepad = SDL_JoystickOpen(index); + priv->gamepad = SDL_JoystickOpen(index); - if (gamepad) { - buttons = SDL_JoystickNumButtons(gamepad); - axes = SDL_JoystickNumAxes(gamepad); + if (priv->gamepad) { + buttons = SDL_JoystickNumButtons(priv->gamepad); + axes = SDL_JoystickNumAxes(priv->gamepad); if (axes >= 4) { this->index = index; @@ -122,12 +141,12 @@ void SDLGamepad::setTickRate(qint16 ms) /**********************************************************************/ void SDLGamepad::updateAxes() { - if (gamepad) { + if (priv->gamepad) { QListInt16 values; SDL_JoystickUpdate(); for (qint8 i = 0; i < axes; i++) { - qint16 value = SDL_JoystickGetAxis(gamepad, i); + qint16 value = SDL_JoystickGetAxis(priv->gamepad, i); if (value > -NULL_RANGE && value < NULL_RANGE) { value = 0; @@ -143,11 +162,11 @@ void SDLGamepad::updateAxes() /**********************************************************************/ void SDLGamepad::updateButtons() { - if (gamepad) { + if (priv->gamepad) { SDL_JoystickUpdate(); for (qint8 i = 0; i < buttons; i++) { - qint16 state = SDL_JoystickGetButton(gamepad, i); + qint16 state = SDL_JoystickGetButton(priv->gamepad, i); if (buttonStates.at(i) != state) { if (state > 0) { diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h index 217f9465f..0c77f947c 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.h @@ -20,18 +20,13 @@ * mail.nalla@gmail.com */ -/**********************************************************************/ #ifndef SDLGAMEPAD_H #define SDLGAMEPAD_H -/**********************************************************************/ -#include -#undef main - -/**********************************************************************/ -#include #include "sdlgamepad_global.h" +#include + /** * The Axis range that is treated as null. * @@ -114,6 +109,8 @@ enum ButtonNumber { */ typedef QList QListInt16; +class SDLGamepadPrivate; + /** * A class for communication with a sdl gamepad. * @@ -226,17 +223,6 @@ public slots: private: - /** - * Variable to control thread. - * - * This class member variable is false at construction time. If - * the sdl init was successfull it will be set to true. The quit - * slot will false it again. - * - * @see quit() - */ - bool loop; - /** * Get new axes information from the SDL system. * @@ -261,6 +247,17 @@ private: */ void updateButtons(); + /** + * Variable to control thread. + * + * This class member variable is false at construction time. If + * the SDL init was successful it will be set to true. The quit + * slot will false it again. + * + * @see quit() + */ + bool loop; + /** * Number of buttons. * @@ -295,20 +292,18 @@ private: */ qint16 index; - /** - * SDL_Joystick object. - * - * This represents the currently opend SDL_Joystick object. - */ - SDL_Joystick *gamepad; - /** * A QList to store the current button states. * - * This list stores the current states of all avaliable buttons. + * This list stores the current states of all available buttons. */ QList buttonStates; + /** + * Variable that holds private members. + */ + SDLGamepadPrivate *priv; + signals: /** @@ -354,5 +349,4 @@ signals: void axesValues(QListInt16 values); }; -/**********************************************************************/ #endif // SDLGAMEPAD_H diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri index 2e6add4fa..a5d13203c 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pri @@ -1,16 +1 @@ -macx { - # Ensures that SDL framework and header files are found when compiled with Qt5.1.1 - INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - SDL = -F/Library/Frameworks - # Add SDL to CFLAGS fixes build problems on mac - QMAKE_CFLAGS += $$SDL - QMAKE_CXXFLAGS += $$SDL - # Let the linker know where to find the frameworks - LIBS += $$SDL -} - -win32 { - INCLUDEPATH += $(SDL_DIR)/include -} - LIBS *= -l$$qtLibraryName(sdlgamepad) diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro index 7c18fd114..1a6a2a60d 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.pro @@ -23,14 +23,21 @@ TARGET = sdlgamepad DEFINES += SDLGAMEPAD_LIBRARY include(../../openpilotgcslibrary.pri) -include(../../sdlgamepad.pri) macx { + # Ensures that SDL framework and header files are found when compiled with Qt5.2.1 + INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers + SDL = -F/Library/Frameworks + # Add SDL to CFLAGS fixes build problems on mac + QMAKE_CFLAGS += $$SDL + QMAKE_CXXFLAGS += $$SDL # Let the linker know where to find the frameworks + LIBS += $$SDL LIBS += -framework OpenGL -framework SDL -framework Cocoa } win32 { + INCLUDEPATH += $(SDL_DIR)/include LIBS += -L$(SDL_DIR)/lib } diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h index d2f5be894..b2bf7910c 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrolgadgetoptionspage.h @@ -31,7 +31,6 @@ #include "coreplugin/dialogs/ioptionspage.h" #include "gcscontrolplugin.h" #include "sdlgamepad/sdlgamepad.h" -#include #include #include From a9ff7f7afc2c7f3817e2a5e810aefbea75ef9909 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Wed, 19 Mar 2014 23:08:40 +0100 Subject: [PATCH 050/131] OP-1255 Qt 5.2.1 : use _MAX_PATH from stdlib.h in place of MAX_PATH from usbstorioctl.h --- ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp index f279a84c8..219065c8f 100644 --- a/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp +++ b/ground/openpilotgcs/src/plugins/hitl/aerosimrc/src/plugin.cpp @@ -33,8 +33,8 @@ bool isFirstRun = true; QString debugInfo(DBG_BUFFER_MAX_SIZE, ' '); -QString pluginFolder(MAX_PATH, ' '); -QString outputFolder(MAX_PATH, ' '); +QString pluginFolder(_MAX_PATH, ' '); +QString outputFolder(_MAX_PATH, ' '); QList videoModes; QTime ledTimer; From 40f648eab1ac27bc09318a21bba792f0e113f1db Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 20 Mar 2014 00:46:05 +0100 Subject: [PATCH 051/131] OP-1255 Windows toolchain : upgraded Qt from version 5.1.1 to version 5.2.1 - Qt installer is now downloaded from official web site - Qt is not anymore tweaked to contain the SDL SDK (see OP-1263) - Installing Qt now requires 7-Zip to be available (run "./make/scripts/win_sdk_install.sh []" to get it) - SLD needs to be installed with "make sdl_sdk_install" KNOWN ISSUE : GCS build fails unless V=1 command line arg is provided --- ground/openpilotgcs/copydata.pro | 1 - make/scripts/win_sdk_install.sh | 20 ++++++- make/tools.mk | 92 ++++++++++++++++++++++++++++---- 3 files changed, 100 insertions(+), 13 deletions(-) diff --git a/ground/openpilotgcs/copydata.pro b/ground/openpilotgcs/copydata.pro index 6779190f5..39eabcfbb 100644 --- a/ground/openpilotgcs/copydata.pro +++ b/ground/openpilotgcs/copydata.pro @@ -139,7 +139,6 @@ GCS_LIBRARY_PATH Qt5MultimediaWidgets$${DS}.dll \ Qt5Quick$${DS}.dll \ Qt5Qml$${DS}.dll \ - Qt5V8$${DS}.dll \ icuin51.dll \ icudt51.dll \ icuuc51.dll diff --git a/make/scripts/win_sdk_install.sh b/make/scripts/win_sdk_install.sh index b6b3c1ce1..af9c3d3c0 100644 --- a/make/scripts/win_sdk_install.sh +++ b/make/scripts/win_sdk_install.sh @@ -27,14 +27,19 @@ SCRIPT_NAME="`basename \"$SCRIPT_PATH\"`" SCRIPT_DIR="`dirname \"$SCRIPT_PATH\"`" ROOT_DIR="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`" TOOLS_DIR="$ROOT_DIR/tools" +if [ -x "$1" ]; then + TOOLS_DIR="$1" +fi # Tools URLs to fetch WGET_URL="http://wiki.openpilot.org/download/attachments/18612236/wget.exe" MAKE_URL="http://wiki.openpilot.org/download/attachments/18612236/make.exe" +SEVENZIP_URL="http://wiki.openpilot.org/download/attachments/18612236/7za.exe" # Expected tools paths WGET="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`" MAKE="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`" +SEVENZIP="$TOOLS_DIR/bin/`basename \"$SEVENZIP_URL\"`" # wget is necessary to fetch other files WGET_NAME="`basename \"$WGET\"`" @@ -78,7 +83,6 @@ EOF fi # make is necessary to fetch all SDKs -MAKE_NAME="`basename \"$MAKE\"`" if [ ! -x "$MAKE" ]; then echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL" MAKE_DIR="`dirname \"$MAKE\"`" @@ -86,10 +90,24 @@ if [ ! -x "$MAKE" ]; then $WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL" if [ $? -ne 0 ]; then echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..." + MAKE_NAME="`basename \"$MAKE\"`" MAKE="$MAKE_NAME" fi fi +# 7-Zip is necessary to install some SDKs +if [ ! -x "$SEVENZIP" ]; then + echo "$SCRIPT_NAME: $SEVENZIP_NAME not found, fetching from $SEVENZIP_URL" + SEVENZIP_DIR="`dirname \"$SEVENZIP\"`" + mkdir -p "$SEVENZIP_DIR" + $WGET -N --content-disposition -P "$SEVENZIP_DIR" "$SEVENZIP_URL" + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME: $SEVENZIP_NAME fetch error, hope it's in the path..." + SEVENZIP_NAME="`basename \"$SEVENZIP\"`" + SEVENZIP="$SEVENZIP_NAME" + fi +fi + # Finally we can fetch all SDKs using top level Makefile cd "$ROOT_DIR" echo "Run 'tools/bin/make all_sdk_install' to install the other tools" diff --git a/make/tools.mk b/make/tools.mk index 977c6bf3c..9b6d28491 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -12,6 +12,7 @@ # mingw_install (Windows only - NOT USED for Qt-5.1.x) # python_install (Windows only - NOT USED for Qt-5.1.x) # nsis_install (Windows only) +# sdl_install (Windows only) # openssl_install (Windows only) # uncrustify_install # doxygen_install @@ -76,7 +77,9 @@ else ifeq ($(UNAME), Darwin) DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1.src.tar.gz else ifeq ($(UNAME), Windows) ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-windows.tar.bz2 - QT_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-5.1.1-windows.tar.bz2 + QT_SDK_URL := http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe + QT_SDK_MD5_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe.md5 + QT_SDK_ARCH := mingw48_32 NSIS_URL := http://wiki.openpilot.org/download/attachments/18612236/nsis-2.46-unicode.tar.bz2 SDL_URL := http://wiki.openpilot.org/download/attachments/18612236/SDL-devel-1.2.15-mingw32.tar.gz OPENSSL_URL := http://wiki.openpilot.org/download/attachments/18612236/openssl-1.0.1e-win32.tar.bz2 @@ -147,9 +150,14 @@ OPENSSL := openssl ANT := ant JAVAC := javac JAR := jar -SEVENZIP := 7zr CD := cd GREP := grep +ifneq ($(UNAME), Windows) + SEVENZIP := 7zr +else + SEVENZIP := 7za.exe +endif + # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases. # It does not work if make started under msysGit installed into a path with spaces. ifneq ($(UNAME), Windows) @@ -300,6 +308,73 @@ $(1)_distclean: endef +############################## +# +# Windows QT install template +# $(1) = tool temp extract/build directory +# $(2) = tool install directory +# $(3) = tool distribution URL +# $(4) = tool distribution .md5 URL +# $(5) = tool distribution file +# $(6) = QT architecture +# $(7) = optional extra build recipes template +# $(8) = optional extra clean recipes template +# +############################## + +define WIN_QT_INSTALL_TEMPLATE + +.PHONY: $(addprefix qt_sdk_, install clean distclean) + +qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR) + $(V1) if ! $(SEVENZIP) >/dev/null 2>&1; then \ + $(ECHO) $(MSG_NOTICE) "Missing 7zip. Run ./make/scripts/win_sdk_install.sh [] to get it." && \ + exit 1; \ + fi + $(call DOWNLOAD_TEMPLATE,$(3),$(5),"$(4)") +# Explode .run file into install packages + @$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(1)) + $(V1) $(MKDIR) -p $$(call toprel, $(dir $(1))) + $(V1) chmod +x $(DL_DIR)/$(5) + $(V1) $(DL_DIR)/$(5) --dump-binary-data -o $(1) +# Extract packages under tool directory + $(V1) $(MKDIR) -p $$(call toprel, $(dir $(2))) + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0qt-project-url.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0readme.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1mingw48_essentials.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1x32-4.8.0-release-posix-dwarf-rev2-runtime.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.essentials/5.2.1icu_51_1_mingw_builds_4_8_0_posix_dwarf_32.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.win32_mingw48.addons/5.2.1mingw48_addons.7z" | grep -v Extracting + $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.tools.win32_mingw48/4.8.0-1-1x32-4.8.0-release-posix-dwarf-rev2.7z" | grep -v Extracting +# Run patcher + @$(ECHO) + @$(ECHO) "Executing QtPatch in" $$(call toprel, $(QT_SDK_PREFIX)) + $(V1) $(CD) $(QT_SDK_PREFIX) + $(V1) $(DL_DIR)/$(5) --runoperation QtPatch windows $(QT_SDK_PREFIX) qt5 + +# Execute post build templates + $(7) + +# Clean up temporary files + @$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1)) + $(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)" + +qt_sdk_clean: + @$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1)) + $(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)" + @$(ECHO) $(MSG_CLEANING) $$(call toprel, "$(2)") + $(V1) [ ! -d "$(2)" ] || $(RM) -rf "$(2)" + + $(8) + +qt_sdk_distclean: + @$(ECHO) $(MSG_DISTCLEANING) $$(call toprel, $(DL_DIR)/$(5)) + $(V1) [ ! -f "$(DL_DIR)/$(5)" ] || $(RM) "$(DL_DIR)/$(5)" + $(V1) [ ! -f "$(DL_DIR)/$(5).md5" ] || $(RM) "$(DL_DIR)/$(5).md5" + +endef + ############################## # # Linux QT install template @@ -409,17 +484,12 @@ endef ifeq ($(UNAME), Windows) -QT_SDK_PREFIX := $(QT_SDK_DIR)/5.1.1/mingw48_32 - -define QT_SDK_CONFIGURE_TEMPLATE - @$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(QT_SDK_DIR)) - $(V1) $(ECHO) $(QUOTE)[Paths]$(QUOTE) > $(QT_SDK_PREFIX)/bin/qt.conf - $(V1) $(ECHO) $(QUOTE)Prefix = $(QT_SDK_PREFIX)$(QUOTE) >> $(QT_SDK_PREFIX)/bin/qt.conf -endef - - $(eval $(call TOOL_INSTALL_TEMPLATE,qt_sdk,$(QT_SDK_DIR),$(QT_SDK_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_CONFIGURE_TEMPLATE))) +QT_SDK_PREFIX := $(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH) +QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD + $(eval $(call WIN_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) else ifeq ($(UNAME), Linux) + QT_SDK_PREFIX := "$(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH)" QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD $(eval $(call LINUX_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) From 82bcc65d4ccbb3bc7b791cfa155692442a2d41cd Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 20 Mar 2014 01:09:25 +0100 Subject: [PATCH 052/131] OP-1263 cleaned up gcscontrol.pro --- .../src/plugins/gcscontrol/gcscontrol.pro | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro index 3603aaa31..57fb56136 100644 --- a/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro +++ b/ground/openpilotgcs/src/plugins/gcscontrol/gcscontrol.pro @@ -9,27 +9,27 @@ include(../../plugins/uavobjects/uavobjects.pri) include(../../libs/sdlgamepad/sdlgamepad.pri) HEADERS += \ - gcscontrolgadget.h \ + gcscontrolgadget.h \ gcscontrolgadgetconfiguration.h \ gcscontrolgadgetoptionspage.h \ - gcscontrolgadgetwidget.h \ - gcscontrolgadgetfactory.h \ - gcscontrolplugin.h \ - joystickcontrol.h + gcscontrolgadgetwidget.h \ + gcscontrolgadgetfactory.h \ + gcscontrolplugin.h \ + joystickcontrol.h SOURCES += \ - gcscontrolgadget.cpp \ + gcscontrolgadget.cpp \ gcscontrolgadgetconfiguration.cpp \ gcscontrolgadgetoptionspage.cpp \ - gcscontrolgadgetwidget.cpp \ - gcscontrolgadgetfactory.cpp \ - gcscontrolplugin.cpp \ - joystickcontrol.cpp + gcscontrolgadgetwidget.cpp \ + gcscontrolgadgetfactory.cpp \ + gcscontrolplugin.cpp \ + joystickcontrol.cpp OTHER_FILES += GCSControl.pluginspec FORMS += \ - gcscontrol.ui \ + gcscontrol.ui \ gcscontrolgadgetoptionspage.ui RESOURCES += gcscontrol.qrc From 838d8dd15f2299d0f981adb168ce339b70ac6b38 Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 20 Mar 2014 14:10:16 +0100 Subject: [PATCH 053/131] OP-1245 Added code to update and store meta data on the board. --- .../src/plugins/flightlog/FlightLogDialog.qml | 8 +- .../plugins/flightlog/flightlogmanager.cpp | 96 ++++++++++++++----- .../src/plugins/flightlog/flightlogmanager.h | 14 ++- .../src/plugins/uavobjects/uavobjects.pro | 7 +- .../uavobjecthelper.cpp | 9 ++ .../uavobjecthelper.h | 3 + .../plugins/uavobjectutil/uavobjectutil.pro | 6 +- 7 files changed, 103 insertions(+), 40 deletions(-) rename ground/openpilotgcs/src/plugins/{uavobjects => uavobjectutil}/uavobjecthelper.cpp (95%) rename ground/openpilotgcs/src/plugins/{uavobjects => uavobjectutil}/uavobjecthelper.h (95%) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index c328223b1..1553bb998 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -188,7 +188,7 @@ Rectangle { enabled: !logManager.disableControls && logManager.boardConnected model: logManager.logStatuses Layout.preferredWidth: 200 - currentIndex: logSettings.loggingEnabled + currentIndex: logManager.loggingEnabled onCurrentIndexChanged: { logManager.setLoggingEnabled(currentIndex); } @@ -346,12 +346,6 @@ Rectangle { Rectangle { Layout.fillWidth: true } - Button { - enabled: !logManager.disableControls && logManager.boardConnected - text: qsTr("Apply to board") - activeFocusOnPress: true - onClicked: logManager.applySettingsToBoard() - } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Save to board") diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 3f8970f57..ea04eaafd 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -50,10 +50,10 @@ FlightLogManager::FlightLogManager(QObject *parent) : Q_ASSERT(pluginManager); - m_objectManager = pluginManager->getObject(); + m_objectManager = pluginManager->getObject(); Q_ASSERT(m_objectManager); - m_telemtryManager = pluginManager->getObject(); + m_telemtryManager = pluginManager->getObject(); Q_ASSERT(m_telemtryManager); m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); @@ -77,6 +77,7 @@ FlightLogManager::FlightLogManager(QObject *parent) : connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged())); connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged())); + connectionStatusChanged(); } FlightLogManager::~FlightLogManager() @@ -387,7 +388,8 @@ void FlightLogManager::cancelExportLogs() void FlightLogManager::loadSettings() { QString xmlFilter = tr("XML file %1").arg("(*.xml)"); - QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load Log Settings"), QDir::homePath(), QString("%1").arg(xmlFilter)); + QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load Log Settings"), QDir::homePath(), QString("%1").arg(xmlFilter)); + if (!fileName.isEmpty()) { if (!fileName.endsWith(".xml")) { fileName.append(".xml"); @@ -414,11 +416,10 @@ void FlightLogManager::loadSettings() while (xmlReader.readNextStartElement()) { if (xmlReader.name() == "setting") { QString name = xmlReader.attributes().value("name").toString(); - int level = xmlReader.attributes().value("level").toInt(&ok); + int level = xmlReader.attributes().value("level").toInt(&ok); if (ok) { int period = xmlReader.attributes().value("period").toInt(&ok); - if (ok && updateLogWrapper(name, level, period)) { - } else { + if (ok && updateLogWrapper(name, level, period)) {} else { errorString = tr("Could not parse period attribute, or object with name '%1' could not be found.").arg(name); break; } @@ -445,8 +446,9 @@ void FlightLogManager::loadSettings() void FlightLogManager::saveSettings() { QString xmlFilter = tr("XML file %1").arg("(*.xml)"); - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Settings"), - QDir::homePath(), QString("%1").arg(xmlFilter)); + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log Settings"), + QDir::homePath(), QString("%1").arg(xmlFilter)); + if (!fileName.isEmpty()) { if (!fileName.endsWith(".xml")) { fileName.append(".xml"); @@ -486,11 +488,12 @@ void FlightLogManager::resetSettings(bool clear) } } -void FlightLogManager::applySettingsToBoard() -{} - void FlightLogManager::saveSettingsToBoard() -{} +{ + foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { + wrapper->save(); + } +} void FlightLogManager::updateFlightEntries(quint16 currentFlight) { @@ -511,14 +514,16 @@ void FlightLogManager::updateFlightEntries(quint16 currentFlight) void FlightLogManager::setupUAVOWrappers() { + ObjectPersistence *objectPersistance = ObjectPersistence::GetInstance(m_objectManager); + Q_ASSERT(objectPersistance); + foreach(QList objectList, m_objectManager->getObjects()) { UAVObject *object = objectList.at(0); if (!object->isMetaDataObject() && !object->isSettingsObject()) { - UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object)); + UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object), objectPersistance); m_uavoEntries.append(wrapper); m_uavoEntriesHash[wrapper->name()] = wrapper; - qDebug() << objectList.at(0)->getName(); } } emit uavoEntriesChanged(); @@ -527,12 +532,12 @@ void FlightLogManager::setupUAVOWrappers() void FlightLogManager::setupLogSettings() { // Corresponds to: - // typedef enum { - // UPDATEMODE_MANUAL = 0, /** Manually update object, by calling the updated() function */ - // UPDATEMODE_PERIODIC = 1, /** Automatically update object at periodic intervals */ - // UPDATEMODE_ONCHANGE = 2, /** Only update object when its data changes */ - // UPDATEMODE_THROTTLED = 3 /** Object is updated on change, but not more often than the interval time */ - // } UpdateMode; + // typedef enum { + // UPDATEMODE_MANUAL = 0, /** Manually update object, by calling the updated() function */ + // UPDATEMODE_PERIODIC = 1, /** Automatically update object at periodic intervals */ + // UPDATEMODE_ONCHANGE = 2, /** Only update object when its data changes */ + // UPDATEMODE_THROTTLED = 3 /** Object is updated on change, but not more often than the interval time */ + // } UpdateMode; m_logSettings << tr("Disabled") << tr("Periodically") << tr("When updated") << tr("Throttled"); } @@ -551,7 +556,7 @@ void FlightLogManager::connectionStatusChanged() } else { setBoardConnected(false); } - if(boardConnected()) { + if (boardConnected()) { resetSettings(false); } } @@ -559,6 +564,7 @@ void FlightLogManager::connectionStatusChanged() bool FlightLogManager::updateLogWrapper(QString name, int level, int period) { UAVOLogSettingsWrapper *wrapper = m_uavoEntriesHash[name]; + if (wrapper) { wrapper->setSetting(level); wrapper->setPeriod(period); @@ -635,8 +641,8 @@ void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVOb UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} -UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVDataObject *object) : QObject(), - m_object(object), m_setting(DISABLED), m_period(0), m_dirty(0) +UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVDataObject *object, ObjectPersistence *persistence) : QObject(), + m_object(object), m_setting(DISABLED), m_period(0), m_dirty(0), m_objectPersistence(persistence) { reset(false); } @@ -650,3 +656,47 @@ void UAVOLogSettingsWrapper::reset(bool clear) setPeriod(clear ? 0 : m_object->getMetadata().loggingUpdatePeriod); setDirty(false); } + +void UAVOLogSettingsWrapper::save() +{ + if(m_dirty) { + UAVObject::Metadata meta = m_object->getMetadata(); + m_object->SetLoggingUpdateMode(meta, settingAsUpdateMode()); + meta.loggingUpdatePeriod = m_period; + m_object->setMetadata(meta); + + UAVObjectUpdaterHelper helper; + if (helper.doObjectAndWait(m_object->getMetaObject(), 1000) == UAVObjectUpdaterHelper::SUCCESS) { + ObjectPersistence::DataFields data; + data.Operation = ObjectPersistence::OPERATION_SAVE; + data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; + data.ObjectID = m_object->getMetaObject()->getObjID(); + data.InstanceID = m_object->getMetaObject()->getInstID(); + m_objectPersistence->setData(data); + + if (helper.doObjectAndWait(m_objectPersistence, 1000) == UAVObjectUpdaterHelper::SUCCESS) { + setDirty(false); + } else { + qDebug() << "Storing failed!"; + } + } else { + qDebug() << "Updating failed!"; + } + } +} + +UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode() +{ + switch (m_setting) { + case 0: + return UAVObject::UPDATEMODE_MANUAL; + case 1: + return UAVObject::UPDATEMODE_PERIODIC; + case 2: + return UAVObject::UPDATEMODE_ONCHANGE; + case 3: + return UAVObject::UPDATEMODE_THROTTLED; + default: + return UAVObject::UPDATEMODE_MANUAL; + } +} diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 19f7b5e12..099ea7843 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -41,6 +41,7 @@ #include "debuglogstatus.h" #include "debuglogsettings.h" #include "debuglogcontrol.h" +#include "objectpersistence.h" #include "uavtalk/telemetrymanager.h" class UAVOLogSettingsWrapper : public QObject { @@ -55,7 +56,7 @@ public: enum UAVLogSetting { DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY }; explicit UAVOLogSettingsWrapper(); - explicit UAVOLogSettingsWrapper(UAVDataObject *object); + explicit UAVOLogSettingsWrapper(UAVDataObject *object, ObjectPersistence *persistence); ~UAVOLogSettingsWrapper(); QString name() const @@ -87,8 +88,11 @@ public slots: void setSetting(int setting) { if (m_setting != setting) { - m_setting = setting; + m_setting = setting; setDirty(true); + if (m_setting != 1 && m_setting != 3) { + setPeriod(0); + } emit settingChanged(setting); } } @@ -111,6 +115,8 @@ public slots: } void reset(bool clear); + void save(); + void apply(); signals: void settingChanged(int setting); @@ -125,6 +131,9 @@ private: int m_setting; int m_period; bool m_dirty; + ObjectPersistence *m_objectPersistence; + + UAVObject::UpdateMode settingAsUpdateMode(); }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -256,7 +265,6 @@ public slots: void loadSettings(); void saveSettings(); void resetSettings(bool clear); - void applySettingsToBoard(); void saveSettingsToBoard(); void setDisableControls(bool arg) diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro index dc54fb9b7..9c6dc8d67 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro @@ -14,17 +14,14 @@ HEADERS += \ uavdataobject.h \ uavobjectfield.h \ uavobjectsinit.h \ - uavobjectsplugin.h \ - uavobjecthelper.h - + uavobjectsplugin.h SOURCES += \ uavobject.cpp \ uavmetaobject.cpp \ uavobjectmanager.cpp \ uavdataobject.cpp \ uavobjectfield.cpp \ - uavobjectsplugin.cpp \ - uavobjecthelper.cpp + uavobjectsplugin.cpp OTHER_FILES += UAVObjects.pluginspec diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.cpp similarity index 95% rename from ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp rename to ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.cpp index 25ff5f805..ddd683a98 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.cpp @@ -32,6 +32,9 @@ AbstractUAVObjectHelper::AbstractUAVObjectHelper(QObject *parent) : QObject(parent), m_transactionResult(false), m_transactionCompleted(false) {} +AbstractUAVObjectHelper::~AbstractUAVObjectHelper() +{} + AbstractUAVObjectHelper::Result AbstractUAVObjectHelper::doObjectAndWait(UAVObject *object, int timeout) { // Lock, we can't call this twice from different threads @@ -86,6 +89,9 @@ void AbstractUAVObjectHelper::transactionCompleted(UAVObject *object, bool succe UAVObjectUpdaterHelper::UAVObjectUpdaterHelper(QObject *parent) : AbstractUAVObjectHelper(parent) {} +UAVObjectUpdaterHelper::~UAVObjectUpdaterHelper() +{} + void UAVObjectUpdaterHelper::doObjectAndWaitImpl() { m_object->updated(); @@ -94,6 +100,9 @@ void UAVObjectUpdaterHelper::doObjectAndWaitImpl() UAVObjectRequestHelper::UAVObjectRequestHelper(QObject *parent) : AbstractUAVObjectHelper(parent) {} +UAVObjectRequestHelper::~UAVObjectRequestHelper() +{} + void UAVObjectRequestHelper::doObjectAndWaitImpl() { m_object->requestUpdate(); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h similarity index 95% rename from ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h rename to ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h index bf2739e09..7891de004 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h @@ -39,6 +39,7 @@ class UAVOBJECTS_EXPORT AbstractUAVObjectHelper : public QObject { Q_OBJECT public: explicit AbstractUAVObjectHelper(QObject *parent = 0); + virtual ~AbstractUAVObjectHelper(); enum Result { SUCCESS, FAIL, TIMEOUT }; Result doObjectAndWait(UAVObject *object, int timeout); @@ -61,6 +62,7 @@ class UAVOBJECTS_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper Q_OBJECT public: explicit UAVObjectUpdaterHelper(QObject *parent = 0); + virtual ~UAVObjectUpdaterHelper(); protected: virtual void doObjectAndWaitImpl(); @@ -70,6 +72,7 @@ class UAVOBJECTS_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper Q_OBJECT public: explicit UAVObjectRequestHelper(QObject *parent = 0); + virtual ~UAVObjectRequestHelper(); protected: virtual void doObjectAndWaitImpl(); diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutil.pro b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutil.pro index 2f8070820..dde6e81b5 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutil.pro +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutil.pro @@ -7,9 +7,11 @@ include(uavobjectutil_dependencies.pri) HEADERS += uavobjectutil_global.h \ uavobjectutilmanager.h \ uavobjectutilplugin.h \ - devicedescriptorstruct.h + devicedescriptorstruct.h \ + uavobjecthelper.h SOURCES += uavobjectutilmanager.cpp \ - uavobjectutilplugin.cpp + uavobjectutilplugin.cpp \ + uavobjecthelper.cpp OTHER_FILES += UAVObjectUtil.pluginspec From b508c7dc968ccfcc059110db22120b7188344a84 Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 20 Mar 2014 17:02:44 +0100 Subject: [PATCH 054/131] OP-1245 Re-factored saving to board. Added code to save more things. --- .../plugins/flightlog/flightlogmanager.cpp | 72 +++++++++---------- .../src/plugins/flightlog/flightlogmanager.h | 10 +-- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index ea04eaafd..3909a01d8 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -69,6 +69,9 @@ FlightLogManager::FlightLogManager(QObject *parent) : m_flightLogSettings = DebugLogSettings::GetInstance(m_objectManager); Q_ASSERT(m_flightLogSettings); + m_objectPersistence = ObjectPersistence::GetInstance(m_objectManager); + Q_ASSERT(m_objectPersistence); + updateFlightEntries(m_flightLogStatus->getFlight()); setupLogSettings(); @@ -490,11 +493,40 @@ void FlightLogManager::resetSettings(bool clear) void FlightLogManager::saveSettingsToBoard() { + + m_flightLogSettings->setLoggingEnabled(m_loggingEnabled); + saveUAVObjectToFlash(m_flightLogSettings); + foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { - wrapper->save(); + if (wrapper->dirty()) { + UAVObject::Metadata meta = wrapper->object()->getMetadata(); + wrapper->object()->SetLoggingUpdateMode(meta, wrapper->settingAsUpdateMode()); + meta.loggingUpdatePeriod = wrapper->period(); + wrapper->object()->setMetadata(meta); + + if (saveUAVObjectToFlash(wrapper->object()->getMetaObject())) { + wrapper->setDirty(false); + } + } } } +bool FlightLogManager::saveUAVObjectToFlash(UAVObject *object) +{ + UAVObjectUpdaterHelper helper; + if (helper.doObjectAndWait(object, 3000) == UAVObjectUpdaterHelper::SUCCESS) { + ObjectPersistence::DataFields data; + data.Operation = ObjectPersistence::OPERATION_SAVE; + data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; + data.ObjectID = object->getObjID(); + data.InstanceID = object->getInstID(); + m_objectPersistence->setData(data); + + return (helper.doObjectAndWait(m_objectPersistence, 3000) == UAVObjectUpdaterHelper::SUCCESS); + } + return false; +} + void FlightLogManager::updateFlightEntries(quint16 currentFlight) { Q_UNUSED(currentFlight); @@ -514,14 +546,10 @@ void FlightLogManager::updateFlightEntries(quint16 currentFlight) void FlightLogManager::setupUAVOWrappers() { - ObjectPersistence *objectPersistance = ObjectPersistence::GetInstance(m_objectManager); - Q_ASSERT(objectPersistance); - foreach(QList objectList, m_objectManager->getObjects()) { UAVObject *object = objectList.at(0); - if (!object->isMetaDataObject() && !object->isSettingsObject()) { - UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object), objectPersistance); + UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object)); m_uavoEntries.append(wrapper); m_uavoEntriesHash[wrapper->name()] = wrapper; } @@ -641,8 +669,8 @@ void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVOb UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} -UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVDataObject *object, ObjectPersistence *persistence) : QObject(), - m_object(object), m_setting(DISABLED), m_period(0), m_dirty(0), m_objectPersistence(persistence) +UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVDataObject *object) : QObject(), + m_object(object), m_setting(DISABLED), m_period(0), m_dirty(0) { reset(false); } @@ -657,34 +685,6 @@ void UAVOLogSettingsWrapper::reset(bool clear) setDirty(false); } -void UAVOLogSettingsWrapper::save() -{ - if(m_dirty) { - UAVObject::Metadata meta = m_object->getMetadata(); - m_object->SetLoggingUpdateMode(meta, settingAsUpdateMode()); - meta.loggingUpdatePeriod = m_period; - m_object->setMetadata(meta); - - UAVObjectUpdaterHelper helper; - if (helper.doObjectAndWait(m_object->getMetaObject(), 1000) == UAVObjectUpdaterHelper::SUCCESS) { - ObjectPersistence::DataFields data; - data.Operation = ObjectPersistence::OPERATION_SAVE; - data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; - data.ObjectID = m_object->getMetaObject()->getObjID(); - data.InstanceID = m_object->getMetaObject()->getInstID(); - m_objectPersistence->setData(data); - - if (helper.doObjectAndWait(m_objectPersistence, 1000) == UAVObjectUpdaterHelper::SUCCESS) { - setDirty(false); - } else { - qDebug() << "Storing failed!"; - } - } else { - qDebug() << "Updating failed!"; - } - } -} - UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode() { switch (m_setting) { diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 099ea7843..87f821701 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -56,7 +56,7 @@ public: enum UAVLogSetting { DISABLED = 0, ON_CHANGE, THROTTLED, PERIODICALLY }; explicit UAVOLogSettingsWrapper(); - explicit UAVOLogSettingsWrapper(UAVDataObject *object, ObjectPersistence *persistence); + explicit UAVOLogSettingsWrapper(UAVDataObject *object); ~UAVOLogSettingsWrapper(); QString name() const @@ -69,6 +69,8 @@ public: return m_setting; } + UAVObject::UpdateMode settingAsUpdateMode(); + int period() const { return m_period; @@ -115,8 +117,6 @@ public slots: } void reset(bool clear); - void save(); - void apply(); signals: void settingChanged(int setting); @@ -131,9 +131,7 @@ private: int m_setting; int m_period; bool m_dirty; - ObjectPersistence *m_objectPersistence; - UAVObject::UpdateMode settingAsUpdateMode(); }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -266,6 +264,7 @@ public slots: void saveSettings(); void resetSettings(bool clear); void saveSettingsToBoard(); + bool saveUAVObjectToFlash(UAVObject *object); void setDisableControls(bool arg) { @@ -322,6 +321,7 @@ private: DebugLogStatus *m_flightLogStatus; DebugLogEntry *m_flightLogEntry; DebugLogSettings *m_flightLogSettings; + ObjectPersistence *m_objectPersistence; QList m_logEntries; QStringList m_flightEntries; From 739aefd53bf7b4a0f6eae5cd918a776999545c8d Mon Sep 17 00:00:00 2001 From: Cosimo Corrado Date: Thu, 20 Mar 2014 22:36:09 +0100 Subject: [PATCH 055/131] OP-1266 Fix checking for temperature compensation coeffs --- flight/modules/Sensors/sensors.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index 0b5291a2c..5c1f38aea 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -454,11 +454,11 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv) mag_scale[2] = cal.mag_scale.Z; accel_temp_calibrated = (agcal.temp_calibrated_extent.max - agcal.temp_calibrated_extent.min > .1f) && - agcal.accel_temp_coeff.X > 1e-9f && agcal.accel_temp_coeff.Y > 1e-9f && agcal.accel_temp_coeff.Z > 1e-9f; + (abs(agcal.accel_temp_coeff.X) > 1e-9f || abs(agcal.accel_temp_coeff.Y) > 1e-9f || abs(agcal.accel_temp_coeff.Z) > 1e-9f); gyro_temp_calibrated = (agcal.temp_calibrated_extent.max - agcal.temp_calibrated_extent.min > .1f) && - agcal.gyro_temp_coeff.X > 1e-9f && agcal.gyro_temp_coeff.Y > 1e-9f && - agcal.gyro_temp_coeff.Z > 1e-9f && agcal.gyro_temp_coeff.Z2 > 1e-9f; + (abs(agcal.gyro_temp_coeff.X) > 1e-9f || abs(agcal.gyro_temp_coeff.Y) > 1e-9f || + abs(agcal.gyro_temp_coeff.Z) > 1e-9f || abs(agcal.gyro_temp_coeff.Z2) > 1e-9f); AttitudeSettingsData attitudeSettings; From 6210b8e0df244257d870a21bf623f95359c66ef3 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 20 Mar 2014 22:51:46 +0100 Subject: [PATCH 056/131] OP-1263 added missing documentation for new Make sdl_install target --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 35cfb8436..e3945c951 100644 --- a/Makefile +++ b/Makefile @@ -867,6 +867,7 @@ help: @$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)" @$(ECHO) " python_install - Install the Python interpreter (Windows only)" @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)" + @$(ECHO) " sdl_install - Install the SDL library (Windows only)" @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)" @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier" @$(ECHO) " doxygen_install - Install the Doxygen documentation generator" From 786d3c97a1b843ade39f1f3fc091bd100e3dfeec Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 20 Mar 2014 22:57:21 +0100 Subject: [PATCH 057/131] OP-1245 Added tooltips. Added correct colors. --- .../src/plugins/flightlog/FlightLogDialog.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 1553bb998..e70b35ce1 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -206,7 +206,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter elide: styleData.elideMode text: styleData.value !== undefined ? logManager.logSettings[styleData.value] : "" - color: styleData.textColor + color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor visible: !styleData.selected } Loader { @@ -243,7 +243,7 @@ Rectangle { text: styleData.value !== undefined && (logManager.uavoEntries[styleData.row].setting === 1 || logManager.uavoEntries[styleData.row].setting === 3) ? parseInt(logManager.uavoEntries[styleData.row].period) + " ms" : "-" - color: styleData.textColor + color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor //visible: !styleData.selected && (logManager.uavoEntries[styleData.row].setting <= 1) enabled: (logManager.uavoEntries[styleData.row].setting > 1) } @@ -295,7 +295,7 @@ Rectangle { Text { verticalAlignment: Text.AlignVCenter anchors.leftMargin: 5 - color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : "#000" + color: logManager.uavoEntries[styleData.row].dirty ? "#f00" : styleData.textColor text: styleData.value } @@ -322,24 +322,28 @@ Rectangle { Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Load...") + tooltip: qsTr("Loads settings for all objects from a file.") activeFocusOnPress: true onClicked: logManager.loadSettings() } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Save...") + tooltip: qsTr("Saves settings for all objects in a file.") activeFocusOnPress: true onClicked: logManager.saveSettings() } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Reset") + tooltip: qsTr("Resets all settings to the values currently set on the board.") activeFocusOnPress: true onClicked: logManager.resetSettings(false) } Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Clear") + tooltip: qsTr("Clears all settings to default values.") activeFocusOnPress: true onClicked: logManager.resetSettings(true) } @@ -349,6 +353,7 @@ Rectangle { Button { enabled: !logManager.disableControls && logManager.boardConnected text: qsTr("Save to board") + tooltip: qsTr("Saves the logging configurations to the boards flash memory.") activeFocusOnPress: true onClicked: logManager.saveSettingsToBoard() } From 77f92945482e48f806f9e3f789e2ff367b82ba1f Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 20 Mar 2014 22:58:09 +0100 Subject: [PATCH 058/131] OP-1245 Changed the code that saves the logging metadata for all objects and DebugLogSettings object. --- .../plugins/flightlog/flightlogmanager.cpp | 36 ++++++++++--------- .../src/plugins/flightlog/flightlogmanager.h | 2 ++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 3909a01d8..ac937d4c2 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -56,6 +56,9 @@ FlightLogManager::FlightLogManager(QObject *parent) : m_telemtryManager = pluginManager->getObject(); Q_ASSERT(m_telemtryManager); + m_objectUtilManager = pluginManager->getObject(); + Q_ASSERT(m_objectUtilManager); + m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); Q_ASSERT(m_flightLogControl); @@ -493,8 +496,8 @@ void FlightLogManager::resetSettings(bool clear) void FlightLogManager::saveSettingsToBoard() { - m_flightLogSettings->setLoggingEnabled(m_loggingEnabled); + m_flightLogSettings->updated(); saveUAVObjectToFlash(m_flightLogSettings); foreach(UAVOLogSettingsWrapper * wrapper, m_uavoEntries) { @@ -502,6 +505,9 @@ void FlightLogManager::saveSettingsToBoard() UAVObject::Metadata meta = wrapper->object()->getMetadata(); wrapper->object()->SetLoggingUpdateMode(meta, wrapper->settingAsUpdateMode()); meta.loggingUpdatePeriod = wrapper->period(); + + // As metadata are set up to update via telemetry on change + // this call will send the update to the board. wrapper->object()->setMetadata(meta); if (saveUAVObjectToFlash(wrapper->object()->getMetaObject())) { @@ -513,18 +519,8 @@ void FlightLogManager::saveSettingsToBoard() bool FlightLogManager::saveUAVObjectToFlash(UAVObject *object) { - UAVObjectUpdaterHelper helper; - if (helper.doObjectAndWait(object, 3000) == UAVObjectUpdaterHelper::SUCCESS) { - ObjectPersistence::DataFields data; - data.Operation = ObjectPersistence::OPERATION_SAVE; - data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; - data.ObjectID = object->getObjID(); - data.InstanceID = object->getInstID(); - m_objectPersistence->setData(data); - - return (helper.doObjectAndWait(m_objectPersistence, 3000) == UAVObjectUpdaterHelper::SUCCESS); - } - return false; + m_objectUtilManager->saveObjectToSD(object); + return true; } void FlightLogManager::updateFlightEntries(quint16 currentFlight) @@ -680,9 +676,17 @@ UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() void UAVOLogSettingsWrapper::reset(bool clear) { - setSetting(clear ? 0 : m_object->GetLoggingUpdateMode(m_object->getMetadata())); - setPeriod(clear ? 0 : m_object->getMetadata().loggingUpdatePeriod); - setDirty(false); + setSetting(m_object->GetLoggingUpdateMode(m_object->getMetadata())); + setPeriod(m_object->getMetadata().loggingUpdatePeriod); + if (clear) { + int oldSetting = setting(); + int oldPeriod = period(); + setSetting(0); + setPeriod(0); + setDirty(oldSetting != setting() || oldPeriod != period()); + } else { + setDirty(false); + } } UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode() diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 87f821701..7e17983ec 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -37,6 +37,7 @@ #include #include "uavobjectmanager.h" +#include "uavobjectutilmanager.h" #include "debuglogentry.h" #include "debuglogstatus.h" #include "debuglogsettings.h" @@ -316,6 +317,7 @@ private slots: private: UAVObjectManager *m_objectManager; + UAVObjectUtilManager *m_objectUtilManager; TelemetryManager *m_telemtryManager; DebugLogControl *m_flightLogControl; DebugLogStatus *m_flightLogStatus; From f95e6833e3ad0e7186f43e33bb3d5487caa42f03 Mon Sep 17 00:00:00 2001 From: m_thread Date: Thu, 20 Mar 2014 22:59:27 +0100 Subject: [PATCH 059/131] OP-1245 Uncrustify --- .../src/plugins/flightlog/flightlogmanager.cpp | 15 ++++++++++----- .../src/plugins/flightlog/flightlogmanager.h | 10 ++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index ac937d4c2..c0dd6f633 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -50,19 +50,19 @@ FlightLogManager::FlightLogManager(QObject *parent) : Q_ASSERT(pluginManager); - m_objectManager = pluginManager->getObject(); + m_objectManager = pluginManager->getObject(); Q_ASSERT(m_objectManager); - m_telemtryManager = pluginManager->getObject(); + m_telemtryManager = pluginManager->getObject(); Q_ASSERT(m_telemtryManager); m_objectUtilManager = pluginManager->getObject(); Q_ASSERT(m_objectUtilManager); - m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); + m_flightLogControl = DebugLogControl::GetInstance(m_objectManager); Q_ASSERT(m_flightLogControl); - m_flightLogStatus = DebugLogStatus::GetInstance(m_objectManager); + m_flightLogStatus = DebugLogStatus::GetInstance(m_objectManager); Q_ASSERT(m_flightLogStatus); connect(m_flightLogStatus, SIGNAL(FlightChanged(quint16)), this, SLOT(updateFlightEntries(quint16))); @@ -544,6 +544,7 @@ void FlightLogManager::setupUAVOWrappers() { foreach(QList objectList, m_objectManager->getObjects()) { UAVObject *object = objectList.at(0); + if (!object->isMetaDataObject() && !object->isSettingsObject()) { UAVOLogSettingsWrapper *wrapper = new UAVOLogSettingsWrapper(qobject_cast(object)); m_uavoEntries.append(wrapper); @@ -680,7 +681,7 @@ void UAVOLogSettingsWrapper::reset(bool clear) setPeriod(m_object->getMetadata().loggingUpdatePeriod); if (clear) { int oldSetting = setting(); - int oldPeriod = period(); + int oldPeriod = period(); setSetting(0); setPeriod(0); setDirty(oldSetting != setting() || oldPeriod != period()); @@ -694,12 +695,16 @@ UAVObject::UpdateMode UAVOLogSettingsWrapper::settingAsUpdateMode() switch (m_setting) { case 0: return UAVObject::UPDATEMODE_MANUAL; + case 1: return UAVObject::UPDATEMODE_PERIODIC; + case 2: return UAVObject::UPDATEMODE_ONCHANGE; + case 3: return UAVObject::UPDATEMODE_THROTTLED; + default: return UAVObject::UPDATEMODE_MANUAL; } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 7e17983ec..7fcf4c4d9 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -46,8 +46,7 @@ #include "uavtalk/telemetrymanager.h" class UAVOLogSettingsWrapper : public QObject { - Q_OBJECT - Q_PROPERTY(UAVDataObject *object READ object NOTIFY objectChanged) + Q_OBJECT Q_PROPERTY(UAVDataObject *object READ object NOTIFY objectChanged) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) @@ -91,7 +90,7 @@ public slots: void setSetting(int setting) { if (m_setting != setting) { - m_setting = setting; + m_setting = setting; setDirty(true); if (m_setting != 1 && m_setting != 3) { setPeriod(0); @@ -122,8 +121,8 @@ public slots: signals: void settingChanged(int setting); void nameChanged(QString name); - void periodChanged(int period); - void objectChanged(UAVDataObject * arg); + void periodChanged(int period); + void objectChanged(UAVDataObject *arg); void dirtyChanged(bool arg); @@ -132,7 +131,6 @@ private: int m_setting; int m_period; bool m_dirty; - }; class ExtendedDebugLogEntry : public DebugLogEntry { From 93cb920cef78a6025b7a940d479ad9c181cc3608 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 21 Mar 2014 18:30:39 +0100 Subject: [PATCH 060/131] OP-1255 Qt 5.2.1 upgrade : put back qt.conf generation to work around QTBUG-33254 --- make/tools.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/make/tools.mk b/make/tools.mk index 9b6d28491..8f2625839 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -485,8 +485,17 @@ endef ifeq ($(UNAME), Windows) QT_SDK_PREFIX := $(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH) + +# This additional configuration step should not be necessary +# but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254 +define QT_SDK_CONFIGURE_TEMPLATE + @$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(QT_SDK_DIR)) + $(V1) $(ECHO) $(QUOTE)[Paths]$(QUOTE) > $(QT_SDK_PREFIX)/bin/qt.conf + $(V1) $(ECHO) $(QUOTE)Prefix = $(QT_SDK_PREFIX)$(QUOTE) >> $(QT_SDK_PREFIX)/bin/qt.conf +endef + QT_BUILD_DIR := $(BUILD_DIR)/QT_BUILD - $(eval $(call WIN_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH))) + $(eval $(call WIN_QT_INSTALL_TEMPLATE,$(QT_BUILD_DIR),$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH),$(QT_SDK_CONFIGURE_TEMPLATE))) else ifeq ($(UNAME), Linux) From eed38b7f356329b82a561c091fa0126cb86206f9 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 21 Mar 2014 18:53:16 +0100 Subject: [PATCH 061/131] OP-1255 removed mingw_install and python_install make targets (obsolete since Qt 5.1.1. upgrade) --- Makefile | 2 -- make/tools.mk | 37 ++++++++----------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index e3945c951..e5748e4bc 100644 --- a/Makefile +++ b/Makefile @@ -864,8 +864,6 @@ help: @$(ECHO) " [Tool Installers]" @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain" @$(ECHO) " qt_sdk_install - Install the QT development tools" - @$(ECHO) " mingw_install - Install the MinGW toolchain (Windows only)" - @$(ECHO) " python_install - Install the Python interpreter (Windows only)" @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)" @$(ECHO) " sdl_install - Install the SDL library (Windows only)" @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)" diff --git a/make/tools.mk b/make/tools.mk index 8f2625839..ec06abb0e 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -265,7 +265,6 @@ define DOWNLOAD_TEMPLATE ) endef - ############################## # # Common tool install template @@ -548,62 +547,40 @@ qt_sdk_version: ifeq ($(UNAME), Windows) -#$(eval $(call TOOL_INSTALL_TEMPLATE,mingw,$(MINGW_DIR),$(MINGW_URL),$(notdir $(MINGW_URL)))) -mingw_install: -mingw_clean: -mingw_distclean: - ifeq ($(shell [ -d "$(MINGW_DIR)" ] && $(ECHO) "exists"), exists) # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename) export QTMINGW := $(MINGW_DIR)/bin export PATH := $(QTMINGW):$(PATH) else # not installed, use host gcc compiler - # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found (make mingw_install), using system PATH) + # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH) endif .PHONY: mingw_version -mingw_version: - -$(V1) gcc --version | head -n1 - -.PHONY: gcc_version -gcc_version: mingw_version +mingw_version: gcc_version else # Linux or Mac all_sdk_version: gcc_version +endif + .PHONY: gcc_version gcc_version: -$(V1) gcc --version | head -n1 -endif - ############################## # # Python # ############################## -ifeq ($(UNAME), Windows) - -#$(eval $(call TOOL_INSTALL_TEMPLATE,python,$(PYTHON_DIR),$(PYTHON_URL),$(notdir $(PYTHON_URL)))) -python_install: -python_clean: -python_distclean: - -else # Linux or Mac - -all_sdk_version: python_version - -endif - ifeq ($(shell [ -d "$(PYTHON_DIR)" ] && $(ECHO) "exists"), exists) export PYTHON := $(PYTHON_DIR)/python export PATH := $(PYTHON_DIR):$(PATH) else # not installed, hope it's in the path... - # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found (make python_install), using system PATH) + # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH) export PYTHON := python endif @@ -654,7 +631,8 @@ endif .PHONY: sdl_version sdl_version: - -$(V1) $(ECHO) "SDL 1.2.15 $(SDL_DIR)" + -$(V1) $(ECHO) "SDL 1.2.15" + endif ############################## @@ -678,6 +656,7 @@ endif .PHONY: openssl_version openssl_version: -$(V1) $(ECHO) "OpenSSL `$(OPENSSL) version`" + endif ############################## From 451279821355b33fb1da8af5e3d3fb63da633fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Chavarr=C3=ADa=20Krauser?= Date: Sat, 22 Mar 2014 12:52:49 +0100 Subject: [PATCH 062/131] OP-1271 Added a length and NULL pointer check in go_starting() to manage zero length reads/writes --- flight/pios/stm32f10x/pios_i2c.c | 15 ++++++++++++--- flight/pios/stm32f4xx/pios_i2c.c | 25 +++++++++++++------------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/flight/pios/stm32f10x/pios_i2c.c b/flight/pios/stm32f10x/pios_i2c.c index 4a95b7ee5..88eccb831 100644 --- a/flight/pios/stm32f10x/pios_i2c.c +++ b/flight/pios/stm32f10x/pios_i2c.c @@ -404,9 +404,18 @@ static void go_starting(struct pios_i2c_adapter *i2c_adapter) PIOS_DEBUG_Assert(i2c_adapter->active_txn >= i2c_adapter->first_txn); PIOS_DEBUG_Assert(i2c_adapter->active_txn <= i2c_adapter->last_txn); - i2c_adapter->active_byte = &(i2c_adapter->active_txn->buf[0]); - i2c_adapter->last_byte = &(i2c_adapter->active_txn->buf[i2c_adapter->active_txn->len - 1]); - + // check for an empty read/write + if (i2c_adapter->active_txn->buf != NULL && i2c_adapter->active_txn->len != 0) { + // Data available + i2c_adapter->active_byte = &(i2c_adapter->active_txn->buf[0]); + i2c_adapter->last_byte = &(i2c_adapter->active_txn->buf[i2c_adapter->active_txn->len - 1]); + } else { + // No Data available => Empty read/write + i2c_adapter->last_byte = NULL; + i2c_adapter->active_byte = i2c_adapter->last_byte + 1; + } + + I2C_GenerateSTART(i2c_adapter->cfg->regs, ENABLE); if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) { I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE); diff --git a/flight/pios/stm32f4xx/pios_i2c.c b/flight/pios/stm32f4xx/pios_i2c.c index 4a98cff33..eff4682fe 100644 --- a/flight/pios/stm32f4xx/pios_i2c.c +++ b/flight/pios/stm32f4xx/pios_i2c.c @@ -94,26 +94,19 @@ static void go_bus_error(struct pios_i2c_adapter *i2c_adapter); static void go_stopping(struct pios_i2c_adapter *i2c_adapter); static void go_stopped(struct pios_i2c_adapter *i2c_adapter); static void go_starting(struct pios_i2c_adapter *i2c_adapter); -static void go_r_any_txn_addr(struct pios_i2c_adapter *i2c_adapter); -static void go_r_more_txn_pre_one(struct pios_i2c_adapter *i2c_adapter); -static void go_r_any_txn_pre_first(struct pios_i2c_adapter *i2c_adapter); -static void go_r_any_txn_pre_middle(struct pios_i2c_adapter *i2c_adapter); -static void go_r_more_txn_pre_last(struct pios_i2c_adapter *i2c_adapter); -static void go_r_any_txn_post_last(struct pios_i2c_adapter *i2c_adapter); static void go_r_any_txn_addr(struct pios_i2c_adapter *i2c_adapter); +static void go_r_more_txn_pre_one(struct pios_i2c_adapter *i2c_adapter); static void go_r_last_txn_pre_one(struct pios_i2c_adapter *i2c_adapter); static void go_r_any_txn_pre_first(struct pios_i2c_adapter *i2c_adapter); static void go_r_any_txn_pre_middle(struct pios_i2c_adapter *i2c_adapter); static void go_r_last_txn_pre_last(struct pios_i2c_adapter *i2c_adapter); +static void go_r_more_txn_pre_last(struct pios_i2c_adapter *i2c_adapter); static void go_r_any_txn_post_last(struct pios_i2c_adapter *i2c_adapter); static void go_w_any_txn_addr(struct pios_i2c_adapter *i2c_adapter); static void go_w_any_txn_middle(struct pios_i2c_adapter *i2c_adapter); static void go_w_more_txn_last(struct pios_i2c_adapter *i2c_adapter); - -static void go_w_any_txn_addr(struct pios_i2c_adapter *i2c_adapter); -static void go_w_any_txn_middle(struct pios_i2c_adapter *i2c_adapter); static void go_w_last_txn_last(struct pios_i2c_adapter *i2c_adapter); static void go_nack(struct pios_i2c_adapter *i2c_adapter); @@ -414,9 +407,17 @@ static void go_starting(struct pios_i2c_adapter *i2c_adapter) PIOS_DEBUG_Assert(i2c_adapter->active_txn >= i2c_adapter->first_txn); PIOS_DEBUG_Assert(i2c_adapter->active_txn <= i2c_adapter->last_txn); - i2c_adapter->active_byte = &(i2c_adapter->active_txn->buf[0]); - i2c_adapter->last_byte = &(i2c_adapter->active_txn->buf[i2c_adapter->active_txn->len - 1]); - + // check for an empty read/write + if (i2c_adapter->active_txn->buf != NULL && i2c_adapter->active_txn->len != 0) { + // Data available + i2c_adapter->active_byte = &(i2c_adapter->active_txn->buf[0]); + i2c_adapter->last_byte = &(i2c_adapter->active_txn->buf[i2c_adapter->active_txn->len - 1]); + } else { + // No Data available => Empty read/write + i2c_adapter->last_byte = NULL; + i2c_adapter->active_byte = i2c_adapter->last_byte + 1; + } + I2C_GenerateSTART(i2c_adapter->cfg->regs, ENABLE); if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) { I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE); From ea665d127074a185a0ffff2e90774c7f4fdadd87 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Sat, 22 Mar 2014 18:44:47 +0100 Subject: [PATCH 063/131] OP-1272 Fix STM32F4 Watchdog in debug mode --- flight/pios/stm32f4xx/pios_wdg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/pios/stm32f4xx/pios_wdg.c b/flight/pios/stm32f4xx/pios_wdg.c index ab34a03ed..f8f85db3d 100644 --- a/flight/pios/stm32f4xx/pios_wdg.c +++ b/flight/pios/stm32f4xx/pios_wdg.c @@ -73,7 +73,7 @@ uint16_t PIOS_WDG_Init() delay = 0x0fff; } #if defined(PIOS_INCLUDE_WDG) - DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE); // make the watchdog stop counting in debug mode + DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); // OP-1272 : write in APB1 register IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_SetPrescaler(IWDG_Prescaler_16); IWDG_SetReload(delay); From 10dec58a1095a285de1fd4699dc913558ea406e5 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Sun, 23 Mar 2014 12:56:01 +0100 Subject: [PATCH 064/131] OP-1267 Fix UAV position after a HomeLocation Update --- .../modules/StateEstimation/stateestimation.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index bff326c87..db05edc59 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -119,7 +120,7 @@ static DelayedCallbackInfo *stateEstimationCallback; static volatile RevoSettingsData revoSettings; static volatile sensorUpdates updatedSensors; -static int32_t fusionAlgorithm = -1; +static volatile int32_t fusionAlgorithm = -1; static filterPipeline *filterChain = NULL; // different filters available to state estimation @@ -213,6 +214,7 @@ static const filterPipeline *ekf13Queue = &(filterPipeline) { static void settingsUpdatedCb(UAVObjEvent *objEv); static void sensorUpdatedCb(UAVObjEvent *objEv); +static void homeLocationUpdatedCb(UAVObjEvent *objEv); static void StateEstimationCb(void); static inline int32_t maxint32_t(int32_t a, int32_t b) @@ -238,6 +240,8 @@ int32_t StateEstimationInitialize(void) GPSVelocitySensorInitialize(); GPSPositionSensorInitialize(); + HomeLocationInitialize(); + GyroStateInitialize(); AccelStateInitialize(); MagStateInitialize(); @@ -247,6 +251,8 @@ int32_t StateEstimationInitialize(void) RevoSettingsConnectCallback(&settingsUpdatedCb); + HomeLocationConnectCallback(&homeLocationUpdatedCb); + GyroSensorConnectCallback(&sensorUpdatedCb); AccelSensorConnectCallback(&sensorUpdatedCb); MagSensorConnectCallback(&sensorUpdatedCb); @@ -477,6 +483,17 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) RevoSettingsGet((RevoSettingsData *)&revoSettings); } +/** + * Callback for eventdispatcher when HomeLocation has been updated + */ +static void homeLocationUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) +{ + // Set fusionAlgorithm to -2 to force a filter init (necessary for LLA filter) + // This value force a filter init only when disarmed + fusionAlgorithm = -2; +} + + /** * Callback for eventdispatcher when any sensor UAVObject has been updated * updates the list of "recently updated UAVObjects" and dispatches the state estimator callback From 2d52720a87608fd6c4d560b0a8f3fe9bfe19cff3 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sun, 23 Mar 2014 16:53:17 +0100 Subject: [PATCH 065/131] OP-1263 fixed minor memory leak introduced during SDL refactoring --- ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp index 082081b0f..811bbf7ce 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp @@ -61,6 +61,8 @@ SDLGamepad::~SDLGamepad() } SDL_Quit(); + + delete priv; } /**********************************************************************/ From fc30ababf0d5327d04a8ecbd0f155344548cafb6 Mon Sep 17 00:00:00 2001 From: Cosimo Corrado Date: Sun, 23 Mar 2014 22:07:09 +0100 Subject: [PATCH 066/131] use fabsf instead abs --- flight/modules/Sensors/sensors.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index 5c1f38aea..aad801cbc 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -454,11 +454,11 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv) mag_scale[2] = cal.mag_scale.Z; accel_temp_calibrated = (agcal.temp_calibrated_extent.max - agcal.temp_calibrated_extent.min > .1f) && - (abs(agcal.accel_temp_coeff.X) > 1e-9f || abs(agcal.accel_temp_coeff.Y) > 1e-9f || abs(agcal.accel_temp_coeff.Z) > 1e-9f); + (fabsf(agcal.accel_temp_coeff.X) > 1e-9f || fabsf(agcal.accel_temp_coeff.Y) > 1e-9f || fabsf(agcal.accel_temp_coeff.Z) > 1e-9f); gyro_temp_calibrated = (agcal.temp_calibrated_extent.max - agcal.temp_calibrated_extent.min > .1f) && - (abs(agcal.gyro_temp_coeff.X) > 1e-9f || abs(agcal.gyro_temp_coeff.Y) > 1e-9f || - abs(agcal.gyro_temp_coeff.Z) > 1e-9f || abs(agcal.gyro_temp_coeff.Z2) > 1e-9f); + (fabsf(agcal.gyro_temp_coeff.X) > 1e-9f || fabsf(agcal.gyro_temp_coeff.Y) > 1e-9f || + fabsf(agcal.gyro_temp_coeff.Z) > 1e-9f || fabsf(agcal.gyro_temp_coeff.Z2) > 1e-9f); AttitudeSettingsData attitudeSettings; From f8f53d880155bd8ed5e9f687243816a4fbe44284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Chavarr=C3=ADa=20Krauser?= Date: Tue, 25 Mar 2014 09:18:25 +0100 Subject: [PATCH 067/131] OP-1273 Adaptations to include MS4525DO PixHawk speed sensor --- flight/modules/Airspeed/airspeed.c | 7 +++++++ flight/pios/pios.h | 6 ++++++ .../targets/boards/revolution/firmware/inc/pios_config.h | 2 ++ flight/targets/boards/revolution/pios_board.h | 1 + make/apps-defs.mk | 1 + shared/uavobjectdefinition/airspeedsensor.xml | 4 ++++ shared/uavobjectdefinition/airspeedsettings.xml | 2 +- 7 files changed, 22 insertions(+), 1 deletion(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index 395cee43a..078aef03f 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -41,6 +41,7 @@ #include "hwsettings.h" #include "airspeedsettings.h" #include "airspeedsensor.h" // object that will be updated by the module +#include "baro_airspeed_ms4525do.h" #include "baro_airspeed_etasv3.h" #include "baro_airspeed_mpxv.h" #include "gps_airspeed.h" @@ -165,6 +166,12 @@ static void airspeedTask(__attribute__((unused)) void *parameters) // Eagletree Airspeed v3 baro_airspeedGetETASV3(&airspeedData, &airspeedSettings); break; +#endif +#if defined(PIOS_INCLUDE_MS4525DO) + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: + // PixHawk Airpeed based on MS4525DO + baro_airspeedGetMS4525DO(&airspeedData, &airspeedSettings); + break; #endif case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_GROUNDSPEEDBASEDWINDESTIMATION: gps_airspeedGet(&airspeedData, &airspeedSettings); diff --git a/flight/pios/pios.h b/flight/pios/pios.h index 15cdc294e..2142f8224 100644 --- a/flight/pios/pios.h +++ b/flight/pios/pios.h @@ -229,6 +229,12 @@ #include #endif +#ifdef PIOS_INCLUDE_MS4525DO +/* PixHawk Airspeed Sensor based on MS4525DO */ +#include +#endif + + #ifdef PIOS_INCLUDE_HCSR04 /* HC-SR04 Ultrasonic Sensor */ #include diff --git a/flight/targets/boards/revolution/firmware/inc/pios_config.h b/flight/targets/boards/revolution/firmware/inc/pios_config.h index 6ad54cc7e..c60e9a453 100644 --- a/flight/targets/boards/revolution/firmware/inc/pios_config.h +++ b/flight/targets/boards/revolution/firmware/inc/pios_config.h @@ -87,6 +87,8 @@ #define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MPXV #define PIOS_INCLUDE_ETASV3 +#define PIOS_INCLUDE_MS4525DO + /* #define PIOS_INCLUDE_HCSR04 */ /* PIOS receiver drivers */ diff --git a/flight/targets/boards/revolution/pios_board.h b/flight/targets/boards/revolution/pios_board.h index de47db80a..60d3cff53 100644 --- a/flight/targets/boards/revolution/pios_board.h +++ b/flight/targets/boards/revolution/pios_board.h @@ -125,6 +125,7 @@ extern uint32_t pios_i2c_mag_pressure_adapter_id; extern uint32_t pios_i2c_flexiport_adapter_id; #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) +#define PIOS_I2C_MS4525DO_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) // ------------------------- // PIOS_USART diff --git a/make/apps-defs.mk b/make/apps-defs.mk index bb5376223..20853c568 100644 --- a/make/apps-defs.mk +++ b/make/apps-defs.mk @@ -69,6 +69,7 @@ SRC += $(PIOSCOMMON)/pios_i2c_esc.c SRC += $(PIOSCOMMON)/pios_l3gd20.c SRC += $(PIOSCOMMON)/pios_mpu6000.c SRC += $(PIOSCOMMON)/pios_mpxv.c +SRC += $(PIOSCOMMON)/pios_ms4525do.c SRC += $(PIOSCOMMON)/pios_ms5611.c SRC += $(PIOSCOMMON)/pios_oplinkrcvr.c SRC += $(PIOSCOMMON)/pios_video.c diff --git a/shared/uavobjectdefinition/airspeedsensor.xml b/shared/uavobjectdefinition/airspeedsensor.xml index 8f55cbeae..f61cb63fc 100644 --- a/shared/uavobjectdefinition/airspeedsensor.xml +++ b/shared/uavobjectdefinition/airspeedsensor.xml @@ -3,7 +3,11 @@ The raw data from the dynamic pressure sensor with pressure, temperature and airspeed. + + + + diff --git a/shared/uavobjectdefinition/airspeedsettings.xml b/shared/uavobjectdefinition/airspeedsettings.xml index 3ed136b16..ea09bba2d 100644 --- a/shared/uavobjectdefinition/airspeedsettings.xml +++ b/shared/uavobjectdefinition/airspeedsettings.xml @@ -4,7 +4,7 @@ - + From 58168538129da7d05bf700b08e39c004e0744f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Chavarr=C3=ADa=20Krauser?= Date: Tue, 25 Mar 2014 09:24:08 +0100 Subject: [PATCH 068/131] OP-1273 New files for the MS4525DO PixHawk speed sensor: PIOS files and module files --- .../modules/Airspeed/baro_airspeed_ms4525do.c | 174 ++++++++++++++++++ .../Airspeed/inc/baro_airspeed_ms4525do.h | 43 +++++ flight/pios/common/pios_ms4525do.c | 127 +++++++++++++ flight/pios/inc/pios_ms4525do.h | 45 +++++ 4 files changed, 389 insertions(+) create mode 100644 flight/modules/Airspeed/baro_airspeed_ms4525do.c create mode 100644 flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h create mode 100644 flight/pios/common/pios_ms4525do.c create mode 100644 flight/pios/inc/pios_ms4525do.h diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c new file mode 100644 index 000000000..ea8480e0b --- /dev/null +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -0,0 +1,174 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Communicate with airspeed sensors and return values + * @{ + * + * @file baro_airspeed_ms4525do.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module, handles temperature and pressure readings from MS4525DO + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * Output object: BaroAirspeed + * + * This module will periodically update the value of the BaroAirspeed object. + * + */ + +#include "openpilot.h" +#include "hwsettings.h" +#include "airspeedsettings.h" +#include "airspeedsensor.h" // object that will be updated by the module +#include "taskinfo.h" + +#if defined(PIOS_INCLUDE_MS4525DO) + +#define CALIBRATION_IDLE_MS 0 // Time to wait before calibrating, in [ms] +#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] +#define FILTER_SHIFT 5 // Barry Dorr filter parameter k + +#define P0 101325.0f // standard pressure +#define CCEXPONENT 0.2857142857f // exponent of compressibility correction 2/7 +#define CASFACTOR 760.8802669f // sqrt(5) * speed of sound at standard +#define TASFACTOR 0.05891022589f // 1/sqrt(T0) + +#define max(x,y) ((x)>=(y) ? (x) : (y)) + +// Private types + +// Private functions +static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); + + +// Private variables +static uint16_t calibrationCount = 0; +static uint32_t filter_reg; // Barry Dorr filter register + + +void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) +{ + // request measurement first + int8_t retVal = PIOS_MS4525DO_Request(); + + if( retVal !=0 ){ + AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + return; + } + + // Datasheet of MS4525DO: conversion needs 0.5 ms + 20% more when status bit used + // delay by one Tick or at least 2 ms + const portTickType xDelay = max(2 / portTICK_RATE_MS, 1); + vTaskDelay( xDelay ); + + // read the sensor + retVal = baro_airspeedReadMS4525DO(airspeedSensor,airspeedSettings); + + switch( retVal ){ + case 0 : AlarmsClear(SYSTEMALARMS_ALARM_I2C); + break; + case -4 : + case -5 : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + break; + case -1 : + case -2 : + case -3 : + case -6 : + default : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + } +} + + +static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) +{ + // Check to see if airspeed sensor is returning airspeedSensor + uint16_t values[2]; + int8_t retVal=PIOS_MS4525DO_Read(values); + + if( retVal == 0 ){ + airspeedSensor->SensorValue = values[0]; + airspeedSensor->SensorValueTemperature = values[1]; + } else { + airspeedSensor->SensorValue = -1; + airspeedSensor->SensorValueTemperature = -1; + airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + airspeedSensor->CalibratedAirspeed = 0; + return retVal; + } + + // only calibrate if no stored calibration is available + if ( !airspeedSettings->ZeroPoint ) { + // Calibrate sensor by averaging zero point value + if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { + calibrationCount++; + filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT ); + + return retVal; + } else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { + calibrationCount++; + // update filter register + filter_reg = filter_reg - ( filter_reg >> FILTER_SHIFT ) + airspeedSensor->SensorValue; + + if (calibrationCount > (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { + // Scale output for unity gain. + airspeedSettings->ZeroPoint = (uint16_t)( filter_reg >> FILTER_SHIFT ); + + AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint); + calibrationCount = 0; + } + return retVal; + } + } + + /* Compute airspeed + assume sensor is A Type and has a range of 1 psi, i.e. Pmin=-1.0 psi and Pmax=1.0 psi + Datasheet pressure: output = 0.8 * 16383 / (Pmax-Pmin) * (P - Pmin) + 0.1 * 16383 + Inversion: P = (10*output - 81915)/65532 in psi + 1 psi = 6894,757293168 Pa + P = (10*output - 81915)*0.1052120688 in Pa + Datasheet temperature: output = (T+50)*2047 / 200 + Inversion: T = (200*out - 102350)/2047 in C + T = (200*out - 102350)/2047 + 273.15 in K + */ + const float dP = ( 10*(int32_t)(airspeedSensor->SensorValue-airspeedSettings->ZeroPoint) ) * 0.1052120688f; + const float T = (float)( 200*(int32_t)airspeedSensor->SensorValueTemperature - 102350) / 2047 + 273.15f; + + airspeedSensor->DifferentialPressure = dP; + airspeedSensor->Temperature = T; + // CAS = Csound * sqrt( 5 *( (dP/P0 +1)^(2/7) - 1) ) + // TAS = Csound * sqrt( 5 T/T0 *( (dP/P0 +1)^(2/7) - 1) ) + // where Csound = 340.276 m/s at standard condition T0=288.15 K and P0 = 101315 Pa + airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * CASFACTOR * sqrtf( powf( fabsf(dP) / P0 + 1.0f , CCEXPONENT ) - 1.0f ); + airspeedSensor->TrueAirspeed = airspeedSensor->CalibratedAirspeed * TASFACTOR * sqrtf( T ); + airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; + + return retVal; +} + + +#endif /* if defined(PIOS_INCLUDE_MS4525DO) */ + +/** + * @} + * @} + */ diff --git a/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h b/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h new file mode 100644 index 000000000..5cbcc9111 --- /dev/null +++ b/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Calculate airspeed from measurements of differential pressure from a MS4525DO (PixHawk airspeed sensor) + * @{ + * + * @file baro_airspeed_mas4525do.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module, reads temperature and pressure from MS4525DO + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef BARO_AIRSPEED_MS4525DO_H +#define BARO_AIRSPEED_MS4525DO_H +#if defined(PIOS_INCLUDE_MS4525DO) + +void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); + +#endif /* PIOS_INCLUDE_MS4525DO */ +#endif // BARO_AIRSPEED_MS4525DO_H + +/** + * @} + * @} + */ diff --git a/flight/pios/common/pios_ms4525do.c b/flight/pios/common/pios_ms4525do.c new file mode 100644 index 000000000..f331453aa --- /dev/null +++ b/flight/pios/common/pios_ms4525do.c @@ -0,0 +1,127 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_MS4525DO MS4525DO Functions + * @brief Hardware functions to deal with the PixHawk Airspeed Sensor based on MS4525DO + * @{ + * + * @file pios_ms4525do.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief PixHawk MS4525DO Airspeed Sensor Driver + * @see The GNU Public License (GPL) Version 3 + * + ******************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "pios.h" + +#ifdef PIOS_INCLUDE_MS4525DO + +/* Local Defs and Variables */ +static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len); +static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len); + +static bool pios_ms4525do_requested = false; + + + +static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len) +{ + const struct pios_i2c_txn txn_list[] = { + { + .info = __func__, + .addr = MS4525DO_I2C_ADDR, + .rw = PIOS_I2C_TXN_READ, + .len = len, + .buf = buffer, + } + }; + + return PIOS_I2C_Transfer(PIOS_I2C_MS4525DO_ADAPTER, txn_list, NELEMENTS(txn_list)); +} + + +static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len) +{ + const struct pios_i2c_txn txn_list[] = { + { + .info = __func__, + .addr = MS4525DO_I2C_ADDR, + .rw = PIOS_I2C_TXN_WRITE, + .len = len, + .buf = buffer, + } + }; + + return PIOS_I2C_Transfer(PIOS_I2C_MS4525DO_ADAPTER, txn_list, NELEMENTS(txn_list)); +} + + + +int8_t PIOS_MS4525DO_Request(void) +{ + // MS4525DO expects a zero length write. + // Sending one byte is a workaround that works for the moment + uint8_t data=0; + int8_t retVal=PIOS_MS4525DO_WriteI2C(&data,sizeof(data)); + /* requested only when transfer worked */ + pios_ms4525do_requested = ( retVal == 0 ); + + return retVal; +} + + +// values has to ba an arrray with two elements +// values stay untouched on error +int8_t PIOS_MS4525DO_Read(uint16_t *values) +{ + if (!pios_ms4525do_requested) { + /* Do not try to read when not requested */ + /* else probably stale data will be obtained */ + return -4; + } + + uint8_t data[4]; + int8_t retVal=PIOS_MS4525DO_ReadI2C(data, sizeof(data)); + + uint8_t status = data[0] & 0xC0; + if (status == 0x80) { + /* stale data */ + return -5; + } else if (status == 0xC0) { + /* device probably broken */ + return -6; + } + + /* differential pressure */ + values[0] = (data[0] << 8); + values[0] += data[1]; + + /* temperature */ + values[1] = (data[2] << 8); + values[1] += data[3]; + values[1] = (values[1] >> 5); + + /* not requested anymore, only when transfer worked */ + pios_ms4525do_requested = !( retVal == 0 ); + + return retVal; +} + +#endif /* PIOS_INCLUDE_MS4525DO */ diff --git a/flight/pios/inc/pios_ms4525do.h b/flight/pios/inc/pios_ms4525do.h new file mode 100644 index 000000000..1bf8778a5 --- /dev/null +++ b/flight/pios/inc/pios_ms4525do.h @@ -0,0 +1,45 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_MS4525DO MS4525DO Functions + * @brief Hardware functions to deal with the PixHawk Airspeed Sensor based on MS4525DO + * @{ + * + * @file pios_ms4525do.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief PixHawk MS4525DO Airspeed Sensor Driver + * @see The GNU Public License (GPL) Version 3 + * + ******************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_MS4525DO_H +#define PIOS_MS4525DO_H + +// Interface Type I chip +#define MS4525DO_I2C_ADDR 0x28 +// Interface Type J chip +/* #define MS4525DO_I2C_ADDR 0x36 */ +// Interface Type K chip +/* #define MS4525DO_I2C_ADDR 0x46 */ + + +extern int8_t PIOS_MS4525DO_Request(void); +extern int8_t PIOS_MS4525DO_Read(uint16_t *values); + +#endif /* PIOS_MS4525DO_H */ From 4dff86dc9cc6e0da0929200eb3fd193fa2a41ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Chavarr=C3=ADa=20Krauser?= Date: Tue, 25 Mar 2014 09:24:08 +0100 Subject: [PATCH 069/131] OP-1273 New files for the MS4525DO PixHawk speed sensor: PIOS files and module files --- .../modules/Airspeed/baro_airspeed_ms4525do.c | 174 ++++++++++++++++++ .../Airspeed/inc/baro_airspeed_ms4525do.h | 43 +++++ flight/pios/common/pios_ms4525do.c | 127 +++++++++++++ flight/pios/inc/pios_ms4525do.h | 45 +++++ 4 files changed, 389 insertions(+) create mode 100644 flight/modules/Airspeed/baro_airspeed_ms4525do.c create mode 100644 flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h create mode 100644 flight/pios/common/pios_ms4525do.c create mode 100644 flight/pios/inc/pios_ms4525do.h diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c new file mode 100644 index 000000000..ea8480e0b --- /dev/null +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -0,0 +1,174 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Communicate with airspeed sensors and return values + * @{ + * + * @file baro_airspeed_ms4525do.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module, handles temperature and pressure readings from MS4525DO + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * Output object: BaroAirspeed + * + * This module will periodically update the value of the BaroAirspeed object. + * + */ + +#include "openpilot.h" +#include "hwsettings.h" +#include "airspeedsettings.h" +#include "airspeedsensor.h" // object that will be updated by the module +#include "taskinfo.h" + +#if defined(PIOS_INCLUDE_MS4525DO) + +#define CALIBRATION_IDLE_MS 0 // Time to wait before calibrating, in [ms] +#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] +#define FILTER_SHIFT 5 // Barry Dorr filter parameter k + +#define P0 101325.0f // standard pressure +#define CCEXPONENT 0.2857142857f // exponent of compressibility correction 2/7 +#define CASFACTOR 760.8802669f // sqrt(5) * speed of sound at standard +#define TASFACTOR 0.05891022589f // 1/sqrt(T0) + +#define max(x,y) ((x)>=(y) ? (x) : (y)) + +// Private types + +// Private functions +static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); + + +// Private variables +static uint16_t calibrationCount = 0; +static uint32_t filter_reg; // Barry Dorr filter register + + +void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) +{ + // request measurement first + int8_t retVal = PIOS_MS4525DO_Request(); + + if( retVal !=0 ){ + AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + return; + } + + // Datasheet of MS4525DO: conversion needs 0.5 ms + 20% more when status bit used + // delay by one Tick or at least 2 ms + const portTickType xDelay = max(2 / portTICK_RATE_MS, 1); + vTaskDelay( xDelay ); + + // read the sensor + retVal = baro_airspeedReadMS4525DO(airspeedSensor,airspeedSettings); + + switch( retVal ){ + case 0 : AlarmsClear(SYSTEMALARMS_ALARM_I2C); + break; + case -4 : + case -5 : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + break; + case -1 : + case -2 : + case -3 : + case -6 : + default : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + } +} + + +static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) +{ + // Check to see if airspeed sensor is returning airspeedSensor + uint16_t values[2]; + int8_t retVal=PIOS_MS4525DO_Read(values); + + if( retVal == 0 ){ + airspeedSensor->SensorValue = values[0]; + airspeedSensor->SensorValueTemperature = values[1]; + } else { + airspeedSensor->SensorValue = -1; + airspeedSensor->SensorValueTemperature = -1; + airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + airspeedSensor->CalibratedAirspeed = 0; + return retVal; + } + + // only calibrate if no stored calibration is available + if ( !airspeedSettings->ZeroPoint ) { + // Calibrate sensor by averaging zero point value + if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { + calibrationCount++; + filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT ); + + return retVal; + } else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { + calibrationCount++; + // update filter register + filter_reg = filter_reg - ( filter_reg >> FILTER_SHIFT ) + airspeedSensor->SensorValue; + + if (calibrationCount > (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { + // Scale output for unity gain. + airspeedSettings->ZeroPoint = (uint16_t)( filter_reg >> FILTER_SHIFT ); + + AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint); + calibrationCount = 0; + } + return retVal; + } + } + + /* Compute airspeed + assume sensor is A Type and has a range of 1 psi, i.e. Pmin=-1.0 psi and Pmax=1.0 psi + Datasheet pressure: output = 0.8 * 16383 / (Pmax-Pmin) * (P - Pmin) + 0.1 * 16383 + Inversion: P = (10*output - 81915)/65532 in psi + 1 psi = 6894,757293168 Pa + P = (10*output - 81915)*0.1052120688 in Pa + Datasheet temperature: output = (T+50)*2047 / 200 + Inversion: T = (200*out - 102350)/2047 in C + T = (200*out - 102350)/2047 + 273.15 in K + */ + const float dP = ( 10*(int32_t)(airspeedSensor->SensorValue-airspeedSettings->ZeroPoint) ) * 0.1052120688f; + const float T = (float)( 200*(int32_t)airspeedSensor->SensorValueTemperature - 102350) / 2047 + 273.15f; + + airspeedSensor->DifferentialPressure = dP; + airspeedSensor->Temperature = T; + // CAS = Csound * sqrt( 5 *( (dP/P0 +1)^(2/7) - 1) ) + // TAS = Csound * sqrt( 5 T/T0 *( (dP/P0 +1)^(2/7) - 1) ) + // where Csound = 340.276 m/s at standard condition T0=288.15 K and P0 = 101315 Pa + airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * CASFACTOR * sqrtf( powf( fabsf(dP) / P0 + 1.0f , CCEXPONENT ) - 1.0f ); + airspeedSensor->TrueAirspeed = airspeedSensor->CalibratedAirspeed * TASFACTOR * sqrtf( T ); + airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; + + return retVal; +} + + +#endif /* if defined(PIOS_INCLUDE_MS4525DO) */ + +/** + * @} + * @} + */ diff --git a/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h b/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h new file mode 100644 index 000000000..5cbcc9111 --- /dev/null +++ b/flight/modules/Airspeed/inc/baro_airspeed_ms4525do.h @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Calculate airspeed from measurements of differential pressure from a MS4525DO (PixHawk airspeed sensor) + * @{ + * + * @file baro_airspeed_mas4525do.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module, reads temperature and pressure from MS4525DO + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef BARO_AIRSPEED_MS4525DO_H +#define BARO_AIRSPEED_MS4525DO_H +#if defined(PIOS_INCLUDE_MS4525DO) + +void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); + +#endif /* PIOS_INCLUDE_MS4525DO */ +#endif // BARO_AIRSPEED_MS4525DO_H + +/** + * @} + * @} + */ diff --git a/flight/pios/common/pios_ms4525do.c b/flight/pios/common/pios_ms4525do.c new file mode 100644 index 000000000..f331453aa --- /dev/null +++ b/flight/pios/common/pios_ms4525do.c @@ -0,0 +1,127 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_MS4525DO MS4525DO Functions + * @brief Hardware functions to deal with the PixHawk Airspeed Sensor based on MS4525DO + * @{ + * + * @file pios_ms4525do.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief PixHawk MS4525DO Airspeed Sensor Driver + * @see The GNU Public License (GPL) Version 3 + * + ******************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "pios.h" + +#ifdef PIOS_INCLUDE_MS4525DO + +/* Local Defs and Variables */ +static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len); +static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len); + +static bool pios_ms4525do_requested = false; + + + +static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len) +{ + const struct pios_i2c_txn txn_list[] = { + { + .info = __func__, + .addr = MS4525DO_I2C_ADDR, + .rw = PIOS_I2C_TXN_READ, + .len = len, + .buf = buffer, + } + }; + + return PIOS_I2C_Transfer(PIOS_I2C_MS4525DO_ADAPTER, txn_list, NELEMENTS(txn_list)); +} + + +static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len) +{ + const struct pios_i2c_txn txn_list[] = { + { + .info = __func__, + .addr = MS4525DO_I2C_ADDR, + .rw = PIOS_I2C_TXN_WRITE, + .len = len, + .buf = buffer, + } + }; + + return PIOS_I2C_Transfer(PIOS_I2C_MS4525DO_ADAPTER, txn_list, NELEMENTS(txn_list)); +} + + + +int8_t PIOS_MS4525DO_Request(void) +{ + // MS4525DO expects a zero length write. + // Sending one byte is a workaround that works for the moment + uint8_t data=0; + int8_t retVal=PIOS_MS4525DO_WriteI2C(&data,sizeof(data)); + /* requested only when transfer worked */ + pios_ms4525do_requested = ( retVal == 0 ); + + return retVal; +} + + +// values has to ba an arrray with two elements +// values stay untouched on error +int8_t PIOS_MS4525DO_Read(uint16_t *values) +{ + if (!pios_ms4525do_requested) { + /* Do not try to read when not requested */ + /* else probably stale data will be obtained */ + return -4; + } + + uint8_t data[4]; + int8_t retVal=PIOS_MS4525DO_ReadI2C(data, sizeof(data)); + + uint8_t status = data[0] & 0xC0; + if (status == 0x80) { + /* stale data */ + return -5; + } else if (status == 0xC0) { + /* device probably broken */ + return -6; + } + + /* differential pressure */ + values[0] = (data[0] << 8); + values[0] += data[1]; + + /* temperature */ + values[1] = (data[2] << 8); + values[1] += data[3]; + values[1] = (values[1] >> 5); + + /* not requested anymore, only when transfer worked */ + pios_ms4525do_requested = !( retVal == 0 ); + + return retVal; +} + +#endif /* PIOS_INCLUDE_MS4525DO */ diff --git a/flight/pios/inc/pios_ms4525do.h b/flight/pios/inc/pios_ms4525do.h new file mode 100644 index 000000000..1bf8778a5 --- /dev/null +++ b/flight/pios/inc/pios_ms4525do.h @@ -0,0 +1,45 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_MS4525DO MS4525DO Functions + * @brief Hardware functions to deal with the PixHawk Airspeed Sensor based on MS4525DO + * @{ + * + * @file pios_ms4525do.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief PixHawk MS4525DO Airspeed Sensor Driver + * @see The GNU Public License (GPL) Version 3 + * + ******************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PIOS_MS4525DO_H +#define PIOS_MS4525DO_H + +// Interface Type I chip +#define MS4525DO_I2C_ADDR 0x28 +// Interface Type J chip +/* #define MS4525DO_I2C_ADDR 0x36 */ +// Interface Type K chip +/* #define MS4525DO_I2C_ADDR 0x46 */ + + +extern int8_t PIOS_MS4525DO_Request(void); +extern int8_t PIOS_MS4525DO_Read(uint16_t *values); + +#endif /* PIOS_MS4525DO_H */ From 199193aa3f4375e3b5ce98bd2cfee0ade6ec0a3b Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Tue, 25 Mar 2014 21:00:10 +0100 Subject: [PATCH 070/131] OP-1267 Fix UAV position after a HomeLocation Update (adding #define to be clearer) --- .../modules/StateEstimation/stateestimation.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index db05edc59..1eca88c4c 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -56,10 +56,14 @@ #include "CoordinateConversions.h" // Private constants -#define STACK_SIZE_BYTES 256 -#define CALLBACK_PRIORITY CALLBACK_PRIORITY_REGULAR -#define TASK_PRIORITY CALLBACK_TASK_FLIGHTCONTROL -#define TIMEOUT_MS 10 +#define STACK_SIZE_BYTES 256 +#define CALLBACK_PRIORITY CALLBACK_PRIORITY_REGULAR +#define TASK_PRIORITY CALLBACK_TASK_FLIGHTCONTROL +#define TIMEOUT_MS 10 + +// Private filter init const +#define FILTER_INIT_FORCE -1 +#define FILTER_INIT_IF_POSSIBLE -2 // local macros, ONLY to be used in the middle of StateEstimationCb in section RUNSTATE_LOAD after the update of states updated! #define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_3_DIMENSIONS(sensorname, shortname, a1, a2, a3) \ @@ -335,7 +339,7 @@ static void StateEstimationCb(void) if (fusionAlgorithm != revoSettings.FusionAlgorithm) { FlightStatusData fs; FlightStatusGet(&fs); - if (fs.Armed == FLIGHTSTATUS_ARMED_DISARMED || fusionAlgorithm == -1) { + if (fs.Armed == FLIGHTSTATUS_ARMED_DISARMED || fusionAlgorithm == FILTER_INIT_FORCE) { const filterPipeline *newFilterChain; switch (revoSettings.FusionAlgorithm) { case REVOSETTINGS_FUSIONALGORITHM_COMPLEMENTARY: @@ -488,9 +492,9 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) */ static void homeLocationUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) { - // Set fusionAlgorithm to -2 to force a filter init (necessary for LLA filter) - // This value force a filter init only when disarmed - fusionAlgorithm = -2; + // Ask for a filter init (necessary for LLA filter) + // Only possible if disarmed + fusionAlgorithm = FILTER_INIT_IF_POSSIBLE; } From 9d30673d18d38c060c3a9474439631729a44e4f5 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Wed, 26 Mar 2014 09:15:56 +0100 Subject: [PATCH 071/131] OP-1273 attitude estimation uses airspeedSensor.TrueAirspeed when available (e.g. from MS4525DO; available when TrueAirspeed >=0 ) instead of using an altitude correction IAS2TAS(alt). When not available it falls back to IAS2TAS(alt) --- flight/modules/Attitude/revolution/attitude.c | 5 +++-- flight/modules/StateEstimation/filterair.c | 2 +- .../modules/StateEstimation/stateestimation.c | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index d502d1c8b..0ca789199 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -650,7 +650,7 @@ static int32_t updateAttitudeComplementary(bool first_run) if (airspeedSensor.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE) { // we have airspeed available airspeed.CalibratedAirspeed = airspeedSensor.CalibratedAirspeed; - airspeed.TrueAirspeed = airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - positionState.Down); + airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; AirspeedStateSet(&airspeed); } } @@ -1078,7 +1078,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) AirspeedStateGet(&airspeed); airspeed.CalibratedAirspeed = airspeedData.CalibratedAirspeed; - airspeed.TrueAirspeed = airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - Nav.Pos[2]); + airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; + AirspeedStateSet(&airspeed); if (!gps_vel_updated && !gps_updated) { diff --git a/flight/modules/StateEstimation/filterair.c b/flight/modules/StateEstimation/filterair.c index 3ed89b99d..3c1308f5a 100644 --- a/flight/modules/StateEstimation/filterair.c +++ b/flight/modules/StateEstimation/filterair.c @@ -78,7 +78,7 @@ static int32_t filter(stateFilter *self, stateEstimation *state) this->altitude = state->baro[0]; } // calculate true airspeed estimation - if (IS_SET(state->updated, SENSORUPDATES_airspeed)) { + if (IS_SET(state->updated, SENSORUPDATES_airspeed) && (state->airspeed[1]<0.f) ) { state->airspeed[1] = state->airspeed[0] * IAS2TAS(this->altitude); } diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index bff326c87..b8dbe8e61 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -85,6 +85,18 @@ UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ } \ } +#define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(sensorname, shortname, a1, a2, EXTRACHECK) \ + if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ + sensorname##Data s; \ + sensorname##Get(&s); \ + if (IS_REAL(s.a1) && IS_REAL(s.a2) && EXTRACHECK) { \ + states.shortname[0] = s.a1; \ + states.shortname[1] = s.a2; \ + } \ + else { \ + UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ + } \ + } // local macros, ONLY to be used in the middle of StateEstimationCb in section RUNSTATE_SAVE before the check of alarms! #define EXPORT_STATE_TO_UAVOBJECT_IF_UPDATED_3_DIMENSIONS(statename, shortname, a1, a2, a3) \ @@ -379,8 +391,10 @@ static void StateEstimationCb(void) FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_3_DIMENSIONS(MagSensor, mag, x, y, z); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_3_DIMENSIONS(GPSVelocitySensor, vel, North, East, Down); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(BaroSensor, baro, Altitude, true); - FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); - states.airspeed[1] = 0.0f; // sensor does not provide true airspeed, needs to be calculated by filter, set to zero for now + FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, TrueAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); +// FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); +// states.airspeed[1] = 0.0f; // sensor does not provide true airspeed, needs to be calculated by filter, set to zero for now + // GPS position data (LLA) is not fetched here since it does not contain floats. The filter must do all checks itself // at this point sensor state is stored in "states" with some rudimentary filtering applied From 8e26338f24b05e07d51847a1a9cfc5d44d2816dd Mon Sep 17 00:00:00 2001 From: Andres <> Date: Thu, 27 Mar 2014 09:32:17 +0100 Subject: [PATCH 072/131] OP-1273 I2C Alarm reset to default when AirspeedSensorType is changed. Small cosmetic corrections --- flight/modules/Airspeed/airspeed.c | 19 ++++++++++++++++++- .../modules/Airspeed/baro_airspeed_ms4525do.c | 12 ++++++------ .../modules/StateEstimation/stateestimation.c | 7 ++++--- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index 078aef03f..0da2d149d 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -60,7 +60,7 @@ static xTaskHandle taskHandle; static bool airspeedEnabled = false; static AirspeedSettingsData airspeedSettings; - +static AirspeedSettingsAirspeedSensorTypeOptions lastAirspeedSensorType = 0; static int8_t airspeedADCPin = -1; @@ -118,6 +118,8 @@ int32_t AirspeedInitialize() airspeedADCPin = i; } } + + lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; AirspeedSensorInitialize(); AirspeedSettingsInitialize(); @@ -153,6 +155,21 @@ static void airspeedTask(__attribute__((unused)) void *parameters) // Update the airspeed object AirspeedSensorGet(&airspeedData); + // if sensor type changed and the last sensor was + // either Eagletree or PixHawk, reset I2C alarms + if(airspeedSettings.AirspeedSensorType != lastAirspeedSensorType){ + switch (lastAirspeedSensorType) { + // Eagletree or PixHawk => Reset I2C alams + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3: + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: + AlarmsDefault(SYSTEMALARMS_ALARM_I2C); + break; + // else do not reset I2C alarms + default: break; + } + lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; + } + switch (airspeedSettings.AirspeedSensorType) { #if defined(PIOS_INCLUDE_MPXV) case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_DIYDRONESMPXV7002: diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index ea8480e0b..caeb44e99 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -44,9 +44,9 @@ #if defined(PIOS_INCLUDE_MS4525DO) -#define CALIBRATION_IDLE_MS 0 // Time to wait before calibrating, in [ms] -#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] -#define FILTER_SHIFT 5 // Barry Dorr filter parameter k +#define CALIBRATION_IDLE_MS 0 // Time to wait before calibrating, in [ms] +#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] +#define FILTER_SHIFT 5 // Barry Dorr filter parameter k #define P0 101325.0f // standard pressure #define CCEXPONENT 0.2857142857f // exponent of compressibility correction 2/7 @@ -57,14 +57,13 @@ // Private types -// Private functions +// Private functions definitions static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); // Private variables static uint16_t calibrationCount = 0; -static uint32_t filter_reg; // Barry Dorr filter register - +static uint32_t filter_reg = 0; // Barry Dorr filter register void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) { @@ -99,6 +98,7 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin } +// Private functions static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) { // Check to see if airspeed sensor is returning airspeedSensor diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index b8dbe8e61..c4d375f56 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -74,6 +74,7 @@ UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ } \ } + #define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(sensorname, shortname, a1, EXTRACHECK) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ sensorname##Data s; \ @@ -85,6 +86,7 @@ UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ } \ } + #define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(sensorname, shortname, a1, a2, EXTRACHECK) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ sensorname##Data s; \ @@ -108,6 +110,7 @@ s.a3 = states.shortname[2]; \ statename##Set(&s); \ } + #define EXPORT_STATE_TO_UAVOBJECT_IF_UPDATED_2_DIMENSIONS(statename, shortname, a1, a2) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ statename##Data s; \ @@ -117,8 +120,8 @@ statename##Set(&s); \ } -// Private types +// Private types struct filterPipelineStruct; typedef const struct filterPipelineStruct { @@ -392,8 +395,6 @@ static void StateEstimationCb(void) FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_3_DIMENSIONS(GPSVelocitySensor, vel, North, East, Down); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(BaroSensor, baro, Altitude, true); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, TrueAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); -// FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); -// states.airspeed[1] = 0.0f; // sensor does not provide true airspeed, needs to be calculated by filter, set to zero for now // GPS position data (LLA) is not fetched here since it does not contain floats. The filter must do all checks itself From c5dc556a43ccab28f7f584030a3f57afa146e373 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Thu, 27 Mar 2014 16:19:22 +0100 Subject: [PATCH 073/131] OP-1273 Uncrustify --- flight/modules/Airspeed/airspeed.c | 22 ++-- .../modules/Airspeed/baro_airspeed_ms4525do.c | 100 +++++++++--------- flight/modules/Attitude/revolution/attitude.c | 6 +- flight/modules/StateEstimation/filterair.c | 2 +- .../modules/StateEstimation/stateestimation.c | 8 +- flight/pios/common/pios_ms4525do.c | 31 +++--- flight/pios/stm32f10x/pios_i2c.c | 4 +- flight/pios/stm32f4xx/pios_i2c.c | 2 +- flight/targets/boards/revolution/pios_board.h | 8 +- 9 files changed, 91 insertions(+), 92 deletions(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index 0da2d149d..1df2438ed 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -118,7 +118,7 @@ int32_t AirspeedInitialize() airspeedADCPin = i; } } - + lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; AirspeedSensorInitialize(); @@ -155,21 +155,21 @@ static void airspeedTask(__attribute__((unused)) void *parameters) // Update the airspeed object AirspeedSensorGet(&airspeedData); - // if sensor type changed and the last sensor was + // if sensor type changed and the last sensor was // either Eagletree or PixHawk, reset I2C alarms - if(airspeedSettings.AirspeedSensorType != lastAirspeedSensorType){ + if (airspeedSettings.AirspeedSensorType != lastAirspeedSensorType) { switch (lastAirspeedSensorType) { - // Eagletree or PixHawk => Reset I2C alams - case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3: - case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: - AlarmsDefault(SYSTEMALARMS_ALARM_I2C); - break; - // else do not reset I2C alarms - default: break; + // Eagletree or PixHawk => Reset I2C alams + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3: + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: + AlarmsDefault(SYSTEMALARMS_ALARM_I2C); + break; + // else do not reset I2C alarms + default: break; } lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; } - + switch (airspeedSettings.AirspeedSensorType) { #if defined(PIOS_INCLUDE_MPXV) case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_DIYDRONESMPXV7002: diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index caeb44e99..af6a6170c 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -45,15 +45,15 @@ #if defined(PIOS_INCLUDE_MS4525DO) #define CALIBRATION_IDLE_MS 0 // Time to wait before calibrating, in [ms] -#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] -#define FILTER_SHIFT 5 // Barry Dorr filter parameter k +#define CALIBRATION_COUNT_MS 4000 // Time to spend calibrating, in [ms] +#define FILTER_SHIFT 5 // Barry Dorr filter parameter k -#define P0 101325.0f // standard pressure -#define CCEXPONENT 0.2857142857f // exponent of compressibility correction 2/7 -#define CASFACTOR 760.8802669f // sqrt(5) * speed of sound at standard -#define TASFACTOR 0.05891022589f // 1/sqrt(T0) +#define P0 101325.0f // standard pressure +#define CCEXPONENT 0.2857142857f // exponent of compressibility correction 2/7 +#define CASFACTOR 760.8802669f // sqrt(5) * speed of sound at standard +#define TASFACTOR 0.05891022589f // 1/sqrt(T0) -#define max(x,y) ((x)>=(y) ? (x) : (y)) +#define max(x, y) ((x) >= (y) ? (x) : (y)) // Private types @@ -62,38 +62,38 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs // Private variables -static uint16_t calibrationCount = 0; -static uint32_t filter_reg = 0; // Barry Dorr filter register +static uint16_t calibrationCount = 0; +static uint32_t filter_reg = 0; // Barry Dorr filter register void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) { // request measurement first int8_t retVal = PIOS_MS4525DO_Request(); - - if( retVal !=0 ){ + + if (retVal != 0) { AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); return; } - + // Datasheet of MS4525DO: conversion needs 0.5 ms + 20% more when status bit used // delay by one Tick or at least 2 ms const portTickType xDelay = max(2 / portTICK_RATE_MS, 1); - vTaskDelay( xDelay ); - + vTaskDelay(xDelay); + // read the sensor - retVal = baro_airspeedReadMS4525DO(airspeedSensor,airspeedSettings); - - switch( retVal ){ - case 0 : AlarmsClear(SYSTEMALARMS_ALARM_I2C); - break; - case -4 : - case -5 : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); - break; - case -1 : - case -2 : - case -3 : - case -6 : - default : AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + retVal = baro_airspeedReadMS4525DO(airspeedSensor, airspeedSettings); + + switch (retVal) { + case 0: AlarmsClear(SYSTEMALARMS_ALARM_I2C); + break; + case -4: + case -5: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + break; + case -1: + case -2: + case -3: + case -6: + default: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); } } @@ -103,38 +103,38 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs { // Check to see if airspeed sensor is returning airspeedSensor uint16_t values[2]; - int8_t retVal=PIOS_MS4525DO_Read(values); - - if( retVal == 0 ){ - airspeedSensor->SensorValue = values[0]; + int8_t retVal = PIOS_MS4525DO_Read(values); + + if (retVal == 0) { + airspeedSensor->SensorValue = values[0]; airspeedSensor->SensorValueTemperature = values[1]; } else { airspeedSensor->SensorValue = -1; airspeedSensor->SensorValueTemperature = -1; - airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; - airspeedSensor->CalibratedAirspeed = 0; + airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + airspeedSensor->CalibratedAirspeed = 0; return retVal; } - + // only calibrate if no stored calibration is available - if ( !airspeedSettings->ZeroPoint ) { + if (!airspeedSettings->ZeroPoint) { // Calibrate sensor by averaging zero point value if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { calibrationCount++; - filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT ); - + filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT); + return retVal; } else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { calibrationCount++; // update filter register - filter_reg = filter_reg - ( filter_reg >> FILTER_SHIFT ) + airspeedSensor->SensorValue; + filter_reg = filter_reg - (filter_reg >> FILTER_SHIFT) + airspeedSensor->SensorValue; if (calibrationCount > (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { - // Scale output for unity gain. - airspeedSettings->ZeroPoint = (uint16_t)( filter_reg >> FILTER_SHIFT ); - + // Scale output for unity gain. + airspeedSettings->ZeroPoint = (uint16_t)(filter_reg >> FILTER_SHIFT); + AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint); - calibrationCount = 0; + calibrationCount = 0; } return retVal; } @@ -149,19 +149,19 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs Datasheet temperature: output = (T+50)*2047 / 200 Inversion: T = (200*out - 102350)/2047 in C T = (200*out - 102350)/2047 + 273.15 in K - */ - const float dP = ( 10*(int32_t)(airspeedSensor->SensorValue-airspeedSettings->ZeroPoint) ) * 0.1052120688f; - const float T = (float)( 200*(int32_t)airspeedSensor->SensorValueTemperature - 102350) / 2047 + 273.15f; - + */ + const float dP = (10 * (int32_t)(airspeedSensor->SensorValue - airspeedSettings->ZeroPoint)) * 0.1052120688f; + const float T = (float)(200 * (int32_t)airspeedSensor->SensorValueTemperature - 102350) / 2047 + 273.15f; + airspeedSensor->DifferentialPressure = dP; - airspeedSensor->Temperature = T; + airspeedSensor->Temperature = T; // CAS = Csound * sqrt( 5 *( (dP/P0 +1)^(2/7) - 1) ) // TAS = Csound * sqrt( 5 T/T0 *( (dP/P0 +1)^(2/7) - 1) ) // where Csound = 340.276 m/s at standard condition T0=288.15 K and P0 = 101315 Pa - airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * CASFACTOR * sqrtf( powf( fabsf(dP) / P0 + 1.0f , CCEXPONENT ) - 1.0f ); - airspeedSensor->TrueAirspeed = airspeedSensor->CalibratedAirspeed * TASFACTOR * sqrtf( T ); + airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * CASFACTOR * sqrtf(powf(fabsf(dP) / P0 + 1.0f, CCEXPONENT) - 1.0f); + airspeedSensor->TrueAirspeed = airspeedSensor->CalibratedAirspeed * TASFACTOR * sqrtf(T); airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; - + return retVal; } diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index 0ca789199..8edbf5cb9 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -650,7 +650,7 @@ static int32_t updateAttitudeComplementary(bool first_run) if (airspeedSensor.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE) { // we have airspeed available airspeed.CalibratedAirspeed = airspeedSensor.CalibratedAirspeed; - airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; + airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed *IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; AirspeedStateSet(&airspeed); } } @@ -1078,8 +1078,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) AirspeedStateGet(&airspeed); airspeed.CalibratedAirspeed = airspeedData.CalibratedAirspeed; - airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed * IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; - + airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed *IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; + AirspeedStateSet(&airspeed); if (!gps_vel_updated && !gps_updated) { diff --git a/flight/modules/StateEstimation/filterair.c b/flight/modules/StateEstimation/filterair.c index 3c1308f5a..bf5c83a32 100644 --- a/flight/modules/StateEstimation/filterair.c +++ b/flight/modules/StateEstimation/filterair.c @@ -78,7 +78,7 @@ static int32_t filter(stateFilter *self, stateEstimation *state) this->altitude = state->baro[0]; } // calculate true airspeed estimation - if (IS_SET(state->updated, SENSORUPDATES_airspeed) && (state->airspeed[1]<0.f) ) { + if (IS_SET(state->updated, SENSORUPDATES_airspeed) && (state->airspeed[1] < 0.f)) { state->airspeed[1] = state->airspeed[0] * IAS2TAS(this->altitude); } diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index c4d375f56..c947be522 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -74,7 +74,7 @@ UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ } \ } - + #define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(sensorname, shortname, a1, EXTRACHECK) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ sensorname##Data s; \ @@ -86,7 +86,7 @@ UNSET_MASK(states.updated, SENSORUPDATES_##shortname); \ } \ } - + #define FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(sensorname, shortname, a1, a2, EXTRACHECK) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ sensorname##Data s; \ @@ -110,7 +110,7 @@ s.a3 = states.shortname[2]; \ statename##Set(&s); \ } - + #define EXPORT_STATE_TO_UAVOBJECT_IF_UPDATED_2_DIMENSIONS(statename, shortname, a1, a2) \ if (IS_SET(states.updated, SENSORUPDATES_##shortname)) { \ statename##Data s; \ @@ -395,7 +395,7 @@ static void StateEstimationCb(void) FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_3_DIMENSIONS(GPSVelocitySensor, vel, North, East, Down); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_1_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(BaroSensor, baro, Altitude, true); FETCH_SENSOR_FROM_UAVOBJECT_CHECK_AND_LOAD_TO_STATE_2_DIMENSION_WITH_CUSTOM_EXTRA_CHECK(AirspeedSensor, airspeed, CalibratedAirspeed, TrueAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); - + // GPS position data (LLA) is not fetched here since it does not contain floats. The filter must do all checks itself // at this point sensor state is stored in "states" with some rudimentary filtering applied diff --git a/flight/pios/common/pios_ms4525do.c b/flight/pios/common/pios_ms4525do.c index f331453aa..8a8fc9aab 100644 --- a/flight/pios/common/pios_ms4525do.c +++ b/flight/pios/common/pios_ms4525do.c @@ -40,7 +40,6 @@ static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len); static bool pios_ms4525do_requested = false; - static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len) { const struct pios_i2c_txn txn_list[] = { @@ -73,15 +72,15 @@ static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len) } - int8_t PIOS_MS4525DO_Request(void) { - // MS4525DO expects a zero length write. + // MS4525DO expects a zero length write. // Sending one byte is a workaround that works for the moment - uint8_t data=0; - int8_t retVal=PIOS_MS4525DO_WriteI2C(&data,sizeof(data)); - /* requested only when transfer worked */ - pios_ms4525do_requested = ( retVal == 0 ); + uint8_t data = 0; + int8_t retVal = PIOS_MS4525DO_WriteI2C(&data, sizeof(data)); + + /* requested only when transfer worked */ + pios_ms4525do_requested = (retVal == 0); return retVal; } @@ -98,28 +97,28 @@ int8_t PIOS_MS4525DO_Read(uint16_t *values) } uint8_t data[4]; - int8_t retVal=PIOS_MS4525DO_ReadI2C(data, sizeof(data)); + int8_t retVal = PIOS_MS4525DO_ReadI2C(data, sizeof(data)); uint8_t status = data[0] & 0xC0; if (status == 0x80) { - /* stale data */ + /* stale data */ return -5; } else if (status == 0xC0) { /* device probably broken */ return -6; } - /* differential pressure */ + /* differential pressure */ values[0] = (data[0] << 8); - values[0] += data[1]; - + values[0] += data[1]; + /* temperature */ values[1] = (data[2] << 8); - values[1] += data[3]; + values[1] += data[3]; values[1] = (values[1] >> 5); - - /* not requested anymore, only when transfer worked */ - pios_ms4525do_requested = !( retVal == 0 ); + + /* not requested anymore, only when transfer worked */ + pios_ms4525do_requested = !(retVal == 0); return retVal; } diff --git a/flight/pios/stm32f10x/pios_i2c.c b/flight/pios/stm32f10x/pios_i2c.c index 88eccb831..8cb98444c 100644 --- a/flight/pios/stm32f10x/pios_i2c.c +++ b/flight/pios/stm32f10x/pios_i2c.c @@ -414,8 +414,8 @@ static void go_starting(struct pios_i2c_adapter *i2c_adapter) i2c_adapter->last_byte = NULL; i2c_adapter->active_byte = i2c_adapter->last_byte + 1; } - - + + I2C_GenerateSTART(i2c_adapter->cfg->regs, ENABLE); if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) { I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE); diff --git a/flight/pios/stm32f4xx/pios_i2c.c b/flight/pios/stm32f4xx/pios_i2c.c index eff4682fe..a5a7b6969 100644 --- a/flight/pios/stm32f4xx/pios_i2c.c +++ b/flight/pios/stm32f4xx/pios_i2c.c @@ -417,7 +417,7 @@ static void go_starting(struct pios_i2c_adapter *i2c_adapter) i2c_adapter->last_byte = NULL; i2c_adapter->active_byte = i2c_adapter->last_byte + 1; } - + I2C_GenerateSTART(i2c_adapter->cfg->regs, ENABLE); if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) { I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE); diff --git a/flight/targets/boards/revolution/pios_board.h b/flight/targets/boards/revolution/pios_board.h index 60d3cff53..975a87194 100644 --- a/flight/targets/boards/revolution/pios_board.h +++ b/flight/targets/boards/revolution/pios_board.h @@ -119,12 +119,12 @@ // PIOS_I2C // See also pios_board.c // ------------------------ -#define PIOS_I2C_MAX_DEVS 3 +#define PIOS_I2C_MAX_DEVS 3 extern uint32_t pios_i2c_mag_pressure_adapter_id; -#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_mag_pressure_adapter_id) +#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_mag_pressure_adapter_id) extern uint32_t pios_i2c_flexiport_adapter_id; -#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) -#define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) +#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) +#define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) #define PIOS_I2C_MS4525DO_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) // ------------------------- From af86a3eb37f912d45c5371df26b439330d7fafaa Mon Sep 17 00:00:00 2001 From: Andres <> Date: Thu, 27 Mar 2014 16:49:57 +0100 Subject: [PATCH 074/131] OP-1282 Added I2C alarm in baro_airspeedGetETASV3 and did uncrustify --- flight/modules/Airspeed/baro_airspeed_etasv3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flight/modules/Airspeed/baro_airspeed_etasv3.c b/flight/modules/Airspeed/baro_airspeed_etasv3.c index 50c5d78fb..62fc1f50a 100644 --- a/flight/modules/Airspeed/baro_airspeed_etasv3.c +++ b/flight/modules/Airspeed/baro_airspeed_etasv3.c @@ -64,11 +64,13 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings if (airspeedSensor->SensorValue == (uint16_t)-1) { airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; airspeedSensor->CalibratedAirspeed = 0; + AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); return; } // only calibrate if no stored calibration is available if (!airspeedSettings->ZeroPoint) { + AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); // Calibrate sensor by averaging zero point value if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { calibrationCount++; @@ -93,6 +95,7 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings // Compute airspeed airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * sqrtf((float)abs(airspeedSensor->SensorValue - airspeedSettings->ZeroPoint)); airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; + AlarmsClear(SYSTEMALARMS_ALARM_I2C); } From 4188b492fce1a289c3d0b37f24849dad810524f4 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Thu, 27 Mar 2014 16:59:48 +0100 Subject: [PATCH 075/131] OP-1273 added I2C warning alarm during calibration of zero point, and uncrustify --- flight/modules/Airspeed/baro_airspeed_ms4525do.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index af6a6170c..eaaee6210 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -87,7 +87,8 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin case 0: AlarmsClear(SYSTEMALARMS_ALARM_I2C); break; case -4: - case -5: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + case -5: + case -7: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); break; case -1: case -2: @@ -122,8 +123,7 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { calibrationCount++; filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT); - - return retVal; + return -7; } else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { calibrationCount++; // update filter register @@ -136,7 +136,7 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint); calibrationCount = 0; } - return retVal; + return -7; } } From fe04cf7d29ae9c4b2de5ca10ffab1ef900dee16b Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Thu, 27 Mar 2014 21:19:03 +0100 Subject: [PATCH 076/131] uncrustification --- flight/modules/Stabilization/stabilization.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/modules/Stabilization/stabilization.c b/flight/modules/Stabilization/stabilization.c index f9cd81910..87c149ffe 100644 --- a/flight/modules/Stabilization/stabilization.c +++ b/flight/modules/Stabilization/stabilization.c @@ -417,7 +417,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters) // and the Att rate equals the Rate rate // that's where Rate x (1-StickAngle) [Attitude pulling down max X Ratt proportion] // == Rate x StickAngle [Rate pulling up according to stick angle] - // * StickAngle [X Ratt proportion] + // * StickAngle [X Ratt proportion] // so 1-x == x*x or x*x+x-1=0 where xE(0,1) // (-1+-sqrt(1+4))/2 = (-1+sqrt(5))/2 // and quadratic formula says that is 0.618033989f @@ -441,7 +441,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters) magnitude *= STICK_VALUE_AT_MODE_TRANSITION / rattitude_mode_transition_stick_position; } else { magnitude = (magnitude - rattitude_mode_transition_stick_position) - * (1.0f-STICK_VALUE_AT_MODE_TRANSITION) + * (1.0f - STICK_VALUE_AT_MODE_TRANSITION) / (1.0f - rattitude_mode_transition_stick_position) + STICK_VALUE_AT_MODE_TRANSITION; } @@ -824,7 +824,7 @@ static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) cur_flight_mode = -1; // Rattitude stick angle where the attitude to rate transition happens - if (settings.RattitudeModeTransition < (uint8_t) 10) { + if (settings.RattitudeModeTransition < (uint8_t)10) { rattitude_mode_transition_stick_position = 10.0f / 100.0f; } else { rattitude_mode_transition_stick_position = (float)settings.RattitudeModeTransition / 100.0f; From 7ec855af5fdda84402457ba7be085577f101725f Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 14:18:14 +0100 Subject: [PATCH 077/131] OP-1273 added and implemented Airpeed alarm for the PixHawk sensor --- flight/modules/Airspeed/airspeed.c | 9 +- .../modules/Airspeed/baro_airspeed_ms4525do.c | 8 +- .../diagrams/default/system-health.svg | 279 ++++++++++++------ .../uavobjectdefinition/airspeedsettings.xml | 2 +- shared/uavobjectdefinition/systemalarms.xml | 1 + 5 files changed, 205 insertions(+), 94 deletions(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index 1df2438ed..b81d5ad5d 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -156,15 +156,15 @@ static void airspeedTask(__attribute__((unused)) void *parameters) AirspeedSensorGet(&airspeedData); // if sensor type changed and the last sensor was - // either Eagletree or PixHawk, reset I2C alarms + // either Eagletree or PixHawk, reset Airspeed alarm if (airspeedSettings.AirspeedSensorType != lastAirspeedSensorType) { switch (lastAirspeedSensorType) { - // Eagletree or PixHawk => Reset I2C alams + // Eagletree or PixHawk => Reset Airspeed alams case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3: case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: - AlarmsDefault(SYSTEMALARMS_ALARM_I2C); + AlarmsDefault(SYSTEMALARMS_ALARM_AIRSPEED); break; - // else do not reset I2C alarms + // else do not reset Airspeed alarm default: break; } lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; @@ -193,6 +193,7 @@ static void airspeedTask(__attribute__((unused)) void *parameters) case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_GROUNDSPEEDBASEDWINDESTIMATION: gps_airspeedGet(&airspeedData, &airspeedSettings); break; + case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE: default: airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; } diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index eaaee6210..5ca0469a8 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -71,7 +71,7 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin int8_t retVal = PIOS_MS4525DO_Request(); if (retVal != 0) { - AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_ERROR); return; } @@ -84,17 +84,17 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin retVal = baro_airspeedReadMS4525DO(airspeedSensor, airspeedSettings); switch (retVal) { - case 0: AlarmsClear(SYSTEMALARMS_ALARM_I2C); + case 0: AlarmsClear(SYSTEMALARMS_ALARM_AIRSPEED); break; case -4: case -5: - case -7: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + case -7: AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_WARNING); break; case -1: case -2: case -3: case -6: - default: AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + default: AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_ERROR); } } diff --git a/ground/openpilotgcs/share/openpilotgcs/diagrams/default/system-health.svg b/ground/openpilotgcs/share/openpilotgcs/diagrams/default/system-health.svg index 10c6a9d53..914709810 100644 --- a/ground/openpilotgcs/share/openpilotgcs/diagrams/default/system-health.svg +++ b/ground/openpilotgcs/share/openpilotgcs/diagrams/default/system-health.svg @@ -14,8 +14,8 @@ height="79.57505" id="svg3604" version="1.1" - inkscape:version="0.48.2 r9819" - sodipodi:docname="system-health.svg" + inkscape:version="0.48.4 r9939" + sodipodi:docname="system-health-mod.svg" inkscape:export-filename="C:\NoBackup\OpenPilot\mainboard-health.png" inkscape:export-xdpi="269.53" inkscape:export-ydpi="269.53" @@ -27,16 +27,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="9.3551549" - inkscape:cx="42.866204" - inkscape:cy="35.940147" - inkscape:current-layer="g4794" + inkscape:zoom="10.554213" + inkscape:cx="47.1292" + inkscape:cy="39.787519" + inkscape:current-layer="svg3604" id="namedview3608" showgrid="false" inkscape:window-width="1920" - inkscape:window-height="1178" - inkscape:window-x="0" - inkscape:window-y="0" + inkscape:window-height="1025" + inkscape:window-x="-2" + inkscape:window-y="-3" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true"> @@ -656,39 +656,48 @@ + d="m 524.3844,367.59399 1.32275,0 1.67432,4.46485 1.68311,-4.46485 1.32275,0 0,6.56104 -0.86572,0 0,-5.76123 -1.6919,4.5 -0.89209,0 -1.69189,-4.5 0,5.76123 -0.86133,0 0,-6.56104" + inkscape:connector-curvature="0" /> + d="m 534.35559,371.68091 c -0.65332,0 -1.10596,0.0747 -1.35791,0.22412 -0.25195,0.14942 -0.37793,0.4043 -0.37793,0.76465 0,0.28711 0.0937,0.51562 0.28125,0.68554 0.19043,0.167 0.44824,0.25049 0.77344,0.25049 0.44824,0 0.80712,-0.1582 1.07666,-0.47461 0.27246,-0.31933 0.40869,-0.74267 0.40869,-1.27002 l 0,-0.18017 -0.8042,0 m 1.61279,-0.33399 0,2.80811 -0.80859,0 0,-0.74707 c -0.18457,0.29883 -0.41455,0.52002 -0.68994,0.66357 -0.27539,0.14063 -0.61231,0.21094 -1.01074,0.21094 -0.50391,0 -0.90528,-0.14062 -1.20411,-0.42187 -0.29589,-0.28418 -0.44384,-0.66358 -0.44384,-1.13819 0,-0.55371 0.18457,-0.97119 0.55371,-1.25244 0.37207,-0.28125 0.92578,-0.42187 1.66113,-0.42187 l 1.13379,0 0,-0.0791 c 0,-0.37206 -0.12305,-0.65917 -0.36914,-0.86132 -0.24317,-0.20508 -0.58594,-0.30762 -1.02832,-0.30762 -0.28125,0 -0.55518,0.0337 -0.82178,0.10107 -0.2666,0.0674 -0.52295,0.16846 -0.76904,0.30323 l 0,-0.74707 c 0.2959,-0.11426 0.58301,-0.19922 0.86133,-0.25489 0.27832,-0.0586 0.54931,-0.0879 0.81299,-0.0879 0.71191,10e-6 1.24364,0.18458 1.59521,0.55371 0.35156,0.36915 0.52734,0.92872 0.52734,1.67871" + inkscape:connector-curvature="0" /> + d="m 537.63831,369.23315 0.80859,0 0,4.92188 -0.80859,0 0,-4.92188 m 0,-1.91601 0.80859,0 0,1.02392 -0.80859,0 0,-1.02392" + inkscape:connector-curvature="0" /> + d="m 544.22571,371.18433 0,2.9707 -0.8086,0 0,-2.94434 c 0,-0.46581 -0.0908,-0.81445 -0.27246,-1.0459 -0.18164,-0.23144 -0.4541,-0.34716 -0.81738,-0.34716 -0.43653,0 -0.78076,0.13916 -1.03271,0.41748 -0.25196,0.27832 -0.37794,0.65772 -0.37793,1.13818 l 0,2.78174 -0.81299,0 0,-4.92188 0.81299,0 0,0.76465 c 0.19335,-0.29589 0.4204,-0.51708 0.68115,-0.66357 0.26367,-0.14648 0.56689,-0.21972 0.90967,-0.21973 0.56542,10e-6 0.99316,0.17579 1.2832,0.52735 0.29003,0.34863 0.43505,0.86279 0.43506,1.54248" + inkscape:connector-curvature="0" /> + d="m 549.38049,371.69849 c 0,-0.59473 -0.12305,-1.06055 -0.36914,-1.39746 -0.24317,-0.33984 -0.57861,-0.50977 -1.00635,-0.50977 -0.42773,0 -0.76465,0.16993 -1.01074,0.50977 -0.24316,0.33691 -0.36475,0.80273 -0.36474,1.39746 -10e-6,0.59472 0.12158,1.06201 0.36474,1.40185 0.24609,0.33692 0.58301,0.50537 1.01074,0.50537 0.42774,0 0.76318,-0.16845 1.00635,-0.50537 0.24609,-0.33984 0.36914,-0.80713 0.36914,-1.40185 m -2.75097,-1.71827 c 0.16992,-0.29296 0.38378,-0.50976 0.6416,-0.65039 0.26074,-0.14355 0.57128,-0.21532 0.93164,-0.21533 0.59765,10e-6 1.08251,0.23731 1.45459,0.71192 0.37499,0.47461 0.56249,1.09863 0.5625,1.87207 -10e-6,0.77344 -0.18751,1.39746 -0.5625,1.87207 -0.37208,0.47461 -0.85694,0.71191 -1.45459,0.71191 -0.36036,0 -0.6709,-0.0703 -0.93164,-0.21094 -0.25782,-0.14355 -0.47168,-0.36181 -0.6416,-0.65478 l 0,0.73828 -0.81299,0 0,-6.83789 0.81299,0 0,2.66308" + inkscape:connector-curvature="0" /> + d="m 553.46741,369.80005 c -0.4336,0 -0.77637,0.16992 -1.02832,0.50976 -0.25196,0.33692 -0.37793,0.79981 -0.37793,1.38868 0,0.58887 0.12451,1.05322 0.37353,1.39306 0.25195,0.33692 0.59619,0.50537 1.03272,0.50537 0.43066,0 0.77197,-0.16992 1.02392,-0.50976 0.25195,-0.33984 0.37793,-0.80273 0.37793,-1.38867 0,-0.58301 -0.12598,-1.04443 -0.37793,-1.38428 -0.25195,-0.34277 -0.59326,-0.51416 -1.02392,-0.51416 m 0,-0.68555 c 0.70312,10e-6 1.25536,0.22852 1.65674,0.68555 0.40136,0.45703 0.60204,1.08985 0.60205,1.89844 -10e-6,0.80566 -0.20069,1.43847 -0.60205,1.89843 -0.40138,0.45704 -0.95362,0.68555 -1.65674,0.68555 -0.70606,0 -1.25977,-0.22851 -1.66114,-0.68555 -0.39843,-0.45996 -0.59765,-1.09277 -0.59765,-1.89843 0,-0.80859 0.19922,-1.44141 0.59765,-1.89844 0.40137,-0.45703 0.95508,-0.68554 1.66114,-0.68555" + inkscape:connector-curvature="0" /> + d="m 559.29895,371.68091 c -0.65332,0 -1.10596,0.0747 -1.35791,0.22412 -0.25195,0.14942 -0.37793,0.4043 -0.37793,0.76465 0,0.28711 0.0937,0.51562 0.28125,0.68554 0.19043,0.167 0.44824,0.25049 0.77344,0.25049 0.44824,0 0.80712,-0.1582 1.07666,-0.47461 0.27246,-0.31933 0.40869,-0.74267 0.40869,-1.27002 l 0,-0.18017 -0.8042,0 m 1.61279,-0.33399 0,2.80811 -0.80859,0 0,-0.74707 c -0.18457,0.29883 -0.41455,0.52002 -0.68994,0.66357 -0.2754,0.14063 -0.61231,0.21094 -1.01074,0.21094 -0.50391,0 -0.90528,-0.14062 -1.20411,-0.42187 -0.29589,-0.28418 -0.44384,-0.66358 -0.44384,-1.13819 0,-0.55371 0.18457,-0.97119 0.55371,-1.25244 0.37207,-0.28125 0.92578,-0.42187 1.66113,-0.42187 l 1.13379,0 0,-0.0791 c 0,-0.37206 -0.12305,-0.65917 -0.36914,-0.86132 -0.24317,-0.20508 -0.58594,-0.30762 -1.02832,-0.30762 -0.28125,0 -0.55518,0.0337 -0.82178,0.10107 -0.2666,0.0674 -0.52295,0.16846 -0.76904,0.30323 l 0,-0.74707 c 0.2959,-0.11426 0.583,-0.19922 0.86133,-0.25489 0.27831,-0.0586 0.54931,-0.0879 0.81298,-0.0879 0.71192,10e-6 1.24365,0.18458 1.59522,0.55371 0.35156,0.36915 0.52734,0.92872 0.52734,1.67871" + inkscape:connector-curvature="0" /> + d="m 565.43372,369.98901 c -0.0908,-0.0527 -0.19044,-0.0908 -0.29883,-0.11425 -0.10547,-0.0264 -0.22266,-0.0395 -0.35156,-0.0395 -0.45704,0 -0.8086,0.14941 -1.05469,0.44824 -0.24317,0.2959 -0.36475,0.72217 -0.36475,1.27881 l 0,2.59277 -0.81299,0 0,-4.92188 0.81299,0 0,0.76465 c 0.16992,-0.29882 0.39111,-0.52001 0.66358,-0.66357 0.27245,-0.14648 0.60351,-0.21972 0.99316,-0.21973 0.0557,10e-6 0.11718,0.004 0.18457,0.0132 0.0674,0.006 0.14209,0.0161 0.22412,0.0308 l 0.004,0.83056" + inkscape:connector-curvature="0" /> + d="m 569.37122,369.98022 0,-2.66308 0.80859,0 0,6.83789 -0.80859,0 0,-0.73828 c -0.16993,0.29297 -0.38526,0.51123 -0.646,0.65478 -0.25782,0.14063 -0.56836,0.21094 -0.93164,0.21094 -0.59473,0 -1.07959,-0.2373 -1.45459,-0.71191 -0.37207,-0.47461 -0.55811,-1.09863 -0.55811,-1.87207 0,-0.77344 0.18604,-1.39746 0.55811,-1.87207 0.375,-0.47461 0.85986,-0.71191 1.45459,-0.71192 0.36328,10e-6 0.67382,0.0718 0.93164,0.21533 0.26074,0.14063 0.47607,0.35743 0.646,0.65039 m -2.75538,1.71827 c 0,0.59472 0.12159,1.06201 0.36475,1.40185 0.24609,0.33692 0.58301,0.50537 1.01074,0.50537 0.42773,0 0.76465,-0.16845 1.01075,-0.50537 0.24608,-0.33984 0.36913,-0.80713 0.36914,-1.40185 -10e-6,-0.59473 -0.12306,-1.06055 -0.36914,-1.39746 -0.2461,-0.33984 -0.58302,-0.50977 -1.01075,-0.50977 -0.42773,0 -0.76465,0.16993 -1.01074,0.50977 -0.24316,0.33691 -0.36475,0.80273 -0.36475,1.39746" + inkscape:connector-curvature="0" /> + + x="572.51758" + y="345.79932" /> + x="519.2749" + y="346.19791" /> + id="path3156" + inkscape:connector-curvature="0" /> + inkscape:label="#path4088-8" + inkscape:connector-curvature="0" /> + style="stroke:#cf0e0e;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + transform="matrix(1.2853162,0,0,0.64013573,-26.151312,-11.845582)"> + d="m 38,33.292974 17.85,8" + style="fill:none;stroke:#cf0e0e;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + d="m 38,41.354548 17.85,-8" + style="fill:none;stroke:#cf0e0e;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + + + + @@ -1089,9 +1175,9 @@ @@ -1102,19 +1188,19 @@ inkscape:groupmode="layer"> @@ -1127,9 +1213,9 @@ @@ -1332,7 +1418,7 @@ @@ -1360,15 +1446,18 @@ + id="Telemetry-Error" + transform="translate(-3.4013125,0)"> + id="path4353" + inkscape:connector-curvature="0" /> + id="path4355" + inkscape:connector-curvature="0" /> + id="Power-Error" + transform="translate(-1.9500095,0)"> @@ -1668,7 +1758,7 @@ style="display:none"> @@ -1698,7 +1788,7 @@ id="Battery-Error" style="stroke:#cf0e0e;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" inkscape:label="#g4026" - transform="translate(0,9.5134715)"> + transform="translate(-1.9500095,9.5134715)"> + transform="translate(-2.3409014,-0.20358251)"> + style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans" + transform="translate(2.8817153,-0.30233889)"> + style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans" + transform="translate(2.9776741,0)"> + style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + transform="translate(-3.4013125,0)"> + style="font-size:35.79270172px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + transform="translate(-3.4013125,0)"> + style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + transform="translate(-3.4013125,0)"> + style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans" + transform="translate(-3.4013125,0)"> Battery Sensors + Airspeed - + diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index d74ae5e02..f5b32abad 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -15,6 +15,7 @@ Actuator Attitude Sensors + Airspeed Stabilization Guidance PathPlan From f73d75704be54e80dc022990aa36bb88f8efb317 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 14:22:21 +0100 Subject: [PATCH 078/131] OP-1283 corrected the coordinate calculation of alarm items by including a multiplication of the inverse of the background matrix and the alarm item matrix --- .../systemhealth/systemhealthgadgetwidget.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index fc7232590..b1ebf131a 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -97,6 +97,8 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) delete item; // removeItem does _not_ delete the item. } + QMatrix backgroundMatrix = m_renderer->matrixForElement(background->elementId()); + QString alarm = systemAlarm->getName(); foreach(UAVObjectField * field, systemAlarm->getFields()) { for (uint i = 0; i < field->getNumElements(); ++i) { @@ -104,12 +106,16 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) QString value = field->getValue(i).toString(); if (!missingElements->contains(element)) { if (m_renderer->elementExists(element)) { - QMatrix blockMatrix = m_renderer->matrixForElement(element); - qreal startX = blockMatrix.mapRect(m_renderer->boundsOnElement(element)).x(); - qreal startY = blockMatrix.mapRect(m_renderer->boundsOnElement(element)).y(); - QString element2 = element + "-" + value; + QString element2 = element + "-" + value; if (!missingElements->contains(element2)) { if (m_renderer->elementExists(element2)) { + // element2 is in global coordinates + // transform its matrix into the coordinates of background + QMatrix blockMatrix = backgroundMatrix.inverted() * m_renderer->matrixForElement(element2); + // use this composed projection to get the position in background corrdinates + qreal startX = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).x(); + qreal startY = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).y(); + QGraphicsSvgItem *ind = new QGraphicsSvgItem(); ind->setSharedRenderer(m_renderer); ind->setElementId(element2); From 6cb2797c4f48eb718305e442744fe899acbd56b5 Mon Sep 17 00:00:00 2001 From: m_thread Date: Fri, 28 Mar 2014 14:34:33 +0100 Subject: [PATCH 079/131] OP-1245 Made the dialog raise to front if hidden by main window. --- ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp index 5b8e9def6..2e1c232b0 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp @@ -75,6 +75,8 @@ void FlightLogPlugin::ShowLogManagementDialog() m_logDialog = new FlightLogDialog(0, new FlightLogManager()); connect(m_logDialog, SIGNAL(finished(int)), this, SLOT(LogManagementDialogClosed())); m_logDialog->show(); + } else { + m_logDialog->raise(); } } From c8c9411fca37e46927a12932e30e421a85b6b65e Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 14:43:39 +0100 Subject: [PATCH 080/131] OP-1283 spelling error in comment corrected --- .../src/plugins/systemhealth/systemhealthgadgetwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index b1ebf131a..f8882c875 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -112,7 +112,7 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) // element2 is in global coordinates // transform its matrix into the coordinates of background QMatrix blockMatrix = backgroundMatrix.inverted() * m_renderer->matrixForElement(element2); - // use this composed projection to get the position in background corrdinates + // use this composed projection to get the position in background coordinates qreal startX = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).x(); qreal startY = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).y(); From 9a207fbb80e4e1b4aab5c6d68b1ff168d7587d16 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 16:59:52 +0100 Subject: [PATCH 081/131] OP-1273 OP-1282 OP-1283 diverse improvements in airspeed sensor handling including implementation of PixHaw sensor, airspeedalarm in Systemhealth and in all airspeed sensors; file changes --- flight/modules/Airspeed/airspeed.c | 15 ++++----------- flight/modules/Airspeed/baro_airspeed_etasv3.c | 7 ++++--- flight/modules/Airspeed/baro_airspeed_mpxv.c | 6 +++++- flight/modules/Airspeed/baro_airspeed_ms4525do.c | 10 ++++++---- flight/modules/Airspeed/gps_airspeed.c | 4 ++++ 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index b81d5ad5d..f2810cadd 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -45,6 +45,7 @@ #include "baro_airspeed_etasv3.h" #include "baro_airspeed_mpxv.h" #include "gps_airspeed.h" +#include "airspeedalarm.h" #include "taskinfo.h" // Private constants @@ -155,18 +156,9 @@ static void airspeedTask(__attribute__((unused)) void *parameters) // Update the airspeed object AirspeedSensorGet(&airspeedData); - // if sensor type changed and the last sensor was - // either Eagletree or PixHawk, reset Airspeed alarm + // if sensor type changed reset Airspeed alarm if (airspeedSettings.AirspeedSensorType != lastAirspeedSensorType) { - switch (lastAirspeedSensorType) { - // Eagletree or PixHawk => Reset Airspeed alams - case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_EAGLETREEAIRSPEEDV3: - case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_PIXHAWKAIRSPEEDMS4525DO: - AlarmsDefault(SYSTEMALARMS_ALARM_AIRSPEED); - break; - // else do not reset Airspeed alarm - default: break; - } + AirspeedAlarm(SYSTEMALARMS_ALARM_DEFAULT); lastAirspeedSensorType = airspeedSettings.AirspeedSensorType; } @@ -196,6 +188,7 @@ static void airspeedTask(__attribute__((unused)) void *parameters) case AIRSPEEDSETTINGS_AIRSPEEDSENSORTYPE_NONE: default: airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + break; } // Set the UAVO diff --git a/flight/modules/Airspeed/baro_airspeed_etasv3.c b/flight/modules/Airspeed/baro_airspeed_etasv3.c index 62fc1f50a..66f047fb8 100644 --- a/flight/modules/Airspeed/baro_airspeed_etasv3.c +++ b/flight/modules/Airspeed/baro_airspeed_etasv3.c @@ -40,6 +40,7 @@ #include "hwsettings.h" #include "airspeedsettings.h" #include "airspeedsensor.h" // object that will be updated by the module +#include "airspeedalarm.h" #if defined(PIOS_INCLUDE_ETASV3) @@ -64,13 +65,13 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings if (airspeedSensor->SensorValue == (uint16_t)-1) { airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; airspeedSensor->CalibratedAirspeed = 0; - AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_ERROR); + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); return; } // only calibrate if no stored calibration is available if (!airspeedSettings->ZeroPoint) { - AlarmsSet(SYSTEMALARMS_ALARM_I2C, SYSTEMALARMS_ALARM_WARNING); + AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); // Calibrate sensor by averaging zero point value if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { calibrationCount++; @@ -95,7 +96,7 @@ void baro_airspeedGetETASV3(AirspeedSensorData *airspeedSensor, AirspeedSettings // Compute airspeed airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * sqrtf((float)abs(airspeedSensor->SensorValue - airspeedSettings->ZeroPoint)); airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; - AlarmsClear(SYSTEMALARMS_ALARM_I2C); + AirspeedAlarm(SYSTEMALARMS_ALARM_OK); } diff --git a/flight/modules/Airspeed/baro_airspeed_mpxv.c b/flight/modules/Airspeed/baro_airspeed_mpxv.c index c05322dfc..086159e49 100644 --- a/flight/modules/Airspeed/baro_airspeed_mpxv.c +++ b/flight/modules/Airspeed/baro_airspeed_mpxv.c @@ -40,6 +40,7 @@ #include "hwsettings.h" #include "airspeedsettings.h" #include "airspeedsensor.h" // object that will be updated by the module +#include "airspeedalarm.h" #if defined(PIOS_INCLUDE_MPXV) @@ -63,7 +64,7 @@ void baro_airspeedGetMPXV(AirspeedSensorData *airspeedSensor, AirspeedSettingsDa // Ensure that the ADC pin is properly configured if (airspeedADCPin < 0) { airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; - + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); return; } if (sensor.type == PIOS_MPXV_UNKNOWN) { @@ -76,6 +77,7 @@ void baro_airspeedGetMPXV(AirspeedSensorData *airspeedSensor, AirspeedSettingsDa break; default: airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); return; } } @@ -83,6 +85,7 @@ void baro_airspeedGetMPXV(AirspeedSensorData *airspeedSensor, AirspeedSettingsDa airspeedSensor->SensorValue = PIOS_MPXV_Measure(&sensor); if (!airspeedSettings->ZeroPoint) { + AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); // Calibrate sensor by averaging zero point value if (calibrationCount < CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { // First let sensor warm up and stabilize. calibrationCount++; @@ -107,6 +110,7 @@ void baro_airspeedGetMPXV(AirspeedSensorData *airspeedSensor, AirspeedSettingsDa airspeedSensor->CalibratedAirspeed = PIOS_MPXV_CalcAirspeed(&sensor, airspeedSensor->SensorValue) * (alpha) + airspeedSensor->CalibratedAirspeed * (1.0f - alpha); airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; + AirspeedAlarm(SYSTEMALARMS_ALARM_OK); } #endif /* if defined(PIOS_INCLUDE_MPXV) */ diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index 5ca0469a8..5db4dfa50 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -40,6 +40,7 @@ #include "hwsettings.h" #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) @@ -71,7 +72,8 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin int8_t retVal = PIOS_MS4525DO_Request(); if (retVal != 0) { - AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_ERROR); + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); + return; } @@ -84,17 +86,17 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin retVal = baro_airspeedReadMS4525DO(airspeedSensor, airspeedSettings); switch (retVal) { - case 0: AlarmsClear(SYSTEMALARMS_ALARM_AIRSPEED); + case 0: AirspeedAlarm(SYSTEMALARMS_ALARM_OK); break; case -4: case -5: - case -7: AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_WARNING); + case -7: AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); break; case -1: case -2: case -3: case -6: - default: AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, SYSTEMALARMS_ALARM_ERROR); + default: AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); } } diff --git a/flight/modules/Airspeed/gps_airspeed.c b/flight/modules/Airspeed/gps_airspeed.c index baa31e46f..794b7fa08 100644 --- a/flight/modules/Airspeed/gps_airspeed.c +++ b/flight/modules/Airspeed/gps_airspeed.c @@ -37,6 +37,7 @@ #include "airspeedsettings.h" #include "gps_airspeed.h" #include "CoordinateConversions.h" +#include "airspeedalarm.h" #include @@ -127,6 +128,7 @@ void gps_airspeedGet(AirspeedSensorData *airspeedData, AirspeedSettingsData *air if (gpsVelData.North * gpsVelData.North + gpsVelData.East * gpsVelData.East + gpsVelData.Down * gpsVelData.Down < 1.0f) { airspeedData->CalibratedAirspeed = 0; airspeedData->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); return; // do not calculate if gps velocity is insufficient... } @@ -141,11 +143,13 @@ void gps_airspeedGet(AirspeedSensorData *airspeedData, AirspeedSettingsData *air if (!IS_REAL(airspeedData->CalibratedAirspeed)) { airspeedData->CalibratedAirspeed = 0; airspeedData->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); } else { // need a low pass filter to filter out spikes in non coordinated maneuvers airspeedData->CalibratedAirspeed = (1.0f - airspeedSettings->GroundSpeedBasedEstimationLowPassAlpha) * gps->oldAirspeed + airspeedSettings->GroundSpeedBasedEstimationLowPassAlpha * airspeed; gps->oldAirspeed = airspeedData->CalibratedAirspeed; airspeedData->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; + AirspeedAlarm(SYSTEMALARMS_ALARM_OK); } // Save old variables for next pass From e014a61fcc2d2c8bc9741d581e497b9f2093bfa4 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 17:00:42 +0100 Subject: [PATCH 082/131] OP-1273 OP-1282 OP-1283 diverse improvements in airspeed sensor handling including implementation of PixHaw sensor, airspeedalarm in Systemhealth and in all airspeed sensors; file added --- flight/modules/Airspeed/airspeedalarm.c | 68 +++++++++++++++++++++ flight/modules/Airspeed/inc/airspeedalarm.h | 45 ++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 flight/modules/Airspeed/airspeedalarm.c create mode 100644 flight/modules/Airspeed/inc/airspeedalarm.h diff --git a/flight/modules/Airspeed/airspeedalarm.c b/flight/modules/Airspeed/airspeedalarm.c new file mode 100644 index 000000000..f490adc3a --- /dev/null +++ b/flight/modules/Airspeed/airspeedalarm.c @@ -0,0 +1,68 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Handle locally airspeed alarms issue changes to PIOS only when necessary + * @{ + * + * @file airspeedalarm.c + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * Output object: none + * + * Handle locally airspeed alarms issue changes to PIOS only when necessary + * + */ + +#include "airspeedalarm.h" + +// local variable + +static SystemAlarmsAlarmOptions severitySet = SYSTEMALARMS_ALARM_UNINITIALISED; + +// functions + +/** + * Handle airspeed alarms and isuue an Alarm to PIOS only if necessary + */ +bool AirspeedAlarm(SystemAlarmsAlarmOptions severity) +{ + if( severity == severitySet ){ + return false; + } + + severitySet = severity; + + return ( AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, severity) == 0); +} + + + + + +/** + * @} + * @} + */ diff --git a/flight/modules/Airspeed/inc/airspeedalarm.h b/flight/modules/Airspeed/inc/airspeedalarm.h new file mode 100644 index 000000000..0a5d6c25f --- /dev/null +++ b/flight/modules/Airspeed/inc/airspeedalarm.h @@ -0,0 +1,45 @@ +/** + ****************************************************************************** + * @addtogroup OpenPilotModules OpenPilot Modules + * @{ + * @addtogroup AirspeedModule Airspeed Module + * @brief Handle locally airspeed alarms issue changes to PIOS only when necessary + * @{ + * + * @file airspeedalarm.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014. + * @brief Airspeed module, reads temperature and pressure from MS4525DO + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef AIRSPEEDALARM_H +#define AIRSPEEDALARM_H + +#include +#include "alarms.h" + + +bool AirspeedAlarm(SystemAlarmsAlarmOptions severity); + +#endif // AIRSPEEDALARM_H + +/** + * @} + * @} + */ From a08b7ad21c07b161494961c07cf0927fffbfb97b Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 17:11:55 +0100 Subject: [PATCH 083/131] OP-1273 OP-1282 OP-1283 uncrustify --- flight/modules/Airspeed/airspeedalarm.c | 11 ++++------- flight/modules/Airspeed/baro_airspeed_ms4525do.c | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/flight/modules/Airspeed/airspeedalarm.c b/flight/modules/Airspeed/airspeedalarm.c index f490adc3a..c14b62ca1 100644 --- a/flight/modules/Airspeed/airspeedalarm.c +++ b/flight/modules/Airspeed/airspeedalarm.c @@ -49,19 +49,16 @@ static SystemAlarmsAlarmOptions severitySet = SYSTEMALARMS_ALARM_UNINITIALISED; */ bool AirspeedAlarm(SystemAlarmsAlarmOptions severity) { - if( severity == severitySet ){ + if (severity == severitySet) { return false; } - + severitySet = severity; - - return ( AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, severity) == 0); + + return AlarmsSet(SYSTEMALARMS_ALARM_AIRSPEED, severity) == 0; } - - - /** * @} * @} diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index 5db4dfa50..86091ff6f 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -73,7 +73,7 @@ void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettin if (retVal != 0) { AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); - + return; } From fd27a23225f10f8572e852f18b55ab472a2914ea Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 18:16:03 +0100 Subject: [PATCH 084/131] OP-1283 Matrix inversion outside loop, mapRect called once --- .../plugins/systemhealth/systemhealthgadgetwidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index f8882c875..2f78e8141 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -97,7 +97,7 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) delete item; // removeItem does _not_ delete the item. } - QMatrix backgroundMatrix = m_renderer->matrixForElement(background->elementId()); + QMatrix backgroundMatrix = (m_renderer->matrixForElement(background->elementId())).inverted(); QString alarm = systemAlarm->getName(); foreach(UAVObjectField * field, systemAlarm->getFields()) { @@ -111,17 +111,16 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) if (m_renderer->elementExists(element2)) { // element2 is in global coordinates // transform its matrix into the coordinates of background - QMatrix blockMatrix = backgroundMatrix.inverted() * m_renderer->matrixForElement(element2); + QMatrix blockMatrix = backgroundMatrix * m_renderer->matrixForElement(element2); // use this composed projection to get the position in background coordinates - qreal startX = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).x(); - qreal startY = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).y(); + QRectF rectProjected = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)); QGraphicsSvgItem *ind = new QGraphicsSvgItem(); ind->setSharedRenderer(m_renderer); ind->setElementId(element2); ind->setParentItem(background); QTransform matrix; - matrix.translate(startX, startY); + matrix.translate(rectProjected.x(), rectProjected.y()); ind->setTransform(matrix, false); } else { if (value.compare("Uninitialised") != 0) { From cf1c5b3f367ccc6d99597d64eb85b2af2e233d32 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 28 Mar 2014 18:20:06 +0100 Subject: [PATCH 085/131] OP-1273 OP-1282 OP-1283 smal enhancements on SystemHealthGadgetWidget: Matrix inversion out of loop and mapRect called once --- .../plugins/systemhealth/systemhealthgadgetwidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index f8882c875..2f78e8141 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -97,7 +97,7 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) delete item; // removeItem does _not_ delete the item. } - QMatrix backgroundMatrix = m_renderer->matrixForElement(background->elementId()); + QMatrix backgroundMatrix = (m_renderer->matrixForElement(background->elementId())).inverted(); QString alarm = systemAlarm->getName(); foreach(UAVObjectField * field, systemAlarm->getFields()) { @@ -111,17 +111,16 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) if (m_renderer->elementExists(element2)) { // element2 is in global coordinates // transform its matrix into the coordinates of background - QMatrix blockMatrix = backgroundMatrix.inverted() * m_renderer->matrixForElement(element2); + QMatrix blockMatrix = backgroundMatrix * m_renderer->matrixForElement(element2); // use this composed projection to get the position in background coordinates - qreal startX = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).x(); - qreal startY = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)).y(); + QRectF rectProjected = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)); QGraphicsSvgItem *ind = new QGraphicsSvgItem(); ind->setSharedRenderer(m_renderer); ind->setElementId(element2); ind->setParentItem(background); QTransform matrix; - matrix.translate(startX, startY); + matrix.translate(rectProjected.x(), rectProjected.y()); ind->setTransform(matrix, false); } else { if (value.compare("Uninitialised") != 0) { From 96865faebd4682a8207700d1f1a16925060bd3f6 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 30 Mar 2014 16:40:42 +0200 Subject: [PATCH 086/131] fixed systemalarms throttling due to prolems over radio telemetry --- shared/uavobjectdefinition/systemalarms.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index d74ae5e02..d17877cd9 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -43,8 +43,8 @@ - - + + From 057563dfb2f70590c7f28b7af471a40cab5c72d0 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 30 Mar 2014 17:47:31 +0200 Subject: [PATCH 087/131] OP-1170 re-activated accidently commented out code from commit a79efd7 --- .../openpilotgcs/src/plugins/opmap/modelmapproxy.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp b/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp index 73c495b34..6655351bb 100644 --- a/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/modelmapproxy.cpp @@ -292,11 +292,9 @@ void modelMapProxy::dataChanged(const QModelIndex &topLeft, const QModelIndex &b void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last) { Q_UNUSED(parent); - Q_UNUSED(first); - Q_UNUSED(last); - /* - for (int x = first; x < last + 1; x++) { + + for (int x = first; x < last + 1; x++) { QModelIndex index; WayPointItem *item; internals::PointLatLng latlng; @@ -324,8 +322,8 @@ void modelMapProxy::rowsInserted(const QModelIndex &parent, int first, int last) } else { item = myMap->WPInsert(latlng, altitude, desc, x); } - } - */ + } + refreshOverlays(); } void modelMapProxy::deleteWayPoint(int number) From 5ed417323e81b6f4ae0ef90fd93ed884d3a2ac30 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Mon, 31 Mar 2014 22:16:29 +0200 Subject: [PATCH 088/131] OP-1273 OP-1282 OP-1283 bug fixes on I2C library: check for intialization and hot-plug robustness --- flight/modules/Airspeed/airspeed.c | 1 + .../modules/Airspeed/baro_airspeed_ms4525do.c | 66 +++++-------------- flight/pios/common/pios_ms4525do.c | 43 ------------ flight/pios/inc/pios_i2c_priv.h | 4 ++ flight/pios/stm32f4xx/pios_i2c.c | 61 ++++++++++++++--- 5 files changed, 72 insertions(+), 103 deletions(-) diff --git a/flight/modules/Airspeed/airspeed.c b/flight/modules/Airspeed/airspeed.c index f2810cadd..bc60159c4 100644 --- a/flight/modules/Airspeed/airspeed.c +++ b/flight/modules/Airspeed/airspeed.c @@ -148,6 +148,7 @@ static void airspeedTask(__attribute__((unused)) void *parameters) airspeedData.SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; + // Main task loop portTickType lastSysTime = xTaskGetTickCount(); while (1) { diff --git a/flight/modules/Airspeed/baro_airspeed_ms4525do.c b/flight/modules/Airspeed/baro_airspeed_ms4525do.c index 86091ff6f..181f07c47 100644 --- a/flight/modules/Airspeed/baro_airspeed_ms4525do.c +++ b/flight/modules/Airspeed/baro_airspeed_ms4525do.c @@ -54,13 +54,9 @@ #define CASFACTOR 760.8802669f // sqrt(5) * speed of sound at standard #define TASFACTOR 0.05891022589f // 1/sqrt(T0) -#define max(x, y) ((x) >= (y) ? (x) : (y)) - // Private types // Private functions definitions -static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings); - // Private variables static uint16_t calibrationCount = 0; @@ -68,64 +64,32 @@ static uint32_t filter_reg = 0; // Barry Dorr filter register void baro_airspeedGetMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) { - // request measurement first - int8_t retVal = PIOS_MS4525DO_Request(); - - if (retVal != 0) { - AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); - - return; - } - - // Datasheet of MS4525DO: conversion needs 0.5 ms + 20% more when status bit used - // delay by one Tick or at least 2 ms - const portTickType xDelay = max(2 / portTICK_RATE_MS, 1); - vTaskDelay(xDelay); - - // read the sensor - retVal = baro_airspeedReadMS4525DO(airspeedSensor, airspeedSettings); - - switch (retVal) { - case 0: AirspeedAlarm(SYSTEMALARMS_ALARM_OK); - break; - case -4: - case -5: - case -7: AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); - break; - case -1: - case -2: - case -3: - case -6: - default: AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); - } -} - - -// Private functions -static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, AirspeedSettingsData *airspeedSettings) -{ - // Check to see if airspeed sensor is returning airspeedSensor uint16_t values[2]; + + // Read sensor int8_t retVal = PIOS_MS4525DO_Read(values); - if (retVal == 0) { - airspeedSensor->SensorValue = values[0]; - airspeedSensor->SensorValueTemperature = values[1]; - } else { + // check for errors + if (retVal != 0) { airspeedSensor->SensorValue = -1; airspeedSensor->SensorValueTemperature = -1; airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_FALSE; airspeedSensor->CalibratedAirspeed = 0; - return retVal; + AirspeedAlarm(SYSTEMALARMS_ALARM_ERROR); + return; } + airspeedSensor->SensorValue = values[0]; + airspeedSensor->SensorValueTemperature = values[1]; + // only calibrate if no stored calibration is available if (!airspeedSettings->ZeroPoint) { // Calibrate sensor by averaging zero point value if (calibrationCount <= CALIBRATION_IDLE_MS / airspeedSettings->SamplePeriod) { calibrationCount++; filter_reg = (airspeedSensor->SensorValue << FILTER_SHIFT); - return -7; + AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); + return; } else if (calibrationCount <= (CALIBRATION_IDLE_MS + CALIBRATION_COUNT_MS) / airspeedSettings->SamplePeriod) { calibrationCount++; // update filter register @@ -138,7 +102,8 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs AirspeedSettingsZeroPointSet(&airspeedSettings->ZeroPoint); calibrationCount = 0; } - return -7; + AirspeedAlarm(SYSTEMALARMS_ALARM_WARNING); + return; } } @@ -163,11 +128,10 @@ static int8_t baro_airspeedReadMS4525DO(AirspeedSensorData *airspeedSensor, Airs airspeedSensor->CalibratedAirspeed = airspeedSettings->Scale * CASFACTOR * sqrtf(powf(fabsf(dP) / P0 + 1.0f, CCEXPONENT) - 1.0f); airspeedSensor->TrueAirspeed = airspeedSensor->CalibratedAirspeed * TASFACTOR * sqrtf(T); airspeedSensor->SensorConnected = AIRSPEEDSENSOR_SENSORCONNECTED_TRUE; - - return retVal; + // everything is fine so set ALARM_OK + AirspeedAlarm(SYSTEMALARMS_ALARM_OK); } - #endif /* if defined(PIOS_INCLUDE_MS4525DO) */ /** diff --git a/flight/pios/common/pios_ms4525do.c b/flight/pios/common/pios_ms4525do.c index 8a8fc9aab..8ad7ce093 100644 --- a/flight/pios/common/pios_ms4525do.c +++ b/flight/pios/common/pios_ms4525do.c @@ -34,10 +34,6 @@ #ifdef PIOS_INCLUDE_MS4525DO /* Local Defs and Variables */ -static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len); -static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len); - -static bool pios_ms4525do_requested = false; static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len) @@ -56,46 +52,10 @@ static int8_t PIOS_MS4525DO_ReadI2C(uint8_t *buffer, uint8_t len) } -static int8_t PIOS_MS4525DO_WriteI2C(uint8_t *buffer, uint8_t len) -{ - const struct pios_i2c_txn txn_list[] = { - { - .info = __func__, - .addr = MS4525DO_I2C_ADDR, - .rw = PIOS_I2C_TXN_WRITE, - .len = len, - .buf = buffer, - } - }; - - return PIOS_I2C_Transfer(PIOS_I2C_MS4525DO_ADAPTER, txn_list, NELEMENTS(txn_list)); -} - - -int8_t PIOS_MS4525DO_Request(void) -{ - // MS4525DO expects a zero length write. - // Sending one byte is a workaround that works for the moment - uint8_t data = 0; - int8_t retVal = PIOS_MS4525DO_WriteI2C(&data, sizeof(data)); - - /* requested only when transfer worked */ - pios_ms4525do_requested = (retVal == 0); - - return retVal; -} - - // values has to ba an arrray with two elements // values stay untouched on error int8_t PIOS_MS4525DO_Read(uint16_t *values) { - if (!pios_ms4525do_requested) { - /* Do not try to read when not requested */ - /* else probably stale data will be obtained */ - return -4; - } - uint8_t data[4]; int8_t retVal = PIOS_MS4525DO_ReadI2C(data, sizeof(data)); @@ -117,9 +77,6 @@ int8_t PIOS_MS4525DO_Read(uint16_t *values) values[1] += data[3]; values[1] = (values[1] >> 5); - /* not requested anymore, only when transfer worked */ - pios_ms4525do_requested = !(retVal == 0); - return retVal; } diff --git a/flight/pios/inc/pios_i2c_priv.h b/flight/pios/inc/pios_i2c_priv.h index aeeff5648..b2f340c83 100644 --- a/flight/pios/inc/pios_i2c_priv.h +++ b/flight/pios/inc/pios_i2c_priv.h @@ -92,6 +92,10 @@ struct pios_i2c_adapter { uint8_t busy; #endif + /* variables for transfer timeouts */ + uint32_t transfer_delay_uS; // approx time to transfer one byte, calculated later basen on setting use here time based on 100 kbits/s + uint32_t transfer_timeout_ticks; // take something tha makes sense for small transaction, calculated later based upon transmission desired + bool bus_error; bool nack; diff --git a/flight/pios/stm32f4xx/pios_i2c.c b/flight/pios/stm32f4xx/pios_i2c.c index a5a7b6969..587afe966 100644 --- a/flight/pios/stm32f4xx/pios_i2c.c +++ b/flight/pios/stm32f4xx/pios_i2c.c @@ -754,6 +754,11 @@ static void i2c_adapter_reset_bus(struct pios_i2c_adapter *i2c_adapter) /* Initialize the I2C block */ I2C_Init(i2c_adapter->cfg->regs, (I2C_InitTypeDef *)&(i2c_adapter->cfg->init)); + // for delays during transfer timeouts + // one tick correspond to transmission of 1 byte i.e. 9 clock ticks + i2c_adapter->transfer_delay_uS=9000000/(((I2C_InitTypeDef *)&(i2c_adapter->cfg->init))->I2C_ClockSpeed); + + if (i2c_adapter->cfg->regs->SR2 & I2C_FLAG_BUSY) { /* Reset the I2C block */ I2C_SoftwareResetCmd(i2c_adapter->cfg->regs, ENABLE); @@ -761,7 +766,6 @@ static void i2c_adapter_reset_bus(struct pios_i2c_adapter *i2c_adapter) } } -#include /* Return true if the FSM is in a terminal state */ static bool i2c_adapter_fsm_terminated(struct pios_i2c_adapter *i2c_adapter) @@ -789,9 +793,16 @@ static bool i2c_adapter_callback_handler(struct pios_i2c_adapter *i2c_adapter) xSemaphoreGive(i2c_adapter->sem_ready); #endif /* USE_FREERTOS */ + /* transfer_timeout_ticks is set by PIOS_I2C_Transfer_Callback */ /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { - ; + //sleep 1 byte, as FSM can't be faster + // FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay + // three times the expected time should cover clock delay + PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); + + i2c_adapter->transfer_timeout_ticks--; + if(i2c_adapter->transfer_timeout_ticks==0)break; } if (i2c_adapter_wait_for_stopped(i2c_adapter)) { @@ -957,6 +968,7 @@ int32_t PIOS_I2C_Init(uint32_t *i2c_id, const struct pios_i2c_adapter_cfg *cfg) NVIC_Init((NVIC_InitTypeDef *)&(i2c_adapter->cfg->event.init)); NVIC_Init((NVIC_InitTypeDef *)&(i2c_adapter->cfg->error.init)); + /* No error */ return 0; @@ -970,6 +982,8 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], bool valid = PIOS_I2C_validate(i2c_adapter); + if(!valid)return -1; + PIOS_Assert(valid) PIOS_DEBUG_Assert(txn_list); @@ -1005,6 +1019,15 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif + // used in the i2c_adapter_callback_handler function + // Estimate bytes of transmission. Per txns: 1 adress byte + length + i2c_adapter->transfer_timeout_ticks= num_txns; + for(uint32_t i=0;itransfer_timeout_ticks += txn_list[i].len; + } + // timeout if it takes three times the expected time + i2c_adapter->transfer_timeout_ticks*=3; + i2c_adapter->callback = NULL; i2c_adapter->bus_error = false; i2c_adapter->nack = false; @@ -1018,9 +1041,15 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { - ; + /* sleep 9 clock ticks (1 byte), because FSM can't be faster than one byte + FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay + three times the expected time should cover clock delay */ + PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); + + i2c_adapter->transfer_timeout_ticks--; + if(i2c_adapter->transfer_timeout_ticks==0)break; } - + if (i2c_adapter_wait_for_stopped(i2c_adapter)) { i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_STOPPED); } else { @@ -1051,6 +1080,8 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx bool valid = PIOS_I2C_validate(i2c_adapter); + if(!valid)return -1; + PIOS_Assert(valid) PIOS_Assert(callback); @@ -1084,6 +1115,15 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif + // used in the i2c_adapter_callback_handler function + // Estimate bytes of transmission. Per txns: 1 adress byte + length + i2c_adapter->transfer_timeout_ticks= num_txns; + for(uint32_t i=0;itransfer_timeout_ticks += txn_list[i].len; + } + // timeout if it takes three times the expected time + i2c_adapter->transfer_timeout_ticks*=3; + i2c_adapter->callback = callback; i2c_adapter->bus_error = false; i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_START); @@ -1097,6 +1137,8 @@ void PIOS_I2C_EV_IRQ_Handler(uint32_t i2c_id) bool valid = PIOS_I2C_validate(i2c_adapter); + if(!valid)return; + PIOS_Assert(valid) uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); @@ -1205,9 +1247,9 @@ void PIOS_I2C_EV_IRQ_Handler(uint32_t i2c_id) /* Ignore this event and wait for TRANSMITTED in case we can't keep up */ goto skip_event; break; - case 0x30084: /* Occurs between byte tranmistted and master mode selected */ - case 0x30000: /* Need to throw away this spurious event */ - case 0x30403 & EVENT_MASK: /* Detected this after got a NACK, probably stop bit */ + case 0x30084: /* BUSY + MSL + TXE + BFT Occurs between byte transmitted and master mode selected */ + case 0x30000: /* BUSY + MSL Need to throw away this spurious event */ + case 0x30403 & EVENT_MASK: /* BUSY + MSL + SB + ADDR Detected this after got a NACK, probably stop bit */ goto skip_event; break; default: @@ -1230,14 +1272,15 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) bool valid = PIOS_I2C_validate(i2c_adapter); + if(!valid)return; + PIOS_Assert(valid) -#if defined(PIOS_I2C_DIAGNOSTICS) uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); +#if defined(PIOS_I2C_DIAGNOSTICS) i2c_erirq_history[i2c_erirq_history_pointer] = event; i2c_erirq_history_pointer = (i2c_erirq_history_pointer + 1) % 5; - #endif if (event & I2C_FLAG_AF) { From 830f13596e8a58d4cb9b4332390ccb342b3b5309 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Mon, 31 Mar 2014 22:17:58 +0200 Subject: [PATCH 089/131] OP-1273 OP-1282 OP-1283 uncrustify --- flight/pios/common/pios_ms4525do.c | 1 + flight/pios/inc/pios_i2c_priv.h | 12 +++--- flight/pios/stm32f4xx/pios_i2c.c | 64 ++++++++++++++++++------------ 3 files changed, 45 insertions(+), 32 deletions(-) diff --git a/flight/pios/common/pios_ms4525do.c b/flight/pios/common/pios_ms4525do.c index 8ad7ce093..10d124a2d 100644 --- a/flight/pios/common/pios_ms4525do.c +++ b/flight/pios/common/pios_ms4525do.c @@ -60,6 +60,7 @@ int8_t PIOS_MS4525DO_Read(uint16_t *values) int8_t retVal = PIOS_MS4525DO_ReadI2C(data, sizeof(data)); uint8_t status = data[0] & 0xC0; + if (status == 0x80) { /* stale data */ return -5; diff --git a/flight/pios/inc/pios_i2c_priv.h b/flight/pios/inc/pios_i2c_priv.h index b2f340c83..78c9cd0e7 100644 --- a/flight/pios/inc/pios_i2c_priv.h +++ b/flight/pios/inc/pios_i2c_priv.h @@ -92,12 +92,12 @@ struct pios_i2c_adapter { uint8_t busy; #endif - /* variables for transfer timeouts */ - uint32_t transfer_delay_uS; // approx time to transfer one byte, calculated later basen on setting use here time based on 100 kbits/s - uint32_t transfer_timeout_ticks; // take something tha makes sense for small transaction, calculated later based upon transmission desired - - bool bus_error; - bool nack; + /* variables for transfer timeouts */ + uint32_t transfer_delay_uS; // approx time to transfer one byte, calculated later basen on setting use here time based on 100 kbits/s + uint32_t transfer_timeout_ticks; // take something tha makes sense for small transaction, calculated later based upon transmission desired + + bool bus_error; + bool nack; volatile enum i2c_adapter_state curr_state; const struct pios_i2c_txn *first_txn; diff --git a/flight/pios/stm32f4xx/pios_i2c.c b/flight/pios/stm32f4xx/pios_i2c.c index 587afe966..eef03be79 100644 --- a/flight/pios/stm32f4xx/pios_i2c.c +++ b/flight/pios/stm32f4xx/pios_i2c.c @@ -756,9 +756,9 @@ static void i2c_adapter_reset_bus(struct pios_i2c_adapter *i2c_adapter) // for delays during transfer timeouts // one tick correspond to transmission of 1 byte i.e. 9 clock ticks - i2c_adapter->transfer_delay_uS=9000000/(((I2C_InitTypeDef *)&(i2c_adapter->cfg->init))->I2C_ClockSpeed); + i2c_adapter->transfer_delay_uS = 9000000 / (((I2C_InitTypeDef *)&(i2c_adapter->cfg->init))->I2C_ClockSpeed); + - if (i2c_adapter->cfg->regs->SR2 & I2C_FLAG_BUSY) { /* Reset the I2C block */ I2C_SoftwareResetCmd(i2c_adapter->cfg->regs, ENABLE); @@ -796,13 +796,15 @@ static bool i2c_adapter_callback_handler(struct pios_i2c_adapter *i2c_adapter) /* transfer_timeout_ticks is set by PIOS_I2C_Transfer_Callback */ /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { - //sleep 1 byte, as FSM can't be faster + // sleep 1 byte, as FSM can't be faster // FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay // three times the expected time should cover clock delay PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); - + i2c_adapter->transfer_timeout_ticks--; - if(i2c_adapter->transfer_timeout_ticks==0)break; + if (i2c_adapter->transfer_timeout_ticks == 0) { + break; + } } if (i2c_adapter_wait_for_stopped(i2c_adapter)) { @@ -982,8 +984,10 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], bool valid = PIOS_I2C_validate(i2c_adapter); - if(!valid)return -1; - + if (!valid) { + return -1; + } + PIOS_Assert(valid) PIOS_DEBUG_Assert(txn_list); @@ -1016,21 +1020,21 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], #ifdef USE_FREERTOS /* Make sure the done/ready semaphore is consumed before we start */ - semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); + semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif // used in the i2c_adapter_callback_handler function // Estimate bytes of transmission. Per txns: 1 adress byte + length - i2c_adapter->transfer_timeout_ticks= num_txns; - for(uint32_t i=0;itransfer_timeout_ticks = num_txns; + for (uint32_t i = 0; i < num_txns; i++) { i2c_adapter->transfer_timeout_ticks += txn_list[i].len; } // timeout if it takes three times the expected time - i2c_adapter->transfer_timeout_ticks*=3; - + i2c_adapter->transfer_timeout_ticks *= 3; + i2c_adapter->callback = NULL; i2c_adapter->bus_error = false; - i2c_adapter->nack = false; + i2c_adapter->nack = false; i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_START); /* Wait for the transfer to complete */ @@ -1041,15 +1045,17 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { - /* sleep 9 clock ticks (1 byte), because FSM can't be faster than one byte + /* sleep 9 clock ticks (1 byte), because FSM can't be faster than one byte FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay three times the expected time should cover clock delay */ PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); - + i2c_adapter->transfer_timeout_ticks--; - if(i2c_adapter->transfer_timeout_ticks==0)break; + if (i2c_adapter->transfer_timeout_ticks == 0) { + break; + } } - + if (i2c_adapter_wait_for_stopped(i2c_adapter)) { i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_STOPPED); } else { @@ -1080,7 +1086,9 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx bool valid = PIOS_I2C_validate(i2c_adapter); - if(!valid)return -1; + if (!valid) { + return -1; + } PIOS_Assert(valid) PIOS_Assert(callback); @@ -1112,18 +1120,18 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx #ifdef USE_FREERTOS /* Make sure the done/ready semaphore is consumed before we start */ - semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); + semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif // used in the i2c_adapter_callback_handler function // Estimate bytes of transmission. Per txns: 1 adress byte + length - i2c_adapter->transfer_timeout_ticks= num_txns; - for(uint32_t i=0;itransfer_timeout_ticks = num_txns; + for (uint32_t i = 0; i < num_txns; i++) { i2c_adapter->transfer_timeout_ticks += txn_list[i].len; } // timeout if it takes three times the expected time - i2c_adapter->transfer_timeout_ticks*=3; - + i2c_adapter->transfer_timeout_ticks *= 3; + i2c_adapter->callback = callback; i2c_adapter->bus_error = false; i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_START); @@ -1137,7 +1145,9 @@ void PIOS_I2C_EV_IRQ_Handler(uint32_t i2c_id) bool valid = PIOS_I2C_validate(i2c_adapter); - if(!valid)return; + if (!valid) { + return; + } PIOS_Assert(valid) @@ -1272,8 +1282,10 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) bool valid = PIOS_I2C_validate(i2c_adapter); - if(!valid)return; - + if (!valid) { + return; + } + PIOS_Assert(valid) uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); From fd5d1e42a31bc1dcb7d44b9e6a10acf4091fa69b Mon Sep 17 00:00:00 2001 From: Andres <> Date: Tue, 1 Apr 2014 07:46:50 +0200 Subject: [PATCH 090/131] OP-1273 OP-1282 OP-1283 corrected compilation error for fw_revoproto --- flight/modules/Attitude/revolution/attitude.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index 8edbf5cb9..66b77d6fe 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -1072,13 +1072,22 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) vel[2] = gpsVelData.Down; } + // Copy the position into the UAVO + PositionStateData positionState; + PositionStateGet(&positionState); + positionState.North = Nav.Pos[0]; + positionState.East = Nav.Pos[1]; + positionState.Down = Nav.Pos[2]; + PositionStateSet(&positionState); + + // airspeed correction needs current positionState if (airspeed_updated) { // we have airspeed available AirspeedStateData airspeed; AirspeedStateGet(&airspeed); airspeed.CalibratedAirspeed = airspeedData.CalibratedAirspeed; - airspeed.TrueAirspeed = (airspeedSensor.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed *IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedSensor.TrueAirspeed; + airspeed.TrueAirspeed = (airspeedData.TrueAirspeed < 0.f) ? airspeed.CalibratedAirspeed *IAS2TAS(homeLocation.Altitude - positionState.Down) : airspeedData.TrueAirspeed; AirspeedStateSet(&airspeed); @@ -1108,14 +1117,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) INSCorrection(&magData.x, NED, vel, (baroData.Altitude + baroOffset), sensors); } - // Copy the position and velocity into the UAVO - PositionStateData positionState; - PositionStateGet(&positionState); - positionState.North = Nav.Pos[0]; - positionState.East = Nav.Pos[1]; - positionState.Down = Nav.Pos[2]; - PositionStateSet(&positionState); - + // Copy the velocity into the UAVO VelocityStateData velocityState; VelocityStateGet(&velocityState); velocityState.North = Nav.Vel[0]; From da5d5aa9773114f4f7b5bb59e5b5ecc8b247aee0 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Tue, 1 Apr 2014 17:07:03 +0200 Subject: [PATCH 091/131] Fixed dll export related issue in uavobjectutil/uavobjecthelper.h, this bug only affected windows. --- .../src/plugins/uavobjectutil/uavobjecthelper.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h index 7891de004..c7ec495fc 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjecthelper.h @@ -33,9 +33,10 @@ #include #include +#include "uavobjectutil_global.h" #include "uavobject.h" -class UAVOBJECTS_EXPORT AbstractUAVObjectHelper : public QObject { +class UAVOBJECTUTIL_EXPORT AbstractUAVObjectHelper : public QObject { Q_OBJECT public: explicit AbstractUAVObjectHelper(QObject *parent = 0); @@ -58,7 +59,7 @@ private: bool m_transactionCompleted; }; -class UAVOBJECTS_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper { +class UAVOBJECTUTIL_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper { Q_OBJECT public: explicit UAVObjectUpdaterHelper(QObject *parent = 0); @@ -68,7 +69,7 @@ protected: virtual void doObjectAndWaitImpl(); }; -class UAVOBJECTS_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper { +class UAVOBJECTUTIL_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper { Q_OBJECT public: explicit UAVObjectRequestHelper(QObject *parent = 0); From e964c863eb21bd05db7685092d147afc1e35b615 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 1 Apr 2014 22:24:05 +0200 Subject: [PATCH 092/131] Fix the broken revoproto target/sync with revolution --- .../boards/revoproto/firmware/Makefile | 15 ++++++++------- .../boards/revoproto/firmware/UAVObjects.inc | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/flight/targets/boards/revoproto/firmware/Makefile b/flight/targets/boards/revoproto/firmware/Makefile index e282fc35b..2e5df1ac3 100644 --- a/flight/targets/boards/revoproto/firmware/Makefile +++ b/flight/targets/boards/revoproto/firmware/Makefile @@ -29,25 +29,26 @@ USE_DSP_LIB ?= NO # List of mandatory modules to include MODULES += Sensors -MODULES += Attitude/revolution -#MODULES += StateEstimation # use instead of Attitude +#MODULES += Attitude/revolution +MODULES += StateEstimation # use instead of Attitude MODULES += Altitude/revolution MODULES += Airspeed MODULES += AltitudeHold MODULES += Stabilization -MODULES += Receiver +MODULES += VtolPathFollower MODULES += ManualControl +MODULES += Receiver MODULES += Actuator MODULES += GPS +MODULES += TxPID MODULES += CameraStab +MODULES += Battery MODULES += FirmwareIAP MODULES += PathPlanner MODULES += FixedWingPathFollower -#MODULES += OveroSync ## OveroSync disabled until OP292 is fixed +MODULES += Osd/osdoutout +MODULES += Logging MODULES += Telemetry -#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged -#MODULES += Battery -#MODULES += TxPID OPTMODULES += ComUsbBridge diff --git a/flight/targets/boards/revoproto/firmware/UAVObjects.inc b/flight/targets/boards/revoproto/firmware/UAVObjects.inc index 566c3820b..72f51cbec 100644 --- a/flight/targets/boards/revoproto/firmware/UAVObjects.inc +++ b/flight/targets/boards/revoproto/firmware/UAVObjects.inc @@ -1,9 +1,5 @@ -##### -# Project: OpenPilot # -# Makefile for OpenPilot UAVObject code -# -# The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2011. +# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,11 +14,10 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -##### +# # These are the UAVObjects supposed to be build as part of the OpenPilot target # (all architectures) - UAVOBJSRCFILENAMES = UAVOBJSRCFILENAMES += accelgyrosettings UAVOBJSRCFILENAMES += accessorydesired @@ -35,12 +30,16 @@ UAVOBJSRCFILENAMES += gyrostate UAVOBJSRCFILENAMES += gyrosensor UAVOBJSRCFILENAMES += accelstate UAVOBJSRCFILENAMES += accelsensor -UAVOBJSRCFILENAMES += magstate UAVOBJSRCFILENAMES += magsensor +UAVOBJSRCFILENAMES += magstate UAVOBJSRCFILENAMES += barosensor UAVOBJSRCFILENAMES += airspeedsensor UAVOBJSRCFILENAMES += airspeedsettings UAVOBJSRCFILENAMES += airspeedstate +UAVOBJSRCFILENAMES += debuglogsettings +UAVOBJSRCFILENAMES += debuglogcontrol +UAVOBJSRCFILENAMES += debuglogstatus +UAVOBJSRCFILENAMES += debuglogentry UAVOBJSRCFILENAMES += flightbatterysettings UAVOBJSRCFILENAMES += firmwareiapobj UAVOBJSRCFILENAMES += flightbatterystate @@ -67,6 +66,7 @@ UAVOBJSRCFILENAMES += mixersettings UAVOBJSRCFILENAMES += mixerstatus UAVOBJSRCFILENAMES += nedaccel UAVOBJSRCFILENAMES += objectpersistence +UAVOBJSRCFILENAMES += oplinkreceiver UAVOBJSRCFILENAMES += overosyncstats UAVOBJSRCFILENAMES += overosyncsettings UAVOBJSRCFILENAMES += pathaction @@ -102,6 +102,8 @@ UAVOBJSRCFILENAMES += receiveractivity UAVOBJSRCFILENAMES += cameradesired UAVOBJSRCFILENAMES += camerastabsettings UAVOBJSRCFILENAMES += altitudeholdsettings +UAVOBJSRCFILENAMES += oplinksettings +UAVOBJSRCFILENAMES += oplinkstatus UAVOBJSRCFILENAMES += altitudefiltersettings UAVOBJSRCFILENAMES += altitudeholddesired UAVOBJSRCFILENAMES += altitudeholdstatus @@ -110,6 +112,7 @@ UAVOBJSRCFILENAMES += waypointactive UAVOBJSRCFILENAMES += poilocation UAVOBJSRCFILENAMES += poilearnsettings UAVOBJSRCFILENAMES += mpu6000settings +UAVOBJSRCFILENAMES += txpidsettings UAVOBJSRC = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),$(OPUAVSYNTHDIR)/$(UAVOBJSRCFILE).c ) UAVOBJDEFINE = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),-DUAVOBJ_INIT_$(UAVOBJSRCFILE) ) From 8bb1d0148cd81e70df14a08643be9550edb53032 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 1 Apr 2014 22:58:23 +0200 Subject: [PATCH 093/131] Uncrustify --- flight/modules/RadioComBridge/RadioComBridge.c | 16 ++++++++-------- .../systemhealth/systemhealthgadgetwidget.cpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index 73e1a1b7c..caa8c488b 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -298,8 +298,8 @@ static void updateRadioComBridgeStats() // Get stats object data RadioComBridgeStatsGet(&radioComBridgeStats); - radioComBridgeStats.TelemetryTxRetries = data->telemetryTxRetries; - radioComBridgeStats.RadioTxRetries = data->radioTxRetries; + radioComBridgeStats.TelemetryTxRetries = data->telemetryTxRetries; + radioComBridgeStats.RadioTxRetries = data->radioTxRetries; // Update stats object radioComBridgeStats.TelemetryTxBytes += telemetryUAVTalkStats.txBytes; @@ -310,13 +310,13 @@ static void updateRadioComBridgeStats() radioComBridgeStats.TelemetryRxSyncErrors += telemetryUAVTalkStats.rxSyncErrors; radioComBridgeStats.TelemetryRxCrcErrors += telemetryUAVTalkStats.rxCrcErrors; - radioComBridgeStats.RadioTxBytes += radioUAVTalkStats.txBytes; - radioComBridgeStats.RadioTxFailures += radioUAVTalkStats.txErrors; + radioComBridgeStats.RadioTxBytes += radioUAVTalkStats.txBytes; + radioComBridgeStats.RadioTxFailures += radioUAVTalkStats.txErrors; - radioComBridgeStats.RadioRxBytes += radioUAVTalkStats.rxBytes; - radioComBridgeStats.RadioRxFailures += radioUAVTalkStats.rxErrors; - radioComBridgeStats.RadioRxSyncErrors += radioUAVTalkStats.rxSyncErrors; - radioComBridgeStats.RadioRxCrcErrors += radioUAVTalkStats.rxCrcErrors; + radioComBridgeStats.RadioRxBytes += radioUAVTalkStats.rxBytes; + radioComBridgeStats.RadioRxFailures += radioUAVTalkStats.rxErrors; + radioComBridgeStats.RadioRxSyncErrors += radioUAVTalkStats.rxSyncErrors; + radioComBridgeStats.RadioRxCrcErrors += radioUAVTalkStats.rxCrcErrors; // Update stats object data RadioComBridgeStatsSet(&radioComBridgeStats); diff --git a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp index 2f78e8141..572d2ae90 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/systemhealth/systemhealthgadgetwidget.cpp @@ -111,9 +111,9 @@ void SystemHealthGadgetWidget::updateAlarms(UAVObject *systemAlarm) if (m_renderer->elementExists(element2)) { // element2 is in global coordinates // transform its matrix into the coordinates of background - QMatrix blockMatrix = backgroundMatrix * m_renderer->matrixForElement(element2); + QMatrix blockMatrix = backgroundMatrix * m_renderer->matrixForElement(element2); // use this composed projection to get the position in background coordinates - QRectF rectProjected = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)); + QRectF rectProjected = blockMatrix.mapRect(m_renderer->boundsOnElement(element2)); QGraphicsSvgItem *ind = new QGraphicsSvgItem(); ind->setSharedRenderer(m_renderer); From 9b8be63a4f49acab0e546af16619cbfdbf1d3c54 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Wed, 2 Apr 2014 14:18:42 +0200 Subject: [PATCH 094/131] OP-1273 OP-1282 OP-1283 added delay to I2C Transfer function for both stm32f40x and stm32f10x --- flight/pios/stm32f10x/pios_i2c.c | 35 +++++++++++++++++++++++-------- flight/pios/stm32f4xx/pios_i2c.c | 36 +++++++++----------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/flight/pios/stm32f10x/pios_i2c.c b/flight/pios/stm32f10x/pios_i2c.c index 8cb98444c..efd29435e 100644 --- a/flight/pios/stm32f10x/pios_i2c.c +++ b/flight/pios/stm32f10x/pios_i2c.c @@ -933,9 +933,9 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - PIOS_Assert(valid) + if (!PIOS_I2C_validate(i2c_adapter)) { + return -1; + } PIOS_DEBUG_Assert(txn_list); PIOS_DEBUG_Assert(num_txns); @@ -977,6 +977,14 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif + // Estimate bytes of transmission. Per txns: 1 adress byte + length + i2c_adapter->transfer_timeout_ticks = num_txns; + for (uint32_t i = 0; i < num_txns; i++) { + i2c_adapter->transfer_timeout_ticks += txn_list[i].len; + } + // timeout if it takes eight times the expected time + i2c_adapter->transfer_timeout_ticks <<= 3; + i2c_adapter->bus_error = false; i2c_adapter_inject_event(i2c_adapter, I2C_EVENT_START); @@ -992,7 +1000,15 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { - ; + /* sleep 9 clock ticks (1 byte), because FSM can't be faster than one byte + FIXME: clock streching could make problems, but citing NPX: alsmost no slave device implements clock stretching + three times the expected time should cover clock delay */ + PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); + + i2c_adapter->transfer_timeout_ticks--; + if (i2c_adapter->transfer_timeout_ticks == 0) { + break; + } } if (i2c_adapter_wait_for_stopped(i2c_adapter)) { @@ -1019,9 +1035,9 @@ void PIOS_I2C_EV_IRQ_Handler(uint32_t i2c_id) { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - PIOS_Assert(valid) + if (!PIOS_I2C_validate(i2c_adapter)) { + return; + } uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); @@ -1145,9 +1161,10 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); + if (!PIOS_I2C_validate(i2c_adapter)) { + return; + } - PIOS_Assert(valid) #if defined(PIOS_I2C_DIAGNOSTICS) uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); diff --git a/flight/pios/stm32f4xx/pios_i2c.c b/flight/pios/stm32f4xx/pios_i2c.c index eef03be79..385f6a6cd 100644 --- a/flight/pios/stm32f4xx/pios_i2c.c +++ b/flight/pios/stm32f4xx/pios_i2c.c @@ -797,7 +797,7 @@ static bool i2c_adapter_callback_handler(struct pios_i2c_adapter *i2c_adapter) /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { // sleep 1 byte, as FSM can't be faster - // FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay + // FIXME: clock stretching could make problems, but citing NPX: alsmost no slave device implements clock stretching // three times the expected time should cover clock delay PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); @@ -982,14 +982,10 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - if (!valid) { + if (!PIOS_I2C_validate(i2c_adapter)) { return -1; } - PIOS_Assert(valid) - PIOS_DEBUG_Assert(txn_list); PIOS_DEBUG_Assert(num_txns); @@ -1023,14 +1019,13 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], semaphore_success &= (xSemaphoreTake(i2c_adapter->sem_ready, timeout) == pdTRUE); #endif - // used in the i2c_adapter_callback_handler function // Estimate bytes of transmission. Per txns: 1 adress byte + length i2c_adapter->transfer_timeout_ticks = num_txns; for (uint32_t i = 0; i < num_txns; i++) { i2c_adapter->transfer_timeout_ticks += txn_list[i].len; } - // timeout if it takes three times the expected time - i2c_adapter->transfer_timeout_ticks *= 3; + // timeout if it takes eight times the expected time + i2c_adapter->transfer_timeout_ticks <<= 3; i2c_adapter->callback = NULL; i2c_adapter->bus_error = false; @@ -1046,7 +1041,7 @@ int32_t PIOS_I2C_Transfer(uint32_t i2c_id, const struct pios_i2c_txn txn_list[], /* Spin waiting for the transfer to finish */ while (!i2c_adapter_fsm_terminated(i2c_adapter)) { /* sleep 9 clock ticks (1 byte), because FSM can't be faster than one byte - FIXME: clock delay could make problems, but citing NPX: alsmost no slave device implements clock delay + FIXME: clock stretching could make problems, but citing NPX: alsmost no slave device implements clock stretching three times the expected time should cover clock delay */ PIOS_DELAY_WaituS(i2c_adapter->transfer_delay_uS); @@ -1084,13 +1079,10 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - if (!valid) { + if (!PIOS_I2C_validate(i2c_adapter)) { return -1; } - PIOS_Assert(valid) PIOS_Assert(callback); PIOS_DEBUG_Assert(txn_list); @@ -1129,8 +1121,8 @@ int32_t PIOS_I2C_Transfer_Callback(uint32_t i2c_id, const struct pios_i2c_txn tx for (uint32_t i = 0; i < num_txns; i++) { i2c_adapter->transfer_timeout_ticks += txn_list[i].len; } - // timeout if it takes three times the expected time - i2c_adapter->transfer_timeout_ticks *= 3; + // timeout if it takes eight times the expected time + i2c_adapter->transfer_timeout_ticks <<= 3; i2c_adapter->callback = callback; i2c_adapter->bus_error = false; @@ -1143,14 +1135,10 @@ void PIOS_I2C_EV_IRQ_Handler(uint32_t i2c_id) { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - if (!valid) { + if (!PIOS_I2C_validate(i2c_adapter)) { return; } - PIOS_Assert(valid) - uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); #if defined(PIOS_I2C_DIAGNOSTICS) @@ -1280,14 +1268,10 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id) { struct pios_i2c_adapter *i2c_adapter = (struct pios_i2c_adapter *)i2c_id; - bool valid = PIOS_I2C_validate(i2c_adapter); - - if (!valid) { + if (!PIOS_I2C_validate(i2c_adapter)) { return; } - PIOS_Assert(valid) - uint32_t event = I2C_GetLastEvent(i2c_adapter->cfg->regs); #if defined(PIOS_I2C_DIAGNOSTICS) From 654d842c2234384063d8179840dcab00dc76c6e6 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Sat, 5 Apr 2014 12:12:48 +0200 Subject: [PATCH 095/131] OP-1288 Remove PositionSource from VtolPathFollowerSettings --- .../VtolPathFollower/vtolpathfollower.c | 46 +++---------------- .../vtolpathfollowersettings.xml | 3 +- 2 files changed, 7 insertions(+), 42 deletions(-) diff --git a/flight/modules/VtolPathFollower/vtolpathfollower.c b/flight/modules/VtolPathFollower/vtolpathfollower.c index 372a97763..3c65e1b29 100644 --- a/flight/modules/VtolPathFollower/vtolpathfollower.c +++ b/flight/modules/VtolPathFollower/vtolpathfollower.c @@ -470,48 +470,14 @@ void updateEndpointVelocity() float eastCommand; float downCommand; - float northPos = 0, eastPos = 0, downPos = 0; - switch (vtolpathfollowerSettings.PositionSource) { - case VTOLPATHFOLLOWERSETTINGS_POSITIONSOURCE_EKF: - northPos = positionState.North; - eastPos = positionState.East; - downPos = positionState.Down; - break; - case VTOLPATHFOLLOWERSETTINGS_POSITIONSOURCE_GPSPOS: - { - // this used to work with the NEDposition UAVObject - // however this UAVObject has been removed - GPSPositionSensorData gpsPosition; - GPSPositionSensorGet(&gpsPosition); - HomeLocationData homeLocation; - HomeLocationGet(&homeLocation); - float lat = DEG2RAD(homeLocation.Latitude / 10.0e6f); - float alt = homeLocation.Altitude; - float T[3] = { alt + 6.378137E6f, - cosf(lat) * (alt + 6.378137E6f), - -1.0f }; - float NED[3] = { T[0] * (DEG2RAD((gpsPosition.Latitude - homeLocation.Latitude) / 10.0e6f)), - T[1] * (DEG2RAD((gpsPosition.Longitude - homeLocation.Longitude) / 10.0e6f)), - T[2] * ((gpsPosition.Altitude + gpsPosition.GeoidSeparation - homeLocation.Altitude)) }; - - northPos = NED[0]; - eastPos = NED[1]; - downPos = NED[2]; - } - break; - default: - PIOS_Assert(0); - break; - } - // Compute desired north command - northError = pathDesired.End.North - northPos; + northError = pathDesired.End.North - positionState.North; northPosIntegral = bound(northPosIntegral + northError * dT * vtolpathfollowerSettings.HorizontalPosPI.Ki, -vtolpathfollowerSettings.HorizontalPosPI.ILimit, vtolpathfollowerSettings.HorizontalPosPI.ILimit); northCommand = (northError * vtolpathfollowerSettings.HorizontalPosPI.Kp + northPosIntegral); - eastError = pathDesired.End.East - eastPos; + eastError = pathDesired.End.East - positionState.East; eastPosIntegral = bound(eastPosIntegral + eastError * dT * vtolpathfollowerSettings.HorizontalPosPI.Ki, -vtolpathfollowerSettings.HorizontalPosPI.ILimit, vtolpathfollowerSettings.HorizontalPosPI.ILimit); @@ -527,7 +493,7 @@ void updateEndpointVelocity() velocityDesired.North = northCommand * scale; velocityDesired.East = eastCommand * scale; - downError = pathDesired.End.Down - downPos; + downError = pathDesired.End.Down - positionState.Down; downPosIntegral = bound(downPosIntegral + downError * dT * vtolpathfollowerSettings.VerticalPosPI.Ki, -vtolpathfollowerSettings.VerticalPosPI.ILimit, vtolpathfollowerSettings.VerticalPosPI.ILimit); @@ -595,12 +561,12 @@ static void updateVtolDesiredAttitude(bool yaw_attitude) float northVel = 0, eastVel = 0, downVel = 0; switch (vtolpathfollowerSettings.VelocitySource) { - case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_EKF: + case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_STATE_ESTIMATION: northVel = velocityState.North; eastVel = velocityState.East; downVel = velocityState.Down; break; - case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_NEDVEL: + case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPS_VELNED: { GPSVelocitySensorData gpsVelocity; GPSVelocitySensorGet(&gpsVelocity); @@ -609,7 +575,7 @@ static void updateVtolDesiredAttitude(bool yaw_attitude) downVel = gpsVelocity.Down; } break; - case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPSPOS: + case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPS_GROUNDSPEED: { GPSPositionSensorData gpsPosition; GPSPositionSensorGet(&gpsPosition); diff --git a/shared/uavobjectdefinition/vtolpathfollowersettings.xml b/shared/uavobjectdefinition/vtolpathfollowersettings.xml index a8a5e49e7..47e39cb5d 100644 --- a/shared/uavobjectdefinition/vtolpathfollowersettings.xml +++ b/shared/uavobjectdefinition/vtolpathfollowersettings.xml @@ -10,8 +10,7 @@ - - + From bb91039f51dce53a72c35b5f5db28c6232e905a1 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sat, 5 Apr 2014 12:53:31 +0200 Subject: [PATCH 096/131] OP-1290 fixes in telemetry (and pios_board initialization) --- flight/modules/Telemetry/telemetry.c | 67 +++++++++++++++---- .../boards/revolution/firmware/pios_board.c | 9 ++- flight/targets/boards/revolution/pios_board.h | 2 + 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index 593b30f5b..0b365f7c4 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -54,6 +54,9 @@ // Private variables static uint32_t telemetryPort; +#ifdef PIOS_INCLUDE_RFM22B +static uint32_t radioPort; +#endif static xQueueHandle queue; #if defined(PIOS_TELEM_PRIORITY_QUEUE) @@ -80,6 +83,7 @@ static void telemetryTxTask(void *parameters); static void telemetryRxTask(void *parameters); #ifdef PIOS_INCLUDE_RFM22B static void radioRxTask(void *parameters); +static int32_t transmitRadioData(uint8_t *data, int32_t length); #endif static int32_t transmitData(uint8_t *data, int32_t length); static void registerObject(UAVObjHandle obj); @@ -140,13 +144,16 @@ int32_t TelemetryInitialize(void) // Update telemetry settings telemetryPort = PIOS_COM_TELEM_RF; +#ifdef PIOS_INCLUDE_RFM22B + radioPort = PIOS_COM_RF; +#endif HwSettingsInitialize(); updateSettings(); // Initialise UAVTalk uavTalkCon = UAVTalkInitialize(&transmitData); #ifdef PIOS_INCLUDE_RFM22B - radioUavTalkCon = UAVTalkInitialize(&transmitData); + radioUavTalkCon = UAVTalkInitialize(&transmitRadioData); #endif // Create periodic event that will be used to update the telemetry stats @@ -375,17 +382,28 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters) * Tries to empty the high priority queue before handling any standard priority item */ #if defined(PIOS_TELEM_PRIORITY_QUEUE) - // Loop forever - while (xQueueReceive(priorityQueue, &ev, 1) == pdTRUE) { + // empty priority queue, non-blocking + while (xQueueReceive(priorityQueue, &ev, 0) == pdTRUE) { // Process event processObjEvent(&ev); } -#endif - // Wait for queue message + // check regular queue and process update - non-blocking if (xQueueReceive(queue, &ev, 0) == pdTRUE) { // Process event processObjEvent(&ev); + + // if both queues are empty, wait on priority queue for updates (1 tick) then repeat cycle + } else if (xQueueReceive(priorityQueue, &ev, 1) == pdTRUE) { + // Process event + processObjEvent(&ev); } +#else + // wait on queue for updates (1 tick) then repeat cycle + if (xQueueReceive(queue, &ev, 1) == pdTRUE) { + // Process event + processObjEvent(&ev); + } +#endif /* if defined(PIOS_TELEM_PRIORITY_QUEUE) */ } } @@ -424,12 +442,12 @@ static void radioRxTask(__attribute__((unused)) void *parameters) { // Task loop while (1) { - if (telemetryPort) { + if (radioPort) { // Block until data are available uint8_t serial_data[1]; uint16_t bytes_to_process; - bytes_to_process = PIOS_COM_ReceiveBuffer(telemetryPort, serial_data, sizeof(serial_data), 500); + bytes_to_process = PIOS_COM_ReceiveBuffer(radioPort, serial_data, sizeof(serial_data), 500); if (bytes_to_process > 0) { for (uint8_t i = 0; i < bytes_to_process; i++) { UAVTalkProcessInputStream(radioUavTalkCon, serial_data[i]); @@ -440,6 +458,23 @@ static void radioRxTask(__attribute__((unused)) void *parameters) } } } + + +/** + * Transmit data buffer to the radioport. + * \param[in] data Data buffer to send + * \param[in] length Length of buffer + * \return -1 on failure + * \return number of bytes transmitted on success + */ +static int32_t transmitRadioData(uint8_t *data, int32_t length) +{ + if (radioPort) { + return PIOS_COM_SendBuffer(radioPort, data, length); + } + + return -1; +} #endif /* PIOS_INCLUDE_RFM22B */ /** @@ -676,17 +711,25 @@ static void updateSettings() * Determine input/output com port as highest priority available * @param[in] input Returns the approproate input com port if true, else the appropriate output com port */ -static uint32_t getComPort(bool input) +// #ifdef PIOS_INCLUDE_RFM22B +// static uint32_t getComPort( bool input) +// #else +static uint32_t getComPort(__attribute__((unused)) bool input) +// #endif { -#ifndef PIOS_INCLUDE_RFM22B - input = false; -#endif #if defined(PIOS_INCLUDE_USB) + // if USB is connected, USB takes precedence for telemetry if (PIOS_COM_Available(PIOS_COM_TELEM_USB)) { return PIOS_COM_TELEM_USB; } else #endif /* PIOS_INCLUDE_USB */ - if (!input && PIOS_COM_Available(telemetryPort)) { +#ifdef PIOS_INCLUDE_RFM22B + // PIOS_COM_RF input is handled by a separate RX thread and therefore must be ignored + if (input && telemetryPort == PIOS_COM_RF) { + return 0; + } else +#endif /* PIOS_INCLUDE_RFM22B */ + if (PIOS_COM_Available(telemetryPort)) { return telemetryPort; } else { return 0; diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 262fcf899..14d917b84 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -224,6 +224,7 @@ uint32_t pios_com_debug_id; uint32_t pios_com_gps_id = 0; uint32_t pios_com_telem_usb_id = 0; uint32_t pios_com_telem_rf_id = 0; +uint32_t pios_com_rf_id = 0; uint32_t pios_com_bridge_id = 0; uint32_t pios_com_overo_id = 0; uint32_t pios_com_hkosd_id = 0; @@ -231,7 +232,7 @@ uint32_t pios_com_hkosd_id = 0; uint32_t pios_com_vcp_id = 0; #if defined(PIOS_INCLUDE_RFM22B) -uint32_t pios_rfm22b_id = 0; +uint32_t pios_rfm22b_id = 0; #endif uintptr_t pios_uavo_settings_fs_id; @@ -753,11 +754,15 @@ void PIOS_Board_Init(void) uint8_t *tx_buffer = (uint8_t *)pvPortMalloc(PIOS_COM_RFM22B_RF_TX_BUF_LEN); PIOS_Assert(rx_buffer); PIOS_Assert(tx_buffer); - if (PIOS_COM_Init(&pios_com_telem_rf_id, &pios_rfm22b_com_driver, pios_rfm22b_id, + if (PIOS_COM_Init(&pios_com_rf_id, &pios_rfm22b_com_driver, pios_rfm22b_id, rx_buffer, PIOS_COM_RFM22B_RF_RX_BUF_LEN, tx_buffer, PIOS_COM_RFM22B_RF_TX_BUF_LEN)) { PIOS_Assert(0); } + /* Set Telemetry to use OPLinkMini if no other telemetry is configured (USB always overrides anyway) */ + if (!pios_com_telem_rf_id) { + pios_com_telem_rf_id = pios_com_rf_id; + } oplinkStatus.LinkState = OPLINKSTATUS_LINKSTATE_ENABLED; // Set the RF data rate on the modem to ~2X the selected buad rate because the modem is half duplex. diff --git a/flight/targets/boards/revolution/pios_board.h b/flight/targets/boards/revolution/pios_board.h index 975a87194..09a2be105 100644 --- a/flight/targets/boards/revolution/pios_board.h +++ b/flight/targets/boards/revolution/pios_board.h @@ -141,6 +141,7 @@ extern uint32_t pios_i2c_flexiport_adapter_id; // ------------------------- #define PIOS_COM_MAX_DEVS 4 extern uint32_t pios_com_telem_rf_id; +extern uint32_t pios_com_rf_id; extern uint32_t pios_com_gps_id; extern uint32_t pios_com_telem_usb_id; extern uint32_t pios_com_bridge_id; @@ -149,6 +150,7 @@ extern uint32_t pios_com_hkosd_id; #define PIOS_COM_GPS (pios_com_gps_id) #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id) #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id) +#define PIOS_COM_RF (pios_com_rf_id) #define PIOS_COM_BRIDGE (pios_com_bridge_id) #define PIOS_COM_VCP (pios_com_vcp_id) #define PIOS_COM_OSDHK (pios_com_hkosd_id) From 5b6d397f76dfbea871a8895a74fa7e533e600562 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sat, 5 Apr 2014 13:00:21 +0200 Subject: [PATCH 097/131] OP-1290 uncommented accidentally commented lines --- flight/modules/Telemetry/telemetry.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index 0b365f7c4..55c201369 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -711,11 +711,11 @@ static void updateSettings() * Determine input/output com port as highest priority available * @param[in] input Returns the approproate input com port if true, else the appropriate output com port */ -// #ifdef PIOS_INCLUDE_RFM22B -// static uint32_t getComPort( bool input) -// #else +#ifdef PIOS_INCLUDE_RFM22B +static uint32_t getComPort(bool input) +#else static uint32_t getComPort(__attribute__((unused)) bool input) -// #endif +#endif { #if defined(PIOS_INCLUDE_USB) // if USB is connected, USB takes precedence for telemetry From 6e0f478f43e3af43c8581493cf88aceca10ea680 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 5 Apr 2014 13:00:55 +0200 Subject: [PATCH 098/131] OP-1291 fix Matlab/Octave converter after UAVTalk changes. Also made several optimization. --- .../plugins/uavobjects/uavobject.m.template | 73 ++++++++++++------- .../matlab/uavobjectgeneratormatlab.cpp | 10 +-- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.m.template b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.m.template index baf532e31..f7e683b0d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.m.template +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.m.template @@ -59,60 +59,79 @@ $(INSTANTIATIONCODE) fid = fopen(logfile); -buffer=fread(fid,Inf,'uchar=>uchar'); +buffer=fread(fid,Inf,'uchar=>uint8'); fseek(fid, 0, 'bof'); - -bufferIdx=1; +bufferlen = size(buffer); correctMsgByte=hex2dec('20'); correctTimestampedByte=hex2dec('A0'); correctSyncByte=hex2dec('3C'); unknownObjIDList=zeros(1,2); - -% Parse log file, entry by entry -% prebuf = buffer(1:12); +headerLen = 1 + 1 + 2 + 4 + 2; % sync type len id inst +timestampLen = 4; +crcLen = 1; +oplHeaderLen = 8 + 4; last_print = -1e10; +bufferIdx=1; +headerIdx=oplHeaderLen + 1; + startTime=clock; while (1) - if (feof(fid)); break; end - try %% Read message header % get sync field (0x3C, 1 byte) - sync = fread(fid, 1, 'uint8'); + if (bufferlen < headerIdx + 12); break; end + sync = buffer(headerIdx); + % printf('%x ', sync); + headerIdx += 1; if sync ~= correctSyncByte - prebuf = [prebuf(2:end); sync]; wrongSyncByte = wrongSyncByte + 1; continue end - - % get msg type (quint8 1 byte ) should be 0x20, ignore the rest? - msgType = fread(fid, 1, 'uint8'); - if msgType ~= correctMsgByte && msgType ~= hex2dec('A0') - wrongMessageByte = wrongMessageByte + 1; + + % printf('\n %u:',headerIdx - 1); + % get the opl timestamp and datablock size + oplTimestamp = typecast(uint8(buffer(headerIdx - 1 - 8 - 4:headerIdx - 1 - 8 - 1)), 'uint32'); + oplSize = typecast(uint8(buffer(headerIdx - 1 - 8:headerIdx - 1 - 1)), 'uint64'); + + % get msg type (quint8 1 byte ) should be 0x20/0xA0, ignore the rest + msgType = buffer(headerIdx); + headerIdx += 1; + if msgType ~= correctMsgByte && msgType ~= correctTimestampedByte + % fixme: it should read the whole message payload instead of skipping and blindly searching for next sync byte. + fprintf('\nSkipping message type: %x \n', msgType); continue end % get msg size (quint16 2 bytes) excludes crc, include msg header and data payload - msgSize = fread(fid, 1, 'uint16'); + msgSize = uint32(typecast(buffer(headerIdx:headerIdx + 1), 'uint16')); + headerIdx += 2; + % get obj id (quint32 4 bytes) - objID = fread(fid, 1, 'uint32'); + objID = typecast(uint8(buffer(headerIdx:headerIdx + 3)), 'uint32'); + headerIdx += 4; + % get instance id (quint16 2 bytes) + instID = typecast(uint8(buffer(headerIdx:headerIdx + 1)), 'uint16'); + % printf('Id %x type %x size %u Inst %x ', objID, msgType, msgSize, instID); + headerIdx += 2; + + % get timestamp if needed (quint32 4 bytes) if msgType == correctMsgByte - %% Process header if we are aligned - timestamp = typecast(uint8(prebuf(1:4)), 'uint32'); - datasize = typecast(uint8(prebuf(5:12)), 'uint64'); + datasize = msgSize - headerLen; elseif msgType == correctTimestampedByte - timestamp = fread(fid,1,'uint16'); + timestamp = typecast(uint8(buffer(headerIdx:headerIdx + 3)), 'uint32'); + % printf('ts %u'); + headerIdx += 4; + datasize = msgSize - headerLen - timestampLen; end + % printf('\n'); + bufferIdx = headerIdx; + headerIdx += datasize + crcLen + oplHeaderLen; - if (isempty(objID)) %End of file - break; - end - %% Read object switch objID @@ -124,10 +143,8 @@ $(SWITCHCODE) else unknownObjIDList(unknownObjIDListIdx,2)=unknownObjIDList(unknownObjIDListIdx,2)+1; end - - datasize = typecast(buffer(datasizeBufferIdx + 4:datasizeBufferIdx + 12-1), 'uint64'); - msgBytesLeft = datasize - 1 - 1 - 2 - 4; + msgBytesLeft = msgSize - 1 - 1 - 2 - 4; if msgBytesLeft > 255 msgBytesLeft = 0; end diff --git a/ground/uavobjgenerator/generators/matlab/uavobjectgeneratormatlab.cpp b/ground/uavobjgenerator/generators/matlab/uavobjectgeneratormatlab.cpp index b6611164b..e47db4316 100644 --- a/ground/uavobjgenerator/generators/matlab/uavobjectgeneratormatlab.cpp +++ b/ground/uavobjgenerator/generators/matlab/uavobjectgeneratormatlab.cpp @@ -122,9 +122,6 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo *info, int numBytes) matlabSwitchCode.append("\t\t\t" + tableIdxName + " = " + tableIdxName + " + 1;\n"); matlabSwitchCode.append("\t\t\t" + objectTableName + "FidIdx(" + tableIdxName + ") = bufferIdx; %#ok<*AGROW>\n"); matlabSwitchCode.append("\t\t\tbufferIdx=bufferIdx + " + objectTableName.toUpper() + "_NUMBYTES+1; %+1 is for CRC\n"); - if (!info->isSingleInst) { - matlabSwitchCode.append("\t\t\tbufferIdx = bufferIdx + 2; %An extra two bytes for the instance ID\n"); - } matlabSwitchCode.append("\t\t\tif " + tableIdxName + " >= length(" + objectTableName + "FidIdx) %Check to see if pre-allocated memory is exhausted\n"); matlabSwitchCode.append("\t\t\t\t" + objectTableName + "FidIdx(" + tableIdxName + "*2) = 0;\n"); matlabSwitchCode.append("\t\t\tend\n"); @@ -145,16 +142,15 @@ bool UAVObjectGeneratorMatlab::process_object(ObjectInfo *info, int numBytes) // Add timestamp allocationFields.append("\t" + objectName + ".timestamp = " + "double(typecast(buffer(mcolon(" + objectName + "FidIdx " - "- 20, " + objectName + "FidIdx + 4-1 -20)), 'uint32'))';\n"); + "- headerLen - oplHeaderLen, " + objectName + "FidIdx + 3 - headerLen - oplHeaderLen)), 'uint32'))';\n"); int currentIdx = 0; // Add Instance ID, if necessary if (!info->isSingleInst) { allocationFields.append("\t" + objectName + ".instanceID = " + - "double(typecast(buffer(mcolon(" + objectName + "FidIdx " - ", " + objectName + "FidIdx + 2-1)), 'uint16'))';\n"); - currentIdx += 2; + "double(typecast(buffer(mcolon(" + objectName + "FidIdx - 2" + ", " + objectName + "FidIdx - 2 + 1)), 'uint16'))';\n"); } for (int n = 0; n < info->fields.length(); ++n) { From 48876620fcb8115b61de9077487d91595e43ba9e Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sat, 5 Apr 2014 17:27:52 +0200 Subject: [PATCH 099/131] OP-1290 fix event system issues caused by alarm flapping --- flight/libraries/alarms.c | 12 +++++++-- shared/uavobjectdefinition/systemalarms.xml | 27 ++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/flight/libraries/alarms.c b/flight/libraries/alarms.c index be8e6ec86..1b3bca517 100644 --- a/flight/libraries/alarms.c +++ b/flight/libraries/alarms.c @@ -75,8 +75,12 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - if (cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) { + uint32_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; + if ((flightTime - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] > 1000 && + cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) + || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; + cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] = flightTime; SystemAlarmsSet(&alarms); } @@ -110,10 +114,14 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - if (cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) { + uint32_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; + if ((flightTime - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] > 1000 && + cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) + || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.ExtendedAlarmStatus, alarms.ExtendedAlarmStatus.BootFault)[alarm] = status; cast_struct_to_array(alarms.ExtendedAlarmSubStatus, alarms.ExtendedAlarmStatus.BootFault)[alarm] = subStatus; cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; + cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] = flightTime; SystemAlarmsSet(&alarms); } diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index 401f36530..1f7fb0c72 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -26,6 +26,31 @@ Power + + + SystemConfiguration + BootFault + OutOfMemory + StackOverflow + CPUOverload + EventSystem + Telemetry + Receiver + ManualControl + Actuator + Attitude + Sensors + Airspeed + Stabilization + Guidance + PathPlan + Battery + FlightTime + I2C + GPS + Power + + SystemConfiguration @@ -45,7 +70,7 @@ - + From ce94ffd35c9ce78ec339ac8b40a88bd9e21479a7 Mon Sep 17 00:00:00 2001 From: Bertrand Oresve Date: Sun, 6 Apr 2014 10:43:54 +0200 Subject: [PATCH 100/131] OP-1288 Remove PositionSource from VtolPathFollowerSettings (with correct default setting) --- shared/uavobjectdefinition/vtolpathfollowersettings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/uavobjectdefinition/vtolpathfollowersettings.xml b/shared/uavobjectdefinition/vtolpathfollowersettings.xml index 47e39cb5d..8a7d9991a 100644 --- a/shared/uavobjectdefinition/vtolpathfollowersettings.xml +++ b/shared/uavobjectdefinition/vtolpathfollowersettings.xml @@ -10,7 +10,7 @@ - + From 3018e73e9118dc960da316e4aa050ce201675242 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 6 Apr 2014 12:24:42 +0200 Subject: [PATCH 101/131] OP-1290 saved some RAM by removing last alarm update time from UAVObject (static allocated array instead, and smaller element size) --- flight/libraries/alarms.c | 13 ++++++----- shared/uavobjectdefinition/systemalarms.xml | 25 --------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/flight/libraries/alarms.c b/flight/libraries/alarms.c index 1b3bca517..7b27d174e 100644 --- a/flight/libraries/alarms.c +++ b/flight/libraries/alarms.c @@ -37,6 +37,7 @@ // Private variables static xSemaphoreHandle lock; +static volatile uint16_t lastAlarmChange[SYSTEMALARMS_ALARM_NUMELEM] = { 0 }; // this deliberately overflows every 2^16 milliseconds to save memory // Private functions static int32_t hasSeverity(SystemAlarmsAlarmOptions severity); @@ -75,12 +76,12 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - uint32_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; - if ((flightTime - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] > 1000 && + uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory + if ((flightTime - lastAlarmChange[alarm] > 1000 && cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] = flightTime; + lastAlarmChange[alarm] = flightTime; SystemAlarmsSet(&alarms); } @@ -114,14 +115,14 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - uint32_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; - if ((flightTime - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] > 1000 && + uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory + if ((flightTime - lastAlarmChange[alarm] > 1000 && cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.ExtendedAlarmStatus, alarms.ExtendedAlarmStatus.BootFault)[alarm] = status; cast_struct_to_array(alarms.ExtendedAlarmSubStatus, alarms.ExtendedAlarmStatus.BootFault)[alarm] = subStatus; cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; - cast_struct_to_array(alarms.LastChange, alarms.LastChange.Actuator)[alarm] = flightTime; + lastAlarmChange[alarm] = flightTime; SystemAlarmsSet(&alarms); } diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index 1f7fb0c72..e1fcf6d32 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -26,31 +26,6 @@ Power - - - SystemConfiguration - BootFault - OutOfMemory - StackOverflow - CPUOverload - EventSystem - Telemetry - Receiver - ManualControl - Actuator - Attitude - Sensors - Airspeed - Stabilization - Guidance - PathPlan - Battery - FlightTime - I2C - GPS - Power - - SystemConfiguration From 2d9fe95b0858d5b088e2826f511a23f0395814cf Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 6 Apr 2014 12:37:57 +0200 Subject: [PATCH 102/131] OP-1290 added nicer #define for magic number --- flight/libraries/alarms.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flight/libraries/alarms.c b/flight/libraries/alarms.c index 7b27d174e..922301ca6 100644 --- a/flight/libraries/alarms.c +++ b/flight/libraries/alarms.c @@ -32,6 +32,11 @@ #include "inc/alarms.h" // Private constants +#ifndef PIOS_ALARM_GRACETIME +// alarm cannot be turned off for at least 1000 milliseconds +// to prevent event system overload through flapping alarms + #define PIOS_ALARM_GRACETIME 1000 +#endif // PIOS_ALARM_GRACETIME // Private types @@ -77,7 +82,7 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory - if ((flightTime - lastAlarmChange[alarm] > 1000 && + if ((flightTime - lastAlarmChange[alarm] > PIOS_ALARM_GRACETIME && cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; @@ -116,7 +121,7 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory - if ((flightTime - lastAlarmChange[alarm] > 1000 && + if ((flightTime - lastAlarmChange[alarm] > PIOS_ALARM_GRACETIME && cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { cast_struct_to_array(alarms.ExtendedAlarmStatus, alarms.ExtendedAlarmStatus.BootFault)[alarm] = status; From e18f2e6d7e93822aacd407c59df8f61bb824d808 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 6 Apr 2014 12:46:27 +0200 Subject: [PATCH 103/131] OP1290 Systemalarms optimizations as suggested by OPReview-689 --- flight/libraries/alarms.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/flight/libraries/alarms.c b/flight/libraries/alarms.c index 922301ca6..0ea46c5e5 100644 --- a/flight/libraries/alarms.c +++ b/flight/libraries/alarms.c @@ -69,7 +69,7 @@ int32_t AlarmsInitialize(void) */ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity) { - SystemAlarmsData alarms; + SystemAlarmsAlarmData alarms; // Check that this is a valid alarm if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) { @@ -80,14 +80,14 @@ int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity xSemaphoreTakeRecursive(lock, portMAX_DELAY); // Read alarm and update its severity only if it was changed - SystemAlarmsGet(&alarms); - uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory + SystemAlarmsAlarmGet(&alarms); + uint16_t flightTime = (uint16_t)xTaskGetTickCount() * (uint16_t)portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory if ((flightTime - lastAlarmChange[alarm] > PIOS_ALARM_GRACETIME && - cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) - || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { - cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] = severity; + cast_struct_to_array(alarms, alarms.Actuator)[alarm] != severity) + || cast_struct_to_array(alarms, alarms.Actuator)[alarm] < severity) { + cast_struct_to_array(alarms, alarms.Actuator)[alarm] = severity; lastAlarmChange[alarm] = flightTime; - SystemAlarmsSet(&alarms); + SystemAlarmsAlarmSet(&alarms); } // Release lock @@ -120,7 +120,7 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, // Read alarm and update its severity only if it was changed SystemAlarmsGet(&alarms); - uint16_t flightTime = xTaskGetTickCount() * portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory + uint16_t flightTime = (uint16_t)xTaskGetTickCount() * (uint16_t)portTICK_RATE_MS; // this deliberately overflows every 2^16 milliseconds to save memory if ((flightTime - lastAlarmChange[alarm] > PIOS_ALARM_GRACETIME && cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] != severity) || cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm] < severity) { @@ -143,7 +143,7 @@ int32_t ExtendedAlarmsSet(SystemAlarmsAlarmElem alarm, */ SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) { - SystemAlarmsData alarms; + SystemAlarmsAlarmData alarms; // Check that this is a valid alarm if (alarm >= SYSTEMALARMS_ALARM_NUMELEM) { @@ -151,8 +151,8 @@ SystemAlarmsAlarmOptions AlarmsGet(SystemAlarmsAlarmElem alarm) } // Read alarm - SystemAlarmsGet(&alarms); - return cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[alarm]; + SystemAlarmsAlarmGet(&alarms); + return cast_struct_to_array(alarms, alarms.Actuator)[alarm]; } /** @@ -234,17 +234,17 @@ int32_t AlarmsHasCritical() */ static int32_t hasSeverity(SystemAlarmsAlarmOptions severity) { - SystemAlarmsData alarms; + SystemAlarmsAlarmData alarms; // Lock xSemaphoreTakeRecursive(lock, portMAX_DELAY); // Read alarms - SystemAlarmsGet(&alarms); + SystemAlarmsAlarmGet(&alarms); // Go through alarms and check if any are of the given severity or higher for (uint32_t n = 0; n < SYSTEMALARMS_ALARM_NUMELEM; ++n) { - if (cast_struct_to_array(alarms.Alarm, alarms.Alarm.Actuator)[n] >= severity) { + if (cast_struct_to_array(alarms, alarms.Actuator)[n] >= severity) { xSemaphoreGiveRecursive(lock); return 1; } From 9a52f506efca36010d0b1302557fa1b52d08f26f Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Sun, 6 Apr 2014 15:38:22 +0200 Subject: [PATCH 104/131] drive-by bugfix in Fixedwingpathfollower --- .../modules/FixedWingPathFollower/fixedwingpathfollower.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c index cb602536e..9a2e52651 100644 --- a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c +++ b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c @@ -503,7 +503,7 @@ static uint8_t updateFixedDesiredAttitude() // Error condition: plane cannot hold altitude at current speed. fixedwingpathfollowerStatus.Errors.Lowpower = 0; - if (powerCommand >= fixedwingpathfollowerSettings.ThrustLimit.Max && // thrust at maximum + if (fixedwingpathfollowerSettings.ThrustLimit.Neutral + powerCommand >= fixedwingpathfollowerSettings.ThrustLimit.Max && // thrust at maximum velocityState.Down > 0 && // we ARE going down descentspeedDesired < 0 && // we WANT to go up airspeedError > 0 && // we are too slow already @@ -513,7 +513,7 @@ static uint8_t updateFixedDesiredAttitude() } // Error condition: plane keeps climbing despite minimum thrust (opposite of above) fixedwingpathfollowerStatus.Errors.Highpower = 0; - if (powerCommand >= fixedwingpathfollowerSettings.ThrustLimit.Min && // thrust at minimum + if (fixedwingpathfollowerSettings.ThrustLimit.Neutral + powerCommand <= fixedwingpathfollowerSettings.ThrustLimit.Min && // thrust at minimum velocityState.Down < 0 && // we ARE going up descentspeedDesired > 0 && // we WANT to go down airspeedError < 0 && // we are too fast already @@ -555,7 +555,7 @@ static uint8_t updateFixedDesiredAttitude() // Error condition: high speed dive fixedwingpathfollowerStatus.Errors.Pitchcontrol = 0; - if (pitchCommand >= fixedwingpathfollowerSettings.PitchLimit.Max && // pitch demand is full up + if (fixedwingpathfollowerSettings.PitchLimit.Neutral + pitchCommand >= fixedwingpathfollowerSettings.PitchLimit.Max && // pitch demand is full up velocityState.Down > 0 && // we ARE going down descentspeedDesired < 0 && // we WANT to go up airspeedError < 0 && // we are too fast already From eed5c098ab787f16e67a13b4815e264514bd739f Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:12:00 +0200 Subject: [PATCH 105/131] OP-1294 Allow to specify different stack sizes for rx and tx telemetry task. --- flight/modules/Telemetry/telemetry.c | 15 +++++++++------ .../coptercontrol/firmware/inc/pios_config.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index 55c201369..2626d4647 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -41,7 +41,13 @@ // Private constants #define MAX_QUEUE_SIZE TELEM_QUEUE_SIZE -#define STACK_SIZE_BYTES PIOS_TELEM_STACK_SIZE +#ifdef PIOS_TELEM_RX_STACK_SIZE +#define STACK_SIZE_RX_BYTES PIOS_TELEM_RX_STACK_SIZE +#define STACK_SIZE_TX_BYTES PIOS_TELEM_TX_STACK_SIZE +#else +#define STACK_SIZE_RX_BYTES PIOS_TELEM_STACK_SIZE +#define STACK_SIZE_TX_BYTES PIOS_TELEM_STACK_SIZE +#endif #define TASK_PRIORITY_RX (tskIDLE_PRIORITY + 2) #define TASK_PRIORITY_TX (tskIDLE_PRIORITY + 2) #define TASK_PRIORITY_RADRX (tskIDLE_PRIORITY + 2) @@ -110,9 +116,9 @@ int32_t TelemetryStart(void) GCSTelemetryStatsConnectQueue(priorityQueue); // Start telemetry tasks - xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle); + xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_TX_BYTES / 4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYTX, telemetryTxTaskHandle); - xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle); + xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE_RX_BYTES / 4, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYRX, telemetryRxTaskHandle); #ifdef PIOS_INCLUDE_RFM22B @@ -391,7 +397,6 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters) if (xQueueReceive(queue, &ev, 0) == pdTRUE) { // Process event processObjEvent(&ev); - // if both queues are empty, wait on priority queue for updates (1 tick) then repeat cycle } else if (xQueueReceive(priorityQueue, &ev, 1) == pdTRUE) { // Process event @@ -458,8 +463,6 @@ static void radioRxTask(__attribute__((unused)) void *parameters) } } } - - /** * Transmit data buffer to the radioport. * \param[in] data Data buffer to send diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index 8acb0e0c5..59572cdc9 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -164,7 +164,8 @@ #else #define PIOS_SYSTEM_STACK_SIZE 660 #endif -#define PIOS_TELEM_STACK_SIZE 540 +#define PIOS_TELEM_RX_STACK_SIZE 410 +#define PIOS_TELEM_TX_STACK_SIZE 560 #define PIOS_EVENTDISPATCHER_STACK_SIZE 160 /* This can't be too high to stop eventdispatcher thread overflowing */ From 1d1e73717cfcde00eec9c4815a57363eb1d7f8df Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:12:44 +0200 Subject: [PATCH 106/131] remove two old stale lines in taskinfo --- shared/uavobjectdefinition/taskinfo.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared/uavobjectdefinition/taskinfo.xml b/shared/uavobjectdefinition/taskinfo.xml index 24e3c37ad..a5fb7ad4b 100644 --- a/shared/uavobjectdefinition/taskinfo.xml +++ b/shared/uavobjectdefinition/taskinfo.xml @@ -56,7 +56,6 @@ FlightPlan TelemetryTx - TelemetryTxPri TelemetryRx RadioRx @@ -94,7 +93,6 @@ FlightPlan TelemetryTx - TelemetryTxPri TelemetryRx RadioRx From 499efdf168615b40edccb949b3427c63931034b4 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:14:12 +0200 Subject: [PATCH 107/131] OP-1294 adjust some stack sizes for CC --- .../boards/coptercontrol/firmware/inc/pios_config.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index 59572cdc9..ae4cba5c0 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -157,16 +157,19 @@ #define CPULOAD_LIMIT_CRITICAL 95 /* Task stack sizes */ -#define PIOS_ACTUATOR_STACK_SIZE 1020 -#define PIOS_MANUAL_STACK_SIZE 850 +#define PIOS_ACTUATOR_STACK_SIZE 820 +#define PIOS_MANUAL_STACK_SIZE 635 +#define PIOS_RECEIVER_STACK_SIZE 620 +#define PIOS_STABILIZATION_STACK_SIZE 780 + #ifdef DIAG_TASKS -#define PIOS_SYSTEM_STACK_SIZE 720 +#define PIOS_SYSTEM_STACK_SIZE 740 #else #define PIOS_SYSTEM_STACK_SIZE 660 #endif #define PIOS_TELEM_RX_STACK_SIZE 410 #define PIOS_TELEM_TX_STACK_SIZE 560 -#define PIOS_EVENTDISPATCHER_STACK_SIZE 160 +#define PIOS_EVENTDISPATCHER_STACK_SIZE 100 /* This can't be too high to stop eventdispatcher thread overflowing */ #define PIOS_EVENTDISAPTCHER_QUEUE 10 From 25ef201445a451f09e46d2ba577dd01dc7ecdcd2 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:15:30 +0200 Subject: [PATCH 108/131] OP-1294 adjust FreeRTOS options to save some more heap --- .../boards/coptercontrol/firmware/inc/FreeRTOSConfig.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flight/targets/boards/coptercontrol/firmware/inc/FreeRTOSConfig.h b/flight/targets/boards/coptercontrol/firmware/inc/FreeRTOSConfig.h index 703dea543..11b68eee3 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/FreeRTOSConfig.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/FreeRTOSConfig.h @@ -23,7 +23,7 @@ /* Notes: We use 5 task priorities */ #define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 1 +#define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configUSE_MALLOC_FAILED_HOOK 1 #define configCPU_CLOCK_HZ ((unsigned long)72000000) @@ -31,7 +31,7 @@ #define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5) #define configMINIMAL_STACK_SIZE ((unsigned short)48) #define configTOTAL_HEAP_SIZE ((size_t)(53 * 256)) -#define configMAX_TASK_NAME_LEN (16) +#define configMAX_TASK_NAME_LEN (6) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 0 @@ -39,7 +39,7 @@ #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 0 #define configUSE_ALTERNATIVE_API 0 -#define configQUEUE_REGISTRY_SIZE 10 +#define configQUEUE_REGISTRY_SIZE 0 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 @@ -52,10 +52,10 @@ #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskSuspend 0 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetSchedulerState 0 #define INCLUDE_xTaskGetCurrentTaskHandle 1 #define INCLUDE_uxTaskGetStackHighWaterMark 1 From 492275bf0e98b7c932f2f20b20685c7dccca55aa Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 6 Apr 2014 19:26:48 +0200 Subject: [PATCH 109/131] OP-1294 Fix undeclared STACK_SIZE_BYTES for revo --- flight/modules/Telemetry/telemetry.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/flight/modules/Telemetry/telemetry.c b/flight/modules/Telemetry/telemetry.c index 2626d4647..153ca7d41 100644 --- a/flight/modules/Telemetry/telemetry.c +++ b/flight/modules/Telemetry/telemetry.c @@ -40,7 +40,9 @@ #include "taskinfo.h" // Private constants -#define MAX_QUEUE_SIZE TELEM_QUEUE_SIZE +#define MAX_QUEUE_SIZE TELEM_QUEUE_SIZE +// Three different stack size parameter are accepted for Telemetry(RX PIOS_TELEM_RX_STACK_SIZE) +// Tx(PIOS_TELEM_TX_STACK_SIZE) and Radio RX(PIOS_TELEM_RADIO_RX_STACK_SIZE) #ifdef PIOS_TELEM_RX_STACK_SIZE #define STACK_SIZE_RX_BYTES PIOS_TELEM_RX_STACK_SIZE #define STACK_SIZE_TX_BYTES PIOS_TELEM_TX_STACK_SIZE @@ -48,13 +50,19 @@ #define STACK_SIZE_RX_BYTES PIOS_TELEM_STACK_SIZE #define STACK_SIZE_TX_BYTES PIOS_TELEM_STACK_SIZE #endif -#define TASK_PRIORITY_RX (tskIDLE_PRIORITY + 2) -#define TASK_PRIORITY_TX (tskIDLE_PRIORITY + 2) -#define TASK_PRIORITY_RADRX (tskIDLE_PRIORITY + 2) -#define REQ_TIMEOUT_MS 250 -#define MAX_RETRIES 2 -#define STATS_UPDATE_PERIOD_MS 4000 -#define CONNECTION_TIMEOUT_MS 8000 + +#ifdef PIOS_TELEM_RADIO_RX_STACK_SIZE +#define STACK_SIZE_RADIO_RX_BYTES PIOS_TELEM_RADIO_RX_STACK_SIZE +#else +#define STACK_SIZE_RADIO_RX_BYTES STACK_SIZE_RX_BYTES +#endif +#define TASK_PRIORITY_RX (tskIDLE_PRIORITY + 2) +#define TASK_PRIORITY_TX (tskIDLE_PRIORITY + 2) +#define TASK_PRIORITY_RADRX (tskIDLE_PRIORITY + 2) +#define REQ_TIMEOUT_MS 250 +#define MAX_RETRIES 2 +#define STATS_UPDATE_PERIOD_MS 4000 +#define CONNECTION_TIMEOUT_MS 8000 // Private types @@ -122,7 +130,7 @@ int32_t TelemetryStart(void) PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYRX, telemetryRxTaskHandle); #ifdef PIOS_INCLUDE_RFM22B - xTaskCreate(radioRxTask, (signed char *)"RadioRx", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY_RADRX, &radioRxTaskHandle); + xTaskCreate(radioRxTask, (signed char *)"RadioRx", STACK_SIZE_RADIO_RX_BYTES / 4, NULL, TASK_PRIORITY_RADRX, &radioRxTaskHandle); PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_RADIORX, radioRxTaskHandle); #endif From 1aefc61bc477f14a1cb7bfcab7341b23757db153 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 7 Apr 2014 00:31:48 +0200 Subject: [PATCH 110/131] OP-1294 Resize stack for CallbackScheduler. --- flight/pios/common/pios_callbackscheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/pios/common/pios_callbackscheduler.c b/flight/pios/common/pios_callbackscheduler.c index 9c13138c8..25b4b44e8 100644 --- a/flight/pios/common/pios_callbackscheduler.c +++ b/flight/pios/common/pios_callbackscheduler.c @@ -33,7 +33,7 @@ // Private constants #define STACK_SAFETYCOUNT 16 -#define STACK_SIZE (384 + STACK_SAFETYSIZE) +#define STACK_SIZE (190 + STACK_SAFETYSIZE) #define STACK_SAFETYSIZE 8 #define MAX_SLEEP 1000 From b9d911c40f00b78d1cf55dfcd63d17b182911788 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 7 Apr 2014 00:32:34 +0200 Subject: [PATCH 111/131] OP-1294 eventdipatcher stack can be further reduced --- .../targets/boards/coptercontrol/firmware/inc/pios_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index ae4cba5c0..bc33315ea 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -169,10 +169,10 @@ #endif #define PIOS_TELEM_RX_STACK_SIZE 410 #define PIOS_TELEM_TX_STACK_SIZE 560 -#define PIOS_EVENTDISPATCHER_STACK_SIZE 100 +#define PIOS_EVENTDISPATCHER_STACK_SIZE 95 /* This can't be too high to stop eventdispatcher thread overflowing */ -#define PIOS_EVENTDISAPTCHER_QUEUE 10 +#define PIOS_EVENTDISAPTCHER_QUEUE 10 /* Revolution series */ /* #define REVOLUTION */ From a72f48173f2fb5c17d16fa32ac595e399e5400ab Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 7 Apr 2014 12:12:01 +0200 Subject: [PATCH 112/131] OP-1295 fix "autoupdate not working" issue. OPFW_RESOURCE is now a dependency of openpilotgcs_qmake --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 16fcb23b4..f31564bc5 100644 --- a/Makefile +++ b/Makefile @@ -723,7 +723,7 @@ $(OPFW_RESOURCE): $(FW_TARGETS) # If opfw_resource or all firmware are requested, GCS should depend on the resource ifneq ($(strip $(filter opfw_resource all all_fw all_flight,$(MAKECMDGOALS))),) - $(eval openpilotgcs: $(OPFW_RESOURCE)) + $(eval openpilotgcs_qmake: $(OPFW_RESOURCE)) endif # Packaging targets: package, clean_package From 6d1fabdd5f731ed13f00cc7767481678aaaa2591 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 8 Apr 2014 00:30:10 +0200 Subject: [PATCH 113/131] OP-1294 declare controlHandler as const, add a new PIOS_EXCLUDE_ADVANCED_FEATURES that disables all nav features --- flight/modules/ManualControl/manualcontrol.c | 37 +++++++++++-------- .../coptercontrol/firmware/inc/pios_config.h | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/flight/modules/ManualControl/manualcontrol.c b/flight/modules/ManualControl/manualcontrol.c index 95c06de72..4de61af46 100644 --- a/flight/modules/ManualControl/manualcontrol.c +++ b/flight/modules/ManualControl/manualcontrol.c @@ -57,7 +57,7 @@ // defined handlers -static controlHandler handler_MANUAL = { +static const controlHandler handler_MANUAL = { .controlChain = { .Stabilization = false, .PathFollower = false, @@ -65,7 +65,7 @@ static controlHandler handler_MANUAL = { }, .handler = &manualHandler, }; -static controlHandler handler_STABILIZED = { +static const controlHandler handler_STABILIZED = { .controlChain = { .Stabilization = true, .PathFollower = false, @@ -74,16 +74,8 @@ static controlHandler handler_STABILIZED = { .handler = &stabilizedHandler, }; -// TODO: move the altitude handling into stabi -static controlHandler handler_ALTITUDE = { - .controlChain = { - .Stabilization = true, - .PathFollower = false, - .PathPlanner = false, - }, - .handler = &altitudeHandler, -}; -static controlHandler handler_AUTOTUNE = { + +static const controlHandler handler_AUTOTUNE = { .controlChain = { .Stabilization = false, .PathFollower = false, @@ -92,7 +84,18 @@ static controlHandler handler_AUTOTUNE = { .handler = NULL, }; -static controlHandler handler_PATHFOLLOWER = { +#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES +// TODO: move the altitude handling into stabi +static const controlHandler handler_ALTITUDE = { + .controlChain = { + .Stabilization = true, + .PathFollower = false, + .PathPlanner = false, + }, + .handler = &altitudeHandler, +}; + +static const controlHandler handler_PATHFOLLOWER = { .controlChain = { .Stabilization = true, .PathFollower = true, @@ -101,7 +104,7 @@ static controlHandler handler_PATHFOLLOWER = { .handler = &pathFollowerHandler, }; -static controlHandler handler_PATHPLANNER = { +static const controlHandler handler_PATHPLANNER = { .controlChain = { .Stabilization = true, .PathFollower = true, @@ -110,7 +113,7 @@ static controlHandler handler_PATHPLANNER = { .handler = &pathPlannerHandler, }; - +#endif // Private variables static DelayedCallbackInfo *callbackHandle; @@ -192,7 +195,7 @@ static void manualControlTask(void) } // Depending on the mode update the Stabilization or Actuator objects - controlHandler *handler = &handler_MANUAL; + const controlHandler *handler = &handler_MANUAL; switch (newMode) { case FLIGHTSTATUS_FLIGHTMODE_MANUAL: handler = &handler_MANUAL; @@ -202,6 +205,7 @@ static void manualControlTask(void) case FLIGHTSTATUS_FLIGHTMODE_STABILIZED3: handler = &handler_STABILIZED; break; +#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES case FLIGHTSTATUS_FLIGHTMODE_VELOCITYCONTROL: case FLIGHTSTATUS_FLIGHTMODE_POSITIONHOLD: case FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE: @@ -216,6 +220,7 @@ static void manualControlTask(void) case FLIGHTSTATUS_FLIGHTMODE_ALTITUDEVARIO: handler = &handler_ALTITUDE; break; +#endif case FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE: handler = &handler_AUTOTUNE; break; diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index bc33315ea..d589d20ed 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -144,7 +144,7 @@ /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ - +#define PIOS_EXCLUDE_ADVANCED_FEATURES /* Performance counters */ #define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998 From 10a0f69c8213453a0515e79ff21cda870db2a24b Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Tue, 8 Apr 2014 14:11:17 +0200 Subject: [PATCH 114/131] OP-1255 Win:Fixed 7z detection when it is not in path but under tools/bin Lin:Switch from 7zr to 7za due to wider availability --- make/tools.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/make/tools.mk b/make/tools.mk index ec06abb0e..cd129cec7 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -153,9 +153,13 @@ JAR := jar CD := cd GREP := grep ifneq ($(UNAME), Windows) - SEVENZIP := 7zr + SEVENZIP := 7za else SEVENZIP := 7za.exe +ifneq ($(shell $(SEVENZIP) --version >/dev/null 2>&1 && $(ECHO) "found"), found) +# no $(SEVENZIP) found in path. hope is in bin... + SEVENZIP = $(TOOLS_DIR)/bin/7za.exe +endif endif # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases. From 73bc088ad5aa6f3e1ccd8a953e8076cf4f560587 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Tue, 8 Apr 2014 16:26:27 +0200 Subject: [PATCH 115/131] OP-1298 fix for metadata being overwritten on multiinstance object initialization --- flight/uavobjects/uavobject.c.template | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/flight/uavobjects/uavobject.c.template b/flight/uavobjects/uavobject.c.template index 395279bd1..c25cb4abf 100644 --- a/flight/uavobjects/uavobject.c.template +++ b/flight/uavobjects/uavobject.c.template @@ -79,7 +79,6 @@ int32_t $(NAME)Initialize(void) void $(NAME)SetDefaults(UAVObjHandle obj, uint16_t instId) { $(NAME)Data data; - UAVObjMetadata metadata; // Initialize object fields to their default values UAVObjGetInstanceData(obj, instId, &data); @@ -88,18 +87,21 @@ $(INITFIELDS) UAVObjSetInstanceData(obj, instId, &data); // Initialize object metadata to their default values - metadata.flags = - $(FLIGHTACCESS) << UAVOBJ_ACCESS_SHIFT | - $(GCSACCESS) << UAVOBJ_GCS_ACCESS_SHIFT | - $(FLIGHTTELEM_ACKED) << UAVOBJ_TELEMETRY_ACKED_SHIFT | - $(GCSTELEM_ACKED) << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | - $(FLIGHTTELEM_UPDATEMODE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | - $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT | - $(LOGGING_UPDATEMODE) << UAVOBJ_LOGGING_UPDATE_MODE_SHIFT; - metadata.telemetryUpdatePeriod = $(FLIGHTTELEM_UPDATEPERIOD); - metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD); - metadata.loggingUpdatePeriod = $(LOGGING_UPDATEPERIOD); - UAVObjSetMetadata(obj, &metadata); + if ( instId == 0 ) { + UAVObjMetadata metadata; + metadata.flags = + $(FLIGHTACCESS) << UAVOBJ_ACCESS_SHIFT | + $(GCSACCESS) << UAVOBJ_GCS_ACCESS_SHIFT | + $(FLIGHTTELEM_ACKED) << UAVOBJ_TELEMETRY_ACKED_SHIFT | + $(GCSTELEM_ACKED) << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + $(FLIGHTTELEM_UPDATEMODE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT | + $(LOGGING_UPDATEMODE) << UAVOBJ_LOGGING_UPDATE_MODE_SHIFT; + metadata.telemetryUpdatePeriod = $(FLIGHTTELEM_UPDATEPERIOD); + metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD); + metadata.loggingUpdatePeriod = $(LOGGING_UPDATEPERIOD); + UAVObjSetMetadata(obj, &metadata); + } } /** From 4b50708db65879a3b1218d4f99c12264444be10a Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Tue, 8 Apr 2014 16:26:55 +0200 Subject: [PATCH 116/131] uncrustify --- .../openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp index 811bbf7ce..094158178 100644 --- a/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp +++ b/ground/openpilotgcs/src/libs/sdlgamepad/sdlgamepad.cpp @@ -22,14 +22,12 @@ #include "sdlgamepad.h" #include -//#undef main +// #undef main -class SDLGamepadPrivate -{ +class SDLGamepadPrivate { public: SDLGamepadPrivate() : gamepad(0) - { - } + {} /** * SDL_Joystick object. @@ -37,7 +35,6 @@ public: * This represents the currently opened SDL_Joystick object. */ SDL_Joystick *gamepad; - }; /**********************************************************************/ @@ -48,7 +45,7 @@ SDLGamepad::SDLGamepad() index = -1; loop = false; tick = MIN_RATE; - priv = new SDLGamepadPrivate; + priv = new SDLGamepadPrivate; } /**********************************************************************/ From 011c5987936f3a36ec5f164953e37b29ef0050af Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Tue, 8 Apr 2014 18:31:11 +0200 Subject: [PATCH 117/131] OP-1296 only use GPS in filterchains when explicitly requested disallow arming when GPS is needed for initialization until lock is acquired --- flight/modules/Attitude/revolution/attitude.c | 2 +- flight/modules/StateEstimation/filterbaro.c | 60 +++++++++++++++---- .../StateEstimation/inc/stateestimation.h | 1 + .../modules/StateEstimation/stateestimation.c | 45 +++++++++----- shared/uavobjectdefinition/revosettings.xml | 2 +- 5 files changed, 83 insertions(+), 27 deletions(-) diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index d502d1c8b..9621e41d7 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -278,7 +278,7 @@ static void AttitudeTask(__attribute__((unused)) void *parameters) case REVOSETTINGS_FUSIONALGORITHM_COMPLEMENTARY: ret_val = updateAttitudeComplementary(first_run); break; - case REVOSETTINGS_FUSIONALGORITHM_INS13OUTDOOR: + case REVOSETTINGS_FUSIONALGORITHM_INS13GPSOUTDOOR: ret_val = updateAttitudeINSGPS(first_run, true); break; case REVOSETTINGS_FUSIONALGORITHM_INS13INDOOR: diff --git a/flight/modules/StateEstimation/filterbaro.c b/flight/modules/StateEstimation/filterbaro.c index a44927392..4715d7762 100644 --- a/flight/modules/StateEstimation/filterbaro.c +++ b/flight/modules/StateEstimation/filterbaro.c @@ -36,7 +36,7 @@ // Private constants -#define STACK_REQUIRED 64 +#define STACK_REQUIRED 128 #define INIT_CYCLES 100 // Private types @@ -44,30 +44,59 @@ struct data { float baroOffset; float baroGPSOffsetCorrectionAlpha; float baroAlt; + float gpsAlt; int16_t first_run; + bool useGPS; }; // Private variables // Private functions -static int32_t init(stateFilter *self); +static int32_t initwithgps(stateFilter *self); +static int32_t initwithoutgps(stateFilter *self); +static int32_t maininit(stateFilter *self); static int32_t filter(stateFilter *self, stateEstimation *state); int32_t filterBaroInitialize(stateFilter *handle) { - handle->init = &init; + handle->init = &initwithgps; handle->filter = &filter; handle->localdata = pvPortMalloc(sizeof(struct data)); return STACK_REQUIRED; } -static int32_t init(stateFilter *self) +int32_t filterBaroiInitialize(stateFilter *handle) +{ + handle->init = &initwithoutgps; + handle->filter = &filter; + handle->localdata = pvPortMalloc(sizeof(struct data)); + return STACK_REQUIRED; +} + +static int32_t initwithgps(stateFilter *self) +{ + struct data *this = (struct data *)self->localdata; + + this->useGPS = 1; + return maininit(self); +} + +static int32_t initwithoutgps(stateFilter *self) +{ + struct data *this = (struct data *)self->localdata; + + this->useGPS = 0; + return maininit(self); +} + +static int32_t maininit(stateFilter *self) { struct data *this = (struct data *)self->localdata; this->baroOffset = 0.0f; + this->gpsAlt = 0.0f; this->first_run = INIT_CYCLES; RevoSettingsInitialize(); @@ -81,17 +110,29 @@ static int32_t filter(stateFilter *self, stateEstimation *state) struct data *this = (struct data *)self->localdata; if (this->first_run) { + // Make sure initial location is initialized properly before continuing + if (this->useGPS && IS_SET(state->updated, SENSORUPDATES_pos)) { + if (this->first_run == INIT_CYCLES) { + this->gpsAlt = state->pos[2]; + this->first_run--; + } + } // Initialize to current altitude reading at initial location if (IS_SET(state->updated, SENSORUPDATES_baro)) { - this->baroOffset = ((float)(INIT_CYCLES)-this->first_run) / (float)(INIT_CYCLES)*this->baroOffset + (this->first_run / (float)(INIT_CYCLES)) * state->baro[0]; - this->baroAlt = 0; - this->first_run--; + if (this->first_run < INIT_CYCLES || !this->useGPS) { + this->baroOffset = (((float)(INIT_CYCLES)-this->first_run) / (float)(INIT_CYCLES)) * this->baroOffset + (this->first_run / (float)(INIT_CYCLES)) * (state->baro[0] + this->gpsAlt); + this->baroAlt = state->baro[0]; + this->first_run--; + } UNSET_MASK(state->updated, SENSORUPDATES_baro); } + // make sure we raise an error until properly initialized - would not be good if people arm and + // use altitudehold without initialized barometer filter + return 2; } else { // Track barometric altitude offset with a low pass filter // based on GPS altitude if available - if (IS_SET(state->updated, SENSORUPDATES_pos)) { + if (this->useGPS && IS_SET(state->updated, SENSORUPDATES_pos)) { this->baroOffset = this->baroOffset * this->baroGPSOffsetCorrectionAlpha + (1.0f - this->baroGPSOffsetCorrectionAlpha) * (this->baroAlt + state->pos[2]); } @@ -100,9 +141,8 @@ static int32_t filter(stateFilter *self, stateEstimation *state) this->baroAlt = state->baro[0]; state->baro[0] -= this->baroOffset; } + return 0; } - - return 0; } diff --git a/flight/modules/StateEstimation/inc/stateestimation.h b/flight/modules/StateEstimation/inc/stateestimation.h index e0da4bf27..298edb31e 100644 --- a/flight/modules/StateEstimation/inc/stateestimation.h +++ b/flight/modules/StateEstimation/inc/stateestimation.h @@ -64,6 +64,7 @@ typedef struct stateFilterStruct { int32_t filterMagInitialize(stateFilter *handle); +int32_t filterBaroiInitialize(stateFilter *handle); int32_t filterBaroInitialize(stateFilter *handle); int32_t filterAltitudeInitialize(stateFilter *handle); int32_t filterAirInitialize(stateFilter *handle); diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index 3c142cdf5..901dcabb6 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -123,6 +123,7 @@ static filterPipeline *filterChain = NULL; // different filters available to state estimation static stateFilter magFilter; static stateFilter baroFilter; +static stateFilter baroiFilter; static stateFilter altitudeFilter; static stateFilter airFilter; static stateFilter stationaryFilter; @@ -138,15 +139,28 @@ static filterPipeline *cfQueue = &(filterPipeline) { .next = &(filterPipeline) { .filter = &airFilter, .next = &(filterPipeline) { - .filter = &llaFilter, + .filter = &baroiFilter, .next = &(filterPipeline) { - .filter = &baroFilter, + .filter = &altitudeFilter, .next = &(filterPipeline) { - .filter = &altitudeFilter, - .next = &(filterPipeline) { - .filter = &cfFilter, - .next = NULL, - } + .filter = &cfFilter, + .next = NULL, + } + } + } + } +}; +static const filterPipeline *cfmiQueue = &(filterPipeline) { + .filter = &magFilter, + .next = &(filterPipeline) { + .filter = &airFilter, + .next = &(filterPipeline) { + .filter = &baroiFilter, + .next = &(filterPipeline) { + .filter = &altitudeFilter, + .next = &(filterPipeline) { + .filter = &cfmFilter, + .next = NULL, } } } @@ -176,15 +190,12 @@ static const filterPipeline *ekf13iQueue = &(filterPipeline) { .next = &(filterPipeline) { .filter = &airFilter, .next = &(filterPipeline) { - .filter = &llaFilter, + .filter = &baroiFilter, .next = &(filterPipeline) { - .filter = &baroFilter, + .filter = &stationaryFilter, .next = &(filterPipeline) { - .filter = &stationaryFilter, - .next = &(filterPipeline) { - .filter = &ekf13iFilter, - .next = NULL, - } + .filter = &ekf13iFilter, + .next = NULL, } } } @@ -256,6 +267,7 @@ int32_t StateEstimationInitialize(void) uint32_t stack_required = STACK_SIZE_BYTES; // Initialize Filters stack_required = maxint32_t(stack_required, filterMagInitialize(&magFilter)); + stack_required = maxint32_t(stack_required, filterBaroiInitialize(&baroiFilter)); stack_required = maxint32_t(stack_required, filterBaroInitialize(&baroFilter)); stack_required = maxint32_t(stack_required, filterAltitudeInitialize(&altitudeFilter)); stack_required = maxint32_t(stack_required, filterAirInitialize(&airFilter)); @@ -334,12 +346,15 @@ static void StateEstimationCb(void) newFilterChain = cfQueue; break; case REVOSETTINGS_FUSIONALGORITHM_COMPLEMENTARYMAG: + newFilterChain = cfmiQueue; + break; + case REVOSETTINGS_FUSIONALGORITHM_COMPLEMENTARYMAGGPSOUTDOOR: newFilterChain = cfmQueue; break; case REVOSETTINGS_FUSIONALGORITHM_INS13INDOOR: newFilterChain = ekf13iQueue; break; - case REVOSETTINGS_FUSIONALGORITHM_INS13OUTDOOR: + case REVOSETTINGS_FUSIONALGORITHM_INS13GPSOUTDOOR: newFilterChain = ekf13Queue; break; default: diff --git a/shared/uavobjectdefinition/revosettings.xml b/shared/uavobjectdefinition/revosettings.xml index 8d634d1cd..0dd5e4d82 100644 --- a/shared/uavobjectdefinition/revosettings.xml +++ b/shared/uavobjectdefinition/revosettings.xml @@ -1,7 +1,7 @@ Settings for the revo to control the algorithm and what is updated - +