Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r1b738450008f53cdacc28226a503593bb54ba901 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 1b738450008f53cdacc28226a503593bb54ba901) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -22,7 +22,8 @@ #include "NVDataMgmt.h" #include "OperationModes.h" #include "PersistentAlarm.h" -#include "SystemCommMessages.h" +#include "SystemCommMessages.h" +#include "SelfTests.h" #include "TaskGeneral.h" #include "Temperatures.h" #include "Timers.h" @@ -70,6 +71,7 @@ #define PSI_TO_MMHG ( 51.7149F ) ///< Conversion factor for converting PSI to mmHg. +// The new arterial pressure sensor is the same as the venous pressure sensor #define VENOUS_PRESSURE_NORMAL_OP 0 ///< Venous pressure status bits indicate normal operation. #define VENOUS_PRESSURE_CMD_MODE 1 ///< Venous pressure status bits indicate sensor in command mode. #define VENOUS_PRESSURE_STALE_DATA 2 ///< Venous pressure status bits indicate data is stale (no new data since last fpga read). @@ -661,7 +663,7 @@ static void checkOcclusions( void ) { U32 bpOccl = getMeasuredBloodPumpOcclusion(); - BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); + BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) @@ -679,14 +681,42 @@ SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, bpOccl ); } - // Check for BP occlusion - if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + + // Check for occlusion in PreTreatment modes when the cartridge is installed + // and setOcclusionInstallLevel has been called. + if( MODE_PRET == getCurrentOperationMode() ) { - signalBloodPumpHardStop(); // Stop pump immediately - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + // Check for BP occlusion + if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { + if( getPreTreatmentSubState() > HD_PRE_TREATMENT_CART_INSTALL_STATE && getDrySelfTestsState() > DRY_SELF_TESTS_START_STATE ) + { + // Check for occlusion + if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { + signalBloodPumpHardStop(); // Stop pump immediately + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + } + } + } } - else + // Check for occlusion in PreTreatment modes where pumps are moving + else if( MODE_TREA == getCurrentOperationMode() ) { + if( TREATMENT_STOP_STATE != getTreatmentState()) + { + // Check for occlusion + if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { + signalBloodPumpHardStop(); // Stop pump immediately + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + } + } + } + + // Clear alarm regardless of op mode once conditions are met. + if ( bpOccl <= ( OCCLUSION_CLEAR_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { clearAlarmCondition( ALARM_ID_OCCLUSION_BLOOD_PUMP ); } Index: firmware/App/HDCommon.h =================================================================== diff -u -r74ffac3f87a1a03c1a4282d6a6ac9db8c9b1a432 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 74ffac3f87a1a03c1a4282d6a6ac9db8c9b1a432) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -10,8 +10,8 @@ * @author (last) Dara Navaei * @date (last) 23-May-2022 * -* @author (original) Sean -* @date (original) 27-Feb-2020 +* @author (original) Sean +* @date (original) 27-Feb-2020 * ***************************************************************************/ @@ -25,7 +25,7 @@ #define HD_VERSION_MAJOR 0 #define HD_VERSION_MINOR 6 #define HD_VERSION_MICRO 0 -#define HD_VERSION_BUILD 46 +#define HD_VERSION_BUILD 307 // ********** development build switches ********** @@ -46,9 +46,9 @@ #define DISABLE_UI_POST_TEST 1 // Disable the UI POST // TODO stays as a build switch until the calibration structure is updated with the build - #define SKIP_CAL_CHECK 1 // Implement software configuration + #define SKIP_CAL_CHECK 1 // Implement software configuration once the build switch is done - #include +#include #include #endif #endif Index: firmware/App/Modes/Prime.c =================================================================== diff -u -raceb6e5388e905d119c5c379bc97ced0720aa270 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision aceb6e5388e905d119c5c379bc97ced0720aa270) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -52,7 +52,7 @@ #define DIALYZER_VOLUME_SCALE_FACTOR 0.5F ///< Half of the dialyzer total volume. #define NO_AIR_DETECTED_COUNT ( 20 * MS_PER_SECOND ) ///< No air detected time period count. -#define PURGE_AIR_TIME_OUT_COUNT ( 60 * MS_PER_SECOND ) ///< Time period count for purge air time out. +#define PURGE_AIR_TIME_OUT_COUNT ( 120 * MS_PER_SECOND ) ///< Time period count for purge air time out. #define LOAD_CELL_STEADY_VOLUME_SAMPLING_TIME ( 1 * MS_PER_SECOND ) ///< Time load cell reading steady state detection sampling time in seconds. #define PRIME_DIALYSATE_BYPASS_TIME_LIMIT ( 15 * MS_PER_SECOND ) ///< Time limit for priming dialysate bypass circuit. #define STEADY_VOLUME_COUNT_SEC ( 10000 / LOAD_CELL_STEADY_VOLUME_SAMPLING_TIME ) ///< Counter must be greater than 10 seconds before steady volume is true. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r1b738450008f53cdacc28226a503593bb54ba901 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1b738450008f53cdacc28226a503593bb54ba901) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -52,8 +52,7 @@ #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window #define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd - -#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST +#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST #define MSG_NOT_ACKED_MAX_RETRIES 3 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< Maximum number of Denali messages that can be pending ACK at any given time @@ -1615,10 +1614,6 @@ handleTestSyringePumpHeprinBolusTargetRateOverrideRequest( message ); break; - case MSG_ID_HD_REQ_CURRENT_TREATMENT_PARAMETERS: - handleTestCurrentTreamtmentParametersRequest( message ); - break; - case MSG_ID_HD_FANS_DUTY_CYCLE_OVERRIDE: handleSetFansDutyCycleOverrideRequest( message ); break; @@ -1655,6 +1650,7 @@ handleResendAllAlarmsCommand( message ); break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1b738450008f53cdacc28226a503593bb54ba901 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1b738450008f53cdacc28226a503593bb54ba901) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -28,6 +28,7 @@ #include "Fans.h" #include "FPGA.h" #include "ModeStandby.h" +#include "ModeInitPOST.h" #include "OperationModes.h" #include "RTC.h" #include "SampleWater.h" @@ -2359,13 +2360,13 @@ { TEMPERATURE_SENSORS_DATA_T payload; - memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant ); - } - // TODO - what to do if invalid payload length? - // TODO - how to know if DG stops sending these? -} - + memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); + setDialysateTemperatureReadings( payload.TDi, payload.TRo ); + } + // TODO - what to do if invalid payload length? + // TODO - how to know if DG stops sending these? +} + /*********************************************************************//** * @brief * The handleDialysateFlowData function handles dialysate flow data broadcast @@ -5155,6 +5156,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingPercentOverride( payload.state.u32 ); @@ -7030,15 +7032,26 @@ { BOOL status = FALSE; HD_OP_MODE_T currentMode = getCurrentOperationMode(); + DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { - status = TRUE; + requestNewOperationMode( MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; + + if ( (DG_MODE_STAN == currentDGMode) || (DG_MODE_FAUL == currentDGMode) ) + { + status = TRUE; + cmdSetDGToServiceMode(); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } } else { @@ -7316,4 +7329,28 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The sendDGServiceModeRequest function constructs a service mode request msg + * to the DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG Service mode request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceModeRequest() +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_SERVICE_MODE; + msg.hdr.payloadLen = 0; + + // 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; +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1b738450008f53cdacc28226a503593bb54ba901 -re15a3675797c4a4099aa9a12ca6811dc75568dd1 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1b738450008f53cdacc28226a503593bb54ba901) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision e15a3675797c4a4099aa9a12ca6811dc75568dd1) @@ -395,6 +395,9 @@ // MSG_ID_DG_START_STOP_CHEM_DISINFECT BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ); +// MSG_ID_HD_REQUEST_DG_SERVICE_MODE +BOOL sendDGServiceModeRequest(); + // MSG_ID_ALARM_STATUS BOOL broadcastAlarmStatus( COMP_ALARM_STATUS_T almStatus ); @@ -422,9 +425,6 @@ // MSG_ID_HD_SET_SW_CONFIG_RECORD void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ); -// MSG_ID_UI_REQUEST_SERVICE_MODE -void handleUIServiceModeRequest( MESSAGE_T *message ); -void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ); // MSG_ID_HD_REQUEST_DG_ALARMS BOOL sendRequestForDGResendAlarms( void );