mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-20 12:15:21 +01:00
test1
This commit is contained in:
parent
e433e375e5
commit
b7ba17d871
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"callsign": "CD2RXU-11",
|
||||
"stationMode": 4,
|
||||
"stationMode": 2,
|
||||
"iGateComment": "LoRa_APRS_iGate",
|
||||
"wifi": {
|
||||
"AP": [
|
||||
|
|
|
|||
|
|
@ -21,5 +21,4 @@ lib_deps =
|
|||
ayushsharma82/AsyncElegantOTA@^2.2.7
|
||||
ottowinter/ESPAsyncWebServer-esphome@^3.0.0
|
||||
esphome/AsyncTCP-esphome@^2.0.0
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
peterus/esp-logger @ 1.0.0
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
|
|
@ -13,16 +13,13 @@
|
|||
#include "digi_utils.h"
|
||||
#include "gps_utils.h"
|
||||
#include "display.h"
|
||||
#include "logger.h"
|
||||
#include "utils.h"
|
||||
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
logging::Logger logger;
|
||||
|
||||
|
||||
String versionDate = "2023.06.12";
|
||||
String versionDate = "2023.06.13";
|
||||
int myWiFiAPIndex = 0;
|
||||
int myWiFiAPSize = Config.wifiAPs.size();
|
||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
|
|
@ -39,8 +36,6 @@ std::vector<String> lastHeardStation_temp;
|
|||
|
||||
String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket;
|
||||
|
||||
// agregar automatic restart cada X horas?
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
pinMode(greenLed, OUTPUT);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ void sendNewPacket(const String &typeOfMessage, const String &newPacket) {
|
|||
LoRa.write((const uint8_t *)newPacket.c_str(), newPacket.length());
|
||||
LoRa.endPacket();
|
||||
digitalWrite(greenLed,LOW);
|
||||
SYSLOG_Utils::log("LoRa Tx", newPacket,0,0,0);
|
||||
Serial.print("---> LoRa Packet Tx : ");
|
||||
Serial.println(newPacket);
|
||||
}
|
||||
|
|
@ -67,7 +68,7 @@ String receivePacket() {
|
|||
loraPacket += (char)inChar;
|
||||
}
|
||||
if (Config.syslog.active && (stationMode==1 || stationMode==2)) {
|
||||
SYSLOG_Utils::processPacket(loraPacket, LoRa.packetRssi(), LoRa.packetSnr(), LoRa.packetFrequencyError());
|
||||
SYSLOG_Utils::log("LoRa Rx", loraPacket, LoRa.packetRssi(), LoRa.packetSnr(), LoRa.packetFrequencyError());
|
||||
}
|
||||
}
|
||||
return loraPacket;
|
||||
|
|
|
|||
|
|
@ -1,31 +1,58 @@
|
|||
#include <WiFiUdp.h>
|
||||
#include <WiFi.h>
|
||||
#include "configuration.h"
|
||||
#include "syslog_utils.h"
|
||||
#include "gps_utils.h"
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
extern Configuration Config;
|
||||
extern logging::Logger logger;
|
||||
extern int stationMode;
|
||||
|
||||
WiFiUDP udpClient;
|
||||
|
||||
namespace SYSLOG_Utils {
|
||||
|
||||
void processPacket(String packet, int rssi, float snr, int freqError) {
|
||||
String syslogPacket;
|
||||
syslogPacket = packet.substring(3,packet.indexOf(">")) + " / TIME / ";
|
||||
syslogPacket += packet.substring(packet.indexOf(">")+1,packet.indexOf(",")) + " / ";
|
||||
if (packet.indexOf("WIDE1-1") > 10) {
|
||||
syslogPacket += "WIDE1-1 / ";
|
||||
} else {
|
||||
syslogPacket += " _ / ";
|
||||
void log(String type, String packet, int rssi, float snr, int freqError) {
|
||||
String syslogPacket = "ESP32 LoRa [APRS] - ";
|
||||
if (Config.syslog.active && (stationMode==1 || stationMode==2)) {
|
||||
if (type == "APRSIS Tx") {
|
||||
if (packet.indexOf(":>") > 10) {
|
||||
syslogPacket += type + " - StartUp STATUS - " + packet.substring(packet.indexOf(":>")+2);
|
||||
}
|
||||
} else if (type == "LoRa Rx") {
|
||||
if (packet.indexOf("::") > 10) {
|
||||
syslogPacket += type + " - MESSAGE - " + packet.substring(3,packet.indexOf(">")) + " ---> " + packet.substring(packet.indexOf("::")+2);
|
||||
} else if (packet.indexOf(":!") > 10 || packet.indexOf(":=") > 10) {
|
||||
syslogPacket += type + " - GPS - " + packet.substring(3,packet.indexOf(">")) + " / " + packet.substring(packet.indexOf(">")+1,packet.indexOf(",")) + " / ";
|
||||
if (packet.indexOf("WIDE1-1") > 10) {
|
||||
syslogPacket += "WIDE1-1 / ";
|
||||
} else {
|
||||
syslogPacket += "_ / ";
|
||||
}
|
||||
syslogPacket += String(rssi) + "dBm / " + String(snr) + "dB / " + String(freqError) + "Hz / " + GPS_Utils::getDistance(packet);
|
||||
} else {
|
||||
syslogPacket += type + " - " + packet;
|
||||
}
|
||||
} else if (type == "LoRa Tx") {
|
||||
if (packet.indexOf("RFONLY") > 10) {
|
||||
syslogPacket += type + " - RFONLY - " + packet.substring(packet.indexOf("::")+2);
|
||||
} else if (packet.indexOf("::") > 10) {
|
||||
syslogPacket += type + " - MESSAGE - " + packet.substring(0,packet.indexOf(">")) + " ---> " + packet.substring(packet.indexOf("::")+2);
|
||||
} else {
|
||||
syslogPacket += type + " - " + packet;
|
||||
}
|
||||
} else {
|
||||
syslogPacket = "ERROR - Error in Syslog Packet";
|
||||
}
|
||||
udpClient.beginPacket(Config.syslog.server.c_str(), Config.syslog.port);
|
||||
udpClient.write((const uint8_t*)syslogPacket.c_str(), syslogPacket.length());
|
||||
udpClient.endPacket();
|
||||
}
|
||||
syslogPacket += String(rssi) + "dBm / " + String(snr) + "dB / " + String(freqError) + "Hz / ";
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", (syslogPacket + GPS_Utils::getDistance(packet)).c_str());
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
||||
// ver hostname "ESP32 LoRa APRS iGate" ?
|
||||
if (Config.syslog.active) {
|
||||
logger.setSyslogServer(Config.syslog.server, Config.syslog.port, "ESP32 LoRa APRS iGate");
|
||||
if (Config.syslog.active && (stationMode==1 || stationMode==2)) {
|
||||
udpClient.begin(WiFi.localIP(), 0);
|
||||
Serial.println("Syslog Server (" + Config.syslog.server + ") connected!\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace SYSLOG_Utils {
|
||||
|
||||
void processPacket(String packet, int rssi, float snr, int freqError) ;
|
||||
void log(String type ,String packet, int rssi, float snr, int freqError);
|
||||
void setup();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <SPIFFS.h>
|
||||
#include <WiFi.h>
|
||||
#include "configuration.h"
|
||||
#include "syslog_utils.h"
|
||||
#include "pins_config.h"
|
||||
#include "wifi_utils.h"
|
||||
#include "lora_utils.h"
|
||||
|
|
@ -34,7 +35,8 @@ void processStatus() {
|
|||
if (stationMode==1 || stationMode==2) {
|
||||
delay(1000);
|
||||
status += ",qAC:>https://github.com/richonguzman/LoRa_APRS_iGate";
|
||||
espClient.write((status + "\n").c_str());
|
||||
espClient.write((status + "\n").c_str());
|
||||
SYSLOG_Utils::log("APRSIS Tx", status,0,0,0);
|
||||
} else {
|
||||
delay(5000);
|
||||
status += ":>https://github.com/richonguzman/LoRa_APRS_iGate";
|
||||
|
|
|
|||
Loading…
Reference in a new issue