stationMode digi plus igate Rx for now

This commit is contained in:
richonguzman 2023-09-21 02:08:10 -03:00
parent b0255ccbd9
commit 0f8f082ff7
5 changed files with 36 additions and 17 deletions

View File

@ -20,7 +20,7 @@
Configuration Config;
WiFiClient espClient;
String versionDate = "2023.09.20";
String versionDate = "2023.09.21";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];

View File

@ -1,12 +1,16 @@
#include <WiFi.h>
#include "configuration.h"
#include "station_utils.h"
#include "aprs_is_utils.h"
#include "lora_utils.h"
#include "digi_utils.h"
#include "wifi_utils.h"
#include "gps_utils.h"
#include "display.h"
#include "utils.h"
extern Configuration Config;
extern WiFiClient espClient;
extern int stationMode;
extern uint32_t lastScreenOn;
extern int lastStationModeState;
@ -31,14 +35,15 @@ namespace DIGI_Utils {
STATION_Utils::updateLastHeard(sender);
STATION_Utils::updatePacketBuffer(packet);
Utils::typeOfPacket(packet, "Digi");
if ((stationMode==3 || stationMode==5 || stationMode==6) && (packet.indexOf("WIDE1-1") > 10)) {
if ((stationMode==3 || stationMode==5 || stationMode==6) && (packet.indexOf("WIDE1-1") > 10)) { // ver lo de WIDE para sM=6
if (stationMode==6 && ((WiFi.status()==WL_CONNECTED) && espClient.connected())) {
espClient.write(APRS_IS_Utils::createPacket(packet).c_str());
Serial.print("(Uploaded to APRS-IS)");
}
loraPacket = packet.substring(3);
loraPacket.replace("WIDE1-1", Config.callsign + "*");
delay(500);
LoRa_Utils::sendNewPacket("APRS", loraPacket);
/*if (stationMode==6 && wifi ) {
subir a aprsis
}*/
display_toggle(true);
lastScreenOn = millis();
} else if (stationMode ==4){
@ -77,8 +82,14 @@ namespace DIGI_Utils {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
processPacket(LoRa_Utils::receivePacket());
} else if (stationMode==6) {
if (WiFi.status() != WL_CONNECTED) {
WIFI_Utils::startWiFi();
}
if (!espClient.connected()) {
APRS_IS_Utils::connect();
}
String Tx = String(Config.loramodule.digirepeaterTxFreq);
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
@ -86,7 +97,7 @@ namespace DIGI_Utils {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
processPacket(LoRa_Utils::receivePacket());
}
}

View File

@ -83,7 +83,11 @@ String generateBeacon() {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED && espClient.connected()) || stationMode==6) {
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
beaconPacket = Config.callsign + ">APLRG1,qAC:=" + stationLatitude + "L" + stationLongitude;
beaconPacket = Config.callsign + ">APLRG1,WIDE1-1";
if (stationMode!=6) {
beaconPacket += ",qAC";
}
beaconPacket += ":=" + stationLatitude + "L" + stationLongitude;
if (stationMode == 1) {
beaconPacket += "&";
} else {
@ -98,7 +102,7 @@ String generateBeacon() {
stationLatitude = processLatitudeAPRS(Config.digi.latitude);
stationLongitude = processLongitudeAPRS(Config.digi.longitude);
}
beaconPacket = Config.callsign + ">APLRG1:=" + stationLatitude + "L" + stationLongitude + "#" + Config.digi.comment;
beaconPacket = Config.callsign + ">APLRG1,WIDE1-1:=" + stationLatitude + "L" + stationLongitude + "#" + Config.digi.comment;
}
return beaconPacket;
}

View File

@ -54,10 +54,10 @@ void notFound(AsyncWebServerRequest *request) {
void processStatus() {
String status = Config.callsign + ">APLRG1";
String status = Config.callsign + ">APLRG1,WIDE1-1";
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
delay(1000);
status += ",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate ;
status += ",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate " + versionDate;
espClient.write((status + "\n").c_str());
SYSLOG_Utils::log("APRSIS Tx", status,0,0,0);
} else {
@ -208,8 +208,10 @@ void checkBeaconInterval() {
}
seventhLine = " listening...";
/*si hay wifi
envia beacon por wifi*/
if (stationMode==6 && ((WiFi.status()==WL_CONNECTED) && espClient.connected())) {
espClient.write((beaconPacket + "\n").c_str());
Serial.println("---> Uploaded to APRS-IS");
}
LoRa_Utils::sendNewPacket("APRS", beaconPacket);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
}

View File

@ -26,9 +26,11 @@ void checkWiFi() {
void startWiFi() {
int wifiCounter = 0;
int status = WL_IDLE_STATUS;
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(500);
if (stationMode != 6) {
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(500);
}
unsigned long start = millis();
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
@ -43,7 +45,7 @@ void startWiFi() {
delay(1000);
if(myWiFiAPIndex >= (myWiFiAPSize-1)) {
myWiFiAPIndex = 0;
if (stationMode==5) {
if (stationMode==5 || stationMode==6) {
wifiCounter++;
}
} else {