Skip to content
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

Some Arduino commands like EntradaPulsos1 = pulseIn(IO2_SERVO_IN_1, HIGH, 50000); doesn't work properly #391

Closed
Escrich opened this issue Feb 24, 2020 · 4 comments

Comments

@Escrich
Copy link

Escrich commented Feb 24, 2020

Dear all, I’m writing you because after latest actualizations, some Arduino commands started to work erratically, just coming to this example:
SignalOne = pulseIn(IO2_SERVO_IN_1, HIGH, 50000); //input pulsewidth 1# with 50 mS of timeout
With this sentence i read a servo control signal, and the result it’s something between 1000 and 2000 uSeconds, I’m using this kind of line since more than five years ago, and it’s really accurate, but actually, when you expect 1000, the reading shows around 700, when you expect 1500, (and you are sure you have it), you are getting around 1100, this is just for your information, i was tried connecting or disconnecting millis() and so.
Regards:
JMEC

@Escrich
Copy link
Author

Escrich commented Feb 24, 2020

Tested deeply on Attiny85

@SpenceKonde
Copy link
Owner

This is fixed in github version, will be in next release.

The cause of the pulseIn issues was that:
Core was missing the precompiled assembly snippet used to fix dependence on compiler version (the newer compiler version is actually worse at optimizing the loop in question), but pulseIn() depends on the execution time of a very tight loop.
The assembly snippet, as it happens, didn't honor timeout value if no pulse was detected - it would expire in 11/16ths of the specified time. This was busted everywhere - though it is also fixed in ATTinyCore now.

@SpenceKonde
Copy link
Owner

SpenceKonde commented Feb 24, 2020

(duplicate of #384) - still really confused by why three people reported it within the past 2 weeks, when it had been broken for quite a while without anyone noticing.

@Escrich
Copy link
Author

Escrich commented Feb 24, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants