Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -rbf44edd28c59df78a75165764b6b654f2e91e556 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision bf44edd28c59df78a75165764b6b654f2e91e556) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -90,7 +90,7 @@ #define BLOOD_LEAK_EMB_MODE_NUM_OF_INFO_CMDS 3 ///< Blood leak embedded mode number of informative commands. #define BLOOD_LEAK_FPGA_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Blood leak embedded mode FPGA error timeout in milliseconds. -#define BLOOD_LEAK_RXFIFO_COUNT_MASK 0x03ff ///< Mask high order bits of blood leak sensor rx count +#define BLOOD_LEAK_RXFIFO_COUNT_MASK 0x03FF ///< Mask high order bits of blood leak sensor rx count /// Defined states for the blood leak detector state machine. typedef enum BloodLeakStates @@ -344,6 +344,10 @@ case BLOOD_LEAK_EMB_MODE_WAIT_FOR_COMMAND_RESPONSE_STATE: bloodLeakEmbModeSubstate = handleBloodLeakEmbModeWaitForCommandResponseState(); break; + + default: + // TODO software fault + break; } } @@ -561,6 +565,10 @@ // All the commands shall be processed and have data prior to checking the results areCommandsReady &= bloodLeakEmbModeCmd[ i ].isCmdRespRdy; break; + + default: + // Do nothing with the rest of the commands + break; } } @@ -591,6 +599,10 @@ hasCmdSqncFailed |= hasCurrCmdFailed; failedCmd = ( TRUE == hasCurrCmdFailed ? i : NU_EMB_MODE_CMD ); break; + + default: + // Do nothing with the rest of the commands + break; } } @@ -924,7 +936,8 @@ { // If the element in the first index of the command sequence buffer is the read a byte request, set the variable to TRUE so the // wait for data to receive state knows that the request has been sent and it can read the byte. - U08 commandInIndex0 = bloodLeakEmbModeCmdSeq[ BLOOD_LEAK_EMB_MODE_REQUEST_RX_INDEX ][ BLOOD_LEAK_EMB_MODE_CMD_COL_INDEX ]; + U08 commandInIndex0 = bloodLeakEmbModeCmdSeq[ BLOOD_LEAK_EMB_MODE_REQUEST_RX_INDEX ][ BLOOD_LEAK_EMB_MODE_CMD_COL_INDEX ]; + bloodLeakEmbModeHasRxRqstBeenSent = ( BLOOD_LEAK_EMB_MODE_COMM_READ_REQST == commandInIndex0 ? TRUE : FALSE ); bloodLeakUARTCmdIndex = 0; bloodLeakEmbModeCmdSeqLength = 0; @@ -1254,6 +1267,7 @@ data.bloodLeakStatus = (U32)getBloodLeakStatus(); data.bloodLeakState = (U32)bloodLeakState; + data.bloodLeakPersitentCounter = bloodLeakPersistenceCtr; bloodLeakDataPublicationCounter = 0; broadcastData( MSG_ID_HD_BLOOD_LEAK_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( BLOOD_LEAK_DATA_T ) ); @@ -1484,7 +1498,20 @@ } } +/*********************************************************************//** + * @brief + * The getBloodLeakRxBytesAvailable function returns the number of received + * bytes available from FPGA. + * @details Inputs: none + * @details Outputs: none + * @return Number of received bytes available + *************************************************************************/ +static U16 getBloodLeakRxBytesAvailable( void ) +{ + return getFPGABloodLeakRxFIFOCount() & BLOOD_LEAK_RXFIFO_COUNT_MASK; +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1641,9 +1668,4 @@ return result; } -static U16 getBloodLeakRxBytesAvailable( void ) -{ - return getFPGABloodLeakRxFIFOCount() & BLOOD_LEAK_RXFIFO_COUNT_MASK; -} - /**@}*/ Index: firmware/App/Controllers/BloodLeak.h =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -46,6 +46,7 @@ { U32 bloodLeakStatus; ///< Blood leak detector status U32 bloodLeakState; ///< Blood leak detector state + U32 bloodLeakPersitentCounter; ///< Blood leak detector persistent counter } BLOOD_LEAK_DATA_T; // ********** public function prototypes ********** Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r0b084a3430750d40473bbd5dc3cdc2d73f4163d2 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 0b084a3430750d40473bbd5dc3cdc2d73f4163d2) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -1065,7 +1065,7 @@ { BOOL start = TRUE; dgCmdResp[ DG_CMD_START_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** @@ -1080,11 +1080,55 @@ { BOOL start = FALSE; dgCmdResp[ DG_CMD_STOP_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** * @brief + * The cmdStopDGActiveCool function sends a stop active cool command + * message to the DG. + * @details Inputs: none + * @details Outputs: stop active cool mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGActiveCool( void ) +{ + dgCmdResp[ DG_CMD_STOP_ACTIVE_COOL ].commandID = DG_CMD_NONE; + sendDGStopActiveCoolModeCommand(); +} + +/*********************************************************************//** + * @brief + * The cmdStartDGROPermeateSampleMode function sends an RO permeate sample + * start command message to the DG. + * @details Inputs: none + * @details Outputs: start RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStartDGROPermeateSampleMode( void ) +{ + BOOL start = TRUE; + dgCmdResp[ DG_CMD_START_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief + * The cmdStopDGROPermeateSampleMode function sends an RO permeate sample + * stop command message to the DG. + * @details Inputs: none + * @details Outputs: stop RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGROPermeateSampleMode( void ) +{ + BOOL start = FALSE; + dgCmdResp[ DG_CMD_STOP_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief * The cmdRequestDGConcentrateRatios function sends a request to DG to receive * the concentrate ratios. * @details Inputs: none Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r0b084a3430750d40473bbd5dc3cdc2d73f4163d2 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 0b084a3430750d40473bbd5dc3cdc2d73f4163d2) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -154,6 +154,9 @@ void cmdStopDGChemicalDisinfect( void ); void cmdStartDGChemicalFlushDisinfect( void ); void cmdStopDGChemFlushDisinfect( void ); +void cmdStopDGActiveCool( void ); +void cmdStartDGROPermeateSampleMode( void ); +void cmdStopDGROPermeateSampleMode( void ); void cmdRequestDGMixingRatios( void ); void cmdSetDGToServiceMode( void ); Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r81ae33c257ff53595ecdd9c06d23594dd70fb198 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 81ae33c257ff53595ecdd9c06d23594dd70fb198) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -632,11 +632,11 @@ break; case DG_MODE_HCOL: - // TODO stop active cool + cmdStopDGActiveCool(); break; case DG_MODE_ROPS: - // TODo stop ro permeate sample + cmdStopDGROPermeateSampleMode(); break; } break; @@ -817,7 +817,7 @@ break; case DG_MODE_ROPS: - // TODo start ro permeate sample + cmdStartDGROPermeateSampleMode(); break; } state = STANDBY_WAIT_FOR_DG_CLEANING_MODE_CMD_RESPONSE_STATE; @@ -848,7 +848,6 @@ if ( DG_CMD_REQUEST_REJECT_REASON_NONE == dgCmdResp.rejectCode ) { - state = STANDBY_WAIT_FOR_DG_CLEANING_MODE_TO_START_STATE; result = TRUE; } Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra37189e75de205982befcc91176f33c0523b03a8 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a37189e75de205982befcc91176f33c0523b03a8) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -1811,7 +1811,7 @@ /*********************************************************************//** * @brief - * The sendDGStartChemicalDisinfectFlushModeCommand function constructs a DG + * The sendDGStartStopChemicalDisinfectFlushModeCommand function constructs a DG * start/stop chemical disinfect flush mode command message and queues the msg * for transmit on the appropriate CAN channel. * @details Inputs: none @@ -1820,7 +1820,7 @@ * @param start TRUE indicates start chemical disinfect flush mode * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendDGStartChemicalDisinfectFlushModeCommand( BOOL start ) +BOOL sendDGStartStopChemicalDisinfectFlushModeCommand( BOOL start ) { BOOL result; MESSAGE_T msg; @@ -3421,7 +3421,46 @@ serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_NOT_REQUIRED ); } +// MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL +BOOL sendDGStopActiveCoolModeCommand( void ) +{ + BOOL result; + MESSAGE_T msg; + BOOL start = FALSE; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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_HD_2_DG, ACK_REQUIRED ); + + return result; +} + +// MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST +BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ) +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ); + + memcpy( msg.payload, &start, sizeof( BOOL ) ); + + // 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_HD_2_DG, ACK_REQUIRED ); + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -re5167d0700038c1faf8b689b844a905f20c0d3c6 -r41a41275952290677df1fb0d27db3f354be26dd8 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision e5167d0700038c1faf8b689b844a905f20c0d3c6) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 41a41275952290677df1fb0d27db3f354be26dd8) @@ -474,7 +474,7 @@ BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ); // MSG_ID_DG_START_STOP_CHEM_DISINFECT_FLUSH -BOOL sendDGStartChemicalDisinfectFlushModeCommand( BOOL start ); +BOOL sendDGStartStopChemicalDisinfectFlushModeCommand( BOOL start ); // MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ); @@ -547,6 +547,12 @@ // MSG_ID_HD_SEND_CHEM_FLUSH_SAMPLE_PASS_FAIL_TO_DG void handleSendChemFlushPassFailToDG( U32 status ); +// MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL +BOOL sendDGStopActiveCoolModeCommand( void ); + +// MSG_ID_DG_START_STOP_RO_PERMEATE_SAMPLE_MODE_CMD_REQUEST +BOOL sendDGStartStopDGROPermeateSampleModeCommand( BOOL start ); + // *********** public test support message functions ********** // MSG_TESTER_LOG_IN