LoRa_APRS_iGate/src/utils.cpp

40 lines
1 KiB
C++
Raw Normal View History

2023-06-04 20:54:11 +02:00
#include <WiFi.h>
#include <Arduino.h>
2023-06-06 17:21:59 +02:00
#include "configuration.h"
2023-06-07 23:25:50 +02:00
#include "wifi_utils.h"
2023-06-04 20:18:30 +02:00
#include "utils.h"
2023-06-04 20:54:11 +02:00
extern WiFiClient espClient;
extern Configuration Config;
extern bool statusAfterBoot;
2023-06-04 20:18:30 +02:00
2023-06-04 20:54:11 +02:00
namespace utils {
2023-06-04 20:18:30 +02:00
2023-06-07 23:25:50 +02:00
void validateMode(int mode) {
if (mode == 1 || mode == 2 || mode == 5) {
if (mode==1) {
Serial.println("stationMode ---> iGate (only Rx)");
} else {
Serial.println("stationMode ---> iGate (Rx + Tx)");
}
WIFI_Utils::setup();
btStop();
} else if (mode == 3) {
Serial.println("stationMode ---> DigiRepeater Rx freq = Tx freq");
} else if (mode == 4) {
Serial.println("stationMode ---> DigiRepeater Rx freq = Tx freq");
} else {
Serial.println("stationMode ---> NOT VALID, check 'data/igate_conf.json'");
while (1);
}
}
2023-06-04 20:54:11 +02:00
void processStatus() {
delay(1000);
2023-06-06 23:25:50 +02:00
String startupStatus = Config.callsign + ">APLRG1,qAC:>" + Config.defaultStatus;
2023-06-04 20:54:11 +02:00
espClient.write((startupStatus + "\n").c_str());
statusAfterBoot = false;
2023-06-04 20:18:30 +02:00
}
}