Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -176,6 +176,7 @@ { if( heater < NUM_OF_DG_HEATERS ) { +#ifndef DISABLE_HEATERS_AND_TEMPS // Assume the target temperature has not changed heatersStatus[ heater ].hasTargetTempChanged = FALSE; @@ -186,6 +187,7 @@ heatersStatus[ heater ].hasTargetTempChanged = TRUE; // TODO alarm if temperature if out of range or just reject? } +#endif } else { @@ -217,13 +219,16 @@ { BOOL status = FALSE; + if( heater < NUM_OF_DG_HEATERS ) { +#ifndef DISABLE_HEATERS_AND_TEMPS if ( TRUE == heatersStatus[ heater ].hasTargetTempChanged ) { status = TRUE; heatersStatus[ heater ].startHeaterSignal = TRUE; } +#endif } else { @@ -330,7 +335,7 @@ heatersStatus[ DG_TRIMMER_HEATER ].targetTemp = heaterCmdPtr->targetTemp; // TODo do we need to remove this since the trimmer heater is set in the reservoirs #ifndef DISABLE_HEATERS_AND_TEMPS - //heatersStatus[ DG_TRIMMER_HEATER ].startHeaterSignal = TRUE; // DEBUG_DENALI + heatersStatus[ DG_TRIMMER_HEATER ].startHeaterSignal = TRUE; #endif } else @@ -897,12 +902,12 @@ if ( trimmerHeaterInternalTemp > HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C ) { isTempOut = TRUE; - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, trimmerHeaterInternalTemp ); + //SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_INTERNAL_TEMP_OUT_OF_RANGE, trimmerHeaterInternalTemp ); } else if ( trimmerHeaterColdJunctionTemp > HEATERS_MAX_ALLOWED_COLD_JUNCTION_TEMPERATURE_C ) { isTempOut = TRUE; - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_CJ_TEMP_OUT_OF_RANGE, trimmerHeaterColdJunctionTemp ); + //SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_TRIMMER_HEATER_CJ_TEMP_OUT_OF_RANGE, trimmerHeaterColdJunctionTemp ); } // If it is above the range for the first time, stop the trimmer heater Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -358,18 +358,18 @@ flow = flow - ( getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP1_ACID ) / 1000.0 ) - ( getMeasuredPumpSpeed( CONCENTRATEPUMPS_CP2_BICARB ) / 1000.0 ); + // Apply calibration to flow sensor reading measuredROFlowRateLPM.data = pow(flow, 4) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].fourthOrderCoeff + pow(flow, 3) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].thirdOrderCoeff + pow(flow, 2) * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].secondOrderCoeff + - flow * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].gain + + flow * flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].gain + flowSensorsCalRecord.flowSensors[ CAL_DATA_RO_PUMP_FLOW_SENSOR ].offset; - // If the flow is less than a certain value, FPGA will return 0xFFFF meaning that - // the flow is 0. - if ( FLOW_SENSOR_ZERO_READING == roFlowReading ) - { - measuredROFlowRateLPM.data = 0.0; - } + // If the flow is less than a certain value, FPGA will return 0xFFFF meaning that the flow is 0. + if ( FLOW_SENSOR_ZERO_READING == roFlowReading ) + { + measuredROFlowRateLPM.data = 0.0; + } measuredFlowReadingsSum = 0; flowFilterCounter = 0; Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -164,7 +164,7 @@ static BOOL isADCReadValid( U32 sensorIndex, U32 fpgaError, U32 fpgaCount ); static void processADCRead( U32 sensorIndex, S32 adc ); static void publishTemperatureSensorsData( void ); -static void monitorTemperatureSnsrs( U32 sensorIndex ); +static void monitorTemperatureSnsrs( U32 sensorIndex, F32 temperature ); /*********************************************************************//** * @brief @@ -373,7 +373,7 @@ if ( sensorIndex < NUM_OF_TEMPERATURE_SENSORS ) { - if ( OVERRIDE_KEY == tempSensors[ sensorIndex ].temperatureValues.override ) + if ( tempSensors[ sensorIndex ].temperatureValues.override == OVERRIDE_KEY ) { temperature = tempSensors[ sensorIndex ].temperatureValues.ovData; } @@ -713,7 +713,7 @@ tempSensors[ sensorIndex ].temperatureValues.data = temperature; // Monitor the temperature value - monitorTemperatureSnsrs( sensorIndex ); + monitorTemperatureSnsrs( sensorIndex, temperature ); } /*********************************************************************//** @@ -880,14 +880,17 @@ * @details Inputs: tempSensors * @details Outputs: tempSensors * @param sensorIndex the index of the temperature sensor + * @param temperature the temperature value to be checked * @return none *************************************************************************/ -static void monitorTemperatureSnsrs( U32 sensorIndex ) +static void monitorTemperatureSnsrs( U32 sensorIndex, F32 temperature ) { - F32 temperature = getTemperatureValue( sensorIndex ); + // The maximum allowed temperature is different for the sensors that are in the fluid path + // with the ones that are not in the fluid path + F32 maxLimit = tempSensors[ sensorIndex ].maxAllowedTemperature; // Check both temperature and to be in range - if ( ( temperature < TEMP_SENSORS_MIN_ALLOWED_DEGREE_C ) || ( temperature > tempSensors[ sensorIndex ].maxAllowedTemperature ) ) + if ( ( temperature < TEMP_SENSORS_MIN_ALLOWED_DEGREE_C ) || ( temperature > maxLimit ) ) { // TODO investigate //checkPersistentAlarm( ALARM_ID_DG_TEMPERATURE_SENSOR_OUT_OF_RANGE, TRUE, sensorIndex, temperature ); @@ -916,7 +919,7 @@ if ( sensorIndex < NUM_OF_TEMPERATURE_SENSORS ) { - if ( TRUE == isTestingActivated() ) + if ( isTestingActivated() ) { result = TRUE; tempSensors[ sensorIndex ].temperatureValues.ovData = temperature; @@ -942,7 +945,7 @@ if ( sensorIndex < NUM_OF_TEMPERATURE_SENSORS ) { - if ( TRUE == isTestingActivated() ) + if ( isTestingActivated() ) { result = TRUE; tempSensors[ sensorIndex ].temperatureValues.override = OVERRIDE_RESET; @@ -966,7 +969,7 @@ { BOOL result = FALSE; - if ( TRUE == isTestingActivated() ) + if ( isTestingActivated() ) { U32 interval = value / TASK_PRIORITY_INTERVAL; @@ -990,7 +993,7 @@ { BOOL result = FALSE; - if ( TRUE == isTestingActivated() ) + if ( isTestingActivated() ) { result = TRUE; tempSensorsPublishInterval.override = OVERRIDE_RESET; Index: firmware/App/DGCommon.h =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/DGCommon.h (.../DGCommon.h) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/DGCommon.h (.../DGCommon.h) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -25,7 +25,7 @@ #define DG_VERSION_MAJOR 0 #define DG_VERSION_MINOR 6 #define DG_VERSION_MICRO 0 -#define DG_VERSION_BUILD 17 +#define DG_VERSION_BUILD 88 // ********** build switches ********** @@ -34,7 +34,7 @@ // TODO: Removed debug build flags when release build is ready // #define BOARD_WITH_NO_HARDWARE 1 // #define TASK_TIMING_OUTPUT_ENABLED 1 // re-purposes drain pump enable pin for task timing -// #define DISABLE_HEATERS_AND_TEMPS 1 +// #define DISABLE_HEATERS_AND_TEMPS 1 // #define DISABLE_ACCELS 1 // #define SKIP_POST 1 #define SKIP_CAL_CHECK 1 @@ -53,12 +53,13 @@ #define THD_USING_TRO_CONNECTOR 1 #define DISABLE_FLOW_CHECK_IN_FILL 1 #define IGNORE_CONC_PUMP_IN_HEAT_DISINFECT 1 -// #define NEW_FMD_FLOW_SENSOR 1 // Turn these flags on to disable dialysate mixing #define DISABLE_DIALYSATE_CHECK 1 // Disabled for Tom // #define DISABLE_MIXING 1 //#define DISABLE_FLOW_CONTROL_TREATMENT 1 + //#define DISABLE_TRIMMER_HEATER 1 + #define DIALYSATE_FLOW_METER_ENABLED 1 #define DISABLE_ACK_ALARM 1 #include Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -47,7 +47,6 @@ #define DIALYSATE_FILL_TIME_OUT ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Time out period when reservoir is not filled with correct dialysate. #define EMPTY_BOTTLE_DETECT_PERSISTENT_PERIOD_MS ( 5 * MS_PER_SECOND ) ///< Persistent period for empty bottle detect. - #define CONCENTRATE_PUMP_PRIME_INTERVAL ( 3 * MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Persistent time interval for concentrate pumps prime. #define ACID_BICARB_CONCENTRATE_ADDITION_MULTIPLER 1.06 ///< Acid and bicarbonate concentrates make up around 6% to total volume. Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) @@ -49,13 +49,13 @@ #define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. // Flush drain path state defines -#define FLUSH_DRAIN_WAIT_TIME_MS ( 2 * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. TODo it was 2 minutes +#define FLUSH_DRAIN_WAIT_TIME_MS ( 2 * 60 * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. // Flush dialysate state defines -#define FLUSH_DIALYSATE_WAIT_TIME_MS ( 0.5 * 60 * MS_PER_SECOND ) ///< Flush dialysate wait time in milliseconds. +#define FLUSH_DIALYSATE_WAIT_TIME_MS ( 1 * 60 * MS_PER_SECOND ) ///< Flush dialysate wait time in milliseconds. // Flush concentrate straws state defines -#define FLUSH_CONCENTRATE_STRAWS_TIME_MS ( 0.5 * 60 * MS_PER_SECOND ) ///< Flush concentrate straws wait time in milliseconds. todo was 3 minutes +#define FLUSH_CONCENTRATE_STRAWS_TIME_MS ( 3 * 60 * MS_PER_SECOND ) ///< Flush concentrate straws wait time in milliseconds. #define ACID_PUMP_SPEED_ML_PER_MIN -30.0 ///< Acid pump speed in mL/min. // The bicarb pump is 2% faster than the acid pump to create a flow from acid to bicarb line during flush #define BICARB_PUMP_SPEED_ML_PER_MIN 30.6 ///< Bicarb pump speed in mL/min. @@ -303,6 +303,7 @@ // Close VPi to prevent wasting water setValveState( VPI, VALVE_STATE_CLOSED ); + // Set the actuators to drain R1 setValveState( VRD1, VALVE_STATE_OPEN );