Skip to content

Commit

Permalink
Add Solax-Tesla waiting for contactor close
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Nov 28, 2023
1 parent 2d6026e commit dcd525c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 11 additions & 9 deletions Software/src/battery/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,16 +519,18 @@ the first, for a few cycles, then stop all messages which causes the contactor
if (currentMillis - previousMillis30 >= interval30) {
previousMillis30 = currentMillis;

if (bms_status == ACTIVE) {
send221still = 50;
batteryAllowsContactorClosing = true;
ESP32Can.CANWriteFrame(&TESLA_221_1);
ESP32Can.CANWriteFrame(&TESLA_221_2);
} else { //bms_status == FAULT
if (send221still > 0) {
batteryAllowsContactorClosing = false;
if (inverterAllowsContactorClosing == 1) {
if (bms_status == ACTIVE) {
send221still = 50;
batteryAllowsContactorClosing = true;
ESP32Can.CANWriteFrame(&TESLA_221_1);
send221still--;
ESP32Can.CANWriteFrame(&TESLA_221_2);
} else { //bms_status == FAULT or inverter requested opening contactors
if (send221still > 0) {
batteryAllowsContactorClosing = false;
ESP32Can.CANWriteFrame(&TESLA_221_1);
send221still--;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Software/src/battery/TESLA-MODEL-3-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint8_t LEDcolor; //Enum, 0-10
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false
// Definitions for BMS status
#define STANDBY 0
#define INACTIVE 1
Expand Down

0 comments on commit dcd525c

Please sign in to comment.