Move leaking defines to private constants

This commit is contained in:
Jaakko Haakana 2025-06-27 23:14:10 +03:00
parent 6403d064c3
commit 7e929c61d6
4 changed files with 29 additions and 28 deletions

View file

@ -21,16 +21,6 @@
#define BATTERY_SELECTED
#define SELECTED_BATTERY_CLASS BydAttoBattery
#define CELLCOUNT_EXTENDED 126
#define CELLCOUNT_STANDARD 104
#define MAX_PACK_VOLTAGE_EXTENDED_DV 4410 //Extended range
#define MIN_PACK_VOLTAGE_EXTENDED_DV 3800 //Extended range
#define MAX_PACK_VOLTAGE_STANDARD_DV 3640 //Standard range
#define MIN_PACK_VOLTAGE_STANDARD_DV 3136 //Standard range
#define MAX_CELL_DEVIATION_MV 230
#define MAX_CELL_VOLTAGE_MV 3650 //Charging stops if one cell exceeds this value
#define MIN_CELL_VOLTAGE_MV 2800 //Discharging stops if one cell goes below this value
class BydAttoBattery : public CanBattery {
public:
// Use this constructor for the second battery.
@ -73,6 +63,16 @@ class BydAttoBattery : public CanBattery {
DATALAYER_INFO_BYDATTO3* datalayer_bydatto;
bool* allows_contactor_closing;
static const int CELLCOUNT_EXTENDED = 126;
static const int CELLCOUNT_STANDARD = 104;
static const int MAX_PACK_VOLTAGE_EXTENDED_DV = 4410; //Extended range
static const int MIN_PACK_VOLTAGE_EXTENDED_DV = 3800; //Extended range
static const int MAX_PACK_VOLTAGE_STANDARD_DV = 3640; //Standard range
static const int MIN_PACK_VOLTAGE_STANDARD_DV = 3136; //Standard range
static const int MAX_CELL_DEVIATION_MV = 230;
static const int MAX_CELL_VOLTAGE_MV = 3650; //Charging stops if one cell exceeds this value
static const int MIN_CELL_VOLTAGE_MV = 2800; //Discharging stops if one cell goes below this value
static const int POLL_FOR_BATTERY_SOC = 0x0005;
static const uint8_t NOT_DETERMINED_YET = 0;
static const uint8_t STANDARD_RANGE = 1;

View file

@ -6,18 +6,19 @@
#define BATTERY_SELECTED
#define SELECTED_BATTERY_CLASS JaguarIpaceBattery
#define MAX_PACK_VOLTAGE_DV 4546 //5000 = 500.0V
#define MIN_PACK_VOLTAGE_DV 3370
#define MAX_CELL_DEVIATION_MV 250
#define MAX_CELL_VOLTAGE_MV 4250 //Battery is put into emergency stop if one cell goes over this value
#define MIN_CELL_VOLTAGE_MV 2700 //Battery is put into emergency stop if one cell goes below this value
class JaguarIpaceBattery : public CanBattery {
public:
virtual void setup(void);
virtual void handle_incoming_can_frame(CAN_frame rx_frame);
virtual void update_values();
virtual void transmit_can(unsigned long currentMillis);
private:
static const int MAX_PACK_VOLTAGE_DV = 4546; //5000 = 500.0V
static const int MIN_PACK_VOLTAGE_DV = 3370;
static const int MAX_CELL_DEVIATION_MV = 250;
static const int MAX_CELL_VOLTAGE_MV = 4250; //Battery is put into emergency stop if one cell goes over this value
static const int MIN_CELL_VOLTAGE_MV = 2700; //Battery is put into emergency stop if one cell goes below this value
};
#endif

View file

@ -10,12 +10,6 @@
#define BATTERY_SELECTED
#define SELECTED_BATTERY_CLASS NissanLeafBattery
#define MAX_PACK_VOLTAGE_DV 4040 //5000 = 500.0V
#define MIN_PACK_VOLTAGE_DV 2600
#define MAX_CELL_DEVIATION_MV 150
#define MAX_CELL_VOLTAGE_MV 4250 //Battery is put into emergency stop if one cell goes over this value
#define MIN_CELL_VOLTAGE_MV 2700 //Battery is put into emergency stop if one cell goes below this value
class NissanLeafBattery : public CanBattery {
public:
// Use this constructor for the second battery.
@ -53,6 +47,12 @@ class NissanLeafBattery : public CanBattery {
BatteryHtmlRenderer& get_status_renderer() { return renderer; }
private:
static const int MAX_PACK_VOLTAGE_DV = 4040; //5000 = 500.0V
static const int MIN_PACK_VOLTAGE_DV = 2600;
static const int MAX_CELL_DEVIATION_MV = 150;
static const int MAX_CELL_VOLTAGE_MV = 4250; //Battery is put into emergency stop if one cell goes over this value
static const int MIN_CELL_VOLTAGE_MV = 2700; //Battery is put into emergency stop if one cell goes below this value
NissanLeafHtmlRenderer renderer;
bool is_message_corrupt(CAN_frame rx_frame);

View file

@ -7,12 +7,6 @@
#define BATTERY_SELECTED
#define SELECTED_BATTERY_CLASS RenaultZoeGen1Battery
#define MAX_PACK_VOLTAGE_DV 4200 //5000 = 500.0V
#define MIN_PACK_VOLTAGE_DV 3000
#define MAX_CELL_DEVIATION_MV 150
#define MAX_CELL_VOLTAGE_MV 4250 //Battery is put into emergency stop if one cell goes over this value
#define MIN_CELL_VOLTAGE_MV 2700 //Battery is put into emergency stop if one cell goes below this value
class RenaultZoeGen1Battery : public CanBattery {
public:
// Use this constructor for the second battery.
@ -42,6 +36,12 @@ class RenaultZoeGen1Battery : public CanBattery {
private:
RenaultZoeGen1HtmlRenderer renderer;
static const int MAX_PACK_VOLTAGE_DV = 4200; //5000 = 500.0V
static const int MIN_PACK_VOLTAGE_DV = 3000;
static const int MAX_CELL_DEVIATION_MV = 150;
static const int MAX_CELL_VOLTAGE_MV = 4250; //Battery is put into emergency stop if one cell goes over this value
static const int MIN_CELL_VOLTAGE_MV = 2700; //Battery is put into emergency stop if one cell goes below this value
DATALAYER_BATTERY_TYPE* datalayer_battery;
DATALAYER_INFO_ZOE* datalayer_zoe;