Skip to content

Commit

Permalink
Change enable line logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Dec 1, 2024
1 parent ab755aa commit d411b0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
11 changes: 1 addition & 10 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,6 @@ void init_contactors() {
pinMode(BMS_POWER, OUTPUT);
digitalWrite(BMS_POWER, HIGH);
#endif //HW_STARK
#ifdef SMA_TRIPOWER_CAN
//pinMode(INVERTER_CONTACTOR_ENABLE_PIN, OUTPUT); //Incase this is an output
//digitalWrite(INVERTER_CONTACTOR_ENABLE_PIN, LOW); //Incase this is an output
#endif //SMA_TRIPOWER_CAN
}

void init_rs485() {
Expand Down Expand Up @@ -743,14 +739,9 @@ void check_interconnect_available() {
#endif //DOUBLE_BATTERY

void handle_contactors() {
#ifdef BYD_SMA
#if defined(BYD_SMA) || defined(SMA_TRIPOWER_CAN)
datalayer.system.status.inverter_allows_contactor_closing = digitalRead(INVERTER_CONTACTOR_ENABLE_PIN);
#endif
#ifdef SMA_TRIPOWER_CAN
//set(INVERTER_CONTACTOR_ENABLE_PIN, ON); //TODO: is this an input, or an output? Figure out and make logic
datalayer.system.status.inverter_allows_contactor_closing =
digitalRead(INVERTER_CONTACTOR_ENABLE_PIN); //Incase it is input
#endif

#ifdef CONTACTOR_CONTROL_DOUBLE_BATTERY
handle_contactors_battery2();
Expand Down
5 changes: 4 additions & 1 deletion Software/src/inverter/SMA-TRIPOWER-CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ void receive_can_inverter(CAN_frame rx_frame) {
void send_can_inverter() {
unsigned long currentMillis = millis();

//TODO, should we break before pairing_completed? Or rely on Enable line?
// Send CAN Message only if we're enabled by inverter
if (!datalayer.system.status.inverter_allows_contactor_closing) {
return;
}

// Send CAN Message every 2s
if (currentMillis - previousMillis2s >= INTERVAL_2_S) {
Expand Down

0 comments on commit d411b0a

Please sign in to comment.