Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rf3b83f75a19b975ad1abead662c8151a2907ac00 -r933a18d740285e70be9d00696ed0f5a5381bc8e4 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision f3b83f75a19b975ad1abead662c8151a2907ac00) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) @@ -8,7 +8,7 @@ * @file SystemComm.c * * @author (last) Sean Nash -* @date (last) 28-Aug-2020 +* @date (last) 14-Oct-2020 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -161,9 +161,8 @@ /*********************************************************************//** * @brief * The initSystemComm function initializes the SystemComm module. - * @details - * Inputs : none - * Outputs : SystemComm module initialized. + * @details Inputs: none + * @details Outputs: SystemComm module initialized. * @return none *************************************************************************/ void initSystemComm( void ) @@ -189,9 +188,8 @@ * @brief * The checkInFromDG function checks in the DG with the HD - indicating that * the DG is communicating. - * @details - * Inputs : none - * Outputs : dgIsCommunicating + * @details Inputs: none + * @details Outputs: dgIsCommunicating * @return none *************************************************************************/ void checkInFromDG( void ) @@ -204,9 +202,8 @@ * @brief * The checkInFromUI function checks in the UI with the HD - indicating that * the UI is communicating. - * @details - * Inputs : none - * Outputs : uiIsCommunicating + * @details Inputs: none + * @details Outputs: uiIsCommunicating * @return none *************************************************************************/ void checkInFromUI( void ) @@ -220,9 +217,8 @@ * @brief * The isDGCommunicating function determines whether the DG is communicating * with the HD. - * @details - * Inputs : dgIsCommunicating - * Outputs : none + * @details Inputs: dgIsCommunicating + * @details Outputs: none * @return TRUE if DG has checked in since last call, FALSE if not *************************************************************************/ BOOL isDGCommunicating( void ) @@ -234,9 +230,8 @@ * @brief * The isUICommunicating function determines whether the UI is communicating * with the HD. - * @details - * Inputs : uiIsCommunicating - * Outputs : none + * @details Inputs: uiIsCommunicating + * @details Outputs: none * @return TRUE if UI has checked in since last call, FALSE if not *************************************************************************/ BOOL isUICommunicating( void ) @@ -251,9 +246,8 @@ /*********************************************************************//** * @brief * The uiCommunicated function determines whether the UI has communicated. - * @details - * Inputs : uiDidCommunicate - * Outputs : none + * @details Inputs: uiDidCommunicate + * @details Outputs: none * @return TRUE if UI has communicated since power up, FALSE if not *************************************************************************/ BOOL uiCommunicated( void ) @@ -265,9 +259,8 @@ * @brief * The isHDOnlyCANNode function determines whether the HD is the only node * currently on the CAN bus. - * @details - * Inputs : hdIsOnlyCANNode - * Outputs : none + * @details Inputs: hdIsOnlyCANNode + * @details Outputs: none * @return TRUE if HD is only node on CAN bus, FALSE if not *************************************************************************/ BOOL isHDOnlyCANNode( void ) @@ -278,9 +271,8 @@ /*********************************************************************//** * @brief * The execSystemCommRx function manages received data from other sub-systems. - * @details - * Inputs : none - * Outputs : Incoming messages parsed and processed. + * @details Inputs: none + * @details Outputs: Incoming messages parsed and processed. * @return none *************************************************************************/ void execSystemCommRx( void ) @@ -302,9 +294,8 @@ * @brief * The execSystemCommTx function manages data to be transmitted to other * sub-systems. - * @details - * Inputs : none - * Outputs : Outgoing messages transmitted. + * @details Inputs: none + * @details Outputs: Outgoing messages transmitted. * @return none *************************************************************************/ void execSystemCommTx( void ) @@ -373,9 +364,8 @@ * This may have occurred because a CAN packet transmission has completed * or because a CAN packet has been received. The appropriate handler is * called. - * @details - * Inputs : none - * Outputs : message interrupt handled + * @details Inputs: none + * @details Outputs: message interrupt handled * @param srcCANBox which CAN message box triggered this interrupt * @return none *************************************************************************/ @@ -422,9 +412,8 @@ * @brief * The handleUARTMsgRecvPacketInterrupt function handles a DMA UART receive * packet completed interrupt. - * @details - * Inputs : none - * Outputs : UART received packet interrupt handled. + * @details Inputs: none + * @details Outputs: UART received packet interrupt handled. * @return none *************************************************************************/ #ifdef DEBUG_ENABLED @@ -443,9 +432,8 @@ * @brief * The handleUARTMsgXmitPacketInterrupt function handles a DMA UART transmit * packet completed interrupt. - * @details - * Inputs : none - * Outputs : UART transmit packet interrupt handled. + * @details Inputs: none + * @details Outputs: UART transmit packet interrupt handled. * @return none *************************************************************************/ #ifdef DEBUG_ENABLED @@ -464,9 +452,8 @@ * @brief * The initUARTAndDMA function initializes the SCI1 peripheral and the DMA * to go with it for PC communication. - * @details - * Inputs : none - * Outputs : SCI1 and DMA initialized + * @details Inputs: none + * @details Outputs: SCI1 and DMA initialized * @return none *************************************************************************/ #ifdef DEBUG_ENABLED @@ -530,9 +517,8 @@ * @brief * The isCANBoxForXmit function determines whether a given CAN message box * is configured for transmit. - * @details - * Inputs : CAN_OUT_BUFFERS[] - * Outputs : none + * @details Inputs: CAN_OUT_BUFFERS[] + * @details Outputs: none * @param srcCANBox which CAN message box to check * @return TRUE if the given CAN message box is configured for transmit, FALSE if not. *************************************************************************/ @@ -557,9 +543,8 @@ * @brief * The isCANBoxForRecv function determines whether a given CAN message box * is configured for receiving. - * @details - * Inputs : MSG_IN_BUFFERS[] - * Outputs : none + * @details Inputs: MSG_IN_BUFFERS[] + * @details Outputs: none * @param srcCANBox which CAN message box to check * @return TRUE if the given CAN message box is configured for receiving, FALSE if not. *************************************************************************/ @@ -583,9 +568,8 @@ /*********************************************************************//** * @brief * The clearCANXmitBuffers function clears all CAN transmit buffers. - * @details - * Inputs : CAN_OUT_BUFFERS[] - * Outputs : CAN transmit buffers cleared. + * @details Inputs: CAN_OUT_BUFFERS[] + * @details Outputs: CAN transmit buffers cleared. * @return none *************************************************************************/ static void clearCANXmitBuffers( void ) @@ -608,9 +592,8 @@ * @brief * The findNextHighestPriorityCANPacketToTransmit function gets the next * 8 byte packet and initiates a CAN transmit on the appropriate CAN channel. - * @details - * Inputs : Output CAN Comm Buffer(s) - * Outputs : none + * @details Inputs: Output CAN Comm Buffer(s) + * @details Outputs: none * @return buffer with highest priority CAN packet to transmit, * COMM_BUFFER_NOT_USED if not CAN packets pending transmit found *************************************************************************/ @@ -636,9 +619,8 @@ * @brief * The transmitNextCANPacket function gets the next 8 byte packet and initiates * a CAN transmit on the appropriate CAN channel. - * @details - * Inputs : Output CAN Comm Buffers - * Outputs : CAN packet transmit initiated. + * @details Inputs: Output CAN Comm Buffers + * @details Outputs: CAN packet transmit initiated. * @return number of bytes transmitted *************************************************************************/ static U32 transmitNextCANPacket( void ) @@ -686,9 +668,8 @@ * @brief * The transmitNextUARTPacket function sets up and initiates a DMA transmit * of the next packet pending transmit (if any) via UART. - * @details - * Inputs : Output UART Comm Buffer(s) - * Outputs : UART DMA transmit initiated. + * @details Inputs: Output UART Comm Buffer(s) + * @details Outputs: UART DMA transmit initiated. * @return number of bytes transmitted *************************************************************************/ #ifdef DEBUG_ENABLED @@ -725,9 +706,8 @@ * @brief * The processIncomingData function parses out messages from the Input * Comm Buffers and adds them to the Received Message Queue. - * @details - * Inputs : Input Comm Buffers - * Outputs : Parsed message(s) added to Received Message Queue + * @details Inputs: Input Comm Buffers + * @details Outputs: Parsed message(s) added to Received Message Queue * @return none *************************************************************************/ static void processIncomingData( void ) @@ -813,9 +793,8 @@ * @brief * The consumeBufferPaddingBeforeSync function removes any bytes in a given * buffer that lie before a sync byte. - * @details - * Inputs : none - * Outputs : Any padding at front of buffer is consumed. + * @details Inputs: none + * @details Outputs: Any padding at front of buffer is consumed. * @param buffer the comm buffer to process * @return none *************************************************************************/ @@ -844,9 +823,8 @@ * @brief * The parseMessageFromBuffer function looks for a complete message in a * given buffer. If a message is found, its size is returned. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @param data pointer to byte array to search for a message * @param len number of bytes in the data to search * @return size of message if found, zero if no complete message found, @@ -896,9 +874,8 @@ * @brief * The processReceivedMessages function processes any messages in the * received message queues. - * @details - * Inputs : Received Message Queues - * Outputs : Message(s) processed. + * @details Inputs: Received Message Queues + * @details Outputs: Message(s) processed. * @return none *************************************************************************/ static void processReceivedMessages( void ) @@ -946,9 +923,8 @@ * @brief * The checkForCommTimeouts function checks for sub-system communication * timeout errors. - * @details - * Inputs : timeOfLastDGCheckIn, timeOfLastUICheckIn - * Outputs : possibly a comm t/o alarm + * @details Inputs: timeOfLastDGCheckIn, timeOfLastUICheckIn + * @details Outputs: possibly a comm t/o alarm * @return none *************************************************************************/ static void checkForCommTimeouts( void ) @@ -971,9 +947,8 @@ * The checkTooManyBadMsgCRCs function checks for too many bad message CRCs * within a set period of time. Assumed function is being called when a new * bad CRC is detected so a new bad CRC will be added to the list. - * @details - * Inputs : badCRCTimeStamps[], badCRCListIdx, badCRCListCount - * Outputs : possibly a "too many bad CRCs" alarm + * @details Inputs: badCRCTimeStamps[], badCRCListIdx, badCRCListCount + * @details Outputs: possibly a "too many bad CRCs" alarm * @return none *************************************************************************/ static void checkTooManyBadMsgCRCs( void ) @@ -998,9 +973,8 @@ * The addMsgToPendingACKList function adds a given message to the pending * ACK list. Messages in this list will require receipt of an ACK message * for this particular message within a limited time. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @param msg pointer to msg within the message data * @param msgData pointer to message data to add to pending ACK list * @param len number of bytes of message data @@ -1046,9 +1020,8 @@ * The matchACKtoPendingACKList function searches the pending ACK list to * see if the sequence # from a received ACK msg matches any. If found, * the list entry is removed. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @param seqNo sequence # to match to an entry in the list * @return TRUE if a match was found, FALSE if not *************************************************************************/ @@ -1076,9 +1049,8 @@ * The checkPendingACKList function searches the pending ACK list to * see if any have expired. Any such messages will be queued for retransmission * and if max retries reached a fault is triggered. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @return none *************************************************************************/ static void checkPendingACKList( void ) @@ -1112,9 +1084,8 @@ /*********************************************************************//** * @brief * The processReceivedMessage function processes a given message. - * @details - * Inputs : none - * Outputs : message processed + * @details Inputs: none + * @details Outputs: message processed * @param message pointer to message to process * @return none *************************************************************************/ @@ -1158,6 +1129,10 @@ case MSG_ID_USER_UF_SETTINGS_CHANGE_REQUEST: handleChangeUFSettingsRequest( message ); + break; + + case MSG_ID_USER_SALINE_BOLUS_REQUEST: + handleSalineBolusRequest( message ); break; case MSG_ID_USER_CONFIRM_UF_SETTINGS_CHANGE: @@ -1414,6 +1389,60 @@ handleTestSetTreatmentParameter( message ); break; + case MSG_ID_VALVES_STATES_PUBLISH_INTERVAL_OVERRIDE: + handleTestHDValvesBroadcastIntervalOverrideRequest( message ); + break; + + case MSG_ID_HD_VALVES_HOME: + handleHomeHDValve( message ); + break; + + case MSG_ID_HD_VALVES_SET_AIR_TRAP_VALVE: + handleSetAirTrapValve( message ); + break; + + case MSG_ID_HD_VALVES_POSITION_OVERRIDE: + handleSetHDValvePositionOverrideRequest( message ); + break; + +#ifdef DEBUG_ENABLED + case MSG_ID_HD_VALVES_SET_PWM_OVERRIDE: + handleSetHDValvePWMOverrideRequest( message ); + break; +#endif + + case MSG_ID_HD_AIR_TRAP_SEND_INTERVAL_OVERRIDE: + handleSetAirTrapBroadcastIntervalOverrideRequest( message ); + break; + + case MSG_ID_HD_AIR_TRAP_LEVEL_SENSOR_OVERRIDE: + handleSetAirTrapLevelSensorOverrideRequest( message ); + break; + + case MSG_ID_HD_SOFTWARE_RESET_REQUEST: + handleHDSoftwareResetRequest( message ); + break; + + case MSG_ID_BLOOD_FLOW_SIG_STRENGTH_OVERRIDE: + handleTestBloodFlowSignalStrengthOverrideRequest( message ); + break; + + case MSG_ID_DIAL_IN_FLOW_SIG_STRENGTH_OVERRIDE: + handleTestDialInFlowSignalStrengthOverrideRequest( message ); + break; + + case MSG_ID_BLOOD_PUMP_HOME_CMD: + handleTestBloodPumpHomeRequest( message ); + break; + + case MSG_ID_DIAL_IN_PUMP_HOME_CMD: + handleTestDialInPumpHomeRequest( message ); + break; + + case MSG_ID_DIAL_OUT_PUMP_HOME_CMD: + handleTestDialOutPumpHomeRequest( message ); + break; + case MSG_ID_SUPER_CLEAR_ALARMS_CMD: handleTestSuperClearAlarmsRequest( message ); break;