Merge pull request #37 from bobbycar-graz/36-unique-device-name
Unique device names
This commit is contained in:
@@ -68,6 +68,7 @@ build_flags =
|
|||||||
build_flags =
|
build_flags =
|
||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
${peters_platine.build_flags}
|
${peters_platine.build_flags}
|
||||||
|
-DDEVICE_PREFIX=bobbyquad
|
||||||
-DFEATURE_3WIRESW
|
-DFEATURE_3WIRESW
|
||||||
-DPINS_3WIRESW_OUT=0
|
-DPINS_3WIRESW_OUT=0
|
||||||
-DPINS_3WIRESW_IN1=16
|
-DPINS_3WIRESW_IN1=16
|
||||||
@@ -131,6 +132,7 @@ build_flags =
|
|||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
${peters_platine.build_flags}
|
${peters_platine.build_flags}
|
||||||
${default_limits.build_flags}
|
${default_limits.build_flags}
|
||||||
|
-DDEVICE_PREFIX=bobbycar
|
||||||
-DDEFAULT_GASMIN=400
|
-DDEFAULT_GASMIN=400
|
||||||
-DDEFAULT_GASMAX=2000
|
-DDEFAULT_GASMAX=2000
|
||||||
-DDEFAULT_BREMSMIN=600
|
-DDEFAULT_BREMSMIN=600
|
||||||
@@ -179,6 +181,7 @@ upload_port = /dev/ttyUSB*
|
|||||||
build_flags =
|
build_flags =
|
||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
${peters_platine.build_flags}
|
${peters_platine.build_flags}
|
||||||
|
-DDEVICE_PREFIX=bobbyquad
|
||||||
; -DFEATURE_3WIRESW
|
; -DFEATURE_3WIRESW
|
||||||
; -DPINS_3WIRESW_OUT=0
|
; -DPINS_3WIRESW_OUT=0
|
||||||
; -DPINS_3WIRESW_IN1=16
|
; -DPINS_3WIRESW_IN1=16
|
||||||
@@ -214,6 +217,7 @@ upload_speed = 921600
|
|||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
|
-DDEVICE_PREFIX=testbench
|
||||||
-DILI9341_DRIVER=1
|
-DILI9341_DRIVER=1
|
||||||
-DTFT_MOSI=22
|
-DTFT_MOSI=22
|
||||||
-DTFT_SCLK=21
|
-DTFT_SCLK=21
|
||||||
@@ -260,6 +264,7 @@ upload_speed = 921600
|
|||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
|
-DDEVICE_PREFIX=bobbyquad
|
||||||
-DUSER_SETUP_LOADED=1
|
-DUSER_SETUP_LOADED=1
|
||||||
-DRPI_DISPLAY_TYPE
|
-DRPI_DISPLAY_TYPE
|
||||||
-DILI9486_DRIVER
|
-DILI9486_DRIVER
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
|
11
src/main.cpp
11
src/main.cpp
@@ -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, __STRINGIFY(DEVICE_PREFIX) "_%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
|
||||||
|
Reference in New Issue
Block a user