mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 10:19:29 +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 "../devboard/utils/events.h"
|
||||
#include "BMW-I3-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "BYD-ATTO-3-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* TODO:
|
||||
- Map all values from battery CAN messages
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "CHADEMO-BATTERY-INTERNAL.h"
|
||||
#include "CHADEMO-BATTERY.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
|
||||
* 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.h"
|
||||
#include "CHADEMO-SHUNTS.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* Initial frames received from ISA shunts provide invalid during initialization */
|
||||
static int framecount = 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "IMIEV-CZERO-ION-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
//Code still work in progress, TODO:
|
||||
//Figure out if CAN messages need to be sent to keep the system happy?
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "JAGUAR-IPACE-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* Do not change code below unless you are sure what you are doing */
|
||||
static unsigned long previousMillisKeepAlive = 0;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../devboard/utils/events.h"
|
||||
#include "../lib/pierremolinaro-ACAN2517FD/ACAN2517FD.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 */
|
||||
static unsigned long previousMillis20ms = 0; // will store last time a 20ms CAN Message was send
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.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 */
|
||||
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "KIA-HYUNDAI-HYBRID-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* TODO:
|
||||
- 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 "../devboard/utils/events.h"
|
||||
#include "MG-5-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* TODO:
|
||||
- Get contactor closing working
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "PYLON-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "RENAULT-KANGOO-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* TODO:
|
||||
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 "../devboard/utils/events.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
|
||||
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 "../devboard/utils/events.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
|
||||
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 "../devboard/utils/events.h"
|
||||
#include "SANTA-FE-PHEV-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* Credits go to maciek16c for these findings!
|
||||
https://github.com/maciek16c/hyundai-santa-fe-phev-battery
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "TESLA-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* 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/) */
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../datalayer/datalayer.h"
|
||||
#include "../devboard/utils/events.h"
|
||||
#include "VOLVO-SPA-BATTERY.h"
|
||||
#include "../devboard/utils/pause.h"
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -2,28 +2,26 @@
|
|||
#include "../../datalayer/datalayer.h"
|
||||
#include "events.h"
|
||||
|
||||
|
||||
bool emulator_pause_request_ON = false;
|
||||
bool emulator_pause_CAN_send_ON = false;
|
||||
bool can_send_CAN = true;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
if (pause_battery) {
|
||||
|
||||
set_event(EVENT_PAUSE_BEGIN, 1);
|
||||
emulator_pause_request_ON = true;
|
||||
datalayer.battery.status.max_discharge_power_W = 0;
|
||||
datalayer.battery.status.max_charge_power_W = 0;
|
||||
#ifdef DOUBLE_BATTERY
|
||||
datalayer.battery2.status.max_discharge_power_W = 0;
|
||||
datalayer.battery2.status.max_charge_power_W = 0;
|
||||
#endif
|
||||
datalayer.battery.status.max_discharge_power_W = 0;
|
||||
datalayer.battery.status.max_charge_power_W = 0;
|
||||
#ifdef DOUBLE_BATTERY
|
||||
datalayer.battery2.status.max_discharge_power_W = 0;
|
||||
datalayer.battery2.status.max_charge_power_W = 0;
|
||||
#endif
|
||||
|
||||
emulator_pause_status = PAUSING;
|
||||
} else {
|
||||
|
@ -37,15 +35,14 @@ void setBatteryPause(bool pause_battery,bool pause_CAN) {
|
|||
|
||||
/// @brief handle emulator pause status
|
||||
/// @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)
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -70,4 +67,4 @@ std::string get_emulator_pause_status() {
|
|||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
|
||||
//battery pause status
|
||||
enum battery_pause_status { NORMAL = 0, PAUSING = 1, PAUSED = 2, RESUMING = 3 };
|
||||
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 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();
|
||||
std::string get_emulator_pause_status();
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -717,9 +717,7 @@ String processor(const String& var) {
|
|||
if (emulator_pause_status == NORMAL)
|
||||
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||
else
|
||||
content +=
|
||||
"<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) +
|
||||
" </h4>";
|
||||
content += "<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||
|
||||
// Close the block
|
||||
content += "</div>";
|
||||
|
@ -799,9 +797,7 @@ String processor(const String& var) {
|
|||
if (emulator_pause_status == NORMAL)
|
||||
content += "<h4>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||
else
|
||||
content +=
|
||||
"<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) +
|
||||
" </h4>";
|
||||
content += "<h4 style='color: red;'>Pause status: " + String(get_emulator_pause_status().c_str()) + " </h4>";
|
||||
|
||||
content += "</div>";
|
||||
content += "</div>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue