Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gpio not toggling if turtle mode enabled #69

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/drivers/actuators/voxl_esc/voxl_esc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,11 +1459,14 @@ void VoxlEsc::Run()
update_leds(_led_rsc.mode, _led_rsc.control);
}

if (_parameters.mode > 0) {
/* if turtle mode enabled, we go straight to the sticks, no mix */
if (_manual_control_setpoint_sub.updated()) {
/* check whether sticks have been updated */
if (_manual_control_setpoint_sub.updated()) {

_manual_control_setpoint_sub.copy(&_manual_control_setpoint);

if (_parameters.mode > 0) {
/* if turtle mode enabled, we go straight to the sticks, no mix */

_manual_control_setpoint_sub.copy(&_manual_control_setpoint);

if (!_outputs_on) {

Expand All @@ -1483,16 +1486,12 @@ void VoxlEsc::Run()
_turtle_mode_en = false;
}
}
}

}

// check if gpio control is enabled
if (_parameters.gpio_ctl_channel > 0) {

if (_manual_control_setpoint_sub.updated()) {
}

_manual_control_setpoint_sub.copy(&_manual_control_setpoint);
// check if gpio control is enabled
if (_parameters.gpio_ctl_channel > 0) {

_gpio_ctl_en = true;
float gpio_setpoint = VOXL_ESC_GPIO_CTL_DISABLED_SETPOINT;
Expand Down Expand Up @@ -1520,10 +1519,10 @@ void VoxlEsc::Run()

if (gpio_setpoint > VOXL_ESC_GPIO_CTL_THRESHOLD) {
_gpio_ctl_high = false;

} else {
_gpio_ctl_high = true;
}

}
}

Expand Down
Loading