diff --git a/src/relay_chn_tilt.c b/src/relay_chn_tilt.c index 9162258..4fab83c 100644 --- a/src/relay_chn_tilt.c +++ b/src/relay_chn_tilt.c @@ -140,11 +140,11 @@ static void relay_chn_tilt_issue_cmd(relay_chn_tilt_ctl_t *tilt_ctl, relay_chn_t { // TILT_STOP is safe and high priority if (cmd == RELAY_CHN_TILT_CMD_STOP) { - if (tilt_ctl->chn_ctl->state == RELAY_CHN_STATE_STOPPED) { - return; // Do nothing if already stopped + relay_chn_state_t state = tilt_ctl->chn_ctl->state; + if (state == RELAY_CHN_STATE_TILT_FORWARD || state == RELAY_CHN_STATE_TILT_REVERSE) { + // If the command is TILT_STOP, issue it immediately + relay_chn_tilt_dispatch_cmd(tilt_ctl, cmd); } - // If the command is TILT_STOP, issue it immediately - relay_chn_tilt_dispatch_cmd(tilt_ctl, cmd); return; } @@ -320,7 +320,7 @@ void relay_chn_tilt_reverse() void relay_chn_tilt_stop() { - relay_chn_tilt_dispatch_cmd(&s_tilt_ctl, RELAY_CHN_TILT_CMD_STOP); + relay_chn_tilt_issue_cmd(&s_tilt_ctl, RELAY_CHN_TILT_CMD_STOP); } #endif // CONFIG_RELAY_CHN_COUNT > 1