diff options
author | Don Gagne <don@thegagnes.com> | 2014-08-04 09:41:29 -0700 |
---|---|---|
committer | Don Gagne <don@thegagnes.com> | 2014-08-04 09:41:29 -0700 |
commit | 014fd5f47baad2f49292216eba851100aa543fef (patch) | |
tree | 7c95a65b8cf6f86abe1c6a8c02019000ed5585e7 /src/modules | |
parent | 6fbeaeaacecfa532c1c4437ba51312e1c46d980d (diff) | |
download | px4-firmware-014fd5f47baad2f49292216eba851100aa543fef.tar.gz px4-firmware-014fd5f47baad2f49292216eba851100aa543fef.tar.bz2 px4-firmware-014fd5f47baad2f49292216eba851100aa543fef.zip |
Add fRunPreArmChecks flag
This is to allow unit tests to be written which do not perform pre-arm
checks
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/commander/state_machine_helper.cpp | 13 | ||||
-rw-r--r-- | src/modules/commander/state_machine_helper.h | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 3c3d2f233..f8589d24b 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -99,11 +99,12 @@ static const char * const state_names[ARMING_STATE_MAX] = { }; transition_result_t -arming_state_transition(struct vehicle_status_s *status, /// current vehicle status - const struct safety_s *safety, /// current safety settings - arming_state_t new_arming_state, /// arming state requested - struct actuator_armed_s *armed, /// current armed status - const int mavlink_fd) /// mavlink fd for error reporting, 0 for none +arming_state_transition(struct vehicle_status_s *status, ///< current vehicle status + const struct safety_s *safety, ///< current safety settings + arming_state_t new_arming_state, ///< arming state requested + struct actuator_armed_s *armed, ///< current armed status + bool fRunPreArmChecks, ///< true: run the pre-arm checks, false: no pre-arm checks, for unit testing + const int mavlink_fd) ///< mavlink fd for error reporting, 0 for none { // Double check that our static arrays are still valid ASSERT(ARMING_STATE_INIT == 0); @@ -125,7 +126,7 @@ arming_state_transition(struct vehicle_status_s *status, /// current int prearm_ret = OK; /* only perform the check if we have to */ - if (new_arming_state == ARMING_STATE_ARMED) { + if (fRunPreArmChecks && new_arming_state == ARMING_STATE_ARMED) { prearm_ret = prearm_check(status, mavlink_fd); } diff --git a/src/modules/commander/state_machine_helper.h b/src/modules/commander/state_machine_helper.h index bb1b87e71..69ce8bbce 100644 --- a/src/modules/commander/state_machine_helper.h +++ b/src/modules/commander/state_machine_helper.h @@ -57,7 +57,7 @@ typedef enum { bool is_safe(const struct vehicle_status_s *current_state, const struct safety_s *safety, const struct actuator_armed_s *armed); transition_result_t arming_state_transition(struct vehicle_status_s *current_state, const struct safety_s *safety, - arming_state_t new_arming_state, struct actuator_armed_s *armed, const int mavlink_fd); + arming_state_t new_arming_state, struct actuator_armed_s *armed, bool fRunPreArmChecks, const int mavlink_fd); transition_result_t main_state_transition(struct vehicle_status_s *current_state, main_state_t new_main_state); |