Skip to content

Commit

Permalink
Change byte order of the MAC in the access point name.
Browse files Browse the repository at this point in the history
  • Loading branch information
SubOptimal committed Sep 8, 2022
1 parent eea6ce2 commit 34bf39e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/configServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,23 @@ void startServer(ObsConfig *obsConfig) {
theObsConfig = obsConfig;

const uint64_t chipid_num = ESP.getEfuseMac();
String esp_chipid = String((uint16_t)(chipid_num >> 32), HEX);
esp_chipid += String((uint32_t)chipid_num, HEX);
esp_chipid.toUpperCase();
OBS_ID = "OpenBikeSensor-" + esp_chipid;
OBS_ID_SHORT = "OBS-" + String((uint16_t)(ESP.getEfuseMac() >> 32), HEX);
OBS_ID_SHORT.toUpperCase();

uint64_t chipid_be = 0;
for(int i=0; i<48; i=i+8) {
chipid_be <<= 8;
chipid_be |= ((chipid_num >> i) & 0xff);
}
/*
FIXME: workaround as the MAC of the AP is increased by one
could not yet figure out the reason, as WiFi.softAP is
called with OBS_ID as value for the ssid
*/
chipid_be++;

char esp_chipid[28];
snprintf(esp_chipid, sizeof(esp_chipid), "OpenBikeSensor-%llX", chipid_be);
OBS_ID = String(esp_chipid);
OBS_ID_SHORT = "OBS-" + OBS_ID.substring(15,19);

displayTest->clear();
displayTest->showTextOnGrid(0, 0, "Ver.:");
Expand Down

0 comments on commit 34bf39e

Please sign in to comment.