mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
Add get wifi.status and get wifi.ip CLI commands
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
#include "MyMesh.h"
|
#include "MyMesh.h"
|
||||||
|
|
||||||
#include <Arduino.h> // needed for PlatformIO
|
#include <Arduino.h> // needed for PlatformIO
|
||||||
|
#ifdef WIFI_SSID
|
||||||
|
#include <WiFi.h>
|
||||||
|
#endif
|
||||||
#include <Mesh.h>
|
#include <Mesh.h>
|
||||||
|
|
||||||
#define CMD_APP_START 1
|
#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);
|
sprintf(reply, "> %s", _prefs.wifi_ssid[0] ? _prefs.wifi_ssid : WIFI_SSID);
|
||||||
return true;
|
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
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user