chiark / gitweb /
Update focus position while moving
authorAlexandra Lanes <ajlanes@chiark.greenend.org.uk>
Sat, 18 Jun 2022 21:55:20 +0000 (23:55 +0200)
committerAlexandra Lanes <ajlanes@chiark.greenend.org.uk>
Sat, 18 Jun 2022 21:55:20 +0000 (23:55 +0200)
legofocuser.py

index d80c73f51b539a98ab112fbf3648aaebbd13a843..59c81d633d9ef337699a79b703a1eeb6885b5135 100755 (executable)
@@ -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):