Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

modpycom.c/pulses_get(): prevent lock-up at long pulses#110

Closed
robert-hh wants to merge 1 commit intopycom:masterfrom
robert-hh:pulses_get
Closed

modpycom.c/pulses_get(): prevent lock-up at long pulses#110
robert-hh wants to merge 1 commit intopycom:masterfrom
robert-hh:pulses_get

Conversation

@robert-hh
Copy link
Copy Markdown
Contributor

pulses_get() gets into a kind of lock state, if pulses with a duration of > 20000µs are applied and the time out was set to an appropriate large value, like 30000. It does not simply return wrong values, but from one "overflow" event on it returns the value pair 19879, 0 irrespective of the signal applied to the input. Only hard reset fixes that.
This PR results in a more robust behavior. For pulses of > 32768µs a wrong value will be reported, but after returning to shorter pulses, these will be reported correctly.

The longest pulse with was set to 20ms. The were some observations that pulses_get() kind of locked up at longer pulses. Setting the maximal pulse width to 0xffff avoids this situation. Even it the pulse width is longer than 65ms, the device recovers at shorter pulses. This value is also used by espressif's examples.
@danicampora
Copy link
Copy Markdown

Merged with master, thanks!

@robert-hh
Copy link
Copy Markdown
Contributor Author

B.T.W.: Merry Christmas

@danicampora
Copy link
Copy Markdown

Merry Christmas!! :-)

@robert-hh robert-hh deleted the pulses_get branch December 26, 2017 10:50
Xykon pushed a commit that referenced this pull request Mar 2, 2020
@DG12 DG12 mentioned this pull request Apr 7, 2020
X-Ryl669 pushed a commit to X-Ryl669/pycom-micropython-sigfox that referenced this pull request May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants