Bluetooth : test if payload is an APRS frame before TX

This commit is contained in:
Valentin Saugnier 2023-08-07 13:13:39 +02:00
parent 63186eceff
commit fe5ccbb8e0
1 changed files with 7 additions and 1 deletions

View File

@ -75,11 +75,17 @@ namespace BLUETOOTH_Utils {
}
}
shouldSendToLoRa = !serialReceived.isEmpty(); // because we can't send data here
shouldSendToLoRa = !serialReceived.isEmpty()
// Test true APRS frame and not a NMEA (case when RX buffer overflow)
&& serialReceived.indexOf(">") != -1
&& serialReceived.indexOf(":") != -1
&& serialReceived.indexOf("$G") == -1
&& serialReceived.indexOf("$B") == -1;
if (shouldSendToLoRa) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "bluetooth",
"Data received should be transmitted to RF => %s", serialReceived.c_str());
// because we can't send data here
}
}