Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -rffaaf7d1e1eb5715eac3f7c7b424a4648526344d --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision ffaaf7d1e1eb5715eac3f7c7b424a4648526344d) @@ -1258,20 +1258,19 @@ *************************************************************************/ SELF_TEST_STATUS_T execBloodFlowTest( void ) { - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - CALIBRATION_DATA_T cal; + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; + // Get the flow sensors calibration record + HD_FLOW_SENSORS_CAL_RECORD_T cal = getHDFlowSensorsCalibrationRecord(); + switch ( bloodPumpSelfTestState ) { case BLOOD_FLOW_SELF_TEST_STATE_START: - // Retrieve blood flow sensor calibration data - if ( TRUE == getCalibrationData( &cal ) ) - { - bloodFlowCalGain = cal.bloodFlowGain; - bloodFlowCalOffset = cal.bloodFlowOffset_mL_min; - bloodPumpSelfTestState = BLOOD_FLOW_TEST_STATE_COMPLETE; // TODO - implement rest of self-test(s) - result = SELF_TEST_STATUS_PASSED; - } + + bloodFlowCalGain = cal.hdFlowSensors[ CAL_DATA_HD_BLOOD_FLOW_SENSOR ].gain; + bloodFlowCalOffset = cal.hdFlowSensors[ CAL_DATA_HD_BLOOD_FLOW_SENSOR ].offset; + bloodPumpSelfTestState = BLOOD_FLOW_TEST_STATE_COMPLETE; // TODO - implement rest of self-test(s) + result = SELF_TEST_STATUS_PASSED; break; case BLOOD_FLOW_TEST_STATE_IN_PROGRESS: @@ -1292,58 +1291,7 @@ /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ - - -/*********************************************************************//** - * @brief - * The setBloodFlowCalibration function sets the blood flow calibration - * factors and has them stored in non-volatile memory. - * @details Inputs: none - * @details Outputs: bloodFlowCalGain, bloodFlowCalOffset - * @param gain gain calibration factor for blood flow sensor - * @param offset offset calibration factor for blood flow sensor - * @return TRUE if calibration factors successfully set/stored, FALSE if not - *************************************************************************/ -BOOL setBloodFlowCalibration( F32 gain, F32 offset ) -{ - BOOL result = FALSE; - if ( TRUE == isTestingActivated() ) - { - CALIBRATION_DATA_T cal; - - getCalibrationData( &cal ); - // Keep locally and apply immediately - bloodFlowCalGain = gain; - bloodFlowCalOffset = offset; - // Also update calibration record in non-volatile memory - cal.bloodFlowGain = gain; - cal.bloodFlowOffset_mL_min = offset; - if ( TRUE == setCalibrationData( cal ) ) - { - result = TRUE; - } - } - - return result; -} - -/*********************************************************************//** - * @brief - * The getBloodFlowCalibration function retrieves the current blood flow - * calibration factors. - * @details Inputs: bloodFlowCalGain, bloodFlowCalOffset - * @details Outputs: none - * @param gain value to populate with gain calibration factor for blood flow sensor - * @param offset value to populate with offset calibration factor for blood flow sensor - * @return none - *************************************************************************/ -void getBloodFlowCalibration( F32 *gain, F32 *offset ) -{ - *gain = bloodFlowCalGain; - *offset = bloodFlowCalOffset; -} - /*********************************************************************//** * @brief * The testSetBloodFlowDataPublishIntervalOverride function overrides the Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -rffaaf7d1e1eb5715eac3f7c7b424a4648526344d --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision ffaaf7d1e1eb5715eac3f7c7b424a4648526344d) @@ -1220,20 +1220,18 @@ *************************************************************************/ SELF_TEST_STATUS_T execDialInFlowTest( void ) { - SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - CALIBRATION_DATA_T cal; + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; + + // Get the flow sensors calibration record + HD_FLOW_SENSORS_CAL_RECORD_T cal = getHDFlowSensorsCalibrationRecord(); switch ( dialInPumpSelfTestState ) { case DIAL_IN_FLOW_SELF_TEST_STATE_START: - // Retrieve blood flow sensor calibration data - if ( TRUE == getCalibrationData( &cal ) ) - { - dialInFlowCalGain = cal.dialysateFlowGain; - dialInFlowCalOffset = cal.dialysateFlowOffset_mL_min; - dialInPumpSelfTestState = DIAL_IN_FLOW_TEST_STATE_COMPLETE; // TODO - implement rest of self-test(s) - result = SELF_TEST_STATUS_PASSED; - } + dialInFlowCalGain = cal.hdFlowSensors[ CAL_DATA_HD_DIALYZER_FLOW_SENSOR ].gain; + dialInFlowCalOffset = cal.hdFlowSensors[ CAL_DATA_HD_DIALYZER_FLOW_SENSOR ].offset; + dialInPumpSelfTestState = DIAL_IN_FLOW_TEST_STATE_COMPLETE; // TODO - implement rest of self-test(s) + result = SELF_TEST_STATUS_PASSED; break; case DIAL_IN_FLOW_TEST_STATE_IN_PROGRESS: @@ -1255,57 +1253,6 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ - -/*********************************************************************//** - * @brief - * The setDialInFlowCalibration function sets the dialysate flow calibration - * factors and has them stored in non-volatile memory. - * @details Inputs: none - * @details Outputs: dialInFlowCalGain, dialInFlowCalOffset - * @param gain gain calibration factor for dialysate flow sensor - * @param offset offset calibration factor for dialysate flow sensor - * @return TRUE if calibration factors successfully set/stored, FALSE if not - *************************************************************************/ -BOOL setDialInFlowCalibration( F32 gain, F32 offset ) -{ - BOOL result = FALSE; - - if ( TRUE == isTestingActivated() ) - { - CALIBRATION_DATA_T cal; - - getCalibrationData( &cal ); - // Keep locally and apply immediately - dialInFlowCalGain = gain; - dialInFlowCalOffset = offset; - // Also update calibration record in non-volatile memory - cal.dialysateFlowGain = gain; - cal.dialysateFlowOffset_mL_min = offset; - if ( TRUE == setCalibrationData( cal ) ) - { - result = TRUE; - } - } - - return result; -} - -/*********************************************************************//** - * @brief - * The getDialInFlowCalibration function retrieves the current dialysate flow - * calibration factors. - * @details Inputs: dialInFlowCalGain, dialInFlowCalOffset - * @details Outputs: none - * @param gain value to populate with gain calibration factor for dialysate flow sensor - * @param offset value to populate with offset calibration factor for dialysate flow sensor - * @return none - *************************************************************************/ -void getDialInFlowCalibration( F32 *gain, F32 *offset ) -{ - *gain = dialInFlowCalGain; - *offset = dialInFlowCalOffset; -} - /*********************************************************************//** * @brief * The testSetDialInFlowDataPublishIntervalOverride function overrides the Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -rffaaf7d1e1eb5715eac3f7c7b424a4648526344d --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ffaaf7d1e1eb5715eac3f7c7b424a4648526344d) @@ -1397,18 +1397,6 @@ handleTestHDAccelBroadcastIntervalOverrideRequest( message ); break; - case MSG_ID_HD_ACCEL_SET_CALIBRATION: - handleSetAccelCalibration( message ); - break; - - case MSG_ID_HD_BLOOD_FLOW_SET_CALIBRATION: - handleSetBloodFlowCalibration( message ); - break; - - case MSG_ID_HD_DIALYSATE_FLOW_SET_CALIBRATION: - handleSetDialysateFlowCalibration( message ); - break; - case MSG_ID_DIAL_OUT_FLOW_SET_PT_OVERRIDE: handleTestDialOutFlowSetPointOverrideRequest( message ); break; @@ -1475,14 +1463,6 @@ handleTestSuperClearAlarmsRequest( message ); break; - case MSG_ID_HD_REQUEST_CALIBRATION_DATA: - handleTestHDCalibrationDataRequest( message ); - break; - - case MSG_ID_HD_ERASE_CALIBRATION_DATA: - handleTestEraseHDCalibrationDataRequest( message ); - break; - default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rbd5622b94bc751fd9e7ccb7d34afdf69b60240ec -rffaaf7d1e1eb5715eac3f7c7b424a4648526344d --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bd5622b94bc751fd9e7ccb7d34afdf69b60240ec) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ffaaf7d1e1eb5715eac3f7c7b424a4648526344d) @@ -3726,84 +3726,6 @@ /*********************************************************************//** * @brief - * The handleSetAccelCalibration function handles a request to set - * accelerometer calibration factors. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleSetAccelCalibration( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // Verify payload length - if ( message->hdr.payloadLen == sizeof(ACCEL_CAL_PAYLOAD_T) ) - { - ACCEL_CAL_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(ACCEL_CAL_PAYLOAD_T) ); - result = setAccelCalibration( payload.xOffset, payload.yOffset, payload.zOffset ); - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief - * The handleSetBloodFlowCalibration function handles a request to set - * blood flow calibration factors. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleSetBloodFlowCalibration( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // Verify payload length - if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) - { - LINEAR_F32_CAL_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(LINEAR_F32_CAL_PAYLOAD_T) ); - result = setBloodFlowCalibration( payload.gain, payload.offset ); - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief - * The handleSetDialysateFlowCalibration function handles a request to set - * dialysate flow calibration factors. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleSetDialysateFlowCalibration( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // Verify payload length - if ( message->hdr.payloadLen == sizeof(LINEAR_F32_CAL_PAYLOAD_T) ) - { - LINEAR_F32_CAL_PAYLOAD_T payload; - - memcpy( &payload, message->payload, sizeof(LINEAR_F32_CAL_PAYLOAD_T) ); - result = setDialInFlowCalibration( payload.gain, payload.offset ); - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief * The handleTestSetTreatmentParameter function handles a request to set * a specific treatment parameter value. * @details Inputs: none @@ -4172,73 +4094,6 @@ } /*********************************************************************//** - * @brief - * The handleTestHDCalibrationDataRequest function handles a request for - * HD calibration data. - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestHDCalibrationDataRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( 0 == message->hdr.payloadLen ) - { - CALIBRATION_DATA_T cal; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Get calibration data - result = getCalibrationData( &cal ); - if ( TRUE == result ) - { - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_CALIBRATION_DATA; - msg.hdr.payloadLen = sizeof( CALIBRATION_DATA_T ); - - memcpy( payloadPtr, &cal, sizeof( CALIBRATION_DATA_T ) ); - - // 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 ); - } - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief - * The handleTestEraseHDCalibrationDataRequest function handles a request for - * HD calibration data erasure. - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestEraseHDCalibrationDataRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == sizeof(U32) ) - { - U32 key; - - memcpy( &key, message->payload, sizeof(U32) ); - - result = testResetCalibrationData( key ); - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** * @brief * The handleSetHDCalibrationRecord function handles a request to set the HD * calibration data record.