Parse CAN messges
This commit is contained in:
@ -43,6 +43,7 @@ extern "C" {
|
||||
/* USER CODE BEGIN EC */
|
||||
extern volatile int ltdc_cb_triggered;
|
||||
extern TX_QUEUE gui_button_queue;
|
||||
extern TX_QUEUE vehicle_update_queue;
|
||||
extern FDCAN_HandleTypeDef hfdcan1;
|
||||
/* USER CODE END EC */
|
||||
|
||||
|
||||
@ -1,21 +1,120 @@
|
||||
#ifndef __INC_VEHICLE_H
|
||||
#define __INC_VEHICLE_H
|
||||
|
||||
#include "stw_defines.h"
|
||||
#include "tx_port.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
TS_INACTIVE = 0,
|
||||
TS_ACTIVE = 1,
|
||||
TS_PRECHARGE = 2,
|
||||
TS_DISCHARGE = 3,
|
||||
TS_ERROR = 4,
|
||||
TS_CHARGING_CHECK = 5,
|
||||
TS_CHARGING = 6
|
||||
} TSState;
|
||||
|
||||
typedef enum {
|
||||
AS_OFF = 0,
|
||||
AS_MANUAL = 1,
|
||||
AS_READY = 2,
|
||||
AS_DRIVING = 3,
|
||||
AS_FINISHED = 4,
|
||||
AS_EMERGENCY = 5
|
||||
} ASState;
|
||||
|
||||
typedef enum {
|
||||
R2D_NONE = 0,
|
||||
R2D_TSMS = 1,
|
||||
R2D_TSACTIVE = 2,
|
||||
R2D_RESETTING_NODES = 3,
|
||||
R2D_RESETTING_COMMS = 4,
|
||||
R2D_WAITING_INIT = 5,
|
||||
R2D_INIT_STAGE1 = 6,
|
||||
R2D_INIT_STAGE2 = 7,
|
||||
R2D_INIT_SUCCESS = 0xF
|
||||
} R2DProgress;
|
||||
|
||||
typedef enum {
|
||||
INICHK_START = 0,
|
||||
INICHK_WD_CHECK = 1,
|
||||
INICHK_WD_OK = 2,
|
||||
INICHK_ASB_CHECK_1 = 3,
|
||||
INICHK_ASB_CHECK_2 = 4,
|
||||
INICHK_WAIT_TS = 5,
|
||||
INICHK_EBS_CHECK_A = 6,
|
||||
INICHK_EBS_CHECK_B = 7,
|
||||
INICHK_DONE = 8,
|
||||
INICHK_ERROR = 9
|
||||
} IniChkState;
|
||||
|
||||
typedef struct {
|
||||
int fl;
|
||||
int fr;
|
||||
int rl;
|
||||
int rr;
|
||||
float fl;
|
||||
float fr;
|
||||
float rl;
|
||||
float rr;
|
||||
} TireTemps;
|
||||
|
||||
typedef struct {
|
||||
TSState ts_state;
|
||||
ASState as_state;
|
||||
Mission active_mission;
|
||||
|
||||
R2DProgress r2d_progress;
|
||||
struct {
|
||||
int invl_ready : 1;
|
||||
int invr_ready : 1;
|
||||
int sdc_bfl : 1;
|
||||
int sdc_brl : 1;
|
||||
int sdc_acc : 1;
|
||||
int sdc_hvb : 1;
|
||||
int err_sdc : 1;
|
||||
int err_ams : 1;
|
||||
int err_pdu : 1;
|
||||
int err_ini_chk : 1;
|
||||
int err_con_mon : 1;
|
||||
int err_scs : 1;
|
||||
int err_sbspd : 1;
|
||||
int err_appsp : 1;
|
||||
int err_as : 1;
|
||||
int err_ros : 1;
|
||||
int err_res : 1;
|
||||
int err_invl : 1;
|
||||
int err_invr : 1;
|
||||
} errors;
|
||||
IniChkState ini_chk_state;
|
||||
|
||||
unsigned lap_count;
|
||||
TireTemps tire_temps;
|
||||
|
||||
float min_cell_volt;
|
||||
float max_cell_temp;
|
||||
int soc;
|
||||
|
||||
float ts_current;
|
||||
float ts_voltage_bat;
|
||||
float ts_voltage_veh;
|
||||
} VehicleState;
|
||||
|
||||
extern VehicleState vehicle_state;
|
||||
|
||||
typedef enum {
|
||||
VEH_UPD_AMS,
|
||||
VEH_UPD_MISSION,
|
||||
VEH_UPD_STATUS,
|
||||
VEH_UPD_TS_CURRENT,
|
||||
VEH_UPD_TS_VOLTAGE_VEH,
|
||||
VEH_UPD_TS_VOLTAGE_BAT
|
||||
} VehicleUpdate;
|
||||
|
||||
void vehicle_thread_entry(ULONG hfdcan_addr);
|
||||
|
||||
void vehicle_select_mission(Mission mission);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user