Use a dummy write function for Stepper until we've initialized from the config.
authorW. Trevor King <wking@drexel.edu>
Mon, 26 Mar 2012 16:35:05 +0000 (12:35 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 26 Mar 2012 16:35:05 +0000 (12:35 -0400)
pyafm/stepper.py

index 3c04556c41e116c01cd6879158f955dd4d82370a..668348400396be82cf47d077ac36d3fb893fa7c5 100644 (file)
@@ -38,17 +38,17 @@ class Stepper(_stepper.Stepper):
         self.config = config
         self.port = None
         c = self.config  # reduce verbosity
+        dummy_write = lambda value: None
         super(Stepper, self).__init__(
-            write=self.port.write_bitfield, full_step=c['full-step'],
-            logic=c['logic'], delay=c['delay'], step_size=c['step-size'],
-            backlash=c['backlash'])
+            write=dummy_write, full_step=c['full-step'], logic=c['logic'],
+            delay=c['delay'], step_size=c['step-size'], backlash=c['backlash'])
 
     def load_from_config(self, devices):
         c = self.config  # reduce verbosity
         if self.port is None:
             self.port = _DigitalPort(config=c['port'])
             self.port.load_from_config(devices=devices)
-            self._write = self.port.write_bitfield
+        self._write = self.port.write_bitfield
         self.full_step = c['full-step']
         self.logic = c['logic']
         self.delay = c['delay']