CUER
/
charger_code
Code to run on the charger board (used to charge the car from the mains).
CANParserCharger.h@5:756fae795d37, 2017-07-30 (annotated)
- Committer:
- DasSidG
- Date:
- Sun Jul 30 22:59:37 2017 +0000
- Revision:
- 5:756fae795d37
- Parent:
- 4:f6459580c312
- Child:
- 7:70cf5bff23f9
Made it calculate the voltage error itself.; Made it reset the relevant part of the CAN buffer each time it reads it so that it uses fresh data each time; ; Ready for testing.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DasSidG | 3:a7626dffb64a | 1 | #ifndef CANParserCharger_H |
DasSidG | 3:a7626dffb64a | 2 | #define CANParserCharger_H |
DasSidG | 3:a7626dffb64a | 3 | |
DasSidG | 1:0c77e20b4d4c | 4 | #include "CAN_Data.h" |
DasSidG | 1:0c77e20b4d4c | 5 | #include "CAN_IDs.h" |
DasSidG | 5:756fae795d37 | 6 | #include "charger.h" |
DasSidG | 1:0c77e20b4d4c | 7 | |
DasSidG | 3:a7626dffb64a | 8 | |
DasSidG | 1:0c77e20b4d4c | 9 | |
DasSidG | 5:756fae795d37 | 10 | #define CHARGER_CAN_BIT_RATE 250000 //note this is different to the car CAN bit rate, this is fixed by the charger |
DasSidG | 3:a7626dffb64a | 11 | #define CHARGER_VI_CONTROL_ID 0x1806E5F4 |
DasSidG | 3:a7626dffb64a | 12 | #define CHARGER_VI_INFO_ID 0x18FF50E5 |
DasSidG | 3:a7626dffb64a | 13 | |
DasSidG | 4:f6459580c312 | 14 | #define CAN_TIMEOUT_MS 100 |
DasSidG | 4:f6459580c312 | 15 | |
DasSidG | 3:a7626dffb64a | 16 | |
DasSidG | 1:0c77e20b4d4c | 17 | |
DasSidG | 1:0c77e20b4d4c | 18 | //@TODO add some comments |
DasSidG | 1:0c77e20b4d4c | 19 | |
DasSidG | 1:0c77e20b4d4c | 20 | void get_max_min_voltage(CANMessage msg, float &_min_cell_voltage, float &_max_cell_voltage); |
DasSidG | 1:0c77e20b4d4c | 21 | void get_battery_status(CANMessage msg, bool &error); |
DasSidG | 1:0c77e20b4d4c | 22 | void get_charger_VI_info(CANMessage msg, float &_charger_voltage, float &_charger_current, uint8_t &_charger_status); |
DasSidG | 5:756fae795d37 | 23 | void check_precharge_status (CANMessage msg, bool &_precharge_ready); |
DasSidG | 5:756fae795d37 | 24 | |
DasSidG | 1:0c77e20b4d4c | 25 | CANMessage generate_charger_control_msg(float _desired_voltage, float _desired_current, uint8_t _charger_control); |
DasSidG | 1:0c77e20b4d4c | 26 | CANMessage generate_charger_info_msg(float _charger_voltage, float _charger_current, uint8_t _charger_status); |
DasSidG | 3:a7626dffb64a | 27 | CANMessage generate_charging_finished_msg(); //When this packet is received by the BMU, it causes the BMU to reset its SoC value to 100% |
DasSidG | 1:0c77e20b4d4c | 28 | #endif |