Index: dialin/dg/events.py =================================================================== diff -u -r0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac -r6acb9af3aed2505112c51cb7eea41dffaa472286 --- dialin/dg/events.py (.../events.py) (revision 0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac) +++ dialin/dg/events.py (.../events.py) (revision 6acb9af3aed2505112c51cb7eea41dffaa472286) @@ -33,14 +33,15 @@ self._dg_event_data_type = dict() # Dictionary of the the mode as key and the sub mode states enum class as the value - self._dg_op_mode_2_sub_mode = {DGOpModes.DG_MODE_STAN.name: DGStandByModeStates, + self._dg_op_mode_2_sub_mode = {DGOpModes.DG_MODE_FAUL.name: DGFaultStates, + DGOpModes.DG_MODE_INIT.name: DGInitStates, + DGOpModes.DG_MODE_STAN.name: DGStandByModeStates, DGOpModes.DG_MODE_CIRC.name: DGRecircModeStates, DGOpModes.DG_MODE_FILL.name: DGFillModeStates, DGOpModes.DG_MODE_DRAI.name: DGDrainModeStates, DGOpModes.DG_MODE_FLUS.name: DGFlushStates, DGOpModes.DG_MODE_HEAT.name: DGHeatDisinfectStates, - DGOpModes.DG_MODE_CHEM.name: DGChemicalDisinfectStates, - DGOpModes.DG_MODE_FAUL.name: DGFaultStates} + DGOpModes.DG_MODE_CHEM.name: DGChemicalDisinfectStates} # Loop through the list of the DG events enums and initial the event dictionary. Each event is a key in the # dictionary and the value is a list. @@ -138,7 +139,7 @@ # Convert the event ID to enum event_state_name = DGEventList(event_id).name - #print(event_data_1, event_data_2) + #print(event_state_name, event_data_1, event_data_2) # Check if the event state name is operation mode change. If it is, get the name of the operation modes # from the op modes enum class @@ -183,18 +184,17 @@ event_data_2 = current_sub_mode_enum_class(event_data_2).name elif current_op_mode_timestamp > current_sub_mode_timestamp: - # If the previous and current of the last two tuples do not match, then an operation modes transition - # has occurred and and the previous state is converted from the previous class and the current op mode + # If the previous and current of the last two tuples do not match, then an operation mode transition + # has occurred and the previous state is converted from the previous class and the current op mode # is converted from current operation states enum class. # i.e last = (timestamp, event type, 3, 8) and one before = (timestamp, event type, 8, 3) # previous and current do not match so in the last type (timestamp, event type, 8, 3) the prev state # should be from op mode 8 and the current state should be from op mode 3 - previous_sub_mode = current_sub_tuple[len(current_sub_tuple) - 2] - previous_sub_mode_enum_class = self._dg_op_mode_2_sub_mode[previous_sub_mode] + previous_op_mode = last_op_tuple[len(last_op_tuple) - 2] + previous_sub_mode_enum_class = self._dg_op_mode_2_sub_mode[previous_op_mode] event_data_1 = previous_sub_mode_enum_class(event_data_1).name event_data_2 = current_sub_mode_enum_class(event_data_2).name else: - #print(event_data_1, event_data_2) if event_data_2 != 0: event_data_1 = current_sub_mode_enum_class(event_data_1).name @@ -210,3 +210,6 @@ # Update event dictionary self._dg_event_dictionary[event_state_name].append(event_tuple) + + +# What is wrong with the events in develop? Index: tests/dg_heat_and_chemical_disinfect_test.py =================================================================== diff -u -r0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac -r6acb9af3aed2505112c51cb7eea41dffaa472286 --- tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision 0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac) +++ tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision 6acb9af3aed2505112c51cb7eea41dffaa472286) @@ -549,11 +549,11 @@ hd.cmd_log_in_to_hd() sleep(1) - # run_heat_disinfect() + #run_heat_disinfect() # run_chemical_disinfect() - # run_dg() + run_dg() # run_ro_pump_duty_cycles() @@ -563,6 +563,6 @@ # cmd_test_heaters() - collect_treatment_data() + #collect_treatment_data() Index: tests/test_flush.py =================================================================== diff -u -r0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac -r6acb9af3aed2505112c51cb7eea41dffaa472286 --- tests/test_flush.py (.../test_flush.py) (revision 0a83db66e0df99be5dbac9cd9e9aceb25e7ce7ac) +++ tests/test_flush.py (.../test_flush.py) (revision 6acb9af3aed2505112c51cb7eea41dffaa472286) @@ -105,7 +105,7 @@ f = open("/home/fw/projects/dialin/tests/flush_mode.log", "w") #dg.hd_proxy.cmd_start_stop_dg_flush() dg.cmd_dg_software_reset_request() - #sleep(0.1) + try: while True: flush = get_flush_mode_info() @@ -124,17 +124,25 @@ # If the mode came back to standby or standby solo if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: - dg.hd_proxy.cmd_start_stop_dg_flush() + + if complete_counter == 1: + dg.hd_proxy.cmd_start_stop_dg_flush() # Write a few more complete states to make sure the complete state items are recorded - #if complete_counter == 3: - # f.close() - # break + if complete_counter == 3: + f.close() + events = dg.events.get_dg_events(2, 60) + for event in events: + print(event) + break complete_counter += 1 except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_flush(start=False) f.close() + events = dg.events.get_dg_events(2, 50) + for event in events: + print(event) if __name__ == "__main__":