aprs is check status

This commit is contained in:
richonguzman 2023-06-06 12:37:22 -04:00
parent bbff189e10
commit 27f73d0a11
4 changed files with 32 additions and 15 deletions

View File

@ -25,7 +25,7 @@ Configuration Config(ConfigurationFilePath);
uint32_t lastTxTime = 0;
static bool beacon_update = true;
unsigned long previousWiFiMillis = 0;
static uint32_t lastRxTxTime = millis();
uint32_t lastRxTxTime = millis();
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
@ -35,7 +35,7 @@ bool statusAfterBoot = Config.statusAfterBoot;
std::vector<String> lastHeardStation;
std::vector<String> lastHeardStation_temp;
String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket; //iGateLatitude, iGateLongitude;
String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket;
String createAPRSPacket(String unprocessedPacket) {
String callsign_and_path_tracker, payload_tracker, processedPacket;
@ -229,8 +229,6 @@ void setup() {
LoRaUtils::setup();
iGateBeaconPacket = GPS_Utils::generateBeacon();
//iGateLatitude = GPS_Utils::processLatitudeAPRS();
//iGateLongitude = GPS_Utils::processLongitudeAPRS();
}
void loop() {
@ -253,7 +251,7 @@ void loop() {
APRS_IS_Utils::connect();
}
if (WiFi.status() == WL_CONNECTED) {
/*if (WiFi.status() == WL_CONNECTED) {
wifiState = "OK";
} else {
wifiState = "--";
@ -270,8 +268,8 @@ void loop() {
display_toggle(true);
}
lastRxTxTime = millis();
}
secondLine = "WiFi: " + wifiState + "/ APRS-IS: " + aprsisState;
}*/
secondLine = APRS_IS_Utils::checkStatus();// "WiFi: " + wifiState + "/ APRS-IS: " + aprsisState;
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
@ -296,13 +294,6 @@ void loop() {
if (beacon_update) {
display_toggle(true);
Serial.println("---- Sending iGate Beacon ----");
/*String iGateBeaconPacket = Config.callsign + ">APLR10,qAC:=";
if (Config.loramodule.enableTx) {
iGateBeaconPacket += iGateLatitude + "L" + iGateLongitude + "a";
} else {
iGateBeaconPacket += iGateLatitude + "L" + iGateLongitude + "&";
}
iGateBeaconPacket += Config.comment;*/
//Serial.println(iGateBeaconPacket);
espClient.write((iGateBeaconPacket + "\n").c_str());
lastTxTime = millis();

View File

@ -1,10 +1,12 @@
#include "aprs_is_utils.h"
#include <WiFi.h>
#include "configuration.h"
#include "display.h"
extern Configuration Config;
extern WiFiClient espClient;
extern int internalLedPin;
extern uint32_t lastRxTxTime;
namespace APRS_IS_Utils {
@ -32,6 +34,29 @@ void connect(){
}
}
String checkStatus() {
String wifiState, aprsisState;
if (WiFi.status() == WL_CONNECTED) {
wifiState = "OK";
} else {
wifiState = "--";
if (!Config.display.alwaysOn) {
display_toggle(true);
}
lastRxTxTime = millis();
}
if (espClient.connected()) {
aprsisState = "OK";
} else {
aprsisState = "--";
if (!Config.display.alwaysOn) {
display_toggle(true);
}
lastRxTxTime = millis();
}
return "WiFi: " + wifiState + "/ APRS-IS: " + aprsisState;
}
/*void processSplitedMessage(String addressee, String message1, String message2) {
espClient.write((Config.callsign + ">APRS,qAC::" + addressee + ":" + message1 + "\n").c_str());
Serial.println("-------> " + message1);

View File

@ -6,6 +6,7 @@
namespace APRS_IS_Utils {
void connect();
String checkStatus();
//void processSplitedMessage(String addressee, String message1, String message2);
}

View File

@ -22,7 +22,7 @@ void setup_display() {
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
display.display();
delay(4000);
delay(1000);
}
void display_toggle(bool toggle) {