Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FastIO FastPWM USBDevice
Diff: Plunger/quadSensor.h
- 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