mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Refactor: Code cleanup and optimization without functional changes
This commit is contained in:
parent
bc70c70e09
commit
a8010abdd9
25 changed files with 86 additions and 109 deletions
|
@ -3,8 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,8 +7,6 @@
|
||||||
#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,7 +22,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +4,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.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 previousMillis10 = 0; // will store last time a 10ms CAN Message was send
|
static unsigned long previousMillis10 = 0; // will store last time a 10ms CAN Message was send
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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,7 +3,6 @@
|
||||||
#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/) */
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "../include.h"
|
#include "../include.h"
|
||||||
#ifdef TEST_FAKE_BATTERY
|
#ifdef TEST_FAKE_BATTERY
|
||||||
#include "../datalayer/datalayer.h"
|
#include "../datalayer/datalayer.h"
|
||||||
#include "../devboard/utils/pause.h"
|
|
||||||
|
|
||||||
#include "TEST-FAKE-BATTERY.h"
|
#include "TEST-FAKE-BATTERY.h"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#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
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "../../lib/bblanchon-ArduinoJson/ArduinoJson.h"
|
#include "../../lib/bblanchon-ArduinoJson/ArduinoJson.h"
|
||||||
#include "../../lib/knolleary-pubsubclient/PubSubClient.h"
|
#include "../../lib/knolleary-pubsubclient/PubSubClient.h"
|
||||||
#include "../utils/events.h"
|
#include "../utils/events.h"
|
||||||
#include "../utils/pause.h"
|
|
||||||
#include "../utils/timer.h"
|
#include "../utils/timer.h"
|
||||||
|
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
|
|
|
@ -9,6 +9,14 @@ static bool battery_empty_event_fired = false;
|
||||||
|
|
||||||
#define MAX_SOH_DEVIATION_PPTT 2500
|
#define MAX_SOH_DEVIATION_PPTT 2500
|
||||||
|
|
||||||
|
//battery pause status begin
|
||||||
|
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;
|
||||||
|
//battery pause status end
|
||||||
|
|
||||||
void update_machineryprotection() {
|
void update_machineryprotection() {
|
||||||
// Start checking that the battery is within reason. Incase we see any funny business, raise an event!
|
// Start checking that the battery is within reason. Incase we see any funny business, raise an event!
|
||||||
|
|
||||||
|
@ -171,3 +179,66 @@ void update_machineryprotection() {
|
||||||
|
|
||||||
#endif // DOUBLE_BATTERY
|
#endif // DOUBLE_BATTERY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//battery pause status begin
|
||||||
|
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
|
||||||
|
|
||||||
|
emulator_pause_status = PAUSING;
|
||||||
|
} else {
|
||||||
|
clear_event(EVENT_PAUSE_BEGIN);
|
||||||
|
set_event(EVENT_PAUSE_END, 0);
|
||||||
|
emulator_pause_request_ON = false;
|
||||||
|
emulator_pause_CAN_send_ON = false;
|
||||||
|
emulator_pause_status = RESUMING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @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() {
|
||||||
|
|
||||||
|
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) {
|
||||||
|
emulator_pause_status = PAUSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!emulator_pause_request_ON && emulator_pause_status == RESUMING) {
|
||||||
|
emulator_pause_status = NORMAL;
|
||||||
|
can_send_CAN = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
can_send_CAN = (!emulator_pause_CAN_send_ON || emulator_pause_status == NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_emulator_pause_status() {
|
||||||
|
switch (emulator_pause_status) {
|
||||||
|
case NORMAL:
|
||||||
|
return "RUNNING";
|
||||||
|
case PAUSING:
|
||||||
|
return "PAUSING";
|
||||||
|
case PAUSED:
|
||||||
|
return "PAUSED";
|
||||||
|
case RESUMING:
|
||||||
|
return "RESUMING";
|
||||||
|
default:
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//battery pause status
|
||||||
|
|
|
@ -1,11 +1,26 @@
|
||||||
#ifndef SAFETY_H
|
#ifndef SAFETY_H
|
||||||
#define SAFETY_H
|
#define SAFETY_H
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define MAX_CAN_FAILURES 50
|
#define MAX_CAN_FAILURES 50
|
||||||
|
|
||||||
#define MAX_CHARGE_DISCHARGE_LIMIT_FAILURES 1
|
#define MAX_CHARGE_DISCHARGE_LIMIT_FAILURES 1
|
||||||
|
|
||||||
|
//battery pause status begin
|
||||||
|
enum battery_pause_status { NORMAL = 0, PAUSING = 1, PAUSED = 2, RESUMING = 3 };
|
||||||
|
extern bool emulator_pause_request_ON;
|
||||||
|
extern bool emulator_pause_CAN_send_ON;
|
||||||
|
extern battery_pause_status emulator_pause_status;
|
||||||
|
extern bool can_send_CAN;
|
||||||
|
//battery pause status end
|
||||||
|
|
||||||
void update_machineryprotection();
|
void update_machineryprotection();
|
||||||
|
|
||||||
|
//battery pause status begin
|
||||||
|
void setBatteryPause(bool pause_battery, bool pause_CAN);
|
||||||
|
void emulator_pause_state_send_CAN_battery();
|
||||||
|
std::string get_emulator_pause_status();
|
||||||
|
//battery pause status end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
#include "pause.h"
|
|
||||||
#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) {
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
emulator_pause_status = PAUSING;
|
|
||||||
} else {
|
|
||||||
clear_event(EVENT_PAUSE_BEGIN);
|
|
||||||
set_event(EVENT_PAUSE_END, 0);
|
|
||||||
emulator_pause_request_ON = false;
|
|
||||||
emulator_pause_CAN_send_ON = false;
|
|
||||||
emulator_pause_status = RESUMING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @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() {
|
|
||||||
|
|
||||||
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) {
|
|
||||||
emulator_pause_status = PAUSED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!emulator_pause_request_ON && emulator_pause_status == RESUMING) {
|
|
||||||
emulator_pause_status = NORMAL;
|
|
||||||
can_send_CAN = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
can_send_CAN = (!emulator_pause_CAN_send_ON || emulator_pause_status == NORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string get_emulator_pause_status() {
|
|
||||||
switch (emulator_pause_status) {
|
|
||||||
case NORMAL:
|
|
||||||
return "RUNNING";
|
|
||||||
case PAUSING:
|
|
||||||
return "PAUSING";
|
|
||||||
case PAUSED:
|
|
||||||
return "PAUSED";
|
|
||||||
case RESUMING:
|
|
||||||
return "RESUMING";
|
|
||||||
default:
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
#ifndef _PAUSE_H_
|
|
||||||
#define _PAUSE_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
//battery pause status
|
|
||||||
enum battery_pause_status { NORMAL = 0, PAUSING = 1, PAUSED = 2, RESUMING = 3 };
|
|
||||||
extern bool emulator_pause_request_ON;
|
|
||||||
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 emulator_pause_state_send_CAN_battery();
|
|
||||||
std::string get_emulator_pause_status();
|
|
||||||
#endif
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "../../datalayer/datalayer.h"
|
#include "../../datalayer/datalayer.h"
|
||||||
#include "../utils/events.h"
|
#include "../utils/events.h"
|
||||||
#include "../utils/led_handler.h"
|
#include "../utils/led_handler.h"
|
||||||
#include "../utils/pause.h"
|
|
||||||
#include "../utils/timer.h"
|
#include "../utils/timer.h"
|
||||||
|
|
||||||
// Create AsyncWebServer object on port 80
|
// Create AsyncWebServer object on port 80
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue