Skip to content

Commit ecf9369

Browse files
committed
Display AP mac address
1 parent a096525 commit ecf9369

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Networking/ESP8266WiFi/WiFiInterface.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,14 @@ void WiFiInterface::Diagnostics(MessageType mtype) noexcept
987987
{
988988
Receiver<NetworkStatusResponse> status;
989989
status.Value().clockReg = 0xFFFFFFFF; // older WiFi firmware doesn't return this value, so preset it
990-
if (SendCommand(NetworkCommand::networkGetStatus, 0, 0, nullptr, 0, status) >= (int32_t)MinimumStatusResponseLength)
990+
991+
int rc = SendCommand(NetworkCommand::networkGetStatus, 0, 0, nullptr, 0, status);
992+
if (rc >= (int32_t)MinimumStatusResponseLength)
991993
{
992994
NetworkStatusResponse& r = status.Value();
993995
r.versionText[ARRAY_UPB(r.versionText)] = 0;
994996
platform.MessageF(mtype, "Firmware version %s\n", r.versionText);
995-
platform.MessageF(mtype, "MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
997+
platform.MessageF(mtype, "Module MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
996998
r.macAddress[0], r.macAddress[1], r.macAddress[2], r.macAddress[3], r.macAddress[4], r.macAddress[5]);
997999
platform.MessageF(mtype, "Module reset reason: %s, Vcc %.2f, flash size %" PRIu32 ", free heap %" PRIu32 "\n",
9981000
TranslateEspResetReason(r.resetReason), (double)((float)r.vcc/1024), r.flashSize, r.freeHeap);
@@ -1004,6 +1006,16 @@ void WiFiInterface::Diagnostics(MessageType mtype) noexcept
10041006

10051007
if (currentMode == WiFiState::connected)
10061008
{
1009+
int majorVer, minorVer, patchVer;
1010+
if (GetFirmwareVersion(majorVer, minorVer, patchVer) && // if parse failed, don't display
1011+
((majorVer >= 2 && minorVer >= 1 && patchVer > 0) || // > 2.1.0
1012+
(majorVer >= 2 && minorVer >= 2) || // >= 2.2.z
1013+
(majorVer >= 3) /* >= 3.y.z*/))
1014+
{
1015+
platform.MessageF(mtype, "AP MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
1016+
r.apMac[0], r.apMac[1], r.apMac[2], r.apMac[3], r.apMac[4], r.apMac[5]);
1017+
}
1018+
10071019
constexpr const char* ConnectionModes[4] = { "none", "802.11b", "802.11g", "802.11n" };
10081020
platform.MessageF(mtype, "Signal strength %ddBm, channel %u, mode %s, reconnections %u\n",
10091021
(int)r.rssi, r.channel, ConnectionModes[r.phyMode], reconnectCount);

0 commit comments

Comments
 (0)