diff --git a/Software/src/battery/CHADEMO-BATTERY.cpp b/Software/src/battery/CHADEMO-BATTERY.cpp index 79bd0ba4..aa0730af 100644 --- a/Software/src/battery/CHADEMO-BATTERY.cpp +++ b/Software/src/battery/CHADEMO-BATTERY.cpp @@ -714,9 +714,7 @@ void ChademoBattery::handle_chademo_sequence() { * with timers to have higher confidence of certain conditions hitting * a steady state */ -#ifdef DEBUG_LOG - logging.println("CHADEMO plug is not inserted, cannot connect d2 relay to begin initialization."); -#endif + LOG_PRINTLN("CHADEMO plug is not inserted, cannot connect d2 relay to begin initialization."); CHADEMO_Status = CHADEMO_IDLE; } break; @@ -725,9 +723,7 @@ void ChademoBattery::handle_chademo_sequence() { * Used for triggers/error handling elsewhere; * State change to CHADEMO_NEGOTIATE occurs in handle_incoming_can_frame_battery(..) */ -#ifdef DEBUG_LOG -// logging.println("Awaiting initial vehicle CAN to trigger negotiation"); -#endif + LOG_PRINTLN("Awaiting initial vehicle CAN to trigger negotiation"); evse_init(); break; case CHADEMO_NEGOTIATE: diff --git a/Software/src/battery/VOLVO-SPA-BATTERY.cpp b/Software/src/battery/VOLVO-SPA-BATTERY.cpp index fe27647c..a27868d3 100644 --- a/Software/src/battery/VOLVO-SPA-BATTERY.cpp +++ b/Software/src/battery/VOLVO-SPA-BATTERY.cpp @@ -102,8 +102,6 @@ void VolvoSpaBattery:: logging.println(MAX_U); logging.print("Battery minimum voltage limit: "); logging.println(MIN_U); - logging.print("Remaining Energy: "); - logging.println(remaining_capacity); logging.print("Discharge limit: "); logging.println(HvBattPwrLimDchaSoft); logging.print("Battery Error Indication: "); diff --git a/Software/src/communication/contactorcontrol/comm_contactorcontrol.cpp b/Software/src/communication/contactorcontrol/comm_contactorcontrol.cpp index 06c99843..ed5900aa 100644 --- a/Software/src/communication/contactorcontrol/comm_contactorcontrol.cpp +++ b/Software/src/communication/contactorcontrol/comm_contactorcontrol.cpp @@ -25,7 +25,7 @@ bool periodic_bms_reset = periodic_bms_reset_default; #ifdef REMOTE_BMS_RESET const bool remote_bms_reset_default = true; #else -const bool remote_bms_reset_default = true; +const bool remote_bms_reset_default = false; #endif bool remote_bms_reset = remote_bms_reset_default; diff --git a/Software/src/devboard/hal/hal.h b/Software/src/devboard/hal/hal.h index 2f8da77a..c013b7da 100644 --- a/Software/src/devboard/hal/hal.h +++ b/Software/src/devboard/hal/hal.h @@ -5,6 +5,7 @@ #include #include #include "../../../src/devboard/utils/events.h" +#include "../../../src/devboard/utils/logging.h" #include "../../../src/devboard/utils/types.h" // Hardware Abstraction Layer base class. @@ -30,14 +31,13 @@ class Esp32Hal { for (gpio_num_t pin : requested_pins) { if (pin < 0) { set_event(EVENT_GPIO_NOT_DEFINED, (int)pin); - // Event: {name} attempted to allocate pin that wasn't defined for the selected HW. + LOG_PRINT("%s attempted to allocate pin %d that wasn't defined for the selected HW.\n", name, (int)pin); return false; } auto it = allocated_pins.find(pin); if (it != allocated_pins.end()) { - // Event: GPIO conflict for pin {pin} between name and it->second. - //std::cerr << "Pin " << pin << " already allocated to \"" << it->second << "\".\n"; + LOG_PRINT("GPIO conflict for pin %d between %s and %s.\n", (int)pin, name, it->second.c_str()); set_event(EVENT_GPIO_CONFLICT, (int)pin); return false; } diff --git a/Software/src/devboard/safety/safety.cpp b/Software/src/devboard/safety/safety.cpp index 13cdbd4f..a8119e18 100644 --- a/Software/src/devboard/safety/safety.cpp +++ b/Software/src/devboard/safety/safety.cpp @@ -396,16 +396,12 @@ void update_pause_state() { allowed_to_send_CAN = (!emulator_pause_CAN_send_ON || emulator_pause_status == NORMAL); if (previous_allowed_to_send_CAN && !allowed_to_send_CAN) { -#ifdef DEBUG_LOG - logging.printf("Safety: Pausing CAN sending\n"); -#endif + LOG_PRINT("Safety: Pausing CAN sending\n"); //completely force stop the CAN communication stop_can(); } else if (!previous_allowed_to_send_CAN && allowed_to_send_CAN) { //resume CAN communication -#ifdef DEBUG_LOG - logging.printf("Safety: Resuming CAN sending\n"); -#endif + LOG_PRINT("Safety: Resuming CAN sending\n"); restart_can(); } } diff --git a/Software/src/devboard/utils/logging.h b/Software/src/devboard/utils/logging.h index 8d5a9e59..d2ee4e60 100644 --- a/Software/src/devboard/utils/logging.h +++ b/Software/src/devboard/utils/logging.h @@ -17,4 +17,17 @@ class Logging : public Print { }; extern Logging logging; + +#ifdef DEBUG_LOG +#define LOG_PRINT(fmt, ...) logging.printf(fmt, ##__VA_ARGS__) +#define LOG_PRINTLN(str) logging.println(str) +#else +#define LOG_PRINT(fmt, ...) \ + do { \ + } while (0) +#define LOG_PRINTLN(str) \ + do { \ + } while (0) +#endif + #endif // __LOGGING_H__ diff --git a/Software/src/devboard/webserver/events_html.cpp b/Software/src/devboard/webserver/events_html.cpp index e548bb71..8ec56d82 100644 --- a/Software/src/devboard/webserver/events_html.cpp +++ b/Software/src/devboard/webserver/events_html.cpp @@ -1,5 +1,6 @@ #include "events_html.h" #include "../../datalayer/datalayer.h" +#include "../../devboard/utils/logging.h" const char EVENTS_HTML_START[] = R"=====(
Event Type
Severity
Last Event
Count
Data
Message