mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-22 08:40:16 +01:00
47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
#include "configuration.h"
|
|
#include "lora_utils.h"
|
|
#include "digi_utils.h"
|
|
#include "display.h"
|
|
#include "utils.h"
|
|
|
|
extern Configuration Config;
|
|
extern int stationMode;
|
|
extern uint32_t lastScreenOn;
|
|
|
|
namespace DIGI_Utils {
|
|
|
|
void processPacket(String packet) {
|
|
String loraPacket;
|
|
if (packet != "") {
|
|
Serial.print("Received Lora Packet : " + String(packet));
|
|
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
|
Serial.println(" ---> APRS LoRa Packet");
|
|
if ((stationMode==3) && (packet.indexOf("WIDE1-1") > 10)) {
|
|
utils::typeOfPacket(packet);
|
|
loraPacket = packet.substring(3);
|
|
loraPacket.replace("WIDE1-1", Config.callsign + "*");
|
|
delay(500);
|
|
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
|
display_toggle(true);
|
|
lastScreenOn = millis();
|
|
} else if (stationMode ==4){
|
|
utils::typeOfPacket(packet);
|
|
loraPacket = packet.substring(3,packet.indexOf(",")+1) + Config.callsign + "*" + packet.substring(packet.indexOf(","));
|
|
delay(500);
|
|
if (stationMode == 4) {
|
|
LoRa_Utils::changeFreqTx();
|
|
}
|
|
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
|
if (stationMode == 4) {
|
|
LoRa_Utils::changeFreqRx();
|
|
}
|
|
display_toggle(true);
|
|
lastScreenOn = millis();
|
|
}
|
|
} else {
|
|
Serial.println(" ---> LoRa Packet Ignored (first 3 bytes or NOGATE)\n");
|
|
}
|
|
}
|
|
}
|
|
|
|
} |