@@ -234,6 +234,12 @@ static int32_t updateAttitudeComplimentary(bool first_run)
234
234
AlarmsSet (SYSTEMALARMS_ALARM_ATTITUDE ,SYSTEMALARMS_ALARM_WARNING );
235
235
return -1 ;
236
236
}
237
+ if ( xQueueReceive (accelQueue , & ev , 0 ) != pdTRUE )
238
+ {
239
+ // When one of these is updated so should the other
240
+ AlarmsSet (SYSTEMALARMS_ALARM_ATTITUDE ,SYSTEMALARMS_ALARM_WARNING );
241
+ return -1 ;
242
+ }
237
243
238
244
// During initialization and
239
245
FlightStatusData flightStatus ;
@@ -290,7 +296,8 @@ static int32_t updateAttitudeComplimentary(bool first_run)
290
296
accel_err [1 ] /= accel_mag ;
291
297
accel_err [2 ] /= accel_mag ;
292
298
293
- if (1 ) {
299
+ if ( xQueueReceive (magQueue , & ev , 0 ) != pdTRUE )
300
+ {
294
301
// Rotate gravity to body frame and cross with accels
295
302
float brot [3 ];
296
303
float Rbe [3 ][3 ];
@@ -378,6 +385,14 @@ static int32_t updateAttitudeComplimentary(bool first_run)
378
385
379
386
AttitudeActualSet (& attitudeActual );
380
387
388
+ // Flush these queues for avoid errors
389
+ if ( xQueueReceive (baroQueue , & ev , 0 ) != pdTRUE )
390
+ {
391
+ }
392
+ if ( xQueueReceive (gpsQueue , & ev , 0 ) != pdTRUE )
393
+ {
394
+ }
395
+
381
396
AlarmsClear (SYSTEMALARMS_ALARM_ATTITUDE );
382
397
383
398
return 0 ;
0 commit comments