10000 DRIVERS.md Improve section on Encoder class. · youxinweizhi/micropython-async@4c38f3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c38f3d

Browse files
committed
DRIVERS.md Improve section on Encoder class.
1 parent d850519 commit 4c38f3d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

v3/docs/DRIVERS.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,9 @@ not intended for applications such as CNC machines where
409409
is required. Drivers for NC machines must never miss an edge. Contact bounce or
410410
vibration induced jitter can cause transitions to occur at a high rate; these
411411
must be tracked. Consequently callbacks occur in an interrupt context with the
412-
associated concurrency issues.
412+
associated concurrency issues. These issues, along with general discussion of
413+
MicroPython encoder drivers, are covered
414+
[in this doc](https://github.com/peterhinch/micropython-samples/blob/master/encoders/ENCODERS.md).
413415

414416
This driver runs the user supplied callback in an `asyncio` context, so that
415417
the callback runs only when other tasks have yielded to the scheduler. This
@@ -471,18 +473,15 @@ Class variable:
471473
The driver works by maintaining an internal value `._v` which uses hardware
472474
interrupts to track the absolute position of the physical encoder. In theory
473475
this should be precise with jitter caused by contact bounce being tracked. With
474-
the Adafruit encoder it is imprecise: returning the dial to a given detent
475-
after repeated movements shows a gradual "drift" in position. This occurs on
476-
hosts with hard or soft IRQ's. I attempted to investigate this with various
477-
hardware and software techniques and suspect there may be mechanical issues in
478-
the device. Possibly pulses may occasionally missed with direction-dependent
479-
probability. Unlike optical encoders these low cost controls make no claim to
480-
absolute accuracy.
481-
482-
This is of little practical consequence as encoder knobs are usually used in
483-
systems where there is user feedback. In a practical application
476+
mechanical encoders it is imprecise unless Schmitt trigger pre-conditioning is
477+
used. The reasons for this and solutions are discussed
478+
[in this doc](https://github.com/peterhinch/micropython-samples/blob/master/encoders/ENCODERS.md).
479+
480+
An absence of pre-conditioning is often of little practical consequence as
481+
encoder knobs are usually used in systems where there is user feedback. In a
482+
practical application
484483
([micro-gui](https://github.com/peterhinch/micropython-micro-gui)) there is no
485-
obvious evidence of the missed pulses.
484+
obvious evidence of the missed pulses which do occasionally occur.
486485

487486
###### [Contents](./DRIVERS.md#1-contents)
488487

0 commit comments

Comments
 (0)
0