mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 01:39:30 +02:00
Move more USER_SETTINGS out
This commit is contained in:
parent
bf6e4c8a0f
commit
f03324585b
10 changed files with 30 additions and 58 deletions
|
@ -2,42 +2,11 @@
|
|||
#include <string>
|
||||
#include "src/devboard/hal/hal.h"
|
||||
|
||||
/* This file contains all the battery settings and limits */
|
||||
/* They can be defined here, or later on in the WebUI */
|
||||
/* Most important is to select which CAN interface each component is connected to */
|
||||
/*
|
||||
CAN_NATIVE = Native CAN port on the LilyGo & Stark hardware
|
||||
CANFD_NATIVE = Native CANFD port on the Stark CMR hardware
|
||||
CAN_ADDON_MCP2515 = Add-on CAN MCP2515 connected to GPIO pins
|
||||
CANFD_ADDON_MCP2518 = Add-on CAN-FD MCP2518 connected to GPIO pins
|
||||
*/
|
||||
|
||||
volatile CAN_Configuration can_config = {
|
||||
.battery = CAN_NATIVE, // Which CAN is your battery connected to?
|
||||
.inverter = CAN_NATIVE, // Which CAN is your inverter connected to? (No need to configure incase you use RS485)
|
||||
.battery_double = CAN_ADDON_MCP2515, // (OPTIONAL) Which CAN is your second battery connected to?
|
||||
.charger = CAN_NATIVE, // (OPTIONAL) Which CAN is your charger connected to?
|
||||
.shunt = CAN_NATIVE // (OPTIONAL) Which CAN is your shunt connected to?
|
||||
};
|
||||
|
||||
// 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);
|
||||
|
||||
std::string ssid;
|
||||
std::string password;
|
||||
std::string passwordAP;
|
||||
|
||||
const char* mqtt_topic_name =
|
||||
"BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX"
|
||||
const char* mqtt_object_id_prefix =
|
||||
"be_"; // Custom prefix for MQTT object ID. Previously, the prefix was automatically set to "esp32-XXXXXX_"
|
||||
const char* mqtt_device_name =
|
||||
"Battery Emulator"; // Custom device name in Home Assistant. Previously, the name was automatically set to "BatteryEmulator_esp32-XXXXXX"
|
||||
const char* ha_device_id =
|
||||
"battery-emulator"; // Custom device ID in Home Assistant. Previously, the ID was always "battery-emulator"
|
||||
|
||||
/* Charger settings (Optional, when using generator charging) */
|
||||
volatile float CHARGER_SET_HV = 384; // Reasonably appropriate 4.0v per cell charging of a 96s pack
|
||||
volatile float CHARGER_MAX_HV = 420; // Max permissible output (VDC) of charger
|
||||
|
|
|
@ -10,17 +10,6 @@
|
|||
/* 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
|
||||
|
||||
/* Do not change any code below this line */
|
||||
/* Only change battery specific settings above and in "USER_SETTINGS.cpp" */
|
||||
typedef struct {
|
||||
CAN_Interface battery;
|
||||
CAN_Interface inverter;
|
||||
CAN_Interface battery_double;
|
||||
CAN_Interface charger;
|
||||
CAN_Interface shunt;
|
||||
} CAN_Configuration;
|
||||
extern volatile CAN_Configuration can_config;
|
||||
extern volatile uint8_t AccessPointEnabled;
|
||||
extern volatile float CHARGER_SET_HV;
|
||||
extern volatile float CHARGER_MAX_HV;
|
||||
extern volatile float CHARGER_MIN_HV;
|
||||
|
@ -28,26 +17,10 @@ extern volatile float CHARGER_MAX_POWER;
|
|||
extern volatile float CHARGER_MAX_A;
|
||||
extern volatile float CHARGER_END_A;
|
||||
|
||||
#include "src/communication/equipmentstopbutton/comm_equipmentstopbutton.h"
|
||||
|
||||
// Equipment stop button behavior. Use NC button for safety reasons.
|
||||
//LATCHING_SWITCH - Normally closed (NC), latching switch. When pressed it activates e-stop
|
||||
//MOMENTARY_SWITCH - Short press to activate e-stop, long 15s press to deactivate. E-stop is persistent between reboots
|
||||
|
||||
#ifdef EQUIPMENT_STOP_BUTTON
|
||||
const STOP_BUTTON_BEHAVIOR stop_button_default_behavior = STOP_BUTTON_BEHAVIOR::MOMENTARY_SWITCH;
|
||||
#else
|
||||
const STOP_BUTTON_BEHAVIOR stop_button_default_behavior = STOP_BUTTON_BEHAVIOR::NOT_CONNECTED;
|
||||
#endif
|
||||
|
||||
#ifdef WIFICONFIG
|
||||
extern IPAddress local_IP;
|
||||
extern IPAddress gateway;
|
||||
extern IPAddress subnet;
|
||||
#endif
|
||||
|
||||
#if defined(MEB_BATTERY)
|
||||
#define PRECHARGE_CONTROL
|
||||
#endif
|
||||
|
||||
#endif // __USER_SETTINGS_H__
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
#include "src/devboard/sdcard/sdcard.h"
|
||||
#include "src/devboard/utils/logging.h"
|
||||
|
||||
volatile CAN_Configuration can_config = {.battery = CAN_NATIVE,
|
||||
.inverter = CAN_NATIVE,
|
||||
.battery_double = CAN_ADDON_MCP2515,
|
||||
.charger = CAN_NATIVE,
|
||||
.shunt = CAN_NATIVE};
|
||||
|
||||
struct CanReceiverRegistration {
|
||||
CanReceiver* receiver;
|
||||
CAN_Speed speed;
|
||||
|
|
|
@ -15,6 +15,15 @@ void transmit_can_frame_to_interface(const CAN_frame* tx_frame, int interface);
|
|||
|
||||
class CanReceiver;
|
||||
|
||||
typedef struct {
|
||||
CAN_Interface battery;
|
||||
CAN_Interface inverter;
|
||||
CAN_Interface battery_double;
|
||||
CAN_Interface charger;
|
||||
CAN_Interface shunt;
|
||||
} CAN_Configuration;
|
||||
extern volatile CAN_Configuration can_config;
|
||||
|
||||
enum class CAN_Speed {
|
||||
CAN_SPEED_100KBPS = 100,
|
||||
CAN_SPEED_125KBPS = 125,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../devboard/utils/debounce_button.h"
|
||||
#include "USER_SETTINGS.h"
|
||||
|
||||
const STOP_BUTTON_BEHAVIOR stop_button_default_behavior = STOP_BUTTON_BEHAVIOR::NOT_CONNECTED;
|
||||
STOP_BUTTON_BEHAVIOR equipment_stop_behavior = stop_button_default_behavior;
|
||||
|
||||
// Parameters
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../../devboard/wifi/wifi.h"
|
||||
#include "../../inverter/INVERTERS.h"
|
||||
#include "../contactorcontrol/comm_contactorcontrol.h"
|
||||
#include "../equipmentstopbutton/comm_equipmentstopbutton.h"
|
||||
#include "../precharge_control/precharge_control.h"
|
||||
|
||||
// Parameters
|
||||
|
|
|
@ -30,6 +30,14 @@ bool mqtt_manual_topic_object_name =
|
|||
// If this is not true, the previous default naming format 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used.
|
||||
// This naming convention was in place until version 7.5.0. Users should check the version from which they are updating, as this change
|
||||
// may break compatibility with previous versions of MQTT naming
|
||||
const char* mqtt_topic_name =
|
||||
"BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX"
|
||||
const char* mqtt_object_id_prefix =
|
||||
"be_"; // Custom prefix for MQTT object ID. Previously, the prefix was automatically set to "esp32-XXXXXX_"
|
||||
const char* mqtt_device_name =
|
||||
"Battery Emulator"; // Custom device name in Home Assistant. Previously, the name was automatically set to "BatteryEmulator_esp32-XXXXXX"
|
||||
const char* ha_device_id =
|
||||
"battery-emulator"; // Custom device ID in Home Assistant. Previously, the ID was always "battery-emulator"
|
||||
|
||||
#define MQTT_QOS 0 // MQTT Quality of Service (0, 1, or 2) //TODO: Should this be configurable?
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "settings_html.h"
|
||||
#include <Arduino.h>
|
||||
#include "../../../src/communication/contactorcontrol/comm_contactorcontrol.h"
|
||||
#include "../../../src/communication/equipmentstopbutton/comm_equipmentstopbutton.h"
|
||||
#include "../../charger/CHARGERS.h"
|
||||
#include "../../communication/can/comm_can.h"
|
||||
#include "../../communication/nvm/comm_nvm.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../charger/CHARGERS.h"
|
||||
#include "../../communication/can/comm_can.h"
|
||||
#include "../../communication/contactorcontrol/comm_contactorcontrol.h"
|
||||
#include "../../communication/equipmentstopbutton/comm_equipmentstopbutton.h"
|
||||
#include "../../communication/nvm/comm_nvm.h"
|
||||
#include "../../datalayer/datalayer.h"
|
||||
#include "../../datalayer/datalayer_extended.h"
|
||||
|
|
|
@ -10,7 +10,10 @@ bool mdns_enabled = true; //If true, allows battery monitor te be found by .loc
|
|||
uint16_t wifi_channel = 0;
|
||||
|
||||
std::string custom_hostname; //If not set, the default naming format 'esp32-XXXXXX' will be used
|
||||
std::string ssid;
|
||||
std::string password;
|
||||
std::string ssidAP;
|
||||
std::string passwordAP;
|
||||
|
||||
// Configuration Parameters
|
||||
static const uint16_t WIFI_CHECK_INTERVAL = 2000; // 1 seconds normal check interval when last connected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue