CUER
/
charger_code
Code to run on the charger board (used to charge the car from the mains).
Diff: charger.cpp
- Revision:
- 12:77d493b3320b
- Parent:
- 11:f578a372be42
--- a/charger.cpp Sun Sep 10 11:33:19 2017 +0000 +++ b/charger.cpp Tue Sep 12 05:42:43 2017 +0000 @@ -23,6 +23,8 @@ bool charge_finished; bool bms_error; bool charging; +bool bms_timeout = false; +bool charger_timeout = false; float min_cell_voltage = 3600; //mV float max_cell_voltage = 3600;//mV @@ -81,7 +83,7 @@ t.reset(); car_CAN_data_sent = false; - car_can.write(generate_charger_info_msg(charger_voltage, charger_current, charger_status)); //charger info message for rest of car + car_can.write(generate_charger_info_msg(charger_voltage, charger_current, charger_status, charger_timeout, bms_timeout)); //charger info message for rest of car while(!car_CAN_data_sent && t.read_ms() < CAN_TIMEOUT_MS); if (DEBUG) { @@ -141,12 +143,14 @@ { if (DEBUG) printf("Error: BMS comms timeout \r\n"); comms_timeout = true; + bms_timeout = true; } if (timeouts.charger_timeout.read_ms() > CHARGER_MSG_TIMEOUT_MS) { if (DEBUG) printf("Error: Charger comms timeout \r\n"); comms_timeout = true; + charger_timeout = true; } }