Laptimes
This commit is contained in:
parent
6da02adae9
commit
638394ac0a
|
@ -129,6 +129,9 @@ typedef struct {
|
|||
IniChkState ini_chk_state;
|
||||
|
||||
unsigned lap_count;
|
||||
float lap_last;
|
||||
float lap_best;
|
||||
|
||||
Temperatures temps;
|
||||
|
||||
float min_cell_volt;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#define CAN_ID_AMS_STATUS 0xA
|
||||
#define CAN_ID_AMS_ERROR 0xC
|
||||
#define CAN_ID_ABX_DRIVER 0x101
|
||||
#define CAN_ID_ABX_TIMINGS 0x102
|
||||
#define CAN_ID_ABX_BRAKE_T 0x105
|
||||
#define CAN_ID_CS_INTERNAL 0x108
|
||||
#define CAN_ID_ABX_MISC 0x109
|
||||
|
@ -40,6 +41,7 @@ void vehicle_thread_entry(ULONG hfdcan_addr) {
|
|||
ftcan_add_filter(CAN_ID_AMS_STATUS, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_AMS_ERROR, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_ABX_DRIVER, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_ABX_TIMINGS, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_ABX_BRAKE_T, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_CS_INTERNAL, 0x7FF);
|
||||
ftcan_add_filter(CAN_ID_ABX_MISC, 0x7FF);
|
||||
|
@ -104,6 +106,10 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
|
|||
vehicle_state.brake_press_r = ((data[2] >> 4) | (data[3] << 4)) * 0.1;
|
||||
vehicle_state.speed = data[5] * CAN_ABX_DRIVER_SPEED_FACTOR;
|
||||
break;
|
||||
case CAN_ID_ABX_TIMINGS:
|
||||
vehicle_state.lap_best = (data[0] | (data[1] << 8)) * 0.01f;
|
||||
vehicle_state.lap_last = (data[2] | (data[3] << 8)) * 0.01f;
|
||||
break;
|
||||
case CAN_ID_ABX_BRAKE_T:
|
||||
vehicle_state.temps.brake_fl = (data[0] | (data[1] << 8)) * 0.01f;
|
||||
vehicle_state.temps.brake_fr = (data[2] | (data[3] << 8)) * 0.01f;
|
||||
|
|
|
@ -16,7 +16,8 @@ CountedEnum(DataFieldType, size_t, DF_TSState, DF_ASState, DF_ActiveMission,
|
|||
DF_TSSoC, DF_LVSoC, DF_TSCurrent, DF_TSVoltageBat, DF_TSVoltageVeh,
|
||||
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal, DF_TempMotL,
|
||||
DF_TempMotR, DF_TempInvL, DF_TempInvR, DF_TempBrakeFL,
|
||||
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR);
|
||||
DF_TempBrakeFR, DF_TempBrakeRL, DF_TempBrakeRR, DF_LapBest,
|
||||
DF_LapLast);
|
||||
|
||||
enum class NamedFieldKind { Float, Bool, Text, Int };
|
||||
|
||||
|
|
|
@ -294,6 +294,10 @@ NamedFieldDescription dataFieldDescs[] = {
|
|||
VEH_FIELD(temps.brake_rl)},
|
||||
[DF_TempBrakeRR] = {NamedFieldKind::Float, "TBRR", 3, 0,
|
||||
VEH_FIELD(temps.brake_rr)},
|
||||
[DF_LapBest] = {NamedFieldKind::Float, "LAPBEST", 3, 1,
|
||||
VEH_FIELD(lap_best)},
|
||||
[DF_LapLast] = {NamedFieldKind::Float, "LAPLAST", 3, 1,
|
||||
VEH_FIELD(lap_last)},
|
||||
};
|
||||
|
||||
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
||||
|
|
|
@ -11,7 +11,7 @@ constexpr int32_t SHOW_ERRORS_FOR = 10000; // ms
|
|||
#include "vehicle_state.h"
|
||||
|
||||
DriverViewPresenter::DriverViewPresenter(DriverViewView &v)
|
||||
: view(v), fields{DF_MinCellVolt, DF_Speed, DF_MaxCellTemp} {}
|
||||
: view(v), fields{DF_LapLast, DF_Speed, DF_MaxCellTemp} {}
|
||||
|
||||
void DriverViewPresenter::activate() {
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "vehicle_state.h"
|
||||
|
||||
DriverViewView::DriverViewView()
|
||||
: fieldTypes{DF_MinCellVolt, DF_Speed, DF_TSCurrent} {}
|
||||
: fieldTypes{DF_LapLast, DF_Speed, DF_MaxCellTemp} {}
|
||||
|
||||
void DriverViewView::setupScreen() {
|
||||
DriverViewViewBase::setupScreen();
|
||||
|
|
Loading…
Reference in New Issue