From d212640f74e109031f0155f1f2ba864690fad697 Mon Sep 17 00:00:00 2001 From: Torsten Date: Mon, 5 Jul 2021 14:26:58 +0300 Subject: [PATCH] finally fix wifi name to be unique --- fan_control/include/ota.hpp | 2 +- fan_control/src/main.cpp | 3 +-- fan_control/src/ota.cpp | 6 +++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fan_control/include/ota.hpp b/fan_control/include/ota.hpp index dcba75b..75be939 100644 --- a/fan_control/include/ota.hpp +++ b/fan_control/include/ota.hpp @@ -4,4 +4,4 @@ #include #include -void ota_setup(const char* name); \ No newline at end of file +void ota_setup(); \ No newline at end of file diff --git a/fan_control/src/main.cpp b/fan_control/src/main.cpp index 044b8e3..e369ab4 100644 --- a/fan_control/src/main.cpp +++ b/fan_control/src/main.cpp @@ -6,11 +6,10 @@ #include "serial.hpp" -const char* ssid = "fan_XXX"; void setup() { Serial.begin(115200); - ota_setup(ssid); + ota_setup(); server_setup(); collector_setup(); DEBUG_OUT.println(F("Setup done")); diff --git a/fan_control/src/ota.cpp b/fan_control/src/ota.cpp index db4918b..ab548fc 100644 --- a/fan_control/src/ota.cpp +++ b/fan_control/src/ota.cpp @@ -2,8 +2,12 @@ #include "serial.hpp" #include -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"); boolean result = WiFi.softAP(ssid); while (result == false) {