Arnaud VALLEY / Mbed 2 deprecated Pinscape_Controller_V2_arnoz

Dependencies:   mbed FastIO FastPWM USBDevice

Revision:
105:6a25bbfae1e4
Parent:
101:755f44622abc
Child:
108:bd5d4bd4383b
--- a/Plunger/quadSensor.h	Fri Dec 27 20:14:23 2019 +0000
+++ b/Plunger/quadSensor.h	Thu Jan 23 04:09:24 2020 +0000
@@ -121,17 +121,20 @@
         timer.start();
     }
     
-    // Auto-zero.  Return to the park position
+    // Auto-zero.  Return to the park position.  If we're using reverse
+    // orientation, go to the park position distance from the top end
+    // of the scale.
     virtual void autoZero()
     {
-        pos = parkPos;
+        pos = reverseOrientation ? nativeScale - parkPos : parkPos;
     }
         
     // Begin calibration.  We can assume that the plunger is at the
-    // park position when calibration starts.
+    // park position when calibration starts, so perform an explicit
+    // auto-zeroing operation.
     virtual void beginCalibration(Config &)
     {
-        pos = parkPos;
+        autoZero();
     }
     
     // read the sensor