mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Add LEAF specific advanced page
This commit is contained in:
parent
3927e6af47
commit
9fed800cae
3 changed files with 82 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "../devboard/mqtt/mqtt.h"
|
||||
#endif
|
||||
#include "../datalayer/datalayer.h"
|
||||
#include "../datalayer/datalayer_web.h" //For Advanced Battery Insights webpage
|
||||
#include "../devboard/utils/events.h"
|
||||
|
||||
/* Do not change code below unless you are sure what you are doing */
|
||||
|
@ -315,6 +316,22 @@ void update_values_battery() { /* This function maps all the values fetched via
|
|||
}
|
||||
}
|
||||
|
||||
// Update webserver datalayer
|
||||
datalayer_web.nissanleaf.LEAF_gen = LEAF_battery_Type;
|
||||
datalayer_web.nissanleaf.GIDS = battery_GIDS;
|
||||
datalayer_web.nissanleaf.ChargePowerLimit = battery_Charge_Power_Limit;
|
||||
datalayer_web.nissanleaf.MaxPowerForCharger = battery_MAX_POWER_FOR_CHARGER;
|
||||
datalayer_web.nissanleaf.Interlock = battery_Interlock;
|
||||
datalayer_web.nissanleaf.RelayCutRequest = battery_Relay_Cut_Request;
|
||||
datalayer_web.nissanleaf.FailsafeStatus = battery_Failsafe_Status;
|
||||
datalayer_web.nissanleaf.Full = battery_Full_CHARGE_flag;
|
||||
datalayer_web.nissanleaf.Empty = battery_Capacity_Empty;
|
||||
datalayer_web.nissanleaf.MainRelayOn = battery_MainRelayOn_flag;
|
||||
datalayer_web.nissanleaf.HeatExist = battery_HeatExist;
|
||||
datalayer_web.nissanleaf.HeatingStop = battery_Heating_Stop;
|
||||
datalayer_web.nissanleaf.HeatingStart = battery_Heating_Start;
|
||||
datalayer_web.nissanleaf.HeaterSendRequest = battery_Batt_Heater_Mail_Send_Request;
|
||||
|
||||
/*Finally print out values to serial if configured to do so*/
|
||||
#ifdef DEBUG_VIA_USB
|
||||
Serial.println("Values from battery");
|
||||
|
|
|
@ -28,9 +28,56 @@ typedef struct {
|
|||
|
||||
} DATALAYER_INFO_TESLA;
|
||||
|
||||
typedef struct {
|
||||
/** uint8_t */
|
||||
/** Enum, ZE0 = 0, AZE0 = 1, ZE1 = 2 */
|
||||
uint8_t LEAF_gen = 0;
|
||||
/** uint16_t */
|
||||
/** 77Wh per gid. LEAF specific unit */
|
||||
uint16_t GIDS = 0;
|
||||
/** uint16_t */
|
||||
/** Max regen power in kW */
|
||||
uint16_t ChargePowerLimit = 0;
|
||||
/** int16_t */
|
||||
/** Max charge power in kW */
|
||||
int16_t MaxPowerForCharger = 0;
|
||||
/** bool */
|
||||
/** Interlock status */
|
||||
bool Interlock = false;
|
||||
/** uint8_t */
|
||||
/** battery_FAIL status */
|
||||
uint8_t RelayCutRequest = 0;
|
||||
/** uint8_t */
|
||||
/** battery_STATUS status */
|
||||
uint8_t FailsafeStatus = 0;
|
||||
/** bool */
|
||||
/** True if fully charged */
|
||||
bool Full = false;
|
||||
/** bool */
|
||||
/** True if battery empty */
|
||||
bool Empty = false;
|
||||
/** bool */
|
||||
/** Battery pack allows closing of contacors */
|
||||
bool MainRelayOn = false;
|
||||
/** bool */
|
||||
/** True if heater exists */
|
||||
bool HeatExist = false;
|
||||
/** bool */
|
||||
/** Heater stopped */
|
||||
bool HeatingStop = false;
|
||||
/** bool */
|
||||
/** Heater starting */
|
||||
bool HeatingStart = false;
|
||||
/** bool */
|
||||
/** Heat request sent*/
|
||||
bool HeaterSendRequest = false;
|
||||
|
||||
} DATALAYER_INFO_NISSAN_LEAF;
|
||||
|
||||
class DataLayerWeb {
|
||||
public:
|
||||
DATALAYER_INFO_TESLA tesla;
|
||||
DATALAYER_INFO_NISSAN_LEAF nissanleaf;
|
||||
};
|
||||
|
||||
extern DataLayerWeb datalayer_web;
|
||||
|
|
|
@ -26,7 +26,24 @@ String advanced_battery_processor(const String& var) {
|
|||
content += "<h4>Pyrotest: " + String(datalayer_web.tesla.pyroTestInProgress) + "</h4>";
|
||||
#endif
|
||||
|
||||
#ifndef TESLA_BATTERY //Only the listed types have extra info
|
||||
#ifdef NISSAN_LEAF_BATTERY
|
||||
content += "<h4>LEAF generation: " + String(datalayer_web.nissanleaf.LEAF_gen) + "</h4>";
|
||||
content += "<h4>GIDS: " + String(datalayer_web.nissanleaf.GIDS) + "</h4>";
|
||||
content += "<h4>Regen kW: " + String(datalayer_web.nissanleaf.ChargePowerLimit) + "</h4>";
|
||||
content += "<h4>Charge kW: " + String(datalayer_web.nissanleaf.MaxPowerForCharger) + "</h4>";
|
||||
content += "<h4>Interlock: " + String(datalayer_web.nissanleaf.Interlock) + "</h4>";
|
||||
content += "<h4>Relay cut request: " + String(datalayer_web.nissanleaf.RelayCutRequest) + "</h4>";
|
||||
content += "<h4>Failsafe status: " + String(datalayer_web.nissanleaf.FailsafeStatus) + "</h4>";
|
||||
content += "<h4>Fully charged: " + String(datalayer_web.nissanleaf.Full) + "</h4>";
|
||||
content += "<h4>Battery empty: " + String(datalayer_web.nissanleaf.Empty) + "</h4>";
|
||||
content += "<h4>Main relay ON: " + String(datalayer_web.nissanleaf.MainRelayOn) + "</h4>";
|
||||
content += "<h4>Heater present: " + String(datalayer_web.nissanleaf.HeatExist) + "</h4>";
|
||||
content += "<h4>Heating stopped: " + String(datalayer_web.nissanleaf.HeatingStop) + "</h4>";
|
||||
content += "<h4>Heating started: " + String(datalayer_web.nissanleaf.HeatingStart) + "</h4>";
|
||||
content += "<h4>Heating requested: " + String(datalayer_web.nissanleaf.HeaterSendRequest) + "</h4>";
|
||||
#endif
|
||||
|
||||
#if !defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_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