Create files for implementation, removed old code
This commit is contained in:
@@ -25,7 +25,7 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
-DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
-DFEATURE_LEDBACKLIGHT
|
||||
|
@@ -6,16 +6,6 @@ set(BOBBY_HEADERS
|
||||
accessors/wifiapconfigaccessors.h
|
||||
accessors/wifistaconfigaccessors.h
|
||||
actions/assertaction.h
|
||||
actions/bluetoothbeginaction.h
|
||||
actions/bluetoothbeginmasteraction.h
|
||||
actions/bluetoothconnectbmsaction.h
|
||||
actions/bluetoothdisconnectaction.h
|
||||
actions/bluetoothendaction.h
|
||||
actions/bluetoothflushaction.h
|
||||
actions/bmsturnoffchargeaction.h
|
||||
actions/bmsturnoffdischargeaction.h
|
||||
actions/bmsturnonchargeaction.h
|
||||
actions/bmsturnondischargeaction.h
|
||||
actions/dividebyzeroaction.h
|
||||
actions/erasenvsaction.h
|
||||
actions/ledstripanimationactions.h
|
||||
@@ -34,8 +24,6 @@ set(BOBBY_HEADERS
|
||||
actions/wifistascanclearaction.h
|
||||
battery.h
|
||||
ble_bobby.h
|
||||
bluetooth_bobby.h
|
||||
bluetoothmode.h
|
||||
bmsutils.h
|
||||
bobbyblinker.h
|
||||
bobbybuttons.h
|
||||
@@ -45,7 +33,6 @@ set(BOBBY_HEADERS
|
||||
bobbytypesafeenum.h
|
||||
buildserver.h
|
||||
can.h
|
||||
changevaluedisplay_bluetoothmode.h
|
||||
changevaluedisplay_bobbyquickactions.h
|
||||
changevaluedisplay_controlmode.h
|
||||
changevaluedisplay_controltype.h
|
||||
@@ -140,9 +127,6 @@ set(BOBBY_HEADERS
|
||||
screens/batteryinfodisplay.h
|
||||
screens/batterymenu.h
|
||||
screens/blesettingsmenu.h
|
||||
screens/bluetoothsettingsmenu.h
|
||||
screens/bmsdisplay.h
|
||||
screens/bmsmenu.h
|
||||
screens/boardcomputerhardwaresettingsmenu.h
|
||||
screens/buzzermenu.h
|
||||
screens/calibratevoltagedisplay.h
|
||||
@@ -244,7 +228,6 @@ set(BOBBY_HEADERS
|
||||
taskmanager.h
|
||||
tempomat.h
|
||||
texthelpers/bletexthelpers.h
|
||||
texthelpers/bluetoothtexthelpers.h
|
||||
texthelpers/cloudtexthelpers.h
|
||||
texthelpers/debugtexthelpers.h
|
||||
texthelpers/esptexthelpers.h
|
||||
@@ -283,7 +266,7 @@ set(BOBBY_SOURCES
|
||||
actions/wifistascanclearaction.cpp
|
||||
battery.cpp
|
||||
ble_bobby.cpp
|
||||
bluetooth_bobby.cpp
|
||||
bmsutils.cpp
|
||||
bobbyblinker.cpp
|
||||
bobbybuttons.cpp
|
||||
bobbyhupe.cpp
|
||||
@@ -373,8 +356,6 @@ set(BOBBY_SOURCES
|
||||
screens/batteryinfodisplay.cpp
|
||||
screens/batterymenu.cpp
|
||||
screens/blesettingsmenu.cpp
|
||||
screens/bmsdisplay.cpp
|
||||
screens/bmsmenu.cpp
|
||||
screens/boardcomputerhardwaresettingsmenu.cpp
|
||||
screens/buzzermenu.cpp
|
||||
screens/calibratevoltagedisplay.cpp
|
||||
|
@@ -1,16 +0,0 @@
|
||||
#include "bluetoothbeginaction.h"
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
void BluetoothBeginAction::triggered()
|
||||
{
|
||||
if (!bluetoothSerial.begin(configs.bluetoothName.value.c_str()))
|
||||
{
|
||||
//Serial.println("Could not begin bluetooth");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <actioninterface.h>
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothBeginAction : public virtual espgui::ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override;
|
||||
};
|
||||
#endif
|
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothBeginMasterAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bluetoothSerial.begin(configs.bluetoothName.value.c_str(), true))
|
||||
{
|
||||
//Serial.println("Could not begin bluetooth master");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
class BluetoothConnectBmsAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
uint8_t remoteAddress[ESP_BD_ADDR_LEN] = {0xAA, 0xBB, 0xCC, 0xA1, 0x23, 0x45};
|
||||
if (!bluetoothSerial.connect(remoteAddress))
|
||||
{
|
||||
//Serial.println("Could not connect bluetooth to bms");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothDisconnectAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bluetoothSerial.disconnect())
|
||||
{
|
||||
//Serial.println("Could not disconnect bluetooth");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothEndAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
bluetoothSerial.end();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "globals.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothFlushAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
bluetoothSerial.flush();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "bmsutils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
class BmsTurnOffChargeAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bms::send6Bit(42405, 250, 0))
|
||||
{
|
||||
//Serial.println("Could not turn off charge mosfet");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "bmsutils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
class BmsTurnOffDischargeAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bms::send6Bit(42405, 249, 0))
|
||||
{
|
||||
//Serial.println("Could not turn off discharge mosfet");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "bmsutils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
class BmsTurnOnChargeAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bms::send6Bit(42405, 250, 1))
|
||||
{
|
||||
//Serial.println("Could not turn on charge mosfet");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "actioninterface.h"
|
||||
#include "bmsutils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BMS
|
||||
class BmsTurnOnDischargeAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override
|
||||
{
|
||||
if (!bms::send6Bit(42405, 249, 1))
|
||||
{
|
||||
//Serial.println("Could not turn on discharge mosfet");
|
||||
// TODO: better error handling
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
#include "bluetooth_bobby.h"
|
||||
|
||||
// compilation will be broken as there is no config parameter
|
||||
|
||||
// local includes
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothbeginaction.h"
|
||||
#include "actions/bluetoothbeginmasteraction.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "actions/bluetoothconnectbmsaction.h"
|
||||
#endif
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
void bluetooth_init()
|
||||
{
|
||||
if (configs.bluetooth.autoBluetoothMode.value == BluetoothMode::Master)
|
||||
{
|
||||
bootLabel.redraw("bluetooth begin master");
|
||||
BluetoothBeginMasterAction{}.triggered();
|
||||
#ifdef FEATURE_BMS
|
||||
if (configs.autoConnectBms.value)
|
||||
{
|
||||
bootLabel.redraw("connect BMS");
|
||||
BluetoothConnectBmsAction{}.triggered();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (configs.bluetooth.autoBluetoothMode.value == BluetoothMode::Slave)
|
||||
{
|
||||
bootLabel.redraw("bluetooth begin");
|
||||
BluetoothBeginAction{}.triggered();
|
||||
}
|
||||
}
|
||||
|
||||
void bluetooth_update()
|
||||
{
|
||||
}
|
||||
#endif
|
@@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
void bluetooth_init();
|
||||
void bluetooth_update();
|
||||
#endif
|
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
enum class BluetoothMode : uint8_t
|
||||
{
|
||||
Off,
|
||||
Master,
|
||||
Slave
|
||||
};
|
4
main/bmsutils.cpp
Normal file
4
main/bmsutils.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "bmsutils.h"
|
||||
|
||||
namespace bms {
|
||||
} // namespace bms
|
139
main/bmsutils.h
139
main/bmsutils.h
@@ -1,141 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include <espchrono.h>
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
namespace {
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
namespace bms {
|
||||
constexpr auto autoReconnect = false; // causes hangs when not available
|
||||
|
||||
bool lastConnected;
|
||||
espchrono::millis_clock::time_point lastSend;
|
||||
espchrono::millis_clock::time_point lastReceive;
|
||||
|
||||
float voltage;
|
||||
float current;
|
||||
float capacity;
|
||||
int8_t soc;
|
||||
float cycle;
|
||||
int16_t power;
|
||||
float batt[12];
|
||||
|
||||
bool send6Bit(int zhen_tou, int address, int data)
|
||||
{
|
||||
uint8_t buffer[6];
|
||||
buffer[0] = (char)((zhen_tou>>8)&255);
|
||||
buffer[1] = (char)(zhen_tou&255);
|
||||
buffer[2] = (char)(address&255);
|
||||
buffer[3] = (char)((data>>8)&255);
|
||||
buffer[4] = (char)(data&255);
|
||||
buffer[5] = (char)(buffer[2]+buffer[3]+buffer[4]);
|
||||
|
||||
const auto sent = bluetoothSerial.write(buffer, 6);
|
||||
if (sent != 6)
|
||||
{
|
||||
//Serial.printf("send: %u\r\n", sent);
|
||||
}
|
||||
return sent == 6;
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
|
||||
if (bluetoothSerial.hasClient() != lastConnected)
|
||||
{
|
||||
lastSend = 0;
|
||||
lastConnected = bluetoothSerial.hasClient();
|
||||
}
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
{
|
||||
if (bluetoothSerial.available() >= 140)
|
||||
{
|
||||
uint8_t buffer[140];
|
||||
const auto read = bluetoothSerial.readBytes(buffer, 140);
|
||||
if (read != 140)
|
||||
{
|
||||
//Serial.printf("bms read buffer too short %u\r\n", read);
|
||||
|
||||
for (int i = 0; i < read; i++)
|
||||
{
|
||||
//Serial.printf("%i ", buffer[i]);
|
||||
}
|
||||
//Serial.println();
|
||||
|
||||
goto after_read;
|
||||
}
|
||||
|
||||
if (buffer[0] != 170 ||
|
||||
buffer[1] != 85 ||
|
||||
buffer[2] != 170 ||
|
||||
buffer[3] != 255)
|
||||
{
|
||||
//Serial.println("bms read buffer wrong sequence");
|
||||
|
||||
for (const auto &x : buffer)
|
||||
{
|
||||
//Serial.printf("%i ", x);
|
||||
}
|
||||
//Serial.println();
|
||||
|
||||
goto after_read;
|
||||
}
|
||||
|
||||
lastReceive = now;
|
||||
|
||||
voltage = static_cast<int16_t>((buffer[4] << 8) | buffer[5]) / 10.f;
|
||||
current = static_cast<int16_t>((buffer[72] << 8) | buffer[73]) / 10.f;
|
||||
capacity = static_cast<int32_t>((((((buffer[79] << 8) | buffer[80]) << 8) | buffer[81]) << 8) | buffer[82]) / 1000.f;
|
||||
soc = buffer[74];
|
||||
cycle = static_cast<int32_t>((((((buffer[83] << 8) | buffer[84]) << 8) | buffer[85]) << 8) | buffer[86]) / 1000.f;
|
||||
power = (buffer[113] << 8) | buffer[114];
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
batt[i] = ((buffer[(i*2)+6] * 256) + buffer[(i*2)+7]) / 1000.f;
|
||||
}
|
||||
// else if (bluetoothSerial.available())
|
||||
// {
|
||||
// //Serial.printf("available() = %i\r\n", bluetoothSerial.available());
|
||||
// while (bluetoothSerial.available())
|
||||
// {
|
||||
// //Serial.printf("%i ", bluetoothSerial.read());
|
||||
// }
|
||||
// //Serial.println();
|
||||
// }
|
||||
|
||||
after_read:
|
||||
|
||||
if (!lastSend || now-lastSend >= 1000)
|
||||
{
|
||||
//Serial.println("requresting bms live values");
|
||||
if (!send6Bit(56283, 0, 0))
|
||||
{
|
||||
//Serial.println("could not request bms live values");
|
||||
}
|
||||
lastSend = now;
|
||||
}
|
||||
}
|
||||
else if (autoReconnect)
|
||||
{
|
||||
if (!lastSend || now-lastSend >= 500)
|
||||
{
|
||||
uint8_t remoteAddress[ESP_BD_ADDR_LEN] = {0xAA, 0xBB, 0xCC, 0xA1, 0x23, 0x45};
|
||||
//Serial.println("connect()");
|
||||
const auto result = bluetoothSerial.connect(remoteAddress);
|
||||
//Serial.printf("connect() returned %s\r\n", result?"true":"false");
|
||||
|
||||
lastSend = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace bms
|
||||
|
@@ -1,53 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// local includes
|
||||
#include "changevaluedisplay.h"
|
||||
#include "menudisplay.h"
|
||||
#include "utils.h"
|
||||
#include "actions/setvalueaction.h"
|
||||
#include "actions/backproxyaction.h"
|
||||
#include "icons/back.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
|
||||
namespace espgui {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<>
|
||||
class ChangeValueDisplay<BluetoothMode> :
|
||||
public MenuDisplay,
|
||||
public virtual AccessorInterface<BluetoothMode>,
|
||||
public virtual ActionInterface
|
||||
{
|
||||
using Base = MenuDisplay;
|
||||
|
||||
public:
|
||||
ChangeValueDisplay();
|
||||
|
||||
void start() override;
|
||||
};
|
||||
|
||||
ChangeValueDisplay<BluetoothMode>::ChangeValueDisplay()
|
||||
{
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BluetoothMode>, StaticText<TEXT_OFF>>>(BluetoothMode::Off, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BluetoothMode>, StaticText<TEXT_MASTER>>>(BluetoothMode::Master, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BluetoothMode>, StaticText<TEXT_SLAVE>>>(BluetoothMode::Slave, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&bobbyicons::back>>>(*this);
|
||||
}
|
||||
|
||||
void ChangeValueDisplay<BluetoothMode>::start()
|
||||
{
|
||||
Base::start();
|
||||
|
||||
switch (const auto value = getValue())
|
||||
{
|
||||
case BluetoothMode::Off: setSelectedIndex(0); break;
|
||||
case BluetoothMode::Master: setSelectedIndex(1); break;
|
||||
case BluetoothMode::Slave: setSelectedIndex(2); break;
|
||||
default:
|
||||
//Serial.printf("Unknown BluetoothMode: %i\r\n", int(value));
|
||||
setSelectedIndex(4);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace espgui
|
@@ -48,10 +48,5 @@ std::atomic<int8_t> buttonRequest;
|
||||
bool initScreenRequest{false};
|
||||
|
||||
Controllers controllers;
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
BluetoothSerial bluetoothSerial;
|
||||
#endif
|
||||
|
||||
ModeInterface *lastMode{};
|
||||
ModeInterface *currentMode{};
|
||||
|
@@ -7,9 +7,6 @@
|
||||
#include <optional>
|
||||
|
||||
// Arduino includes
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include <BluetoothSerial.h>
|
||||
#endif
|
||||
#ifdef FEATURE_SERIAL
|
||||
#include <HardwareSerial.h>
|
||||
#endif
|
||||
@@ -123,10 +120,6 @@ extern Controllers controllers;
|
||||
struct FrontControllerGetter { static Controller &get() { return controllers.front; }};
|
||||
struct BackControllerGetter { static Controller &get() { return controllers.back; }};
|
||||
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
extern BluetoothSerial bluetoothSerial;
|
||||
#endif
|
||||
|
||||
extern ModeInterface *lastMode;
|
||||
extern ModeInterface *currentMode;
|
||||
|
||||
|
@@ -1,63 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// compilation will be broken as there is no config parameter
|
||||
|
||||
// local includes
|
||||
#include "changevaluedisplay.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "changevaluedisplay_bluetoothmode.h"
|
||||
#endif
|
||||
#include "guihelpers/bobbymenudisplay.h"
|
||||
#include "menuitem.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "actions/bluetoothbeginaction.h"
|
||||
#include "actions/bluetoothbeginmasteraction.h"
|
||||
#include "actions/bluetoothflushaction.h"
|
||||
#include "actions/bluetoothendaction.h"
|
||||
#include "actions/bluetoothdisconnectaction.h"
|
||||
#endif
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "texthelpers/bluetoothtexthelpers.h"
|
||||
#include "accessors/settingsaccessors.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
using namespace espgui;
|
||||
using namespace bluetoothtexthelpers;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
class BluetoothSettingsMenu;
|
||||
|
||||
//using AutoBluetoothModeChangeDisplay = makeComponent<
|
||||
// ChangeValueDisplay<BluetoothMode>,
|
||||
// StaticText<TEXT_AUTOBLUETOOTHMODE>,
|
||||
// AutoBluetoothModeAccessor,
|
||||
// BackActionInterface<SwitchScreenAction<BluetoothSettingsMenu>>,
|
||||
// SwitchScreenAction<BluetoothSettingsMenu>
|
||||
//>;
|
||||
|
||||
class BluetoothSettingsMenu :
|
||||
public BobbyMenuDisplay,
|
||||
public StaticText<TEXT_BLUETOOTHSETTINGS>,
|
||||
public BackActionInterface<SwitchScreenAction<SettingsMenu>>
|
||||
{
|
||||
public:
|
||||
BluetoothSettingsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, BluetoothAvailableText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, BluetoothHasClientText, DisabledColor, DummyAction>>();
|
||||
// constructMenuItem<makeComponent<MenuItem, BluetoothConnectedText, DisabledColor, DummyAction>>(); // crashes
|
||||
constructMenuItem<makeComponent<MenuItem, BluetoothIsReadyText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, BluetoothIsReadyMasterText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHBEGIN>, BluetoothBeginAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHBEGINMASTER>, BluetoothBeginMasterAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHFLUSH>, BluetoothFlushAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHEND>, BluetoothEndAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHDISCONNECT>, BluetoothDisconnectAction>>();
|
||||
// constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_AUTOBLUETOOTHMODE>, SwitchScreenAction<AutoBluetoothModeChangeDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<SettingsMenu>, StaticMenuItemIcon<&bobbyicons::back>>>();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
} // namespace
|
@@ -1,110 +0,0 @@
|
||||
#include "bmsdisplay.h"
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
#include "screens/mainmenu.h"
|
||||
#include "screens/speedinfodisplay.h"
|
||||
#include "screens/statusdisplay.h"
|
||||
#include "screenmanager.h"
|
||||
#include "guihelpers/bobbymenudisplay.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
void BmsDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
tft.setTextFont(2);
|
||||
m_statusLabel.start();
|
||||
m_statusLabel.redraw("init");
|
||||
|
||||
tft.setTextFont(4);
|
||||
tft.drawString("Voltage:", 0, m_voltageLabel.y());
|
||||
m_voltageLabel.start();
|
||||
tft.drawString("Capacity:", 0, m_capacityLabel.y());
|
||||
m_capacityLabel.start();
|
||||
tft.drawString("SOC:", 0, m_socLabel.y());
|
||||
m_socLabel.start();
|
||||
tft.drawString("Power:", 0, m_powerLabel.y());
|
||||
m_powerLabel.start();
|
||||
tft.drawString("Current:", 0, m_currentLabel.y());
|
||||
m_currentLabel.start();
|
||||
tft.drawString("Speed:", 0, m_speedLabel.y());
|
||||
m_speedLabel.start();
|
||||
tft.drawString("PpS:", 0, m_powerPerSpeedLabel.y());
|
||||
m_powerPerSpeedLabel.start();
|
||||
|
||||
for (auto &label : m_battLabels)
|
||||
label.start();
|
||||
|
||||
tft.drawString("Cycle:", 0, m_cycleLabel.y());
|
||||
m_cycleLabel.start();
|
||||
}
|
||||
|
||||
void BmsDisplay::redraw()
|
||||
{
|
||||
Base::redraw();
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
else
|
||||
{
|
||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
tft.setTextFont(2);
|
||||
}
|
||||
|
||||
m_statusLabel.redraw(bluetoothSerial.hasClient() ? "OK" : "FAIL");
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
if (!bluetoothSerial.hasClient())
|
||||
tft.setTextFont(4);
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
{
|
||||
m_voltageLabel.redraw(fmt::format("{:.02f}V", bms::voltage));
|
||||
m_capacityLabel.redraw(fmt::format("{:.02f} mAh", bms::capacity));
|
||||
m_socLabel.redraw(fmt::format("{:.02f}%", bms::soc));
|
||||
m_powerLabel.redraw(fmt::format("{:.02f}W", bms::power));
|
||||
m_currentLabel.redraw(fmt::format("{:.02f}A", bms::current));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_voltageLabel.clear();
|
||||
m_capacityLabel.clear();
|
||||
m_socLabel.clear();
|
||||
m_powerLabel.clear();
|
||||
m_currentLabel.clear();
|
||||
}
|
||||
|
||||
m_speedLabel.redraw(fmt::format("{:.02f}kmh", avgSpeedKmh));
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
m_powerPerSpeedLabel.redraw(fmt::format("{:.02f}W/kmh", avgSpeedKmh < 1 ? 0 : bms::power / avgSpeedKmh));
|
||||
else
|
||||
m_powerPerSpeedLabel.clear();
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
m_battLabels[i].redraw(fmt::format("{:.02f}", bms::batt[i]));
|
||||
|
||||
if (bluetoothSerial.hasClient())
|
||||
m_cycleLabel.redraw(fmt::format("{:.02f}AH", bms::cycle));
|
||||
else
|
||||
m_cycleLabel.clear();
|
||||
}
|
||||
|
||||
void BmsDisplay::buttonPressed(espgui::Button button)
|
||||
{
|
||||
Base::buttonPressed(button);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
using espgui::Button;
|
||||
case Button::Right: pushScreen<MainMenu>(); break;
|
||||
case Button::Up: switchScreen<SpeedInfoDisplay>(); break;
|
||||
case Button::Down: switchScreen<StatusDisplay>(); break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,44 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
// 3rdparty lib includes
|
||||
#include <fmt/core.h>
|
||||
#include <widgets/label.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "bmsutils.h"
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
class BmsDisplay :
|
||||
public BobbyDisplay,
|
||||
public espgui::DummyBack
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
|
||||
public:
|
||||
void initScreen() override;
|
||||
void redraw() override;
|
||||
|
||||
void buttonPressed(espgui::Button button) override;
|
||||
|
||||
espgui::Label m_statusLabel{200, 0};
|
||||
|
||||
espgui::Label m_voltageLabel{107, 0};
|
||||
espgui::Label m_capacityLabel{107, 25};
|
||||
espgui::Label m_socLabel{107, 50};
|
||||
espgui::Label m_powerLabel{107, 75};
|
||||
espgui::Label m_currentLabel{107, 100};
|
||||
espgui::Label m_speedLabel{107, 125};
|
||||
espgui::Label m_powerPerSpeedLabel{107, 150};
|
||||
|
||||
std::array<espgui::Label, 12> m_battLabels{{
|
||||
espgui::Label{0, 225}, espgui::Label{60, 225}, espgui::Label{120, 225}, espgui::Label{180, 225},
|
||||
espgui::Label{0, 250}, espgui::Label{60, 250}, espgui::Label{120, 250}, espgui::Label{180, 250},
|
||||
espgui::Label{0, 275}, espgui::Label{60, 275}, espgui::Label{120, 275}, espgui::Label{180, 275}
|
||||
}};
|
||||
|
||||
espgui::Label m_cycleLabel{105, 300};
|
||||
};
|
||||
#endif
|
@@ -1,36 +0,0 @@
|
||||
#include "bmsmenu.h"
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
// local includes
|
||||
#include "menuitem.h"
|
||||
#include "actions/bluetoothconnectbmsaction.h"
|
||||
#include "actions/bluetoothdisconnectaction.h"
|
||||
#include "actions/dummyaction.h"
|
||||
#include "actions/bmsturnonchargeaction.h"
|
||||
#include "actions/bmsturnoffchargeaction.h"
|
||||
#include "actions/bmsturnondischargeaction.h"
|
||||
#include "actions/bmsturnoffdischargeaction.h"
|
||||
#include "actions/popscreenaction.h"
|
||||
#include "bluetoothtexthelpers.h"
|
||||
#include "icons/back.h"
|
||||
|
||||
using namespace espgui;
|
||||
using namespace bluetoothtexthelpers;
|
||||
|
||||
BmsMenu::BmsMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CONNECTBMS>, BluetoothConnectBmsAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DISCONNECTBMS>, BluetoothDisconnectAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, BluetoothHasClientText, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TURNONCHARGE>, BmsTurnOnChargeAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TURNOFFCHARGE>, BmsTurnOffChargeAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TURNONDISCHARGE>, BmsTurnOnDischargeAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TURNOFFDISCHARGE>, BmsTurnOffDischargeAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&bobbyicons::back>>>();
|
||||
}
|
||||
|
||||
void BmsMenu::back()
|
||||
{
|
||||
popSreen();
|
||||
}
|
||||
#endif
|
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
// local includes
|
||||
#include "guihelpers/bobbymenudisplay.h"
|
||||
|
||||
class BmsMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
BmsMenu();
|
||||
|
||||
std::string text() const override { return TEXT_BMS; }
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
@@ -27,10 +27,6 @@ constexpr char TEXT_SUMCURRENT[] = "Sum current";
|
||||
constexpr char TEXT_FRONTVOLTAGE[] = "Front voltage";
|
||||
constexpr char TEXT_BACKVOLTAGE[] = "Back voltage";
|
||||
constexpr char TEXT_VOLTAGES[] = "Voltages";
|
||||
constexpr char TEXT_BMSVOLTAGE[] = "BMS voltage";
|
||||
constexpr char TEXT_BMSCURRENT[] = "BMS current";
|
||||
constexpr char TEXT_BMSPOWER[] = "BMS power";
|
||||
constexpr char TEXT_SUMCURRENTSCOMPARISON[] = "Sum currents comparison";
|
||||
constexpr char TEXT_MOTORCURRENTS[] = "Motor currents";
|
||||
constexpr char TEXT_RSSI[] = "RSSI";
|
||||
constexpr char TEXT_BACK[] = "Back";
|
||||
@@ -132,37 +128,6 @@ using VoltagesSplitGraphDisplay = espgui::makeComponent<
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
|
||||
#ifdef FEATURE_BMS
|
||||
using BmsVoltageGraphDisplay = espgui::makeComponent<
|
||||
BobbyGraphDisplay<1>,
|
||||
espgui::StaticText<TEXT_BMSVOLTAGE>,
|
||||
espgui::SingleGraphAccessor<BmsVoltageStatistics>,
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using BmsCurrentGraphDisplay = espgui::makeComponent<
|
||||
BobbyGraphDisplay<1>,
|
||||
espgui::StaticText<TEXT_BMSCURRENT>,
|
||||
espgui::SingleGraphAccessor<BmsCurrentStatistics>,
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using BmsPowerGraphDisplay = espgui::makeComponent<
|
||||
BobbyGraphDisplay<1>,
|
||||
espgui::StaticText<TEXT_BMSPOWER>,
|
||||
espgui::SingleGraphAccessor<BmsPowerStatistics>,
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
using SumCurrentsComparisonGraphDisplay = espgui::makeComponent<
|
||||
BobbyGraphDisplay<2>,
|
||||
espgui::StaticText<TEXT_SUMCURRENTSCOMPARISON>,
|
||||
DualGraphAccessor<SumCurrentStatistics, BmsCurrentStatistics>,
|
||||
espgui::ConfirmActionInterface<espgui::PopScreenAction>,
|
||||
espgui::BackActionInterface<espgui::PopScreenAction>
|
||||
>;
|
||||
#endif
|
||||
|
||||
class MotorCurrentsStatistics : public virtual espgui::GraphAccessorInterface<4>
|
||||
{
|
||||
std::array<std::reference_wrapper<const statistics::ContainerType>, 4> getBuffers() const override
|
||||
@@ -203,12 +168,6 @@ GraphsMenu::GraphsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACKVOLTAGE>, PushScreenAction<BackVoltageGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VOLTAGES>, PushScreenAction<VoltagesGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VOLTAGES>, PushScreenAction<VoltagesSplitGraphDisplay>>>();
|
||||
#ifdef FEATURE_BMS
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMSVOLTAGE>, PushScreenAction<BmsVoltageGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMSCURRENT>, PushScreenAction<BmsCurrentGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMSPOWER>, PushScreenAction<BmsPowerGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SUMCURRENTSCOMPARISON>, PushScreenAction<SumCurrentsComparisonGraphDisplay>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOTORCURRENTS>, PushScreenAction<MotorCurrentsGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_RSSI>, PushScreenAction<RssiGraphDisplay>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, PopScreenAction, StaticMenuItemIcon<&bobbyicons::back>>>();
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "screens/graphsmenu.h"
|
||||
#include "screens/batterymenu.h"
|
||||
#include "screens/powersupplydisplay.h"
|
||||
#include "screens/bmsmenu.h"
|
||||
#include "screens/settingsmenu.h"
|
||||
#include "screens/manageprofilesmenu.h"
|
||||
#include "screens/mosfetsmenu.h"
|
||||
@@ -31,9 +30,6 @@
|
||||
#include "icons/modes.h"
|
||||
#include "icons/presets.h"
|
||||
#include "icons/graph.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "icons/bms.h"
|
||||
#endif
|
||||
#include "icons/settings.h"
|
||||
#include "icons/lock.h"
|
||||
#include "icons/demos.h"
|
||||
@@ -59,11 +55,9 @@ constexpr char TEXT_LEDSTRIP[] = "Ledstrip";
|
||||
constexpr char TEXT_STATISTICSMENU[] = "Statistics";
|
||||
constexpr char TEXT_SELECTMODE[] = "Select mode";
|
||||
constexpr char TEXT_MODESETTINGS[] = "Mode settings";
|
||||
constexpr char TEXT_PRESETS[] = "Presets";
|
||||
constexpr char TEXT_PROFILES[] = "Profiles";
|
||||
constexpr char TEXT_GRAPHS[] = "Graphs";
|
||||
constexpr char TEXT_POWERSUPPLY[] = "Powersupply";
|
||||
constexpr char TEXT_BMS[] = "BMS";
|
||||
constexpr char TEXT_SETTINGS[] = "Settings";
|
||||
constexpr char TEXT_GREENPASS[] = "Green Pass";
|
||||
constexpr char TEXT_LOCKVEHICLE[] = "Lock vehicle";
|
||||
@@ -111,9 +105,6 @@ MainMenu::MainMenu()
|
||||
#endif
|
||||
#ifdef FEATURE_MOSFETS
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MOSFETS>, PushScreenAction<MosfetsMenu>>>();
|
||||
#endif
|
||||
#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BMS>, PushScreenAction<BmsMenu>, StaticMenuItemIcon<&bobbyicons::bms>>>();
|
||||
#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DEMOS>, PushScreenAction<DemosMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_PROFILES>, PushScreenAction<ProfilesMenu>, StaticMenuItemIcon<&bobbyicons::presets>>>(); }
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "icons/wifi.h"
|
||||
#include "screens/aboutmenu.h"
|
||||
#include "screens/blesettingsmenu.h"
|
||||
#include "screens/bluetoothsettingsmenu.h"
|
||||
#include "screens/boardcomputerhardwaresettingsmenu.h"
|
||||
#include "screens/buzzermenu.h"
|
||||
#include "screens/cloudsettingsmenu.h"
|
||||
@@ -48,7 +47,6 @@ constexpr char TEXT_BACKLIGHT[] = "Backlight";
|
||||
constexpr char TEXT_LIMITSSETTINGS[] = "Limits settings";
|
||||
constexpr char TEXT_NETWORKSETTINGS[] = "Network settings";
|
||||
constexpr char TEXT_ESPNOW[] = "ESPNOW settings";
|
||||
constexpr char TEXT_BLUETOOTHSETTINGS[] = "Bluetooth settings";
|
||||
constexpr char TEXT_BLESETTINGS[] = "BLE settings";
|
||||
constexpr char TEXT_CLOUDSETTINGS[] = "Cloud settings";
|
||||
constexpr char TEXT_UDPCLOUDSETTINGS[] = "UDP Cloud settings";
|
||||
@@ -60,7 +58,6 @@ constexpr char TEXT_BOARDCOMPUTERHARDWARESETTINGS[] = "Boardcomputer H/W setting
|
||||
constexpr char TEXT_FEATUREFLAGS[] = "Feature flags";
|
||||
constexpr char TEXT_USERNAME[] = "Username"; // ota-name
|
||||
constexpr char TEXT_ANHAENGER_ID[] = "Anhaenger ID";
|
||||
constexpr char TEXT_AUTOCONNECTBMS[] = "Auto connect BMS";
|
||||
constexpr char TEXT_BUZZER[] = "Buzzer";
|
||||
constexpr char TEXT_FRONTLED[] = "Front LED";
|
||||
constexpr char TEXT_BACKLED[] = "Back LED";
|
||||
@@ -109,9 +106,6 @@ SettingsMenu::SettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_NETWORKSETTINGS>, PushScreenAction<NetworkSettingsMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
|
||||
if (configs.feature.esp_now.isEnabled.value())
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ESPNOW>, PushScreenAction<EspNowMenu>, StaticMenuItemIcon<&bobbyicons::wifi>>>();
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLUETOOTHSETTINGS>, PushScreenAction<BluetoothSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
#endif
|
||||
if (configs.feature.ble.isEnabled.value())
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BLESETTINGS>, PushScreenAction<BleSettingsMenu>, StaticMenuItemIcon<&bobbyicons::bluetooth>>>();
|
||||
if (configs.feature.cloud.isEnabled.value())
|
||||
@@ -130,9 +124,6 @@ SettingsMenu::SettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FEATUREFLAGS>, PushScreenAction<FeatureFlagsMenu>, StaticMenuItemIcon<&bobbyicons::demos>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_USERNAME>, PushScreenAction<UsernameChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_ANHAENGER_ID, AnhaengerIdAccessor>, PushScreenAction<AnhaengerIdChangeScreen>>>();
|
||||
//#if defined(FEATURE_BLUETOOTH) && defined(FEATURE_BMS)
|
||||
// constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_AUTOCONNECTBMS>, BobbyCheckbox, AutoConnectBmsAccessor>>();
|
||||
//#endif
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BUZZER>, PushScreenAction<BuzzerMenu>, StaticMenuItemIcon<&bobbyicons::buzzer>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_FRONTLED>, BobbyCheckbox, FrontLedAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACKLED>, BobbyCheckbox, BackLedAccessor>>();
|
||||
|
@@ -85,11 +85,7 @@ void SpeedInfoDisplay::buttonPressed(espgui::Button button)
|
||||
espgui::switchScreen<BatteryInfoDisplay>();
|
||||
break;
|
||||
case Button::Down:
|
||||
#ifdef FEATURE_BMS
|
||||
espgui::switchScreen<BmsDisplay>();
|
||||
#else
|
||||
espgui::switchScreen<StatusDisplay>();
|
||||
#endif
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
@@ -10,16 +10,13 @@
|
||||
#include <tftinterface.h>
|
||||
|
||||
// local includes
|
||||
#include "screens/batteryinfodisplay.h"
|
||||
#include "screens/speedinfodisplay.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "screens/bmsdisplay.h"
|
||||
#endif
|
||||
#include "screens/mainmenu.h"
|
||||
#include "screens/metersdisplay.h"
|
||||
#include "drivingstatistics.h"
|
||||
#include "modes/defaultmode.h"
|
||||
#include "newsettings.h"
|
||||
#include "screens/batteryinfodisplay.h"
|
||||
#include "screens/mainmenu.h"
|
||||
#include "screens/metersdisplay.h"
|
||||
#include "screens/speedinfodisplay.h"
|
||||
#include "taskmanager.h"
|
||||
#include "udpcloud.h"
|
||||
|
||||
@@ -217,11 +214,7 @@ void StatusDisplay::buttonPressed(espgui::Button button)
|
||||
case Button::Up:
|
||||
if (simplified)
|
||||
return;
|
||||
#ifdef FEATURE_BMS
|
||||
switchScreen<BmsDisplay>();
|
||||
#else
|
||||
switchScreen<SpeedInfoDisplay>();
|
||||
#endif
|
||||
break;
|
||||
case Button::Down:
|
||||
if (simplified)
|
||||
|
@@ -16,9 +16,6 @@
|
||||
|
||||
// local includes
|
||||
#include "profilesettings.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetoothmode.h"
|
||||
#endif
|
||||
#include "unifiedmodelmode.h"
|
||||
#include "globals.h"
|
||||
|
||||
@@ -140,16 +137,6 @@ template<> struct nvsGetterHelper<LarsmModeMode> { static esp_err_t nvs_get(nvs_
|
||||
*out_value = LarsmModeMode(tempValue);
|
||||
return err;
|
||||
}};
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> struct nvsGetterHelper<BluetoothMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, BluetoothMode* out_value)
|
||||
{
|
||||
uint8_t tempValue;
|
||||
esp_err_t err = nvs_get_u8(handle, key, &tempValue);
|
||||
if (err == ESP_OK)
|
||||
*out_value = BluetoothMode(tempValue);
|
||||
return err;
|
||||
}};
|
||||
#endif
|
||||
template<> struct nvsGetterHelper<UnifiedModelMode> { static esp_err_t nvs_get(nvs_handle handle, const char* key, UnifiedModelMode* out_value)
|
||||
{
|
||||
uint8_t tempValue;
|
||||
@@ -283,12 +270,6 @@ template<> struct nvsSetterHelper<LarsmModeMode> { static esp_err_t nvs_set(nvs_
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
}};
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<> struct nvsSetterHelper<BluetoothMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, BluetoothMode value)
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
}};
|
||||
#endif
|
||||
template<> struct nvsSetterHelper<UnifiedModelMode> { static esp_err_t nvs_set(nvs_handle handle, const char* key, UnifiedModelMode value)
|
||||
{
|
||||
return nvs_set_u8(handle, key, uint8_t(value));
|
||||
|
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace statistics {
|
||||
ContainerType raw_gas, raw_brems, gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
|
||||
#ifdef FEATURE_BMS
|
||||
bmsVoltage, bmsCurrent, bmsPower,
|
||||
#endif
|
||||
rssi;
|
||||
} // namespace statistics
|
||||
|
||||
@@ -33,11 +30,6 @@ void pushStats()
|
||||
statistics::backLeftCurrent.push_back(fixCurrent(controllers.back.feedback.left.dcLink));
|
||||
statistics::backRightCurrent.push_back(fixCurrent(controllers.back.feedback.right.dcLink));
|
||||
}
|
||||
#ifdef FEATURE_BMS
|
||||
statistics::bmsVoltage.push_back(bms::voltage);
|
||||
statistics::bmsCurrent.push_back(bms::current);
|
||||
statistics::bmsPower.push_back(bms::power);
|
||||
#endif
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
|
@@ -6,15 +6,11 @@
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "bmsutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace statistics {
|
||||
using ContainerType = ring_buffer<float, 200>;
|
||||
extern ContainerType raw_gas, raw_brems, gas, brems, avgSpeed, avgSpeedKmh, sumCurrent, frontVoltage, backVoltage, frontLeftCurrent, frontRightCurrent, backLeftCurrent, backRightCurrent,
|
||||
#ifdef FEATURE_BMS
|
||||
bmsVoltage, bmsCurrent, bmsPower,
|
||||
#endif
|
||||
rssi;
|
||||
} // namespace statistics
|
||||
|
||||
@@ -42,11 +38,6 @@ using AvgSpeedKmhStatistics = BufferAccessorImpl<statistics::avgSpeedKmh>;
|
||||
using SumCurrentStatistics = BufferAccessorImpl<statistics::sumCurrent>;
|
||||
using FrontVoltageStatistics = BufferAccessorImpl<statistics::frontVoltage>;
|
||||
using BackVoltageStatistics = BufferAccessorImpl<statistics::backVoltage>;
|
||||
#ifdef FEATURE_BMS
|
||||
using BmsVoltageStatistics = BufferAccessorImpl<statistics::bmsVoltage>;
|
||||
using BmsCurrentStatistics = BufferAccessorImpl<statistics::bmsCurrent>;
|
||||
using BmsPowerStatistics = BufferAccessorImpl<statistics::bmsPower>;
|
||||
#endif
|
||||
using FrontLeftCurrentStatistics = BufferAccessorImpl<statistics::frontLeftCurrent>;
|
||||
using FrontRightCurrentStatistics = BufferAccessorImpl<statistics::frontRightCurrent>;
|
||||
using BackLeftCurrentStatistics = BufferAccessorImpl<statistics::backLeftCurrent>;
|
||||
|
@@ -18,12 +18,6 @@
|
||||
#endif
|
||||
#include "time_bobbycar.h"
|
||||
#include "potis.h"
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
#include "bluetooth_bobby.h"
|
||||
#ifdef FEATURE_BMS
|
||||
#include "bmsutils.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FEATURE_CAN
|
||||
#include "can.h"
|
||||
#endif
|
||||
@@ -65,12 +59,6 @@ BobbySchedulerTask schedulerTasksArr[] {
|
||||
#endif
|
||||
BobbySchedulerTask { "time", initTime, updateTime, 100ms, false },
|
||||
BobbySchedulerTask { "potis", initPotis, readPotis, 20ms, false },
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
BobbySchedulerTask { "bluetooth", bluetooth_init, bluetooth_update, 100ms, false },
|
||||
#ifdef FEATURE_BMS
|
||||
BobbySchedulerTask { "bms", bms::init, bms::update, 100ms, false },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FEATURE_CAN
|
||||
BobbySchedulerTask { "can", can::initCan, can::updateCan, 10ms, false },
|
||||
#endif
|
||||
|
@@ -1,43 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "fmt/core.h"
|
||||
|
||||
// local includes
|
||||
#include "textinterface.h"
|
||||
#include "globals.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace bluetoothtexthelpers {
|
||||
#ifdef FEATURE_BLUETOOTH
|
||||
template<const char *Ttext, typename TreturnType, TreturnType (BluetoothSerial::*Tmethod)()>
|
||||
using BluetoothStatusTextHelper = StatusTextHelper<Ttext, BluetoothSerial, &bluetoothSerial, TreturnType, Tmethod>;
|
||||
|
||||
constexpr char TEXT_BLUETOOTHAVAILABLE[] = "Available: ";
|
||||
using BluetoothAvailableText = BluetoothStatusTextHelper<TEXT_BLUETOOTHAVAILABLE, int, &BluetoothSerial::available>;
|
||||
|
||||
constexpr char TEXT_BLUETOOTHHASCLIENT[] = "Has client: ";
|
||||
using BluetoothHasClientText = BluetoothStatusTextHelper<TEXT_BLUETOOTHHASCLIENT, bool, &BluetoothSerial::hasClient>;
|
||||
|
||||
//constexpr char TEXT_BLUETOOTHCONNECTED[] = "Connected: ";
|
||||
//using BluetoothConnectedText = BluetoothStatusTextHelper<TEXT_BLUETOOTHCONNECTED, bool, &BluetoothSerial::connected>;
|
||||
struct BluetoothConnectedText : public virtual TextInterface {
|
||||
public:
|
||||
std::string text() const override { return fmt::format("{}: {}", TEXT_BLUETOOTHCONNECTED, to_string(bluetoothSerial.connected())); }
|
||||
};
|
||||
|
||||
//constexpr char TEXT_BLUETOOTHISREADY[] = "Is ready: ";
|
||||
//using BluetoothIsReadyText = BluetoothStatusTextHelper<TEXT_BLUETOOTHISREADY, bool, &BluetoothSerial::isReady>;
|
||||
struct BluetoothIsReadyText : public virtual TextInterface {
|
||||
public:
|
||||
std::string text() const override { return fmt::format("{}: {}", TEXT_BLUETOOTHISREADY, to_string(bluetoothSerial.isReady())); }
|
||||
};
|
||||
|
||||
//constexpr char TEXT_BLUETOOTHISREADYMASTER[] = "Is ready (M): ";
|
||||
//using BluetoothIsReadyMasterText = BluetoothStatusTextHelper<TEXT_BLUETOOTHISREADYMASTER, bool, &BluetoothSerial::isReady>;
|
||||
class BluetoothIsReadyMasterText : public virtual TextInterface {
|
||||
public:
|
||||
std::string text() const override { return fmt::format("{}: {}", TEXT_BLUETOOTHISREADYMASTER, to_string(bluetoothSerial.isReady(true))); }
|
||||
};
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user