diff --git a/README.md b/README.md new file mode 100644 index 0000000..f377f40 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ESP32_APRS_Weather_Report +ESP32 as a Weather Report for APRS diff --git a/src/Lora_APRS_iGate_DIY.cpp b/src/ESP32_APRS_Weather_Report.cpp similarity index 72% rename from src/Lora_APRS_iGate_DIY.cpp rename to src/ESP32_APRS_Weather_Report.cpp index 32b27d0..880de08 100644 --- a/src/Lora_APRS_iGate_DIY.cpp +++ b/src/ESP32_APRS_Weather_Report.cpp @@ -1,34 +1,10 @@ #include -#include -#include #include -#include "iGate_config.h" -#include "pins_config.h" +#include "config.h" WiFiClient espClient; uint32_t lastTxTime = 0; -void setup_lora() { - Serial.println("Set LoRa pins!"); - SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); - LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ); - - long freq = 433775000; - Serial.print("frequency: "); - Serial.println(String(freq)); - if (!LoRa.begin(freq)) { - Serial.println("Starting LoRa failed!"); - while (true) { - } - } - LoRa.setSpreadingFactor(12); - LoRa.setSignalBandwidth(125000); - LoRa.setCodingRate4(5); - LoRa.enableCrc(); - LoRa.setTxPower(20); - Serial.println("LoRa init done!\n"); -} - void setup_wifi() { int status = WL_IDLE_STATUS; WiFi.mode(WIFI_STA); @@ -90,28 +66,6 @@ void procesa_y_sube_APRS_IS(String mensaje) { connect_and_upload_to_APRS_IS(packet_para_APRS_IS); } -void valida_y_procesa_packet(String mensaje) { - String packetStart = ""; - String packetStart2 = ""; - Serial.print("MENSAJE RECIBIDO!!! "); - Serial.print("(Validando inicio ---> "); - packetStart = mensaje.substring(0, 3); - packetStart2 = mensaje.substring(0, 4); - if (packetStart == "\x3c\xff\x01") { - Serial.println("Packet Valido)"); - procesa_y_sube_APRS_IS(mensaje); - }else if (packetStart2 == "\x77\x63\x6c\x70") { - LoRa.beginPacket(); - LoRa.print("Weather Response from iGate"); - LoRa.endPacket(); - Serial.println("Enviando Respuesta LoRa a Tracker"); - } else { - Serial.println("Packet NO Valido)"); - } -} - - - void APRS_connect(){ int count = 0; String aprsauth; @@ -158,7 +112,6 @@ void setup() { Serial.begin(115200); setup_wifi(); btStop(); - //setup_lora(); Serial.println("Starting iGate\n"); APRS_connect(); } @@ -166,19 +119,7 @@ void setup() { void loop() { APRS_IS_READ(); - /*String receivedPacket = ""; - static bool beacon_update = true; - - int packetSize = LoRa.parsePacket(); - if (packetSize) { - while (LoRa.available()) { - int inChar = LoRa.read(); - receivedPacket += (char)inChar; - } - valida_y_procesa_packet(receivedPacket); //Serial.println("Mensaje Recibido : " + String(receivedPacket)); - }; - - uint32_t lastTx = millis() - lastTxTime; + /*uint32_t lastTx = millis() - lastTxTime; if (lastTx >= BeaconInterval) { beacon_update = true; } diff --git a/src/iGate_config.h b/src/config.h similarity index 87% rename from src/iGate_config.h rename to src/config.h index 32ff305..9cb9547 100644 --- a/src/iGate_config.h +++ b/src/config.h @@ -21,8 +21,8 @@ const int APRSPORT = 14580; // write the aprs server APRSPOR // 14579 port is allready filtered -String iGateBeaconPacket = iGate_Callsign + ">APLG01,TCPIP*,qAC,T2BRAZIL:=" + LAT + "L" + LON + "&" + iGate_Comment + "\n"; -//String iGateBeaconPacket = iGate_Callsign + ">APLG01,TCPIP*,qAC,CHILE:=" + LAT + "L" + LON + "&" + iGate_Comment + "\n"; +//String iGateBeaconPacket = iGate_Callsign + ">APLG01,TCPIP*,qAC,T2BRAZIL:=" + LAT + "L" + LON + "&" + iGate_Comment + "\n"; +String iGateBeaconPacket = iGate_Callsign + ">APLG01,TCPIP*,qAC,CHILE:=" + LAT + "L" + LON + "&" + iGate_Comment + "\n"; #endif \ No newline at end of file