From f69fa4b98f42b757ef6378411930bc0644731422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Wed, 19 May 2021 19:53:11 +0300 Subject: [PATCH] [FL1327] Fix duplicate MOTD #475 --- firmware/targets/f5/api-hal/api-hal-vcp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/targets/f5/api-hal/api-hal-vcp.c b/firmware/targets/f5/api-hal/api-hal-vcp.c index 4c797306..6c2d71df 100644 --- a/firmware/targets/f5/api-hal/api-hal-vcp.c +++ b/firmware/targets/f5/api-hal/api-hal-vcp.c @@ -46,11 +46,15 @@ void _api_hal_vcp_control_line(uint8_t state) { bool rts = state & 0b10; if (rts) { - api_hal_vcp->alive = true; - _api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH + if (!api_hal_vcp->alive) { + api_hal_vcp->alive = true; + _api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH + } } else { - api_hal_vcp->alive = false; - _api_hal_vcp_rx_callback(&ascii_eot, 1); // EOT + if (api_hal_vcp->alive) { + _api_hal_vcp_rx_callback(&ascii_eot, 1); // EOT + api_hal_vcp->alive = false; + } } osSemaphoreRelease(api_hal_vcp->tx_semaphore);