mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Fix definition of maxcells
This commit is contained in:
parent
f6b036052c
commit
443619535a
2 changed files with 3 additions and 5 deletions
|
@ -1060,10 +1060,6 @@ void transmit_can_battery() {
|
||||||
case CELL_VOLTAGE_CELLNO:
|
case CELL_VOLTAGE_CELLNO:
|
||||||
current_cell_polled++;
|
current_cell_polled++;
|
||||||
if (current_cell_polled > 96) {
|
if (current_cell_polled > 96) {
|
||||||
datalayer.battery.info.number_of_cells = 97;
|
|
||||||
#ifdef DOUBLE_BATTERY
|
|
||||||
datalayer.battery2.info.number_of_cells = 97;
|
|
||||||
#endif
|
|
||||||
cmdState = CELL_VOLTAGE_CELLNO_LAST;
|
cmdState = CELL_VOLTAGE_CELLNO_LAST;
|
||||||
} else {
|
} else {
|
||||||
cmdState = CELL_VOLTAGE_CELLNO;
|
cmdState = CELL_VOLTAGE_CELLNO;
|
||||||
|
@ -1150,13 +1146,14 @@ void setup_battery(void) { // Performs one time setup at startup
|
||||||
datalayer.battery.info.min_design_voltage_dV = MIN_PACK_VOLTAGE_60AH;
|
datalayer.battery.info.min_design_voltage_dV = MIN_PACK_VOLTAGE_60AH;
|
||||||
datalayer.battery.info.max_cell_voltage_deviation_mV = MAX_CELL_DEVIATION_MV;
|
datalayer.battery.info.max_cell_voltage_deviation_mV = MAX_CELL_DEVIATION_MV;
|
||||||
datalayer.system.status.battery_allows_contactor_closing = true;
|
datalayer.system.status.battery_allows_contactor_closing = true;
|
||||||
|
datalayer.battery.info.number_of_cells = NUMBER_OF_CELLS;
|
||||||
#ifdef DOUBLE_BATTERY
|
#ifdef DOUBLE_BATTERY
|
||||||
datalayer.battery2.info.max_design_voltage_dV = datalayer.battery.info.max_design_voltage_dV;
|
datalayer.battery2.info.max_design_voltage_dV = datalayer.battery.info.max_design_voltage_dV;
|
||||||
datalayer.battery2.info.min_design_voltage_dV = datalayer.battery.info.min_design_voltage_dV;
|
datalayer.battery2.info.min_design_voltage_dV = datalayer.battery.info.min_design_voltage_dV;
|
||||||
datalayer.battery2.info.max_cell_voltage_deviation_mV = datalayer.battery.info.max_cell_voltage_deviation_mV;
|
datalayer.battery2.info.max_cell_voltage_deviation_mV = datalayer.battery.info.max_cell_voltage_deviation_mV;
|
||||||
datalayer.battery2.status.voltage_dV =
|
datalayer.battery2.status.voltage_dV =
|
||||||
0; //Init voltage to 0 to allow contactor check to operate without fear of default values colliding
|
0; //Init voltage to 0 to allow contactor check to operate without fear of default values colliding
|
||||||
|
datalayer.battery2.info.number_of_cells = NUMBER_OF_CELLS;
|
||||||
#endif
|
#endif
|
||||||
pinMode(WUP_PIN1, OUTPUT);
|
pinMode(WUP_PIN1, OUTPUT);
|
||||||
digitalWrite(WUP_PIN1, HIGH); // Wake up the battery
|
digitalWrite(WUP_PIN1, HIGH); // Wake up the battery
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define MIN_PACK_VOLTAGE_94AH 2590 // Discharge stops if pack voltage exceeds this value
|
#define MIN_PACK_VOLTAGE_94AH 2590 // Discharge stops if pack voltage exceeds this value
|
||||||
#define MAX_PACK_VOLTAGE_120AH 4030 // Charge stops if pack voltage exceeds this value
|
#define MAX_PACK_VOLTAGE_120AH 4030 // Charge stops if pack voltage exceeds this value
|
||||||
#define MIN_PACK_VOLTAGE_120AH 2680 // Discharge stops if pack voltage exceeds this value
|
#define MIN_PACK_VOLTAGE_120AH 2680 // Discharge stops if pack voltage exceeds this value
|
||||||
|
#define NUMBER_OF_CELLS 96
|
||||||
void setup_battery(void);
|
void setup_battery(void);
|
||||||
void transmit_can_frame(CAN_frame* tx_frame, int interface);
|
void transmit_can_frame(CAN_frame* tx_frame, int interface);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue