mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-02-01 21:34:38 +01:00
beta1
This commit is contained in:
parent
6a99256836
commit
d3d25cc3f2
|
|
@ -14,6 +14,5 @@ board = esp32dev
|
|||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
lib_deps =
|
||||
sandeepmistry/LoRa@^0.8.0
|
||||
platform_packages =
|
||||
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
WiFiClient espClient;
|
||||
uint32_t lastTxTime = 0;
|
||||
static bool beacon_update = true;
|
||||
|
||||
void setup_wifi() {
|
||||
int status = WL_IDLE_STATUS;
|
||||
|
|
@ -20,79 +21,30 @@ void setup_wifi() {
|
|||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void connect_and_upload_to_APRS_IS(String packet) {
|
||||
int count = 0;
|
||||
String aprsauth;
|
||||
Serial.println("Conectando a APRS-IS");
|
||||
while (!espClient.connect(SERVER.c_str(), APRSPORT) && count < 20) {
|
||||
Serial.println("Didn't connect with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
delay(1000);
|
||||
espClient.stop();
|
||||
espClient.flush();
|
||||
Serial.println("Run client.stop");
|
||||
Serial.println("Trying to connect with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
count++;
|
||||
Serial.println("Try: " + String(count));
|
||||
}
|
||||
if (count == 20) {
|
||||
Serial.println("Tried: " + String(count) + " don't send the packet!");
|
||||
} else {
|
||||
Serial.println("Connected with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
while (espClient.connected()) {
|
||||
delay(200);
|
||||
aprsauth = "user " + iGate_Callsign + " pass " + passcode_igate + "\n"; //info igate
|
||||
espClient.write(aprsauth.c_str()); //Serial.println("Run client.connected()");
|
||||
delay(200);
|
||||
espClient.write(packet.c_str()); //Serial.println("Send client.write=" + aprsauth);
|
||||
delay(200); //Serial.println("Send espClient.write = " + packet_para_APRS_IS);
|
||||
Serial.println("Packet uploaded =)\n");
|
||||
espClient.stop();
|
||||
espClient.flush(); //Serial.println("(Telnet client disconnect)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void procesa_y_sube_APRS_IS(String mensaje) {
|
||||
String packet_para_APRS_IS = "";
|
||||
String callsign_y_path_tracker = "";
|
||||
String payload_tracker;
|
||||
|
||||
int posicion_dos_puntos = mensaje.indexOf(':');
|
||||
callsign_y_path_tracker = mensaje.substring(3, posicion_dos_puntos);
|
||||
payload_tracker = mensaje.substring(posicion_dos_puntos);
|
||||
packet_para_APRS_IS = callsign_y_path_tracker + ",qAO," + iGate_Callsign + payload_tracker + "\n";
|
||||
//Serial.print("Mensaje APRS_IS : "); Serial.println(packet_para_APRS_IS);
|
||||
//packet = "CD2RXU-9>APLT00,qAO,CD2RXU-10:=" + LAT + "/" + LON + ">" + "\n"; // ejemplo!!!
|
||||
connect_and_upload_to_APRS_IS(packet_para_APRS_IS);
|
||||
}
|
||||
|
||||
void APRS_connect(){
|
||||
int count = 0;
|
||||
String aprsauth;
|
||||
Serial.println("Conectando a APRS-IS");
|
||||
while (!espClient.connect(SERVER.c_str(), APRSPORT) && count < 20) {
|
||||
Serial.println("Didn't connect with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
while (!espClient.connect(AprsServer.c_str(), AprsServerPort) && count < 20) {
|
||||
Serial.println("Didn't connect with server...");
|
||||
delay(1000);
|
||||
espClient.stop();
|
||||
espClient.flush();
|
||||
Serial.println("Run client.stop");
|
||||
Serial.println("Trying to connect with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
Serial.println("Trying to connect with Server: " + String(AprsServer) + " AprsServerPort: " + String(AprsServerPort));
|
||||
count++;
|
||||
Serial.println("Try: " + String(count));
|
||||
}
|
||||
if (count == 20) {
|
||||
Serial.println("Tried: " + String(count) + " don't send the packet!");
|
||||
Serial.println("Tried: " + String(count) + " FAILED!");
|
||||
} else {
|
||||
Serial.println("Connected with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||
|
||||
//aprsauth = "user " + iGate_Callsign + " pass " + passcode_igate + " vers " + "ESP32_TEST" + " " + "0.2" + " filter " + "r/-33.034/-70.573/50 t/ms" + "\n\r"; //info igate
|
||||
aprsauth = "user " + iGate_Callsign + " pass " + passcode_igate + " vers " + "ESP32_TEST" + " " + "0.2" + " filter " + "t/poms/CD2RXU-10/50" + "\n\r"; //info igate
|
||||
Serial.println("Connected with Server: " + String(AprsServer) + " Port: " + String(AprsServerPort));
|
||||
aprsauth = "user " + WeatherReportCallsign + " pass " + WeatherReportPasscode + " vers " + AprsSoftwareName + " " + AprsSoftwareVersion + " filter " + AprsFilter + "\n\r";
|
||||
espClient.write(aprsauth.c_str());
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APRS_IS_READ(){
|
||||
String aprsisData;
|
||||
while (espClient.connected()) {
|
||||
|
|
@ -107,27 +59,26 @@ void APRS_IS_READ(){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
setup_wifi();
|
||||
btStop();
|
||||
Serial.println("Starting iGate\n");
|
||||
Serial.println("Starting Weather Report APRS\n");
|
||||
APRS_connect();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
APRS_IS_READ();
|
||||
|
||||
/*uint32_t lastTx = millis() - lastTxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
if (lastTx >= BeaconInterval) {
|
||||
beacon_update = true;
|
||||
}
|
||||
|
||||
if (beacon_update) {
|
||||
Serial.println("enviando Beacon Estacion/iGate");
|
||||
connect_and_upload_to_APRS_IS(iGateBeaconPacket);
|
||||
espClient.write(WeatherReportBeaconPacket.c_str());
|
||||
lastTxTime = millis();
|
||||
beacon_update = false;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
24
src/config.h
24
src/config.h
|
|
@ -8,21 +8,19 @@
|
|||
|
||||
#define BeaconInterval 900000 // 15 minutes = 900000 seg
|
||||
|
||||
String iGate_Callsign = "CD2RXU-11";
|
||||
String passcode_igate = "23201";
|
||||
const String WeatherReportCallsign = "CD2RXU-11";
|
||||
const String WeatherReportPasscode = "23201";
|
||||
const String AprsServer = "radioaficion.pro"; // write the address of the aprs server //const String SERVER = "brazil.aprs2.net";
|
||||
const int AprsServerPort = 14580; // 14579 port is allready filtered so use 14580
|
||||
const String AprsSoftwareName = "ESP32_TEST";
|
||||
const String AprsSoftwareVersion = "0.1.0";
|
||||
const String AprsFilter = "t/poms/CD2RXU-10/50";
|
||||
|
||||
const String LAT = "3302.03S"; // por corregir // write your latitude
|
||||
const String LON = "07134.42W"; //por corregir
|
||||
const String WeatherReportComment = "LoRa APRS Weather Report https://github.com/richonguzman/ESP32_APRS_Weather_Report";
|
||||
|
||||
const String iGate_Comment = "DIY ESP32 - LoRa APRS iGATE https://github.com/richonguzman/LoRa_APRS_iGate";
|
||||
|
||||
const String SERVER = "radioaficion.pro"; // write the address of the aprs server //const String SERVER = "brazil.aprs2.net";
|
||||
const int APRSPORT = 14580; // write the aprs server APRSPORT
|
||||
// 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";
|
||||
const String LAT = "3302.03S"; // por corregir // write your latitude
|
||||
const String LON = "07134.42W"; //por corregir
|
||||
|
||||
String WeatherReportBeaconPacket = WeatherReportCallsign + ">APLG01,TCPIP*,qAC,CHILE:=" + LAT + "L" + LON + "&" + WeatherReportComment + "\n";
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue