mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Merge from main and fix conflict
This commit is contained in:
commit
541bab131e
10 changed files with 69 additions and 21 deletions
2
.github/workflows/compile-all-batteries.yml
vendored
2
.github/workflows/compile-all-batteries.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
# 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.
|
||||
on:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 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.
|
||||
on:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 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.
|
||||
on:
|
||||
|
|
2
.github/workflows/compile-all-hardware.yml
vendored
2
.github/workflows/compile-all-hardware.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
# 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.
|
||||
on:
|
||||
|
|
2
.github/workflows/compile-all-inverters.yml
vendored
2
.github/workflows/compile-all-inverters.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
# 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.
|
||||
on:
|
||||
|
|
2
.github/workflows/run-pre-commit.yml
vendored
2
.github/workflows/run-pre-commit.yml
vendored
|
@ -1,6 +1,6 @@
|
|||
# This GithHub Action runs the pre-commit defined in the .pre-commit-config.yaml file
|
||||
|
||||
name: Run pre-commit
|
||||
name: 📝 Run pre-commit
|
||||
|
||||
on:
|
||||
- push
|
||||
|
|
2
.github/workflows/unit-tests.yml
vendored
2
.github/workflows/unit-tests.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: Run Unit Tests
|
||||
name: ⚙️ Run Unit Tests
|
||||
|
||||
|
||||
on: [push, pull_request]
|
||||
|
|
|
@ -71,7 +71,7 @@ void ChevyVoltCharger::map_can_frame_to_variable(CAN_frame rx_frame) {
|
|||
break;
|
||||
default:
|
||||
#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
|
||||
break;
|
||||
}
|
||||
|
@ -149,9 +149,9 @@ void ChevyVoltCharger::transmit_can(unsigned long currentMillis) {
|
|||
/* Serial echo every 5s of charger stats */
|
||||
if (currentMillis - previousMillis5000ms >= INTERVAL_5_S) {
|
||||
previousMillis5000ms = currentMillis;
|
||||
logging.printf("Charger AC in IAC=%fA VAC=%fV\n", charger_stat_ACcur, charger_stat_ACvol);
|
||||
logging.printf("Charger HV out IDC=%fA VDC=%fV\n", charger_stat_HVcur, charger_stat_HVvol);
|
||||
logging.printf("Charger LV out IDC=%fA VDC=%fV\n", charger_stat_LVcur, charger_stat_LVvol);
|
||||
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", HVDC_output_current(), HVDC_output_voltage());
|
||||
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 HVset=%uV,%uA finishCurrent=%uA\n", setpoint_HV_VDC, setpoint_HV_IDC, setpoint_HV_IDC_END);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
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) {
|
||||
|
|
|
@ -63,20 +63,23 @@ void SmaBydHvsInverter::
|
|||
}
|
||||
|
||||
//Error bits
|
||||
if (datalayer.system.status.inverter_allows_contactor_closing) {
|
||||
if (datalayer.system.status.battery_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
|
||||
}
|
||||
|
||||
#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
|
||||
if (!datalayer.system.status.inverter_allows_contactor_closing) {
|
||||
timeWithoutInverterAllowsContactorClosing++;
|
||||
|
@ -166,21 +169,65 @@ void SmaBydHvsInverter::map_can_frame_to_variable(CAN_frame rx_frame) {
|
|||
case 0x560: //Message originating from SMA inverter - Init
|
||||
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
|
||||
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
|
||||
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
|
||||
//Inverter brand (frame1-3 = 0x53 0x4D 0x41) = SMA
|
||||
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
|
||||
#ifdef DEBUG_LOG
|
||||
logging.println("Received 0x5E7: SMA pairing request");
|
||||
#endif // DEBUG_LOG
|
||||
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
|
||||
transmit_can_init();
|
||||
break;
|
||||
case 0x62C:
|
||||
datalayer.system.status.CAN_inverter_still_alive = CAN_STILL_ALIVE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SmaBydHvsInverter::transmit_can(unsigned long currentMillis) {
|
||||
|
||||
// Send CAN Message every 100ms if inverter allows contactor closing
|
||||
if (datalayer.system.status.inverter_allows_contactor_closing) {
|
||||
if (currentMillis - previousMillis100ms >= 100) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue