tests/machine_encoder.py: Fix esp32 Encoder: only 3 pulses to count first rotation. #17914
+88
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add pin initial level.
Add test Encoder phases x2 and x4.
Explanation to the #12346 (comment)
Output waveform of industrial quadrature encoders:

Output waveform of rotary encoders is slightly different:

They have several fixed positions per revolution with channel A and channel B output levels equal to 1.
I suspect that @jonathanhogg, @jimmo used exactly this kind of encoder.
He has high levels of input channels and increment the Encoder on the falling edge of channel A.
micropython/ports/esp32/modules/machine.py
Line 161 in 744270a
So, the esp32 test requires initial high levels of channels before starting the count.
Also added mimxrt configuration from the #12347
@robert-hh You can cherry-pick from here too.