mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 03:50:13 +02:00
Adding the ability to set default configuration for specific hardware such as a 16mhz crystal for the Lilygo T-2CAN
This commit is contained in:
parent
4e0ea84fad
commit
588c78f1d6
3 changed files with 12 additions and 0 deletions
|
@ -33,6 +33,8 @@ void init_stored_settings() {
|
||||||
settings.putBool("EQUIPMENT_STOP", datalayer.system.settings.equipment_stop_active);
|
settings.putBool("EQUIPMENT_STOP", datalayer.system.settings.equipment_stop_active);
|
||||||
#endif // LOAD_SAVED_SETTINGS_ON_BOOT
|
#endif // LOAD_SAVED_SETTINGS_ON_BOOT
|
||||||
|
|
||||||
|
esp32hal->set_default_configuration_values();
|
||||||
|
|
||||||
char tempSSIDstring[63]; // Allocate buffer with sufficient size
|
char tempSSIDstring[63]; // Allocate buffer with sufficient size
|
||||||
size_t lengthSSID = settings.getString("SSID", tempSSIDstring, sizeof(tempSSIDstring));
|
size_t lengthSSID = settings.getString("SSID", tempSSIDstring, sizeof(tempSSIDstring));
|
||||||
if (lengthSSID > 0) { // Successfully read the string from memory. Set it to SSID!
|
if (lengthSSID > 0) { // Successfully read the string from memory. Set it to SSID!
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../../src/devboard/utils/events.h"
|
#include "../../../src/devboard/utils/events.h"
|
||||||
#include "../../../src/devboard/utils/logging.h"
|
#include "../../../src/devboard/utils/logging.h"
|
||||||
#include "../../../src/devboard/utils/types.h"
|
#include "../../../src/devboard/utils/types.h"
|
||||||
|
#include <src/communication/nvm/comm_nvm.h>
|
||||||
|
|
||||||
// Hardware Abstraction Layer base class.
|
// Hardware Abstraction Layer base class.
|
||||||
// Derive a class to define board-specific parameters such as GPIO pin numbers
|
// Derive a class to define board-specific parameters such as GPIO pin numbers
|
||||||
|
@ -24,6 +25,8 @@ class Esp32Hal {
|
||||||
virtual int MODBUS_CORE() { return 0; }
|
virtual int MODBUS_CORE() { return 0; }
|
||||||
virtual int WIFICORE() { return 0; }
|
virtual int WIFICORE() { return 0; }
|
||||||
|
|
||||||
|
virtual void set_default_configuration_values(){}
|
||||||
|
|
||||||
template <typename... Pins>
|
template <typename... Pins>
|
||||||
bool alloc_pins(const char* name, Pins... pins) {
|
bool alloc_pins(const char* name, Pins... pins) {
|
||||||
std::vector<gpio_num_t> requested_pins = {static_cast<gpio_num_t>(pins)...};
|
std::vector<gpio_num_t> requested_pins = {static_cast<gpio_num_t>(pins)...};
|
||||||
|
|
|
@ -7,6 +7,13 @@ class LilyGo2CANHal : public Esp32Hal {
|
||||||
public:
|
public:
|
||||||
const char* name() { return "LilyGo T_2CAN"; }
|
const char* name() { return "LilyGo T_2CAN"; }
|
||||||
|
|
||||||
|
virtual void set_default_configuration_values() {
|
||||||
|
BatteryEmulatorSettingsStore settings;
|
||||||
|
if(!settings.settingExists("CANFREQ")){
|
||||||
|
settings.saveUInt("CANFREQ", 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual gpio_num_t CAN_TX_PIN() { return GPIO_NUM_7; }
|
virtual gpio_num_t CAN_TX_PIN() { return GPIO_NUM_7; }
|
||||||
virtual gpio_num_t CAN_RX_PIN() { return GPIO_NUM_6; }
|
virtual gpio_num_t CAN_RX_PIN() { return GPIO_NUM_6; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue