Updated CAN interface
This commit is contained in:
		@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -61,5 +61,5 @@ struct InverterStats
 | 
			
		||||
    uint8_t _reserved;
 | 
			
		||||
    uint16_t temp;
 | 
			
		||||
    int16_t velocity;
 | 
			
		||||
    uint16_t error;
 | 
			
		||||
    int16_t wheel_speed;
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user