mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-11-01 19:35:47 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2ba3d992a | ||
|
|
683bc7fe1a | ||
|
|
e692ce2729 | ||
|
|
90b18ef088 |
No files matched your search
@@ -15,11 +15,11 @@ jobs:
|
||||
- name: ttgo-lora32-v21
|
||||
chip: esp32
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
@@ -61,7 +61,7 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
#received-packets{max-width:none;padding-left:0;padding-right:0;}
|
||||
#received-packets .table{--bs-table-color:var(--msh-text);--bs-table-border-color:var(--msh-border);color:var(--msh-text);}
|
||||
#received-packets th{white-space:nowrap;}
|
||||
#received-packets td:nth-child(1),#received-packets td:nth-child(3),#received-packets td:nth-child(4){white-space:nowrap;}
|
||||
#received-packets td:nth-child(1),#received-packets td:nth-child(2),#received-packets td:nth-child(4),#received-packets td:nth-child(5){white-space:nowrap;}
|
||||
@media(max-width:768px){.app-sidebar{width:60px;padding:12px 6px;}.side-link .label,.nav-group-label{display:none;}.app-main{padding:14px;}}
|
||||
</style>
|
||||
</head>
|
||||
@@ -196,6 +196,7 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<table class="table mt-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Time</th>
|
||||
<th scope="col">Frame</th>
|
||||
<th scope="col">RSSI</th>
|
||||
|
||||
@@ -607,6 +607,7 @@ function loadReceivedPackets(packets) {
|
||||
const element = document.createElement("tr");
|
||||
|
||||
element.innerHTML = `
|
||||
<td>${packet.rxDate}</td>
|
||||
<td>${packet.rxTime}</td>
|
||||
<td>${packet.packet}</td>
|
||||
<td>${packet.RSSI}</td>
|
||||
|
||||
@@ -43,9 +43,12 @@ private:
|
||||
|
||||
String _hostName = "";
|
||||
std::vector<WiFiNetwork> _wifiNetworks;
|
||||
volatile uint8_t _lastWiFiDisconnectReason = 0;
|
||||
String _wifiAuthFailSSID = "";
|
||||
|
||||
int _findWiFiNetworkIndex(const String& ssid) const;
|
||||
bool _connectWiFi(const WiFiNetwork& network);
|
||||
bool _isWiFiAuthFailure() const;
|
||||
void _processAPTimeout();
|
||||
void _onNetworkEvent(arduino_event_id_t event, arduino_event_info_t /*info*/);
|
||||
|
||||
@@ -75,6 +78,7 @@ public:
|
||||
bool disconnectWiFi();
|
||||
String getWiFiSSID() const;
|
||||
String getWiFiAPSSID() const;
|
||||
String getWiFiAuthFailSSID() const;
|
||||
IPAddress getWiFiIP() const;
|
||||
IPAddress getWiFiAPIP() const;
|
||||
wifi_mode_t getWiFiMode() const;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace NTP_Utils {
|
||||
bool setup();
|
||||
void update();
|
||||
String getFormatedTime();
|
||||
String getFormatedDate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
class ReceivedPacket {
|
||||
public:
|
||||
String rxDate;
|
||||
String rxTime;
|
||||
String packet;
|
||||
int RSSI;
|
||||
|
||||
@@ -68,7 +68,7 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-09-30";
|
||||
String versionDate = "2026-10-01";
|
||||
String versionNumber = "4.0.2";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
|
||||
@@ -305,6 +305,7 @@ namespace LoRa_Utils {
|
||||
receivedPackets.erase(receivedPackets.begin());
|
||||
}
|
||||
ReceivedPacket receivedPacket;
|
||||
receivedPacket.rxDate = NTP_Utils::getFormatedDate();
|
||||
receivedPacket.rxTime = NTP_Utils::getFormatedTime();
|
||||
receivedPacket.packet = sanitizeForWeb(packet.substring(3));
|
||||
receivedPacket.RSSI = rssi;
|
||||
|
||||
+20
-1
@@ -51,12 +51,14 @@ bool NetworkManager::_connectWiFi(const WiFiNetwork& network) {
|
||||
WiFi.mode(_wifiAPmode ? WIFI_AP_STA : WIFI_STA);
|
||||
|
||||
Serial.println("[NM] Attempting to connect to WiFi: " + network.ssid);
|
||||
_lastWiFiDisconnectReason = 0;
|
||||
WiFi.begin(network.ssid.c_str(), network.psk.c_str());
|
||||
|
||||
Serial.print("[NM] Connecting ");
|
||||
|
||||
int attempts = 0;
|
||||
while (!isWiFiConnected() && attempts < 10) {
|
||||
if (_lastWiFiDisconnectReason == WIFI_REASON_AUTH_FAIL) break;
|
||||
delay(500);
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
digitalWrite(INTERNAL_LED_PIN,HIGH);
|
||||
@@ -72,10 +74,19 @@ bool NetworkManager::_connectWiFi(const WiFiNetwork& network) {
|
||||
|
||||
if (isWiFiConnected()) return true;
|
||||
|
||||
if (_isWiFiAuthFailure()) {
|
||||
Serial.println("[NM] Wrong WiFi password for SSID: " + network.ssid);
|
||||
if (_wifiAuthFailSSID.isEmpty()) _wifiAuthFailSSID = network.ssid;
|
||||
}
|
||||
Serial.println("[NM] Failed to connect to WiFi after " + String(attempts) + " attempts. SSID: " + network.ssid);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkManager::_isWiFiAuthFailure() const {
|
||||
uint8_t reason = _lastWiFiDisconnectReason;
|
||||
return reason == WIFI_REASON_AUTH_FAIL || reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT;
|
||||
}
|
||||
|
||||
void NetworkManager::_processAPTimeout() {
|
||||
if (!_wifiAPmode || _apTimeout == 0) {
|
||||
return;
|
||||
@@ -93,8 +104,11 @@ void NetworkManager::_processAPTimeout() {
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_info_t /*info*/) {
|
||||
void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_info_t info) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
||||
_lastWiFiDisconnectReason = info.wifi_sta_disconnected.reason;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("[NM] ETH Started");
|
||||
if (!_hostName.isEmpty()) {
|
||||
@@ -224,6 +238,7 @@ bool NetworkManager::connectWiFi() {
|
||||
if (_wifiNetworks.empty()) {
|
||||
return false;
|
||||
}
|
||||
_wifiAuthFailSSID = "";
|
||||
|
||||
for (size_t i = 0; i < _wifiNetworks.size(); i++) {
|
||||
disconnectWiFi();
|
||||
@@ -256,6 +271,10 @@ String NetworkManager::getWiFiAPSSID() const {
|
||||
return WiFi.softAPSSID();
|
||||
}
|
||||
|
||||
String NetworkManager::getWiFiAuthFailSSID() const {
|
||||
return _wifiAuthFailSSID;
|
||||
}
|
||||
|
||||
IPAddress NetworkManager::getWiFiIP() const {
|
||||
return WiFi.localIP();
|
||||
}
|
||||
|
||||
@@ -70,4 +70,13 @@ namespace NTP_Utils {
|
||||
return String(formatedTime);
|
||||
}
|
||||
|
||||
String getFormatedDate() {
|
||||
if (Config.digi.ecoMode != 0) return "";
|
||||
struct tm timeinfo;
|
||||
if (!ntpStarted || !getLocalTime(&timeinfo, 0)) return ""; // 0 ms: don't wait (default timeout would block 5 s)
|
||||
char formatedDate[11];
|
||||
strftime(formatedDate, sizeof(formatedDate), "%Y-%m-%d", &timeinfo);
|
||||
return String(formatedDate);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -160,6 +160,7 @@ namespace WEB_Utils {
|
||||
JsonDocument data;
|
||||
|
||||
for (int i = 0; i < receivedPackets.size(); i++) {
|
||||
data[i]["rxDate"] = receivedPackets[i].rxDate;
|
||||
data[i]["rxTime"] = receivedPackets[i].rxTime;
|
||||
data[i]["packet"] = receivedPackets[i].packet;
|
||||
data[i]["RSSI"] = receivedPackets[i].RSSI;
|
||||
|
||||
@@ -34,6 +34,7 @@ extern uint32_t lastServerCheck;
|
||||
uint8_t wifiCounter = 0;
|
||||
uint32_t lastBackupDigiTime = millis();
|
||||
uint32_t lastWiFiCheck = 0;
|
||||
bool firstWiFiAttempt = true;
|
||||
|
||||
|
||||
namespace WIFI_Utils {
|
||||
@@ -108,6 +109,8 @@ namespace WIFI_Utils {
|
||||
|
||||
displayShow("", "Connecting to WiFi:", "", " loading ...", 0);
|
||||
networkManager->connectWiFi();
|
||||
bool showAuthError = firstWiFiAttempt;
|
||||
firstWiFiAttempt = false;
|
||||
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
digitalWrite(INTERNAL_LED_PIN, LOW);
|
||||
@@ -120,6 +123,10 @@ namespace WIFI_Utils {
|
||||
displayShow("", " Connected!!", "" , " loading ...", 1000);
|
||||
} else {
|
||||
Serial.println("[WiFi] Not connected to WiFi!");
|
||||
String authFailSSID = networkManager->getWiFiAuthFailSSID();
|
||||
if (showAuthError && !authFailSSID.isEmpty()) {
|
||||
displayShow("", "SSID: " + authFailSSID.substring(0, 15), "Bad WiFi password", "Double check settings", 5000);
|
||||
}
|
||||
if (Config.wifiAutoAP.enabled) {
|
||||
Serial.println("Starting AP fallback...");
|
||||
displayShow("", " WiFi Not Connected!", "" , " loading ...", 1000);
|
||||
|
||||
Reference in new issue
Block a user