Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -61,11 +61,12 @@ #define DATA_PUBLISH_COUNTER_START_COUNT 60 ///< Data publish counter start count. -// Calibration mode defines +// Embedded mode defines #define BLOOD_LEAK_EMB_MODE_CMD_SEQ_LENGTH 4 ///< Blood leak embedded mode command sequence length. #define BLOOD_LEAK_EMB_MODE_STOP_INDEX 1 ///< Blood leak embedded mode stop writing to FIFO index. #define BLOOD_LEAK_EMB_MODE_COMM_ACTIVE_HIGH 5 ///< Blood leak embedded mode communication active high command. #define BLOOD_LEAK_EMB_MODE_COMM_ACTIVE_LOW 4 ///< Blood leak embedded mode communication active low command. +#define BLOOD_LEAK_EMB_MODE_COMM_READ_REQST 8 ///< Blood leak embedded mode communication read Rx byte request. #define BLOOD_LEAK_EMB_MODE_RX_TIMEOUT_MS ( 5 * MS_PER_SECOND ) ///< Blood leak embedded mode calibration receive timeout in milliseconds. #define BLOOD_LEAK_EMB_MODE_RX_BUFFER_EMPTY 0x80 ///< Blood leak embedded mode buffer empty value. #define BLOOD_LEAK_EMB_MODE_RESP_BUFFER_LEN 5 ///< Blood leak embedded mode number of commands. @@ -878,7 +879,6 @@ case SP_EMB_MODE_CMD: prepareSetPointSeq( bloodLeakEmbModeSetPoint ); - bloodLeakEmbModeNumOfCmdTries = 0; state = BLOOD_LEAK_CAL_SEND_COMMAND_STATE; break; @@ -918,7 +918,6 @@ command = bloodLeakEmbModeCmdSquence[ bloodLeakUARTCmdIndex ]; isUARTTxDone = ( bloodLeakUARTCmdIndex <= BLOOD_LEAK_EMB_MODE_STOP_INDEX ? FALSE : TRUE ); isUARTCtrlDone = ( bloodLeakUARTCmdIndex > ( BLOOD_LEAK_EMB_MODE_CMD_SEQ_LENGTH - 1 ) ? TRUE : FALSE ); - bloodLeakUARTCmdIndex++; break; @@ -931,7 +930,6 @@ command = bloodLeakSetPointSequence[ bloodLeakUARTCmdIndex ]; isUARTTxDone = ( bloodLeakUARTCmdIndex >= activeHighIndex ? TRUE : FALSE ); isUARTCtrlDone = ( bloodLeakUARTCmdIndex > bloodLeakSetPointSeqLength ? TRUE : FALSE ); - bloodLeakUARTCmdIndex++; } break; @@ -956,12 +954,14 @@ else { // Reset the variables for the next - bloodLeakEmbModeOpsStartTime = getMSTimerCount(); - bloodLeakUARTCmdIndex = 0; - bloodLeakEmbModeRespIndex = 0; - state = BLOOD_LEAK_CAL_WAIT_FOR_COMMAND_RESPONSE_STATE; + bloodLeakEmbModeOpsStartTime = getMSTimerCount(); + bloodLeakUARTCmdIndex = 0; + bloodLeakEmbModeRespIndex = 0; + state = BLOOD_LEAK_CAL_WAIT_FOR_COMMAND_RESPONSE_STATE; memset( bloodLeakEmbModeRespBuffer, 0x0, BLOOD_LEAK_EMB_MODE_RESP_BUFFER_LEN ); + // TODO is this the right place for the first request? + setFPGABloodLeakUARTControl( BLOOD_LEAK_EMB_MODE_COMM_READ_REQST ); } return state; @@ -1006,15 +1006,13 @@ if ( ( expChar1 == data ) && ( 0 == bloodLeakEmbModeRespIndex ) ) { bloodLeakEmbModeRespBuffer[ bloodLeakEmbModeRespIndex ] = data; - bloodLeakEmbModeRespIndex++; } // Check if the buffer index is > 0 so the first char has been inserted and the rest is data but it is not the echo of the command // For instance, V has been inserted and XXXX is inserted that is followed by V. So V123 and not VVV12. else if ( ( bloodLeakEmbModeRespIndex > 0 ) && ( data != expChar1 ) ) { bloodLeakEmbModeRespBuffer[ bloodLeakEmbModeRespIndex ] = data; - bloodLeakEmbModeRespIndex++; } } @@ -1028,7 +1026,6 @@ if ( ( expChar1 == data ) || ( expChar2 == data ) ) { bloodLeakEmbModeRespBuffer[ bloodLeakEmbModeRespIndex ] = data; - bloodLeakEmbModeRespIndex++; } } @@ -1051,7 +1048,6 @@ if ( ( data >= BLOOD_LEAK_EMB_MODE_0_NUM_ASCII ) && ( data <= BLOOD_LEAK_EMB_MODE_9_NUM_ASCII ) ) { bloodLeakEmbModeRespBuffer[ bloodLeakEmbModeRespIndex ] = data; - bloodLeakEmbModeRespIndex++; } } @@ -1067,11 +1063,12 @@ if ( ( data >= BLOOD_LEAK_EMB_MODE_0_NUM_ASCII ) && ( data <= BLOOD_LEAK_EMB_MODE_9_NUM_ASCII ) ) { bloodLeakEmbModeRespBuffer[ bloodLeakEmbModeRespIndex ] = data; - bloodLeakEmbModeRespIndex++; } } } + // Send another request to the FPGA to read the next data in the buffer + setFPGABloodLeakUARTControl( BLOOD_LEAK_EMB_MODE_COMM_READ_REQST ); } // If wait for the receive FIFO has timed out or all there is no buffer left in the Rx FIFO transition back to wait for command state for the next command @@ -1086,7 +1083,6 @@ else { U08 i; - BOOL isNull = FALSE; for ( i = 0; i < length; i++ ) @@ -1108,7 +1104,6 @@ { bloodLeakEmbModeRqstedCmd = NU_EMB_MODE_CMD; state = BLOOD_LEAK_CAL_WAIT_FOR_COMAND_STATE; - handleSendBloodLeakEmbeddedModeCommandResponse( length, bloodLeakEmbModeRespBuffer ); } } Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -64,6 +64,9 @@ F32 tempAvgFill; ///< Average fill temperature in C F32 tempLastFill; ///< Last fill temperature in C F32 timereservoirFillMS; ///< Reservoir fill time in milliseconds + F32 tempRsrvr0ActualTrimmer; ///< Temperature actual reservoir in C. + F32 tempFillMixAvgTrimmer; ///< Temperature fill mix average trimmer in C. + F32 tempRsrvrEndFillTrimmer; ///< Temperature reservoir end fill trimmer in C. } DG_RESERVOIRS_DATA_PAYLOAD_T; /// Payload record structure for DG temperature sensors data message. Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -107,14 +107,14 @@ { consumableInstallConfirmed = FALSE; #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONSUMABLES_TESTS ) != SW_CONFIG_ENABLE_VALUE ) + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONSUMABLES_TESTS ) ) { - currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_FILL_CMD_STATE; + currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_COMPLETE_STATE; } else #endif { - currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_COMPLETE_STATE; + currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_FILL_CMD_STATE; } } break; Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -542,16 +542,17 @@ { PRE_TREATMENT_STATE_DATA_T preTreatmentData; - preTreatmentData.preTreatmentSubMode = currentPreTreatmentState; - preTreatmentData.sampleWaterState = getSampleWaterState(); + preTreatmentData.preTreatmentSubMode = currentPreTreatmentState; + preTreatmentData.sampleWaterState = getSampleWaterState(); preTreatmentData.consumableSelfTestsState = getConsumableSelfTestState(); - preTreatmentData.noCartSelfTestsState = getNoCartSelfTestsState(); - preTreatmentData.installState = 0; - preTreatmentData.drySelfTestsState = getDrySelfTestsState(); - preTreatmentData.primeState = getPrimeState(); - preTreatmentData.recircState = getPreTreatmentRecircState(); - preTreatmentData.patientConnectionState = 0; - preTreatmentData.wetSelfTestsState = getWetSelfTestState(); + preTreatmentData.noCartSelfTestsState = getNoCartSelfTestsState(); + preTreatmentData.installState = 0; + preTreatmentData.drySelfTestsState = getDrySelfTestsState(); + preTreatmentData.primeState = getPrimeState(); + preTreatmentData.recircState = getPreTreatmentRecircState(); + preTreatmentData.patientConnectionState = 0; + preTreatmentData.wetSelfTestsState = getWetSelfTestState(); + preTreatmentData.preTreatmentRsrvrState = currentReservoirMgmtState; broadcastData( MSG_ID_PRE_TREATMENT_STATE, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&preTreatmentData, sizeof( PRE_TREATMENT_STATE_DATA_T ) ); preTreatmentPublishTimerCounter = 0; @@ -1094,12 +1095,12 @@ } else { - U32 volume = FILL_RESERVOIR_TO_VOLUME_ML; + U32 volume = PRE_TREATMENT_FLUSH_RESERVOIR_VOLUME_ML; #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRIMING ) != SW_CONFIG_ENABLE_VALUE ) + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRIMING ) ) { - volume = PRE_TREATMENT_FLUSH_RESERVOIR_VOLUME_ML; + volume = FILL_RESERVOIR_TO_VOLUME_ML; } #endif Index: firmware/App/Modes/ModePreTreat.h =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -45,6 +45,7 @@ U32 recircState; ///< Current re-circulate state U32 patientConnectionState; ///< Current patient connection state U32 wetSelfTestsState; ///< CUrrent wet self-tests state + U32 preTreatmentRsrvrState; ///< Current pre-treatment reservoir state } PRE_TREATMENT_STATE_DATA_T; // ********** public function prototypes ********** Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -239,9 +239,9 @@ U08 arterialPressureReadCount; ///< Reg 444. Arterial pressure sensor read count. U08 arterialPressureErrorCount; ///< Reg 445. Arterial pressure sensor error count. U08 bloodLeakTxFIFOCount; ///< Reg 446. Blood leak transmit FIFO count. - U08 bloodLeakRxFIFOCount; ///< Reg 447. Blood leak receive FIFO count. - U08 bloodLeakRxErrorCount; ///< Reg 448. Blood leak receive error count. - U08 bloodLeakRxFIFODataOut; ///< Reg 449. Blood leak receive FIFO data out. + U08 bloodLeakRxErrorCount; ///< Reg 447. Blood leak receive error count. + U16 bloodLeakRxFIFOCount; ///< Reg 448. Blood leak receive FIFO count. + U08 bloodLeakRxFIFODataOut; ///< Reg 450. Blood leak receive FIFO data out. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -2195,7 +2195,7 @@ * @details Outputs: none * @return fpgaSensorReadings.bloodLeakRxFIFOCount *************************************************************************/ -U08 getFPGABloodLeakRxFIFOCount( void ) +U16 getFPGABloodLeakRxFIFOCount( void ) { return fpgaSensorReadings.bloodLeakRxFIFOCount; } Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rd558c3058a027d8f4407c7bb882505e30225a7f9 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) @@ -141,7 +141,7 @@ U16 getFPGABloodLeakLEDIntensity( void ); U16 getFPGABloodLeakRegisterCounter( void ); U08 getFPGABloodLeakTxFIFOCount( void ); -U08 getFPGABloodLeakRxFIFOCount( void ); +U16 getFPGABloodLeakRxFIFOCount( void ); U08 getFPGABloodLeakRxErrorCount( void ); U08 getFPGABloodLeakRxFIFODataOut( void );