Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -rc7ed4f90b600fe684097654f150e4972646ffec9 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision c7ed4f90b600fe684097654f150e4972646ffec9) @@ -7,8 +7,8 @@ * * @file SystemComm.c * -* @author (last) Dara Navaei -* @date (last) 21-Dec-2021 +* @author (last) Michael Garthwaite +* @date (last) 09-Mar-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -100,7 +100,7 @@ static volatile BOOL dgIsOnlyCANNode = TRUE; ///< flag indicating whether DG is alone on CAN bus. static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. -static volatile BOOL hdIsCommunicating = FALSE; ///< has HD sent a message since last check +static OVERRIDE_U32_T hdCommunicationStatus = {0, 0, 0, 0}; ///< has HD sent a message since last check static volatile U32 timeOfLastHDCheckIn = 0; ///< last time we received an HD broadcast // ********** private function prototypes ********** @@ -153,7 +153,7 @@ *************************************************************************/ BOOL isHDCommunicating( void ) { - return hdIsCommunicating; + return getU32OverrideValue(&hdCommunicationStatus); } /*********************************************************************//** @@ -496,7 +496,7 @@ // if message from HD broadcast channel, update HD comm status if ( COMM_BUFFER_IN_CAN_HD_BROADCAST == MSG_IN_BUFFERS[ i ] ) { - hdIsCommunicating = TRUE; + hdCommunicationStatus.data = (U32)TRUE; timeOfLastHDCheckIn = getMSTimerCount(); } } @@ -620,7 +620,7 @@ if ( message.crc == crc8( (U08*)(&message), sizeof(MESSAGE_HEADER_T) + message.msg.hdr.payloadLen ) ) { // if ACK, mark pending message ACK'd - if ( MSG_ID_ACK == message.msg.hdr.msgID ) + if ( MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK == message.msg.hdr.msgID ) { matchACKtoPendingACKList( message.msg.hdr.seqNo ); } @@ -654,7 +654,7 @@ { if ( TRUE == didTimeout( timeOfLastHDCheckIn, HD_COMM_TIMEOUT_IN_MS ) ) { - hdIsCommunicating = FALSE; + hdCommunicationStatus.data = FALSE; //activateAlarmNoData( ALARM_ID_HD_COMM_TIMEOUT ); } } @@ -877,6 +877,10 @@ handleDGSendConcentrateMixingRatios( message ); break; + case MSG_ID_DG_SCHEDULED_RUNS_INFO: + handleDGScheduledRunsRequest( message ); + break; + // NOTE: This case must be last case MSG_ID_DG_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); @@ -888,7 +892,8 @@ } // handle any test messages if tester has logged in successfully - if ( ( msgID > MSG_ID_FIRST_DG_TESTER_MESSAGE ) && ( msgID <= END_OF_MSG_IDS ) && ( TRUE == isTestingActivated() ) ) + // NOTE: END_OF_MSG_IDS = 65536 which is out of the range of a U16 so it is subtracted by 1. This is unreachable in development testing + if ( ( msgID > MSG_ID_FIRST_DG_TESTER_MESSAGE ) && ( msgID <= END_OF_MSG_IDS - 1 ) && ( TRUE == isTestingActivated() ) ) { switch ( msgID ) { @@ -1148,11 +1153,84 @@ handleTestFansRPMAlarmStartTimeOffsetOverrideRequest( message ); break; + case MSG_ID_DG_USED_ACID_VOLUME_ML_OVERRIDE: + handleTestUsedAcidVolumeMLOverrideRequest( message ); + break; + + case MSG_ID_DG_USED_BICARB_VOLUME_ML_OVERRIDE: + handleTestUsedBicarbVolumeMLOverrideRequest( message ); + break; + + case MSG_ID_DG_GET_SW_CONFIG_RECORD: + handleGetDGSoftwareConfigRecord( message ); + break; + + case MSG_ID_DG_SET_SW_CONFIG_RECORD: + handleSetDGSoftwareConfigRecord( message ); + break; + + case MSG_ID_DG_FANS_DUTY_CYCLE_OVERRIDE: + handleSetFansDutyCycleOverrideRequest( message ); + break; + + case MSG_ID_DG_HD_COMMUNICATION_STATUS_OVERRIDE: + handleTestHDCommunicationStatusOverrideRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; } } } + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + +/*********************************************************************//** + * @brief + * The testSetHDCommunicationStatus function sets the override + * of the HD communication status. + * @details Inputs: none + * @details Outputs: hdCommunicationStatus + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testSetHDCommunicationStatus( U32 value ) +{ + BOOL result = FALSE; + + if (TRUE == isTestingActivated() ) + { + result = TRUE; + hdCommunicationStatus.ovData = value; + hdCommunicationStatus.override = OVERRIDE_KEY; + + } + return result; +} + +/*********************************************************************//** + * @brief + * The testResetHDCommuncationStatus function resets the override + * of the HD communication status. + * @details Inputs: none + * @details Outputs: hdCommunicationStatus + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetHDCommuncationStatus( void ) +{ + BOOL result = FALSE; + + if (TRUE == isTestingActivated() ) + { + result = TRUE; + hdCommunicationStatus.override = OVERRIDE_RESET; + hdCommunicationStatus.ovData = hdCommunicationStatus.ovInitData; + + } + return result; +} + /**@}*/