mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Changes after review comments
This commit is contained in:
parent
2cea5bd578
commit
c31c53e856
4 changed files with 15 additions and 14 deletions
|
@ -16,7 +16,6 @@ volatile uint16_t MAXDISCHARGEAMP =
|
|||
300; //30.0A , BYD CAN specific setting, Max discharge speed in Amp (Some inverters needs to be artificially limited)
|
||||
|
||||
// MQTT
|
||||
// For more detailed settings, see mqtt.h
|
||||
#ifdef MQTT
|
||||
const char* mqtt_user = "REDACTED";
|
||||
const char* mqtt_password = "REDACTED";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
//#define CHADEMO_BATTERY
|
||||
//#define IMIEV_CZERO_ION_BATTERY
|
||||
//#define KIA_HYUNDAI_64_BATTERY
|
||||
//#define NISSAN_LEAF_BATTERY
|
||||
#define NISSAN_LEAF_BATTERY
|
||||
//#define RENAULT_KANGOO_BATTERY
|
||||
//#define RENAULT_ZOE_BATTERY
|
||||
//#define SANTA_FE_PHEV_BATTERY
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
/* Select inverter communication protocol. See Wiki for which to use with your inverter: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/wiki */
|
||||
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
|
||||
//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
|
||||
#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
|
||||
//#define LUNA2000_MODBUS //Enable this line to emulate a "Luna2000 battery" over Modbus RTU
|
||||
//#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus
|
||||
//#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus
|
||||
|
@ -29,17 +29,23 @@
|
|||
//#define SOLAX_CAN //Enable this line to emulate a "SolaX Triple Power LFP" over CAN bus
|
||||
|
||||
/* Other options */
|
||||
//#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs
|
||||
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
||||
#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs
|
||||
#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
||||
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
|
||||
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
|
||||
//#define DUAL_CAN //Enable this line to activate an isolated secondary CAN Bus using add-on MCP2515 controller (Needed for FoxESS inverters)
|
||||
//#define SERIAL_LINK_RECEIVER //Enable this line to receive battery data over RS485 pins from another Lilygo (This LilyGo interfaces with inverter)
|
||||
//#define SERIAL_LINK_TRANSMITTER //Enable this line to send battery data over RS485 pins to another Lilygo (This LilyGo interfaces with battery)
|
||||
//#define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings.
|
||||
//#define MQTT // Enable this line to enable MQTT
|
||||
#define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings.
|
||||
//#define LOAD_SAVED_SETTINGS_ON_BOOT //Enable this line to read settings stored via the webserver on boot
|
||||
|
||||
/* MQTT options */
|
||||
#define MQTT // Enable this line to enable MQTT
|
||||
#define MQTT_SUBSCRIPTIONS \
|
||||
{ "my/topic/abc", "my/other/topic" }
|
||||
#define MQTT_SERVER "192.168.xxx.yyy"
|
||||
#define MQTT_PORT 1883
|
||||
|
||||
/* Select charger used (Optional) */
|
||||
//#define CHEVYVOLT_CHARGER //Enable this line to control a Chevrolet Volt charger connected to battery - for example, when generator charging or using an inverter without a charging function.
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const size_t mqtt_nof_subscriptions = sizeof(mqtt_subscriptions) / sizeof(mqtt_s
|
|||
|
||||
WiFiClient espClient;
|
||||
PubSubClient client(espClient);
|
||||
char mqtt_msg[MSG_BUFFER_SIZE];
|
||||
char mqtt_msg[MQTT_MSG_BUFFER_SIZE];
|
||||
int value = 0;
|
||||
static unsigned long previousMillisUpdateVal;
|
||||
MyTimer publish_global_timer(5000);
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
#include <Arduino.h>
|
||||
#include "../../../USER_SETTINGS.h"
|
||||
|
||||
#define MSG_BUFFER_SIZE (1024)
|
||||
#define MQTT_SUBSCRIPTIONS \
|
||||
{ "my/topic/abc", "my/other/topic" }
|
||||
#define MQTT_SERVER "192.168.xxx.yyy"
|
||||
#define MQTT_PORT 1883
|
||||
#define MQTT_MSG_BUFFER_SIZE (1024)
|
||||
|
||||
extern uint16_t SOC;
|
||||
extern uint16_t StateOfHealth;
|
||||
|
@ -53,7 +49,7 @@ extern uint16_t cell_min_voltage; //mV, 0-4350
|
|||
extern const char* mqtt_user;
|
||||
extern const char* mqtt_password;
|
||||
|
||||
extern char mqtt_msg[MSG_BUFFER_SIZE];
|
||||
extern char mqtt_msg[MQTT_MSG_BUFFER_SIZE];
|
||||
|
||||
void init_mqtt(void);
|
||||
void mqtt_loop(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue