Index: firmware/App/Modes/FPModes/FPOperationModes.c =================================================================== diff -u -r5398b91c33e6fd39a74dbe132e50120965ef4107 -rc554353ba10c84377f0b9f7218f911543a293598 --- firmware/App/Modes/FPModes/FPOperationModes.c (.../FPOperationModes.c) (revision 5398b91c33e6fd39a74dbe132e50120965ef4107) +++ firmware/App/Modes/FPModes/FPOperationModes.c (.../FPOperationModes.c) (revision c554353ba10c84377f0b9f7218f911543a293598) @@ -35,6 +35,8 @@ #define BROADCAST_TD_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< FP operation mode broadcast interval (in task interval/sec). #define DATA_PUBLISH_COUNTER_START_COUNT 11 ///< Data publish counter start count. +#define SIGNAL_START 1 +#define SIGNAL_STOP 0 // ********** private data ********** @@ -57,7 +59,7 @@ /* FAUL */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, /* SERV */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, /* INIT */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_INIT, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_NLEG }, -/* STAN */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_DPGP, FP_MODE_DEGP }, +/* STAN */{ FP_MODE_FAUL, FP_MODE_SERV, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_NLEG, FP_MODE_DPGP, FP_MODE_NLEG }, /* PGEN */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_PGEN, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, /* GENW */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_GENP, FP_MODE_NLEG, FP_MODE_NLEG }, /* DPGP */{ FP_MODE_FAUL, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_STAN, FP_MODE_NLEG, FP_MODE_NLEG, FP_MODE_DPGP, FP_MODE_DEGP }, @@ -403,7 +405,7 @@ * The isFPDefeatured function returns if the Leahi device is defeatured. * @details \b Inputs: none * @details \b Outputs: none - * @return the current state of standby mode. + * @return the boolean if the FP device is defeatured. *************************************************************************/ BOOL isFPDefeatured( void ) { @@ -417,15 +419,62 @@ * has a boost pump installed. * @details \b Inputs: none * @details \b Outputs: none - * @return the current state of standby mode. + * @return the boolean if boost pump is installed. *************************************************************************/ BOOL isBoostPumpInstalled( void ) { // TODO - pull status from NV mem. return isBoostInstalled; } +/*********************************************************************//** + * @brief + * The signalStopGenPermeate function returns if the Leahi device + * has a boost pump installed. + * @details \b Inputs: none + * @details \b Outputs: none + * @return the rejection reason codes for stopping generate permeate. + *************************************************************************/ +REQUEST_REJECT_REASON_CODE_T signalStopGenPermeate( void ) +{ + REQUEST_REJECT_REASON_CODE_T reason = REQUEST_REJECT_REASON_NONE; + // Stop is agnostic to defeatured/featured. + // As long as were not in fault or POST, request to go to standby to stop + if ( currentMode >= FP_MODE_STAN ) + { + requestNewFPOperationMode( FP_MODE_STAN ); + } + else + { + reason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; + } + return reason; +} +/*********************************************************************//** + * @brief + * The signalStartGenPermeate function returns if the Leahi device + * has a boost pump installed. + * @details \b Inputs: none + * @details \b Outputs: none + * @return the rejection reason codes for starting generate permeate. + *************************************************************************/ +REQUEST_REJECT_REASON_CODE_T signalStartGenPermeate( void ) +{ + REQUEST_REJECT_REASON_CODE_T reason = REQUEST_REJECT_REASON_NONE; + // TODO - Service and disinfection checks happen here. + if ( TRUE == isFPDefeatured() ) + { + requestNewFPOperationMode( FP_MODE_DPGP ); + } + else + { + requestNewFPOperationMode( FP_MODE_PGEN ); + } + return reason; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -480,4 +529,37 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetGeneratePermeateSignal function sets start stop signal of generate + * permeate. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message message from Dialin which includes the signal to start or stop + * generate permeate modes. + * @return TRUE if set successful, FALSE if not + *************************************************************************/ +BOOL testSetGeneratePermeateSignal( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify message payload length is valid + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + U32 signalStartStop; + + memcpy( &signalStartStop, message->payload, sizeof( U32 ) ); + if ( SIGNAL_START == signalStartStop ) + { + signalStartGenPermeate(); + } + else if ( SIGNAL_STOP == signalStartStop ) + { + signalStopGenPermeate(); + } + } + + return result; +} + /**@}*/ Index: firmware/App/Modes/FPModes/FPOperationModes.h =================================================================== diff -u -r6545787080956983fed6bd9c2717938c202917ab -rc554353ba10c84377f0b9f7218f911543a293598 --- firmware/App/Modes/FPModes/FPOperationModes.h (.../FPOperationModes.h) (revision 6545787080956983fed6bd9c2717938c202917ab) +++ firmware/App/Modes/FPModes/FPOperationModes.h (.../FPOperationModes.h) (revision c554353ba10c84377f0b9f7218f911543a293598) @@ -52,11 +52,14 @@ U32 getCurrentFPSubMode( void ); // Get the current sub-mode BOOL isFPDefeatured( void ); // is the Leahi device is defeatured ( TBD pulled from NV mem ) BOOL isBoostPumpInstalled( void ); // is this leahi device installed with a boost pump ( TBD pulled from NV mem ) +REQUEST_REJECT_REASON_CODE_T signalStopGenPermeate( void ); // signal to stop gen permeate request. +REQUEST_REJECT_REASON_CODE_T signalStartGenPermeate( void ); // signal to start gen permeate request. void setCurrentFPSubState( U32 subState ); // Set the current substate. void setCurrentFP4thLevelState( U32 state ); // Set the current 4th level state. BOOL testSetFPOperationMode( MESSAGE_T *message ); // Set operation mode override BOOL testSetFPOpModePublishIntervalOverride( MESSAGE_T *message ); // Set operation mode publish interval override +BOOL testSetGeneratePermeateSignal( MESSAGE_T *message ); // Set start stop generate permeate. /**@}*/ Index: firmware/App/Services/Messaging.c =================================================================== diff -u -rd224ea9c16866ca84a62782dd9027fa162af2dbd -rc554353ba10c84377f0b9f7218f911543a293598 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision d224ea9c16866ca84a62782dd9027fa162af2dbd) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision c554353ba10c84377f0b9f7218f911543a293598) @@ -238,6 +238,7 @@ { MSG_ID_FP_PERMEATE_TANK_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPermeateTankDataPublishIntervalOverride }, { MSG_ID_FP_RO_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testROPumpDataPublishIntervalOverride }, { MSG_ID_DD_RINSE_PUMP_DATA_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testRinsePumpDataPublishIntervalOverride }, + { MSG_ID_FP_SET_START_STOP_OVERRIDE_REQUEST, &testSetGeneratePermeateSignal }, }; /// Calculation for number of entries in the incoming message function handler look-up table. Index: firmware/App/Services/TDInterface.c =================================================================== diff -u -re01f6c0b94312dec30878967be9ffa3228e8773b -rc554353ba10c84377f0b9f7218f911543a293598 --- firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision e01f6c0b94312dec30878967be9ffa3228e8773b) +++ firmware/App/Services/TDInterface.c (.../TDInterface.c) (revision c554353ba10c84377f0b9f7218f911543a293598) @@ -335,6 +335,7 @@ BOOL handlePreGenDialysateRequestMsg( MESSAGE_T *message ) { BOOL result = FALSE; + REQUEST_REJECT_REASON_CODE_T fpReason = REQUEST_REJECT_REASON_NONE; if ( message->hdr.payloadLen == sizeof( PRE_GEN_DIALYSATE_REQ_PAYLOAD_T ) ) { @@ -347,7 +348,7 @@ if ( ( DD_MODE_STAN == ddMode ) && ( TRUE == startPreGenRequest.start ) ) { // Start FP Pre-Generate Permeate - requestFPGeneratePermeate( RO_PRE_GEN, TRUE ); + fpReason = signalStartGenPermeate(); // start pre-gen dialysate result = requestDDPreGenStart(); // Update Temperature, Acid/Bicarb type and dialysate rate for pregen process. @@ -361,6 +362,8 @@ { // stop pre generate diaysate delivery result = requestDDPreGenStop(); + // stop FP Pre-Generate Permeate + fpReason = signalStopGenPermeate(); } } } @@ -384,6 +387,7 @@ BOOL handleDialysateDeliveryRequestMsg( MESSAGE_T *message ) { BOOL result = FALSE; + REQUEST_REJECT_REASON_CODE_T fpReason = REQUEST_REJECT_REASON_NONE; if ( message->hdr.payloadLen == sizeof( DIALYSATE_DELIVERY_REQ_PAYLOAD_T ) ) { @@ -413,6 +417,8 @@ { // stop dialysate generation result = requestDDGenDialyasteStop(); + // stop FP Pre-Generate Permeate + fpReason = signalStopGenPermeate(); } else {