Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -27,7 +27,8 @@ #include "PresOccl.h" #include "FPGA.h" -#include "InternalADC.h" +#include "InternalADC.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PIControllers.h" #include "SystemCommMessages.h" @@ -133,7 +134,9 @@ static MOTOR_DIR_T bloodPumpDirection = MOTOR_DIR_FORWARD; ///< requested blood flow direction static MOTOR_DIR_T bloodPumpDirectionSet = MOTOR_DIR_FORWARD; ///< currently set blood flow direction static PUMP_CONTROL_MODE_T bloodPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested blood pump control mode. -static PUMP_CONTROL_MODE_T bloodPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set blood pump control mode. +static PUMP_CONTROL_MODE_T bloodPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set blood pump control mode. +static F32 bloodFlowCalGain = 1.0; ///< blood flow calibration gain. +static F32 bloodFlowCalOffset = 0.0; ///< blood flow calibration offset. static OVERRIDE_U32_T bloodFlowDataPublishInterval = { BLOOD_FLOW_DATA_PUB_INTERVAL, BLOOD_FLOW_DATA_PUB_INTERVAL, BLOOD_FLOW_DATA_PUB_INTERVAL, 0 }; ///< Interval (in ms) at which to publish blood flow data to CAN bus static OVERRIDE_S32_T targetBloodFlowRate = { 0, 0, 0, 0 }; ///< requested blood flow rate @@ -360,7 +363,7 @@ { U16 bpRPM = getIntADCReading( INT_ADC_BLOOD_PUMP_SPEED ); U16 bpmA = getIntADCReading( INT_ADC_BLOOD_PUMP_MOTOR_CURRENT ); - F32 bpFlow = getFPGABloodFlow(); + F32 bpFlow = ( getFPGABloodFlow() + bloodFlowCalOffset ) * bloodFlowCalGain; adcBloodPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpRPM)) * BP_SPEED_ADC_TO_RPM_FACTOR; adcBloodPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpmA)) * BP_CURRENT_ADC_TO_MA_FACTOR; @@ -652,7 +655,7 @@ * @details * Inputs : bloodFlowDataPublishInterval * Outputs : none - * @return the current blood flow data publication interval (in ms). + * @return the current blood flow data publication interval (in task intervals). *************************************************************************/ U32 getPublishBloodFlowDataInterval( void ) { @@ -838,8 +841,8 @@ /*********************************************************************//** * @brief - * The resetBloodFlowMovingAverage function re-sizes and re-initializes the \n - * blood flow moving average sample buffer. + * The resetBloodFlowMovingAverage function re-initializes the blood flow \n + * moving average sample buffer. * @details * Inputs : none * Outputs : flowReadingsTotal, flowReadingsIdx, flowReadingsCount all set to zero. @@ -855,11 +858,10 @@ /*********************************************************************//** * @brief - * The filterBloodFlowReadings function adds a new flow sample to the filter \n - * if decimation rate for current set point calls for it. + * The filterBloodFlowReadings function adds a new flow sample to the filter. * @details * Inputs : none - * Outputs : flowReadings[], flowReadingsIdx, flowReadingsCount + * Outputs : flowReadings[], flowReadingsIdx, flowReadingsCount, flowReadingsTotal * @param flow : newest blood flow sample * @return none *************************************************************************/ @@ -1172,9 +1174,32 @@ SELF_TEST_STATUS_T execBloodFlowTest( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; + CALIBRATION_DATA_T cal; + + 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; + } + break; + + case BLOOD_FLOW_TEST_STATE_IN_PROGRESS: + break; + + case BLOOD_FLOW_TEST_STATE_COMPLETE: + break; + + default: + // TODO - s/w fault + break; + } - // TODO - implement self test(s) - return result; } @@ -1184,6 +1209,59 @@ *************************************************************************/ +/*********************************************************************//** + * @brief + * The setBloodFlowCalibration function sets the blood flow calibration \n + * factors and has them stored in non-volatile memory. + * @details + * Inputs : none + * 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; + + if ( TRUE == 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 \n + * calibration factors. + * @details + * Inputs : bloodFlowCalGain, bloodFlowCalOffset + * 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 \n Index: firmware/App/Controllers/BloodFlow.h =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Controllers/BloodFlow.h (.../BloodFlow.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -52,8 +52,10 @@ DATA_GET_PROTOTYPE( F32, getMeasuredBloodPumpRotorSpeed ); DATA_GET_PROTOTYPE( F32, getMeasuredBloodPumpSpeed ); DATA_GET_PROTOTYPE( F32, getMeasuredBloodPumpMCSpeed ); -DATA_GET_PROTOTYPE( F32, getMeasuredBloodPumpMCCurrent ); - +DATA_GET_PROTOTYPE( F32, getMeasuredBloodPumpMCCurrent ); + +BOOL setBloodFlowCalibration( F32 gain, F32 offset ); +void getBloodFlowCalibration( F32 *gain, F32 *offset ); BOOL testSetBloodFlowDataPublishIntervalOverride( U32 value ); BOOL testResetBloodFlowDataPublishIntervalOverride( void ); BOOL testSetTargetBloodFlowRateOverride( S32 value ); Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -25,6 +25,7 @@ #include "FPGA.h" #include "InternalADC.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PIControllers.h" #include "SystemCommMessages.h" @@ -127,10 +128,12 @@ static BOOL isDialInPumpOn = FALSE; ///< dialIn pump is currently running static F32 dialInPumpPWMDutyCyclePct = 0.0; ///< initial dialIn pump PWM duty cycle static F32 dialInPumpPWMDutyCyclePctSet = 0.0; ///< currently set dialIn pump PWM duty cycle -static MOTOR_DIR_T dialInPumpDirection = MOTOR_DIR_FORWARD; ///< requested dialIn flow direction -static MOTOR_DIR_T dialInPumpDirectionSet = MOTOR_DIR_FORWARD; ///< currently set dialIn flow direction +static MOTOR_DIR_T dialInPumpDirection = MOTOR_DIR_FORWARD; ///< requested dialysate flow direction +static MOTOR_DIR_T dialInPumpDirectionSet = MOTOR_DIR_FORWARD; ///< currently set dialysate flow direction static PUMP_CONTROL_MODE_T dialInPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested dialIn pump control mode. static PUMP_CONTROL_MODE_T dialInPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP;///< currently set dialIn pump control mode. +static F32 dialInFlowCalGain = 1.0; ///< dialysate flow calibration gain. +static F32 dialInFlowCalOffset = 0.0; ///< dialysate flow calibration offset. static OVERRIDE_U32_T dialInFlowDataPublishInterval = { DIAL_IN_FLOW_DATA_PUB_INTERVAL, DIAL_IN_FLOW_DATA_PUB_INTERVAL, DIAL_IN_FLOW_DATA_PUB_INTERVAL, 0 }; ///< interval (in ms) at which to publish dialIn flow data to CAN bus static OVERRIDE_S32_T targetDialInFlowRate = { 0, 0, 0, 0 }; ///< requested dialIn flow rate @@ -357,7 +360,7 @@ { U16 dipRPM = getIntADCReading( INT_ADC_DIAL_IN_PUMP_SPEED ); U16 dipmA = getIntADCReading( INT_ADC_DIAL_IN_PUMP_MOTOR_CURRENT ); - F32 dipFlow = getFPGADialysateFlow(); + F32 dipFlow = ( getFPGADialysateFlow() + dialInFlowCalOffset ) * dialInFlowCalGain; adcDialInPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(dipRPM)) * DIP_SPEED_ADC_TO_RPM_FACTOR; adcDialInPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(dipmA)) * DIP_CURRENT_ADC_TO_MA_FACTOR; @@ -649,9 +652,19 @@ * @details * Inputs : dialInFlowDataPublishInterval * Outputs : none - * @return the current dialIn flow data publication interval (in ms). + * @return the current dialIn flow data publication interval (in task intervals). *************************************************************************/ -DATA_GET( U32, getPublishDialInFlowDataInterval, dialInFlowDataPublishInterval ) +U32 getPublishDialInFlowDataInterval( void ) +{ + U32 result = dialInFlowDataPublishInterval.data; + + if ( OVERRIDE_KEY == dialInFlowDataPublishInterval.override ) + { + result = dialInFlowDataPublishInterval.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -662,7 +675,17 @@ * Outputs : none * @return the current target dialIn flow rate (in mL/min). *************************************************************************/ -DATA_GET( S32, getTargetDialInFlowRate, targetDialInFlowRate ) +S32 getTargetDialInFlowRate( void ) +{ + S32 result = targetDialInFlowRate.data; + + if ( OVERRIDE_KEY == targetDialInFlowRate.override ) + { + result = targetDialInFlowRate.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -673,7 +696,17 @@ * Outputs : none / * @return the current dialIn flow rate (in mL/min). *************************************************************************/ -DATA_GET( F32, getMeasuredDialInFlowRate, measuredDialInFlowRate ) +F32 getMeasuredDialInFlowRate( void ) +{ + F32 result = measuredDialInFlowRate.data; + + if ( OVERRIDE_KEY == measuredDialInFlowRate.override ) + { + result = measuredDialInFlowRate.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -684,7 +717,17 @@ * Outputs : none * @return the current dialIn flow rate (in mL/min). *************************************************************************/ -DATA_GET( F32, getMeasuredDialInPumpRotorSpeed, dialInPumpRotorSpeedRPM ) +F32 getMeasuredDialInPumpRotorSpeed( void ) +{ + F32 result = dialInPumpRotorSpeedRPM.data; + + if ( OVERRIDE_KEY == dialInPumpRotorSpeedRPM.override ) + { + result = dialInPumpRotorSpeedRPM.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -695,7 +738,17 @@ * Outputs : none * @return the current dialIn flow rate (in mL/min). *************************************************************************/ -DATA_GET( F32, getMeasuredDialInPumpSpeed, dialInPumpSpeedRPM ) +F32 getMeasuredDialInPumpSpeed( void ) +{ + F32 result = dialInPumpSpeedRPM.data; + + if ( OVERRIDE_KEY == dialInPumpSpeedRPM.override ) + { + result = dialInPumpSpeedRPM.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -706,7 +759,17 @@ * Outputs : none * @return the current dialIn pump speed (in RPM). *************************************************************************/ -DATA_GET( F32, getMeasuredDialInPumpMCSpeed, adcDialInPumpMCSpeedRPM ) +F32 getMeasuredDialInPumpMCSpeed( void ) +{ + F32 result = adcDialInPumpMCSpeedRPM.data; + + if ( OVERRIDE_KEY == adcDialInPumpMCSpeedRPM.override ) + { + result = adcDialInPumpMCSpeedRPM.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -717,7 +780,17 @@ * Outputs : none / * @return the current dialIn pump current (in mA). *************************************************************************/ -DATA_GET( F32, getMeasuredDialInPumpMCCurrent, adcDialInPumpMCCurrentmA ) +F32 getMeasuredDialInPumpMCCurrent( void ) +{ + F32 result = adcDialInPumpMCCurrentmA.data; + + if ( OVERRIDE_KEY == adcDialInPumpMCCurrentmA.override ) + { + result = adcDialInPumpMCCurrentmA.ovData; + } + + return result; +} /*********************************************************************//** * @brief @@ -753,6 +826,7 @@ * @details * Inputs : none * Outputs : flowReadingsTotal, flowReadingsIdx, flowReadingsCount all set to zero. + * @return none *************************************************************************/ static void resetDialInFlowMovingAverage( void ) { @@ -764,11 +838,10 @@ /*********************************************************************//** * @brief - * The filterDialInFlowReadings function adds a new flow sample to the filter \n - * if decimation rate for current set point calls for it. + * The filterDialInFlowReadings function adds a new flow sample to the filter. * @details * Inputs : none - * Outputs : flowReadings[], flowReadingsIdx, flowReadingsCount + * Outputs : flowReadings[], flowReadingsIdx, flowReadingsCount, flowReadingsTotal * @return none *************************************************************************/ static void filterDialInFlowReadings( F32 flow ) @@ -1072,9 +1145,32 @@ SELF_TEST_STATUS_T execDialInFlowTest( void ) { SELF_TEST_STATUS_T result = SELF_TEST_STATUS_FAILED; - - // TODO - implement self test(s) - + CALIBRATION_DATA_T cal; + + 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; + } + break; + + case DIAL_IN_FLOW_TEST_STATE_IN_PROGRESS: + break; + + case DIAL_IN_FLOW_TEST_STATE_COMPLETE: + break; + + default: + // TODO - s/w fault + break; + } + return result; } @@ -1084,6 +1180,59 @@ *************************************************************************/ +/*********************************************************************//** + * @brief + * The setDialInFlowCalibration function sets the dialysate flow calibration \n + * factors and has them stored in non-volatile memory. + * @details + * Inputs : none + * 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; + + if ( TRUE == 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 \n + * calibration factors. + * @details + * Inputs : dialInFlowCalGain, dialInFlowCalOffset + * 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 \n Index: firmware/App/Controllers/DialInFlow.h =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -54,6 +54,8 @@ DATA_GET_PROTOTYPE( F32, getMeasuredDialInPumpMCSpeed ); DATA_GET_PROTOTYPE( F32, getMeasuredDialInPumpMCCurrent ); +BOOL setDialInFlowCalibration( F32 gain, F32 offset ); +void getDialInFlowCalibration( F32 *gain, F32 *offset ); BOOL testSetDialInFlowDataPublishIntervalOverride( U32 value ); BOOL testResetDialInFlowDataPublishIntervalOverride( void ); BOOL testSetTargetDialInFlowRateOverride( S32 value ); Index: firmware/App/HDCommon.h =================================================================== diff -u -r72f847f5a701cf0e10e8803ea6bd0ad5fab1f284 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 72f847f5a701cf0e10e8803ea6bd0ad5fab1f284) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -37,7 +37,9 @@ // #define BREADBOARD_TARGET 1 // old breadboard system build - no longer used? // #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 SKIP_POST 1 // skip POST tests - all pass +// #define SKIP_POST 1 // skip POST tests - all pass + #define LIMITED_NVDATA_CRC_CHECKS 1 // only perform POST CRC checks on nv-data records that are implemented so far +// #define DISABLE_ACCELS 1 // disable accelerometer POST and monitoring #define DISABLE_CRC_ERROR 1 // do not error on bad CRC for CAN messages #define DISABLE_ACK_ERRORS 1 // do not error on failure of other node(s) to ACK a message #define DISABLE_MOTOR_CURRENT_CHECKS 1 // do not error on HD pump current checks Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -15,9 +15,12 @@ * ***************************************************************************/ +#include "Accel.h" #include "AlarmLamp.h" +#include "BloodFlow.h" #include "Buttons.h" #include "CPLD.h" +#include "DialInFlow.h" #include "FPGA.h" #include "OperationModes.h" #include "RTC.h" @@ -127,6 +130,25 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_BLOOD_FLOW: + testStatus = execBloodFlowTest(); + postState = handlePOSTStatus( testStatus ); + break; + + case POST_STATE_DIALYSATE_FLOW: + testStatus = execDialInFlowTest(); + postState = handlePOSTStatus( testStatus ); + break; + + case POST_STATE_ACCELEROMETER: +#ifndef DISABLE_ACCELS + testStatus = execAccelTest(); +#else + testStatus = SELF_TEST_STATUS_PASSED; +#endif + postState = handlePOSTStatus( testStatus ); + break; + case POST_STATE_STUCK_BUTTON: testStatus = execStuckButtonTest(); handlePOSTStatus( testStatus ); Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -84,15 +84,15 @@ typedef struct { U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation. - U08 fpgaRev; ///< Reg 1. FPGA revision being reported. - U16 fpgaStatus; ///< Reg 2. FPGA status register. - U08 fpgaDiag; ///< Reg 4. FPGA diagnostic (R/W) register. - U08 adc1Control; ///< Reg 5. ADC1 control register. Bit 0=auto read enable. - U08 flowDAQ1Cmd; ///< Reg 6. Command passed to flow DAQ #1. - U08 flowDAQ2Cmd; ///< Reg 7. Command passed to flow DAQ #2. - U08 accelCmd; ///< Reg 8. Command passed to accelerometer. - U08 fpgaRevMajor; ///< Reg 9. FPGA Major revision #. - U08 fpgaRevLab; ///< Reg 10. FPGA Lab revision #. + U08 fpgaRev; ///< Reg 1. FPGA revision (minor) being reported. + U08 fpgaRevMajor; ///< Reg 2. FPGA revision (major) being reported. + U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported. + U16 fpgaStatus; ///< Reg 4. FPGA status register. + U08 fpgaDiag; ///< Reg 6. FPGA diagnostic (R/W) register. + U08 adc1Control; ///< Reg 7. ADC1 control register. Bit 0=auto read enable. + U08 flowDAQ1Cmd; ///< Reg 8. Command passed to flow DAQ #1. + U08 flowDAQ2Cmd; ///< Reg 9. Command passed to flow DAQ #2. + U08 accelCmd; ///< Reg 10. Command passed to accelerometer. U08 fpgaSensorTest; ///< Reg 11. Blood leak and bubble detector sensor test register. U16 fpgaPIDControl; ///< Reg 12. Valve PID enables. } FPGA_HEADER_T; // read only on FPGA @@ -1254,6 +1254,62 @@ { // 14-bits return fpgaSensorReadings.venousPressure & 0x3FFF; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelAxes function gets the accelerometer axis readings. \n + * Axis readings are in ADC counts. 0.004 g per LSB. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param x : Populate this param with X axis reading + * @param y : Populate this param with Y axis reading + * @param z : Populate this param with Z axis reading + * @return none + *************************************************************************/ +void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ) +{ + *x = (S16)fpgaSensorReadings.accelX; + *y = (S16)fpgaSensorReadings.accelY; + *z = (S16)fpgaSensorReadings.accelZ; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings. \n + * from last FPGA read (every 10ms). \n + * Axis readings are in ADC counts. 0.004 g per LSB. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param x : Populate this param with maximum X axis reading + * @param y : Populate this param with maximum Y axis reading + * @param z : Populate this param with maximum Z axis reading + * @return none + *************************************************************************/ +void getFPGAAccelMaxes( S16 *xmax, S16*ymax, S16*zmax ) +{ + *xmax = (S16)fpgaSensorReadings.accelXMax; + *ymax = (S16)fpgaSensorReadings.accelYMax; + *zmax = (S16)fpgaSensorReadings.accelZMax; +} + +/*********************************************************************//** + * @brief + * The getFPGAAccelStatus function gets the accelerometer reading count \n + * and error register values. + * @details + * Inputs : fpgaSensorReadings + * Outputs : none + * @param cnt : Populate this param with latest sample counter value + * @param err : Populate this param with latest error + * @return none + *************************************************************************/ +void getFPGAAccelStatus( U16 *cnt, U16 *err ) +{ + *cnt = fpgaSensorReadings.accelSampleCounter; + *err = fpgaSensorReadings.accelFaultRegister; } /*********************************************************************//** Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r31c4bf94671f58375d2e1dbbbb37b37c6949e0c4 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 31c4bf94671f58375d2e1dbbbb37b37c6949e0c4) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -62,7 +62,11 @@ U16 getFPGAVenousPressure( void ); U16 getFPGABloodPumpOcclusion( void ); U16 getFPGADialInPumpOcclusion( void ); -U16 getFPGADialOutPumpOcclusion( void ); +U16 getFPGADialOutPumpOcclusion( void ); + +void getFPGAAccelAxes( S16 *x, S16 *y, S16 *z ); +void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); +void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); /**@}*/ Index: firmware/App/Services/MessagePayloads.h =================================================================== diff -u --- firmware/App/Services/MessagePayloads.h (revision 0) +++ firmware/App/Services/MessagePayloads.h (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -0,0 +1,172 @@ +/************************************************************************** +* +* Copyright (c) 2020-2020 Diality Inc. - All Rights Reserved. +* +* THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +* WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +* +* @file MessagePayloads.h +* +* @author (last) Sean Nash +* @date (last) 28-Jul-2020 +* +* @author (original) Sean Nash +* @date (original) 28-Jul-2020 +* +***************************************************************************/ + +#ifndef __MESSAGE_PAYLOADS_H__ +#define __MESSAGE_PAYLOADS_H__ + +// ********** public definitions ********** + +#pragma pack(push,1) + +typedef struct +{ + U08 confirmed; // 1 = confirmed, 0 = rejected/timed out +} OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T; + +typedef struct +{ + U32 alarmState; // 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority + U32 alarmTop; // ID of top active alarm + U32 escalatesIn; // seconds + U32 silenceExpiresIn; // seconds + U16 alarmsFlags; // bit flags: 1 = true, 0 = false for each bit +} ALARM_COMP_STATUS_PAYLOAD_T; + +typedef struct +{ + U08 major; + U08 minor; + U08 micro; + U16 build; + U08 fpgaId; + U08 fpgaMajor; + U08 fpgaMinor; + U08 fpgaLab; +} HD_VERSIONS_T; + +typedef struct +{ + F32 x; + F32 y; + F32 z; + F32 xMax; + F32 yMax; + F32 zMax; + F32 xTilt; + F32 yTilt; + F32 zTilt; +} HD_ACCEL_DATA_PAYLOAD_T; + +typedef struct +{ + F32 gain; + F32 offset; +} LINEAR_F32_CAL_PAYLOAD_T; + +typedef struct +{ + S32 xOffset; + S32 yOffset; + S32 zOffset; +} ACCEL_CAL_PAYLOAD_T; + +typedef struct +{ + U32 setPoint; + F32 measFlow; + F32 measRotorSpd; + F32 measPumpSpd; + F32 measMCSpd; + F32 measMCCurr; + F32 pwmDC; +} PERISTALTIC_PUMP_STATUS_PAYLOAD_T; + +typedef struct +{ + F32 arterialPressure; + F32 venousPressure; + F32 bldPumpOcclusion; + F32 diPumpOcclusion; + F32 doPumpOcclusion; +} PRESSURE_OCCLUSION_DATA_T; + +typedef struct +{ + U32 treatmentTimePrescribedinSec; + U32 treatmentTimeElapsedinSec; + U32 treatmentTimeRemaininginSec; +} TREATMENT_TIME_DATA_T; + +typedef struct +{ + U32 treatmentSubMode; + U32 uFState; + U32 salineBolusState; +} TREATMENT_STATE_DATA_T; + +typedef struct +{ + F32 res1PrimaryLoadCell; + F32 res1BackupLoadCell; + F32 res2PrimaryLoadCell; + F32 res2BackupLoadCell; +} LOAD_CELL_READINGS_PAYLOAD_T; + +typedef struct +{ + U32 setPtPSI; + F32 measFlowRateMlMin; + F32 setPWM; +} DG_RO_PUMP_DATA_PAYLOAD_T; + +typedef struct +{ + U32 setPtRPM; + F32 setPWM; +} DG_DRAIN_PUMP_DATA_PAYLOAD_T; + +typedef struct +{ + F32 roInPSI; + F32 roOutPSI; + F32 drainInPSI; + F32 drainOutPSI; +} DG_PRESSURES_DATA_PAYLOAD_T; + +typedef struct +{ + U32 resID; + U32 setFillToVolumeMl; + U32 setDrainToVolumeMl; +} DG_RESERVOIRS_DATA_PAYLOAD_T; + +typedef struct +{ + F32 volume_mL; + U32 adjustType; +} UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T; + +typedef struct +{ + F32 TPi; + F32 TPo; + F32 TD1; + F32 TD2; + F32 TRo; + F32 TDi; + F32 HtrPrimThermo; + F32 HtrTrimThermo; + F32 HtrPrimColdJunc; + F32 HtrTrimColdJunc; + F32 HtrPrimInternal; + F32 HtrTrimInternal; +} DG_TEMPERATURES_T; + +#pragma pack(pop) + +#endif + Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rcd2ba56ddf9443fc624c21764e6478766b7fd6ed -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision cd2ba56ddf9443fc624c21764e6478766b7fd6ed) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -1366,6 +1366,30 @@ handleTestHDSafetyShutdownOverrideRequest( message ); break; + case MSG_ID_HD_ACCEL_OVERRIDE: + handleTestHDAccelOverrideRequest( message ); + break; + + case MSG_ID_HD_ACCEL_MAX_OVERRIDE: + handleTestHDAccelMaxOverrideRequest( message ); + break; + + case MSG_ID_HD_ACCEL_SEND_INTERVAL_OVERRIDE: + 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; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r31c4bf94671f58375d2e1dbbbb37b37c6949e0c4 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 31c4bf94671f58375d2e1dbbbb37b37c6949e0c4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -16,14 +16,16 @@ ***************************************************************************/ #include // for memcpy() - + +#include "Accel.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" #include "DGInterface.h" #include "DialInFlow.h" #include "Dialysis.h" -#include "FPGA.h" +#include "FPGA.h" +#include "MessagePayloads.h" #include "ModeTreatment.h" #include "PresOccl.h" #include "SafetyShutdown.h" @@ -42,128 +44,6 @@ #define DEBUG_EVENT_MAX_TEXT_LEN 40 #endif -#pragma pack(push,1) - -typedef struct -{ - U08 confirmed; // 1 = confirmed, 0 = rejected/timed out -} OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T; - -typedef struct -{ - U32 alarmState; // 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority - U32 alarmTop; // ID of top active alarm - U32 escalatesIn; // seconds - U32 silenceExpiresIn; // seconds - U16 alarmsFlags; // bit flags: 1 = true, 0 = false for each bit -} ALARM_COMP_STATUS_PAYLOAD_T; - -typedef struct -{ - U08 major; - U08 minor; - U08 micro; - U16 build; - U08 fpgaId; - U08 fpgaMajor; - U08 fpgaMinor; - U08 fpgaLab; -} HD_VERSIONS_T; - -typedef struct -{ - U32 setPoint; - F32 measFlow; - F32 measRotorSpd; - F32 measPumpSpd; - F32 measMCSpd; - F32 measMCCurr; - F32 pwmDC; -} PERISTALTIC_PUMP_STATUS_PAYLOAD_T; - -typedef struct -{ - F32 arterialPressure; - F32 venousPressure; - F32 bldPumpOcclusion; - F32 diPumpOcclusion; - F32 doPumpOcclusion; -} PRESSURE_OCCLUSION_DATA_T; - -typedef struct -{ - U32 treatmentTimePrescribedinSec; - U32 treatmentTimeElapsedinSec; - U32 treatmentTimeRemaininginSec; -} TREATMENT_TIME_DATA_T; - -typedef struct -{ - U32 treatmentSubMode; - U32 uFState; - U32 salineBolusState; -} TREATMENT_STATE_DATA_T; - -typedef struct -{ - F32 res1PrimaryLoadCell; - F32 res1BackupLoadCell; - F32 res2PrimaryLoadCell; - F32 res2BackupLoadCell; -} LOAD_CELL_READINGS_PAYLOAD_T; - -typedef struct -{ - U32 setPtPSI; - F32 measFlowRateMlMin; - F32 setPWM; -} DG_RO_PUMP_DATA_PAYLOAD_T; - -typedef struct -{ - U32 setPtRPM; - F32 setPWM; -} DG_DRAIN_PUMP_DATA_PAYLOAD_T; - -typedef struct -{ - F32 roInPSI; - F32 roOutPSI; - F32 drainInPSI; - F32 drainOutPSI; -} DG_PRESSURES_DATA_PAYLOAD_T; - -typedef struct -{ - U32 resID; - U32 setFillToVolumeMl; - U32 setDrainToVolumeMl; -} DG_RESERVOIRS_DATA_PAYLOAD_T; - -typedef struct -{ - F32 volume_mL; - U32 adjustType; -} UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T; - -typedef struct -{ - F32 TPi; - F32 TPo; - F32 TD1; - F32 TD2; - F32 TRo; - F32 TDi; - F32 HtrPrimThermo; - F32 HtrTrimThermo; - F32 HtrPrimColdJunc; - F32 HtrTrimColdJunc; - F32 HtrPrimInternal; - F32 HtrTrimInternal; -} DG_TEMPERATURES_T; - -#pragma pack(pop) - // ********** private data ********** static BOOL testerLoggedIn = FALSE; @@ -769,7 +649,54 @@ return result; } - + +/************************************************************************* + * @brief + * The broadcastAccelData function constructs an accelerometer data msg to \n + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details + * Inputs : none + * Outputs : accelerometer data broadcast msg constructed and queued. + * @param x : X axis vector magnitude (in g) + * @param y : Y axis vector magnitude (in g) + * @param z : Z axis vector magnitude (in g) + * @param xm : max X axis vector magnitude (in g) + * @param ym : max Y axis vector magnitude (in g) + * @param zm : max Z axis vector magnitude (in g) + * @param xt : X axis tilt (in degrees) + * @param yt : Y axis tilt (in degrees) + * @param zt : Z axis tilt (in degrees) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastAccelData( F32 x, F32 y, F32 z, F32 xm, F32 ym, F32 zm, F32 xt, F32 yt, F32 zt ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + HD_ACCEL_DATA_PAYLOAD_T payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_ACCELEROMETER_DATA; + msg.hdr.payloadLen = sizeof( HD_ACCEL_DATA_PAYLOAD_T ); + payload.x = x; + payload.y = y; + payload.z = z; + payload.xMax = xm; + payload.yMax = ym; + payload.zMax = zm; + payload.xTilt = xt; + payload.yTilt = yt; + payload.zTilt = zt; + + memcpy( payloadPtr, &payload, sizeof( MSG_ID_HD_ACCELEROMETER_DATA ) ); + + // 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; +} + /************************************************************************* * @brief broadcastAlarmStatus * The broadcastAlarmStatus function constructs an alarm status msg to \n @@ -2273,3 +2200,117 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDSafetyShutdownOverrideRequest, testSetSafetyShutdownOverride, testResetSafetyShutdownOverride ) + +/************************************************************************* + * @brief + * The handleTestHDAccelOverrideRequest function handles a request to \n + * override the measured accelerometer sensor readings. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestHDAccelOverrideRequest, testSetAccelAxisOverride, testResetAccelAxisOverride ) + +/************************************************************************* + * @brief + * The handleTestHDAccelMaxOverrideRequest function handles a request to \n + * override the measured accelerometer sensor maximum readings. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestHDAccelMaxOverrideRequest, testSetAccelMaxOverride, testResetAccelMaxOverride ) + +/************************************************************************* + * @brief + * The handleTestHDAccelBroadcastIntervalOverrideRequest function handles a \n + * request to override the broadcast interval for accelerometer data messages. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDAccelBroadcastIntervalOverrideRequest, testSetAccelDataPublishIntervalOverride, testResetAccelDataPublishIntervalOverride ) + +/************************************************************************* + * @brief + * The handleSetAccelCalibration function handles a request to set + * accelerometer calibration factors. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetAccelCalibration( MESSAGE_T *message ) +{ + BOOL result; + + 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 + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetBloodFlowCalibration( MESSAGE_T *message ) +{ + BOOL result; + + 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 + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSetDialysateFlowCalibration( MESSAGE_T *message ) +{ + BOOL result; + + 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 ); +} Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r31c4bf94671f58375d2e1dbbbb37b37c6949e0c4 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 31c4bf94671f58375d2e1dbbbb37b37c6949e0c4) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -119,7 +119,10 @@ BOOL sendDGStartStopTrimmerHeaterCommand( BOOL start ); // MSG_ID_DG_OP_MODE: -void handleDGOpMode( MESSAGE_T *message ); +void handleDGOpMode( MESSAGE_T *message ); + +// MSG_ID_HD_ACCELEROMETER_DATA +BOOL broadcastAccelData( F32 x, F32 y, F32 z, F32 xm, F32 ym, F32 zm, F32 xt, F32 yt, F32 zt ); // MSG_ID_ALARM_STATUS BOOL broadcastAlarmStatus( COMP_ALARM_STATUS_T almStatus ); @@ -289,6 +292,24 @@ // MSG_ID_HD_SAFETY_SHUTDOWN_OVERRIDE: void handleTestHDSafetyShutdownOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ACCEL_OVERRIDE: +void handleTestHDAccelOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ACCEL_MAX_OVERRIDE: +void handleTestHDAccelMaxOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ACCEL_SEND_INTERVAL_OVERRIDE: +void handleTestHDAccelBroadcastIntervalOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_ACCEL_SET_CALIBRATION: +void handleSetAccelCalibration( MESSAGE_T *message ); + +// MSG_ID_HD_BLOOD_FLOW_SET_CALIBRATION: +void handleSetBloodFlowCalibration( MESSAGE_T *message ); + +// MSG_ID_HD_DIALYSATE_FLOW_SET_CALIBRATION: +void handleSetDialysateFlowCalibration( MESSAGE_T *message ); #endif Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r31c4bf94671f58375d2e1dbbbb37b37c6949e0c4 -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 31c4bf94671f58375d2e1dbbbb37b37c6949e0c4) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -14,14 +14,15 @@ * @date (original) 05-Nov-2019 * ***************************************************************************/ - -#include "InternalADC.h" + +#include "Accel.h" #include "BloodFlow.h" #include "Buttons.h" #include "CPLD.h" #include "DialInFlow.h" #include "DialOutFlow.h" #include "FPGA.h" +#include "InternalADC.h" #include "SystemComm.h" #include "WatchdogMgmt.h" #include "TaskPriority.h" @@ -63,7 +64,12 @@ execDialInFlowMonitor(); // monitor dialysate outlet pump and load cells - execDialOutFlowMonitor(); + execDialOutFlowMonitor(); + +#ifndef DISABLE_ACCELS + // monitor accelerometer + execAccel(); +#endif #endif // 2nd pass for FPGA execFPGAOut(); Index: firmware/source/sys_main.c =================================================================== diff -u -rc0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b -r3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9 --- firmware/source/sys_main.c (.../sys_main.c) (revision c0273c73da6b6dee4ad6f1d54cb6c6f27a262b5b) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 3ded5ffcbcade3f1da5d40c52936ab5f97fc6ec9) @@ -62,6 +62,7 @@ #include "rti.h" #include "HDCommon.h" +#include "Accel.h" #include "AlarmLamp.h" #include "BloodFlow.h" #include "Buttons.h" @@ -178,6 +179,7 @@ initBloodFlow(); initDialInFlow(); initDialOutFlow(); + initAccel(); initOperationModes(); initRTC(); initNVDataMgmt();