114 lines
1.9 KiB
C
114 lines
1.9 KiB
C
#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 {
|
|
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;
|
|
|
|
void vehicle_thread_entry(ULONG hfdcan_addr);
|
|
|
|
void vehicle_select_mission(Mission mission);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // __INC_VEHICLE_H
|