mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-07 00:13:59 -04:00
Sub: Add servo toggle button function
This commit is contained in:
parent
307638e8af
commit
8b0b96d56e
@ -430,6 +430,16 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
|
|||||||
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_min()); // 1-indexed
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_min()); // 1-indexed
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case JSButton::button_function_t::k_servo_1_min_toggle:
|
||||||
|
if(!held) {
|
||||||
|
SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
|
||||||
|
if(chan->get_output_pwm() != chan->get_output_min()) {
|
||||||
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_min()); // 1-indexed
|
||||||
|
} else {
|
||||||
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_trim()); // 1-indexed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case JSButton::button_function_t::k_servo_1_max:
|
case JSButton::button_function_t::k_servo_1_max:
|
||||||
case JSButton::button_function_t::k_servo_1_max_momentary:
|
case JSButton::button_function_t::k_servo_1_max_momentary:
|
||||||
{
|
{
|
||||||
@ -437,6 +447,16 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
|
|||||||
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_max()); // 1-indexed
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_max()); // 1-indexed
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case JSButton::button_function_t::k_servo_1_max_toggle:
|
||||||
|
if(!held) {
|
||||||
|
SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
|
||||||
|
if(chan->get_output_pwm() != chan->get_output_max()) {
|
||||||
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_max()); // 1-indexed
|
||||||
|
} else {
|
||||||
|
ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_trim()); // 1-indexed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case JSButton::button_function_t::k_servo_1_center:
|
case JSButton::button_function_t::k_servo_1_center:
|
||||||
{
|
{
|
||||||
SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
|
SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
|
||||||
|
Loading…
Reference in New Issue
Block a user