From 31e351a129d180c598d8e4a40a4a3795c893a41f Mon Sep 17 00:00:00 2001 From: ismail Date: Tue, 9 Sep 2025 17:50:02 +0300 Subject: [PATCH] Fix tilting opposite direction when running Fixed TILT_STOP command issuing chain that was causing a running channel to be stopped when an opposite direction tilting requested. For exeample: RUN_FORWARD > TILT_REVERSE. Refs #1105 and fixes #1110. --- src/relay_chn_tilt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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