mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Fix code formatting.
This commit is contained in:
parent
d5228efe9f
commit
40fbdc5f73
3 changed files with 14 additions and 10 deletions
|
@ -1544,7 +1544,7 @@ void transmit_can_battery() {
|
|||
#endif
|
||||
can_msg_received = RX_DEFAULT;
|
||||
first_can_msg = 0;
|
||||
if (datalayer.battery.status.real_bms_status != BMS_FAULT){
|
||||
if (datalayer.battery.status.real_bms_status != BMS_FAULT) {
|
||||
datalayer.battery.status.real_bms_status = BMS_DISCONNECTED;
|
||||
datalayer.system.status.battery_allows_contactor_closing = false;
|
||||
}
|
||||
|
@ -1617,8 +1617,9 @@ void transmit_can_battery() {
|
|||
|
||||
//HV request and DC/DC control lies in 0x503
|
||||
|
||||
if (datalayer.battery.status.real_bms_status != BMS_FAULT && /*first_can_msg > 0 && currentMillis > first_can_msg + 2000*/
|
||||
(datalayer.battery.status.real_bms_status == BMS_STANDBY || datalayer.battery.status.real_bms_status == BMS_ACTIVE) &&
|
||||
if (datalayer.battery.status.real_bms_status != BMS_FAULT &&
|
||||
(datalayer.battery.status.real_bms_status == BMS_STANDBY ||
|
||||
datalayer.battery.status.real_bms_status == BMS_ACTIVE) &&
|
||||
(labs(((int32_t)datalayer.battery.status.voltage_dV) -
|
||||
((int32_t)datalayer_extended.meb.BMS_voltage_intermediate_dV)) < 200)) {
|
||||
#ifdef DEBUG_LOG
|
||||
|
@ -1627,7 +1628,8 @@ void transmit_can_battery() {
|
|||
}
|
||||
#endif
|
||||
MEB_503.data.u8[1] =
|
||||
0x30 | (datalayer.battery.status.real_bms_status == BMS_ACTIVE ? 0x00 : 0x80); // Disable precharing if ACTIVE
|
||||
0x30 |
|
||||
(datalayer.battery.status.real_bms_status == BMS_ACTIVE ? 0x00 : 0x80); // Disable precharing if ACTIVE
|
||||
MEB_503.data.u8[3] = BMS_TARGET_HV_ON; //TODO, should we try AC_2 or DC charging?
|
||||
MEB_503.data.u8[5] = 0x82; // Bordnetz Active
|
||||
MEB_503.data.u8[6] = 0xE0; // Request emergency shutdown HV system == 0, false
|
||||
|
|
|
@ -48,7 +48,8 @@ void handle_precharge_control() {
|
|||
case PRECHARGE_IDLE:
|
||||
|
||||
if (datalayer.battery.status.bms_status != FAULT && datalayer.battery.status.real_bms_status == BMS_STANDBY &&
|
||||
datalayer.system.status.inverter_allows_contactor_closing && !datalayer.system.settings.equipment_stop_active) {
|
||||
datalayer.system.status.inverter_allows_contactor_closing &&
|
||||
!datalayer.system.settings.equipment_stop_active) {
|
||||
prechargeStatus = START_PRECHARGE;
|
||||
}
|
||||
break;
|
||||
|
@ -94,7 +95,8 @@ void handle_precharge_control() {
|
|||
ledcWriteTone(PRECHARGE_PIN, freq);
|
||||
}
|
||||
|
||||
if ((datalayer.battery.status.real_bms_status != BMS_STANDBY && datalayer.battery.status.real_bms_status != BMS_ACTIVE) ||
|
||||
if ((datalayer.battery.status.real_bms_status != BMS_STANDBY &&
|
||||
datalayer.battery.status.real_bms_status != BMS_ACTIVE) ||
|
||||
datalayer.battery.status.bms_status != ACTIVE || datalayer.system.settings.equipment_stop_active) {
|
||||
pinMode(PRECHARGE_PIN, OUTPUT);
|
||||
digitalWrite(PRECHARGE_PIN, LOW);
|
||||
|
|
|
@ -135,10 +135,10 @@ void Logging::printf(const char* fmt, ...) {
|
|||
#endif // DEBUG_LOG
|
||||
}
|
||||
|
||||
void Logging::log_bms_status(real_bms_status_enum bms_status, int battery_id){
|
||||
void Logging::log_bms_status(real_bms_status_enum bms_status, int battery_id) {
|
||||
static real_bms_status_enum previous_state = BMS_FAULT;
|
||||
const char *id = "";
|
||||
if (battery_id == 2){
|
||||
const char* id = "";
|
||||
if (battery_id == 2) {
|
||||
id = "2";
|
||||
}
|
||||
if (previous_state != bms_status) {
|
||||
|
@ -161,4 +161,4 @@ void Logging::log_bms_status(real_bms_status_enum bms_status, int battery_id){
|
|||
}
|
||||
previous_state = bms_status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue