diff --git a/data_embed/index.html b/data_embed/index.html
index e39621c..8de16f5 100644
--- a/data_embed/index.html
+++ b/data_embed/index.html
@@ -345,9 +345,7 @@
WiFi Access
Add all Wi-Fi Networks intended to be used,
- and their respective coordinates to
- georeference the iGate location.Add all Wi-Fi Networks intended to be used.
diff --git a/platformio.ini b/platformio.ini
index 07e3162..bf8942e 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,6 +13,7 @@ default_envs = ttgo-lora32-v21
[env]
platform = espressif32 @ 6.3.1
+board_build.partitions = min_spiffs.csv
framework = arduino
monitor_speed = 115200
board_build.embed_files =
diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp
index 1163af5..a89f73b 100644
--- a/src/LoRa_APRS_iGate.cpp
+++ b/src/LoRa_APRS_iGate.cpp
@@ -37,41 +37,31 @@ ________________________________________________________________________________
#include "A7670_utils.h"
#endif
-
+String versionDate = "2024.05.14";
Configuration Config;
WiFiClient espClient;
-
-String versionDate = "2024.05.13";
uint8_t myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
bool isUpdatingOTA = false;
-bool statusAfterBoot = true;
-bool beaconUpdate = true;
-uint32_t lastBeaconTx = 0;
uint32_t previousWiFiMillis = 0;
uint32_t lastScreenOn = millis();
uint32_t lastWiFiCheck = 0;
bool WiFiConnect = true;
bool WiFiConnected = false;
-
bool WiFiAutoAPStarted = false;
long WiFiAutoAPTime = false;
uint32_t lastBatteryCheck = 0;
-
String batteryVoltage;
-uint32_t lastTxTime = millis();
-uint32_t lastRxTime = millis();
-
std::vector receivedPackets;
bool modemLoggedToAPRSIS = false;
-String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, iGateBeaconPacket, iGateLoRaBeaconPacket;
+String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine;
//#define STARTUP_DELAY 5 //min
@@ -82,8 +72,7 @@ void setup() {
Config.check();
LoRa_Utils::setup();
Utils::validateFreqs();
- iGateBeaconPacket = GPS_Utils::generateBeacon();
- iGateLoRaBeaconPacket = GPS_Utils::generateiGateLoRaBeacon();
+ GPS_Utils::generateBeacons();
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
show_display("", " STARTUP DELAY ...", "", "", 0);
diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp
index a1f9109..44aed21 100644
--- a/src/aprs_is_utils.cpp
+++ b/src/aprs_is_utils.cpp
@@ -19,12 +19,10 @@ extern String fourthLine;
extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
-
-extern std::vector outputPacketBuffer;
-extern uint32_t lastRxTime;
-
extern bool modemLoggedToAPRSIS;
+uint32_t lastRxTime = millis();
+
#ifdef ESP32_DIY_LoRa_A7670
extern bool stationBeacon;
#endif
diff --git a/src/bme_utils.cpp b/src/bme_utils.cpp
index f1117d1..395f111 100644
--- a/src/bme_utils.cpp
+++ b/src/bme_utils.cpp
@@ -6,14 +6,15 @@
#define SEALEVELPRESSURE_HPA (1013.25)
#define CORRECTION_FACTOR (8.2296) // for meters
-extern Configuration Config;
-extern String fifthLine;
-
-float newHum, newTemp, newPress, newGas;
+extern Configuration Config;
+extern String fifthLine;
int wxModuleType = 0;
uint8_t wxModuleAddress = 0x00;
+float newHum, newTemp, newPress, newGas;
+
+
Adafruit_BME280 bme280;
Adafruit_BME680 bme680;
#ifdef HELTEC_V3_GPS
@@ -23,7 +24,6 @@ Adafruit_BMP280 bmp280;
#endif
-
namespace BME_Utils {
void getWxModuleAddres() {
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 83ff0d4..0a82972 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -3,6 +3,7 @@
#include "configuration.h"
#include "display.h"
+
void Configuration::check() {
if (reload) {
show_display("------- UPDATE ------", "config is old", "device will update", "and then reboot", 1000);
diff --git a/src/digi_utils.cpp b/src/digi_utils.cpp
index f6a4a64..e891f92 100644
--- a/src/digi_utils.cpp
+++ b/src/digi_utils.cpp
@@ -20,8 +20,6 @@ extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
-extern std::vector outputPacketBuffer;
-
namespace DIGI_Utils {
diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp
index bd74a57..0494821 100644
--- a/src/gps_utils.cpp
+++ b/src/gps_utils.cpp
@@ -5,7 +5,7 @@
extern Configuration Config;
extern WiFiClient espClient;
-String distance;
+String distance, iGateBeaconPacket, iGateLoRaBeaconPacket;
namespace GPS_Utils {
@@ -47,17 +47,14 @@ namespace GPS_Utils {
return encodedData;
}
- String generateBeacon() {
- String beaconPacket = Config.callsign + ">APLRG1," + Config.beacon.path;
-
- if (Config.aprs_is.active && Config.digi.mode == 0) { // If APRSIS enabled and Digi disabled
- beaconPacket += ",qAC";
- }
- return beaconPacket + ":!" + encodeGPS(Config.beacon.latitude, Config.beacon.longitude, Config.beacon.overlay, Config.beacon.symbol);;
- }
-
- String generateiGateLoRaBeacon() {
- return Config.callsign + ">APLRG1," + Config.beacon.path + ":!" + encodeGPS(Config.beacon.latitude, Config.beacon.longitude, Config.beacon.overlay, Config.beacon.symbol);
+ void generateBeacons() {
+ String beaconPacket = Config.callsign + ">APLRG1";
+ if (Config.beacon.path != "") {
+ beaconPacket += "," + Config.beacon.path;
+ }
+ String encodedGPS = encodeGPS(Config.beacon.latitude, Config.beacon.longitude, Config.beacon.overlay, Config.beacon.symbol);
+ iGateBeaconPacket = beaconPacket + ",qAC:!" + encodedGPS;
+ iGateLoRaBeaconPacket = beaconPacket + ":!" + encodedGPS;
}
double calculateDistanceTo(double latitude, double longitude) {
diff --git a/src/gps_utils.h b/src/gps_utils.h
index d711168..8c8ae3e 100644
--- a/src/gps_utils.h
+++ b/src/gps_utils.h
@@ -8,8 +8,7 @@ namespace GPS_Utils {
char *ax25_base91enc(char *s, uint8_t n, uint32_t v);
String encodeGPS(float latitude, float longitude, String overlay, String symbol);
- String generateBeacon();
- String generateiGateLoRaBeacon();
+ void generateBeacons();
double calculateDistanceCourse(double latitude, double longitude);
String decodeEncodedGPS(String packet);
String getReceivedGPS(String packet);
diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp
index 0450aa2..99b1fe6 100644
--- a/src/lora_utils.cpp
+++ b/src/lora_utils.cpp
@@ -10,7 +10,6 @@
extern Configuration Config;
extern uint32_t lastRxTime;
-
extern std::vector receivedPackets;
bool transmissionFlag = true;
diff --git a/src/power_utils.cpp b/src/power_utils.cpp
index 37c8808..3cfb70f 100644
--- a/src/power_utils.cpp
+++ b/src/power_utils.cpp
@@ -20,10 +20,6 @@ extern Configuration Config;
namespace POWER_Utils {
- bool BatteryIsConnected = false;
- String batteryVoltage = "";
- String batteryChargeDischargeCurrent = "";
-
void activateMeasurement() {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
PMU.disableTSPinMeasure();
@@ -138,7 +134,7 @@ namespace POWER_Utils {
}
#ifdef VEXT_CTRL
- pinMode(VEXT_CTRL,OUTPUT); // this is for GPS and TFT screen on Wireless_Tracker and only for Oled in Heltec V3
+ pinMode(VEXT_CTRL,OUTPUT); // GPS + TFT on HELTEC Wireless_Tracker and only for Oled in HELTEC V3
digitalWrite(VEXT_CTRL, HIGH);
#endif
diff --git a/src/station_utils.cpp b/src/station_utils.cpp
index 418c62f..ecb7e2c 100644
--- a/src/station_utils.cpp
+++ b/src/station_utils.cpp
@@ -5,11 +5,11 @@
#include "utils.h"
#include
-extern Configuration Config;
-extern uint32_t lastTxTime;
-extern uint32_t lastRxTime;
-extern String fourthLine;
+extern Configuration Config;
+extern uint32_t lastRxTime;
+extern String fourthLine;
+uint32_t lastTxTime = millis();
std::vector lastHeardStation;
std::vector outputPacketBuffer;
std::vector packet25SegBuffer;
@@ -70,7 +70,6 @@ namespace STATION_Utils {
String deltaTimeString = packet25SegBuffer[0].substring(0, packet25SegBuffer[0].indexOf(","));
uint32_t deltaTime = deltaTimeString.toInt();
if ((millis() - deltaTime) > 25 * 1000) {
- //Serial.print("Borrando : "); Serial.println(packet25SegBuffer[0]);
packet25SegBuffer.erase(packet25SegBuffer.begin());
}
}
diff --git a/src/tnc_utils.cpp b/src/tnc_utils.cpp
index fe8bb9a..4e38dba 100644
--- a/src/tnc_utils.cpp
+++ b/src/tnc_utils.cpp
@@ -6,7 +6,6 @@
#include "utils.h"
extern Configuration Config;
-extern std::vector outputPacketBuffer;
#define MAX_CLIENTS 4
#define INPUT_BUFFER_SIZE (2 + MAX_CLIENTS)
diff --git a/src/utils.cpp b/src/utils.cpp
index e9d3851..7cf8404 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -12,10 +12,9 @@
#include "display.h"
#include "utils.h"
-extern WiFiClient espClient;
extern Configuration Config;
+extern WiFiClient espClient;
extern String versionDate;
-extern bool statusAfterBoot;
extern String firstLine;
extern String secondLine;
extern String thirdLine;
@@ -23,9 +22,7 @@ extern String fourthLine;
extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
-extern uint32_t lastBeaconTx;
extern uint32_t lastScreenOn;
-extern bool beaconUpdate;
extern String iGateBeaconPacket;
extern String iGateLoRaBeaconPacket;
extern std::vector lastHeardStation;
@@ -38,6 +35,10 @@ extern bool WiFiConnect;
extern bool WiFiConnected;
extern int wxModuleType;
+bool statusAfterBoot = true;
+bool beaconUpdate = true;
+uint32_t lastBeaconTx = 0;
+
namespace Utils {
@@ -169,14 +170,14 @@ namespace Utils {
void checkWiFiInterval() {
uint32_t WiFiCheck = millis() - lastWiFiCheck;
- if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15*60*1000) {
- WiFiConnect = true;
+ if (WiFi.status() != WL_CONNECTED && WiFiCheck >= 15 * 60 * 1000) {
+ WiFiConnect = true;
}
if (WiFiConnect) {
- Serial.println("\nConnecting to WiFi ...");
- WIFI_Utils::startWiFi();
- lastWiFiCheck = millis();
- WiFiConnect = false;
+ Serial.println("\nConnecting to WiFi ...");
+ WIFI_Utils::startWiFi();
+ lastWiFiCheck = millis();
+ WiFiConnect = false;
}
}
diff --git a/src/web_utils.cpp b/src/web_utils.cpp
index 6579a43..6d69cb8 100644
--- a/src/web_utils.cpp
+++ b/src/web_utils.cpp
@@ -5,7 +5,6 @@
#include "utils.h"
extern Configuration Config;
-
extern uint32_t lastBeaconTx;
extern std::vector receivedPackets;
diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp
index cbb47c9..8d8f4e9 100644
--- a/src/wifi_utils.cpp
+++ b/src/wifi_utils.cpp
@@ -18,7 +18,7 @@ extern bool WiFiAutoAPStarted;
namespace WIFI_Utils {
void checkWiFi() {
- if ((WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30*1000) && !WiFiAutoAPStarted) {
+ if ((WiFi.status() != WL_CONNECTED) && ((millis() - previousWiFiMillis) >= 30 * 1000) && !WiFiAutoAPStarted) {
Serial.print(millis());
Serial.println("Reconnecting to WiFi...");
WiFi.disconnect();