Explorar o código

[FL1327] Fix duplicate MOTD #475

あく %!s(int64=4) %!d(string=hai) anos
pai
achega
f69fa4b98f
Modificáronse 1 ficheiros con 8 adicións e 4 borrados
  1. 8 4
      firmware/targets/f5/api-hal/api-hal-vcp.c

+ 8 - 4
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;
     bool rts = state & 0b10;
 
 
     if (rts) {
     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 {
     } 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);
     osSemaphoreRelease(api_hal_vcp->tx_semaphore);