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

Add support for DYP A02YYU ultrasonic sensor #2622

Merged
merged 5 commits into from
Oct 24, 2024
Merged

Conversation

toniSg
Copy link
Contributor

@toniSg toniSg commented Oct 11, 2024

This brings the support of DYP A02YYU waterproof ultrasonic sensor to espurna.

It will need a UART port configured as 9600/8N1 (RX pin only is enough). To enable this sensor, the follwing build flags shall be configured:

A02YYU_SUPPORT set to 1
A02YYU_PORT set to the UART port ID

This has been tested on an esp8266 D1 Mini reporting steady distance measurements over more than 2 weeks.

code/espurna/sensors/A02YYUSensor.h Outdated Show resolved Hide resolved
code/espurna/config/sensors.h Show resolved Hide resolved
code/espurna/config/sensors.h Show resolved Hide resolved
code/espurna/sensors/A02YYUSensor.h Outdated Show resolved Hide resolved
@toniSg toniSg force-pushed the dev branch 3 times, most recently from eb08cda to cbaec01 Compare October 23, 2024 11:56
@mcspr mcspr merged commit 36e00df into xoseperez:dev Oct 24, 2024
5 checks passed
@mcspr
Copy link
Collaborator

mcspr commented Oct 24, 2024

Thanks!

Still, I do think it might be useful to keep payload / overall data string examples around. Small example w/ test sensor cpp update
3cdccfa
And I think I'll try to cover the rest of serial sensors (and clean-up existing pre() / tick() / value() inconsistent reads and timeout uses / no timeouts while at it)

@toniSg
Copy link
Contributor Author

toniSg commented Oct 24, 2024

Thanks!

Still, I do think it might be useful to keep payload / overall data string examples around. Small example w/ test sensor cpp update 3cdccfa And I think I'll try to cover the rest of serial sensors (and clean-up existing pre() / tick() / value() inconsistent reads and timeout uses / no timeouts while at it)

Sure, I'll try to do some data capture from the sensor this week end and I'll submit them.

@toniSg
Copy link
Contributor Author

toniSg commented Oct 27, 2024

Hello Max,

As promised, please find attached some data capture from the device. Unfortunately, I couldn't capture data from my faulty device, it doesn't power up anymore :( I think it's definitely dead.

I'll think about how to exploit those data in the test and also how to simulate faulty/corrupted data. Basically, with the faulty device, some values were randomly dropped or zeroed. It should be easy to replicate that pattern for the tests.

I've also looked at your test and it's a very good thing, I'll try to contibute to this effort. I'd have one question about this though, in the standard behavior, several frames that are parsed in once within a tick() call. The test will only test the latest parsed value. would it be possible to check at all parsed values?

a02yyu-data-capture.txt

@mcspr
Copy link
Collaborator

mcspr commented Oct 30, 2024

I'd have one question about this though, in the standard behavior, several frames that are parsed in once within a tick() call. The test will only test the latest parsed value. would it be possible to check at all parsed values?

Most naïve approach would be to just throttle the input to one frame per tick()? (like it does currently)

Otherwise, manually pick results with an extra external method to handle one frame at a time. Bulk of the data passed at once continues to only have one result at the end.

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

Successfully merging this pull request may close these issues.

2 participants