From af257341bd5e42e344fc00cfa03bf5bb795a6ce0 Mon Sep 17 00:00:00 2001 From: Madeleine Lee Date: Sat, 7 Oct 2023 20:15:54 +0000 Subject: [PATCH] Changed Display fault enum from positive to default values, added a delay in UpdateDisplay_Init since errors wouldn't be displayed unless we waited more than 215 ms before sending them. --- Apps/Src/UpdateDisplay.c | 2 ++ Drivers/Inc/Display.h | 22 +++++++++++----------- Tests/Test_FaultThread_Exceptions.c | 17 +++++------------ 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/Apps/Src/UpdateDisplay.c b/Apps/Src/UpdateDisplay.c index d89aecb99..ccaa2a65f 100644 --- a/Apps/Src/UpdateDisplay.c +++ b/Apps/Src/UpdateDisplay.c @@ -85,6 +85,8 @@ UpdateDisplayError_t UpdateDisplay_Init(){ assertOSError(OS_DISPLAY_LOC, err); UpdateDisplayError_t ret = UpdateDisplay_SetPage(INFO); + OSTimeDlyHMSM(0, 0, 0, 300, OS_OPT_TIME_HMSM_STRICT, &err); // Wait >215ms so errors will show on the display + assertOSError(OS_MAIN_LOC, err); return ret; } diff --git a/Drivers/Inc/Display.h b/Drivers/Inc/Display.h index de483a48f..5b57c8f59 100644 --- a/Drivers/Inc/Display.h +++ b/Drivers/Inc/Display.h @@ -23,17 +23,17 @@ * Error types */ typedef enum{ // Currently only ERR_NONE and ERR_PARSE are used - DISPLAY_ERR_NONE = 0, - DISPLAY_ERR_PARSE =-1, // Error parsing command struct passed to Display_Send - DISPLAY_ERR_INV_INSTR =-2, // Invalid instruction passed to nextion (0x00) - DISPLAY_ERR_INV_COMP =-3, // Invalid component id passed to nextion (0x02) - DISPLAY_ERR_INV_PGID =-4, // Invalid page id passed to nextion (0x03) - DISPLAY_ERR_INV_VAR =-5, // Invalid variable name passed to nextion (0x1A) - DISPLAY_ERR_INV_VAROP =-6, // Invalid variable operation passed to nextion (0x1B) - DISPLAY_ERR_ASSIGN =-7, // Assignment failure nextion (0x1C) - DISPLAY_ERR_PARAMS =-8, // Invalid number of parameters passed to nextion (0x1E) - DISPLAY_ERR_MAX_ARGS =-9, // Command arg list exceeded MAX_ARGS elements - DISPLAY_ERR_OTHER =-10 // Other nextion display error + DISPLAY_ERR_NONE, + DISPLAY_ERR_PARSE, // Error parsing command struct passed to Display_Send + DISPLAY_ERR_INV_INSTR, // Invalid instruction passed to nextion (0x00) + DISPLAY_ERR_INV_COMP, // Invalid component id passed to nextion (0x02) + DISPLAY_ERR_INV_PGID, // Invalid page id passed to nextion (0x03) + DISPLAY_ERR_INV_VAR, // Invalid variable name passed to nextion (0x1A) + DISPLAY_ERR_INV_VAROP, // Invalid variable operation passed to nextion (0x1B) + DISPLAY_ERR_ASSIGN, // Assignment failure nextion (0x1C) + DISPLAY_ERR_PARAMS, // Invalid number of parameters passed to nextion (0x1E) + DISPLAY_ERR_MAX_ARGS, // Command arg list exceeded MAX_ARGS elements + DISPLAY_ERR_OTHER // Other nextion display error } DisplayError_t; diff --git a/Tests/Test_FaultThread_Exceptions.c b/Tests/Test_FaultThread_Exceptions.c index 0fd2cff55..f1c62de16 100644 --- a/Tests/Test_FaultThread_Exceptions.c +++ b/Tests/Test_FaultThread_Exceptions.c @@ -41,8 +41,8 @@ enum { // Test menu enum }; /*** Constants ***/ -#define TEST_OPTION TEST_READTRITIUM // Decide what to test based on test menu enum -#define READTRITIUM_OPTION T_DC_BUS_OVERVOLT_ERR // The enum for the tritium error we want to test (reference error enum) +#define TEST_OPTION TEST_UPDATEDISPLAY // Decide what to test based on test menu enum +#define READTRITIUM_OPTION T_NONE // The enum for the tritium error we want to test (reference error enum) /* READTRITIUM_OPTION menu: T_HARDWARE_OVER_CURRENT_ERR = (1<<0), @@ -184,14 +184,13 @@ void Task_ManagerTask(void* arg) { case TEST_OS_ASSERT: // Test the assertOSError function using the OSErrorTask // Creates an OS error by pending on a mutex that isn't created - // Successful if it prints the OS Error code 24004 - // and doesn't print the fail message (task is stopped by asserting an error) + // Successful if it doesn't print the fail message (task is stopped by asserting an error) printf("\n\n\r=========== Testing OS assert ==========="); //Expected output: infinite while loop with no prints createOSErrorTask(); - OSTimeDlyHMSM(0, 0, 0, 500, OS_OPT_TIME_HMSM_STRICT, &err); + OSTimeDlyHMSM(0, 0, 2, 0, OS_OPT_TIME_HMSM_STRICT, &err); checkOSError(err); break; @@ -215,13 +214,6 @@ void Task_ManagerTask(void* arg) { canError.ID = MOTOR_STATUS; createReadTritium(); - //OSTimeDlyHMSM(0, 0, 10, 0, OS_OPT_TIME_HMSM_STRICT, &err); // Wait for the display to initialize - // for (int i = 0x07; i < 0x09; i++){ - // printf("\n\rSending %x", i); - // Display_Error(OS_DISPLAY_LOC, i); - // OSTimeDlyHMSM(0, 0, 0, 104, OS_OPT_TIME_HMSM_STRICT, &err); // Wait for the display to initialize - //} - //OSTimeDlyHMSM(0, 0, 0, 10, OS_OPT_TIME_HMSM_STRICT, &err); // Wait for the display to initialize printf("\n\n\rNow sending: %d", tritiumError); // Sending 0 means no Tritium error CANbus_Send(canError, CAN_BLOCKING, MOTORCAN); OSTimeDlyHMSM(0, 0, 1, 0, OS_OPT_TIME_HMSM_STRICT, &err); // Wait for ReadTritium to finish @@ -245,6 +237,7 @@ void Task_ManagerTask(void* arg) { // Tests exceptions in ReadCarCAN by creating the tasks and sending messages // Successful if charging disable and missed messages turns off contactors // And we enter a nonrecoverable fault immediately after receiving the trip message + /* Not tested on hardware due to dependencies on ReadCarCAN fix_ignition_delay branch changes */ printf("\n\n\r=========== Testing ReadCarCAN ==========="); createReadCarCAN();