state_machine_test.cpp
Go to the documentation of this file.
1 #include "common.h"
2 #include "mavlink.h"
3 #include "state_manager.h"
4 #include "test_board.h"
5 
6 #include "rosflight.h"
7 
8 using namespace rosflight_firmware;
9 
10 class StateMachineTest : public ::testing::Test
11 {
12 public:
16 
17  StateMachineTest() : mavlink(board), rf(board, mavlink) {}
18 
19  void SetUp() override
20  {
21  board.backup_memory_clear();
22  rf.init();
23  rf.state_manager_.clear_error(rf.state_manager_.state().error_codes); // Clear All Errors to Start
25  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, false); // default to turning this off
26  stepFirmware(100000);
27  }
28 
29  void stepFirmware(uint32_t us)
30  {
31  uint64_t start_time_us = board.clock_micros();
32  float dummy_acc[3] = {0, 0, -9.80665};
33  float dummy_gyro[3] = {0, 0, 0};
34  while (board.clock_micros() < start_time_us + us)
35  {
36  board.set_imu(dummy_acc, dummy_gyro, board.clock_micros() + 1000);
37  rf.run();
38  }
39  }
40 };
41 
43 {
44  // Should be in PREFLIGHT MODE
45  EXPECT_EQ(rf.state_manager_.state().armed, false);
46  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
47  EXPECT_EQ(rf.state_manager_.state().error_codes, 0x00);
48  EXPECT_EQ(rf.state_manager_.state().error, false);
49 }
50 
51 TEST_F(StateMachineTest, SetAndClearAllErrors)
52 {
53  // Try setting and clearing all the errors
54  for (int error = 0x0001; error <= StateManager::ERROR_UNCALIBRATED_IMU; error *= 2)
55  {
56  // set the error
57  rf.state_manager_.set_error(error);
58  EXPECT_EQ(rf.state_manager_.state().armed, false);
59  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
60  EXPECT_EQ(rf.state_manager_.state().error_codes, error);
61  EXPECT_EQ(rf.state_manager_.state().error, true);
62 
63  // clear the error
64  rf.state_manager_.clear_error(error);
65  EXPECT_EQ(rf.state_manager_.state().armed, false);
66  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
67  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
68  EXPECT_EQ(rf.state_manager_.state().error, false);
69  }
70 }
71 
72 TEST_F(StateMachineTest, SetAndClearComboErrors)
73 {
76  rf.state_manager_.set_error(error);
77  EXPECT_EQ(rf.state_manager_.state().armed, false);
78  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
79  EXPECT_EQ(rf.state_manager_.state().error_codes, 0x32);
80  EXPECT_EQ(rf.state_manager_.state().error, true);
81 }
82 
83 TEST_F(StateMachineTest, AddErrorAfterPreviousError)
84 {
87  rf.state_manager_.set_error(error);
88  rf.state_manager_.set_error(StateManager::ERROR_INVALID_MIXER);
89  EXPECT_EQ(rf.state_manager_.state().armed, false);
90  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
91  EXPECT_EQ(rf.state_manager_.state().error_codes, 0x33);
92  EXPECT_EQ(rf.state_manager_.state().error, true);
93 }
94 
95 TEST_F(StateMachineTest, ClearOneErrorOutOfMany)
96 {
99  rf.state_manager_.set_error(error);
100  rf.state_manager_.clear_error(StateManager::ERROR_UNCALIBRATED_IMU);
101  EXPECT_EQ(rf.state_manager_.state().armed, false);
102  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
103  EXPECT_EQ(rf.state_manager_.state().error_codes,
105  EXPECT_EQ(rf.state_manager_.state().error, true);
106 }
107 
108 TEST_F(StateMachineTest, ClearMultipleErrorsAtOnce)
109 {
112  rf.state_manager_.set_error(error);
114  EXPECT_EQ(rf.state_manager_.state().armed, false);
115  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
116  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_UNCALIBRATED_IMU);
117  EXPECT_EQ(rf.state_manager_.state().error, true);
118 }
119 
120 TEST_F(StateMachineTest, ClearAllErrors)
121 {
124  rf.state_manager_.set_error(error);
125  rf.state_manager_.clear_error(error);
126  EXPECT_EQ(rf.state_manager_.state().armed, false);
127  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
128  EXPECT_EQ(rf.state_manager_.state().error_codes, 0x00);
129  EXPECT_EQ(rf.state_manager_.state().error, false);
130 }
131 
132 TEST_F(StateMachineTest, DoNotArmIfError)
133 {
134  // Now add, an error, and then try to arm
135  rf.state_manager_.set_error(StateManager::ERROR_INVALID_MIXER);
136  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
137  EXPECT_EQ(rf.state_manager_.state().armed, false);
138  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
139  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_INVALID_MIXER);
140  EXPECT_EQ(rf.state_manager_.state().error, true);
141 }
142 
143 TEST_F(StateMachineTest, ArmIfNoError)
144 {
145  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
146  EXPECT_EQ(rf.state_manager_.state().armed, true);
147  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
148  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
149  EXPECT_EQ(rf.state_manager_.state().error, false);
150 }
151 
152 TEST_F(StateMachineTest, ArmAndDisarm)
153 {
154  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
155  EXPECT_EQ(rf.state_manager_.state().armed, true);
156 
157  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_DISARM);
158  EXPECT_EQ(rf.state_manager_.state().armed, false);
159  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
160  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
161  EXPECT_EQ(rf.state_manager_.state().error, false);
162 }
163 
164 TEST_F(StateMachineTest, WaitForCalibrationToArm)
165 {
166  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
167  // try to arm
168  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
169  // We shouldn't have armed yet
170  EXPECT_EQ(rf.state_manager_.state().armed, false);
171  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
172  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
173  EXPECT_EQ(rf.state_manager_.state().error, false);
174 
175  // Calibration complete, it should arm now
176  rf.state_manager_.set_event(StateManager::EVENT_CALIBRATION_COMPLETE);
177  EXPECT_EQ(rf.state_manager_.state().armed, true);
178  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
179  EXPECT_EQ(rf.state_manager_.state().error_codes, 0x00);
180  EXPECT_EQ(rf.state_manager_.state().error, false);
181 }
182 
183 TEST_F(StateMachineTest, CalibrationFailedDontArm)
184 {
185  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
186  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
187  rf.state_manager_.set_event(StateManager::EVENT_CALIBRATION_FAILED);
188 
189  EXPECT_EQ(rf.state_manager_.state().armed, false);
190  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
191  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
192  EXPECT_EQ(rf.state_manager_.state().error, false);
193 }
194 
195 TEST_F(StateMachineTest, ErrorDuringCalibrationDontArm)
196 {
197  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
198  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
199  rf.state_manager_.set_error(StateManager::ERROR_INVALID_MIXER);
200 
201  EXPECT_EQ(rf.state_manager_.state().armed, false);
202  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
203  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_INVALID_MIXER);
204  EXPECT_EQ(rf.state_manager_.state().error, true);
205 }
206 
207 TEST_F(StateMachineTest, RCLostDuringCalibrationDontArm)
208 {
209  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
210  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
211  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
212 
213  EXPECT_EQ(rf.state_manager_.state().armed, false);
214  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
215  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_RC_LOST);
216  EXPECT_EQ(rf.state_manager_.state().error, true);
217 }
218 
219 TEST_F(StateMachineTest, ClearErrorStayDisarmed)
220 {
221  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
222  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
223  rf.state_manager_.set_error(StateManager::ERROR_INVALID_MIXER);
224  EXPECT_EQ(rf.state_manager_.state().armed, false);
225  rf.state_manager_.set_event(StateManager::EVENT_CALIBRATION_COMPLETE);
226  rf.state_manager_.clear_error(StateManager::ERROR_INVALID_MIXER);
227  EXPECT_EQ(rf.state_manager_.state().armed, false);
228  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
229 }
230 
231 TEST_F(StateMachineTest, RecoverRCStayDisarmed)
232 {
233  rf.params_.set_param_int(PARAM_CALIBRATE_GYRO_ON_ARM, true);
234  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
235  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
236  EXPECT_EQ(rf.state_manager_.state().armed, false);
237  rf.state_manager_.set_event(StateManager::EVENT_CALIBRATION_COMPLETE);
238  rf.state_manager_.set_event(StateManager::EVENT_RC_FOUND);
239  EXPECT_EQ(rf.state_manager_.state().armed, false);
240  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
241 }
242 
243 TEST_F(StateMachineTest, SetErrorsWhileArmed)
244 {
245  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
246  EXPECT_EQ(rf.state_manager_.state().armed, true);
247  rf.state_manager_.set_error(StateManager::ERROR_TIME_GOING_BACKWARDS);
248 
249  EXPECT_EQ(rf.state_manager_.state().armed, true);
250  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
251  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_TIME_GOING_BACKWARDS);
252  EXPECT_EQ(rf.state_manager_.state().error, true);
253 }
254 
255 TEST_F(StateMachineTest, ErrorsPersistWhenDisarmed)
256 {
257  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
258  rf.state_manager_.set_error(StateManager::ERROR_TIME_GOING_BACKWARDS);
259  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_DISARM);
260 
261  EXPECT_EQ(rf.state_manager_.state().armed, false);
262  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
263  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_TIME_GOING_BACKWARDS);
264  EXPECT_EQ(rf.state_manager_.state().error, true);
265 }
266 
267 TEST_F(StateMachineTest, UnableToArmWithPersistentErrors)
268 {
269  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
270  rf.state_manager_.set_error(StateManager::ERROR_TIME_GOING_BACKWARDS);
271  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_DISARM);
272  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
273 
274  EXPECT_EQ(rf.state_manager_.state().armed, false);
275  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_TIME_GOING_BACKWARDS);
276  EXPECT_EQ(rf.state_manager_.state().error, true);
277 }
278 
279 TEST_F(StateMachineTest, ArmIfThrottleLow)
280 {
281  uint16_t rc_values[8];
282  for (int i = 0; i < 8; i++)
283  {
284  rc_values[i] = (i > 3) ? 1000 : 1500;
285  }
286  rc_values[2] = 1000;
287  board.set_rc(rc_values);
288  step_firmware(rf, board, 100);
289  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
290  EXPECT_EQ(true, rf.state_manager_.state().armed);
291 }
292 
293 TEST_F(StateMachineTest, ArmIfThrottleHighWithMinThrottle)
294 {
295  rf.params_.set_param_int(PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE, true);
296  uint16_t rc_values[8];
297  for (int i = 0; i < 8; i++)
298  {
299  rc_values[i] = (i > 3) ? 1000 : 1500;
300  }
301  rc_values[2] = 1500;
302  board.set_rc(rc_values);
303  step_firmware(rf, board, 100000);
304 
305  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
306  step_firmware(rf, board, 1200000);
307  EXPECT_EQ(rf.state_manager_.state().armed, false);
308 }
309 
310 TEST_F(StateMachineTest, DontArmIfThrottleHighWithoutMinThrottle)
311 {
312  rf.params_.set_param_int(PARAM_RC_OVERRIDE_TAKE_MIN_THROTTLE, false);
313  uint16_t rc_values[8];
314  for (int i = 0; i < 8; i++)
315  {
316  rc_values[i] = (i > 3) ? 1000 : 1500;
317  }
318  rc_values[2] = 1500;
319  board.set_rc(rc_values);
320  step_firmware(rf, board, 100000);
321 
322  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
323  step_firmware(rf, board, 1200000);
324  EXPECT_EQ(rf.state_manager_.state().armed, false);
325 }
326 
327 TEST_F(StateMachineTest, LostRCWhenDisarmNoFailsafe)
328 {
329  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
330  EXPECT_EQ(rf.state_manager_.state().armed, false);
331  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
332  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_RC_LOST);
333  EXPECT_EQ(rf.state_manager_.state().error, true);
334 }
335 
336 TEST_F(StateMachineTest, UnableToArmWithoutRC)
337 {
338  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
339  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
340  EXPECT_EQ(rf.state_manager_.state().armed, false);
341 }
342 
343 TEST_F(StateMachineTest, AbleToArmAfterRCRecovery)
344 {
345  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
346  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
347  EXPECT_EQ(rf.state_manager_.state().armed, false);
348  rf.state_manager_.set_event(StateManager::EVENT_RC_FOUND);
349  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
350  EXPECT_EQ(rf.state_manager_.state().armed, true);
351 }
352 
353 TEST_F(StateMachineTest, RCLostWhileArmedEnterFailsafe)
354 {
355  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
356  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
357  EXPECT_EQ(rf.state_manager_.state().armed, true);
358  EXPECT_EQ(rf.state_manager_.state().error, true);
359  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_RC_LOST);
360  EXPECT_EQ(rf.state_manager_.state().failsafe, true);
361 }
362 
363 TEST_F(StateMachineTest, DisarmWhileInFailsafeGoToError)
364 {
365  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
366  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
367  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_DISARM);
368  EXPECT_EQ(rf.state_manager_.state().armed, false);
369  EXPECT_EQ(rf.state_manager_.state().error, true);
370  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_RC_LOST);
371  EXPECT_EQ(rf.state_manager_.state().failsafe, true);
372 }
373 
374 TEST_F(StateMachineTest, RegainRCAfterFailsafe)
375 {
376  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
377  rf.state_manager_.set_event(StateManager::EVENT_RC_LOST);
378  rf.state_manager_.set_event(StateManager::EVENT_RC_FOUND);
379  EXPECT_EQ(rf.state_manager_.state().armed, true);
380  EXPECT_EQ(rf.state_manager_.state().error, false);
381  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
382  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
383 }
384 constexpr uint32_t StateManager::BackupData::ARM_MAGIC; // C++ is weird
386 {
387  board.backup_memory_clear();
388  rf.state_manager_.check_backup_memory();
389  EXPECT_EQ(rf.state_manager_.state().armed, false);
390  EXPECT_EQ(rf.state_manager_.state().error, false);
391  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
392  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
393 }
394 TEST_F(StateMachineTest, CrashRecoveryDisarmed)
395 {
396  board.backup_memory_clear();
397  StateManager::BackupData data;
398  data.arm_flag = 0;
399  data.error_code = 1;
400  data.reset_count = 1;
401  data.finalize();
402  board.backup_memory_write(&data, sizeof(data));
403  rf.state_manager_.check_backup_memory();
404  EXPECT_EQ(rf.state_manager_.state().armed, false);
405  EXPECT_EQ(rf.state_manager_.state().error, false);
406  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
407  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
408 }
409 TEST_F(StateMachineTest, CrashRecoveryArmed)
410 {
411  board.backup_memory_clear();
412  StateManager::BackupData data;
413  data.arm_flag = StateManager::BackupData::ARM_MAGIC;
414  data.error_code = 1;
415  data.reset_count = 1;
416  data.finalize();
417  board.backup_memory_write(&data, sizeof(data));
418  rf.state_manager_.check_backup_memory();
419  EXPECT_EQ(rf.state_manager_.state().armed, true);
420  EXPECT_EQ(rf.state_manager_.state().error, false);
421  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
422  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
423 }
424 TEST_F(StateMachineTest, CrashRecoveryInvalidChecksum)
425 {
426  board.backup_memory_clear();
427  StateManager::BackupData data;
428  data.arm_flag = StateManager::BackupData::ARM_MAGIC;
429  data.error_code = 1;
430  data.reset_count = 1;
431  data.finalize();
432  data.checksum += 1;
433  board.backup_memory_write(&data, sizeof(data));
434  rf.state_manager_.check_backup_memory();
435  EXPECT_EQ(rf.state_manager_.state().armed, false);
436  EXPECT_EQ(rf.state_manager_.state().error, false);
437  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
438  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
439 }
440 TEST_F(StateMachineTest, CrashRecoveryInvalidArmMagic)
441 {
442  board.backup_memory_clear();
443  StateManager::BackupData data;
444  data.arm_flag = StateManager::BackupData::ARM_MAGIC - 101;
445  data.error_code = 1;
446  data.reset_count = 1;
447  data.finalize();
448  board.backup_memory_write(&data, sizeof(data));
449  rf.state_manager_.check_backup_memory();
450  EXPECT_EQ(rf.state_manager_.state().armed, false);
451  EXPECT_EQ(rf.state_manager_.state().error, false);
452  EXPECT_EQ(rf.state_manager_.state().error_codes, StateManager::ERROR_NONE);
453  EXPECT_EQ(rf.state_manager_.state().failsafe, false);
454 }
455 TEST_F(StateMachineTest, WriteBackupDataDisarmed)
456 {
457  board.backup_memory_clear();
458  const StateManager::BackupData::DebugInfo debug_info{1, 2, 3, 4, 5, 6, 7, 8};
459  rf.state_manager_.write_backup_data(debug_info);
460  StateManager::BackupData data;
461  board.backup_memory_read(&data, sizeof(data));
462  EXPECT_EQ(data.reset_count, 1);
463  EXPECT_EQ(data.arm_flag, 0);
464  EXPECT_TRUE(data.valid_checksum());
465  EXPECT_EQ(data.debug.r0, debug_info.r0);
466  EXPECT_EQ(data.debug.r1, debug_info.r1);
467  EXPECT_EQ(data.debug.r2, debug_info.r2);
468  EXPECT_EQ(data.debug.r3, debug_info.r3);
469  EXPECT_EQ(data.debug.r12, debug_info.r12);
470  EXPECT_EQ(data.debug.lr, debug_info.lr);
471  EXPECT_EQ(data.debug.pc, debug_info.pc);
472  EXPECT_EQ(data.debug.psr, debug_info.psr);
473 }
474 
475 TEST_F(StateMachineTest, WriteBackupDataArmed)
476 {
477  board.backup_memory_clear();
478  rf.state_manager_.set_event(StateManager::EVENT_REQUEST_ARM);
479  StateManager::BackupData::DebugInfo debug_info{1, 2, 3, 4, 5, 6, 7, 8};
480  rf.state_manager_.write_backup_data(debug_info);
481  StateManager::BackupData data;
482  board.backup_memory_read(&data, sizeof(data));
483  EXPECT_EQ(data.reset_count, 1);
484  EXPECT_EQ(data.arm_flag, StateManager::BackupData::ARM_MAGIC);
485  EXPECT_TRUE(data.valid_checksum());
486  EXPECT_EQ(data.debug.r0, debug_info.r0);
487  EXPECT_EQ(data.debug.r1, debug_info.r1);
488  EXPECT_EQ(data.debug.r2, debug_info.r2);
489  EXPECT_EQ(data.debug.r3, debug_info.r3);
490  EXPECT_EQ(data.debug.r12, debug_info.r12);
491  EXPECT_EQ(data.debug.lr, debug_info.lr);
492  EXPECT_EQ(data.debug.pc, debug_info.pc);
493  EXPECT_EQ(data.debug.psr, debug_info.psr);
494 }
static uint8_t Init(uint32_t AudioFreq, uint32_t Volume, uint32_t options)
Init Initialize and configures all required resources for audio play function.
static volatile bool error
Definition: drv_i2c.c:92
void set_imu(float *acc, float *gyro, uint64_t time_us)
Definition: test_board.cpp:57
uint64_t clock_micros() override
Definition: test_board.cpp:80
TEST_F(StateMachineTest, Init)
void run()
Main loop for the ROSflight autopilot flight stack.
Definition: rosflight.cpp:100
void stepFirmware(uint32_t us)
void SetUp() override
const State & state() const
void clear_error(uint16_t error)
void backup_memory_clear(size_t len) override
Definition: test_board.cpp:146
void step_firmware(rosflight_firmware::ROSflight &rf, rosflight_firmware::testBoard &board, uint32_t us)
Definition: common.cpp:30
void init()
Main initialization routine for the ROSflight autopilot flight stack.
Definition: rosflight.cpp:55
bool set_param_int(uint16_t id, int32_t value)
Sets the value of a parameter by ID and calls the parameter change callback.
Definition: param.cpp:366


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Sat May 9 2020 03:16:53