Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -re0413e662822f3ccc8b4fe9d969efef7eedb05ad -r59357d3831aa60f17ccdfbe0eef1a005935b9a58 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision e0413e662822f3ccc8b4fe9d969efef7eedb05ad) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 59357d3831aa60f17ccdfbe0eef1a005935b9a58) @@ -7,8 +7,8 @@ * * @file SystemComm.c * -* @author (last) Michael Garthwaite -* @date (last) 17-Mar-2023 +* @author (last) Dara Navaei +* @date (last) 20-May-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -49,8 +49,8 @@ #define MAX_COMM_CRC_FAILURES 5 ///< maximum number of CRC errors within window period before alarm #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window -#define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< maximum time for a Denali message that requires ACK to be ACK'd -#define MSG_NOT_ACKED_MAX_RETRIES 8 ///< maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm +#define MSG_NOT_ACKED_TIMEOUT_MS 250 ///< maximum time for a Denali message that requires ACK to be ACK'd +#define MSG_NOT_ACKED_MAX_RETRIES 10 ///< maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< maximum number of Delanli messages that can be pending ACK at any given time #define MAX_FPGA_CLOCK_SPEED_ERRORS 3 ///< maximum number of FPGA clock speed errors within window period before alarm @@ -196,6 +196,12 @@ // check ACK list for messages that need to be re-sent because they haven't been ACK'd checkPendingACKList(); + + if ( TRUE == hasDialinCheckInExpired() ) + { + // It has been a while since the user logged in but not activity has been received from Dialin so set the tester's status to log out + setTesterStatusToLoggedOut(); + } } /*********************************************************************//** @@ -770,27 +776,41 @@ U32 i; // find expired messages pending ACK - for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) - { // pending ACK expired? - if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) - { // if retries left, reset and resend pending message. Do not retry when in POST since the UI might not still be responsive - if ( ( pendingAckList[ i ].retries > 0 ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) - { // re-queue message for transmit - pendingAckList[ i ].retries--; - pendingAckList[ i ].timeStamp = getMSTimerCount(); - addToCommBuffer( pendingAckList[ i ].channel, pendingAckList[ i ].msg, pendingAckList[ i ].msgSize ); - } - // if no retries left, alarm - else - { - U16 msgID; + if( TRUE == isHDCommunicating() ) + { + for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) + { // pending ACK expired? + if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) + { // if retries left, reset and resend pending message. Do not retry when in POST since the UI might not still be responsive + if ( pendingAckList[ i ].retries > 0 ) + { + if ( getCurrentOperationMode() != DG_MODE_INIT ) + { // If not in post, limit the number of retries + pendingAckList[ i ].retries--; + } + // Resend message + pendingAckList[ i ].timeStamp = getMSTimerCount(); + addToCommBuffer( pendingAckList[ i ].channel, pendingAckList[ i ].msg, pendingAckList[ i ].msgSize ); + } + // if no retries left, alarm + else + { + U16 msgID; - memcpy( &msgID, &pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16 ) ], sizeof( U16 ) ); - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); - pendingAckList[ i ].used = FALSE; // take pending message off of list + memcpy( &msgID, &pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16 ) ], sizeof( U16 ) ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); + pendingAckList[ i ].used = FALSE; // take pending message off of list + } } } } + else + { // Clear pending ACK list + for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) + { + pendingAckList[ i ].used = FALSE; + } + } } /*********************************************************************//** @@ -921,6 +941,10 @@ handleReceiveChemFlushSampleResultsFromHD( message ); break; + case MSG_ID_UI_SET_DG_RO_MODE: + handleSetROOnlyMode( message ); + break; + // NOTE: This case must be last case MSG_ID_DG_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); @@ -1188,13 +1212,15 @@ handleTestUsedBicarbVolumeMLOverrideRequest( message ); break; +#ifndef _RELEASE_ case MSG_ID_DG_GET_SW_CONFIG_RECORD: handleGetDGSoftwareConfigRecord( message ); break; case MSG_ID_DG_SET_SW_CONFIG_RECORD: handleSetDGSoftwareConfigRecord( message ); break; +#endif case MSG_ID_DG_FANS_DUTY_CYCLE_OVERRIDE: handleSetFansDutyCycleOverrideRequest( message ); @@ -1286,6 +1312,34 @@ handleTestDGSetDialysateMixingRatios( message ); break; + case MSG_ID_DG_SET_TEST_CONFIGURATION: + handleTestDGSetTestConfig( message ); + break; + + case MSG_ID_DG_GET_TEST_CONFIGURATION: + handleTestDGGetTestConfig( message ); + break; + + case MSG_ID_DG_RESET_ALL_TEST_CONFIGURATIONS: + handleTestDGResetAllTestConfigs( message ); + break; + + case MSG_ID_DG_DIALIN_CHECK_IN: + handleTestDGDialinCheckIn( message ); + break; + + case MSG_ID_DG_GET_LOAD_CELLS_TARE_VALUES: + handleTestDGGetLoadCellsTareValues( message ); + break; + + case MSG_ID_DG_SET_LOAD_CELLS_TARE_VALUES: + handleTestDGSetLoadCellsTareValues( message ); + break; + + case MSG_ID_DG_SET_COND_SENSOR_CAL_TABLE: + handleTestDGSetConductivitySensorCalTable( message ); + break; + default: // TODO - unrecognized message ID received - ignore break;