Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r53dd658c22a8e91597304b1aff96fee43b7b8c49 -r62cbfbbd0d1baa7b1f383510b7864921e2dfd054 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 53dd658c22a8e91597304b1aff96fee43b7b8c49) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 62cbfbbd0d1baa7b1f383510b7864921e2dfd054) @@ -34,7 +34,7 @@ #define BLOOD_LEAK_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the blood leak data is published on the CAN bus. #define BLOOD_LEAK_TIMEOUT_MS 500 ///< Blood leak detector timeout for zeroing and self-test (15 ms extended edge detection) -#define BLOOD_LEAK_PERSISTENCE ( 5 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Persistence for blood leak detected alarm. +#define BLOOD_LEAK_PERSISTENCE ( 10 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Persistence for blood leak detected alarm. #define BLOOD_LEAK_RESET_TX_FIFO 2 ///< Blood leak reset transmit FIFO command. #define BLOOD_LEAK_START_COMM_CTRL_U_ASCII 21 ///< Blood leak start communication command, ^U (Ctrl-U) in ascii. #define BLOOD_LEAK_UART_COMM_ACTIVE_LOW 0 ///< Blood leak UART communication active low command. @@ -92,6 +92,8 @@ BLOOD_LEAK_UART_COMM_ACTIVE_HIGH, BLOOD_LEAK_UART_COMM_ACTIVE_LOW }; +static U32 tempRemoveThis = 0; + // ********** private function prototypes ********** static BLOOD_LEAK_STATES_T handleBloodLeakStartupState( void ); @@ -151,6 +153,7 @@ { U32 length = sizeof( HD_BLOOD_LEAK_SENSOR_CAL_RECORD_T ); getCalibrationRecord2Driver( GET_CAL_BLOOD_LEAK_SENSOR, (U08*)&bloodLeakCalRecord, length, ALARM_ID_HD_BLOOD_LEAK_INVALID_CAL_RECORD ); + prepareSetPointSeq(); // Force the state machine to go back to set the set point that has been received from // the calibration data @@ -301,7 +304,7 @@ } else { - // TODO fault alarm that we cannot write to blood leak? + activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_SENSOR_SET_POINT_SET_FAILURE ); } } @@ -332,7 +335,7 @@ // The active high index is the length - 2 they are the last two elements U32 activeHighIndex = bloodLeakSetPointSeqLength - 2; - // Check if the current index towards the end of the buffer which are 1 and 0 + // Check if the current index towards the end of the buffer which are FIFO set and FIFO reset if( activeHighIndex > bloodLeakUARTCmdIndex ) { setFPGABloodLeakUARTTransmit( (U08)command ); @@ -343,17 +346,29 @@ } bloodLeakUARTCmdIndex++; + + // TODO remove + tempRemoveThis = getMSTimerCount(); + // TODO remove } else { - if ( ++bloodLeakWait2ReadSetPointCounter > BLOOD_LEAK_WAIT_2_READ_SET_POINT ) + // TODO remove this is temporary code + U16 bld = getFPGABloodLeakDetectSetPoint(); + if ( bld == bloodLeakCalRecord.setPoint ) { + U32 timeout = calcTimeSince(tempRemoveThis); + state = BLOOD_LEAK_INIT_STATE; + } + // TODo Remove this is temporary code + + /*if ( ++bloodLeakWait2ReadSetPointCounter > BLOOD_LEAK_WAIT_2_READ_SET_POINT ) + { bloodLeakWait2ReadSetPointCounter = 0; bloodLeakUARTCmdIndex = 0; - // Done with writing the set point state = BLOOD_LEAK_CHECK_SET_POINT_STATE; - } + }*/ } return state; Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rf3c8ef49b4bef41b606325e3db0e053a7a72d98f -r62cbfbbd0d1baa7b1f383510b7864921e2dfd054 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision f3c8ef49b4bef41b606325e3db0e053a7a72d98f) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 62cbfbbd0d1baa7b1f383510b7864921e2dfd054) @@ -82,7 +82,9 @@ // Reservoir data static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. -static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. +static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. + +// TODO remove below variables static U32 dgReservoirFillVolumeTarget = 0; ///< Latest fill-to volume reported by the DG. static U32 dgReservoirFillVolumeTargetSet = 0; ///< Fill-to volume commanded. static U32 dgReservoirDrainVolumeTarget = 0; ///< Latest drain-to volume reported by the DG. @@ -180,8 +182,6 @@ timeStartMS = getMSTimerCount(); } - - /*********************************************************************//** * @brief * The getDGOpMode function gets the current DG operating mode. Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -rf3c8ef49b4bef41b606325e3db0e053a7a72d98f -r62cbfbbd0d1baa7b1f383510b7864921e2dfd054 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision f3c8ef49b4bef41b606325e3db0e053a7a72d98f) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 62cbfbbd0d1baa7b1f383510b7864921e2dfd054) @@ -55,15 +55,15 @@ U32 resID; ///< Active reservoir ID U32 setFillToVolumeMl; ///< Reservoir set fill to target volume in ml U32 setDrainToVolumeMl; ///< Reservoir set drain to target volume in ml - U32 timeReservoirCycleMS; - U32 timeReservoirFill2SwitchMS; - F32 timeUFDecayMS; - F32 tempUFFill; - F32 tempReservoirUseActual; - F32 tempReservoirEndFill; - F32 tempAvgFill; - F32 tempLastFill; - F32 timereservoirFill; + U32 timeReservoirCycleMS; ///< Reservoir time cycle in milliseconds + U32 timeReservoirFill2SwitchMS; ///< Reservoir time fill to switch in milliseconds + F32 timeUFDecayMS; ///< Ultrafilter decay time in milliseconds + F32 tempUFFill; ///< Ultrafilter fill temperature in C + F32 tempReservoirUseActual; ///< Reservoir actual use temperature in C + F32 tempReservoirEndFill; ///< Reservoir end of the fill temperature in C + F32 tempAvgFill; ///< Average fill temperature in C + F32 tempLastFill; ///< Last fill temperature in C + F32 timereservoirFillMS; ///< Reservoir fill time in milliseconds } DG_RESERVOIRS_DATA_PAYLOAD_T; /// Payload record structure for DG temperature sensors data message. Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r2a6ac80309cb52922f856b3eb4ff2c876b44c0d6 -r62cbfbbd0d1baa7b1f383510b7864921e2dfd054 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 2a6ac80309cb52922f856b3eb4ff2c876b44c0d6) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 62cbfbbd0d1baa7b1f383510b7864921e2dfd054) @@ -2344,11 +2344,11 @@ *************************************************************************/ void handleDGReservoirData( MESSAGE_T *message ) { - if ( message->hdr.payloadLen == sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ) + if ( message->hdr.payloadLen == sizeof( DG_RESERVOIRS_DATA_PAYLOAD_T ) ) { DG_RESERVOIRS_DATA_PAYLOAD_T payload; - memcpy( &payload, message->payload, sizeof(DG_RESERVOIRS_DATA_PAYLOAD_T) ); + memcpy( &payload, message->payload, sizeof( DG_RESERVOIRS_DATA_PAYLOAD_T ) ); setDGReservoirsData( (DG_RESERVOIR_ID_T)payload.resID, payload.setFillToVolumeMl, payload.setDrainToVolumeMl ); } }