finally fix wifi name to be unique

This commit is contained in:
Torsten 2021-07-05 14:26:58 +03:00
parent 1d47154445
commit d212640f74
3 changed files with 7 additions and 4 deletions

View File

@ -4,4 +4,4 @@
#include <ESP8266mDNS.h> #include <ESP8266mDNS.h>
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
void ota_setup(const char* name); void ota_setup();

View File

@ -6,11 +6,10 @@
#include "serial.hpp" #include "serial.hpp"
const char* ssid = "fan_XXX";
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
ota_setup(ssid); ota_setup();
server_setup(); server_setup();
collector_setup(); collector_setup();
DEBUG_OUT.println(F("Setup done")); DEBUG_OUT.println(F("Setup done"));

View File

@ -2,8 +2,12 @@
#include "serial.hpp" #include "serial.hpp"
#include <LittleFS.h> #include <LittleFS.h>
void ota_setup(const char* ssid) { static String ssid;
void ota_setup() {
String mac = WiFi.macAddress();
mac.replace(":","_");
ssid = String("fan_") + mac;
DEBUG_OUT.println("Booting"); DEBUG_OUT.println("Booting");
boolean result = WiFi.softAP(ssid); boolean result = WiFi.softAP(ssid);
while (result == false) { while (result == false) {