spam protection

This commit is contained in:
jusax23 2023-09-17 15:30:13 +02:00
parent 3f7ea70f75
commit 0cd62f9db7
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -88,6 +88,9 @@ void _rc_serial_add(const char* data, size_t len) {
} }
void _handle_serial_send() { void _handle_serial_send() {
static unsigned long lastRC = 0;
if (millis() - lastRC < 20) return;
lastRC = millis();
mutex_enter_blocking(&serial_mut); mutex_enter_blocking(&serial_mut);
if (rcSerial.command == 0) { if (rcSerial.command == 0) {
while (rcSerial.command < 30 && !queue_is_empty(&serial_write_queue)) { while (rcSerial.command < 30 && !queue_is_empty(&serial_write_queue)) {