Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rb766ff89da93aeb7f423a61487933477ff3ec82d -r4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision b766ff89da93aeb7f423a61487933477ff3ec82d) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6) @@ -63,8 +63,8 @@ #define CONC_PUMPS_PRIME_AT_MAX_SPEED_TIME_OUT_MS ( 7 * MS_PER_SECOND ) ///< Concentrate pumps prime at maximum speed timeout in milliseconds. #define CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ( 10 * MS_PER_SECOND ) ///< Concentrate pumps prime check conductivity sensors timeout in milliseconds. -#define CONC_PUMPS_PRIME_MAX_ALLOWED_PRIME_TIME_OUT_MS ( 25 * MS_PER_SECOND ) ///< Concentrate pumps prime maximum allowed timeout in prime in milliseconds. - +#define CONC_PUMPS_PRIME_MAX_ALLOWED_PRIME_TIME_OUT_MS ( 50 * MS_PER_SECOND ) ///< Concentrate pumps prime maximum allowed timeout in prime in milliseconds. +#define NINTY_FIVE_PERCENT_FACTOR 0.95F ///< Ninety five percent of expected conductivity #define FLOW_INTEGRATED_VOLUME_CHECK_TOLERANCE 0.1F ///< Flow integrated volume has 10% tolerance compare to load cell reading. #define FIVE_PERCENT_FACTOR 0.05F ///< 5.0 / 100.0 used to calculate conductivity within range of -/+ 5%. @@ -791,15 +791,15 @@ if ( TRUE == didTimeout( concPumpPrimeStartTimeMS, CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ) ) { /* Once the time for priming the concentrate lines has elapsed, check the mixing conductivity of the sensors - * If the acid and bicarb conductivity values are at about 50% of the target concentrate during fill, transition to the next state - * If the acid and bicarb conductivity values are not at 50% but the maximum prime time has elapsed, transition to the next state + * If the acid and bicarb conductivity values are at about 95% of the target concentrate during fill, transition to the next state + * If the acid and bicarb conductivity values are not at 95% but the maximum prime time has elapsed, transition to the next state */ F32 acidConduSPerCM = getConductivityValue( CONDUCTIVITYSENSORS_CD1_SENSOR ); F32 bicarbConduSPerCM = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); F32 acidFillConduSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].acidConduSPerCM; F32 bicarbFillConduSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].bicarbConduSPerCM; - if ( ( acidConduSPerCM >= ( acidFillConduSPerCM * HALF ) ) && ( bicarbConduSPerCM >= ( bicarbFillConduSPerCM * HALF ) ) ) + if ( ( acidConduSPerCM >= ( acidFillConduSPerCM * NINTY_FIVE_PERCENT_FACTOR ) ) && ( bicarbConduSPerCM >= ( bicarbFillConduSPerCM * NINTY_FIVE_PERCENT_FACTOR ) ) ) { result = DG_FILL_MODE_STATE_DELIVER_DIALYSATE; setModeFillStateTransition( result ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r09ac8a11080a42d32c9a217d267fc16c9f397cc2 -r4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 09ac8a11080a42d32c9a217d267fc16c9f397cc2) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6) @@ -7,8 +7,8 @@ * * @file SystemComm.c * -* @author (last) James Walter Taylor -* @date (last) 16-Aug-2023 +* @author (last) Sean Nash +* @date (last) 24-Aug-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -106,6 +106,7 @@ static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. 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 +static OVERRIDE_U32_T pendingACKOverride = { 0, 0, 0, 0 }; ///< Pending ACK override data structure. // ********** private function prototypes ********** @@ -160,7 +161,7 @@ *************************************************************************/ BOOL isHDCommunicating( void ) { - return getU32OverrideValue(&hdCommunicationStatus); + return getU32OverrideValue( &hdCommunicationStatus ); } /*********************************************************************//** @@ -668,6 +669,7 @@ if ( TRUE == didTimeout( timeOfLastHDCheckIn, HD_COMM_TIMEOUT_IN_MS ) ) { hdCommunicationStatus.data = FALSE; + setHDOperationMode( 0, 0 ); // If HD off or not connected, consider HD mode is fault. } } @@ -780,7 +782,7 @@ { 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 ( ( TRUE == pendingAckList[ i ].used ) && ( ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) || ( getU32OverrideValue( &pendingACKOverride ) > 0 ) ) ) { // 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 ) { @@ -1372,6 +1374,14 @@ handleTestDGRAMStatusOverrideRequest( message ); break; + case MSG_ID_DG_RESERVOIR_BROADCAST_INTERVAL_OVERRIDE: + handleTestDGReservoirOverrideRequest( message ); + break; + + case MSG_ID_DG_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE: + handleTestDGPendingACKOverrideRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; @@ -1429,4 +1439,48 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetPendingACKOverride function overrides the + * pendingACKOverride variable. + * @details Inputs: none + * @details Outputs: pendingACKOverride + * @param value override for pendingACKOverride + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetPendingACKOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + pendingACKOverride.ovData = value; + pendingACKOverride.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetPendingACKOverride function resets the override + * of the pendingACKOverride variable. + * @details Inputs: none + * @details Outputs: pendingACKOverride + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetPendingACKOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + pendingACKOverride.override = OVERRIDE_RESET; + pendingACKOverride.ovData = pendingACKOverride.ovInitData; + } + + return result; +} /**@}*/ Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r09ac8a11080a42d32c9a217d267fc16c9f397cc2 -r4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 09ac8a11080a42d32c9a217d267fc16c9f397cc2) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Michael Garthwaite -* @date (last) 15-Aug-2023 +* @author (last) Sean Nash +* @date (last) 24-Aug-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -341,7 +341,7 @@ // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_TRIGGERED; - msg.hdr.payloadLen = sizeof( U32 ) * 5; + msg.hdr.payloadLen = sizeof( U32 ) * 8; memcpy( payloadPtr, &alarm, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); @@ -1572,9 +1572,9 @@ U32 mode = 0; U32 subMode = 0; - memcpy( payloadPtr, &mode, sizeof( U32 ) ); + memcpy( &mode, payloadPtr, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &subMode, sizeof( U32 ) ); + memcpy( &subMode, payloadPtr, sizeof( U32 ) ); setHDOperationMode( mode, subMode ); status = TRUE; @@ -5001,4 +5001,68 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestDGPendingACKOverrideRequest function handles a + * request to override pending ACKs. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGPendingACKOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetPendingACKOverride( payload.state.u32 ); + } + else + { + result = testResetPendingACKOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDGReservoirOverrideRequest function handles a request + * to override the reservoir publish interval + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDGReservoirOverrideRequest( MESSAGE_T * message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetReservoirDataPublishIntervalOverride( payload.state.u32 ); + } + else + { + result = testResetReservoirDataPublishIntervalOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r2b2cf776b2e1dec6d61c3a4150a4b5d838b4f911 -r4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 2b2cf776b2e1dec6d61c3a4150a4b5d838b4f911) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 4b528a5706b6d1c8661b00dcd45c39cf8db9a0f6) @@ -8,7 +8,7 @@ * @file SystemCommMessages.h * * @author (last) Michael Garthwaite -* @date (last) 15-Aug-2023 +* @date (last) 21-Aug-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -526,6 +526,12 @@ // MSG_ID_DG_RAM_STATUS_OVERRIDE void handleTestDGRAMStatusOverrideRequest( MESSAGE_T* message ); +// MSG_ID_DG_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE +void handleTestDGPendingACKOverrideRequest( MESSAGE_T* message ); + +// MSG_ID_DG_RESERVOIR_BROADCAST_INTERVAL_OVERRIDE +void handleTestDGReservoirOverrideRequest( MESSAGE_T* message); + /**@}*/ #endif