mejora Resolucion
This commit is contained in:
parent
8e49b29b9f
commit
08191ebb04
|
|
@ -11,7 +11,6 @@
|
||||||
#include "lora_utils.h"
|
#include "lora_utils.h"
|
||||||
#include "wifi_utils.h"
|
#include "wifi_utils.h"
|
||||||
#include "digi_utils.h"
|
#include "digi_utils.h"
|
||||||
#include "time_utils.h"
|
|
||||||
#include "gps_utils.h"
|
#include "gps_utils.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -20,7 +19,7 @@ Configuration Config;
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
|
|
||||||
|
|
||||||
String versionDate = "2023.06.16";
|
String versionDate = "2023.06.17";
|
||||||
int myWiFiAPIndex = 0;
|
int myWiFiAPIndex = 0;
|
||||||
int myWiFiAPSize = Config.wifiAPs.size();
|
int myWiFiAPSize = Config.wifiAPs.size();
|
||||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||||
|
|
@ -43,7 +42,6 @@ void setup() {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
Utils::setupDiplay();
|
Utils::setupDiplay();
|
||||||
WIFI_Utils::setup();
|
WIFI_Utils::setup();
|
||||||
TIME_Utils::setup();
|
|
||||||
LoRa_Utils::setup();
|
LoRa_Utils::setup();
|
||||||
Utils::validateDigiFreqs();
|
Utils::validateDigiFreqs();
|
||||||
iGateBeaconPacket = GPS_Utils::generateBeacon();
|
iGateBeaconPacket = GPS_Utils::generateBeacon();
|
||||||
|
|
@ -60,7 +58,6 @@ void loop() {
|
||||||
APRS_IS_Utils::checkStatus();
|
APRS_IS_Utils::checkStatus();
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
||||||
while (espClient.connected()) {
|
while (espClient.connected()) {
|
||||||
TIME_Utils::getDateTime();
|
|
||||||
Utils::checkDisplayInterval();
|
Utils::checkDisplayInterval();
|
||||||
Utils::checkBeaconInterval();
|
Utils::checkBeaconInterval();
|
||||||
APRS_IS_Utils::processLoRaPacket(LoRa_Utils::receivePacket());
|
APRS_IS_Utils::processLoRaPacket(LoRa_Utils::receivePacket());
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void processLoRaPacket(String packet) {
|
||||||
espClient.write(aprsPacket.c_str());
|
espClient.write(aprsPacket.c_str());
|
||||||
Serial.println(" ---> Uploaded to APRS-IS");
|
Serial.println(" ---> Uploaded to APRS-IS");
|
||||||
STATION_Utils::updateLastHeard(Sender);
|
STATION_Utils::updateLastHeard(Sender);
|
||||||
Utils::typeOfPacket(aprsPacket);
|
Utils::typeOfPacket(aprsPacket, "LoRa-APRS");
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -180,8 +180,8 @@ void processAPRSISPacket(String packet) {
|
||||||
LoRa_Utils::sendNewPacket("APRS", LoRa_Utils::generatePacket(packet));
|
LoRa_Utils::sendNewPacket("APRS", LoRa_Utils::generatePacket(packet));
|
||||||
display_toggle(true);
|
display_toggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
Utils::typeOfPacket(packet);
|
Utils::typeOfPacket(packet, "APRS-LoRa");
|
||||||
seventhLine = Sender + " -> " + Addressee;
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ void processPacket(String packet) {
|
||||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
|
||||||
Serial.println(" ---> APRS LoRa Packet");
|
Serial.println(" ---> APRS LoRa Packet");
|
||||||
if ((stationMode==3) && (packet.indexOf("WIDE1-1") > 10)) {
|
if ((stationMode==3) && (packet.indexOf("WIDE1-1") > 10)) {
|
||||||
Utils::typeOfPacket(packet);
|
Utils::typeOfPacket(packet, "Digi");
|
||||||
loraPacket = packet.substring(3);
|
loraPacket = packet.substring(3);
|
||||||
loraPacket.replace("WIDE1-1", Config.callsign + "*");
|
loraPacket.replace("WIDE1-1", Config.callsign + "*");
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
@ -25,7 +25,7 @@ void processPacket(String packet) {
|
||||||
display_toggle(true);
|
display_toggle(true);
|
||||||
lastScreenOn = millis();
|
lastScreenOn = millis();
|
||||||
} else if (stationMode ==4){
|
} else if (stationMode ==4){
|
||||||
Utils::typeOfPacket(packet);
|
Utils::typeOfPacket(packet, "Digi");
|
||||||
if (packet.indexOf("WIDE1-1") == -1) {
|
if (packet.indexOf("WIDE1-1") == -1) {
|
||||||
loraPacket = packet.substring(3,packet.indexOf(":")) + "," + Config.callsign + "*" + packet.substring(packet.indexOf(":"));
|
loraPacket = packet.substring(3,packet.indexOf(":")) + "," + Config.callsign + "*" + packet.substring(packet.indexOf(":"));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern std::vector<String> lastHeardStation;
|
extern std::vector<String> lastHeardStation;
|
||||||
extern std::vector<String> lastHeardStation_temp;
|
extern std::vector<String> lastHeardStation_temp;
|
||||||
|
extern String fifthLine;
|
||||||
|
|
||||||
namespace STATION_Utils {
|
namespace STATION_Utils {
|
||||||
|
|
||||||
|
|
@ -42,6 +43,11 @@ void updateLastHeard(String station) {
|
||||||
Serial.print(lastHeardStation[k].substring(0,lastHeardStation[k].indexOf(","))); Serial.print(" ");
|
Serial.print(lastHeardStation[k].substring(0,lastHeardStation[k].indexOf(","))); Serial.print(" ");
|
||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
if (lastHeardStation.size() < 10) {
|
||||||
|
fifthLine = "Stations (30min) = " + String(lastHeardStation.size());
|
||||||
|
} else {
|
||||||
|
fifthLine = "Stations (30min) = " + String(lastHeardStation.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasHeard(String station) {
|
bool wasHeard(String station) {
|
||||||
|
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
#include "time_utils.h"
|
|
||||||
#include "display.h"
|
|
||||||
#include "time.h"
|
|
||||||
|
|
||||||
extern String firstLine;
|
|
||||||
extern String secondLine;
|
|
||||||
extern String thirdLine;
|
|
||||||
extern String fourthLine;
|
|
||||||
extern String fifthLine;
|
|
||||||
extern String sixthLine;
|
|
||||||
extern String seventhLine;
|
|
||||||
extern String eigthLine;
|
|
||||||
|
|
||||||
namespace TIME_Utils {
|
|
||||||
|
|
||||||
void getDateTime() {
|
|
||||||
struct tm timeinfo;
|
|
||||||
String year, month, day, hour, minute, seconds;
|
|
||||||
if(!getLocalTime(&timeinfo)){
|
|
||||||
Serial.println("Failed to obtain time");
|
|
||||||
fourthLine = "no time info... restarting";
|
|
||||||
ESP.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
year = (String)(timeinfo.tm_year + 1900);
|
|
||||||
|
|
||||||
month = (String)(timeinfo.tm_mon+1);
|
|
||||||
if (month.length() == 1) {
|
|
||||||
month = "0" + month;
|
|
||||||
}
|
|
||||||
|
|
||||||
day = (String)(timeinfo.tm_mday);
|
|
||||||
if (day.length() == 1) {
|
|
||||||
day = "0" + day;
|
|
||||||
}
|
|
||||||
|
|
||||||
hour = (String)(timeinfo.tm_hour);
|
|
||||||
if (hour == 0) {
|
|
||||||
hour = "00";
|
|
||||||
} else if (hour.length() == 1) {
|
|
||||||
hour = "0" + hour;
|
|
||||||
}
|
|
||||||
|
|
||||||
minute = (String)(timeinfo.tm_min);
|
|
||||||
if (minute == 0) {
|
|
||||||
minute = "00";
|
|
||||||
} else if (minute.length() == 1) {
|
|
||||||
minute = "0" + minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
seconds = (String)(timeinfo.tm_sec);
|
|
||||||
if (seconds == 0) {
|
|
||||||
seconds = "00";
|
|
||||||
} else if (seconds.length() == 1) {
|
|
||||||
seconds = "0" + seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
fourthLine = year + "/" + month + "/" + day + " - " + hour + ":" + minute + ":" + seconds;
|
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
const char* ntpServer = "pool.ntp.org";
|
|
||||||
const long GMT = 0; // for receiving UTC time
|
|
||||||
const long gmtOffset_sec = GMT*60*60;
|
|
||||||
const int daylightOffset_sec = 3600;
|
|
||||||
|
|
||||||
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
|
|
||||||
//configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
|
|
||||||
getDateTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef TIME_UTILS_H_
|
|
||||||
#define TIME_UTILS_H_
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
|
|
||||||
namespace TIME_Utils {
|
|
||||||
|
|
||||||
void getDateTime();
|
|
||||||
void setup();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -14,23 +14,24 @@
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
extern WiFiClient espClient;
|
extern WiFiClient espClient;
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern String versionDate;
|
extern String versionDate;
|
||||||
extern bool statusAfterBoot;
|
extern bool statusAfterBoot;
|
||||||
extern String firstLine;
|
extern String firstLine;
|
||||||
extern String secondLine;
|
extern String secondLine;
|
||||||
extern String thirdLine;
|
extern String thirdLine;
|
||||||
extern String fourthLine;
|
extern String fourthLine;
|
||||||
extern String fifthLine;
|
extern String fifthLine;
|
||||||
extern String sixthLine;
|
extern String sixthLine;
|
||||||
extern String seventhLine;
|
extern String seventhLine;
|
||||||
extern String eigthLine;
|
extern String eigthLine;
|
||||||
extern uint32_t lastBeaconTx;
|
extern uint32_t lastBeaconTx;
|
||||||
extern uint32_t lastScreenOn;
|
extern uint32_t lastScreenOn;
|
||||||
extern bool beacon_update;
|
extern bool beacon_update;
|
||||||
extern int stationMode;
|
extern int stationMode;
|
||||||
extern String iGateBeaconPacket;
|
extern String iGateBeaconPacket;
|
||||||
|
extern std::vector<String> lastHeardStation;
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
|
|
@ -56,7 +57,7 @@ void processStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getLocalIP() {
|
String getLocalIP() {
|
||||||
return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]);
|
return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupDiplay() {
|
void setupDiplay() {
|
||||||
|
|
@ -70,7 +71,7 @@ void setupDiplay() {
|
||||||
secondLine = "<DigiRepeater Active>";
|
secondLine = "<DigiRepeater Active>";
|
||||||
} else {
|
} else {
|
||||||
secondLine = "";
|
secondLine = "";
|
||||||
}
|
}
|
||||||
seventhLine = "";
|
seventhLine = "";
|
||||||
eigthLine = " listening...";
|
eigthLine = " listening...";
|
||||||
}
|
}
|
||||||
|
|
@ -85,12 +86,21 @@ void checkBeaconInterval() {
|
||||||
Serial.println("---- Sending iGate Beacon ----");
|
Serial.println("---- Sending iGate Beacon ----");
|
||||||
if (stationMode==1 || stationMode==2) {
|
if (stationMode==1 || stationMode==2) {
|
||||||
thirdLine = getLocalIP();
|
thirdLine = getLocalIP();
|
||||||
|
if (lastHeardStation.size() < 10) {
|
||||||
|
fifthLine = "Stations (30min) = " + String(lastHeardStation.size());
|
||||||
|
} else {
|
||||||
|
fifthLine = "Stations (30min) = " + String(lastHeardStation.size());
|
||||||
|
}
|
||||||
|
//fifthLine = "";
|
||||||
|
sixthLine = "";
|
||||||
seventhLine = "";
|
seventhLine = "";
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 1000);
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 1000);
|
||||||
eigthLine = " listening...";
|
eigthLine = " listening...";
|
||||||
espClient.write((iGateBeaconPacket + "\n").c_str());
|
espClient.write((iGateBeaconPacket + "\n").c_str());
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
|
||||||
} else if (stationMode==3 || stationMode==4) {
|
} else if (stationMode==3 || stationMode==4) {
|
||||||
|
fifthLine = "";
|
||||||
|
sixthLine = "";
|
||||||
seventhLine = "";
|
seventhLine = "";
|
||||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 0);
|
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 0);
|
||||||
eigthLine = " listening...";
|
eigthLine = " listening...";
|
||||||
|
|
@ -130,20 +140,42 @@ void validateDigiFreqs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void typeOfPacket(String packet) {
|
void typeOfPacket(String packet, String packetType) {
|
||||||
|
String sender;
|
||||||
if (stationMode==1 || stationMode==2) {
|
if (stationMode==1 || stationMode==2) {
|
||||||
seventhLine = "Callsign = " + packet.substring(0,packet.indexOf(">"));
|
if (packetType == "LoRa-APRS") {
|
||||||
|
sixthLine = "LoRa Rx ----> APRS-IS";
|
||||||
|
} else if (packetType == "APRS-LoRa") {
|
||||||
|
sixthLine = "APRS-IS ----> LoRa Tx";
|
||||||
|
}
|
||||||
|
sender = packet.substring(0,packet.indexOf(">"));
|
||||||
} else {
|
} else {
|
||||||
seventhLine = "Callsign = " + packet.substring(3,packet.indexOf(">"));
|
sixthLine = "LoRa Rx ----> LoRa Tx";
|
||||||
|
sender = packet.substring(3,packet.indexOf(">"));
|
||||||
|
}
|
||||||
|
for (int i=sender.length();i<9;i++) {
|
||||||
|
sender += " ";
|
||||||
}
|
}
|
||||||
if (packet.indexOf("::") >= 10) {
|
if (packet.indexOf("::") >= 10) {
|
||||||
eigthLine = "TYPE ----> MESSAGE";
|
if (packetType == "APRS-LoRa") {
|
||||||
|
String addresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
||||||
|
String addressee = addresseeAndMessage.substring(0, addresseeAndMessage.indexOf(":"));
|
||||||
|
addressee.trim();
|
||||||
|
seventhLine = sender + " > " + addressee;
|
||||||
|
Serial.println("mensaje desde " + seventhLine);
|
||||||
|
} else {
|
||||||
|
seventhLine = sender + "> MESSAGE";
|
||||||
|
}
|
||||||
|
eigthLine = "RSSI: 38dBm SNR: 6dBm";
|
||||||
} else if (packet.indexOf(":>") >= 10) {
|
} else if (packet.indexOf(":>") >= 10) {
|
||||||
eigthLine = "TYPE ----> NEW STATUS";
|
seventhLine = sender + "> NEW STATUS";
|
||||||
|
eigthLine = "RSSI: 38dBm SNR: 6dBm";
|
||||||
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
|
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
|
||||||
eigthLine = "TYPE ----> GPS BEACON";
|
seventhLine = sender + "> GPS BEACON";
|
||||||
|
eigthLine = "RSSI:38dBm D: 25.6km";
|
||||||
} else {
|
} else {
|
||||||
eigthLine = "TYPE ----> ??????????";
|
seventhLine = sender + "> ??????????";
|
||||||
|
eigthLine = "RSSI: 38dBm SNR: 6dBm";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ void setupDiplay();
|
||||||
void checkBeaconInterval();
|
void checkBeaconInterval();
|
||||||
void checkDisplayInterval();
|
void checkDisplayInterval();
|
||||||
void validateDigiFreqs();
|
void validateDigiFreqs();
|
||||||
void typeOfPacket(String packet);
|
void typeOfPacket(String packet, String packetType);
|
||||||
void startOTAServer();
|
void startOTAServer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ void startWiFi() {
|
||||||
digitalWrite(greenLed,LOW);
|
digitalWrite(greenLed,LOW);
|
||||||
Serial.print("Connected as ");
|
Serial.print("Connected as ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
show_display("", "", " Connected!!", "" , " loading programs...", 1000);
|
show_display("", "", " Connected!!", "" , " loading ...", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue