Index: dialin/common/hd_defs.py =================================================================== diff -u -r875bce283a91757d2e80647987b8276514bd376b -r16a0f3e2aa815027958118fac18fbb17baf32b5c --- dialin/common/hd_defs.py (.../hd_defs.py) (revision 875bce283a91757d2e80647987b8276514bd376b) +++ dialin/common/hd_defs.py (.../hd_defs.py) (revision 16a0f3e2aa815027958118fac18fbb17baf32b5c) @@ -49,32 +49,31 @@ @unique class HDInitStates(DialinEnum): - POST_STATE_START = 0 # Start initialize & POST mode state - POST_STATE_FW_INTEGRITY = 1 # Run firmware integrity test state - POST_STATE_AC = 2 # Check HD has AC power - power off if not - POST_STATE_WATCHDOG = 3 # Run watchdog test state - POST_STATE_SAFETY_SHUTDOWN = 4 # Run safety shutdown test state - POST_STATE_RTC = 5 # Run RTC test state - POST_STATE_NVDATAMGMT = 6 # Run NV Data Mgmt. test state - POST_STATE_BLOOD_FLOW = 7 # Run blood flow test state - POST_STATE_DIALYSATE_INLET_FLOW = 8 # Run dialysate inlet flow test state - POST_STATE_DIALYSATE_OUTLET_FLOW = 9 # Run dialysate outlet flow test state - POST_STATE_BLOOD_LEAK = 10 # Run blood leak sensor test state - POST_STATE_VALVES = 11 # Run valves test state - POST_STATE_SYRINGE_PUMP = 12 # Run syringe pump test state - POST_STATE_PRES_OCCL = 13 # Run pressure occlusion state - POST_STATE_ALARM_AUDIO = 14 # Run alarm audio test state - POST_STATE_ALARM_LAMP = 15 # Run alarm lamp test state - POST_STATE_ACCELEROMETER = 16 # Run Accelerometer test state - POST_STATE_TEMPERATURES = 17 # Run temperatures POST state - POST_STATE_FANS = 18 # Run fans POST state - POST_STATE_STUCK_BUTTON = 19 # Run stuck button test state - POST_STATE_UI_POST = 20 # Check whether UI passed its POST tests - POST_STATE_FW_COMPATIBILITY = 21 # Run firmware compatibility test state - POST_STATE_FPGA = 22 # Run FPGA test state - POST_STATE_COMPLETED = 23 # POST self-tests completed state - POST_STATE_FAILED = 24 # POST self-tests failed state - NUM_OF_POST_STATES = 25 # Number of initialize & POST mode states + POST_STATE_START = 0 # Start initialize & POST mode state + POST_STATE_FW_INTEGRITY = 1 # Run firmware integrity test state + POST_STATE_RTC = 2 # Run RTC test state + POST_STATE_NVDATAMGMT = 3 # Run NV Data Mgmt. test state + POST_STATE_WATCHDOG = 4 # Run watchdog test state + POST_STATE_SAFETY_SHUTDOWN = 5 # Run safety shutdown test state + POST_STATE_BLOOD_FLOW = 6 # Run blood flow test state + POST_STATE_DIALYSATE_INLET_FLOW = 7 # Run dialysate inlet flow test state + POST_STATE_DIALYSATE_OUTLET_FLOW = 8 # Run dialysate outlet flow test state + POST_STATE_BLOOD_LEAK = 9 # Run blood leak sensor test state + POST_STATE_VALVES = 10 # Run valves test state + POST_STATE_SYRINGE_PUMP = 11 # Run syringe pump test state + POST_STATE_PRES_OCCL = 12 # Run pressure occlusion state + POST_STATE_ALARM_AUDIO = 13 # Run alarm audio test state + POST_STATE_ALARM_LAMP = 14 # Run alarm lamp test state + POST_STATE_ACCELEROMETER = 15 # Run Accelerometer test state + POST_STATE_TEMPERATURES = 16 # Run temperatures POST state + POST_STATE_FANS = 17 # Run fans POST state + POST_STATE_STUCK_BUTTON = 18 # Run stuck button test state + POST_STATE_UI_POST = 19 # Check whether UI passed its POST tests + POST_STATE_FW_COMPATIBILITY = 20 # Run firmware compatibility test state + POST_STATE_FPGA = 21 # Run FPGA test state + POST_STATE_COMPLETED = 22 # POST self-tests completed state + POST_STATE_FAILED = 23 # POST self-tests failed state + NUM_OF_POST_STATES = 24 # Number of initialize & POST mode states @unique class PreTreatmentSubModes(DialinEnum): Index: dialin/hd/blood_leak.py =================================================================== diff -u -r3b17d81f02ad7a93e019d1a146e94e57ca54c39a -r16a0f3e2aa815027958118fac18fbb17baf32b5c --- dialin/hd/blood_leak.py (.../blood_leak.py) (revision 3b17d81f02ad7a93e019d1a146e94e57ca54c39a) +++ dialin/hd/blood_leak.py (.../blood_leak.py) (revision 16a0f3e2aa815027958118fac18fbb17baf32b5c) @@ -107,13 +107,16 @@ def get_blood_leak_emb_mode_command_response(self, emb_mod_cmd: int) -> str: """ - Gets the embedded mode command response + Gets the most recent embedded mode command response for a given command @param emb_mod_cmd the command to get its response @return: string - embedded mode command response """ - return self.blood_leak_emb_mode_cmds[EmbModeCommands(emb_mod_cmd).name] + if emb_mod_cmd < len(EmbModeCommands): + return self.blood_leak_emb_mode_cmds[EmbModeCommands(emb_mod_cmd).name] + else: + self.logger.debug("Invalid command!") @publish(['blood_leak_status', 'blood_leak_state']) def _handler_blood_leak_sync(self, message): @@ -139,7 +142,6 @@ @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ - rst = integer_to_bytearray(reset) det = float_to_bytearray(detected) payload = rst + det @@ -241,7 +243,6 @@ # If there is content... if received_message is not None: - self._is_emb_mode_command_in_progress = True # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: @@ -253,6 +254,9 @@ Constructs and sends switching to embedded mode command Constraints: Must be logged into HD. + It is recommended to have delays in between sending each command to make sure the firmware's queue is not + overflown. + The sensor must be in embedded mode. The firmware sets the sensor into the embedded mode by default. @return: non-zero integer if successful, False otherwise """ @@ -275,7 +279,6 @@ # If there is content... if received_message is not None: - self._is_emb_mode_command_in_progress = True # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: Index: tests/dg_tests.py =================================================================== diff -u -r90fd2bc1daa3ff18c14dd2bee592d8c05487e460 -r16a0f3e2aa815027958118fac18fbb17baf32b5c --- tests/dg_tests.py (.../dg_tests.py) (revision 90fd2bc1daa3ff18c14dd2bee592d8c05487e460) +++ tests/dg_tests.py (.../dg_tests.py) (revision 16a0f3e2aa815027958118fac18fbb17baf32b5c) @@ -742,3 +742,5 @@ #dg.heaters.cmd_heater_duty_cycle_override(1, 10, reset=1) + #hd.cmd_hd_software_reset_request() +