ready for testing

This commit is contained in:
richonguzman
2023-06-19 19:44:55 -04:00
parent d0eccf3e5f
commit af0626de82
4 changed files with 30 additions and 10 deletions
+2 -2
View File
@@ -6,8 +6,8 @@
"AP": [
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -33.0338131,
"longitude": -71.5737237
"latitude": -33.0468601,
"longitude": -71.6270988
},
{ "ssid": "Jimenita",
"password": "mg6wyMhqRnxk",
+5 -3
View File
@@ -5,6 +5,7 @@
extern Configuration Config;
extern WiFi_AP *currentWiFi;
extern int stationMode;
String distance;
namespace GPS_Utils {
@@ -113,8 +114,8 @@ String decodeEncodedGPS(String packet) {
int X3 = int(encodedLongtitude[2]);
int X4 = int(encodedLongtitude[3]);
float decodedLongitude = -180.0 + ((((X1-33) * pow(91,3)) + ((X2-33) * pow(91,2)) + ((X3-33) * 91) + X4-33) / 190463.0);
return String(decodedLatitude) + "N / " + String(decodedLongitude) + "E / " + String(calculateDistanceTo(decodedLatitude, decodedLongitude)) + "km";
distance = String(calculateDistanceTo(decodedLatitude, decodedLongitude),1);
return String(decodedLatitude) + "N / " + String(decodedLongitude) + "E / " + distance + "km";
}
String getReceivedGPS(String packet) {
@@ -145,7 +146,8 @@ String getReceivedGPS(String packet) {
if (LngSign == "W") {
convertedLongitude = -convertedLongitude;
}
return String(convertedLatitude) + "N / " + String(convertedLongitude) + "E / " + String(calculateDistanceTo(convertedLatitude, convertedLongitude)) + "km";
distance = String(calculateDistanceTo(convertedLatitude, convertedLongitude),1);
return String(convertedLatitude) + "N / " + String(convertedLongitude) + "E / " + distance + "km";
}
String getDistance(String packet) {
+7 -1
View File
@@ -7,6 +7,9 @@
extern Configuration Config;
extern int stationMode;
int rssi, freqError;
float snr;
namespace LoRa_Utils {
void setup() {
@@ -67,8 +70,11 @@ String receivePacket() {
int inChar = LoRa.read();
loraPacket += (char)inChar;
}
rssi = LoRa.packetRssi();
snr = LoRa.packetSnr();
freqError = LoRa.packetFrequencyError();
if (Config.syslog.active && (stationMode==1 || stationMode==2)) {
SYSLOG_Utils::log("LoRa Rx", loraPacket, LoRa.packetRssi(), LoRa.packetSnr(), LoRa.packetFrequencyError());
SYSLOG_Utils::log("LoRa Rx", loraPacket, rssi, snr, freqError);
}
}
return loraPacket;
+16 -4
View File
@@ -9,6 +9,7 @@
#include "pins_config.h"
#include "wifi_utils.h"
#include "lora_utils.h"
#include "gps_utils.h"
#include "bme_utils.h"
#include "display.h"
#include "utils.h"
@@ -33,6 +34,10 @@ extern bool beacon_update;
extern int stationMode;
extern String iGateBeaconPacket;
extern std::vector<String> lastHeardStation;
extern int rssi;
extern float snr;
extern int freqError;
extern String distance;
namespace Utils {
@@ -185,16 +190,23 @@ void typeOfPacket(String packet, String packetType) {
} else {
sixthLine = sender + "> MESSAGE";
}
seventhLine = "RSSI: 38dBm SNR: 6dBm";
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
} else if (packet.indexOf(":>") >= 10) {
sixthLine = sender + "> NEW STATUS";
seventhLine = "RSSI: 38dBm SNR: 6dBm";
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
sixthLine = sender + "> GPS BEACON";
seventhLine = "RSSI:38dBm D: 25.6km";
GPS_Utils::getDistance(packet);
seventhLine = "RSSI:" + String(rssi) + "dBm ";
if (distance.indexOf(".") == 2) {
seventhLine += " ";
} else if (distance.indexOf(".") == 1) {
seventhLine += " ";
}
seventhLine += "D:" + distance + "km";
} else {
sixthLine = sender + "> ??????????";
seventhLine = "RSSI: 38dBm SNR: 6dBm";
seventhLine = "RSSI:" + String(rssi) + "dBm SNR: " + String(snr) + "dBm";
}
}