opt/1085-optimization-and-cleanup #37
@@ -454,13 +454,20 @@ static void relay_chn_execute_stop(relay_chn_ctl_t *chn_ctl)
|
||||
|
||||
// If there is any pending command, cancel it since the STOP command is issued right after it
|
||||
chn_ctl->pending_cmd = RELAY_CHN_CMD_NONE;
|
||||
// Invalidate the channel's timer if it is active
|
||||
esp_timer_stop(chn_ctl->inertia_timer);
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_RUN_LIMIT
|
||||
esp_timer_stop(chn_ctl->run_limit_timer);
|
||||
#endif
|
||||
|
||||
if (previous_state == RELAY_CHN_STATE_FORWARD_PENDING || previous_state == RELAY_CHN_STATE_REVERSE_PENDING) {
|
||||
chn_ctl->pending_cmd = RELAY_CHN_CMD_IDLE;
|
||||
// Do nothing more and let the timer set channel idle when it expires
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the channel's timer if it is active
|
||||
esp_timer_stop(chn_ctl->inertia_timer);
|
||||
|
||||
// Save the last run time only if the previous state was either STATE FORWARD
|
||||
// or STATE_REVERSE. Then schedule a free command.
|
||||
if (previous_state == RELAY_CHN_STATE_FORWARD || previous_state == RELAY_CHN_STATE_REVERSE) {
|
||||
@@ -474,7 +481,6 @@ static void relay_chn_execute_stop(relay_chn_ctl_t *chn_ctl)
|
||||
// relay_chn_dispatch_cmd(chn_ctl, RELAY_CHN_CMD_IDLE);
|
||||
relay_chn_execute_idle(chn_ctl);
|
||||
}
|
||||
ESP_LOGI(TAG, "execute_stop: #%d, state: %d", chn_ctl->id, chn_ctl->state); // TODO delete
|
||||
}
|
||||
|
||||
static void relay_chn_execute_forward(relay_chn_ctl_t *chn_ctl)
|
||||
|
||||
Reference in New Issue
Block a user