diff --git a/platformio.ini b/platformio.ini index 6ef9b91..4d05774 100644 --- a/platformio.ini +++ b/platformio.ini @@ -68,6 +68,7 @@ build_flags = build_flags = ${common_env_data.build_flags} ${peters_platine.build_flags} + -DDEVICE_PREFIX=bobbyquad -DFEATURE_3WIRESW -DPINS_3WIRESW_OUT=0 -DPINS_3WIRESW_IN1=16 @@ -131,6 +132,7 @@ build_flags = ${common_env_data.build_flags} ${peters_platine.build_flags} ${default_limits.build_flags} + -DDEVICE_PREFIX=bobbycar -DDEFAULT_GASMIN=400 -DDEFAULT_GASMAX=2000 -DDEFAULT_BREMSMIN=600 @@ -179,6 +181,7 @@ upload_port = /dev/ttyUSB* build_flags = ${common_env_data.build_flags} ${peters_platine.build_flags} + -DDEVICE_PREFIX=bobbyquad ; -DFEATURE_3WIRESW ; -DPINS_3WIRESW_OUT=0 ; -DPINS_3WIRESW_IN1=16 @@ -214,6 +217,7 @@ upload_speed = 921600 build_flags = ${common_env_data.build_flags} + -DDEVICE_PREFIX=testbench -DILI9341_DRIVER=1 -DTFT_MOSI=22 -DTFT_SCLK=21 @@ -260,6 +264,7 @@ upload_speed = 921600 build_flags = ${common_env_data.build_flags} + -DDEVICE_PREFIX=bobbyquad -DUSER_SETUP_LOADED=1 -DRPI_DISPLAY_TYPE -DILI9486_DRIVER 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..4a440b3 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, __STRINGIFY(DEVICE_PREFIX) "_%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