Skip to content

Commit 79db889

Browse files
committed
Display AP mac address
1 parent 194eee3 commit 79db889

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Networking/ESP8266WiFi/WiFiInterface.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,14 @@ void WiFiInterface::Diagnostics(MessageType mtype) noexcept
998998
{
999999
Receiver<NetworkStatusResponse> status;
10001000
status.Value().clockReg = 0xFFFFFFFF; // older WiFi firmware doesn't return this value, so preset it
1001-
if (SendCommand(NetworkCommand::networkGetStatus, 0, 0, nullptr, 0, status) >= (int32_t)MinimumStatusResponseLength)
1001+
1002+
int rc = SendCommand(NetworkCommand::networkGetStatus, 0, 0, nullptr, 0, status);
1003+
if (rc >= (int32_t)MinimumStatusResponseLength)
10021004
{
10031005
NetworkStatusResponse& r = status.Value();
10041006
r.versionText[ARRAY_UPB(r.versionText)] = 0;
10051007
platform.MessageF(mtype, "Firmware version %s\n", r.versionText);
1006-
platform.MessageF(mtype, "MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
1008+
platform.MessageF(mtype, "Module MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
10071009
r.macAddress[0], r.macAddress[1], r.macAddress[2], r.macAddress[3], r.macAddress[4], r.macAddress[5]);
10081010
platform.MessageF(mtype, "Module reset reason: %s, Vcc %.2f, flash size %" PRIu32 ", free heap %" PRIu32 "\n",
10091011
TranslateEspResetReason(r.resetReason), (double)((float)r.vcc/1024), r.flashSize, r.freeHeap);
@@ -1015,6 +1017,15 @@ void WiFiInterface::Diagnostics(MessageType mtype) noexcept
10151017

10161018
if (currentMode == WiFiState::connected)
10171019
{
1020+
int majorVer, minorVer, patchVer;
1021+
if (GetFirmwareVersion(majorVer, minorVer, patchVer) && // if parse failed, don't display
1022+
((majorVer >= 2 && minorVer >= 2 && patchVer >= 0) || // > 2.2.z
1023+
(majorVer >= 3) /* >= 3.y.z*/))
1024+
{
1025+
platform.MessageF(mtype, "AP MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
1026+
r.apMac[0], r.apMac[1], r.apMac[2], r.apMac[3], r.apMac[4], r.apMac[5]);
1027+
}
1028+
10181029
constexpr const char* ConnectionModes[4] = { "none", "802.11b", "802.11g", "802.11n" };
10191030
platform.MessageF(mtype, "Signal strength %ddBm, channel %u, mode %s, reconnections %u\n",
10201031
(int)r.rssi, r.channel, ConnectionModes[r.phyMode], reconnectCount);

0 commit comments

Comments
 (0)