Add get wifi.status and get wifi.ip CLI commands

This commit is contained in:
Michael Graff committed 2026-09-06 21:44:47 -05:00
1 parent b11a779843
commit 98cf4f3332
1 file changed
+15
+15
View File
@@ -1,6 +1,9 @@
#include "MyMesh.h"
#include <Arduino.h> // needed for PlatformIO
#ifdef WIFI_SSID
#include <WiFi.h>
#endif
#include <Mesh.h>
#define CMD_APP_START 1
@@ -2184,6 +2187,18 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
sprintf(reply, "> %s", _prefs.wifi_ssid[0] ? _prefs.wifi_ssid : WIFI_SSID);
return true;
}
if (strcmp(command, "get wifi.status") == 0) {
strcpy(reply, WiFi.status() == WL_CONNECTED ? "> connected" : "> disconnected");
return true;
}
if (strcmp(command, "get wifi.ip") == 0) {
if (WiFi.status() == WL_CONNECTED) {
sprintf(reply, "> %s", WiFi.localIP().toString().c_str());
} else {
strcpy(reply, "> (not connected)");
}
return true;
}
}
#endif