Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r364c00d074d23989f2d714189a8c89964e32b458 -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 364c00d074d23989f2d714189a8c89964e32b458) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file Heaters.c * -* @author (last) Bill Bracken -* @date (last) 22-Aug-2022 +* @author (last) Michael Garthwaite +* @date (last) 07-Sep-2022 * * @author (original) Dara Navaei * @date (original) 23-Apr-2020 @@ -30,7 +30,6 @@ #include "OperationModes.h" #include "PersistentAlarm.h" #include "Reservoirs.h" -#include "ROPump.h" #include "SafetyShutdown.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" @@ -170,6 +169,7 @@ if( heater < NUM_OF_DG_HEATERS ) { +#ifndef DISABLE_HEATERS_AND_TEMPS // Assume the target temperature has not changed heatersStatus[ heater ].hasTargetTempChanged = FALSE; @@ -180,6 +180,7 @@ heatersStatus[ heater ].hasTargetTempChanged = TRUE; result = TRUE; } +#endif } else { @@ -213,6 +214,7 @@ { BOOL status = FALSE; + if( heater < NUM_OF_DG_HEATERS ) { if ( HEATER_EXEC_STATE_OFF == heatersStatus[ heater ].state ) Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r851ee579efc2add1f16a5012bdaac93658e760ea -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 851ee579efc2add1f16a5012bdaac93658e760ea) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -221,7 +221,7 @@ // For now maximum allowed pressure is inserted into the target pressure override // if the target flow rate exceeded the max pressure, it will set the maximum pressure targetROPumpMaxPressure = maxPressure; - targetROPumpFlowRateLPM = roFlowRate; + targetROPumpFlowRateLPM = roFlowRate; roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; roPumpState = RO_PUMP_RAMP_UP_TO_TARGET_FLOW_STATE; // Get the initial guess of the duty cycle Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -r8074ecece0b11532c173ad951a98036f0c54ca52 -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 8074ecece0b11532c173ad951a98036f0c54ca52) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -22,7 +22,7 @@ /** * @defgroup ROPump ROPump - * @brief RO Pump monitor and controller module. Controls and monitors the RO pump. + * @brief RO Pump monitor and controller module. Controls and monitors the RO pump and the flow meter. * The flow meter is manufactured by SwissFlow, PN: 82015311. * The diaphragm (RO) pump is manufactured by Aquatec, PN: 5889-2MM1-V724DY. * Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r97e05773e710de7cf31c717399fe1e99a3cc7d0c -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 97e05773e710de7cf31c717399fe1e99a3cc7d0c) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file TemperatureSensors.c * -* @author (last) Dara Navaei -* @date (last) 04-Aug-2022 +* @author (last) Michael Garthwaite +* @date (last) 30-Aug-2022 * * @author (original) Dara Navaei * @date (original) 08-Apr-2020 @@ -452,14 +452,33 @@ // the electrical connection of THd sensor. if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) ) { - if ( ( TEMPSENSORS_HEAT_DISINFECT == sensorIndex ) || ( TEMPSENSORS_INTERNAL_THD_RTD == sensorIndex ) ) + if ( TEMPSENSORS_HEAT_DISINFECT == sensorIndex ) { - temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_OUTLET_REDUNDANT ].temperatureValues ); + if ( OVERRIDE_KEY == tempSensors[ TEMPSENSORS_HEAT_DISINFECT ].temperatureValues.override ) + { + temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_HEAT_DISINFECT ].temperatureValues ); + } + else + { + temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_OUTLET_REDUNDANT ].temperatureValues ); + } } + if ( TEMPSENSORS_INTERNAL_THD_RTD == sensorIndex ) + { + temperature = 40.0F; + } + if ( TEMPSENSORS_OUTLET_REDUNDANT == sensorIndex ) { - temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_INLET_DIALYSATE ].temperatureValues ); + if ( OVERRIDE_KEY == tempSensors[ TEMPSENSORS_OUTLET_REDUNDANT ].temperatureValues.override ) + { + temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_OUTLET_REDUNDANT ].temperatureValues ); + } + else + { + temperature = getF32OverrideValue( &tempSensors[ TEMPSENSORS_INLET_DIALYSATE ].temperatureValues ); + } } } #endif @@ -908,6 +927,7 @@ data.loadCellA2B2 = getTemperatureValue( TEMPSENSORS_LOAD_CELL_A2_B2 ); data.internalTHDORTD = getTemperatureValue( TEMPSENSORS_INTERNAL_TRO_RTD ); data.internalTDIRTD = getTemperatureValue( TEMPSENSORS_INTERNAL_TDI_RTD ); + data.interalTHDRTD = getTemperatureValue( TEMPSENSORS_INTERNAL_THD_RTD ); data.internalCondSnsrTemp = getTemperatureValue( TEMPSENSORS_INTERNAL_COND_TEMP_SENSOR ); broadcastData( MSG_ID_DG_TEMPERATURE_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r7f38146626e566ac94d97d785af7290529992fdd -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 7f38146626e566ac94d97d785af7290529992fdd) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -20,6 +20,7 @@ #include "AlarmMgmt.h" #include "Common.h" +#include "FlowSensors.h" #include "MessageSupport.h" #include "PersistentAlarm.h" #include "SystemCommMessages.h" @@ -375,7 +376,7 @@ if ( TURN_ON == reactorsStatus[ reactor ].switchState ) { // Check if the flow is below minimum - reactorsStatus[ reactor ].isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); + reactorsStatus[ reactor ].isFlowBelowMin = ( getMeasuredFlowRateLPM( RO_FLOW_SENSOR ) < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); // If the flow is no longer below minimum and the reactor is requested to be on, turn it back on if ( FALSE == reactorsStatus[ reactor ].isFlowBelowMin ) @@ -419,7 +420,7 @@ } // Check if the flow is below minimum - BOOL isFlowBelowMin = ( getMeasuredROFlowRateLPM() < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); + BOOL isFlowBelowMin = ( getMeasuredFlowRateLPM( RO_FLOW_SENSOR ) < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); if ( TRUE == isFlowBelowMin ) { Index: firmware/App/DGCommon.h =================================================================== diff -u -rcb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/DGCommon.h (.../DGCommon.h) (revision cb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d) +++ firmware/App/DGCommon.h (.../DGCommon.h) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -25,7 +25,7 @@ #define DG_VERSION_MAJOR 0 #define DG_VERSION_MINOR 6 #define DG_VERSION_MICRO 0 -#define DG_VERSION_BUILD 30 +#define DG_VERSION_BUILD 233 // ********** build switches ********** Index: firmware/App/Modes/ModeHeatDisinfect.c =================================================================== diff -u -rcb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision cb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d) +++ firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -62,7 +62,7 @@ // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( SEC_PER_MIN * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. -#define MIN_INLET_TEMPERATURE_C 15.0F ///< Minimum water inlet temperature in C. TODO original temperature was 25 C +#define MIN_INLET_TEMPERATURE_C 25.0F ///< Minimum water inlet temperature in C. #define MAX_INLET_CONDUCTIVITY_US_PER_CM 2000.0F ///< Maximum water inlet conductivity in us/cm // Flush circulation path state defines @@ -80,7 +80,7 @@ #define RSRVRS_PARTIAL_FILL_VOL_ML 500.0F ///< Reservoirs 1 & 2 partial volume in mL. #define RSRVRS_FULL_STABLE_TIME_COUNT ( ( 4 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Reservoirs 1 & 2 full stable time in counts. #define RSRVRS_FILL_UP_TIMEOUT_MS ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 full fill up timeout in ms. TODO original value was 5 mins -#define RSRVRS_500ML_FILL_UP_TIMEOUT_MS ( 4 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 partial fill up timeout in ms. TODO original value was 2 mins +#define RSRVRS_500ML_FILL_UP_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 partial fill up timeout in ms. #define RSRVRS_DRAIN_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 drain timeout in ms. // Fill and heat water @@ -93,7 +93,7 @@ #define HEAT_DISINFECT_TARGET_DRAIN_PRES_PSI 12.0F ///< Heat disinfect target drain outlet pressure in psi. #define HEAT_DISINFECT_TIME_MS ( 10 * SEC_PER_MIN * MS_PER_SECOND ) ///< Heat disinfect time for each section in milliseconds. #define HEAT_DISINFECT_START_TEMP_TIMOUT_MS ( 4 * MIN_PER_HOUR * SEC_PER_MIN * MS_PER_SECOND ) ///< Heat disinfect reaching to minimum temperature timeout in milliseconds. -#define RSRVRS_TARGET_VOL_OUT_TIMEOUT_MS ( 0.5F * SEC_PER_MIN * MS_PER_SECOND ) ///< Reservoirs 1 & 2 maximum volume out of range timeout during heat disinfect. TODO change this to 5 seconds +#define RSRVRS_TARGET_VOL_OUT_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Reservoirs 1 & 2 maximum volume out of range timeout during heat disinfect. #define RSRVRS_MAX_TARGET_VOL_CHANGE_ML 100.0F ///< Reservoirs 1 & 2 maximum allowed volume change when full during heat disinfect. #define POST_HEAT_DISINFECT_WAIT_TIME_MS ( 3 * SEC_PER_MIN * MS_PER_SECOND ) ///< Heat disinfect final wait time before flushing the system in milliseconds. #define HEAT_DISINFECT_MAX_TEMP_GRADIENT_C 15.0F ///< Heat disinfect maximum allowed temperature gradient in between hottest and coldest sensors. @@ -637,7 +637,7 @@ BOOL hasConductivityPassed = FALSE; // If the inlet temperature and conductivity are in range, move onto the next state - if ( ( getTemperatureValue( TEMPSENSORS_INLET_PRIMARY_HEATER ) > MIN_INLET_TEMPERATURE_C ) && + if ( ( getTemperatureValue( TEMPSENSORS_INLET_PRIMARY_HEATER ) >= MIN_INLET_TEMPERATURE_C ) && ( getConductivityValue( CONDUCTIVITYSENSORS_CPI_SENSOR ) <= MAX_INLET_CONDUCTIVITY_US_PER_CM ) ) { hasConductivityPassed = TRUE; @@ -1860,10 +1860,20 @@ { if ( ++rsrvrFillStableTimeCounter >= RSRVRS_FULL_STABLE_TIME_COUNT ) { - status = DG_RESERVOIR_REACHED_TARGET; + status = DG_RESERVOIR_REACHED_TARGET; rsrvrFillStableTimeCounter = 0; // Set the state timer in case it needs to be used for another timeout check - stateTimer = getMSTimerCount(); + if ( ( DG_HEAT_DISINFECT_STATE_FLUSH_R2_AND_DRAIN_R1 == heatDisinfectState) && ( DG_RESERVOIR_2 == reservoir ) ) + { + if ( rsrvr1Status == DG_RESERVOIR_REACHED_TARGET ) + { + stateTimer = getMSTimerCount(); + } + } + else + { + stateTimer = getMSTimerCount(); + } } } else if ( TRUE == didTimeout( stateTimer, timeout ) ) @@ -1906,8 +1916,18 @@ if ( TRUE == isDrainComplete ) { - // Set the state timer in case it needs to be used for another timeout check - stateTimer = getMSTimerCount(); + if ( ( DG_HEAT_DISINFECT_STATE_FLUSH_R2_AND_DRAIN_R1 == heatDisinfectState) && ( DG_RESERVOIR_1 == r) ) + { + if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr2Status) && ( 0 == getDrainPumpTargetRPM() ) ) + { + stateTimer = getMSTimerCount(); + } + } + else + { + stateTimer = getMSTimerCount(); + } + haveDrainParamsBeenInit[ r ] = FALSE; status = DG_RESERVOIR_REACHED_TARGET; } @@ -1948,11 +1968,11 @@ // Check if the temperature gradient in between the coldest and the hottest spot is more than the specified temperature and // the timer has not started yet, start it - if ( ( TPoTemp - ThdTemp > HEAT_DISINFECT_MAX_TEMP_GRADIENT_C ) && ( 0 == tempGradOutOfRangeTimer ) ) + if ( ( fabs( TPoTemp - ThdTemp ) > HEAT_DISINFECT_MAX_TEMP_GRADIENT_C ) && ( 0 == tempGradOutOfRangeTimer ) ) { tempGradOutOfRangeTimer = getMSTimerCount(); } - else if ( ( TPoTemp - ThdTemp > HEAT_DISINFECT_MAX_TEMP_GRADIENT_C ) && + else if ( ( fabs( TPoTemp - ThdTemp ) > HEAT_DISINFECT_MAX_TEMP_GRADIENT_C ) && ( TRUE == didTimeout( tempGradOutOfRangeTimer, HEAT_DISINFECT_TEMP_GRAD_OUT_RANGE_TIME_MS ) ) ) { alarmDetectedPendingTrigger = ALARM_ID_DG_HEAT_DISINFECT_TEMP_GRAD_OUT_OF_RANAGE; Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r851ee579efc2add1f16a5012bdaac93658e760ea -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 851ee579efc2add1f16a5012bdaac93658e760ea) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -312,15 +312,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/ModeStandby.c =================================================================== diff -u -rcb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision cb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file ModeStandby.c * -* @author (last) Dara Navaei -* @date (last) 31-May-2022 +* @author (last) Michael Garthwaite +* @date (last) 07-Sep-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -rcb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision cb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file AlarmMgmtSWFaults.h * -* @author (last) Dara Navaei -* @date (last) 03-Aug-2022 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Quang Nguyen * @date (original) 20-May-2021 @@ -85,6 +85,7 @@ SW_FAULT_ID_PERSISTENT_ALARM_INVALID_INDEX, SW_FAULT_ID_CONCENTRATE_PUMP_EXEC_INVALID_STATE, // 55 SW_FAULT_ID_CONCENTRATE_PUMP_INVALID_PUMP_ID, + SW_FAULT_ID_SERVICE_MODE_INVALID_EXEC_STATE, SW_FAULT_ID_SEMAPHORE_IN_USE_TIMEOUT, SW_FAULT_ID_UV_REACTORS_INVALID_EXEC_STATE, SW_FAULT_ID_UV_REACTORS_INVALID_SELF_TEST_STATE, Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -rcb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision cb4d35cc50df2d3cc9e828cd92e53cf456ca9b9d) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file Reservoirs.c * -* @author (last) Dara Navaei -* @date (last) 03-Aug-2022 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Sean * @date (original) 18-Mar-2020 @@ -1061,4 +1061,32 @@ return result; } +/*********************************************************************//** + * @brief + * The testTareReservoir function tares a given reservoir. It is assumed + * that the given reservoir has already been drained. + * @details Inputs: drainVolumeTargetMl + * @details Outputs: drainVolumeTargetMl + * @param value ID of reservoir to tare + * @return TRUE if tare successful, FALSE if not + *************************************************************************/ +BOOL testTareReservoir( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + if ( value < NUM_OF_DG_RESERVOIRS ) + { + result = TRUE; + tareLoadCellRequest = TRUE; + testSetReservoirDrainVolumeMlOverride( 0 ); + tareLoadCellsAtEmpty( (DG_RESERVOIR_ID_T)value ); + testResetReservoirDrainVolumeMlOverride(); + } + } + + return result; +} + /**@}*/ Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r8074ecece0b11532c173ad951a98036f0c54ca52 -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8074ecece0b11532c173ad951a98036f0c54ca52) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file SystemComm.c * -* @author (last) Dara Navaei -* @date (last) 12-Jul-2022 +* @author (last) Michael Garthwaite +* @date (last) 08-Aug-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -888,6 +888,10 @@ handleDGScheduledRunsRequest( message ); break; + case MSG_ID_HD_REQUEST_DG_SERVICE_MODE: + handleServiceModeRequest( message ); + break; + case MSG_ID_HD_REQUEST_DG_USAGE_INFO: handleHDRequestDGUsageInfo( message ); break; @@ -1125,11 +1129,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: @@ -1140,10 +1144,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; @@ -1156,6 +1156,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; @@ -1188,6 +1192,14 @@ handleSetDGUsageInfoRecord( message ); break; + case MSG_ID_DG_SET_OP_MODE_REQUEST: + handleTestSetOpModeRequest( message ); + break; + + case MSG_ID_DG_RESERVOIR_TARE_REQUEST: + handleTestTareReservoirRequest( message ); + break; + case MSG_ID_HD_REQUEST_DG_ALARMS: handleResendAllAlarmsCommand( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r364c00d074d23989f2d714189a8c89964e32b458 -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 364c00d074d23989f2d714189a8c89964e32b458) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.c * -* @author (last) Dara Navaei -* @date (last) 21-Jun-2022 +* @author (last) Michael Garthwaite +* @date (last) 07-Sep-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -368,7 +368,6 @@ return result; } - // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -1390,6 +1389,56 @@ /*********************************************************************//** * @brief + * The handleTestSetOpModeRequest function handles a request to set the + * DG operation mode. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSetOpModeRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 mode; + + memcpy( &mode, message->payload, sizeof(U32) ); + result = testSetOperationMode( (DG_OP_MODE_T)mode ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestTareReservoirRequest function handles a request to tare a + * given reservoir's weight. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestTareReservoirRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( message->hdr.payloadLen == sizeof(U32) ) + { + U32 res; + + memcpy( &res, message->payload, sizeof(U32) ); + result = testTareReservoir( res ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief * The handleSetHDOperationMode function receives the HD operation modes data * publish message. * @details Inputs: none @@ -3182,37 +3231,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 @@ -3351,10 +3369,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 *************************************************************************/ @@ -3377,7 +3426,6 @@ } /*********************************************************************//** - * @brief * The handleTestUsedAcidVolumeMLOverrideRequest function handles a * request to override the acid volume. * @details Inputs: none @@ -3670,13 +3718,83 @@ /*********************************************************************//** * @brief -* The handleResendAllAlarmsCommand function handles a request to re-send -* all active DG alarms. +* The handleServiceModeRequest function handles a request to enter service +* mode. * @details Inputs: none * @details Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ +void handleServiceModeRequest( MESSAGE_T *message ) +{ + BOOL status = FALSE; + DG_OP_MODE_T currentMode = getCurrentOperationMode(); + REQUEST_REJECT_REASON_CODE_T reject; + + if ( 0 == message->hdr.payloadLen ) + { + if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) + { + status = TRUE; + requestNewOperationMode( DG_MODE_SERV ); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } + } + else + { + reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); + sendServiceModeResponse( status, (U32)reject ); +} + +/*********************************************************************//** + * @brief + * The sendServiceModeResponse function sends out the DG response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ +BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); + + // 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_DG_2_HD, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The sendUIServiceModeResponse function sends out the DG response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ void handleResendAllAlarmsCommand( MESSAGE_T *message ) { BOOL result = FALSE; Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r364c00d074d23989f2d714189a8c89964e32b458 -r1f1b53030a930c542646d9d88c7db0c3a945f150 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 364c00d074d23989f2d714189a8c89964e32b458) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1f1b53030a930c542646d9d88c7db0c3a945f150) @@ -7,8 +7,8 @@ * * @file SystemCommMessages.h * -* @author (last) Dara Navaei -* @date (last) 25-May-2022 +* @author (last) Michael Garthwaite +* @date (last) 07-Sep-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -154,6 +154,12 @@ // MSG_ID_DG_SCHEDULED_RUNS_INFO void handleDGScheduledRunsRequest( MESSAGE_T *message ); +// MSG_ID_UI_REQUEST_SERVICE_MODE +void handleServiceModeRequest( MESSAGE_T *message ); + +// MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST +BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ); + // MSG_ID_HD_OP_MODE BOOL handleSetHDOperationMode( MESSAGE_T *message ); @@ -364,6 +370,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 ); @@ -385,12 +397,27 @@ // MSG_ID_DG_HD_COMMUNICATION_STATUS void handleTestHDCommunicationStatusOverrideRequest(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_DG_SET_OP_MODE_REQUEST +void handleTestSetOpModeRequest( MESSAGE_T *message ); + +// MSG_ID_DG_RESERVOIR_TARE_REQUEST +void handleTestTareReservoirRequest( MESSAGE_T *message ); + +// MSG_ID_HD_OP_MODE +BOOL handleSetHDOperationMode( MESSAGE_T *message ); + // MSG_ID_HD_REQUEST_DG_ALARMS void handleResendAllAlarmsCommand( MESSAGE_T *message );