mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
Simplify bms_status logging
This commit is contained in:
parent
5453115dc2
commit
3348d79f66
3 changed files with 4 additions and 8 deletions
|
@ -313,7 +313,7 @@ void core_loop(void* task_time_us) {
|
|||
emulator_pause_state_transmit_can_battery();
|
||||
}
|
||||
#ifdef DEBUG_LOG
|
||||
logging.log_bms_status(datalayer.battery.status.real_bms_status, 1);
|
||||
logging.log_bms_status(datalayer.battery.status.real_bms_status);
|
||||
#endif
|
||||
esp_task_wdt_reset(); // Reset watchdog to prevent reset
|
||||
vTaskDelayUntil(&xLastWakeTime, xFrequency);
|
||||
|
|
|
@ -135,16 +135,12 @@ 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) {
|
||||
static real_bms_status_enum previous_state = BMS_FAULT;
|
||||
const char* id = "";
|
||||
if (battery_id == 2) {
|
||||
id = "2";
|
||||
}
|
||||
if (previous_state != bms_status) {
|
||||
switch (bms_status) {
|
||||
case BMS_ACTIVE:
|
||||
logging.printf("Battery%s BMS state changed to: OK\n", id);
|
||||
logging.printf("Battery%s BMS state changed to: OK\n");
|
||||
break;
|
||||
case BMS_DISCONNECTED:
|
||||
logging.printf("Battery%s BMS state changed to: DISCONNECTED\n");
|
||||
|
|
|
@ -12,7 +12,7 @@ class Logging : public Print {
|
|||
virtual size_t write(const uint8_t* buffer, size_t size);
|
||||
virtual size_t write(uint8_t) { return 0; }
|
||||
void printf(const char* fmt, ...);
|
||||
void log_bms_status(real_bms_status_enum bms_status, int battery_id);
|
||||
void log_bms_status(real_bms_status_enum bms_status);
|
||||
Logging() {}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue