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; +} + /**@}*/