From dc21099fd6d958027a392836a4ded5feb54ecfbb Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Wed, 26 Sep 2018 17:30:28 +0200 Subject: [PATCH] --- script/local.py | 25 +++++++++++++++++++++++++ script/motion/dry.py | 4 ++++ script/motion/mount.py | 14 +++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/script/local.py b/script/local.py index 539ae24..9a2af02 100644 --- a/script/local.py +++ b/script/local.py @@ -256,6 +256,31 @@ def get_pin_offset(): log("Error getting pin offset: " + str(sys.exc_info()[1]), False) return 0.0 +def is_force_dry(): + try: + dry_mount_counter = int(get_setting("dry_mount_counter")) + except: + dry_mount_counter = 0 + + try: + dry_timespan = time.time() - float( get_setting("dry_timestamp")) + except: + dry_timespan = 3600 + + try: + force_dry_mount_count = int(get_setting("force_dry_mount_count")) + if force_dry_mount_count>0 and dry_mount_counter>=force_dry_mount_count: + return True + except: + pass + + try: + force_dry_timeout = float(get_setting("force_dry_timeout")) + if force_dry_timeout>0 and dry_timespan>=force_dry_timeout: + return True + except: + pass + return False update() diff --git a/script/motion/dry.py b/script/motion/dry.py index 3ebdef1..5619238 100644 --- a/script/motion/dry.py +++ b/script/motion/dry.py @@ -29,6 +29,10 @@ def dry(heat_time=30.0, speed=0.5, wait_cold = 30.0): set_heater(False) set_air_stream(False) + + set_setting("dry_mount_counter", 0) + set_setting("dry_timestamp",time.time()) + if wait_cold >=0 : robot.move_cold() time.sleep(wait_cold) diff --git a/script/motion/mount.py b/script/motion/mount.py index b8ae2b4..44e3e78 100644 --- a/script/motion/mount.py +++ b/script/motion/mount.py @@ -46,6 +46,7 @@ def mount(segment, puck, sample, force=False, read_dm=False): robot.move_dewar() robot.get_dewar(segment, puck, sample) + set_setting("mounted_sample_position", get_sample_name(segment, puck, sample)) @@ -64,7 +65,18 @@ def mount(segment, puck, sample, force=False, read_dm=False): smart_magnet.set_mount_current() - robot.put_gonio() + robot.put_gonio() + + + try: + dry_mount_count = int(get_setting("dry_mount_counter")) + except: + dry_mount_count = 0 + set_setting("dry_mount_counter", dry_mount_count+1) + #TODO: Auto-dry procedure + if is_force_dry(): + pass + robot.move_dewar() mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) #TODO: Should do on finally?