mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
Changes due to review comments
- Split bms_status (system status) to real_bms_status (bms status) - Put #ifdef DEBUG_LOG around all log calls. - Do not update bms_status (system status) directly, fire event instead from automatic precharge control - Add Battery BMS status to webserver for MEB battery type only
This commit is contained in:
parent
753b506068
commit
9410b8732b
11 changed files with 103 additions and 50 deletions
|
@ -134,3 +134,31 @@ void Logging::printf(const char* fmt, ...) {
|
|||
previous_message_was_newline = message_buffer[size - 1] == '\n';
|
||||
#endif // DEBUG_LOG
|
||||
}
|
||||
|
||||
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){
|
||||
id = "2";
|
||||
}
|
||||
if (previous_state != bms_status) {
|
||||
switch (bms_status) {
|
||||
case BMS_ACTIVE:
|
||||
logging.printf("Battery%s BMS state changed to: OK\n", id);
|
||||
break;
|
||||
case BMS_DISCONNECTED:
|
||||
logging.printf("Battery%s BMS state changed to: DISCONNECTED\n");
|
||||
break;
|
||||
case BMS_FAULT:
|
||||
logging.printf("Battery%s BMS state changed to: FAULT\n");
|
||||
break;
|
||||
case BMS_STANDBY:
|
||||
logging.printf("Battery%s BMS state changed to: STANDBY\n");
|
||||
break;
|
||||
default:
|
||||
logging.printf("Battery%s BMS state changed to: ??\n");
|
||||
break;
|
||||
}
|
||||
previous_state = bms_status;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue