From 5c34e9a81503c251288e7ce5ac74bb0d812d8bc4 Mon Sep 17 00:00:00 2001 From: Alexandra Lanes Date: Sat, 18 Jun 2022 23:55:20 +0200 Subject: [PATCH] Update focus position while moving --- legofocuser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/legofocuser.py b/legofocuser.py index d80c73f..59c81d6 100755 --- a/legofocuser.py +++ b/legofocuser.py @@ -178,7 +178,7 @@ class LegoFocuser(device): else: conn.state = "Busy" self.IDSet(conn) - prt = self.IUFind("BUILD_HAT_PORT") + prt = self.IUFind("DEVICE_PORT") portval = prt["PORT"].value.strip() self.motor = Motor(portval) conn.state = "Ok" @@ -223,15 +223,16 @@ class LegoFocuser(device): self.IDSet(fam) def checkmotoridle(self): + afocpos = self.IUFind("ABS_FOCUS_POSITION") + afocpos["FOCUS_ABSOLUTE_POSITION"].value = self.motor.get_position() if self.motor._runmode == MotorRunmode.NONE: focpos = self.IUFind("REL_FOCUS_POSITION") focpos.state = "Ok" self.IDSet(focpos) - focpos = self.IUFind("ABS_FOCUS_POSITION") - focpos.state = "Ok" - self.IDSet(focpos) + afocpos.state = "Ok" else: self.IEAddTimer(100, self.checkmotoridle) + self.IDSet(afocpos) def run_until_resistance(self): -- 2.30.2