kopia lustrzana https://github.com/sh123/esp32_loraprs
More interoperability cases
rodzic
e2f12ebff1
commit
641987e0f8
3
config.h
3
config.h
|
@ -93,7 +93,8 @@
|
|||
#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 TNC2 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
|
||||
#define CFG_TEXT_PACKETS_3 false // true - enable aprs-lora 3 byte prefix '<', 0xff, 0x01
|
||||
#define CFG_TEXT_PACKETS_4 false // true - enable oe3cjb 4 byte prefix
|
||||
|
||||
// Frequency correction for narrow band bandwidths
|
||||
#define CFG_FREQ_CORR false // true - correct own frequency based on received packet
|
||||
|
|
|
@ -83,7 +83,8 @@ 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 TNC2 text packets and disables KISS+AX25 binary frames for interoperability
|
||||
cfg.EnableTextPacketsPrefix = CFG_TEXT_PACKETS_PREFIX; // enable aprs-lora 3 byte prefix '<', 0xff, 0x01
|
||||
cfg.EnableTextPackets3 = CFG_TEXT_PACKETS_3; // enable aprs-lora 3 byte prefix '<', 0xff, 0x01
|
||||
cfg.EnableTextPackets4 = CFG_TEXT_PACKETS_4; // enable 4 byte prefix
|
||||
|
||||
// kiss
|
||||
cfg.KissEnableExtensions = CFG_KISS_EXTENSIONS; // radio control and signal reports
|
||||
|
|
|
@ -4,7 +4,8 @@ namespace Kiss {
|
|||
|
||||
Processor::Processor()
|
||||
: disableKiss_(false)
|
||||
, usePrefix_(false)
|
||||
, usePrefix3_(false)
|
||||
, usePrefix4_(false)
|
||||
, isRawIdle_(true)
|
||||
, state_(State::GetStart)
|
||||
{
|
||||
|
@ -66,11 +67,17 @@ void Processor::queueSerialToRig(Cmd cmd, const byte *packet, int packetLength)
|
|||
bool result = 1;
|
||||
if (disableKiss_) {
|
||||
// inject proprietary identifier
|
||||
if (usePrefix_) {
|
||||
if (usePrefix3_) {
|
||||
result &= serialToRigQueue_.unshift('<');
|
||||
result &= serialToRigQueue_.unshift(0xff);
|
||||
result &= serialToRigQueue_.unshift(0x01);
|
||||
}
|
||||
if (usePrefix4_) {
|
||||
result &= serialToRigQueue_.unshift(' ');
|
||||
result &= serialToRigQueue_.unshift(' ');
|
||||
result &= serialToRigQueue_.unshift(' ');
|
||||
result &= serialToRigQueue_.unshift(' ');
|
||||
}
|
||||
// TNC2, send as is, receiveByteRaw will deal with it
|
||||
for (int i = 0; i < packetLength; i++) {
|
||||
byte rxByte = packet[i];
|
||||
|
@ -121,15 +128,23 @@ bool Processor::processRigToSerial()
|
|||
int readCnt = rxPacketSize;
|
||||
for (int i = 0, j = 0; i < readCnt; i++) {
|
||||
byte rxByte = rigToSerialQueue_.pop();
|
||||
if (disableKiss_ && usePrefix_) {
|
||||
if (disableKiss_) {
|
||||
// filter out properietary identifier
|
||||
if ((i == 0 && rxByte == '<') ||
|
||||
(i == 1 && rxByte == 0xff) ||
|
||||
(i == 2 && rxByte == 0x01))
|
||||
{
|
||||
if (usePrefix3_) {
|
||||
if ((i == 0 && rxByte == '<') ||
|
||||
(i == 1 && rxByte == 0xff) ||
|
||||
(i == 2 && rxByte == 0x01))
|
||||
{
|
||||
rxPacketSize--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// filter out first 4 bytes
|
||||
} else if (usePrefix4_) {
|
||||
if (i >= 0 && i <= 3) {
|
||||
rxPacketSize--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
buf[j++] = rxByte;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ private:
|
|||
|
||||
protected:
|
||||
bool disableKiss_;
|
||||
bool usePrefix_;
|
||||
bool usePrefix3_;
|
||||
bool usePrefix4_;
|
||||
|
||||
private:
|
||||
bool isRawIdle_;
|
||||
|
|
|
@ -68,7 +68,8 @@ 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 TNC2 text plain messages insead of AX25 binary frames for interoperability with other projects
|
||||
bool EnableTextPacketsPrefix; // true - enable aprs-lora 3 byte prefix '<', 0xff, 0x01
|
||||
bool EnableTextPackets3; // true - enable aprs-lora 3 byte prefix '<', 0xff, 0x01
|
||||
bool EnableTextPackets4; // true - enable oe3cjb 4 byte prefix
|
||||
|
||||
// external ptt tx control
|
||||
bool PttEnable; // true - enable external ptt control
|
||||
|
|
|
@ -27,7 +27,8 @@ void Service::setup(const Config &conf)
|
|||
config_ = conf;
|
||||
beaconLastTimestampMs_ = 0;
|
||||
disableKiss_ = conf.EnableTextPackets;
|
||||
usePrefix_ = conf.EnableTextPacketsPrefix;
|
||||
usePrefix3_ = conf.EnableTextPackets3;
|
||||
usePrefix4_ = conf.EnableTextPackets4;
|
||||
|
||||
LOG_SET_OPTION(false, false, true); // disable file, line, enable func
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue