passcode verified
This commit is contained in:
parent
9801545965
commit
62107a5b4a
|
|
@ -8,6 +8,7 @@ namespace APRS_IS_Utils {
|
||||||
|
|
||||||
void upload(const String& line);
|
void upload(const String& line);
|
||||||
void connect();
|
void connect();
|
||||||
|
|
||||||
void checkStatus();
|
void checkStatus();
|
||||||
String checkForStartingBytes(const String& packet);
|
String checkForStartingBytes(const String& packet);
|
||||||
|
|
||||||
|
|
@ -19,6 +20,8 @@ namespace APRS_IS_Utils {
|
||||||
void processAPRSISPacket(const String& packet);
|
void processAPRSISPacket(const String& packet);
|
||||||
void listenAPRSIS();
|
void listenAPRSIS();
|
||||||
|
|
||||||
|
void firstConnection();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -48,7 +48,7 @@ ___________________________________________________________________*/
|
||||||
#include "A7670_utils.h"
|
#include "A7670_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.12.04";
|
String versionDate = "2024.12.06";
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
#ifdef HAS_GPS
|
#ifdef HAS_GPS
|
||||||
|
|
@ -136,6 +136,7 @@ void setup() {
|
||||||
A7670_Utils::setup();
|
A7670_Utils::setup();
|
||||||
#endif
|
#endif
|
||||||
Utils::checkRebootMode();
|
Utils::checkRebootMode();
|
||||||
|
APRS_IS_Utils::firstConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
@ -149,14 +150,13 @@ void loop() {
|
||||||
if (Config.lowVoltageCutOff > 0) {
|
if (Config.lowVoltageCutOff > 0) {
|
||||||
BATTERY_Utils::checkIfShouldSleep();
|
BATTERY_Utils::checkIfShouldSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
thirdLine = Utils::getLocalIP();
|
thirdLine = Utils::getLocalIP();
|
||||||
|
|
||||||
WIFI_Utils::checkWiFi();
|
|
||||||
|
|
||||||
#ifdef HAS_A7670
|
#ifdef HAS_A7670
|
||||||
if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect();
|
if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect();
|
||||||
#else
|
#else
|
||||||
|
WIFI_Utils::checkWiFi();
|
||||||
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) APRS_IS_Utils::connect();
|
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) APRS_IS_Utils::connect();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -191,10 +191,10 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.aprs_is.active) { // If APRSIS enabled
|
if (Config.aprs_is.active) {
|
||||||
APRS_IS_Utils::listenAPRSIS(); // listen received packet from APRSIS
|
APRS_IS_Utils::listenAPRSIS(); // listen received packet from APRSIS
|
||||||
}
|
}
|
||||||
|
|
||||||
STATION_Utils::processOutputPacketBuffer();
|
STATION_Utils::processOutputPacketBuffer();
|
||||||
|
|
||||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ extern String seventhLine;
|
||||||
extern bool modemLoggedToAPRSIS;
|
extern bool modemLoggedToAPRSIS;
|
||||||
extern bool backUpDigiMode;
|
extern bool backUpDigiMode;
|
||||||
|
|
||||||
uint32_t lastRxTime = millis();
|
uint32_t lastRxTime = millis();
|
||||||
|
bool passcodeValid = false;
|
||||||
|
|
||||||
#ifdef HAS_A7670
|
#ifdef HAS_A7670
|
||||||
extern bool stationBeacon;
|
extern bool stationBeacon;
|
||||||
|
|
@ -50,11 +51,9 @@ namespace APRS_IS_Utils {
|
||||||
}
|
}
|
||||||
if (count == 20) {
|
if (count == 20) {
|
||||||
Serial.println("Tried: " + String(count) + " FAILED!");
|
Serial.println("Tried: " + String(count) + " FAILED!");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Serial.println("Connected!\n(Server: " + String(Config.aprs_is.server) + " / Port: " + String(Config.aprs_is.port) + ")");
|
Serial.println("Connected!\n(Server: " + String(Config.aprs_is.server) + " / Port: " + String(Config.aprs_is.port) + ")");
|
||||||
// String filter = "t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance;
|
// String filter = "t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance;
|
||||||
|
|
||||||
String aprsAuth = "user ";
|
String aprsAuth = "user ";
|
||||||
aprsAuth += Config.callsign;
|
aprsAuth += Config.callsign;
|
||||||
aprsAuth += " pass ";
|
aprsAuth += " pass ";
|
||||||
|
|
@ -62,7 +61,6 @@ namespace APRS_IS_Utils {
|
||||||
aprsAuth += " vers CA2RXU_LoRa_iGate 2.0 filter ";
|
aprsAuth += " vers CA2RXU_LoRa_iGate 2.0 filter ";
|
||||||
aprsAuth += Config.aprs_is.filter;
|
aprsAuth += Config.aprs_is.filter;
|
||||||
upload(aprsAuth);
|
upload(aprsAuth);
|
||||||
delay(200);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +172,7 @@ namespace APRS_IS_Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
void processLoRaPacket(const String& packet) {
|
void processLoRaPacket(const String& packet) {
|
||||||
if (espClient.connected() || modemLoggedToAPRSIS) {
|
if (passcodeValid && (espClient.connected() || modemLoggedToAPRSIS)) {
|
||||||
if (packet != "") {
|
if (packet != "") {
|
||||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||||
int firstColonIndex = packet.indexOf(":");
|
int firstColonIndex = packet.indexOf(":");
|
||||||
|
|
@ -259,13 +257,22 @@ namespace APRS_IS_Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
void processAPRSISPacket(const String& packet) {
|
void processAPRSISPacket(const String& packet) {
|
||||||
if (!packet.startsWith("#")) {
|
if (!passcodeValid && packet.indexOf(Config.callsign) != -1) {
|
||||||
|
if (packet.indexOf("unverified") != -1 ) {
|
||||||
|
Serial.println("\n****APRS PASSCODE NOT VALID****\n");
|
||||||
|
displayShow(firstLine, "", " APRS PASSCODE", " NOT VALID !!!", "", "", "", 0);
|
||||||
|
while (1) {};
|
||||||
|
} else if (packet.indexOf("verified") != -1 ) {
|
||||||
|
passcodeValid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (passcodeValid && !packet.startsWith("#")) {
|
||||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||||
String Sender = packet.substring(0, packet.indexOf(">"));
|
String Sender = packet.substring(0, packet.indexOf(">"));
|
||||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||||
Addressee.trim();
|
Addressee.trim();
|
||||||
if (Addressee == Config.callsign) { // its for me!
|
if (Addressee == Config.callsign) { // its for me!
|
||||||
String receivedMessage;
|
String receivedMessage;
|
||||||
if (AddresseeAndMessage.indexOf("{") > 0) { // ack?
|
if (AddresseeAndMessage.indexOf("{") > 0) { // ack?
|
||||||
String ackMessage = "ack";
|
String ackMessage = "ack";
|
||||||
|
|
@ -350,4 +357,13 @@ namespace APRS_IS_Utils {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void firstConnection() {
|
||||||
|
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) {
|
||||||
|
connect();
|
||||||
|
while (!passcodeValid) {
|
||||||
|
listenAPRSIS();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -37,12 +37,13 @@ extern int wxModuleType;
|
||||||
extern bool backUpDigiMode;
|
extern bool backUpDigiMode;
|
||||||
extern bool shouldSleepLowVoltage;
|
extern bool shouldSleepLowVoltage;
|
||||||
extern bool transmitFlag;
|
extern bool transmitFlag;
|
||||||
|
extern bool passcodeValid;
|
||||||
|
|
||||||
extern std::vector<LastHeardStation> lastHeardStations;
|
extern std::vector<LastHeardStation> lastHeardStations;
|
||||||
|
|
||||||
bool statusAfterBoot = true;
|
bool statusAfterBoot = true;
|
||||||
bool sendStartTelemetry = true;
|
bool sendStartTelemetry = true;
|
||||||
bool beaconUpdate = true;
|
bool beaconUpdate = false;
|
||||||
uint32_t lastBeaconTx = 0;
|
uint32_t lastBeaconTx = 0;
|
||||||
uint32_t lastScreenOn = millis();
|
uint32_t lastScreenOn = millis();
|
||||||
String beaconPacket;
|
String beaconPacket;
|
||||||
|
|
@ -185,7 +186,7 @@ namespace Utils {
|
||||||
|
|
||||||
void checkBeaconInterval() {
|
void checkBeaconInterval() {
|
||||||
uint32_t lastTx = millis() - lastBeaconTx;
|
uint32_t lastTx = millis() - lastBeaconTx;
|
||||||
if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) {
|
if (passcodeValid && (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000)) {
|
||||||
beaconUpdate = true;
|
beaconUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue