Merge from main and fix conflict

This commit is contained in:
Jaakko Haakana 2025-05-14 17:37:25 +03:00
commit 541bab131e
10 changed files with 69 additions and 21 deletions

View file

@ -1,5 +1,5 @@
# This is the name of the workflow, visible on GitHub UI. # This is the name of the workflow, visible on GitHub UI.
name: Compile All Batteries name: 🔋 Compile All Batteries
# Here we tell GitHub when to run the workflow. # Here we tell GitHub when to run the workflow.
on: on:

View file

@ -1,5 +1,5 @@
# This is the name of the workflow, visible on GitHub UI. # This is the name of the workflow, visible on GitHub UI.
name: Compile All Combinations name: 🔌🔋💫 Compile All Combinations
# Here we tell GitHub when to run the workflow. # Here we tell GitHub when to run the workflow.
on: on:

View file

@ -1,5 +1,5 @@
# This is the name of the workflow, visible on GitHub UI. # This is the name of the workflow, visible on GitHub UI.
name: Compile All Double Batteries name: 🔋🔋 Compile All Double Batteries
# Here we tell GitHub when to run the workflow. # Here we tell GitHub when to run the workflow.
on: on:

View file

@ -1,5 +1,5 @@
# This is the name of the workflow, visible on GitHub UI. # This is the name of the workflow, visible on GitHub UI.
name: Compile All Hardware name: 🤖 Compile All Hardware
# Here we tell GitHub when to run the workflow. # Here we tell GitHub when to run the workflow.
on: on:

View file

@ -1,5 +1,5 @@
# This is the name of the workflow, visible on GitHub UI. # This is the name of the workflow, visible on GitHub UI.
name: Compile All Inverters name: 🔌 Compile All Inverters
# Here we tell GitHub when to run the workflow. # Here we tell GitHub when to run the workflow.
on: on:

View file

@ -1,6 +1,6 @@
# This GithHub Action runs the pre-commit defined in the .pre-commit-config.yaml file # This GithHub Action runs the pre-commit defined in the .pre-commit-config.yaml file
name: Run pre-commit name: 📝 Run pre-commit
on: on:
- push - push

View file

@ -1,4 +1,4 @@
name: Run Unit Tests name: ⚙️ Run Unit Tests
on: [push, pull_request] on: [push, pull_request]

View file

@ -71,7 +71,7 @@ void ChevyVoltCharger::map_can_frame_to_variable(CAN_frame rx_frame) {
break; break;
default: default:
#ifdef DEBUG_LOG #ifdef DEBUG_LOG
logging.printf("CAN Rcv unknown frame MsgID=%x\n", rx_frame.MsgID); logging.printf("CAN Rcv unknown frame MsgID=%x\n", rx_frame.ID);
#endif #endif
break; break;
} }
@ -149,9 +149,9 @@ void ChevyVoltCharger::transmit_can(unsigned long currentMillis) {
/* Serial echo every 5s of charger stats */ /* Serial echo every 5s of charger stats */
if (currentMillis - previousMillis5000ms >= INTERVAL_5_S) { if (currentMillis - previousMillis5000ms >= INTERVAL_5_S) {
previousMillis5000ms = currentMillis; previousMillis5000ms = currentMillis;
logging.printf("Charger AC in IAC=%fA VAC=%fV\n", charger_stat_ACcur, charger_stat_ACvol); logging.printf("Charger AC in IAC=%fA VAC=%fV\n", AC_input_current(), AC_input_voltage());
logging.printf("Charger HV out IDC=%fA VDC=%fV\n", charger_stat_HVcur, charger_stat_HVvol); logging.printf("Charger HV out IDC=%fA VDC=%fV\n", HVDC_output_current(), HVDC_output_voltage());
logging.printf("Charger LV out IDC=%fA VDC=%fV\n", charger_stat_LVcur, charger_stat_LVvol); logging.printf("Charger LV out IDC=%fA VDC=%fV\n", LVDC_output_current(), LVDC_output_voltage());
logging.printf("Charger mode=%s\n", (charger_mode > MODE_DISABLED) ? "Enabled" : "Disabled"); logging.printf("Charger mode=%s\n", (charger_mode > MODE_DISABLED) ? "Enabled" : "Disabled");
logging.printf("Charger HVset=%uV,%uA finishCurrent=%uA\n", setpoint_HV_VDC, setpoint_HV_IDC, setpoint_HV_IDC_END); logging.printf("Charger HVset=%uV,%uA finishCurrent=%uA\n", setpoint_HV_VDC, setpoint_HV_IDC, setpoint_HV_IDC_END);
} }

View file

@ -484,6 +484,7 @@ void mqtt_message_received(char* topic_raw, int topic_len, char* data, int data_
if (strcmp(topic, generateButtonTopic("STOP").c_str()) == 0) { if (strcmp(topic, generateButtonTopic("STOP").c_str()) == 0) {
setBatteryPause(true, false, true); setBatteryPause(true, false, true);
} }
free(topic);
} }
static void mqtt_event_handler(void* handler_args, esp_event_base_t base, int32_t event_id, void* event_data) { static void mqtt_event_handler(void* handler_args, esp_event_base_t base, int32_t event_id, void* event_data) {

View file

@ -63,20 +63,23 @@ void SmaBydHvsInverter::
} }
//Error bits //Error bits
if (datalayer.system.status.inverter_allows_contactor_closing) { if (datalayer.system.status.battery_allows_contactor_closing) {
SMA_158.data.u8[2] = 0xAA; 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 { } else {
SMA_158.data.u8[2] = 0x6A; 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
} }
#ifdef INVERTER_CONTACTOR_ENABLE_LED_PIN
// Inverter allows contactor closing
if (datalayer.system.status.inverter_allows_contactor_closing) {
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
HIGH); // Turn on LED to indicate that SMA inverter allows contactor closing
} else {
digitalWrite(INVERTER_CONTACTOR_ENABLE_LED_PIN,
LOW); // Turn off LED to indicate that SMA inverter does not allow contactor closing
}
#endif // INVERTER_CONTACTOR_ENABLE_LED_PIN
// Check if Enable line is working. If we go too long without any input, raise an event // Check if Enable line is working. If we go too long without any input, raise an event
if (!datalayer.system.status.inverter_allows_contactor_closing) { if (!datalayer.system.status.inverter_allows_contactor_closing) {
timeWithoutInverterAllowsContactorClosing++; timeWithoutInverterAllowsContactorClosing++;
@ -166,21 +169,65 @@ void SmaBydHvsInverter::map_can_frame_to_variable(CAN_frame rx_frame) {
case 0x560: //Message originating from SMA inverter - Init case 0x560: //Message originating from SMA inverter - Init
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE; datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break; break;
case 0x561:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x562:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x563:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x564:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x565:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x566:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x567:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E0: //Message originating from SMA inverter - String case 0x5E0: //Message originating from SMA inverter - String
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE; datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
//Inverter brand (frame1-3 = 0x53 0x4D 0x41) = SMA //Inverter brand (frame1-3 = 0x53 0x4D 0x41) = SMA
break; break;
case 0x5E1:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E2:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E3:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E4:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E5:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E6:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
case 0x5E7: //Pairing request case 0x5E7: //Pairing request
#ifdef DEBUG_LOG
logging.println("Received 0x5E7: SMA pairing request");
#endif // DEBUG_LOG
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE; datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
transmit_can_init(); transmit_can_init();
break; break;
case 0x62C:
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
break;
default: default:
break; break;
} }
} }
void SmaBydHvsInverter::transmit_can(unsigned long currentMillis) { void SmaBydHvsInverter::transmit_can(unsigned long currentMillis) {
// Send CAN Message every 100ms if inverter allows contactor closing // Send CAN Message every 100ms if inverter allows contactor closing
if (datalayer.system.status.inverter_allows_contactor_closing) { if (datalayer.system.status.inverter_allows_contactor_closing) {
if (currentMillis - previousMillis100ms >= 100) { if (currentMillis - previousMillis100ms >= 100) {