mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 19:42:08 +02:00
Add inverter brand to datalayer
This commit is contained in:
parent
0e0f15f7c5
commit
f43725455a
4 changed files with 10 additions and 16 deletions
|
@ -38,13 +38,13 @@
|
|||
//#define TESLA_MODEL_3Y_BATTERY
|
||||
//#define TESLA_MODEL_SX_BATTERY
|
||||
//#define VOLVO_SPA_BATTERY
|
||||
//#define TEST_FAKE_BATTERY
|
||||
#define TEST_FAKE_BATTERY
|
||||
//#define DOUBLE_BATTERY //Enable this line if you use two identical batteries at the same time (requires CAN_ADDON setup)
|
||||
//#define SERIAL_LINK_TRANSMITTER //Enable this line to send battery data over RS485 pins to another Lilygo (This LilyGo interfaces with battery)
|
||||
|
||||
/* Select inverter communication protocol. See Wiki for which to use with your inverter: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/wiki */
|
||||
//#define AFORE_CAN //Enable this line to emulate an "Afore battery" over CAN bus
|
||||
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
|
||||
#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
|
||||
//#define BYD_KOSTAL_RS485 //Enable this line to emulate a "BYD 11kWh HVM battery" over Kostal RS485
|
||||
//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
|
||||
//#define FOXESS_CAN //Enable this line to emulate a "HV2600/ECS4100 battery" over CAN bus
|
||||
|
@ -63,7 +63,7 @@
|
|||
//#define SERIAL_LINK_RECEIVER //Enable this line to receive battery data over RS485 pins from another Lilygo (This LilyGo interfaces with inverter)
|
||||
|
||||
/* Select hardware used for Battery-Emulator */
|
||||
//#define HW_LILYGO
|
||||
#define HW_LILYGO
|
||||
//#define HW_STARK
|
||||
//#define HW_3LB
|
||||
//#define HW_DEVKIT
|
||||
|
|
|
@ -203,10 +203,12 @@ typedef struct {
|
|||
typedef struct {
|
||||
/** array with type of battery used, for displaying on webserver */
|
||||
char battery_protocol[64] = {0};
|
||||
/** array with type of inverter used, for displaying on webserver */
|
||||
/** array with type of inverter protocl used, for displaying on webserver */
|
||||
char inverter_protocol[64] = {0};
|
||||
/** array with type of battery used, for displaying on webserver */
|
||||
char shunt_protocol[64] = {0};
|
||||
/** array with type of inverter brand used, for displaying on webserver */
|
||||
char inverter_brand[8] = {0};
|
||||
/** array with incoming CAN messages, for displaying on webserver */
|
||||
char logged_can_messages[15000] = {0};
|
||||
size_t logged_can_messages_offset = 0;
|
||||
|
|
|
@ -784,6 +784,8 @@ String processor(const String& var) {
|
|||
// Display which components are used
|
||||
content += "<h4 style='color: white;'>Inverter protocol: ";
|
||||
content += datalayer.system.info.inverter_protocol;
|
||||
content += " ";
|
||||
content += datalayer.system.info.inverter_brand;
|
||||
content += "</h4>";
|
||||
content += "<h4 style='color: white;'>Battery protocol: ";
|
||||
content += datalayer.system.info.battery_protocol;
|
||||
|
|
|
@ -74,7 +74,6 @@ CAN_frame BYD_210 = {.FD = false,
|
|||
.ID = 0x210,
|
||||
.data = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||
|
||||
static uint8_t inverter_name[7] = {0};
|
||||
static int16_t temperature_average = 0;
|
||||
static uint16_t inverter_voltage = 0;
|
||||
static uint16_t inverter_SOC = 0;
|
||||
|
@ -153,16 +152,6 @@ void update_values_can_inverter() { //This function maps all the values fetched
|
|||
//Temperature min
|
||||
BYD_210.data.u8[2] = (datalayer.battery.status.temperature_min_dC >> 8);
|
||||
BYD_210.data.u8[3] = (datalayer.battery.status.temperature_min_dC & 0x00FF);
|
||||
|
||||
#ifdef DEBUG_LOG
|
||||
if (inverter_name[0] != 0) {
|
||||
logging.print("Detected inverter: ");
|
||||
for (uint8_t i = 0; i < 7; i++) {
|
||||
logging.print((char)inverter_name[i]);
|
||||
}
|
||||
logging.println();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void map_can_frame_to_variable_inverter(CAN_frame rx_frame) {
|
||||
|
@ -174,8 +163,9 @@ void map_can_frame_to_variable_inverter(CAN_frame rx_frame) {
|
|||
send_intial_data();
|
||||
} else { // We can identify what inverter type we are connected to
|
||||
for (uint8_t i = 0; i < 7; i++) {
|
||||
inverter_name[i] = rx_frame.data.u8[i + 1];
|
||||
datalayer.system.info.inverter_brand[i] = rx_frame.data.u8[i + 1];
|
||||
}
|
||||
datalayer.system.info.inverter_brand[7] = '\0';
|
||||
}
|
||||
break;
|
||||
case 0x091:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue