Skip to content

Commit

Permalink
Remove serial-print in favour of logging method
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Jan 13, 2025
1 parent cad8fe6 commit 5ec94c4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
16 changes: 8 additions & 8 deletions Software/src/battery/BMW-SBOX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ void transmit_can_shunt() {
SBOX_100.data.u8[0] = 0x86; // Precharge relay only
prechargeStartTime = currentTime;
contactorStatus = NEGATIVE;
#ifdef DEBUG_VIA_USB
Serial.println("S-BOX Precharge relay engaged");
#ifdef DEBUG_LOG
logging.println("S-BOX Precharge relay engaged");
#endif
break;
case NEGATIVE:
Expand All @@ -166,8 +166,8 @@ void transmit_can_shunt() {
negativeStartTime = currentTime;
contactorStatus = POSITIVE;
datalayer.shunt.precharging = true;
#ifdef DEBUG_VIA_USB
Serial.println("S-BOX Negative relay engaged");
#ifdef DEBUG_LOG
logging.println("S-BOX Negative relay engaged");
#endif
}
break;
Expand All @@ -179,17 +179,17 @@ void transmit_can_shunt() {
positiveStartTime = currentTime;
contactorStatus = PRECHARGE_OFF;
datalayer.shunt.precharging = false;
#ifdef DEBUG_VIA_USB
Serial.println("S-BOX Positive relay engaged");
#ifdef DEBUG_LOG
logging.println("S-BOX Positive relay engaged");
#endif
}
break;
case PRECHARGE_OFF:
if (currentTime - positiveStartTime >= CONTACTOR_CONTROL_T3) {
SBOX_100.data.u8[0] = 0x6A; // Negative + Positive
contactorStatus = COMPLETED;
#ifdef DEBUG_VIA_USB
Serial.println("S-BOX Precharge relay released");
#ifdef DEBUG_LOG
logging.println("S-BOX Precharge relay released");
#endif
datalayer.shunt.contactors_engaged = true;
}
Expand Down
5 changes: 2 additions & 3 deletions Software/src/battery/ECMP-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,8 @@ void transmit_can_battery() {
}

void setup_battery(void) { // Performs one time setup at startup
#ifdef DEBUG_VIA_USB
Serial.println("ECMP battery selected");
#endif
strncpy(datalayer.system.info.battery_protocol, "Stellantis eCMP platform", 63);
datalayer.system.info.battery_protocol[63] = '\0';
datalayer.battery.info.number_of_cells = 108;
datalayer.battery.info.max_design_voltage_dV = 4546; // 454.6V, charging over this is not possible
datalayer.battery.info.min_design_voltage_dV = 3210; // 321.0V, under this, discharging further is disabled
Expand Down
12 changes: 6 additions & 6 deletions Software/src/charger/CHEVY-VOLT-CHARGER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void map_can_frame_to_variable_charger(CAN_frame rx_frame) {
break;
default:
#ifdef DEBUG_LOG
logging.printf("CAN Rcv unknown frame MsgID=%x\n", rx_frame.MsgID);
logging.print("CAN Rcv unknown frame MsgID=%x\n", rx_frame.MsgID);
#endif
break;
}
Expand Down Expand Up @@ -181,11 +181,11 @@ void transmit_can_charger() {
/* 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 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.println("Charger AC in IAC=%fA VAC=%fV\n", charger_stat_ACcur, charger_stat_ACvol);
logging.println("Charger HV out IDC=%fA VDC=%fV\n", charger_stat_HVcur, charger_stat_HVvol);
logging.println("Charger LV out IDC=%fA VDC=%fV\n", charger_stat_LVcur, charger_stat_LVvol);
logging.println("Charger mode=%s\n", (charger_mode > MODE_DISABLED) ? "Enabled" : "Disabled");
logging.println("Charger HVset=%uV,%uA finishCurrent=%uA\n", setpoint_HV_VDC, setpoint_HV_IDC, setpoint_HV_IDC_END);
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Software/src/devboard/webserver/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ void onOTAProgress(size_t current, size_t final) {
if (millis() - ota_progress_millis > 1000) {
ota_progress_millis = millis();
#ifdef DEBUG_LOG
logging.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
logging.println("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
#endif // DEBUG_LOG
// Reset the "watchdog"
ota_timeout_timer.reset();
Expand Down
4 changes: 2 additions & 2 deletions Software/src/inverter/SUNGROW-CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ void update_values_can_inverter() { //This function maps all the values fetched
//SUNGROW_400.data.u8[6] =
//SUNGROW_400.data.u8[7] =

#ifdef DEBUG_VIA_USB
#ifdef DEBUG_LOG
if (inverter_sends_000) {
Serial.println("Inverter sends 0x000");
logging.println("Inverter sends 0x000");
}
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions Software/src/lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ int ESP32CAN::CANWriteFrame(const CAN_frame_t* p_frame) {
result = CAN_write_frame(p_frame);
tx_ok = (result == 0) ? true : false;
if (tx_ok == false) {
#ifdef DEBUG_VIA_USB
Serial.println("CAN failure! Check wires");
#ifdef DEBUG_LOG
logging.println("CAN failure! Check wires");
#endif
set_event(EVENT_CAN_TX_FAILURE, 0);
start_time = millis();
Expand Down

0 comments on commit 5ec94c4

Please sign in to comment.