diff --git a/src/actions/bluetoothbeginaction.h b/src/actions/bluetoothbeginaction.h index c73a562..0801fb7 100644 --- a/src/actions/bluetoothbeginaction.h +++ b/src/actions/bluetoothbeginaction.h @@ -11,7 +11,7 @@ class BluetoothBeginAction : public virtual ActionInterface public: void triggered() override { - if (!bluetoothSerial.begin("bobbyquad")) + if (!bluetoothSerial.begin(deviceName)) { Serial.println("Could not begin bluetooth"); // TODO: better error handling diff --git a/src/actions/bluetoothbeginmasteraction.h b/src/actions/bluetoothbeginmasteraction.h index d4b4253..3d862f2 100644 --- a/src/actions/bluetoothbeginmasteraction.h +++ b/src/actions/bluetoothbeginmasteraction.h @@ -11,7 +11,7 @@ class BluetoothBeginMasterAction : public virtual ActionInterface public: void triggered() override { - if (!bluetoothSerial.begin("bobbyquad", true)) + if (!bluetoothSerial.begin(deviceName, true)) { Serial.println("Could not begin bluetooth master"); // TODO: better error handling diff --git a/src/globals.h b/src/globals.h index 134402f..e36702c 100644 --- a/src/globals.h +++ b/src/globals.h @@ -24,6 +24,8 @@ float gametrakX, gametrakY, gametrakDist; #endif float avgSpeed, avgSpeedKmh, sumCurrent, sumAbsoluteCurrent; +char deviceName[16]; + Settings settings; SettingsSaver settingsSaver; diff --git a/src/main.cpp b/src/main.cpp index f45a2f4..1f83de8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -61,10 +63,15 @@ void setup() updateSwapFrontBack(); + { + uint8_t macAddress[6]; + WiFi.macAddress(&macAddress[0]); + std::sprintf(deviceName, "bobbyquad_%02hhx%02hhx%02hhx", macAddress[3], macAddress[4], macAddress[5]); + } + WiFi.mode(WIFI_AP_STA); - WiFi.softAP("bobbyquad", "Passwort_123"); + WiFi.softAP(deviceName, "Passwort_123"); WiFi.begin("realraum", "r3alraum"); - //WiFi.begin("McDonalds Free WiFi 2.4GHz", "Passwort_123"); BluetoothBeginMasterAction{}.triggered(); #ifdef FEATURE_BMS