/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TaskGeneral.c * * @author (last) Sean * @date (last) 30-Jul-2024 * * @author (original) Sean * @date (original) 30-Jul-2024 * ***************************************************************************/ #include "AirPump.h" #include "Messaging.h" #include "OperationModes.h" #include "Pressures.h" #include "Switches.h" #include "SystemCommTD.h" #include "TaskGeneral.h" #include "Voltages.h" #include "WatchdogMgmt.h" /** * @addtogroup TaskGeneral * @{ */ // ********** private data ********** /*********************************************************************//** * @brief * The taskGeneral function handles the scheduled General Task interrupt. * Calls the executive functions for most monitors and controllers, the * operation modes, the system communications, and alarms. * @details \b Inputs: none * @details \b Outputs: Executive functions running in general task are called. * @return none *************************************************************************/ void taskGeneral( void ) { #ifdef TASK_TIMING_OUTPUT_ENABLED // Set GPIO high to indicate general task has begun executing setCPLDLampGreen( PIN_SIGNAL_HIGH ); #endif // Check in with watchdog manager checkInWithWatchdogMgmt( TASK_GENERAL ); // Do this first to keep timing consistent with watchdog management // Manage data received from other sub-systems execSystemCommRx(); // Prevent most processing until UI has started communicating or if DG is active and alarm (ALARM_ID_HD_UI_COMM_POST_FAILED) is raised // proceed to further operations since UI likely failed to come up. if ( ( TRUE == uiCommunicated() ) || ( ( FALSE == isOnlyCANNode() ) && ( TRUE == isAlarmActive( ALARM_ID_TD_UI_COMM_POST_FAILED ) ) ) ) { // Monitor voltages execVoltagesMonitor(); // // Monitor DD // execDDInterfaceMonitor(); // Monitor pressure sensors execPressure(); // Monitor switches execSwitches(); // // Monitor temperatures // execTemperatures(); // // // Monitor processor RAM status // execRAMMonitor(); // Run operation mode state machine execOperationModes(); // // Control air trap valve // execAirTrapController(); // // // Control blood pump // execBloodFlowController(); // // Control Air Pump execAirPumpController(); // // Monitor/Control fan // execFan(); // // // Manage NVDataMgmt process record state machine // execNVDataMgmtProcessRecord(); // Manage alarm state execAlarmMgmt(); // Manage data to be transmitted to other sub-systems execSystemCommTx(); } #ifdef TASK_TIMING_OUTPUT_ENABLED // Set GPIO low to indicate general task has finished executing setCPLDLampGreen( PIN_SIGNAL_LOW ); #endif } /**@}*/