Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r8ac6dbd310f7408760e5cad232b1e9834882f739 -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 8ac6dbd310f7408760e5cad232b1e9834882f739) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -227,12 +227,6 @@ static OPN_CLS_STATE_T valveAirTrapStatus; ///< Air trap valve status (open/close) static HD_VALVES_CAL_RECORD_T valvesCalibrationRecord; ///< Valves calibration record. -// TODO remove for testing only -static S32 testPos[ NUM_OF_VALVES ][300]; -static F32 testCurr[ NUM_OF_VALVES ][ 300 ]; -static U32 idx[ NUM_OF_VALVES ] = {0,0,0,0}; -// TODO remove for testing only - // Self test function prototypes static VALVE_SELF_TEST_STATE_T handleValveSelfTestEnableValves( void ); static VALVE_SELF_TEST_STATE_T handleValveSelfTestConfirmEnable( void ); @@ -1163,20 +1157,6 @@ valvesStatus[ VBA ].currentPositionInCounts.data = (S32)getFPGAValveBloodArterialPosition(); valvesStatus[ VBV ].currentPositionInCounts.data = (S32)getFPGAValveBloodVenousPosition(); - testPos[VDI][ idx[VDI] ] = valvesStatus[ VDI ].currentPositionInCounts.data; - testCurr[VDI][ idx[VDI] ] = valvesStatus[ VDI ].current.data; - idx[VDI] = INC_WRAP(idx[VDI], 0, 300); - - testPos[VDO][ idx[VDO] ] = valvesStatus[ VDO ].currentPositionInCounts.data; - idx[VDO] = INC_WRAP(idx[VDO], 0, 300); - - testPos[VBA][ idx[VBA] ] = valvesStatus[ VBA ].currentPositionInCounts.data; - idx[VBA] = INC_WRAP(idx[VBA], 0, 300); - - testPos[VBV][ idx[VBV] ] = valvesStatus[ VBV ].currentPositionInCounts.data; - testCurr[VBV][ idx[VBV] ] = valvesStatus[ VBV ].current.data; - idx[VBV] = INC_WRAP(idx[VBV], 0, 300); - // Check the position of each valve for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { @@ -1203,7 +1183,8 @@ valvesStatus[ valve ].positionOutOfRangeCounter++; } - if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) + if ( ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) && + ( TRUE == isAlarmActive( ALARM_ID_HD_AC_POWER_LOST ) ) ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); } Index: firmware/App/Controllers/Voltages.c =================================================================== diff -u -r8ac6dbd310f7408760e5cad232b1e9834882f739 -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/Controllers/Voltages.c (.../Voltages.c) (revision 8ac6dbd310f7408760e5cad232b1e9834882f739) +++ firmware/App/Controllers/Voltages.c (.../Voltages.c) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -33,8 +33,8 @@ #define VOLTAGES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the voltages data is published on the CAN bus. #define VOLTAGES_ALARM_PERSISTENCE_MS ( 1 * MS_PER_SECOND ) ///< Alarm persistence period for voltage monitor alarms in milliseconds. -#define POWER_LOSS_VOLTAGE_PERSISTENCE_MS ( 0.15 * MS_PER_SECOND ) ///< Power supply voltage out of range persistence in milliseconds. -#define POWER_LOSS_VOLTAGE_THRESHOLD_V 1.0F ///< Power loss voltage threshold +#define POWER_LOSS_VOLTAGE_PERSISTENCE_MS 150 ///< Power supply voltage out of range persistence in milliseconds. +#define POWER_LOSS_VOLTAGE_THRESHOLD_V 5.0F ///< Power loss voltage threshold #define DATA_PUBLISH_COUNTER_START_COUNT 14 ///< Data publish counter start count. /// Defined states for the voltage monitor state machine. @@ -85,8 +85,6 @@ static OVERRIDE_U32_T voltagesDataPublishInterval = { VOLTAGES_DATA_PUB_INTERVAL, VOLTAGES_DATA_PUB_INTERVAL, 0, 0 }; static OVERRIDE_F32_T voltages[ NUM_OF_MONITORED_LINES ]; ///< Monitored voltages and currents. -static U32 voltageAlarmPersistenceCtr[ NUM_OF_MONITORED_LINES ]; ///< Alarm persistence counters for voltage check failures. - // ********** private function prototypes ********** static VOLTAGES_STATE_T handleVoltagesInitState( void ); @@ -104,17 +102,15 @@ void initVoltagesMonitor( void ) { U32 i; - - voltagesState = VOLTAGES_INIT_STATE; + voltagesState = VOLTAGES_INIT_STATE; voltagesDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; for ( i = 0; i < (U32)NUM_OF_MONITORED_LINES; i++ ) { - voltages[i].data = 0.0; - voltages[i].ovData = 0.0; + voltages[i].data = 0.0; + voltages[i].ovData = 0.0; voltages[i].ovInitData = 0.0; - voltages[i].override = OVERRIDE_RESET; - voltageAlarmPersistenceCtr[i] = 0; + voltages[i].override = OVERRIDE_RESET; } initPersistentAlarm( ALARM_ID_HD_VOLTAGE_OUT_OF_RANGE, VOLTAGES_ALARM_PERSISTENCE_MS, VOLTAGES_ALARM_PERSISTENCE_MS ); @@ -224,42 +220,6 @@ SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_VOLTAGE_OUT_OF_RANGE, i, isVoltageOutOfRange ); } } - - /*if ( volts > MAX_VOLTAGES[ i ] ) - { - if ( ++voltageAlarmPersistenceCtr[ i ] >= VOLTAGES_ALARM_PERSISTENCE_MS ) - { -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_VOLTAGES_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_VOLTAGE_OUT_OF_RANGE, (F32)i, volts ) - } - } - } - else if ( volts < MIN_VOLTAGES[ i ] ) - { - BOOL isAlarmValid = TRUE; - - if ( ( ( MONITORED_LINE_24V == i ) || ( MONITORED_LINE_24V_REGEN == i ) ) && ( TRUE == isAlarmActive( ALARM_ID_HD_AC_POWER_LOST ) ) ) - { - isAlarmValid = FALSE; - } - - if ( ++voltageAlarmPersistenceCtr[ i ] >= VOLTAGES_ALARM_PERSISTENCE_MS ) - { -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_VOLTAGES_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_VOLTAGE_OUT_OF_RANGE, (F32)i, volts ) - } - } - } - else - { - voltageAlarmPersistenceCtr[ i ] = 0; - }*/ } if ( ( getMonitoredLineLevel( MONITORED_LINE_24V ) < POWER_LOSS_VOLTAGE_THRESHOLD_V ) || @@ -270,7 +230,7 @@ if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_AC_POWER_LOST, hasPowerBeenLost ) ) { - activateAlarmNoData( ALARM_ID_HD_AC_POWER_LOST ); + //activateAlarmNoData( ALARM_ID_HD_AC_POWER_LOST ); } } @@ -317,19 +277,18 @@ // Publish voltages monitor data on interval if ( ++voltagesDataPublicationTimerCounter >= getU32OverrideValue( &voltagesDataPublishInterval ) ) { - VOLTAGES_DATA_PAYLOAD_T data; - - data.adc1_2VProc = getMonitoredLineLevel( MONITORED_LINE_1_2V ); - data.adc3_3V = getMonitoredLineLevel( MONITORED_LINE_3_3V ); - data.adc5VLogic = getMonitoredLineLevel( MONITORED_LINE_5V_LOGIC ); - data.adc5VSensors = getMonitoredLineLevel( MONITORED_LINE_5V_SENSORS ); - data.adc24V = getMonitoredLineLevel( MONITORED_LINE_24V ); - data.adc24VRegen = getMonitoredLineLevel( MONITORED_LINE_24V_REGEN ); + VOLTAGES_DATA_PAYLOAD_T data; + data.adc1_2VProc = getMonitoredLineLevel( MONITORED_LINE_1_2V ); + data.adc3_3V = getMonitoredLineLevel( MONITORED_LINE_3_3V ); + data.adc5VLogic = getMonitoredLineLevel( MONITORED_LINE_5V_LOGIC ); + data.adc5VSensors = getMonitoredLineLevel( MONITORED_LINE_5V_SENSORS ); + data.adc24V = getMonitoredLineLevel( MONITORED_LINE_24V ); + data.adc24VRegen = getMonitoredLineLevel( MONITORED_LINE_24V_REGEN ); data.adcFpgaAdcRef = getMonitoredLineLevel( MONITORED_LINE_FPGA_REF_V ); - data.adcPbaRef = getMonitoredLineLevel( MONITORED_LINE_PBA_REF_V ); - data.fpgaVcc = getMonitoredLineLevel( MONITORED_LINE_FPGA_VCC_V ); - data.fpgaVaux = getMonitoredLineLevel( MONITORED_LINE_FPGA_AUX_V ); - data.fpgaVpvn = getMonitoredLineLevel( MONITORED_LINE_FPGA_PVN_V ); + data.adcPbaRef = getMonitoredLineLevel( MONITORED_LINE_PBA_REF_V ); + data.fpgaVcc = getMonitoredLineLevel( MONITORED_LINE_FPGA_VCC_V ); + data.fpgaVaux = getMonitoredLineLevel( MONITORED_LINE_FPGA_AUX_V ); + data.fpgaVpvn = getMonitoredLineLevel( MONITORED_LINE_FPGA_PVN_V ); broadcastData( MSG_ID_HD_VOLTAGES_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( VOLTAGES_DATA_PAYLOAD_T ) ); voltagesDataPublicationTimerCounter = 0; Index: firmware/App/Drivers/InternalADC.c =================================================================== diff -u -r61716bc97ecca8af1ec560333844a8cf602eccb0 -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 61716bc97ecca8af1ec560333844a8cf602eccb0) +++ firmware/App/Drivers/InternalADC.c (.../InternalADC.c) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -28,7 +28,7 @@ // ********** private definitions ********** #define MAX_ADC_CHANNELS 24 ///< ADC supports up to 24 channels. -#define SIZE_OF_ROLLING_AVG 16 ///< Samples in rolling average calculations. +#define SIZE_OF_ROLLING_AVG 8 ///< Samples in rolling average calculations. #define ROLLING_AVG_SHIFT_DIVIDER 4 ///< Rolling average shift divider. /// Mapping from enumerated used ADC channel to processor channel ID. Index: firmware/App/HDCommon.h =================================================================== diff -u -r8ac6dbd310f7408760e5cad232b1e9834882f739 -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 8ac6dbd310f7408760e5cad232b1e9834882f739) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -38,7 +38,7 @@ // #define RUN_WITHOUT_DG 1 // Run HD w/o DG // #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 // TODO soft switch + #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 Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r43e59e505bbea87c76822c51a3273eec3f4addaa -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 43e59e505bbea87c76822c51a3273eec3f4addaa) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -336,9 +336,9 @@ void stopDialysis( void ) { // Stop pumps - setBloodPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); - setDialInPumpTargetFlowRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); - setDialOutPumpTargetRate( 0, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + signalDialInPumpHardStop(); + signalDialOutPumpHardStop(); + signalBloodPumpHardStop(); stopSyringePump(); // Tell DG to stop heating dialysate cmdStopDGTrimmerHeater(); Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -r9bf209fc5813b7e806f51f408ece77174a336c9b -r254faac62b851c393c5df753eade2dc880b83247 --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 9bf209fc5813b7e806f51f408ece77174a336c9b) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 254faac62b851c393c5df753eade2dc880b83247) @@ -367,7 +367,7 @@ handleTreatmentStopBloodSittingTimer(); - result = handleTreatmentStopAlarmsAndSignals(result); + result = handleTreatmentStopAlarmsAndSignals( result ); return result; }