Skip to content

Commit 34bf39e

Browse files
committed
Change byte order of the MAC in the access point name.
fixes openbikesensor#315
1 parent eea6ce2 commit 34bf39e

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/configServer.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,12 +765,23 @@ void startServer(ObsConfig *obsConfig) {
765765
theObsConfig = obsConfig;
766766

767767
const uint64_t chipid_num = ESP.getEfuseMac();
768-
String esp_chipid = String((uint16_t)(chipid_num >> 32), HEX);
769-
esp_chipid += String((uint32_t)chipid_num, HEX);
770-
esp_chipid.toUpperCase();
771-
OBS_ID = "OpenBikeSensor-" + esp_chipid;
772-
OBS_ID_SHORT = "OBS-" + String((uint16_t)(ESP.getEfuseMac() >> 32), HEX);
773-
OBS_ID_SHORT.toUpperCase();
768+
769+
uint64_t chipid_be = 0;
770+
for(int i=0; i<48; i=i+8) {
771+
chipid_be <<= 8;
772+
chipid_be |= ((chipid_num >> i) & 0xff);
773+
}
774+
/*
775+
FIXME: workaround as the MAC of the AP is increased by one
776+
could not yet figure out the reason, as WiFi.softAP is
777+
called with OBS_ID as value for the ssid
778+
*/
779+
chipid_be++;
780+
781+
char esp_chipid[28];
782+
snprintf(esp_chipid, sizeof(esp_chipid), "OpenBikeSensor-%llX", chipid_be);
783+
OBS_ID = String(esp_chipid);
784+
OBS_ID_SHORT = "OBS-" + OBS_ID.substring(15,19);
774785

775786
displayTest->clear();
776787
displayTest->showTextOnGrid(0, 0, "Ver.:");

0 commit comments

Comments
 (0)