diff --git a/config.h b/config.h index b9bf304..b7d07be 100644 --- a/config.h +++ b/config.h @@ -93,6 +93,7 @@ #define CFG_IS_TO_RF false // forward packets from internet to radio based on CFG_APRS_FILTER #define CFG_BEACON false // enable perdiodic beacon from CFG_APRS_RAW_BKN #define CFG_TEXT_PACKETS false // enable aprs text packets instead of binary for interoperability with other projects (disables KISS + AX.25!) +#define CFG_TEXT_PACKETS_PREFIX false // // true - enable aprs-lora 3 byte prefix '<', 0xff, 0x01 // Frequency correction for narrow band bandwidths #define CFG_FREQ_CORR false // true - correct own frequency based on received packet diff --git a/esp32_loraprs.ino b/esp32_loraprs.ino index af28ccf..5e08146 100644 --- a/esp32_loraprs.ino +++ b/esp32_loraprs.ino @@ -83,6 +83,7 @@ void initializeConfig(LoraPrs::Config &cfg) { cfg.EnableRepeater = CFG_DIGIREPEAT; // digirepeat incoming packets cfg.EnableBeacon = CFG_BEACON; // enable periodic AprsRawBeacon beacon to rf and aprsis if rf to aprsis is enabled cfg.EnableTextPackets = CFG_TEXT_PACKETS; // enables text packets and disables KISS+AX25 binary frames for interoperability + cfg.EnableTextPacketsPrefix = CFG_TEXT_PACKETS_PREFIX; // enable aprs-lora 3 byte prefix '<', 0xff, 0x01 // kiss cfg.KissEnableExtensions = CFG_KISS_EXTENSIONS; // radio control and signal reports diff --git a/kiss_processor.cpp b/kiss_processor.cpp index 1384675..cf20a5c 100644 --- a/kiss_processor.cpp +++ b/kiss_processor.cpp @@ -4,6 +4,7 @@ namespace Kiss { Processor::Processor() : disableKiss_(false) + , usePrefix_(false) , isRawIdle_(true) , state_(State::GetStart) { @@ -65,9 +66,11 @@ 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); + if (usePrefix_) { + 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]; @@ -118,7 +121,7 @@ bool Processor::processRigToSerial() int readCnt = rxPacketSize; for (int i = 0, j = 0; i < readCnt; i++) { byte rxByte = rigToSerialQueue_.pop(); - if (disableKiss_) { + if (disableKiss_ && usePrefix_) { // filter out properietary identifier if ((i == 0 && rxByte == '<') || (i == 1 && rxByte == 0xff) || diff --git a/kiss_processor.h b/kiss_processor.h index 8e7f210..a60f2aa 100644 --- a/kiss_processor.h +++ b/kiss_processor.h @@ -85,6 +85,7 @@ private: protected: bool disableKiss_; + bool usePrefix_; private: bool isRawIdle_; diff --git a/loraprs_config.h b/loraprs_config.h index c365e5f..0b3916a 100644 --- a/loraprs_config.h +++ b/loraprs_config.h @@ -68,6 +68,7 @@ struct Config bool EnableRepeater; // true - digirepeat incoming packets based on WIDEn-n paths bool EnableBeacon; // true - send AprsRawBeacon to RF and APRS-IS if EnableRfToIs is true bool EnableTextPackets; // true - use text plain messages insead of AX25 binary frames for interoperability with other projects + bool EnableTextPacketsPrefix; // true - enable aprs-lora 3 byte prefix '<', 0xff, 0x01 // external ptt tx control bool PttEnable; // true - enable external ptt control diff --git a/loraprs_service.cpp b/loraprs_service.cpp index f1d6497..fc7023b 100644 --- a/loraprs_service.cpp +++ b/loraprs_service.cpp @@ -27,6 +27,7 @@ void Service::setup(const Config &conf) config_ = conf; beaconLastTimestampMs_ = 0; disableKiss_ = conf.EnableTextPackets; + usePrefix_ = conf.EnableTextPacketsPrefix; LOG_SET_OPTION(false, false, true); // disable file, line, enable func