Inject filter out proprietary identifier used by another tracker to make it interoperable

pull/42/head
sh123 2022-08-25 10:28:35 +03:00
rodzic bac3bd69ec
commit 94623e493a
2 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
#define USE_RADIOLIB
// Uncomment for SX126X module usage
//#define USE_SX126X
#define USE_SX126X
// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
#ifdef USE_SX126X

Wyświetl plik

@ -17,6 +17,10 @@ void Processor::sendRigToSerial(Cmd cmd, const byte *packet, int packetLength) {
if (disableKiss_) {
for (int i = 0; i < packetLength; i++) {
byte rxByte = packet[i];
// filter out properietary identifier
if (i == 0 && rxByte == '<') continue;
if (i == 1 && rxByte == 0xff) continue;
if (i == 2 && rxByte == 0x01) continue;
// TNC2 splits on \n
if (rxByte == '\0') {
onSerialTx('\n');
@ -68,6 +72,10 @@ void ICACHE_RAM_ATTR Processor::queueRigToSerialIsr(Cmd cmd, const byte *packet,
void Processor::queueSerialToRig(Cmd cmd, const byte *packet, int packetLength) {
bool result = 1;
if (disableKiss_) {
// inject proprietary identifier
result &= serialToRigQueue_.unshift('<');
result &= serialToRigQueue_.unshift(0xff);
result &= serialToRigQueue_.unshift(0x01);
// TNC2, send as is, receiveByteRaw will deal with it
for (int i = 0; i < packetLength; i++) {
byte rxByte = packet[i];