From 86351a7bcb37f89d965c219f3696e7bd2d9e0f9a Mon Sep 17 00:00:00 2001 From: yelvlab Date: Tue, 28 Jul 2026 20:21:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(command):=E4=BF=AE=E5=A4=8D=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=A7=84=E8=8C=83=E6=80=A7=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E5=AE=9E=E8=B4=A8=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/actuator.c | 8 ++++---- Src/command.c | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Src/actuator.c b/Src/actuator.c index 80329fc..b4fc120 100644 --- a/Src/actuator.c +++ b/Src/actuator.c @@ -111,17 +111,17 @@ void actuator_stop(actuator_channel_t channel) { if(channel == ACTUATOR_CH1) { SEGGER_RTT_printf(0, "[ACTUATOR] Stopping Actuator CH1\n"); timer_channel_output_pulse_value_config(ACTUATOR_PWM_TIMER, ACTUATOR_CH1_PWM_TIMER_CH, 999); // Ensure CH1 is off - gpio_bit_set(ACTUATOR_CH1_GPIO_PORT, ACTUATOR_CH1_GPIO_PIN); // Set CH1 direction LOW + gpio_bit_set(ACTUATOR_CH1_GPIO_PORT, ACTUATOR_CH1_GPIO_PIN); // Set CH1 direction High } else if(channel == ACTUATOR_CH2) { SEGGER_RTT_printf(0, "[ACTUATOR] Stopping Actuator CH2\n"); timer_channel_output_pulse_value_config(ACTUATOR_PWM_TIMER, ACTUATOR_CH2_PWM_TIMER_CH, 999); // Ensure CH2 is off - gpio_bit_set(ACTUATOR_CH2_GPIO_PORT, ACTUATOR_CH2_GPIO_PIN); // Set CH2 direction LOW + gpio_bit_set(ACTUATOR_CH2_GPIO_PORT, ACTUATOR_CH2_GPIO_PIN); // Set CH2 direction High } else { // Invalid channel, handle error if necessary SEGGER_RTT_printf(0, "[ACTUATOR] Invalid channel specified for stop: %d\n", channel); timer_channel_output_pulse_value_config(ACTUATOR_PWM_TIMER, ACTUATOR_CH1_PWM_TIMER_CH, 999); // Ensure CH1 is off timer_channel_output_pulse_value_config(ACTUATOR_PWM_TIMER, ACTUATOR_CH2_PWM_TIMER_CH, 999); // Ensure CH2 is off - gpio_bit_set(ACTUATOR_CH1_GPIO_PORT, ACTUATOR_CH1_GPIO_PIN); // Set CH1 direction LOW - gpio_bit_set(ACTUATOR_CH2_GPIO_PORT, ACTUATOR_CH2_GPIO_PIN); // Set CH2 direction LOW + gpio_bit_set(ACTUATOR_CH1_GPIO_PORT, ACTUATOR_CH1_GPIO_PIN); // Set CH1 direction High + gpio_bit_set(ACTUATOR_CH2_GPIO_PORT, ACTUATOR_CH2_GPIO_PIN); // Set CH2 direction High } } \ No newline at end of file diff --git a/Src/command.c b/Src/command.c index 116ce92..07ccd6d 100644 --- a/Src/command.c +++ b/Src/command.c @@ -491,15 +491,17 @@ void handle_command(const uint8_t *frame, uint8_t len) { return; case 5u: // M5 stop actuator output + { uint32_t p_val = 0; bool has_p = find_parameter_value(cmd, cmd_len, 'P', &p_val); if (!has_p || p_val > (uint32_t)ACTUATOR_CH2) { send_response(RESP_TYPE_PARAM_ERR, s_report_status_err, sizeof(s_report_status_err)); return; } - SEGGER_RTT_printf(0, "[COMMAND] M5 Command(STOP): Actuator Channel=%u \n", p_val); - actuator_stop((actuator_channel_t)p_val); - send_response(RESP_TYPE_OK, s_report_status_ok, sizeof(s_report_status_ok)); + SEGGER_RTT_printf(0, "[COMMAND] M5 Command(STOP): Actuator Channel=%u \n", p_val); + actuator_stop((actuator_channel_t)p_val); + send_response(RESP_TYPE_OK, s_report_status_ok, sizeof(s_report_status_ok)); + } return; /* ==========================================