mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Add more battery info for Zoe
This commit is contained in:
parent
c48fe3559d
commit
dadef047ce
3 changed files with 53 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "../include.h"
|
||||
#ifdef RENAULT_ZOE_GEN1_BATTERY
|
||||
#include "../datalayer/datalayer.h"
|
||||
#include "../datalayer/datalayer_extended.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "RENAULT-ZOE-GEN1-BATTERY.h"
|
||||
|
||||
|
@ -29,6 +30,14 @@ static uint16_t LB_Cell_maximum_voltage = 3700;
|
|||
static uint16_t LB_kWh_Remaining = 0;
|
||||
static uint16_t LB_Battery_Voltage = 3700;
|
||||
static uint8_t LB_Heartbeat = 0;
|
||||
static uint8_t LB_CUV = 0;
|
||||
static uint8_t LB_HVBIR = 0;
|
||||
static uint8_t LB_HVBUV = 0;
|
||||
static uint8_t LB_EOCR = 0;
|
||||
static uint8_t LB_HVBOC = 0;
|
||||
static uint8_t LB_HVBOT = 0;
|
||||
static uint8_t LB_HVBOV = 0;
|
||||
static uint8_t LB_COV = 0;
|
||||
static uint8_t frame0 = 0;
|
||||
static uint8_t current_poll = 0;
|
||||
static uint8_t requested_poll = 0;
|
||||
|
@ -123,6 +132,16 @@ void RenaultZoeGen1Battery::
|
|||
datalayer.battery.status.cell_min_voltage_mV = LB_Cell_minimum_voltage;
|
||||
datalayer.battery.status.cell_max_voltage_mV = LB_Cell_maximum_voltage;
|
||||
datalayer.battery.status.voltage_dV = static_cast<uint32_t>((calculated_total_pack_voltage_mV / 100)); // mV to dV
|
||||
|
||||
//Update extended datalayer
|
||||
datalayer_extended.zoe.CUV = LB_CUV;
|
||||
datalayer_extended.zoe.HVBIR = LB_HVBIR;
|
||||
datalayer_extended.zoe.HVBUV = LB_HVBUV;
|
||||
datalayer_extended.zoe.EOCR = LB_EOCR;
|
||||
datalayer_extended.zoe.HVBOC = LB_HVBOC;
|
||||
datalayer_extended.zoe.HVBOT = LB_HVBOT;
|
||||
datalayer_extended.zoe.HVBOV = LB_HVBOV;
|
||||
datalayer_extended.zoe.COV = LB_COV;
|
||||
}
|
||||
|
||||
void RenaultZoeGen1Battery::handle_incoming_can_frame(CAN_frame rx_frame) {
|
||||
|
@ -141,6 +160,14 @@ void RenaultZoeGen1Battery::handle_incoming_can_frame(CAN_frame rx_frame) {
|
|||
break;
|
||||
case 0x424: //100ms - Charge limits, Temperatures, SOH - Confirmed sent by: Fluence ZE40, Zoe 22/41kWh, Kangoo 33kWh
|
||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||
LB_CUV = (rx_frame.data.u8[0] & 0x03);
|
||||
LB_HVBIR = (rx_frame.data.u8[0] & 0x0C) >> 2;
|
||||
LB_HVBUV = (rx_frame.data.u8[0] & 0x30) >> 4;
|
||||
LB_EOCR = (rx_frame.data.u8[0] & 0xC0) >> 6;
|
||||
LB_HVBOC = (rx_frame.data.u8[1] & 0x03);
|
||||
LB_HVBOT = (rx_frame.data.u8[1] & 0x0C) >> 2;
|
||||
LB_HVBOV = (rx_frame.data.u8[1] & 0x30) >> 4;
|
||||
LB_COV = (rx_frame.data.u8[1] & 0xC0) >> 6;
|
||||
LB_Regen_allowed_W = rx_frame.data.u8[2] * 500;
|
||||
LB_Discharge_allowed_W = rx_frame.data.u8[3] * 500;
|
||||
LB_Cell_minimum_temperature = (rx_frame.data.u8[4] - 40);
|
||||
|
|
|
@ -722,6 +722,18 @@ typedef struct {
|
|||
|
||||
} DATALAYER_INFO_VOLVO_HYBRID;
|
||||
|
||||
typedef struct {
|
||||
/** uint8_t */
|
||||
uint8_t CUV = 0;
|
||||
uint8_t HVBIR = 0;
|
||||
uint8_t HVBUV = 0;
|
||||
uint8_t EOCR = 0;
|
||||
uint8_t HVBOC = 0;
|
||||
uint8_t HVBOT = 0;
|
||||
uint8_t HVBOV = 0;
|
||||
uint8_t COV = 0;
|
||||
} DATALAYER_INFO_ZOE;
|
||||
|
||||
typedef struct {
|
||||
/** User requesting NVROL reset via WebUI*/
|
||||
bool UserRequestNVROLReset = false;
|
||||
|
@ -785,6 +797,7 @@ class DataLayerExtended {
|
|||
DATALAYER_INFO_MEB meb;
|
||||
DATALAYER_INFO_VOLVO_POLESTAR VolvoPolestar;
|
||||
DATALAYER_INFO_VOLVO_HYBRID VolvoHybrid;
|
||||
DATALAYER_INFO_ZOE zoe;
|
||||
DATALAYER_INFO_ZOE_PH2 zoePH2;
|
||||
};
|
||||
|
||||
|
|
|
@ -1250,6 +1250,17 @@ String advanced_battery_processor(const String& var) {
|
|||
" kWh</h4>";
|
||||
#endif //MEB_BATTERY
|
||||
|
||||
#ifdef RENAULT_ZOE_GEN1_BATTERY
|
||||
content += "<h4>CUV " + String(datalayer_extended.zoe.CUV) + "</h4>";
|
||||
content += "<h4>HVBIR " + String(datalayer_extended.zoe.HVBIR) + "</h4>";
|
||||
content += "<h4>HVBUV " + String(datalayer_extended.zoe.HVBUV) + "</h4>";
|
||||
content += "<h4>EOCR " + String(datalayer_extended.zoe.EOCR) + "</h4>";
|
||||
content += "<h4>HVBOC " + String(datalayer_extended.zoe.HVBOC) + "</h4>";
|
||||
content += "<h4>HVBOT " + String(datalayer_extended.zoe.HVBOT) + "</h4>";
|
||||
content += "<h4>HVBOV " + String(datalayer_extended.zoe.HVBOV) + "</h4>";
|
||||
content += "<h4>COV " + String(datalayer_extended.zoe.COV) + "</h4>";
|
||||
#endif //RENAULT_ZOE_GEN1_BATTERY
|
||||
|
||||
#ifdef RENAULT_ZOE_GEN2_BATTERY
|
||||
content += "<button onclick='askTriggerNVROL()'>Perform NVROL reset</button>";
|
||||
content += "<h4>soc: " + String(datalayer_extended.zoePH2.battery_soc) + "</h4>";
|
||||
|
@ -1489,7 +1500,8 @@ String advanced_battery_processor(const String& var) {
|
|||
!defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_BATTERY) && !defined(BMW_I3_BATTERY) && \
|
||||
!defined(BYD_ATTO_3_BATTERY) && !defined(RENAULT_ZOE_GEN2_BATTERY) && !defined(CELLPOWER_BMS) && \
|
||||
!defined(MEB_BATTERY) && !defined(VOLVO_SPA_BATTERY) && !defined(VOLVO_SPA_HYBRID_BATTERY) && \
|
||||
!defined(KIA_HYUNDAI_64_BATTERY) && !defined(CMFA_EV_BATTERY) //Only the listed types have extra info
|
||||
!defined(KIA_HYUNDAI_64_BATTERY) && !defined(CMFA_EV_BATTERY) && \
|
||||
!defined(RENAULT_ZOE_GEN1_BATTERY) //Only the listed types have extra info
|
||||
content += "No extra information available for this battery type";
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue