Remove USER_SETTINGS for good

This commit is contained in:
Daniel Öster 2025-09-02 21:18:15 +03:00
parent da560e1629
commit 53d40cbe51
18 changed files with 21 additions and 59 deletions

View file

@ -16,13 +16,11 @@
### Settings
<!-- Please fill in the settings used below from USER_SETTINGS.h, as it will help with diagnosis. -->
<!-- Please attach screenshot of configuration for easier debugging, as it will help with diagnosis. -->
- Software version: ``
- Battery used: ``
- Inverter communication protocol: ``
- Hardware used for Battery-Emulator: `HW_LILYGO, HW_STARK, Custom`
- CONTACTOR_CONTROL: `yes/no`
- CAN_ADDON: `yes/no`
- WEBSERVER: `yes/no`
- MQTT: `yes/no`
- Software version: X.Y.Z
- Battery used: [Nissan LEAF]
- Inverter communication protocol: [BYD Modbus]
- Hardware used for Battery-Emulator: [LilyGo T-CAN/Stark CMR/LilyGo T-2CAN]
- GPIO controlled contactors: [yes/no]
- MQTT: [yes/no]

View file

@ -20,10 +20,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Version and settings (please complete the following information):**
- Please attach your USER_SETTINGS files for easier debugging
- Please attach screenshot of configuration for easier debugging
- Software version: X.Y.Z
- Battery used: [NISSAN_LEAF]
- Inverter communication protocol: [BYD_MODBUS]
- Hardware used for Battery-Emulator: [HW_LILYGO/HW_STARK/HW_DEVKIT]
- CONTACTOR_CONTROL: [yes/no]
- Battery used: [Nissan LEAF]
- Inverter communication protocol: [BYD Modbus]
- Hardware used for Battery-Emulator: [LilyGo T-CAN/Stark CMR/LilyGo T-2CAN]
- GPIO controlled contactors: [yes/no]
- MQTT: [yes/no]

View file

@ -16,7 +16,7 @@ You're in luck. There's various sources to contribute:
- [Discord server](https://www.patreon.com/dala)
## Notes on embedded system
The Battery-Emulator is a real-time control system, which performs lots of time critical operations. Some operations, like contactor control, need to complete within 10 milliseconds periodically. The resources of the ESP32 microcontroller is limited, so keeping track of CPU and memory usage is essential. Keep this in mind when coding for the system! Performance profiling the system can be done by enabling the FUNCTION_TIME_MEASUREMENT option in the USER_SETTINGS.h file
The Battery-Emulator is a real-time control system, which performs lots of time critical operations. Some operations, like contactor control, need to complete within 10 milliseconds periodically. The resources of the ESP32 microcontroller is limited, so keeping track of CPU and memory usage is essential. Keep this in mind when coding for the system! Performance profiling the system can be done by enabling the "Enable performance profiling:" option in the webserver
## Code formatting
The project enforces a specific code formatting in the workflows. To get your code formatted properly, it is easiest to use a pre-commit hook before pushing the code to a pull request.

View file

@ -1,6 +1,5 @@
#include <Arduino.h>
#include "HardwareSerial.h"
#include "USER_SETTINGS.h"
#include "esp_system.h"
#include "esp_task_wdt.h"
#include "esp_timer.h"

View file

@ -1,8 +0,0 @@
#include "USER_SETTINGS.h"
#include <string>
#include "src/devboard/hal/hal.h"
// Set your Static IP address. Only used incase WIFICONFIG is set in USER_SETTINGS.h
IPAddress local_IP(192, 168, 10, 150);
IPAddress gateway(192, 168, 10, 1);
IPAddress subnet(255, 255, 255, 0);

View file

@ -1,19 +0,0 @@
#ifndef __USER_SETTINGS_H__
#define __USER_SETTINGS_H__
#include <WiFi.h>
#include <stdint.h>
#include "src/devboard/utils/types.h"
/* Shunt/Contactor settings (Optional) */
//#define BMW_SBOX // SBOX relay control & battery current/voltage measurement
/* Connectivity options */
//#define WIFICONFIG //Enable this line to set a static IP address / gateway /subnet mask for the device. see USER_SETTINGS.cpp for the settings
#ifdef WIFICONFIG
extern IPAddress local_IP;
extern IPAddress gateway;
extern IPAddress subnet;
#endif
#endif // __USER_SETTINGS_H__

View file

@ -1,7 +1,5 @@
#include "hal.h"
#include "../../../USER_SETTINGS.h"
#include <Arduino.h>
Esp32Hal* esp32hal = nullptr;

View file

@ -4,7 +4,6 @@
#include <freertos/FreeRTOS.h>
#include <src/communication/nvm/comm_nvm.h>
#include <list>
#include "../../../USER_SETTINGS.h"
#include "../../battery/BATTERIES.h"
#include "../../communication/contactorcontrol/comm_contactorcontrol.h"
#include "../../datalayer/datalayer.h"

View file

@ -1,6 +1,5 @@
#include "events.h"
#include <Arduino.h>
#include "../../../USER_SETTINGS.h"
#include "../../datalayer/datalayer.h"
#include "../../devboard/hal/hal.h"
#include "../../devboard/utils/logging.h"

View file

@ -1,5 +1,4 @@
#include "logging.h"
#include "../../../USER_SETTINGS.h"
#include "../../datalayer/datalayer.h"
#include "../sdcard/sdcard.h"

View file

@ -2,8 +2,8 @@
#define __LOGGING_H__
#include <inttypes.h>
#include "../../../USER_SETTINGS.h"
#include "../../datalayer/datalayer.h"
#include "Print.h"
#include "types.h"
#ifndef UNIT_TEST

View file

@ -1,7 +1,6 @@
#ifndef TIME_MEAS_H_
#define TIME_MEAS_H_
#include "USER_SETTINGS.h"
#include "esp_timer.h"
/** Start time measurement in microseconds

View file

@ -7,7 +7,6 @@
extern std::string ssid;
extern std::string password;
#include "../../../USER_SETTINGS.h" // Needed for WiFi ssid and password
#include "../../communication/nvm/comm_nvm.h"
/**

View file

@ -2,7 +2,6 @@
#include <ESPmDNS.h>
#include "../utils/events.h"
#include "../utils/logging.h"
#include "USER_SETTINGS.h"
bool wifi_enabled = true;
bool wifiap_enabled = true;
@ -15,6 +14,12 @@ std::string password;
std::string ssidAP;
std::string passwordAP;
// Set your Static IP address. Only used incase Static address option is set
//TODO: Make configurable via webserver
IPAddress local_IP(192, 168, 10, 150);
IPAddress gateway(192, 168, 10, 1);
IPAddress subnet(255, 255, 255, 0);
// Configuration Parameters
static const uint16_t WIFI_CHECK_INTERVAL = 2000; // 1 seconds normal check interval when last connected
static const uint16_t STEP_WIFI_CHECK_INTERVAL = 2000; // 3 seconds wait step increase in checks for normal reconnects

View file

@ -1,7 +1,6 @@
#ifndef BYD_CAN_H
#define BYD_CAN_H
#include "../../USER_SETTINGS.h"
#include "../datalayer/datalayer.h"
#include "CanInverterProtocol.h"

View file

@ -1,14 +1,12 @@
#ifndef CANINVERTER_PROTOCOL_H
#define CANINVERTER_PROTOCOL_H
#include "../../USER_SETTINGS.h"
#include "InverterProtocol.h"
#include "../communication/Transmitter.h"
#include "../communication/can/CanReceiver.h"
#include "../communication/can/comm_can.h"
#include "../devboard/safety/safety.h"
#include "../devboard/utils/types.h"
#include "InverterProtocol.h"
class CanInverterProtocol : public InverterProtocol, Transmitter, CanReceiver {
public:

View file

@ -4,8 +4,6 @@
#include "InverterProtocol.h"
extern InverterProtocol* inverter;
#include "../../USER_SETTINGS.h"
#include "AFORE-CAN.h"
#include "BYD-CAN.h"
#include "BYD-MODBUS.h"

View file

@ -82,7 +82,6 @@ add_executable(tests
../Software/src/lib/eModbus-eModbus/ModbusTypeDefs.cpp
../Software/src/lib/eModbus-eModbus/RTUutils.cpp
# ../Software/src/lib/eModbus-eModbus/scripts/mbServerFCs.cpp
../Software/USER_SETTINGS.cpp
../Software/src/battery/BATTERIES.cpp
../Software/src/battery/Battery.cpp
../Software/src/battery/BMW-I3-BATTERY.cpp