Index: firmware/App/Controllers/ConductivitySensors.c =================================================================== diff -u -r6e57ef369518a71692b8631dda5204efce51676c -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 6e57ef369518a71692b8631dda5204efce51676c) +++ firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -24,6 +24,7 @@ #include "ModeFill.h" #include "OperationModes.h" #include "PersistentAlarm.h" +#include "Reservoirs.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "TaskPriority.h" @@ -325,8 +326,11 @@ void checkInletWaterConductivity( void ) { F32 conductivity = getConductivityValue( CONDUCTIVITYSENSORS_CPI_SENSOR ); + HD_MODE_SUB_MODE_T opMode; + getHDOperationMode( &opMode ); - if ( VALVE_STATE_OPEN == getValveStateName( VPI ) ) + + if ( VALVE_STATE_OPEN == getValveStateName( VPI ) && ( opMode.hdMode <= MODE_TREA ) ) { #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_WATER_QUALITY_CHECK ) != SW_CONFIG_ENABLE_VALUE ) Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rb766ff89da93aeb7f423a61487933477ff3ec82d -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision b766ff89da93aeb7f423a61487933477ff3ec82d) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -63,8 +63,8 @@ #define CONC_PUMPS_PRIME_AT_MAX_SPEED_TIME_OUT_MS ( 7 * MS_PER_SECOND ) ///< Concentrate pumps prime at maximum speed timeout in milliseconds. #define CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ( 10 * MS_PER_SECOND ) ///< Concentrate pumps prime check conductivity sensors timeout in milliseconds. -#define CONC_PUMPS_PRIME_MAX_ALLOWED_PRIME_TIME_OUT_MS ( 25 * MS_PER_SECOND ) ///< Concentrate pumps prime maximum allowed timeout in prime in milliseconds. - +#define CONC_PUMPS_PRIME_MAX_ALLOWED_PRIME_TIME_OUT_MS ( 50 * MS_PER_SECOND ) ///< Concentrate pumps prime maximum allowed timeout in prime in milliseconds. +#define NINTY_FIVE_PERCENT_FACTOR 0.95F ///< Ninety five percent of expected conductivity #define FLOW_INTEGRATED_VOLUME_CHECK_TOLERANCE 0.1F ///< Flow integrated volume has 10% tolerance compare to load cell reading. #define FIVE_PERCENT_FACTOR 0.05F ///< 5.0 / 100.0 used to calculate conductivity within range of -/+ 5%. @@ -80,7 +80,7 @@ // 2m long tubing to cap = 19.5 mL (acid line) + 7.92 mL/m * 2 m (tubing to cap) + 20.82 mL (straw) = 56.15 mL // Prime time in seconds = ( 56.15 mL / 48 mL/min ) x 60 second/min + 25 seconds margin time = 95 seconds. -#define PRIME_CONCENTRATE_LINES_TIME_OUT_MS ( 95 * MS_PER_SECOND ) ///< Time required to prime the concentrate lines. +#define PRIME_CONCENTRATE_LINES_TIME_OUT_MS ( 60 * MS_PER_SECOND ) ///< Time required to prime the concentrate lines. #define FLUSH_BUBBLES_PUMP_TIME_OUT_MS ( 2 * MS_PER_SECOND ) ///< RO pump on during flush bubble interval in ms. #define DIALYSATE_TEMPERATURE_TOLERANCE_C 2.0F ///< Dialysate temperature tolerance in degree C. #define DATA_PUBLISH_COUNTER_START_COUNT 63 ///< Data publish counter start count. @@ -791,15 +791,15 @@ if ( TRUE == didTimeout( concPumpPrimeStartTimeMS, CONC_PUMPS_PRIME_CHECK_COND_SNSRS_TIME_OUT_MS ) ) { /* Once the time for priming the concentrate lines has elapsed, check the mixing conductivity of the sensors - * If the acid and bicarb conductivity values are at about 50% of the target concentrate during fill, transition to the next state - * If the acid and bicarb conductivity values are not at 50% but the maximum prime time has elapsed, transition to the next state + * If the acid and bicarb conductivity values are at about 95% of the target concentrate during fill, transition to the next state + * If the acid and bicarb conductivity values are not at 95% but the maximum prime time has elapsed, transition to the next state */ F32 acidConduSPerCM = getConductivityValue( CONDUCTIVITYSENSORS_CD1_SENSOR ); F32 bicarbConduSPerCM = getConductivityValue( CONDUCTIVITYSENSORS_CD2_SENSOR ); F32 acidFillConduSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].acidConduSPerCM; F32 bicarbFillConduSPerCM = chemicalsCond.fillCondValues[ chemicalsTypes.acidType ][ FILL_COND_NORMAL_OP ].bicarbConduSPerCM; - if ( ( acidConduSPerCM >= ( acidFillConduSPerCM * HALF ) ) && ( bicarbConduSPerCM >= ( bicarbFillConduSPerCM * HALF ) ) ) + if ( ( acidConduSPerCM >= ( acidFillConduSPerCM * NINTY_FIVE_PERCENT_FACTOR ) ) && ( bicarbConduSPerCM >= ( bicarbFillConduSPerCM * NINTY_FIVE_PERCENT_FACTOR ) ) ) { result = DG_FILL_MODE_STATE_DELIVER_DIALYSATE; setModeFillStateTransition( result ); Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -rb607a94701f5844f2e850783239d1cb2df87fcd5 -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision b607a94701f5844f2e850783239d1cb2df87fcd5) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -499,8 +499,12 @@ *************************************************************************/ void setHDOperationMode( U32 mode, U32 subMode ) { + // thread protection for queue operations + _disable_IRQ(); hdModes.hdMode = (HD_OP_MODE_T)mode; hdModes.hdSubMode = subMode; + // release thread protection + _enable_IRQ(); } /*********************************************************************//** @@ -514,7 +518,8 @@ *************************************************************************/ void getHDOperationMode( HD_MODE_SUB_MODE_T* mode ) { - memcpy( mode, &hdModes, sizeof( HD_MODE_SUB_MODE_T ) ); + mode->hdMode = hdModes.hdMode; + mode->hdSubMode = hdModes.hdSubMode; } /*********************************************************************//** Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rb607a94701f5844f2e850783239d1cb2df87fcd5 -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision b607a94701f5844f2e850783239d1cb2df87fcd5) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -161,7 +161,7 @@ *************************************************************************/ BOOL isHDCommunicating( void ) { - return getU32OverrideValue(&hdCommunicationStatus); + return getU32OverrideValue( &hdCommunicationStatus ); } /*********************************************************************//** @@ -669,6 +669,7 @@ if ( TRUE == didTimeout( timeOfLastHDCheckIn, HD_COMM_TIMEOUT_IN_MS ) ) { hdCommunicationStatus.data = FALSE; + setHDOperationMode( 0, 0 ); // If HD off or not connected, consider HD mode is fault. } } @@ -882,6 +883,10 @@ handleHDStartStopTrimmerHeaterCmd( message ); break; + case MSG_ID_DG_PARK_CONCENTRATE_PUMPS_CMD_REQUEST: + handleParkConecentratePumpsCmd( message ); + break; + case MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD: handleDGStartStopTrimmerHeater( message ); break; @@ -1186,11 +1191,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: @@ -1201,10 +1206,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; @@ -1217,6 +1218,10 @@ handleTestFansRPMAlarmStartTimeOffsetRequest( message ); break; + case MSG_ID_DG_FANS_RPM_OVERRIDE: + handleFansRPMOverride( message ); + break; + case MSG_ID_DG_USED_ACID_VOLUME_ML_OVERRIDE: handleTestUsedAcidVolumeMLOverrideRequest( message ); break; @@ -1263,14 +1268,14 @@ handleTestTareReservoirRequest( message ); break; - case MSG_ID_DG_DRAIN_PUMP_CURRENT_OVERRIDE: - handleTestDrainPumpMeasuredCurrentOverride( message ); - break; - case MSG_ID_DG_GEN_IDLE_PUBLISH_INTERVAL_OVERRIDE: handleTestGenIdlePublishIntervalOverride( message ); break; + case MSG_ID_DG_DRAIN_PUMP_CURRENT_OVERRIDE: + handleSetDrainPumpMeasuredRPMOverrideRequest( message ); + break; + case MSG_ID_DG_DRAIN_PUMP_DIRECTION_OVERRIDE: handleTestDGDrainPumpDirectionOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rb607a94701f5844f2e850783239d1cb2df87fcd5 -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision b607a94701f5844f2e850783239d1cb2df87fcd5) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -341,7 +341,7 @@ // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_ALARM_TRIGGERED; - msg.hdr.payloadLen = sizeof( U32 ) * 5; + msg.hdr.payloadLen = sizeof( U32 ) * 8; memcpy( payloadPtr, &alarm, sizeof( U32 ) ); payloadPtr += sizeof( U32 ); @@ -423,7 +423,6 @@ return result; } - // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -1132,6 +1131,27 @@ /*********************************************************************//** * @brief + * The handleParkConecentratePumpsCmd function handles a DG concentrate pumps park + * command message from the HD. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleParkConecentratePumpsCmd( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == 0 ) + { + result = handleConcentratePumpParkRequest(); + } + + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); +} + +/*********************************************************************//** + * @brief * The handleStartStopTrimmerHeaterCmd function handles a trimmer heater start/stop * command message from the HD. * @details Inputs: none @@ -3615,37 +3635,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 @@ -3784,10 +3773,41 @@ /*********************************************************************//** * @brief - * The handleTestFansRPMAlarmStartTimeOffsetRequest function handles a - * request to set the fans RPM alarm start time offset. + * 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 handleTestFansRPMAlarmStartTimeOverrideRequest function handles a + * request to override the fan RPM alarm start time. + * @details Inputs: none + * @details Outputs: message handled * @param message : a pointer to the message to handle * @return none *************************************************************************/ @@ -3810,7 +3830,6 @@ } /*********************************************************************//** - * @brief * The handleTestUsedAcidVolumeMLOverrideRequest function handles a * request to override the acid volume. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rb607a94701f5844f2e850783239d1cb2df87fcd5 -r150a74dc4d92472352d14934b4359c4bf7e7450a --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision b607a94701f5844f2e850783239d1cb2df87fcd5) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 150a74dc4d92472352d14934b4359c4bf7e7450a) @@ -131,6 +131,9 @@ // MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD BOOL handleDGStartStopTrimmerHeater( MESSAGE_T *message ); +//MSG_ID_DG_PARK_CONCENTRATE_PUMPS +void handleParkConecentratePumpsCmd( MESSAGE_T *message ); + // MSG_ID_HD_START_STOP_TRIMMER_HEATER_CMD void handleHDStartStopTrimmerHeaterCmd( MESSAGE_T *message ); @@ -167,6 +170,12 @@ // MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ); +// MSG_ID_HD_OP_MODE +BOOL handleSetHDOperationMode( MESSAGE_T *message ); + +// MSG_ID_HD_REQUEST_DG_USAGE_INFO +void handleHDRequestDGUsageInfo( MESSAGE_T * message ); + // MSG_ID_DG_SET_SERVICE_TIME void handleSetDGServiceTime( MESSAGE_T *message ); @@ -396,6 +405,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 ); + // MSG_ID_DG_SET_FANS_RPM_ALARM_START_TIME_OFFSET void handleTestFansRPMAlarmStartTimeOffsetRequest( MESSAGE_T *message ); @@ -416,21 +431,27 @@ void handleSetDGSoftwareConfigRecord( MESSAGE_T *message ); #endif +// MSG_ID_HD_REQUEST_DG_ALARMS +void handleResendAllAlarmsCommand( MESSAGE_T *message ); + // MSG_ID_DG_HD_COMMUNICATION_STATUS void handleTestHDCommunicationStatusOverrideRequest( MESSAGE_T *message ); // MSG_ID_DG_SET_PRIMARY_AND_TRIMMER_HEATERS_TARGET_TEMP void handleSetPrimaryAndTrimmerHeatersTargetTemperature( MESSAGE_T *message ); +// MSG_ID_DG_USED_ACID_VOLUME_ML_OVERRIDE +void handleTestUsedAcidVolumeMLOverrideRequest(MESSAGE_T *message); + +// MSG_ID_DG_USED_BICARB_VOLUME_ML_OVERRIDE +void handleTestUsedBicarbVolumeMLOverrideRequest(MESSAGE_T *message); + // MSG_ID_DG_GET_USAGE_INFO_RECORD void handleGetDGUsageInfoRecord( MESSAGE_T *message ); // MSG_ID_DG_SET_USAGE_INFO_RECORD void handleSetDGUsageInfoRecord( MESSAGE_T *message ); -// MSG_ID_HD_REQUEST_DG_ALARMS -void handleResendAllAlarmsCommand( MESSAGE_T *message ); - // MSG_ID_DG_SET_OP_MODE_REQUEST void handleTestSetOpModeRequest( MESSAGE_T *message );