mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-02-02 22:04:17 +01:00
aprs is utils
This commit is contained in:
parent
2aee9f582d
commit
1ffe42f45d
|
|
@ -11,6 +11,7 @@
|
|||
#include "display.h"
|
||||
#include "lora_utils.h"
|
||||
#include "wifi_utils.h"
|
||||
#include "aprs_is_utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
/*#include <AsyncTCP.h>
|
||||
|
|
@ -39,7 +40,7 @@ std::vector<String> lastHeardStation_temp;
|
|||
|
||||
String firstLine, secondLine, thirdLine, fourthLine, iGateLatitude, iGateLongitude;
|
||||
|
||||
void APRS_IS_connect(){
|
||||
/*void APRS_IS_connect(){
|
||||
int count = 0;
|
||||
String aprsauth;
|
||||
Serial.println("Connecting to APRS-IS ...");
|
||||
|
|
@ -61,7 +62,7 @@ void APRS_IS_connect(){
|
|||
espClient.write(aprsauth.c_str());
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
String createAPRSPacket(String unprocessedPacket) {
|
||||
String callsign_and_path_tracker, payload_tracker, processedPacket;
|
||||
|
|
@ -308,7 +309,6 @@ void setup() {
|
|||
Serial.println("\nStarting iGate: " + Config.callsign + " Version: " + String(VERSION));
|
||||
show_display(" LoRa APRS iGate", " Richonguzman", " -- CD2RXU --", " " VERSION, 4000);
|
||||
WIFI_Utils::setup();
|
||||
//setup_wifi();
|
||||
btStop();
|
||||
|
||||
/*server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||
|
|
@ -341,7 +341,7 @@ void loop() {
|
|||
}
|
||||
|
||||
if (!espClient.connected()) {
|
||||
APRS_IS_connect();
|
||||
APRS_IS_Utils::connect();
|
||||
}
|
||||
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
|
|
|
|||
44
src/aprs_is_utils.cpp
Normal file
44
src/aprs_is_utils.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "aprs_is_utils.h"
|
||||
#include <WiFi.h>
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern WiFiClient espClient;
|
||||
extern int internalLedPin;
|
||||
|
||||
namespace APRS_IS_Utils {
|
||||
|
||||
void connect(){
|
||||
int count = 0;
|
||||
String aprsauth;
|
||||
Serial.println("Connecting to APRS-IS ...");
|
||||
while (!espClient.connect(Config.aprs_is.server.c_str(), Config.aprs_is.port) && 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(Config.aprs_is.server) + " AprsServerPort: " + String(Config.aprs_is.port));
|
||||
count++;
|
||||
Serial.println("Try: " + String(count));
|
||||
}
|
||||
if (count == 20) {
|
||||
Serial.println("Tried: " + String(count) + " FAILED!");
|
||||
} else {
|
||||
Serial.println("Connected with Server: " + String(Config.aprs_is.server) + " Port: " + String(Config.aprs_is.port));
|
||||
aprsauth = "user " + Config.callsign + " pass " + Config.aprs_is.passcode + " vers " + Config.aprs_is.softwareName + " " + Config.aprs_is.softwareVersion + " filter t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance + "\n\r";
|
||||
espClient.write(aprsauth.c_str());
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
||||
/*void processSplitedMessage(String addressee, String message1, String message2) {
|
||||
espClient.write((Config.callsign + ">APRS,qAC::" + addressee + ":" + message1 + "\n").c_str());
|
||||
Serial.println("-------> " + message1);
|
||||
Serial.println("(waiting for second part)");
|
||||
delay(5000);
|
||||
espClient.write((Config.callsign + ">APRS,qAC::" + addressee + ":" + message2 + "\n").c_str());
|
||||
Serial.println("-------> " + message2);
|
||||
}*/
|
||||
|
||||
}
|
||||
13
src/aprs_is_utils.h
Normal file
13
src/aprs_is_utils.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef APRS_IS_UTILS_H_
|
||||
#define APRS_IS_UTILS_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
namespace APRS_IS_Utils {
|
||||
|
||||
void connect();
|
||||
//void processSplitedMessage(String addressee, String message1, String message2);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue