Skip to content

tests/machine_encoder.py: Fix esp32 Encoder: only 3 pulses to count first rotation. #17914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IhorNehrutsa
Copy link
Contributor

Add pin initial level.
Add test Encoder phases x2 and x4.

Explanation to the #12346 (comment)

Output waveform of industrial quadrature encoders:
image

Output waveform of rotary encoders is slightly different:
image
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.

falling=self._PCNT.INCREMENT,

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.

@IhorNehrutsa IhorNehrutsa force-pushed the fix_only_3_pulses_to_count_first_rotation branch from d153043 to 80ddee0 Compare August 13, 2025 15:38
Add pin initial level.
Add test Encoder phases x2 and x4.

Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
@IhorNehrutsa IhorNehrutsa force-pushed the fix_only_3_pulses_to_count_first_rotation branch from 80ddee0 to cf658f0 Compare August 13, 2025 15:46
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (744270a) to head (cf658f0).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17914   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22295    22295           
=======================================
  Hits        21936    21936           
  Misses        359      359           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Aug 14, 2025
@projectgus projectgus self-requested a review August 14, 2025 01:02
@dpgeorge dpgeorge added tests Relates to tests/ directory in source and removed extmod Relates to extmod/ directory in source labels Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Relates to tests/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants