Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r51245314484476140164c8dd3dc1a6dc1b7c2384 -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 51245314484476140164c8dd3dc1a6dc1b7c2384) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -97,10 +97,11 @@ #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) -#endif { consumableInstallConfirmed = TRUE; } +#endif + // TODO: Check for DG straw door status to be open once DG door driver implemented if ( TRUE == consumableInstallConfirmed ) { Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -rf96654b60d6a3a09178dc1dfe22c54ae1e067eed -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision f96654b60d6a3a09178dc1dfe22c54ae1e067eed) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -378,10 +378,10 @@ { #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) -#endif { patientDisconnectionConfirmed = TRUE; } +#endif if ( TRUE == patientDisconnectionConfirmed ) { @@ -492,10 +492,22 @@ } // Wait for cartridge and syringe to be removed and for DG to finish any drains/fills. - if ( ( TRUE == isCartridgeRemoved ) && ( FALSE == isSyringeDetected() ) ) + if ( TRUE == isCartridgeRemoved ) { - cmdStopDG(); - requestNewOperationMode( MODE_STAN ); + BOOL isSyringePumpDetected = isSyringeDetected(); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) ) + { + isSyringePumpDetected = FALSE; + } +#endif + + if ( FALSE == isSyringePumpDetected ) + { + cmdStopDG(); + requestNewOperationMode( MODE_STAN ); + } } return HD_POST_TREATMENT_VERIFY_STATE; Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r27a68f930508638f2eb6265ebb381c8918cbc37b -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 27a68f930508638f2eb6265ebb381c8918cbc37b) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -25,6 +25,7 @@ #include "Dialysis.h" #include "ModeTreatment.h" #include "ModeTreatmentParams.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "Reservoirs.h" #include "Rinseback.h" @@ -244,6 +245,9 @@ initTreatmentRecirc(); initTreatmentEnd(); + // Started the treatment set the start time in epoch + setTxLastStartTimeEpoch( getRTCTimestamp() ); + return currentTreatmentState; } Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r27a68f930508638f2eb6265ebb381c8918cbc37b -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 27a68f930508638f2eb6265ebb381c8918cbc37b) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -1145,6 +1145,14 @@ handleDGMixingRatios( message ); break; + case MSG_ID_HD_GET_USAGE_INFO_RECORD: + handleGetHDUsageInfoRecord( message ); + break; + + case MSG_ID_HD_SET_USAGE_INFO_RECORD: + handleSetHDUsageInfoRecord( message ); + break; + // NOTE: this always must be the last case case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r27a68f930508638f2eb6265ebb381c8918cbc37b -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 27a68f930508638f2eb6265ebb381c8918cbc37b) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -3210,7 +3210,7 @@ void handleHDUsageInfoRequest( MESSAGE_T *message ) { MESSAGE_T msg; - U32 payload = getTreatmentTime(); + U32 payload = 0; U08 *payloadPtr = msg.payload; // Create a message record @@ -7017,4 +7017,106 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } +/*********************************************************************//** +* @brief +* The handleGetHDUsageInfoRecord function handles a request to get the HD +* usage information record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetHDUsageInfoRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = sendRecordToDialin( NVDATAMGMT_USAGE_INFO_RECORD ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetHDUsageInfoRecord function handles a request to set the HD +* information record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetHDUsageInfoRecord( MESSAGE_T *message ) +{ + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = receiveRecordFromDialin( NVDATAMGMT_USAGE_INFO_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + +/*********************************************************************//** + * @brief + * The sendDGUsageInfoRecord function sends out the DG usage information record. + * @details Inputs: none + * @details Outputs: DG usage information record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param usageInfoAddress: start address of the susage information record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL handleSendHDUsageInfoRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* usageInfoAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_USAGE_INFO_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, usageInfoAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r27a68f930508638f2eb6265ebb381c8918cbc37b -r0bd1acff7222327c97897b4f9ab91bcc1d9d5816 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 27a68f930508638f2eb6265ebb381c8918cbc37b) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 0bd1acff7222327c97897b4f9ab91bcc1d9d5816) @@ -790,6 +790,15 @@ // MSG_ID_HD_SET_FANS_RPM_ALARM_START_TIME_OFFSET void handleTestFansRPMAlarmStartTimeOffsetRequest( MESSAGE_T *message ); +// MSG_ID_HD_GET_USAGE_INFO_RECORD +void handleGetHDUsageInfoRecord( MESSAGE_T *message ); + +// MSG_ID_HD_SET_USAGE_INFO_RECORD +void handleSetHDUsageInfoRecord( MESSAGE_T *message ); + +// MSG_ID_HD_SEND_USAGE_INFO_RECORD +BOOL handleSendHDUsageInfoRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* usageInfoAddress ); + /**@}*/ #endif