You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#defineVEH_TYPE VEH_TYPE_COPTER //set the vehicle type for logging and mavlink
49
-
#defineVEH_FLIGHTMODE_AP_IDS {AP_COPTER_FLIGHTMODE_STABILIZE, AP_COPTER_FLIGHTMODE_ACRO} //mapping of fightmode index to ArduPilot code for logging and mavlink
49
+
#defineVEH_FLIGHTMODE_AP_IDS {AP_COPTER_FLIGHTMODE_ACRO, AP_COPTER_FLIGHTMODE_STABILIZE} //mapping of fightmode index to ArduPilot code for logging and mavlink
50
50
#defineVEH_FLIGHTMODE_NAMES {"RATE", "ANGLE"} //fightmode names for telemetry
51
51
enum flightmode_enum { RATE, ANGLE }; //the available flightmode indexes
52
-
flightmode_enum rcin_to_flightmode_map[6] {RATE, RATE, RATE, ANGLE, ANGLE, ANGLE}; //flightmode mapping from 6 pos switch to flight mode (simulates a 2-pos switch: RATE/ANGLE)
52
+
flightmode_enum rcin_to_flightmode_map[6] {RATE, RATE, RATE, RATE, ANGLE, ANGLE}; //flightmode mapping from 2/3/6 pos switch to flight mode (simulates a 2-pos switch: RATE/ANGLE)
53
53
54
54
#include"madflight_config.h"//Edit this header file to setup the pins, hardware, radio, etc. for madflight
55
55
#include<madflight.h>
@@ -131,7 +131,11 @@ void loop() {
131
131
132
132
mag.update();
133
133
134
-
if(gps.update()) {bbx.log_gps(); bbx.log_att();} //update gps (and log GPS and ATT for plot.ardupilot.org visualization)
134
+
//update gps (and log GPS and ATT for plot.ardupilot.org visualization)
135
+
if(gps.update()) {
136
+
bbx.log_gps();
137
+
bbx.log_att();
138
+
}
135
139
136
140
//logging
137
141
staticuint32_t log_ts = 0;
@@ -157,7 +161,9 @@ void imu_loop() {
157
161
158
162
//Get radio commands - Note: don't do this in loop() because loop() is a lower priority task than imu_loop(), so in worst case loop() will not get any processor time.
159
163
rcl.update();
160
-
veh.setFlightmode( rcin_to_flightmode_map[rcl.flightmode] ); //map rcl.flightmode (0 to 5) to vehicle flightmode
164
+
if(rcl.connected() && veh.setFlightmode( rcin_to_flightmode_map[rcl.flightmode] )) { //map rcl.flightmode (0 to 5) to vehicle flightmode
0 commit comments