From 0cd62f9db71a0ee92ad493da45ccdaff713ba647 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sun, 17 Sep 2023 15:30:13 +0200 Subject: [PATCH] spam protection --- rcserial.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rcserial.h b/rcserial.h index fd9fad3..05209b9 100644 --- a/rcserial.h +++ b/rcserial.h @@ -88,6 +88,9 @@ void _rc_serial_add(const char* data, size_t len) { } void _handle_serial_send() { + static unsigned long lastRC = 0; + if (millis() - lastRC < 20) return; + lastRC = millis(); mutex_enter_blocking(&serial_mut); if (rcSerial.command == 0) { while (rcSerial.command < 30 && !queue_is_empty(&serial_write_queue)) {