Skip to content

Commit

Permalink
[READY] Dashboard 2024 FCTT (#90)
Browse files Browse the repository at this point in the history
* Start Button Interrupt and dual pedal

WIP Encoder Logic

Encoder Logic Change

WIP Encoder Testing

Rebase regen faults

Encoder, LCD, Button Functions

Uncommented send cooling request

Added CAN update

Removed new fault, some minor checks

Clean up

ADC Pedals

Polling method for dash input

Cleaning up the code

very wip saturday fault changes

Fixed small things

preflight make better

Patching fault updates LCD

Added back data page and brake failure message

New TV page

Minor fix

Display fix

can tweak

Start Button Interrupt and dual pedal

WIP Encoder Logic

Encoder Logic Change

WIP Encoder Testing

Rebase regen faults

Encoder, LCD, Button Functions

Uncommented send cooling request

Added CAN update

Removed new fault, some minor checks

Clean up

ADC Pedals

Polling method for dash input

Cleaning up the code

very wip saturday fault changes

Fixed small things

preflight make better

Patching fault updates LCD

Added back data page and brake failure message

Post rebase fixes

Fixes for text displaying

Housekeeping

WIP

Pedal Calibration 1

* new pages for first long test

* DBC update w loggin msg

* Car State

* New debounce
  • Loading branch information
mcgalliard authored Mar 23, 2024
1 parent b1d2bb7 commit 07a047c
Show file tree
Hide file tree
Showing 14 changed files with 1,659 additions and 804 deletions.
37 changes: 35 additions & 2 deletions common/daq/can_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,40 @@
"msg_period":500,
"msg_hlp":1,
"msg_pgn":101
},
{
"msg_name":"dashboard_brake_status",
"msg_desc":"periodic dashboard brake health",
"signals":[
{"sig_name": "brake_status", "type":"uint8_t", "length":1}
],
"msg_period":500,
"msg_hlp":1,
"msg_pgn":33
},
{
"msg_name":"dashboard_tv_parameters",
"msg_desc":"periodic dashboard tv parameters",
"signals":[
{"sig_name": "tv_enabled", "type":"uint8_t", "length":1},
{"sig_name": "tv_deadband_val", "type":"uint16_t"},
{"sig_name": "tv_intensity_val", "type":"uint16_t"},
{"sig_name": "tv_p_val", "type":"uint16_t"}
],
"msg_period":500,
"msg_hlp":1,
"msg_pgn":55
},
{
"msg_name":"dashboard_start_logging",
"msg_desc":"start logging",
"signals":[
{"sig_name": "logging_enabled", "type":"uint8_t", "length":1}
],
"msg_period":500,
"msg_hlp":1,
"msg_pgn":56
}

],
"rx":[
{"msg_name": "main_hb"},
Expand All @@ -712,7 +744,8 @@
{"msg_name": "coolant_temps"},
{"msg_name": "coolant_out", "callback": true},
{"msg_name": "gearbox"},
{"msg_name": "dashboard_bl_cmd" , "callback": true}
{"msg_name": "dashboard_bl_cmd" , "callback": true},
{"msg_name": "sdc_status"}
]
},
{
Expand Down
21 changes: 21 additions & 0 deletions common/daq/per_dbc.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,18 @@ BO_ 2214598981 dashboard_volts_temp: 6 Dashboard
SG_ volts_5v : 16|16@1+ (1,0) [0|0] "" Vector__XXX
SG_ mcu_temp : 0|16@1- (1,0) [0|0] "" Vector__XXX

BO_ 2214594629 dashboard_brake_status: 1 Dashboard
SG_ brake_status : 0|1@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2214596037 dashboard_tv_parameters: 7 Dashboard
SG_ tv_p_val : 33|16@1+ (1,0) [0|0] "" Vector__XXX
SG_ tv_intensity_val : 17|16@1+ (1,0) [0|0] "" Vector__XXX
SG_ tv_deadband_val : 1|16@1+ (1,0) [0|0] "" Vector__XXX
SG_ tv_enabled : 0|1@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2214596101 dashboard_start_logging: 1 Dashboard
SG_ logging_enabled : 0|1@1+ (1,0) [0|0] "" Vector__XXX

BO_ 2148059781 fault_sync_dashboard: 3 Dashboard
SG_ latched : 16|1@1+ (1,0) [0|0] "" Vector__XXX
SG_ idx : 0|16@1+ (1,0) [0|0] "" Vector__XXX
Expand Down Expand Up @@ -885,6 +897,15 @@ CM_ BO_ 2214598981 "periodic dashboard MCU temp";
CM_ SG_ 2214598981 volts_3v3 "";
CM_ SG_ 2214598981 volts_5v "";
CM_ SG_ 2214598981 mcu_temp "";
CM_ BO_ 2214594629 "periodic dashboard brake health";
CM_ SG_ 2214594629 brake_status "";
CM_ BO_ 2214596037 "periodic dashboard tv parameters";
CM_ SG_ 2214596037 tv_p_val "";
CM_ SG_ 2214596037 tv_intensity_val "";
CM_ SG_ 2214596037 tv_deadband_val "";
CM_ SG_ 2214596037 tv_enabled "";
CM_ BO_ 2214596101 "start logging";
CM_ SG_ 2214596101 logging_enabled "";
CM_ BO_ 2148059781 "Fault status message";
CM_ SG_ 2148059781 latched "";
CM_ SG_ 2148059781 idx "";
Expand Down
5 changes: 5 additions & 0 deletions common/faults/faults.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ static uint16_t currCount;
static q_handle_t *q_tx;

uint16_t most_recent_latched;
q_handle_t q_fault_history;

//Variables containing the index/limits of owned faults (heartbeat)
static uint16_t ownedidx;
Expand Down Expand Up @@ -315,6 +316,7 @@ void handleCallbacks(uint16_t id, bool latched) {
if (!currStatus->latched) {
currStatus->latched = recievedStatus.latched;
most_recent_latched = GET_IDX(id);
qSendToBack(&q_fault_history, &most_recent_latched);
switch(faultArray[GET_IDX(recievedStatus.f_ID)].priority) {
case FAULT_WARNING:
warnCount++;
Expand Down Expand Up @@ -396,6 +398,7 @@ bool updateFault(uint16_t idx) {
fault->bounces = 0;
currCount++;
most_recent_latched = idx;
qSendToBack(&q_fault_history, &idx);
switch(fault->priority) {
case FAULT_WARNING:
warnCount++;
Expand Down Expand Up @@ -593,6 +596,7 @@ static void forceFault(int id, bool state) {
if (state & !statusArray[idx].latched) {
currCount++;
most_recent_latched = idx;
qSendToBack(&q_fault_history, &idx);
switch(faultArray[idx].priority) {
case FAULT_WARNING:
warnCount++;
Expand Down Expand Up @@ -665,4 +669,5 @@ void initFaultLibrary(uint8_t mcu, q_handle_t* txQ, uint32_t ext) {
errorCount = 0;
fatalCount = 0;
currCount = 0;
qConstruct(&q_fault_history, sizeof(uint16_t));
}
3 changes: 2 additions & 1 deletion common/phal_F4_F7/usart/usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@ USART TX and RX interrupts - need to modify when adding a usart peripheral

#ifdef STM32F407xx
// USART1:

void DMA2_Stream7_IRQHandler() //TX
{
handleDMAxComplete(USART1_ACTIVE_IDX, DMA2_Stream7_IRQn, USART_DMA_TX);
Expand All @@ -678,6 +677,7 @@ void DMA2_Stream5_IRQHandler() //RX
handleDMAxComplete(USART1_ACTIVE_IDX, DMA2_Stream5_IRQn, USART_DMA_RX);
}


// USART2:

// Add new DMA interrupt handlers here, passing in new active struct index, along with
Expand All @@ -696,6 +696,7 @@ void DMA1_Stream5_IRQHandler() //RX

// Add new USART Interrupts as new peripherals are needed,
// feeding in the new USART peripheral, along with active array index

void USART1_IRQHandler()
{
handleUsartIRQ(USART1, USART1_ACTIVE_IDX);
Expand Down
35 changes: 28 additions & 7 deletions source/dashboard/can/can_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,23 @@ void canRxUpdate()
can_data.dashboard_bl_cmd.data = msg_data_a->dashboard_bl_cmd.data;
dashboard_bl_cmd_CALLBACK(msg_data_a);
break;
case ID_SDC_STATUS:
can_data.sdc_status.IMD = msg_data_a->sdc_status.IMD;
can_data.sdc_status.BMS = msg_data_a->sdc_status.BMS;
can_data.sdc_status.BSPD = msg_data_a->sdc_status.BSPD;
can_data.sdc_status.BOTS = msg_data_a->sdc_status.BOTS;
can_data.sdc_status.inertia = msg_data_a->sdc_status.inertia;
can_data.sdc_status.c_estop = msg_data_a->sdc_status.c_estop;
can_data.sdc_status.main = msg_data_a->sdc_status.main;
can_data.sdc_status.r_estop = msg_data_a->sdc_status.r_estop;
can_data.sdc_status.l_estop = msg_data_a->sdc_status.l_estop;
can_data.sdc_status.HVD = msg_data_a->sdc_status.HVD;
can_data.sdc_status.hub = msg_data_a->sdc_status.hub;
can_data.sdc_status.TSMS = msg_data_a->sdc_status.TSMS;
can_data.sdc_status.pchg_out = msg_data_a->sdc_status.pchg_out;
can_data.sdc_status.stale = 0;
can_data.sdc_status.last_rx = sched.os_ticks;
break;
case ID_FAULT_SYNC_PDU:
can_data.fault_sync_pdu.idx = msg_data_a->fault_sync_pdu.idx;
can_data.fault_sync_pdu.latched = msg_data_a->fault_sync_pdu.latched;
Expand Down Expand Up @@ -256,6 +273,9 @@ void canRxUpdate()
CHECK_STALE(can_data.gearbox.stale,
sched.os_ticks, can_data.gearbox.last_rx,
UP_GEARBOX);
CHECK_STALE(can_data.sdc_status.stale,
sched.os_ticks, can_data.sdc_status.last_rx,
UP_SDC_STATUS);
/* END AUTO STALE CHECKS */
}

Expand Down Expand Up @@ -295,16 +315,17 @@ bool initCANFilter()
CAN1->sFilterRegister[6].FR1 = (ID_GEARBOX << 3) | 4;
CAN1->sFilterRegister[6].FR2 = (ID_DASHBOARD_BL_CMD << 3) | 4;
CAN1->FA1R |= (1 << 7); // configure bank 7
CAN1->sFilterRegister[7].FR1 = (ID_FAULT_SYNC_PDU << 3) | 4;
CAN1->sFilterRegister[7].FR2 = (ID_FAULT_SYNC_MAIN_MODULE << 3) | 4;
CAN1->sFilterRegister[7].FR1 = (ID_SDC_STATUS << 3) | 4;
CAN1->sFilterRegister[7].FR2 = (ID_FAULT_SYNC_PDU << 3) | 4;
CAN1->FA1R |= (1 << 8); // configure bank 8
CAN1->sFilterRegister[8].FR1 = (ID_FAULT_SYNC_A_BOX << 3) | 4;
CAN1->sFilterRegister[8].FR2 = (ID_FAULT_SYNC_TEST_NODE << 3) | 4;
CAN1->sFilterRegister[8].FR1 = (ID_FAULT_SYNC_MAIN_MODULE << 3) | 4;
CAN1->sFilterRegister[8].FR2 = (ID_FAULT_SYNC_A_BOX << 3) | 4;
CAN1->FA1R |= (1 << 9); // configure bank 9
CAN1->sFilterRegister[9].FR1 = (ID_SET_FAULT << 3) | 4;
CAN1->sFilterRegister[9].FR2 = (ID_RETURN_FAULT_CONTROL << 3) | 4;
CAN1->sFilterRegister[9].FR1 = (ID_FAULT_SYNC_TEST_NODE << 3) | 4;
CAN1->sFilterRegister[9].FR2 = (ID_SET_FAULT << 3) | 4;
CAN1->FA1R |= (1 << 10); // configure bank 10
CAN1->sFilterRegister[10].FR1 = (ID_DAQ_COMMAND_DASHBOARD << 3) | 4;
CAN1->sFilterRegister[10].FR1 = (ID_RETURN_FAULT_CONTROL << 3) | 4;
CAN1->sFilterRegister[10].FR2 = (ID_DAQ_COMMAND_DASHBOARD << 3) | 4;
/* END AUTO FILTER */

CAN1->FMR &= ~CAN_FMR_FINIT; // Enable Filters (exit filter init mode)
Expand Down
74 changes: 74 additions & 0 deletions source/dashboard/can/can_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#define ID_START_BUTTON 0x4000005
#define ID_DASHBOARD_HB 0x4001905
#define ID_DASHBOARD_VOLTS_TEMP 0x4001945
#define ID_DASHBOARD_BRAKE_STATUS 0x4000845
#define ID_DASHBOARD_TV_PARAMETERS 0x4000dc5
#define ID_DASHBOARD_START_LOGGING 0x4000e05
#define ID_FAULT_SYNC_DASHBOARD 0x8ca85
#define ID_DAQ_RESPONSE_DASHBOARD 0x17ffffc5
#define ID_MAIN_HB 0x4001901
Expand All @@ -42,6 +45,7 @@
#define ID_COOLANT_OUT 0x40008df
#define ID_GEARBOX 0x10000901
#define ID_DASHBOARD_BL_CMD 0x409c47e
#define ID_SDC_STATUS 0xc000381
#define ID_FAULT_SYNC_PDU 0x8cadf
#define ID_FAULT_SYNC_MAIN_MODULE 0x8ca01
#define ID_FAULT_SYNC_A_BOX 0x8ca44
Expand All @@ -59,6 +63,9 @@
#define DLC_START_BUTTON 1
#define DLC_DASHBOARD_HB 1
#define DLC_DASHBOARD_VOLTS_TEMP 6
#define DLC_DASHBOARD_BRAKE_STATUS 1
#define DLC_DASHBOARD_TV_PARAMETERS 7
#define DLC_DASHBOARD_START_LOGGING 1
#define DLC_FAULT_SYNC_DASHBOARD 3
#define DLC_DAQ_RESPONSE_DASHBOARD 8
#define DLC_MAIN_HB 2
Expand All @@ -75,6 +82,7 @@
#define DLC_COOLANT_OUT 3
#define DLC_GEARBOX 2
#define DLC_DASHBOARD_BL_CMD 5
#define DLC_SDC_STATUS 2
#define DLC_FAULT_SYNC_PDU 3
#define DLC_FAULT_SYNC_MAIN_MODULE 3
#define DLC_FAULT_SYNC_A_BOX 3
Expand Down Expand Up @@ -135,6 +143,27 @@
data_a->dashboard_volts_temp.volts_3v3 = volts_3v3_;\
qSendToBack(&queue, &msg);\
} while(0)
#define SEND_DASHBOARD_BRAKE_STATUS(queue, brake_status_) do {\
CanMsgTypeDef_t msg = {.Bus=CAN1, .ExtId=ID_DASHBOARD_BRAKE_STATUS, .DLC=DLC_DASHBOARD_BRAKE_STATUS, .IDE=1};\
CanParsedData_t* data_a = (CanParsedData_t *) &msg.Data;\
data_a->dashboard_brake_status.brake_status = brake_status_;\
qSendToBack(&queue, &msg);\
} while(0)
#define SEND_DASHBOARD_TV_PARAMETERS(queue, tv_enabled_, tv_deadband_val_, tv_intensity_val_, tv_p_val_) do {\
CanMsgTypeDef_t msg = {.Bus=CAN1, .ExtId=ID_DASHBOARD_TV_PARAMETERS, .DLC=DLC_DASHBOARD_TV_PARAMETERS, .IDE=1};\
CanParsedData_t* data_a = (CanParsedData_t *) &msg.Data;\
data_a->dashboard_tv_parameters.tv_enabled = tv_enabled_;\
data_a->dashboard_tv_parameters.tv_deadband_val = tv_deadband_val_;\
data_a->dashboard_tv_parameters.tv_intensity_val = tv_intensity_val_;\
data_a->dashboard_tv_parameters.tv_p_val = tv_p_val_;\
qSendToBack(&queue, &msg);\
} while(0)
#define SEND_DASHBOARD_START_LOGGING(queue, logging_enabled_) do {\
CanMsgTypeDef_t msg = {.Bus=CAN1, .ExtId=ID_DASHBOARD_START_LOGGING, .DLC=DLC_DASHBOARD_START_LOGGING, .IDE=1};\
CanParsedData_t* data_a = (CanParsedData_t *) &msg.Data;\
data_a->dashboard_start_logging.logging_enabled = logging_enabled_;\
qSendToBack(&queue, &msg);\
} while(0)
#define SEND_FAULT_SYNC_DASHBOARD(queue, idx_, latched_) do {\
CanMsgTypeDef_t msg = {.Bus=CAN1, .ExtId=ID_FAULT_SYNC_DASHBOARD, .DLC=DLC_FAULT_SYNC_DASHBOARD, .IDE=1};\
CanParsedData_t* data_a = (CanParsedData_t *) &msg.Data;\
Expand Down Expand Up @@ -166,6 +195,7 @@
#define UP_COOLANT_TEMPS 200
#define UP_COOLANT_OUT 1000
#define UP_GEARBOX 2000
#define UP_SDC_STATUS 200
/* END AUTO UP DEFS */

#define CHECK_STALE(stale, curr, last, period) if(!stale && \
Expand Down Expand Up @@ -221,6 +251,18 @@ typedef union {
uint64_t volts_5v: 16;
uint64_t volts_3v3: 16;
} dashboard_volts_temp;
struct {
uint64_t brake_status: 1;
} dashboard_brake_status;
struct {
uint64_t tv_enabled: 1;
uint64_t tv_deadband_val: 16;
uint64_t tv_intensity_val: 16;
uint64_t tv_p_val: 16;
} dashboard_tv_parameters;
struct {
uint64_t logging_enabled: 1;
} dashboard_start_logging;
struct {
uint64_t idx: 16;
uint64_t latched: 1;
Expand Down Expand Up @@ -342,6 +384,21 @@ typedef union {
uint64_t cmd: 8;
uint64_t data: 32;
} dashboard_bl_cmd;
struct {
uint64_t IMD: 1;
uint64_t BMS: 1;
uint64_t BSPD: 1;
uint64_t BOTS: 1;
uint64_t inertia: 1;
uint64_t c_estop: 1;
uint64_t main: 1;
uint64_t r_estop: 1;
uint64_t l_estop: 1;
uint64_t HVD: 1;
uint64_t hub: 1;
uint64_t TSMS: 1;
uint64_t pchg_out: 1;
} sdc_status;
struct {
uint64_t idx: 16;
uint64_t latched: 1;
Expand Down Expand Up @@ -516,6 +573,23 @@ typedef struct {
uint8_t cmd;
uint32_t data;
} dashboard_bl_cmd;
struct {
uint8_t IMD;
uint8_t BMS;
uint8_t BSPD;
uint8_t BOTS;
uint8_t inertia;
uint8_t c_estop;
uint8_t main;
uint8_t r_estop;
uint8_t l_estop;
uint8_t HVD;
uint8_t hub;
uint8_t TSMS;
uint8_t pchg_out;
uint8_t stale;
uint32_t last_rx;
} sdc_status;
struct {
uint16_t idx;
uint8_t latched;
Expand Down
Empty file removed source/dashboard/hdd/hdd.c
Empty file.
12 changes: 0 additions & 12 deletions source/dashboard/hdd/hdd.h

This file was deleted.

Loading

0 comments on commit 07a047c

Please sign in to comment.