changeset 148:05b2ccdf6070

servo.update
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Wed, 06 Aug 2014 18:40:17 +0200
parents 606fe2c5a2ef
children fe5a50873dc2
files maestro.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/maestro.py	Wed Aug 06 18:37:41 2014 +0200
+++ b/maestro.py	Wed Aug 06 18:40:17 2014 +0200
@@ -94,12 +94,6 @@
 
     def move_degrees(self, degrees):
         self._angle = degrees
-        position = (self.width * degrees) / self.max_degrees
-        if self.reverse:
-            position = -position
-        target = self.center + position + self.trim
-        target = min(self.max_position, max(self.min_position, target))
-        self.maestro.set_target(self.index, target)
 
     def set_speed(self, degrees_per_milisecond):
         speed = (self.width * degrees_per_milisecond) / self.max_degrees
@@ -118,3 +112,11 @@
     def stop(self):
         target = self.get_position(self.index)
         self.maestro.set_target(self.index, target)
+
+    def update(self):
+        position = (self.width * self._angle) / self.max_degrees
+        if self.reverse:
+            position = -position
+        target = self.center + position + self.trim
+        target = min(self.max_position, max(self.min_position, target))
+        self.maestro.set_target(self.index, target)