Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r1efa1af5337b36f5022df5ce8cb7459352f13a8b -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 1efa1af5337b36f5022df5ce8cb7459352f13a8b) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -7,8 +7,8 @@ * * @file DialOutFlow.c * -* @author (last) Dara Navaei -* @date (last) 15-Jun-2022 +* @author (last) Bill Bracken +* @date (last) 29-Jun-2022 * * @author (original) Sean * @date (original) 24-Jan-2020 Index: firmware/App/HDCommon.h =================================================================== diff -u -r8bea78ee7a3cd7fba5b9d2b691624fc357c049ee -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 8bea78ee7a3cd7fba5b9d2b691624fc357c049ee) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -36,15 +36,14 @@ // #define USING_DEBUGGER 1 // Want to be able to use the debugger and have break points // #define BOARD_WITH_NO_HARDWARE 1 // Target is a PCB w/ no hardware // #define RUN_WITHOUT_DG 1 // Run HD w/o DG -// #define SIMULATE_UI 1 // Build w/o requirement that UI be there + #define SIMULATE_UI 1 // Build w/o requirement that UI be there // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing - #define DISABLE_BATT_COMM 1 // Disable battery communication + #define DISABLE_BATT_COMM 1 // Disable battery communication // TODO soft switch // #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time // #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters // #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button #define DISABLE_WD_AND_SFTY_POST_TESTS 1 // Disable watchdog and safety shutdown POST tests - #define DISABLE_UI_POST_TEST 1 // Disable the UI POST -// #define PBA_ESTIMATION 1 // Estimate arterial pressure rather than look at PBA sensor // Part of DVT build switch +// #define DISABLE_UI_POST_TEST 1 // Disable the UI POST // TODO stays as a build switch until the calibration structure is updated with the build #define SKIP_CAL_CHECK 1 // Implement software configuration Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -7,8 +7,8 @@ * * @file Dialysis.c * -* @author (last) Dara Navaei -* @date (last) 15-Jul-2022 +* @author (last) Darren Cox +* @date (last) 16-Aug-2022 * * @author (original) Sean * @date (original) 15-Jan-2020 @@ -52,6 +52,14 @@ #define MAX_ACTIVE_LOAD_CELL_CHANGE_G 50.0F ///< Maximum delta between new and previous measured UF volume. +/// Defined states for the Load Cell cycles. +typedef enum Reservoir_Steady_Cycle +{ + RESERVOIR_STEADY_CYCLE_START = 0, ///< Reservoir steady cycle load cell reading at Start + RESERVOIR_STEADY_CYCLE_FINAL, ///< Reservoir steady cycle load cell reading at Final + NUM_OF_RESERVOIR_STEADY_CYCLES ///< Number of Reservoir steady cycle load cell readings +} RESERVOIR_STEADY_CYCLE_T; + // ********** private data ********** static DIALYSIS_STATE_T currentDialysisState; ///< Current state of the dialysis sub-mode state machine. @@ -65,7 +73,7 @@ static F32 resCurrVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir current volume. static F32 resLastVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir previous volume. static F32 measUFVolumeFromPriorReservoirs; ///< Current total ultrafiltration volume from previous reservoirs in current treatment. -static F32 lcLastSteadyWeight[NUM_OF_LOAD_CELLS]; ///< Load Cell Last Steady Weight for drift test +static F32 lcLastSteadyWeight[NUM_OF_RESERVOIR_STEADY_CYCLES][NUM_OF_LOAD_CELLS]; ///< Load Cell Last Steady Weight for drift test Start/Final cycle static U32 uFTimeMS; ///< Current elapsed ultrafiltration time (in ms). Used for calculating UF reference volume. static U32 lastUFTimeStamp; ///< HD timer value when we last took stock of ultrafiltration time (so we can determine how much time has elapsed since). @@ -107,7 +115,7 @@ static void updateUFVolumes( void ); static void publishSalineBolusData( void ); -static void checkLoadCellsStablePrimaryBackupDriftOutOfRange( DG_RESERVOIR_ID_T reservoirID ); +static void checkLoadCellsStablePrimaryBackupDriftOutOfRange( DG_RESERVOIR_ID_T reservoirID, RESERVOIR_STEADY_CYCLE_T cycle ); /*********************************************************************//** * @brief @@ -148,7 +156,8 @@ for (i=0; i ( LOAD_CELL_ILLEGAL_WEIGHT_VALUE + 1 ) ) + if ( ( RESERVOIR_STEADY_CYCLE_FINAL == cycle ) && ( lcLastSteadyWeight[ RESERVOIR_STEADY_CYCLE_START ][ lcPrimaryIndex ] > ( LOAD_CELL_ILLEGAL_WEIGHT_VALUE + 1 ) ) ) { - // Weight has been previously saved, ok to test - loadCellPreviousDrift = lcLastSteadyWeight[lcPrimaryIndex] - lcLastSteadyWeight[lcBackupIndex]; + // Start Weight has been previously saved, ok to test + loadCellPreviousDrift = lcLastSteadyWeight[ RESERVOIR_STEADY_CYCLE_START ][ lcPrimaryIndex ] - lcLastSteadyWeight[ RESERVOIR_STEADY_CYCLE_START ][ lcBackupIndex ]; driftDiff = fabs ( loadCellCurrentDrift - loadCellPreviousDrift ); } // Save latest reading for next test time - lcLastSteadyWeight[ lcPrimaryIndex ] = loadCellPrimaryWeight; - lcLastSteadyWeight[ lcBackupIndex ] = loadCellBackupWeight; + lcLastSteadyWeight[ cycle ][ lcPrimaryIndex ] = loadCellPrimaryWeight; + lcLastSteadyWeight[ cycle ][ lcBackupIndex ] = loadCellBackupWeight; #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) Index: firmware/App/Modes/Prime.c =================================================================== diff -u -r85230672d9a3966a153503d8989bde191e8ee848 -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision 85230672d9a3966a153503d8989bde191e8ee848) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -7,8 +7,8 @@ * * @file Prime.c * -* @author (last) Sean Nash -* @date (last) 13-Jul-2022 +* @author (last) Bill Bracken +* @date (last) 24-Aug-2022 * * @author (original) Quang Nguyen * @date (original) 08-Dec-2020 Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -r8b3e76567196376979b8173147b2dea2506c5f31 -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 8b3e76567196376979b8173147b2dea2506c5f31) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -7,8 +7,8 @@ * * @file SelfTests.c * -* @author (last) Sean Nash -* @date (last) 13-Jul-2022 +* @author (last) Bill Bracken +* @date (last) 22-Aug-2022 * * @author (original) Quang Nguyen * @date (original) 28-Jan-2021 Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra6f52e9ca899d4983b18cbde673139aba216e8d5 -r173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a6f52e9ca899d4983b18cbde673139aba216e8d5) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 173e4fbf9bd750bccb2e758eb1c7ef36ed8db5a0) @@ -1569,10 +1569,9 @@ * @details Inputs: none * @details Outputs: DG start/stop trimmer heater command msg constructed and queued. * @param start TRUE indicates start heater, FALSE indicates stop heater - * @param trimmerHtrTemp target temperature for trimmer heater * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start, F32 trimmerHtrTemp ) +BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start ) { BOOL result; MESSAGE_T msg; @@ -1581,11 +1580,9 @@ // Create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( F32 ); + msg.hdr.payloadLen = sizeof( BOOL ); memcpy( payloadPtr, &start, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &trimmerHtrTemp, sizeof( F32 ) ); // 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_HD_2_DG, ACK_REQUIRED ); @@ -2003,35 +2000,6 @@ } -#ifdef EMC_TEST_BUILD -/*********************************************************************//** - * @brief - * The broadcastCANErrorCount function handles the CAN error count - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -BOOL broadcastCANErrorCount( U32 count ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_CAN_ERROR_COUNT; - msg.hdr.payloadLen = sizeof( U32 ); - - memcpy( payloadPtr, &count, sizeof( U32 ) ); - - // 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_HD_BROADCAST, ACK_NOT_REQUIRED ); - - return result; -} -#endif - // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -2270,7 +2238,6 @@ { BOOL result; MESSAGE_T msg; - U08 *payloadPtr = msg.payload; // Create a message record blankMessage( &msg ); @@ -3624,38 +3591,6 @@ /*********************************************************************//** * @brief - * The handleHDSetArterialPressureOffsetRequest function handles a request to - * set the arterial pressure offset. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleHDSetArterialPressureOffsetRequest( 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 = testSetArterialPressureOffsetOverride( payload.state.f32 ); - } - else - { - result = testResetArterialPressureOffsetOverride(); - } - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestBloodPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump rotor speed (RPM). * @details Inputs: none @@ -7120,6 +7055,30 @@ } /*********************************************************************//** + * @brief + * The sendRequestForDGResendAlarms function sends out the HD request for + * DG re-send all active alarms. + * @details Inputs: none + * @details Outputs: DG alarms re-send request msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendRequestForDGResendAlarms( void ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_ALARMS; + msg.hdr.payloadLen = 0; + + // 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_HD_2_DG, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** * @brief * The handleGetHDUsageInfoRecord function handles a request to get the HD * usage information record. @@ -7275,15 +7234,15 @@ /*********************************************************************//** * @brief - * The handleSendBloodLeakEmbeddedModeCommandResponse function sends out + * The sendBloodLeakEmbeddedModeCommandResponse function sends out * the blood leak embedded mode command response. * @details Inputs: none * @details Outputs: blood leak embedded mode command response msg constructed and queued * @param responseLen: the length of the buffer * @param response: pointer to the response buffer * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL handleSendBloodLeakEmbeddedModeCommandResponse( U32 responseLen, U08* response ) +BOOL sendBloodLeakEmbeddedModeCommandResponse( U32 responseLen, U08* response ) { BOOL result; MESSAGE_T msg; @@ -7304,4 +7263,28 @@ return result; } +/*********************************************************************//** +* @brief +* The handleResendAllAlarmsCommand function handles a request to re-send +* all active HD alarms. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleResendAllAlarmsCommand( MESSAGE_T* message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + handleResendActiveAlarmsRequest(); + result = TRUE; + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/