mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
pre-commit and includes missing
This commit is contained in:
parent
856a0838d1
commit
bc70c70e09
20 changed files with 34 additions and 23 deletions
|
@ -3,6 +3,8 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "BMW-I3-BATTERY.h"
|
#include "BMW-I3-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillis20 = 0; // will store last time a 20ms CAN Message was send
|
static unsigned long previousMillis20 = 0; // will store last time a 20ms CAN Message was send
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "BYD-ATTO-3-BATTERY.h"
|
#include "BYD-ATTO-3-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
- Map all values from battery CAN messages
|
- Map all values from battery CAN messages
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "CHADEMO-BATTERY-INTERNAL.h"
|
#include "CHADEMO-BATTERY-INTERNAL.h"
|
||||||
#include "CHADEMO-BATTERY.h"
|
#include "CHADEMO-BATTERY.h"
|
||||||
#include "CHADEMO-SHUNTS.h"
|
#include "CHADEMO-SHUNTS.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
|
|
||||||
/* CHADEMO handling runs at 6.25 times the rate of most other code, so, rather than the
|
/* CHADEMO handling runs at 6.25 times the rate of most other code, so, rather than the
|
||||||
* default value of 12 (for 12 iterations of the 5s value update loop) * 5 for a 60s timeout,
|
* default value of 12 (for 12 iterations of the 5s value update loop) * 5 for a 60s timeout,
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "CHADEMO-BATTERY-INTERNAL.h"
|
#include "CHADEMO-BATTERY-INTERNAL.h"
|
||||||
#include "CHADEMO-BATTERY.h"
|
#include "CHADEMO-BATTERY.h"
|
||||||
#include "CHADEMO-SHUNTS.h"
|
#include "CHADEMO-SHUNTS.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* Initial frames received from ISA shunts provide invalid during initialization */
|
/* Initial frames received from ISA shunts provide invalid during initialization */
|
||||||
static int framecount = 0;
|
static int framecount = 0;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "IMIEV-CZERO-ION-BATTERY.h"
|
#include "IMIEV-CZERO-ION-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
//Code still work in progress, TODO:
|
//Code still work in progress, TODO:
|
||||||
//Figure out if CAN messages need to be sent to keep the system happy?
|
//Figure out if CAN messages need to be sent to keep the system happy?
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "JAGUAR-IPACE-BATTERY.h"
|
#include "JAGUAR-IPACE-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillisKeepAlive = 0;
|
static unsigned long previousMillisKeepAlive = 0;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "../lib/pierremolinaro-ACAN2517FD/ACAN2517FD.h"
|
#include "../lib/pierremolinaro-ACAN2517FD/ACAN2517FD.h"
|
||||||
#include "KIA-E-GMP-BATTERY.h"
|
#include "KIA-E-GMP-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillis20ms = 0; // will store last time a 20ms CAN Message was send
|
static unsigned long previousMillis20ms = 0; // will store last time a 20ms CAN Message was send
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "KIA-HYUNDAI-64-BATTERY.h"
|
#include "KIA-HYUNDAI-64-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
|
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "KIA-HYUNDAI-HYBRID-BATTERY.h"
|
#include "KIA-HYUNDAI-HYBRID-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
- The HEV battery seems to turn off after 1 minute of use. When this happens SOC% stops updating.
|
- The HEV battery seems to turn off after 1 minute of use. When this happens SOC% stops updating.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "MG-5-BATTERY.h"
|
#include "MG-5-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
- Get contactor closing working
|
- Get contactor closing working
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "PYLON-BATTERY.h"
|
#include "PYLON-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillis1000 = 0; // will store last time a 1s CAN Message was sent
|
static unsigned long previousMillis1000 = 0; // will store last time a 1s CAN Message was sent
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "RENAULT-KANGOO-BATTERY.h"
|
#include "RENAULT-KANGOO-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
There seems to be some values on the Kangoo that differ between the 22/33 kWh version
|
There seems to be some values on the Kangoo that differ between the 22/33 kWh version
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "RENAULT-ZOE-GEN1-BATTERY.h"
|
#include "RENAULT-ZOE-GEN1-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* Information in this file is based of the OVMS V3 vehicle_renaultzoe.cpp component
|
/* Information in this file is based of the OVMS V3 vehicle_renaultzoe.cpp component
|
||||||
https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_renaultzoe/src/vehicle_renaultzoe.cpp
|
https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_renaultzoe/src/vehicle_renaultzoe.cpp
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "RENAULT-ZOE-GEN2-BATTERY.h"
|
#include "RENAULT-ZOE-GEN2-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* Information in this file is based of the OVMS V3 vehicle_renaultzoe.cpp component
|
/* Information in this file is based of the OVMS V3 vehicle_renaultzoe.cpp component
|
||||||
https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_renaultzoe_ph2_obd/src/vehicle_renaultzoe_ph2_obd.cpp
|
https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_renaultzoe_ph2_obd/src/vehicle_renaultzoe_ph2_obd.cpp
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "SANTA-FE-PHEV-BATTERY.h"
|
#include "SANTA-FE-PHEV-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.h"
|
||||||
|
|
||||||
/* Credits go to maciek16c for these findings!
|
/* Credits go to maciek16c for these findings!
|
||||||
https://github.com/maciek16c/hyundai-santa-fe-phev-battery
|
https://github.com/maciek16c/hyundai-santa-fe-phev-battery
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "TESLA-BATTERY.h"
|
#include "TESLA-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
/* Credits: Most of the code comes from Per Carlen's bms_comms_tesla_model3.py (https://gitlab.com/pelle8/batt2gen24/) */
|
/* Credits: Most of the code comes from Per Carlen's bms_comms_tesla_model3.py (https://gitlab.com/pelle8/batt2gen24/) */
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
#include "VOLVO-SPA-BATTERY.h"
|
#include "VOLVO-SPA-BATTERY.h"
|
||||||
|
#include "../devboard/utils/pause.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 */
|
||||||
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
|
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
#include "../../datalayer/datalayer.h"
|
#include "../../datalayer/datalayer.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
|
|
||||||
bool emulator_pause_request_ON = false;
|
bool emulator_pause_request_ON = false;
|
||||||
bool emulator_pause_CAN_send_ON = false;
|
bool emulator_pause_CAN_send_ON = false;
|
||||||
bool can_send_CAN = true;
|
bool can_send_CAN = true;
|
||||||
|
|
||||||
|
|
||||||
battery_pause_status emulator_pause_status = NORMAL;
|
battery_pause_status emulator_pause_status = NORMAL;
|
||||||
|
|
||||||
void setBatteryPause(bool pause_battery,bool pause_CAN) {
|
void setBatteryPause(bool pause_battery, bool pause_CAN) {
|
||||||
|
|
||||||
emulator_pause_CAN_send_ON = pause_CAN;
|
emulator_pause_CAN_send_ON = pause_CAN;
|
||||||
|
|
||||||
|
@ -20,10 +18,10 @@ void setBatteryPause(bool pause_battery,bool pause_CAN) {
|
||||||
emulator_pause_request_ON = true;
|
emulator_pause_request_ON = true;
|
||||||
datalayer.battery.status.max_discharge_power_W = 0;
|
datalayer.battery.status.max_discharge_power_W = 0;
|
||||||
datalayer.battery.status.max_charge_power_W = 0;
|
datalayer.battery.status.max_charge_power_W = 0;
|
||||||
#ifdef DOUBLE_BATTERY
|
#ifdef DOUBLE_BATTERY
|
||||||
datalayer.battery2.status.max_discharge_power_W = 0;
|
datalayer.battery2.status.max_discharge_power_W = 0;
|
||||||
datalayer.battery2.status.max_charge_power_W = 0;
|
datalayer.battery2.status.max_charge_power_W = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
emulator_pause_status = PAUSING;
|
emulator_pause_status = PAUSING;
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,13 +37,12 @@ void setBatteryPause(bool pause_battery,bool pause_CAN) {
|
||||||
/// @return true if CAN messages should be sent to battery, false if not
|
/// @return true if CAN messages should be sent to battery, false if not
|
||||||
void emulator_pause_state_send_CAN_battery() {
|
void emulator_pause_state_send_CAN_battery() {
|
||||||
|
|
||||||
|
|
||||||
if (emulator_pause_status == NORMAL)
|
if (emulator_pause_status == NORMAL)
|
||||||
can_send_CAN = true;
|
can_send_CAN = true;
|
||||||
|
|
||||||
// in some inverters this values are not accurate, so we need to check if we are consider 1.8 amps as the limit
|
// in some inverters this values are not accurate, so we need to check if we are consider 1.8 amps as the limit
|
||||||
if (emulator_pause_request_ON && emulator_pause_status == PAUSING && datalayer.battery.status.current_dA < 18 &&
|
if (emulator_pause_request_ON && emulator_pause_status == PAUSING && datalayer.battery.status.current_dA < 18 &&
|
||||||
datalayer.battery.status.current_dA > -18 ) {
|
datalayer.battery.status.current_dA > -18) {
|
||||||
emulator_pause_status = PAUSED;
|
emulator_pause_status = PAUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
//battery pause status
|
//battery pause status
|
||||||
enum battery_pause_status { NORMAL = 0, PAUSING = 1, PAUSED = 2, RESUMING = 3 };
|
enum battery_pause_status { NORMAL = 0, PAUSING = 1, PAUSED = 2, RESUMING = 3 };
|
||||||
extern bool emulator_pause_request_ON;
|
extern bool emulator_pause_request_ON;
|
||||||
|
@ -11,7 +10,7 @@ extern bool emulator_pause_CAN_send_ON;
|
||||||
extern battery_pause_status emulator_pause_status;
|
extern battery_pause_status emulator_pause_status;
|
||||||
extern bool can_send_CAN;
|
extern bool can_send_CAN;
|
||||||
|
|
||||||
void setBatteryPause(bool pause_battery,bool pause_CAN) ;
|
void setBatteryPause(bool pause_battery, bool pause_CAN);
|
||||||
void emulator_pause_state_send_CAN_battery();
|
void emulator_pause_state_send_CAN_battery();
|
||||||
std::string get_emulator_pause_status();
|
std::string get_emulator_pause_status();
|
||||||
#endif
|
#endif
|
|
@ -717,9 +717,7 @@ String processor(const String& var) {
|
||||||
if (emulator_pause_status == NORMAL)
|
if (emulator_pause_status == NORMAL)
|
||||||
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
else
|
else
|
||||||
content +=
|
content += "<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
"<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) +
|
|
||||||
" </h4>";
|
|
||||||
|
|
||||||
// Close the block
|
// Close the block
|
||||||
content += "</div>";
|
content += "</div>";
|
||||||
|
@ -799,9 +797,7 @@ String processor(const String& var) {
|
||||||
if (emulator_pause_status == NORMAL)
|
if (emulator_pause_status == NORMAL)
|
||||||
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
else
|
else
|
||||||
content +=
|
content += "<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||||
"<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) +
|
|
||||||
" </h4>";
|
|
||||||
|
|
||||||
content += "</div>";
|
content += "</div>";
|
||||||
content += "</div>";
|
content += "</div>";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue