mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 11:37:06 +08:00
fix a bug in the check_motor mechanism (NavResurrect was not possible
any more)
This commit is contained in:
@@ -230,6 +230,15 @@ static inline int ahrs_is_aligned(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Set motors ON or OFF and change the status of the check_motors state machine
|
||||
*/
|
||||
void autopilot_set_motors_on(bool_t motors_on) {
|
||||
autopilot_motors_on = motors_on;
|
||||
kill_throttle = ! autopilot_motors_on;
|
||||
if (autopilot_motors_on) autopilot_check_motor_status = STATUS_MOTORS_ON;
|
||||
else autopilot_check_motor_status = STATUS_MOTORS_OFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* State machine to check if motors should be turned ON or OFF
|
||||
* The motors start/stop when pushing the yaw stick without throttle during a given time
|
||||
|
||||
@@ -60,6 +60,7 @@ extern void autopilot_init(void);
|
||||
extern void autopilot_periodic(void);
|
||||
extern void autopilot_on_rc_frame(void);
|
||||
extern void autopilot_set_mode(uint8_t new_autopilot_mode);
|
||||
extern void autopilot_set_motors_on(bool_t motors_on);
|
||||
|
||||
extern bool_t autopilot_detect_ground;
|
||||
extern bool_t autopilot_detect_ground_once;
|
||||
|
||||
@@ -76,8 +76,8 @@ bool_t nav_detect_ground(void);
|
||||
|
||||
void nav_home(void);
|
||||
|
||||
#define NavKillThrottle() ({ if (autopilot_mode == AP_MODE_NAV) { kill_throttle = 1; autopilot_motors_on = 0; } FALSE; })
|
||||
#define NavResurrect() ({ if (autopilot_mode == AP_MODE_NAV) { kill_throttle = 0; autopilot_motors_on = 1; } FALSE; })
|
||||
#define NavKillThrottle() ({ if (autopilot_mode == AP_MODE_NAV) { autopilot_set_motors_on(FALSE); } FALSE; })
|
||||
#define NavResurrect() ({ if (autopilot_mode == AP_MODE_NAV) { autopilot_set_motors_on(TRUE); } FALSE; })
|
||||
|
||||
|
||||
#define NavSetGroundReferenceHere() ({ nav_reset_reference(); FALSE; })
|
||||
|
||||
Reference in New Issue
Block a user