Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Indicate that SMA inverter allows contactor closing via LED #703

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Software/src/inverter/BYD-SMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,18 @@ void update_values_can_inverter() { //This function maps all the values fetched
}

//Error bits
if (!datalayer.system.status.inverter_allows_contactor_closing) {
SMA_158.data.u8[2] = 0x6A;
} else {
if (datalayer.system.status.inverter_allows_contactor_closing) {
SMA_158.data.u8[2] = 0xAA;
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
HIGH); // Turn on LED to indicate that SMA inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
} else {
SMA_158.data.u8[2] = 0x6A;
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
LOW); // Turn off LED to indicate that SMA inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
}

/*
Expand Down Expand Up @@ -251,10 +259,15 @@ void send_can_inverter() {
}
}
}

void setup_inverter(void) { // Performs one time setup at startup over CAN bus
strncpy(datalayer.system.info.inverter_protocol, "BYD Battery-Box HVS over SMA CAN", 63);
datalayer.system.info.inverter_protocol[63] = '\0';
datalayer.system.status.inverter_allows_contactor_closing = false; // The inverter needs to allow first
pinMode(INVERTER_CONTACTOR_ENABLE_PIN, INPUT);
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
pinMode(INVERTER_CONTACTOR_ENABLE_LED_PIN, OUTPUT);
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN, LOW); // Turn LED off, until inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
}
#endif
18 changes: 15 additions & 3 deletions Software/src/inverter/SMA-CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,18 @@ void update_values_can_inverter() { //This function maps all the values fetched
}

//Error bits
if (!datalayer.system.status.inverter_allows_contactor_closing) {
SMA_158.data.u8[2] = 0x6A;
} else {
if (datalayer.system.status.inverter_allows_contactor_closing) {
SMA_158.data.u8[2] = 0xAA;
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
HIGH); // Turn on LED to indicate that SMA inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
} else {
SMA_158.data.u8[2] = 0x6A;
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
LOW); // Turn off LED to indicate that SMA inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
}

/*
Expand Down Expand Up @@ -253,5 +261,9 @@ void send_can_inverter() {
void setup_inverter(void) { // Performs one time setup at startup over CAN bus
strncpy(datalayer.system.info.inverter_protocol, "SMA CAN", 63);
datalayer.system.info.inverter_protocol[63] = '\0';
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
pinMode(INVERTER_CONTACTOR_ENABLE_LED_PIN, OUTPUT);
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN, LOW); // Turn LED off, until inverter allows contactor closing
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
}
#endif
Loading