Skip to content

Commit 343649a

Browse files
getAPmac bugfix
1 parent 0521889 commit 343649a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

EmbUI/EmbUI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class EmbUI
189189

190190
public:
191191
EmbUI() : cfg(__CFGSIZE), section_handle(), server(80), ws("/ws"){
192-
*mc='\0';
192+
memset(mc,0,sizeof(mc));
193193
}
194194
BITFIELDS sysData;
195195
AsyncWebServer server;

EmbUI/wi-fi.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ void EmbUI::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) // , WiFiEventI
111111
void EmbUI::wifi_init(){
112112
String hn = param(FPSTR(P_hostname));
113113
String appwd = param(FPSTR(P_APpwd));
114-
114+
getAPmac();
115115
if (!hn.length()){
116-
getAPmac();
117116
hn = String(__IDPREFIX) + mc;
118117
var(FPSTR(P_hostname), hn, true);
119118
}
@@ -187,13 +186,18 @@ void EmbUI::setup_mDns(){
187186
void EmbUI::getAPmac(){
188187
if(*mc) return;
189188

190-
uint8_t _mac[6];
189+
uint8_t _mac[7];
191190

192191
#ifdef ESP32
192+
// uint64_t chipid = ESP.getEfuseMac();
193+
// memset(_mac,0,sizeof(_mac));
194+
// memcpy(_mac,&chipid,6);
195+
193196
if(WiFi.getMode() == WIFI_MODE_NULL)
194197
WiFi.mode(WIFI_MODE_AP);
195198
#endif
196199
WiFi.softAPmacAddress(_mac);
197200

201+
printf_P(PSTR("UI MAC:%02X%02X%02X"), _mac[3], _mac[4], _mac[5]);
198202
sprintf_P(mc, PSTR("%02X%02X%02X"), _mac[3], _mac[4], _mac[5]);
199-
}
203+
}

0 commit comments

Comments
 (0)