mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Rename datalayer interface
This commit is contained in:
parent
9fed800cae
commit
868c667929
7 changed files with 54 additions and 54 deletions
|
@ -5,7 +5,7 @@
|
||||||
#include "../devboard/mqtt/mqtt.h"
|
#include "../devboard/mqtt/mqtt.h"
|
||||||
#endif
|
#endif
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../datalayer/datalayer_web.h" //For Advanced Battery Insights webpage
|
#include "../datalayer/datalayer_extended.h" //For "More battery info" webpage
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
|
|
||||||
/* Do not change code below unless you are sure what you are doing */
|
/* Do not change code below unless you are sure what you are doing */
|
||||||
|
@ -317,20 +317,20 @@ void update_values_battery() { /* This function maps all the values fetched via
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update webserver datalayer
|
// Update webserver datalayer
|
||||||
datalayer_web.nissanleaf.LEAF_gen = LEAF_battery_Type;
|
datalayer_extended.nissanleaf.LEAF_gen = LEAF_battery_Type;
|
||||||
datalayer_web.nissanleaf.GIDS = battery_GIDS;
|
datalayer_extended.nissanleaf.GIDS = battery_GIDS;
|
||||||
datalayer_web.nissanleaf.ChargePowerLimit = battery_Charge_Power_Limit;
|
datalayer_extended.nissanleaf.ChargePowerLimit = battery_Charge_Power_Limit;
|
||||||
datalayer_web.nissanleaf.MaxPowerForCharger = battery_MAX_POWER_FOR_CHARGER;
|
datalayer_extended.nissanleaf.MaxPowerForCharger = battery_MAX_POWER_FOR_CHARGER;
|
||||||
datalayer_web.nissanleaf.Interlock = battery_Interlock;
|
datalayer_extended.nissanleaf.Interlock = battery_Interlock;
|
||||||
datalayer_web.nissanleaf.RelayCutRequest = battery_Relay_Cut_Request;
|
datalayer_extended.nissanleaf.RelayCutRequest = battery_Relay_Cut_Request;
|
||||||
datalayer_web.nissanleaf.FailsafeStatus = battery_Failsafe_Status;
|
datalayer_extended.nissanleaf.FailsafeStatus = battery_Failsafe_Status;
|
||||||
datalayer_web.nissanleaf.Full = battery_Full_CHARGE_flag;
|
datalayer_extended.nissanleaf.Full = battery_Full_CHARGE_flag;
|
||||||
datalayer_web.nissanleaf.Empty = battery_Capacity_Empty;
|
datalayer_extended.nissanleaf.Empty = battery_Capacity_Empty;
|
||||||
datalayer_web.nissanleaf.MainRelayOn = battery_MainRelayOn_flag;
|
datalayer_extended.nissanleaf.MainRelayOn = battery_MainRelayOn_flag;
|
||||||
datalayer_web.nissanleaf.HeatExist = battery_HeatExist;
|
datalayer_extended.nissanleaf.HeatExist = battery_HeatExist;
|
||||||
datalayer_web.nissanleaf.HeatingStop = battery_Heating_Stop;
|
datalayer_extended.nissanleaf.HeatingStop = battery_Heating_Stop;
|
||||||
datalayer_web.nissanleaf.HeatingStart = battery_Heating_Start;
|
datalayer_extended.nissanleaf.HeatingStart = battery_Heating_Start;
|
||||||
datalayer_web.nissanleaf.HeaterSendRequest = battery_Batt_Heater_Mail_Send_Request;
|
datalayer_extended.nissanleaf.HeaterSendRequest = battery_Batt_Heater_Mail_Send_Request;
|
||||||
|
|
||||||
/*Finally print out values to serial if configured to do so*/
|
/*Finally print out values to serial if configured to do so*/
|
||||||
#ifdef DEBUG_VIA_USB
|
#ifdef DEBUG_VIA_USB
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "../include.h"
|
#include "../include.h"
|
||||||
#ifdef TESLA_BATTERY
|
#ifdef TESLA_BATTERY
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../datalayer/datalayer_web.h" //For Advanced Battery Insights webpage
|
#include "../datalayer/datalayer_extended.h" //For Advanced Battery Insights webpage
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "TESLA-BATTERY.h"
|
#include "TESLA-BATTERY.h"
|
||||||
|
|
||||||
|
@ -343,13 +343,13 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif // TESLA_MODEL_3Y_BATTERY
|
#endif // TESLA_MODEL_3Y_BATTERY
|
||||||
|
|
||||||
// Update webserver datalayer
|
// Update webserver datalayer
|
||||||
datalayer_web.tesla.status_contactor = battery_contactor;
|
datalayer_extended.tesla.status_contactor = battery_contactor;
|
||||||
datalayer_web.tesla.hvil_status = battery_hvil_status;
|
datalayer_extended.tesla.hvil_status = battery_hvil_status;
|
||||||
datalayer_web.tesla.packContNegativeState = battery_packContNegativeState;
|
datalayer_extended.tesla.packContNegativeState = battery_packContNegativeState;
|
||||||
datalayer_web.tesla.packContPositiveState = battery_packContPositiveState;
|
datalayer_extended.tesla.packContPositiveState = battery_packContPositiveState;
|
||||||
datalayer_web.tesla.packContactorSetState = battery_packContactorSetState;
|
datalayer_extended.tesla.packContactorSetState = battery_packContactorSetState;
|
||||||
datalayer_web.tesla.packCtrsClosingAllowed = battery_packCtrsClosingAllowed;
|
datalayer_extended.tesla.packCtrsClosingAllowed = battery_packCtrsClosingAllowed;
|
||||||
datalayer_web.tesla.pyroTestInProgress = battery_pyroTestInProgress;
|
datalayer_extended.tesla.pyroTestInProgress = battery_pyroTestInProgress;
|
||||||
|
|
||||||
#ifdef DEBUG_VIA_USB
|
#ifdef DEBUG_VIA_USB
|
||||||
|
|
||||||
|
|
4
Software/src/datalayer/datalayer_extended.cpp
Normal file
4
Software/src/datalayer/datalayer_extended.cpp
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#include "datalayer_extended.h"
|
||||||
|
#include "../include.h"
|
||||||
|
|
||||||
|
DataLayerExtended datalayer_extended;
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _DATALAYER_WEB_H_
|
#ifndef _DATALAYER_EXTENDED_H_
|
||||||
#define _DATALAYER_WEB_H_
|
#define _DATALAYER_EXTENDED_H_
|
||||||
|
|
||||||
#include "../include.h"
|
#include "../include.h"
|
||||||
|
|
||||||
|
@ -74,12 +74,12 @@ typedef struct {
|
||||||
|
|
||||||
} DATALAYER_INFO_NISSAN_LEAF;
|
} DATALAYER_INFO_NISSAN_LEAF;
|
||||||
|
|
||||||
class DataLayerWeb {
|
class DataLayerExtended {
|
||||||
public:
|
public:
|
||||||
DATALAYER_INFO_TESLA tesla;
|
DATALAYER_INFO_TESLA tesla;
|
||||||
DATALAYER_INFO_NISSAN_LEAF nissanleaf;
|
DATALAYER_INFO_NISSAN_LEAF nissanleaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DataLayerWeb datalayer_web;
|
extern DataLayerExtended datalayer_extended;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,4 +0,0 @@
|
||||||
#include "datalayer_web.h"
|
|
||||||
#include "../include.h"
|
|
||||||
|
|
||||||
DataLayerWeb datalayer_web;
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "advanced_battery_html.h"
|
#include "advanced_battery_html.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "../../datalayer/datalayer.h"
|
#include "../../datalayer/datalayer.h"
|
||||||
#include "../../datalayer/datalayer_web.h"
|
#include "../../datalayer/datalayer_extended.h"
|
||||||
|
|
||||||
String advanced_battery_processor(const String& var) {
|
String advanced_battery_processor(const String& var) {
|
||||||
if (var == "X") {
|
if (var == "X") {
|
||||||
|
@ -17,30 +17,30 @@ String advanced_battery_processor(const String& var) {
|
||||||
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
||||||
|
|
||||||
#ifdef TESLA_BATTERY
|
#ifdef TESLA_BATTERY
|
||||||
content += "<h4>Contactor Status: " + String(datalayer_web.tesla.status_contactor) + "</h4>";
|
content += "<h4>Contactor Status: " + String(datalayer_extended.tesla.status_contactor) + "</h4>";
|
||||||
content += "<h4>HVIL: " + String(datalayer_web.tesla.hvil_status) + "</h4>";
|
content += "<h4>HVIL: " + String(datalayer_extended.tesla.hvil_status) + "</h4>";
|
||||||
content += "<h4>Negative contactor: " + String(datalayer_web.tesla.packContNegativeState) + "</h4>";
|
content += "<h4>Negative contactor: " + String(datalayer_extended.tesla.packContNegativeState) + "</h4>";
|
||||||
content += "<h4>Positive contactor: " + String(datalayer_web.tesla.packContPositiveState) + "</h4>";
|
content += "<h4>Positive contactor: " + String(datalayer_extended.tesla.packContPositiveState) + "</h4>";
|
||||||
content += "<h4>Contactor set state: " + String(datalayer_web.tesla.packContactorSetState) + "</h4>";
|
content += "<h4>Contactor set state: " + String(datalayer_extended.tesla.packContactorSetState) + "</h4>";
|
||||||
content += "<h4>Closing allowed?: " + String(datalayer_web.tesla.packCtrsClosingAllowed) + "</h4>";
|
content += "<h4>Closing allowed?: " + String(datalayer_extended.tesla.packCtrsClosingAllowed) + "</h4>";
|
||||||
content += "<h4>Pyrotest: " + String(datalayer_web.tesla.pyroTestInProgress) + "</h4>";
|
content += "<h4>Pyrotest: " + String(datalayer_extended.tesla.pyroTestInProgress) + "</h4>";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NISSAN_LEAF_BATTERY
|
#ifdef NISSAN_LEAF_BATTERY
|
||||||
content += "<h4>LEAF generation: " + String(datalayer_web.nissanleaf.LEAF_gen) + "</h4>";
|
content += "<h4>LEAF generation: " + String(datalayer_extended.nissanleaf.LEAF_gen) + "</h4>";
|
||||||
content += "<h4>GIDS: " + String(datalayer_web.nissanleaf.GIDS) + "</h4>";
|
content += "<h4>GIDS: " + String(datalayer_extended.nissanleaf.GIDS) + "</h4>";
|
||||||
content += "<h4>Regen kW: " + String(datalayer_web.nissanleaf.ChargePowerLimit) + "</h4>";
|
content += "<h4>Regen kW: " + String(datalayer_extended.nissanleaf.ChargePowerLimit) + "</h4>";
|
||||||
content += "<h4>Charge kW: " + String(datalayer_web.nissanleaf.MaxPowerForCharger) + "</h4>";
|
content += "<h4>Charge kW: " + String(datalayer_extended.nissanleaf.MaxPowerForCharger) + "</h4>";
|
||||||
content += "<h4>Interlock: " + String(datalayer_web.nissanleaf.Interlock) + "</h4>";
|
content += "<h4>Interlock: " + String(datalayer_extended.nissanleaf.Interlock) + "</h4>";
|
||||||
content += "<h4>Relay cut request: " + String(datalayer_web.nissanleaf.RelayCutRequest) + "</h4>";
|
content += "<h4>Relay cut request: " + String(datalayer_extended.nissanleaf.RelayCutRequest) + "</h4>";
|
||||||
content += "<h4>Failsafe status: " + String(datalayer_web.nissanleaf.FailsafeStatus) + "</h4>";
|
content += "<h4>Failsafe status: " + String(datalayer_extended.nissanleaf.FailsafeStatus) + "</h4>";
|
||||||
content += "<h4>Fully charged: " + String(datalayer_web.nissanleaf.Full) + "</h4>";
|
content += "<h4>Fully charged: " + String(datalayer_extended.nissanleaf.Full) + "</h4>";
|
||||||
content += "<h4>Battery empty: " + String(datalayer_web.nissanleaf.Empty) + "</h4>";
|
content += "<h4>Battery empty: " + String(datalayer_extended.nissanleaf.Empty) + "</h4>";
|
||||||
content += "<h4>Main relay ON: " + String(datalayer_web.nissanleaf.MainRelayOn) + "</h4>";
|
content += "<h4>Main relay ON: " + String(datalayer_extended.nissanleaf.MainRelayOn) + "</h4>";
|
||||||
content += "<h4>Heater present: " + String(datalayer_web.nissanleaf.HeatExist) + "</h4>";
|
content += "<h4>Heater present: " + String(datalayer_extended.nissanleaf.HeatExist) + "</h4>";
|
||||||
content += "<h4>Heating stopped: " + String(datalayer_web.nissanleaf.HeatingStop) + "</h4>";
|
content += "<h4>Heating stopped: " + String(datalayer_extended.nissanleaf.HeatingStop) + "</h4>";
|
||||||
content += "<h4>Heating started: " + String(datalayer_web.nissanleaf.HeatingStart) + "</h4>";
|
content += "<h4>Heating started: " + String(datalayer_extended.nissanleaf.HeatingStart) + "</h4>";
|
||||||
content += "<h4>Heating requested: " + String(datalayer_web.nissanleaf.HeaterSendRequest) + "</h4>";
|
content += "<h4>Heating requested: " + String(datalayer_extended.nissanleaf.HeaterSendRequest) + "</h4>";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_BATTERY) //Only the listed types have extra info
|
#if !defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_BATTERY) //Only the listed types have extra info
|
||||||
|
|
|
@ -880,7 +880,7 @@ String processor(const String& var) {
|
||||||
|
|
||||||
content += "<button onclick='OTA()'>Perform OTA update</button> ";
|
content += "<button onclick='OTA()'>Perform OTA update</button> ";
|
||||||
content += "<button onclick='Settings()'>Change Settings</button> ";
|
content += "<button onclick='Settings()'>Change Settings</button> ";
|
||||||
content += "<button onclick='Advanced()'>Advanced Battery Insights</button> ";
|
content += "<button onclick='Advanced()'>More Battery Info</button> ";
|
||||||
content += "<button onclick='Cellmon()'>Cellmonitor</button> ";
|
content += "<button onclick='Cellmon()'>Cellmonitor</button> ";
|
||||||
content += "<button onclick='Events()'>Events</button> ";
|
content += "<button onclick='Events()'>Events</button> ";
|
||||||
content += "<button onclick='askReboot()'>Reboot Emulator</button>";
|
content += "<button onclick='askReboot()'>Reboot Emulator</button>";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue