Index: dialin/common/dg_defs.py =================================================================== diff -u -rbff28676dd855ea33707bbb26a624abc94aebdf0 -raf831f536411facc3ad088d94a79643429288d16 --- dialin/common/dg_defs.py (.../dg_defs.py) (revision bff28676dd855ea33707bbb26a624abc94aebdf0) +++ dialin/common/dg_defs.py (.../dg_defs.py) (revision af831f536411facc3ad088d94a79643429288d16) @@ -71,8 +71,8 @@ @unique class DGSoloStates(DialinEnum): - DG_SOLO_STANDBY_STATE_START = 0, - DG_SOLO_IDLE_STATE = 1, + DG_SOLO_STANDBY_STATE_START = 0 + DG_SOLO_IDLE_STATE = 1 NUM_OF_DG_SOLO_STANDBY_STATES = 2 Index: dialin/dg/valves.py =================================================================== diff -u -r16e000873965ed64ed3dc96050739bd958a4d912 -raf831f536411facc3ad088d94a79643429288d16 --- dialin/dg/valves.py (.../valves.py) (revision 16e000873965ed64ed3dc96050739bd958a4d912) +++ dialin/dg/valves.py (.../valves.py) (revision af831f536411facc3ad088d94a79643429288d16) @@ -66,7 +66,22 @@ VALVE_STATE_R2_C_TO_NO = 0 VALVE_STATE_R1_C_TO_NC = 1 +@unique +class DGValvesSensedStates(DialinEnum): + VALVE_STATE_OPEN = 0 # Open valve state, used only for VPi, VBf, VRD1, VRD2, and VSP + VALVE_STATE_CLOSED = 1 # Closed valve state, used only for VPi, VBf, VRD1, VRD2, and VSP + VALVE_STATE_OPEN_C_TO_NC = 2 # Open Common to Normally Closed valve state, used only for VPd + VALVE_STATE_NOFILL_C_TO_NO = 3 # No Fill Common to Normally Open valve state, used only for VPo + VALVE_STATE_FILL_C_TO_NC = 4 # Fill Common to Normally Closed valve state, used only for VPo + VALVE_STATE_DRAIN_C_TO_NO = 5 # Drain Common to Normally Open valve state, used only for VDr and VRc. It is also used for VPd in V3 + VALVE_STATE_RECIRC_C_TO_NC = 6 # Recirculate Common to Normally Closed valve state, used only for VDr and VRc + VALVE_STATE_R1_C_TO_NO = 7 # Reservoir 1 Common to Normally Open valve state, used only for VRo and VRi + VALVE_STATE_R1_C_TO_NC = 8 # Reservoir 1 Common to Normally Closed valve state, used only for VRf + VALVE_STATE_R2_C_TO_NO = 9 # Reservoir 2 Common to Normally Open valve state, used only for VRf + VALVE_STATE_R2_C_TO_NC = 10 # Reservoir 2 Common to Normally Closed valve state, used only for VRo and VRi + NUM_OF_VALVE_STATES = 11 # number of valve states + @unique class DGValveNames(DialinEnum): # NOTE: NUM_OF enum has been removed because it should be a part of the software configuration @@ -146,7 +161,7 @@ self.valve_states_enum = [0 for _ in range(self.NUM_OF_VALVES)] for valve in DGValveNames.__members__: - self.valves_sensed_states[valve] = 0 + self.valves_sensed_states[valve] = '' def get_valve_states(self): """ @@ -310,8 +325,8 @@ start = self.END_POS_VALVES_STATES end = start + 1 for valve_id in self.valves_sensed_states: - #print(valve_id, start, end) - self.valves_sensed_states[valve_id] = struct.unpack('B', bytearray(message['message'][start:end]))[0] + valve_state_number = struct.unpack('B', bytearray(message['message'][start:end]))[0] + self.valves_sensed_states[valve_id] = DGValvesSensedStates(valve_state_number).name start = end end += 1 # TODO Behrouz thanks for reminding me, I will work on it! Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r16e000873965ed64ed3dc96050739bd958a4d912 -raf831f536411facc3ad088d94a79643429288d16 --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 16e000873965ed64ed3dc96050739bd958a4d912) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision af831f536411facc3ad088d94a79643429288d16) @@ -27,12 +27,12 @@ # It creates a folder called DG_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in your computer. - dg.sw_configs.cmd_get_dg_sw_config_record() + #dg.sw_configs.cmd_get_dg_sw_config_record() # Use cmd_set_dg_sw_config_record() set the changes back to firmware # This function requires an address for the excel report. Use the absolute address of your excel report like the # example below - #dg.sw_configs.cmd_update_dg_sw_config_record('/home/fw/projects/DG_NV_Records/2022-10-09-DG-SW-CONFIGS-Record.xlsx') + dg.sw_configs.cmd_update_dg_sw_config_record('/home/fw/projects/DG_NV_Records/2022-10-09-DG-SW-CONFIGS-Record.xlsx') # Use this function to reset the configuration records to all be 0 #dg.sw_configs.cmd_reset_dg_sw_config_record() Index: tests/dg_tests.py =================================================================== diff -u -r16e000873965ed64ed3dc96050739bd958a4d912 -raf831f536411facc3ad088d94a79643429288d16 --- tests/dg_tests.py (.../dg_tests.py) (revision 16e000873965ed64ed3dc96050739bd958a4d912) +++ tests/dg_tests.py (.../dg_tests.py) (revision af831f536411facc3ad088d94a79643429288d16) @@ -688,7 +688,7 @@ hd.cmd_log_in_to_hd() sleep(1) - run_heat_disinfect() + #run_heat_disinfect() #run_flush_mode() @@ -731,10 +731,10 @@ #sleep(1) #dg.heaters.cmd_start_stop_trimmer_heater(0) - #dg.valves.cmd_valve_sensed_state_override(4, 1, reset=1) + dg.valves.cmd_valve_sensed_state_override(4, 1, reset=0) - #while True: - # print(get_dg_valves_states()) - # sleep(1) + while True: + print(get_dg_valves_states()) + sleep(1)