diff --git a/src/Lora_APRS_iGate_DIY.cpp b/src/Lora_APRS_iGate_DIY.cpp index aab2a46..8f3160b 100644 --- a/src/Lora_APRS_iGate_DIY.cpp +++ b/src/Lora_APRS_iGate_DIY.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,16 +5,8 @@ #include "pins_config.h" WiFiClient espClient; -int status = WL_IDLE_STATUS; uint32_t lastTxTime = 0; -#define txInterval 15 * 60 * 1000 -const String LAT = "3302.03S"; // por corregir // write your latitude -const String LON = "07134.42W"; //por corregir -const String IGATE = "CD2RXU-10"; -const String Mensaje_iGate = "DIY ESP32 - LoRa APRS iGATE"; - - void setup_lora() { Serial.println("Set LoRa pins!"); SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); @@ -38,6 +29,7 @@ void setup_lora() { } void setup_wifi() { + int status = WL_IDLE_STATUS; WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); @@ -119,8 +111,7 @@ void setup() { } void loop() { - String mensaje_recibido = ""; - String mensaje_beacon_estacion = IGATE + ">APLG01,TCPIP*,qAC,T2BRAZIL:=" + LAT + "L" + LON + "&" + Mensaje_iGate+ "\n"; // + String receivedPacket = ""; uint32_t lastTx = millis() - lastTxTime; bool beacon_update = true; @@ -128,18 +119,18 @@ void loop() { if (packetSize) { while (LoRa.available()) { int inChar = LoRa.read(); - mensaje_recibido += (char)inChar; + receivedPacket += (char)inChar; } - valida_y_procesa_packet(mensaje_recibido); //Serial.println("Mensaje Recibido : " + String(mensaje_recibido)); + valida_y_procesa_packet(receivedPacket); //Serial.println("Mensaje Recibido : " + String(receivedPacket)); } - if (lastTx >= txInterval) { + if (lastTx >= BeaconInterval) { beacon_update = true; } if (beacon_update) { Serial.println("enviando Beacon Estacion/iGate"); - connect_and_upload_to_APRS_IS(mensaje_beacon_estacion); + connect_and_upload_to_APRS_IS(iGateBeaconPacket); lastTxTime = millis(); beacon_update = false; } diff --git a/src/iGate_config.h b/src/iGate_config.h index 2fcad84..dd0289e 100644 --- a/src/iGate_config.h +++ b/src/iGate_config.h @@ -1,15 +1,23 @@ #ifndef IGATE_CONFIG_H_ #define IGATE_CONFIG_H_ -#include - #define WIFI_SSID "Richon" #define WIFI_PASSWORD "k4fPnmg5qnyf" +#define BeaconInterval 15*60*1000 // 15 minutes + String iGate_Callsign = "CD2RXU-10"; String passcode_igate = "23201"; +const String LAT = "3302.03S"; // por corregir // write your latitude +const String LON = "07134.42W"; //por corregir + +const String iGate_Comment = "DIY ESP32 - LoRa APRS iGATE"; + const String SERVER = "brazil.aprs2.net"; // write the address of the aprs server const int APRSPORT = 14579; // write the aprs server APRSPORT +String iGateBeaconPacket = iGate_Callsign + ">APLG01,TCPIP*,qAC,T2BRAZIL:=" + LAT + "L" + LON + "&" + iGate_Comment + "\n"; + + #endif \ No newline at end of file