mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 10:19:29 +02:00
update function name map_can_frame_to_variable_battery() to handle_incoming_can_frame_battery()
This commit is contained in:
parent
0b096010c1
commit
eb4e5bc2b8
29 changed files with 30 additions and 30 deletions
|
@ -112,7 +112,7 @@
|
||||||
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
|
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame);
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame);
|
||||||
void update_values_battery();
|
void update_values_battery();
|
||||||
void transmit_can_battery();
|
void transmit_can_battery();
|
||||||
void setup_battery(void);
|
void setup_battery(void);
|
||||||
|
|
|
@ -502,7 +502,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer_extended.bmwi3.ST_cold_shutoff_valve = battery_status_cold_shutoff_valve;
|
datalayer_extended.bmwi3.ST_cold_shutoff_valve = battery_status_cold_shutoff_valve;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x112: //BMS [10ms] Status Of High-Voltage Battery - 2
|
case 0x112: //BMS [10ms] Status Of High-Voltage Battery - 2
|
||||||
battery_awake = true;
|
battery_awake = true;
|
||||||
|
|
|
@ -516,7 +516,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer.battery.info.min_cell_voltage_mV = MIN_CELL_VOLTAGE_MV;
|
datalayer.battery.info.min_cell_voltage_mV = MIN_CELL_VOLTAGE_MV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
battery_awake = true;
|
battery_awake = true;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x112:
|
case 0x112:
|
||||||
|
|
|
@ -254,7 +254,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer_extended.boltampera.battery_current_7E4 = battery_current_7E4;
|
datalayer_extended.boltampera.battery_current_7E4 = battery_current_7E4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x200:
|
case 0x200:
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
|
|
|
@ -162,7 +162,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer_extended.bydAtto3.voltage_polled = BMS_voltage;
|
datalayer_extended.bydAtto3.voltage_polled = BMS_voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) { //Log values taken with 422V from battery
|
switch (rx_frame.ID) { //Log values taken with 422V from battery
|
||||||
case 0x244: //00,00,00,04,41,0F,20,8B - Static, values never changes between logs
|
case 0x244: //00,00,00,04,41,0F,20,8B - Static, values never changes between logs
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -213,7 +213,7 @@ void update_values_battery() {
|
||||||
//TODO, shall we react on this?
|
//TODO, shall we react on this?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
|
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x1A4: //PDO1_TX - 200ms
|
case 0x1A4: //PDO1_TX - 200ms
|
||||||
|
|
|
@ -367,7 +367,7 @@ inline void process_vehicle_vendor_ID(CAN_frame rx_frame) {
|
||||||
((rx_frame.data.u8[2] << 8) | rx_frame.data.u8[1]); //Actually more bytes, but not needed for our purpose
|
((rx_frame.data.u8[2] << 8) | rx_frame.data.u8[1]); //Actually more bytes, but not needed for our purpose
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
#ifdef CH_CAN_DEBUG
|
#ifdef CH_CAN_DEBUG
|
||||||
logging.print(millis()); // Example printout, time, ID, length, data: 7553 1DB 8 FF C0 B9 EA 0 0 2 5D
|
logging.print(millis()); // Example printout, time, ID, length, data: 7553 1DB 8 FF C0 B9 EA 0 0 2 5D
|
||||||
logging.print(" ");
|
logging.print(" ");
|
||||||
|
@ -819,7 +819,7 @@ void handle_chademo_sequence() {
|
||||||
case CHADEMO_INIT:
|
case CHADEMO_INIT:
|
||||||
/* Transient state while awaiting CAN from Vehicle.
|
/* Transient state while awaiting CAN from Vehicle.
|
||||||
* Used for triggers/error handling elsewhere;
|
* Used for triggers/error handling elsewhere;
|
||||||
* State change to CHADEMO_NEGOTIATE occurs in map_can_frame_to_variable_battery(..)
|
* State change to CHADEMO_NEGOTIATE occurs in handle_incoming_can_frame_battery(..)
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG_LOG
|
#ifdef DEBUG_LOG
|
||||||
// logging.println("Awaiting initial vehicle CAN to trigger negotiation");
|
// logging.println("Awaiting initial vehicle CAN to trigger negotiation");
|
||||||
|
|
|
@ -72,7 +72,7 @@ void update_values_battery() {
|
||||||
datalayer.battery.status.cell_max_voltage_mV = max_cell_mv_value;
|
datalayer.battery.status.cell_max_voltage_mV = max_cell_mv_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x125:
|
case 0x125:
|
||||||
|
|
|
@ -129,7 +129,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x374: //BMU message, 10ms - SOC
|
case 0x374: //BMU message, 10ms - SOC
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
|
|
|
@ -119,7 +119,7 @@ void update_values_battery() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
|
|
||||||
// Do not log noisy startup messages - there are many !
|
// Do not log noisy startup messages - there are many !
|
||||||
if (rx_frame.ID == 0 && rx_frame.DLC == 8 && rx_frame.data.u8[0] == 0 && rx_frame.data.u8[1] == 0 &&
|
if (rx_frame.ID == 0 && rx_frame.DLC == 8 && rx_frame.data.u8[0] == 0 && rx_frame.data.u8[1] == 0 &&
|
||||||
|
|
|
@ -750,7 +750,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
startedUp = true;
|
startedUp = true;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x055:
|
case 0x055:
|
||||||
|
|
|
@ -220,7 +220,7 @@ void update_number_of_cells() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x4DE:
|
case 0x4DE:
|
||||||
startedUp = true;
|
startedUp = true;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x5F1:
|
case 0x5F1:
|
||||||
|
|
|
@ -618,7 +618,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer_extended.meb.rt_battery_unathorized = realtime_warning_battery_unathorized;
|
datalayer_extended.meb.rt_battery_unathorized = realtime_warning_battery_unathorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
last_can_msg_timestamp = millis();
|
last_can_msg_timestamp = millis();
|
||||||
if (first_can_msg == 0)
|
if (first_can_msg == 0)
|
||||||
first_can_msg = last_can_msg_timestamp;
|
first_can_msg = last_can_msg_timestamp;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer.battery.status.temperature_max_dC;
|
datalayer.battery.status.temperature_max_dC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x171: //Following messages were detected on a MG5 battery BMS
|
case 0x171: //Following messages were detected on a MG5 battery BMS
|
||||||
|
|
|
@ -740,7 +740,7 @@ void map_can_frame_to_variable_battery2(CAN_frame rx_frame) {
|
||||||
}
|
}
|
||||||
#endif // DOUBLE_BATTERY
|
#endif // DOUBLE_BATTERY
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x1DB:
|
case 0x1DB:
|
||||||
if (is_message_corrupt(rx_frame)) {
|
if (is_message_corrupt(rx_frame)) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ void update_values_battery() {
|
||||||
datalayer.battery.info.min_design_voltage_dV = discharge_cutoff_voltage;
|
datalayer.battery.info.min_design_voltage_dV = discharge_cutoff_voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x7310:
|
case 0x7310:
|
||||||
|
|
|
@ -180,7 +180,7 @@ void update_values_battery() {
|
||||||
datalayer.battery.info.min_design_voltage_dV = DischargeVoltageLimit * 10;
|
datalayer.battery.info.min_design_voltage_dV = DischargeVoltageLimit * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x080: // 15ms
|
case 0x080: // 15ms
|
||||||
|
|
|
@ -137,7 +137,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
|
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x155: //BMS1
|
case 0x155: //BMS1
|
||||||
|
|
|
@ -65,7 +65,7 @@ void update_values_battery() {
|
||||||
max_value(cell_temperatures_dC, sizeof(cell_temperatures_dC) / sizeof(*cell_temperatures_dC));
|
max_value(cell_temperatures_dC, sizeof(cell_temperatures_dC) / sizeof(*cell_temperatures_dC));
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x155:
|
case 0x155:
|
||||||
|
|
|
@ -135,7 +135,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer.battery.status.voltage_dV = static_cast<uint32_t>((calculated_total_pack_voltage_mV / 100)); // mV to dV
|
datalayer.battery.status.voltage_dV = static_cast<uint32_t>((calculated_total_pack_voltage_mV / 100)); // mV to dV
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x155: //10ms - Charging power, current and SOC
|
case 0x155: //10ms - Charging power, current and SOC
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
|
|
|
@ -218,7 +218,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
datalayer_extended.zoePH2.battery_soc_max = battery_soc_max;
|
datalayer_extended.zoePH2.battery_soc_max = battery_soc_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x18DAF1DB: // LBC Reply from active polling
|
case 0x18DAF1DB: // LBC Reply from active polling
|
||||||
|
|
|
@ -158,7 +158,7 @@ void update_values_battery() {
|
||||||
datalayer.battery.status.cell_min_voltage_mV = minimum_cell_voltage;
|
datalayer.battery.status.cell_min_voltage_mV = minimum_cell_voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// All CAN messages recieved will be logged via serial
|
// All CAN messages recieved will be logged via serial
|
||||||
|
|
|
@ -116,7 +116,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x1FF:
|
case 0x1FF:
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
|
|
|
@ -225,6 +225,6 @@ void setup_battery(void) {
|
||||||
// Needed to make the compiler happy
|
// Needed to make the compiler happy
|
||||||
void update_values_battery() {}
|
void update_values_battery() {}
|
||||||
void transmit_can_battery() {}
|
void transmit_can_battery() {}
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {}
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif //DEBUG_LOG
|
#endif //DEBUG_LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
static uint8_t mux = 0;
|
static uint8_t mux = 0;
|
||||||
static uint16_t temp = 0;
|
static uint16_t temp = 0;
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ void map_can_frame_to_variable_battery2(CAN_frame rx_frame) {
|
||||||
}
|
}
|
||||||
#endif // DOUBLE_BATTERY
|
#endif // DOUBLE_BATTERY
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
}
|
}
|
||||||
void transmit_can_battery() {
|
void transmit_can_battery() {
|
||||||
|
|
|
@ -140,7 +140,7 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_can_frame_to_variable_battery(CAN_frame rx_frame) {
|
void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
datalayer.battery.status.CAN_battery_still_alive = CAN_STILL_ALIVE;
|
||||||
switch (rx_frame.ID) {
|
switch (rx_frame.ID) {
|
||||||
case 0x3A:
|
case 0x3A:
|
||||||
|
|
|
@ -321,7 +321,7 @@ void map_can_frame_to_variable(CAN_frame* rx_frame, int interface) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (interface == can_config.battery) {
|
if (interface == can_config.battery) {
|
||||||
map_can_frame_to_variable_battery(*rx_frame);
|
handle_incoming_can_frame_battery(*rx_frame);
|
||||||
#ifdef CHADEMO_BATTERY
|
#ifdef CHADEMO_BATTERY
|
||||||
ISA_handleFrame(rx_frame);
|
ISA_handleFrame(rx_frame);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue