Skip to content

Commit

Permalink
fix gpio not toggling if turtle mode enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
modalai-tom committed Sep 26, 2024
1 parent 1473db7 commit fc1daa7
Showing 1 changed file with 11 additions and 12 deletions.
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

0 comments on commit fc1daa7

Please sign in to comment.