Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -53,7 +53,9 @@ #define CONCENTRATE_PUMP_VOLUME_PER_PULSE ( CONCENTRATE_PUMP_VOLUME_PER_REV / CONCENTRATE_PUMP_PULSE_PER_REV ) #define CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL ( 500 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is monitored. + #define CONCENTRATE_PUMP_CONTROL_INTERVAL ( 50 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is controlled. + #define CONCENTRATE_PUMP_SPEED_CONTROL_PERSISTENCE_PERIOD ( 5 * MS_PER_SECOND ) ///< Persistence period for concentrate pump speed control error. /// Enumeration of concentrate pump states. Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -174,6 +174,7 @@ { if( heater < NUM_OF_DG_HEATERS ) { +#ifndef DISABLE_HEATERS_AND_TEMPS // Assume the target temperature has not changed heatersStatus[ heater ].hasTargetTempChanged = FALSE; @@ -184,6 +185,7 @@ heatersStatus[ heater ].hasTargetTempChanged = TRUE; // TODO alarm if temperature if out of range or just reject? } +#endif } else { @@ -215,13 +217,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 { @@ -322,10 +327,12 @@ if ( TRUE == heaterCmdPtr->startHeater ) { +#ifndef DISABLE_TRIMMER_HEATER if ( ( MINIMUM_TARGET_TEMPERATURE <= heaterCmdPtr->targetTemp ) && ( heaterCmdPtr->targetTemp <= MAXIMUM_TARGET_TEMPERATURE ) ) { cmdResponse.rejected = FALSE; -#ifndef DISABLE_HEATERS_AND_TEMPS + + #ifndef DISABLE_HEATERS_AND_TEMPS heatersStatus[ DG_TRIMMER_HEATER ].targetTemp = heaterCmdPtr->targetTemp; heatersStatus[ DG_TRIMMER_HEATER ].startHeaterSignal = TRUE; #endif @@ -334,6 +341,7 @@ { cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_INVALID_PARAMETER; } +#endif } else { @@ -820,12 +828,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 -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -353,20 +353,20 @@ // Read flow at the control set if ( ++flowFilterCounter >= FLOW_SAMPLES_TO_AVERAGE ) { - F32 flow = RO_FLOW_ADC_TO_LPM_FACTOR / ( (F32)measuredFlowReadingsSum * FLOW_AVERAGE_MULTIPLIER ); + F32 flow = RO_FLOW_ADC_TO_LPM_FACTOR / ( (F32)measuredFlowReadingsSum * FLOW_AVERAGE_MULTIPLIER ); // Convert flow sensor period to L/min + // 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/DGCommon.h =================================================================== diff -u -r2bb3eb5316eef6a7eccf41f8815de100aa6abee7 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/DGCommon.h (.../DGCommon.h) (revision 2bb3eb5316eef6a7eccf41f8815de100aa6abee7) +++ firmware/App/DGCommon.h (.../DGCommon.h) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -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 82 // ********** 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 #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/ModeDrain.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -62,6 +62,8 @@ static BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines. static U32 rinseConcentrateLinesTimerCtr; ///< Timer counter for rinsing concentrate lines. static U32 dialysateDrainStartTime; ///< Dialysate drain start time. +static BOOL rinseConcentrateLines; ///< Flag indicates to rinse concentrate lines. +static U32 rinseConcentrateLinesTimerCtr; ///< Timer counter for rinsing concentrate lines. // ********** private function prototypes ********** static DG_DRAIN_STATE_T handleDrainStateStart( void ); @@ -78,11 +80,11 @@ *************************************************************************/ void initDrainMode( void ) { - drainState = DG_DRAIN_STATE_START; - drainEmptyTareTimerCtr = 0; - rinseConcentrateLines = FALSE; + drainState = DG_DRAIN_STATE_START; + drainEmptyTareTimerCtr = 0; + dialysateDrainStartTime = 0; + rinseConcentrateLines = FALSE; rinseConcentrateLinesTimerCtr = 0; - dialysateDrainStartTime = 0; } /*********************************************************************//** Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -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 -r94a190522ce398399c7b93c59f788d7666ec0060 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 94a190522ce398399c7b93c59f788d7666ec0060) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -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 ); Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -297,15 +297,15 @@ { DG_POST_STATE_T result = postState; - if ( ( SELF_TEST_STATUS_PASSED == testStatus ) || ( SELF_TEST_STATUS_FAILED == testStatus ) ) + if ( ( testStatus == SELF_TEST_STATUS_PASSED ) || ( testStatus == SELF_TEST_STATUS_FAILED ) ) { - BOOL passed = ( SELF_TEST_STATUS_PASSED == testStatus ? TRUE : FALSE ); + BOOL passed = ( testStatus == SELF_TEST_STATUS_PASSED ? TRUE : FALSE ); // Broadcast passed POST result sendPOSTTestResult( (DG_POST_STATE_T)((int)postState), passed ); // Move on to next POST test result = (DG_POST_STATE_T)((int)postState + 1); - if ( SELF_TEST_STATUS_FAILED == testStatus ) + if ( testStatus == SELF_TEST_STATUS_FAILED ) { tempPOSTPassed = FALSE; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r94a190522ce398399c7b93c59f788d7666ec0060 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 94a190522ce398399c7b93c59f788d7666ec0060) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -7,8 +7,8 @@ * * @file OperationModes.c * -* @author (last) Dara Navaei -* @date (last) 06-Nov-2021 +* @author (last) Sean Nash +* @date (last) 12-Nov-2021 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -82,8 +82,8 @@ #define FPGA_FLUIDLEAK_STATE_MASK 0x0004 ///< Bit mask for fluid leak detector. #define FLUID_DOOR_SWITCH_MASK 0x08 ///< Fluid door switch bit mask. -#define CONCENTRATE_CAP_SWITCH_MASK 0x10 ///< Concentrate cap switch bit mask -#define DIALYSATE_CAP_SWITCH_MASK 0x20 ///< Dialysate cap switch bit mask.. +#define DIALYSATE_CAP_SWITCH_MASK 0x10 ///< Dialysate cap switch bit mask. +#define CONCENTRATE_CAP_SWITCH_MASK 0x1A ///< Concentrate cap switch bit mask. #define FPGA_POWER_OUT_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< FPGA power out timeout in milliseconds. #define FPGA_GPIO_POWER_STATUS_PIN 7 ///< FPGA GPIO power status pin @@ -186,6 +186,7 @@ U16 fpgaFanIn3Pulse; ///< Reg 400. Fan inlet 3 pulse time in 2.5 resolution U16 fpgaFanOut3Pulse; ///< Reg 402. Fan outlet 3 pulse time in 2.5 resolution U16 fpgaTimerCount_ms; ///< Reg 404. Internal FPGA timer count in ms. + U16 fpgaADCVccInt; ///< Reg 406. Internal FPGA Vcc Voltage. U16 fpgaADCVccAux; ///< Reg 408. Internal FPGA Vcc auxiliary voltage. U16 fpgaADCVPVN; ///< Reg 410. Internal FPGA VPVN voltage. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -1283,11 +1283,11 @@ break; case MSG_ID_FILTER_FLUSH_TIME_PERIOD_OVERRIDE: - handleFilterFlushTimePeriodOverride( message ); + handleFilterFlushTimePeriodOverride(message); break; - case MSG_ID_DG_FANS_RPM_OVERRIDE: - handleFansRPMOverride( message ); + case MSG_ID_DG_BLOCK_MESSAGE_TRANSMISSION: + handleTestBlockMessagesRequest( message ); break; case MSG_ID_DG_STOP_RTC_CLOCK: @@ -1298,10 +1298,6 @@ handleSetDrainPumpMeasuredRPMOverrideRequest( message ); break; - case MSG_ID_DG_BLOCK_MESSAGE_TRANSMISSION: - handleTestBlockMessagesRequest( message ); - break; - case MSG_ID_DG_SUPER_CLEAR_ALARMS_CMD: handleTestSuperClearAlarmsRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -22,7 +22,6 @@ #include "Accel.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" -#include "Fans.h" #include "FPGA.h" #include "Heaters.h" #include "ModeFlush.h" @@ -358,7 +357,6 @@ return result; } - // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -2974,37 +2972,6 @@ } /*********************************************************************//** - * @brief - * The handleFansRPMOverride function handles a request to override a fans RPM value. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleFansRPMOverride( MESSAGE_T *message ) -{ - TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; - BOOL result = FALSE; - - // verify payload length - if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) - { - memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) ); - if ( FALSE == payload.reset ) - { - result = testSetFanRPMOverride( payload.index, payload.state.f32 ); - } - else - { - result = testResetFanRPMOverride( payload.index ); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** * @brief * The handleStopDGRTCClock function handles a request to stop the RTC clock. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -355,6 +355,12 @@ // MSG_ID_DG_DRAIN_PUMP_MEASURED_RPM_OVERRIDE void handleSetDrainPumpMeasuredRPMOverrideRequest( MESSAGE_T *message ); +// MSG_ID_DG_ALARM_INFO_SEND_INTERVAL_OVERRIDE +void handleTestAlarmInfoSendIntervalOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_DG_SUPER_CLEAR_ALARMS_CMD +void handleTestSuperClearAlarmsRequest( MESSAGE_T *message ); + /**@}*/ #endif Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -ra6e1a62344275a14e4edde1bdda9974eef840827 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision a6e1a62344275a14e4edde1bdda9974eef840827) @@ -72,10 +72,8 @@ // Monitor load cells execLoadCell(); -#ifndef DISABLE_HEATERS_AND_TEMPS // Temperature sensors read execTemperatureSensors(); -#endif // Conductivity sensors read execConductivitySensors();