From: Alexandra Lanes Date: Sat, 18 Jun 2022 21:55:20 +0000 (+0200) Subject: Update focus position while moving X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~owend/git?a=commitdiff_plain;h=5c34e9a81503c251288e7ce5ac74bb0d812d8bc4;p=legofocuser.git Update focus position while moving --- 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):