Index: firmware/App/Controllers/DialysatePumps.c =================================================================== diff -u -rc85d9f0a8023fabdf1cd557965958d225e2b9085 -r48ca7fd644c67920acc29a80b7af379d0a134d1a --- firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision c85d9f0a8023fabdf1cd557965958d225e2b9085) +++ firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision 48ca7fd644c67920acc29a80b7af379d0a134d1a) @@ -114,6 +114,19 @@ U08 control; ///< Dialysate pump control } DIALYSATE_PUMP_DATA_T; +/// Payload record structure for dialysate pump start request +typedef struct +{ + U32 pumpID; ///< Pump ID Fresh(DGP) : 0, Spent ( SDP) : 1 + U32 rpm; ///< Speed range from 300 to 4500 RPM range +} DIAL_PUMP_START_CMD_PAYLOAD_T; + +/// Payload record structure for dialysate pump stop request +typedef struct +{ + U32 pumpID; ///< Pump ID Fresh(DGP) : 0, Spent ( SDP) : 1 +} DIAL_PUMP_STOP_CMD_PAYLOAD_T; + // ********** private data ********** static U32 dialysatePumpDataPublicationTimerCounter; ///< Used to schedule dialysate pump data publication to CAN bus. @@ -1029,4 +1042,74 @@ return result; } +/*********************************************************************//** + * @brief + * The testDialysatePumpStartOverride function starts a given dialysate pump + * at mentioned RPM. + * @details \b Inputs: tester logged in + * @details \b Outputs: dialysatePumps[] + * @param message set message from Dialin which includes the dialysate pump to set + * and the state to set the dialysate pump to. + * @return TRUE if set request is successful, FALSE if not + *************************************************************************/ +BOOL testDialysatePumpStartOverride( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify tester has logged in with TD + if ( TRUE == isTestingActivated() ) + { + // Verify payload length is valid + if ( sizeof( DIAL_PUMP_START_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) + { + DIAL_PUMP_START_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DIAL_PUMP_START_CMD_PAYLOAD_T) ); + + if ( ( (DIALYSATE_PUMPS_T)payload.pumpID < NUM_OF_DIALYSATE_PUMPS ) && + ( ( payload.rpm >= MIN_DIALYSATE_PUMP_RPM ) && ( payload.rpm <= MAX_DIALYSATE_PUMP_RPM ) ) ) + { + setDialysatePumpTargetRPM( (DIALYSATE_PUMPS_T) payload.pumpID, payload.rpm ); + result = TRUE; + } + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testDialysatePumpStopOverride function stops a given dialysate pump. + * @details \b Inputs: tester logged in + * @details \b Outputs: dialysatePumps[] + * @param message set message from Dialin which includes the dialysate pump to set + * and the state to set the dialysate pump to. + * @return TRUE if set request is successful, FALSE if not + *************************************************************************/ +BOOL testDialysatePumpStopOverride( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify tester has logged in with TD + if ( TRUE == isTestingActivated() ) + { + // Verify payload length is valid + if ( sizeof( DIAL_PUMP_STOP_CMD_PAYLOAD_T ) == message->hdr.payloadLen ) + { + DIAL_PUMP_STOP_CMD_PAYLOAD_T payload; + + memcpy( &payload, message->payload, sizeof(DIAL_PUMP_STOP_CMD_PAYLOAD_T) ); + + if ( (DIALYSATE_PUMPS_T)payload.pumpID < NUM_OF_DIALYSATE_PUMPS ) + { + signalDialysatePumpHardStop( (DIALYSATE_PUMPS_T)payload.pumpID ); + result = TRUE; + } + } + } + + return result; +} + /**@}*/