Made device names unique

This commit is contained in:
2020-05-31 00:07:30 +02:00
parent 23734ee76d
commit b998fd869a
4 changed files with 13 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ class BluetoothBeginAction : public virtual ActionInterface
public: public:
void triggered() override void triggered() override
{ {
if (!bluetoothSerial.begin("bobbyquad")) if (!bluetoothSerial.begin(deviceName))
{ {
Serial.println("Could not begin bluetooth"); Serial.println("Could not begin bluetooth");
// TODO: better error handling // TODO: better error handling

View File

@@ -11,7 +11,7 @@ class BluetoothBeginMasterAction : public virtual ActionInterface
public: public:
void triggered() override void triggered() override
{ {
if (!bluetoothSerial.begin("bobbyquad", true)) if (!bluetoothSerial.begin(deviceName, true))
{ {
Serial.println("Could not begin bluetooth master"); Serial.println("Could not begin bluetooth master");
// TODO: better error handling // TODO: better error handling

View File

@@ -24,6 +24,8 @@ float gametrakX, gametrakY, gametrakDist;
#endif #endif
float avgSpeed, avgSpeedKmh, sumCurrent, sumAbsoluteCurrent; float avgSpeed, avgSpeedKmh, sumCurrent, sumAbsoluteCurrent;
char deviceName[16];
Settings settings; Settings settings;
SettingsSaver settingsSaver; SettingsSaver settingsSaver;

View File

@@ -1,3 +1,5 @@
#include <cstdio>
#include <Arduino.h> #include <Arduino.h>
#include <HardwareSerial.h> #include <HardwareSerial.h>
#include <WiFi.h> #include <WiFi.h>
@@ -61,10 +63,15 @@ void setup()
updateSwapFrontBack(); 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.mode(WIFI_AP_STA);
WiFi.softAP("bobbyquad", "Passwort_123"); WiFi.softAP(deviceName, "Passwort_123");
WiFi.begin("realraum", "r3alraum"); WiFi.begin("realraum", "r3alraum");
//WiFi.begin("McDonalds Free WiFi 2.4GHz", "Passwort_123");
BluetoothBeginMasterAction{}.triggered(); BluetoothBeginMasterAction{}.triggered();
#ifdef FEATURE_BMS #ifdef FEATURE_BMS