61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
/*
|
|
FT_2018e_STW_CAN.h
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Arduino.h"
|
|
#include "DueTimer.h"
|
|
#include "due_can.h"
|
|
|
|
constexpr uint32_t CAN_CELL_STATS_ID = 0x101;
|
|
constexpr uint32_t CAN_BATTERY_STATS_ID = 0x102;
|
|
constexpr uint32_t CAN_COOLING_STATS_ID = 0x103;
|
|
constexpr uint32_t CAN_INVERTER_STATS_ID = 0x104;
|
|
|
|
constexpr uint8_t CAN_INVERTER_STATS_READY = (1 << 0);
|
|
constexpr uint8_t CAN_INVERTER_STATS_DERATING = (1 << 1);
|
|
constexpr uint8_t CAN_INVERTER_STATS_WARNING = (1 << 2);
|
|
constexpr uint8_t CAN_INVERTER_STATS_ERROR = (1 << 3);
|
|
constexpr uint8_t CAN_INVERTER_STATS_ON = (1 << 4);
|
|
constexpr uint8_t CAN_INVERTER_STATS_PRECHARGE = (1 << 5);
|
|
constexpr uint8_t CAN_INVERTER_STATS_AMS_EMERG = (1 << 6);
|
|
constexpr uint8_t CAN_INVERTER_STATS_TS_ACTIVE = (1 << 7);
|
|
|
|
void Init_Can_0();
|
|
void Send_0x110();
|
|
void Receive_Can_0(CAN_FRAME *frame);
|
|
void process_cell_stats(CAN_FRAME *frame);
|
|
void process_battery_stats(CAN_FRAME *frame);
|
|
void process_cooling_stats(CAN_FRAME *frame);
|
|
void process_inverter_stats(CAN_FRAME *frame);
|
|
void update_LED(void);
|
|
|
|
struct CellStats {
|
|
uint16_t sum_cell_voltage;
|
|
int16_t max_cell_temp;
|
|
uint16_t max_cell_voltage;
|
|
uint16_t min_cell_voltage;
|
|
};
|
|
|
|
struct BatteryStats {
|
|
uint16_t battery_current;
|
|
uint16_t pre_air_voltage;
|
|
uint16_t post_air_voltage;
|
|
uint16_t battery_power;
|
|
};
|
|
|
|
struct CoolingStats {
|
|
int16_t water_pressure;
|
|
int16_t water_temp;
|
|
int16_t motor_l_temp;
|
|
int16_t motor_r_temp;
|
|
};
|
|
|
|
struct InverterStats {
|
|
uint8_t status;
|
|
uint8_t _reserved;
|
|
uint16_t temp;
|
|
int16_t velocity;
|
|
int16_t wheel_speed;
|
|
}; |