Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added basics of multi-bus support to CAN driver * New CAN data structure More flexible CAN Send structure * - Compat fixes for applications with new driver data type and function signatures - Compile fixes for driver - Deprecated data types removed * - Compat layer for legacy MC driver - Minor bug fixes - Notice of deprecation for legacy MC driver * reconfigured enum and implemented lookup table * implemented LUT and build fixes * - Moved LUT into the C file to fix linker issue - Moved LUT struct def into the C file - fixed doc comments * - changed file organization - still need to make readfunc populate the idx field * changed lookup table to be a sparse array, changed enum to fit * implemented read functionality * more appropriate error checking in CANbus_Send * - fixed temperature CAN ID - fixed comments - fixed lookup table type * Small fixes * Started CANbus test file * Added some tests for repeated blocking and non-blocking CANbus_Send * Some changes to test * Put CAN1 and CAN3 in loopback mode for testing * Connected CAN1 and CAN3 to test read/writes * Objectives for ReadTritium Rewrite * 11/5 - AM * 11/5 - PM * Implemented error handling * Modified Minion_Read_Input to read inputs and outputs and renamed to Minion_Read_Pin * Added test for testing the ignition contactor task * Updated code due to the Minion Read function rewrite * Removed unneed error * Removed unneeded error and shortened error name * Fixed tritium error handling. Added velocity read and getter capabilities. In process of adding fault handlling capabilities * added if-statement to skip T_NONE errors * for gage * Added fault state handling. * Deleted old motor controller file and header file, and mentions of header file. * fixed velocity conversions to multiplying fixed point value by ten instead of dividing by ten so that the value is accurately displayed in fixed point format. Added macros to initialize internally held variables Motor_RPM and Motor_Velocity (they are both initialized to 0) * Implelemted motor controller restart function in ReadTritium, use this function in FaultState.c. Defined a new error code (T_INIT_FAIL) to shut off the motor controller in the event a restart/initialization fails. * Made changes from design review, including using chargingDisable in the callback, removing extra header files, and taking out the line that set the OS error location bitmap. * master version of CAN driver * fixed restart, changed CAN driver slightly. Commented out old updateVelocity. * erged updatevelocity_rewrite * verified all FSM transitions in Test_SendTritium on renode simulation platform * fixed SendTritium test float printing * fixed can msg construction * fixed can message memory accesses for reading and sending to tritium fixed cruise velocity setpoint to work with rpm instead of m/s * fixed map function and removed magic number usage, also fixed scope macro (#298) * bye bye old sim * Changed Fault State, added exception struct, general assertion function, and rewrote OS assert. Created variable mailbox and mutex and moved semaphore to fault state. * updated EnterFaultState with prio based switch case. combined ArrayMotorKill with nonreocverableFaultHandler. * wrote callback functions for priority 2 * wrote assert function for tritium * fixed function pointer implementation, added h files, unused variables * Moved Faultstate mutex post, fixed a conditional for callbacks, added a macro for initializing CurrException * Renamed _assertError to assertExceptionError, had the exception callback take void for arguments, changed the hall sensor callback to use if statements instead of making a new exception inside the callback. * Fixed a couple more merge conflicts. * Removed delay in fault state main thread. * Created test file for the updated fault state with exception levels with priority levels. Wrote test for exception priorities 1 and 2 in an isolated environment apart from other application tasks. * Added assertOSError test. * Attempted to add a Faultstate test for ReadTritium using the FaultThread leader board and motor simulator files. * Added draft of ReadCarCAN Exception test to FaultThread test. * Fixed build by adding header file and small mistakes. * printf debug * printf now working! * Changed the fault state exception assertion mutex to a binary semaphore since different tasks are setting and handling exceptions (a mutex would have to be posted by the same task that acquired it) * Added missing calls to delete tasks for the tests. * Added a print statement to assertOSError, changed assert functions to only use assertDisplayError and not assertUpdateDisplayError because they really do act the same and we didn't really use assertDisplayError in other apps anynways. * Added a bit more to the Fault State tests, even though CAN communication between machines on Renode tests is not working. * Added Contactors_Init(), made CarSim loop sending messages for testing purposes. * Addressing review comments: removed macro, volatilequalifier for exception and EnterFaultState in header since they aren't needed. * Some small things changed while testing * Changed exception prio field to use an enum instead of an int. * Added/updated comments at the tops of the test files explaining what they are supposed to do. * Moved tasks done by the bps-sim and motor-sim on Renode into the main task in the leaderboard test in an attempt to avoid the many issues previously plaguing this endeavor. * Test now runs on LoopBack mode. However, the weird print issue still happens if you let it run through a second round. * Updated comments and added a print statement to readTritium for motor restarts. * Beginning work for new fault thread mechanism that spawns new tasks of high or low priority to deal with errors. Created task files, made priority and macro changes in Tasks, add comments for planning. * Began new redesign of error handling in which everything is localized to each task and scheduler locking is used to ensure high-priority faults are handled first. This commit includes finishing the error assertion function for the display, as well as renaming variable/function names related to assertDisplayError to reflect our new specification of using the word 'error' to describe when we have issues. * Actually, this commit is where names get changed to replace 'fault' with 'error' * Added a currError variable to hold the current error code for inspection purposes, removed task files from the last fault state redesign attempt which we have since aborted. * Wrote assertTritiumError function for ReadTritium, created new nonrecoverableErrorHandler in Tasks.c to cover standard high-priority error actions like killing contactors, displaying the fault, and entering an infinite while loop. * Renamed Display_Fault function to Display_Error. * Added parameters and function to nonrecoverableErrorHnadler so that it can display the fault screen. * Split nonrecoverableErrorHandler so that arrayMotorKill to turn off the motor and array contactors can be called outside of the nonrecoverable error handler, began work on the ReadCarCAN error assertion function * Finished a first compiling draft of the ReadCarCAN assert function. * Renamed the display error variable from currError to displayError. * Added assertTaskError function to serve as a single assertion function that takes care of locking the scheduler and displaying a fault before jumping to a callback. This allows us to avoid locking the scheduler in many places throughout the code. * Reordered and added new parameters to assertTaskError function. * Rewrote readTritium error assertion to use the main assertTaskError function and a callback handler instead of the separate assertion functions for each task that we were planning earlier. Also added an enum to define options for locking the scheduler and choosing recoverable/nonrecoverable when asserting an error. * Typedef-ed the error assertion option enums to enforce usage, reorder assertion and handler functions in readTritium so that the program can compile. * Began moving assertError function for display errors from display driver to updatedisplay app. * Moved error handling from Display.c to UpdateDisplay.c, decided to set global error variables for tasks inside individual task error assertion functions instead of in the main assertion function to avoid needing to figure out which location an error is coming from to set the correct error variable. * Modified test file, ReadTritium hall and nonhall sensor error tests appear to work. * This is a commit where I tried to test assertDisplayError by using the SetCruiseState function and it didn't work because it returns an error but nothing checks it and the assertDisplayError function is static. Next I'm going try using PutNext to overflow the fifo because I think that was something we wanted to test, but in order to do that I'm going to have to make it nonstatic. * Removed assertDisplayError from UpdateDisplay header file to make it a static function * Actually the display error thing seems to work as intended. Nothing major changed. * Deleted faultstate things. * Small documentation changes. * Reverted ReadCarCAN to where it was before fix_ignition_delay branched off to prepare for merging update_faultstate into fix_ignition_delay. * Renamed assertDisplayError to assertUpdateDisplayError to reduce changes to files. * Deleted the motorsim and carsim files for faultstate testing because the current test runs in loopback mode and doesn't use extra Renode machines. * Small documentation changes and file cleanup. * Update faultstate testfile to work with new faultstate. * Bringing improvements to the fault thread test from fix_ignition_delay so that it has the most recent changes, including those to test ReadCarCAN. * Small changes made while updating error handling for ReadCarCAN on fix_ignition_delay. * Renamed the scheduler lock option, changed error_code_t to a typedef. * Update Apps/Src/ReadTritium.c Accepted suggestion to restructure assertTritiumError for less-nested if-elses Co-authored-by: Sidharth N. Babu <[email protected]> * Update Apps/Src/ReadTritium.c Accepted suggestion to change the small function handler_Tritium_HallError to an inline function Co-authored-by: Sidharth N. Babu <[email protected]> * Changed _assertOSError to use the os_error_loc_t, attempted to realign the updatedisplay enum. * Update Apps/Src/ReadTritium.c Co-authored-by: Sidharth N. Babu <[email protected]> * Reattempting to align the UpdateDisplay.h error enum. * Aligned(?) the comments from UpdateDisplay.h. I think it should all look nice now * Changed assertTaskError to take an error_code_t, and changed error_code_t to be an int16_t. * Modified ReadCarCAN so it compiles * Addressed PR review comments. Mostly small changes and one doc alteration. * Additional PR review changes (renaming things) * Apply suggestions from code review Co-authored-by: Ishan Deshpande <[email protected]> * Addressed review comment: assertUpdateDisplayError takes in an UpdateDisplayError_t instead of a DisplayError_t * Fixed assertUpdateDisplayError using the wrong error type. * Additional review edits: Changed error_code_t from an int16_t to a uint16_t and made more functions use it, including Display_Error, which previously took a uint8_t instead. Also added more comments to assertTritiumError. * Updated Test_DisplayApps to compile with new fault handling system. * Addressed review and other comments: added prints to error infinite loop, made all nonrecoverable errors automatically lock the scheduler, renamed arrayMotorKill to EmergencyContactorOpen. * Deleted #define NUM_TRITIUM_ERRORS and MotorController_getTritiumError which weren't being used. * Added a comment about always locking the scheduler on nonrecoverable faults. * Added additional comments to the test file. * Removed redundant calls to assertUpdateDisplayError. The only ones left are those in UpdateDisplay_PutNext (UPDATEDISPLAY_ERR_FIFO_PUT, UpdateDisplay_PopNext(UPDATEDISPLAY_ERR_FIFO_POP, UPDATEDISPLAY_ERR_DRIVER from display_send), UpdateDisplay_SetComponent(UPDATEDISPLAY_ERR_PARSE_COMP). The rest of the errors that get returned from functions aren't necessary and can be removed in a future issue ticket. * Changed fault handling for UpdateDisplay to clear the queue and reset the display every time instead of erroring out once a restart threshold has been reached. * Made print statements and comments a bit clearer/cleaner. * Display fault is now 4 hex digits * Fixes during hardware testing to a) stop the display error from being overwritten by initializing display and update display earlier in the test and b) prevent the UpdateDisplay task from running into FIFO_POP errors by setting the message queue semaphore to zero when resetting the queue. This was also added to assertTaskError to ensure the error doesn't get overwritten, but this really shouldn't happen so we may want to take it out. * Removed unnecessary value assignments from the UpdateDisplay error enum. * Apply suggestions from code review Removing unused macros and correcting documentation Co-authored-by: Diya Rajon <[email protected]> * 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. * Name change * Addressed review comments- changed assertTaskError to throwTaskError, changed a bit of throwTaskError logic, removed some comments. * Renamed assertTaskError to throwTaskError in the test file. * Changed a print statement so that it still makes sense when sending an error of NONE. * Removed MOTOR_STOPPED macro. * Removed the ERR_NO_CHANGE in UpdateDisplay and all checks for if things haven't changed since we weren't ever checking them anyways. * Update Tests/Test_FaultThread_Exceptions.c Accepted deletion of unnecessary tab Co-authored-by: Ishan Deshpande <[email protected]> * Moved ReadCarCAN Display_Evac into a callback for the BPSTrip message, changed the recoverability option to nonrecoverable. * Fixed Doxygen comments. * Removed references to OS_LOC in new faultstate code. * Removed one more reference to OS LOC. * Replaced accidentally-deleted Doxygen comment. --------- Authored-by: Madeleine Lee <[email protected]>
- Loading branch information