Skip to content

Commit

Permalink
added kill_throttle again, is needed because the kill button in the G…
Browse files Browse the repository at this point in the history
…CS is connected to the kill_throttle setting
  • Loading branch information
flixr committed Apr 6, 2012
1 parent 8995b02 commit ffd501a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conf/settings/settings_booz2.xml
Expand Up @@ -5,7 +5,7 @@

<dl_settings NAME="Misc">
<dl_setting var="autopilot_mode_auto2" min="0" step="1" max="12" module="autopilot" shortname="auto2" values="Fail|Kill|Rate|Att|Rate_rcC|Att_rcC|Att_C|Rate_Z|Att_Z|Hover|Hover_C|Hover_Z|Nav"/>
<dl_setting var="autopilot_motors_on" min="0" step="1" max="1" module="autopilot" values="Kill|Resurrect" handler="KillThrottle"/>
<dl_setting var="kill_throttle" min="0" step="1" max="1" module="autopilot" values="Resurrect|Kill" handler="KillThrottle"/>
<dl_setting var="autopilot_power_switch" min="0" step="1" max="1" module="autopilot" values="OFF|ON" handler="SetPowerSwitch">
<strip_button name="POWER ON" icon="on.png" value="1"/>
<strip_button name="POWER OFF" icon="off.png" value="0"/>
Expand Down
5 changes: 5 additions & 0 deletions sw/airborne/firmwares/rotorcraft/autopilot.c
Expand Up @@ -36,6 +36,7 @@ uint32_t autopilot_in_flight_counter;
uint16_t autopilot_flight_time;

bool_t autopilot_motors_on;
bool_t kill_throttle;

bool_t autopilot_rc;
bool_t autopilot_power_switch;
Expand Down Expand Up @@ -67,6 +68,7 @@ static inline int ahrs_is_aligned(void) {
void autopilot_init(void) {
autopilot_mode = AP_MODE_KILL;
autopilot_motors_on = FALSE;
kill_throttle = ! autopilot_motors_on;
autopilot_in_flight = FALSE;
autopilot_in_flight_counter = 0;
autopilot_mode_auto2 = MODE_AUTO2;
Expand Down Expand Up @@ -222,6 +224,7 @@ static inline void autopilot_check_in_flight( bool_t motors_on ) {

void autopilot_set_motors_on(bool_t motors_on) {
autopilot_motors_on = motors_on;
kill_throttle = ! autopilot_motors_on;
autopilot_arming_set(autopilot_motors_on);
}

Expand All @@ -241,6 +244,8 @@ void autopilot_on_rc_frame(void) {
// an arming sequence is used to start/stop motors
autopilot_arming_check_motors_on();

kill_throttle = ! autopilot_motors_on;

autopilot_check_in_flight(autopilot_motors_on);

if (autopilot_mode > AP_MODE_FAILSAFE) {
Expand Down
1 change: 1 addition & 0 deletions sw/airborne/firmwares/rotorcraft/autopilot.h
Expand Up @@ -49,6 +49,7 @@ extern uint8_t autopilot_mode;
extern uint8_t autopilot_mode_auto2;
extern bool_t autopilot_motors_on;
extern bool_t autopilot_in_flight;
extern bool_t kill_throttle;
extern bool_t autopilot_rc;

extern bool_t autopilot_power_switch;
Expand Down
1 change: 1 addition & 0 deletions sw/airborne/firmwares/rotorcraft/autopilot_arming_switch.h
Expand Up @@ -90,6 +90,7 @@ static inline void autopilot_arming_check_motors_on( void ) {
default:
break;
}
kill_throttle = ! autopilot_motors_on;
}

#endif /* AUTOPILOT_ARMING_SWITCH_H */

0 comments on commit ffd501a

Please sign in to comment.