From beff90a10acd0fb2cf26405abd0e3b1eb7b64f4f Mon Sep 17 00:00:00 2001 From: jvblanck Date: Wed, 30 Jun 2021 21:36:51 +0200 Subject: [PATCH] Updated CAN interface --- lib/FT18e_STW_INIT/FT18e_STW_INIT.h | 14 +++++++------- lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.cpp | 8 ++++---- lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/FT18e_STW_INIT/FT18e_STW_INIT.h b/lib/FT18e_STW_INIT/FT18e_STW_INIT.h index d14519c..7f6bfb2 100644 --- a/lib/FT18e_STW_INIT/FT18e_STW_INIT.h +++ b/lib/FT18e_STW_INIT/FT18e_STW_INIT.h @@ -77,19 +77,19 @@ struct InverterData typedef struct { - uint8_t e_thro; // E-Drossel - int16_t revol; // Drehzahl + uint16_t u_cell_min; // Minimale Zellspannung + uint16_t u_batt; // Batteriespannung (pre-AIR-voltage) int16_t t_mot_l; // Motor-Wasser-Temperatur Links int16_t t_mot_r; // Motor-Wasser-Temperatur Rechts int16_t t_cell_max; // Maximale Zelltemperatur - uint16_t u_cell_min; // Minimale Zellspannung - uint16_t u_batt; // Batteriespannung (pre-AIR-voltage) - bool rev_lim; // Drehzahllimit Bit - int16_t p_wat; + int16_t t_inv; int16_t t_wat; + int16_t p_wat; uint8_t speed; InverterData inverter; - int16_t t_inv; + bool rev_lim; // Drehzahllimit Bit + int16_t revol; // Drehzahl + int16_t wheel_speed; } vehicle_data_type; extern volatile stw_data_type Stw_data; diff --git a/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.cpp b/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.cpp index a01f3c0..c537b16 100644 --- a/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.cpp +++ b/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.cpp @@ -106,8 +106,7 @@ void process_inverter_stats(CAN_FRAME *frame) Vehicle_data.inverter.ts_active = status & CAN_INVERTER_STATS_TS_ACTIVE; Vehicle_data.t_inv = data->temp; Vehicle_data.revol = data->velocity; - Serial.print("invVelocity: "); - Serial.println(data->velocity); + Vehicle_data.wheel_speed = data->wheel_speed; } void update_LED() @@ -116,15 +115,16 @@ void update_LED() bool t_inv = Vehicle_data.t_inv > LED_THRESH_T_INV; bool t_bat = Vehicle_data.t_cell_max > LED_THRESH_T_BAT; - bool u_batt = Vehicle_data.u_cell_min < LED_THRESH_U_BATT; bool precharge_active = !Vehicle_data.inverter.precharge; + bool derating = Vehicle_data.inverter.derating; + bool u_batt = Vehicle_data.u_cell_min < LED_THRESH_U_BATT; digitalWrite(led11, t_mot); // rot, links, oben digitalWrite(led12, t_inv); // rot, links, mitte digitalWrite(led13, t_bat); // rot, links, unten digitalWrite(led14, precharge_active); // rot, rechts, oben - digitalWrite(led15, LOW); // rot rechts, mitte + digitalWrite(led15, derating); // rot rechts, mitte digitalWrite(led16, u_batt); // blau rechts, unten bool rev_lim = Vehicle_data.rev_lim; diff --git a/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.h b/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.h index 04c3ff9..8a7cea1 100644 --- a/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.h +++ b/lib/FT_2018e_STW_CAN/FT_2018e_STW_CAN.h @@ -61,5 +61,5 @@ struct InverterStats uint8_t _reserved; uint16_t temp; int16_t velocity; - uint16_t error; + int16_t wheel_speed; }; \ No newline at end of file