Skip to content

Commit

Permalink
Changed Display fault enum from positive to default values, added a d…
Browse files Browse the repository at this point in the history
…elay in UpdateDisplay_Init since errors wouldn't be displayed unless we waited more than 215 ms before sending them.
  • Loading branch information
KnockbackNemo committed Oct 7, 2023
1 parent a87b2d4 commit af25734
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
2 changes: 2 additions & 0 deletions Apps/Src/UpdateDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
22 changes: 11 additions & 11 deletions Drivers/Inc/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down
17 changes: 5 additions & 12 deletions Tests/Test_FaultThread_Exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit af25734

Please sign in to comment.