Fixed mac address detection for bobbycar unique identifier
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -37,3 +37,6 @@
|
||||
[submodule "components/fmt"]
|
||||
path = components/fmt
|
||||
url = git@github.com:0xFEEDC0DE64/fmt.git
|
||||
[submodule "components/espwifistack"]
|
||||
path = components/espwifistack
|
||||
url = git@github.com:0xFEEDC0DE64/espwifistack.git
|
||||
|
1
components/espwifistack
Submodule
1
components/espwifistack
Submodule
Submodule components/espwifistack added at 0497b7a134
@ -154,6 +154,7 @@ set(headers
|
||||
feedbackparser.h
|
||||
globals.h
|
||||
htmlutils.h
|
||||
macros_bobbycar.h
|
||||
modeinterface.h
|
||||
ota.h
|
||||
serialhandler.h
|
||||
@ -167,6 +168,7 @@ set(headers
|
||||
unifiedmodelmode.h
|
||||
utils.h
|
||||
wifitexthelpers.h
|
||||
wifi_bobbycar.h
|
||||
)
|
||||
|
||||
set(sources
|
||||
@ -179,7 +181,7 @@ set(dependencies
|
||||
# AsyncTCP
|
||||
bobbycar-protocol cpputils cxx-ring-buffer date
|
||||
# ESPAsyncWebServer
|
||||
espchrono espcpputils expected fmt TFT_eSPI
|
||||
espchrono espcpputils espwifistack expected fmt TFT_eSPI
|
||||
)
|
||||
|
||||
idf_component_register(
|
||||
|
@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// local includes
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
#include "macros_bobbycar.h"
|
||||
|
||||
namespace {
|
||||
class WifiSoftApAction : public virtual ActionInterface
|
||||
|
@ -163,7 +163,7 @@ void StatusDisplay::redraw()
|
||||
m_labelLimit1.redraw(std::to_string(controllers.front.command.left.iDcMax) + "A");
|
||||
m_labelPerformance.redraw(std::to_string(performance.last));
|
||||
m_labelMode.redraw(currentMode->displayName());
|
||||
m_labelName.redraw(&deviceName[0]);
|
||||
m_labelName.redraw(deviceName);
|
||||
const auto profile = settingsPersister.currentlyOpenProfileIndex();
|
||||
m_labelProfile.redraw(profile ? std::to_string(*profile) : "-");
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#endif
|
||||
#include <SPI.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
@ -23,6 +24,7 @@
|
||||
#include "modeinterface.h"
|
||||
#include "settings.h"
|
||||
#include "settingspersister.h"
|
||||
#include "macros_bobbycar.h"
|
||||
|
||||
namespace {
|
||||
std::optional<int16_t> raw_gas, raw_brems;
|
||||
@ -34,7 +36,7 @@ float gametrakX, gametrakY, gametrakDist;
|
||||
#endif
|
||||
float avgSpeed, avgSpeedKmh, sumCurrent;
|
||||
|
||||
char deviceName[32];
|
||||
char deviceName[32] = STRING(DEVICE_PREFIX) "_ERR";
|
||||
|
||||
Settings settings;
|
||||
SettingsPersister settingsPersister;
|
||||
|
5
main/macros_bobbycar.h
Normal file
5
main/macros_bobbycar.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// macros are a shit piece of software
|
||||
#define STRING2(s) #s
|
||||
#define STRING(s) STRING2(s)
|
@ -3,6 +3,7 @@
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_wifi_types.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
// Arduino includes
|
||||
#include <Arduino.h>
|
||||
@ -10,10 +11,12 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
using namespace std::chrono_literals;
|
||||
#include <espwifistack.h>
|
||||
|
||||
// local includes
|
||||
#include "bobbycar-common.h"
|
||||
#include "bobbycar-serial.h"
|
||||
#include "macros_bobbycar.h"
|
||||
#include "globals.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "modes/tempomatmode.h"
|
||||
@ -176,13 +179,12 @@ extern "C" void app_main()
|
||||
printMemoryStats("swapFronBack()");
|
||||
#endif
|
||||
|
||||
//bootLabel.redraw("deviceName");
|
||||
//{
|
||||
// uint8_t macAddress[6];
|
||||
// WiFi.macAddress(&macAddress[0]);
|
||||
// std::sprintf(deviceName, STRING(DEVICE_PREFIX) "_%02hhx%02hhx%02hhx", macAddress[3], macAddress[4], macAddress[5]);
|
||||
//}
|
||||
//printMemoryStats("deviceName");
|
||||
bootLabel.redraw("deviceName");
|
||||
if (const auto result = wifi_stack::get_default_mac_addr())
|
||||
std::sprintf(deviceName, STRING(DEVICE_PREFIX) "_%02hhx%02hhx%02hhx", result->at(3), result->at(4), result->at(5));
|
||||
else
|
||||
ESP_LOGE("MAIN", "get_default_mac_addr() failed: %.*s", result.error().size(), result.error().data());
|
||||
printMemoryStats("deviceName");
|
||||
|
||||
//bootLabel.redraw("setHostname");
|
||||
//if (!WiFi.setHostname(deviceName))
|
||||
|
@ -28,10 +28,6 @@
|
||||
#include "can.h"
|
||||
#endif
|
||||
|
||||
// macros are a shit piece of software
|
||||
#define STRING2(s) #s
|
||||
#define STRING(s) STRING2(s)
|
||||
|
||||
namespace {
|
||||
bool currentlyReverseBeeping;
|
||||
bool reverseBeepToggle;
|
||||
|
8
main/wifi_bobbycar.h
Normal file
8
main/wifi_bobbycar.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espwifistack.h>
|
||||
|
||||
namespace {
|
||||
|
||||
} // namespace
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_wifi_types.h>
|
||||
|
||||
// local includes
|
||||
#include "accessorinterface.h"
|
||||
|
||||
namespace {
|
||||
|
Reference in New Issue
Block a user