-
Notifications
You must be signed in to change notification settings - Fork 143
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
[driver] Added TCS3472 missing features #578
Conversation
Update: There's also a |
Thanks for the rich options! I'm fine with the modm coding-style ;) so a simple IDE-plugin, applying the .clang-format from within the working-folder, did the job. It's dropping lovely handmade vertical alignments of Register enums but i don't care. If you don't mind either, the formatting looks good now. |
93525eb
to
bd3103e
Compare
The |
This comment has been minimized.
This comment has been minimized.
Oh, wait, I'm an idiot. You updated both drivers. Never mind me. 🤦♂️🤦♂️ |
Not exactly.. i did not update the tcs3414... but if i compare the branches i see, i've fragged tcs3414.hpp 😅 |
Oh and excuse this additional DLR submodule... next time i'll take better care |
Ok, since I had this sensor lying around and always wanted to test it, I added an example and tested it in hardware. I also refactored the driver some more to make it more up-to-date to our coding style and added the Data class mechanism that we typically use now. It separates the data storage and representation from the driver, which makes it easy to copy around and transmit over a network and only does the conversion work (like Could you test my changes in your hardware when you have time? |
Good morning! I'm currently reading your changes and will test on my hardware soon. |
Tested and works. The new 'Data mechanism' looks nice and clean. |
6a8678d
to
53d29fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll squash the commits together when you tell me you're ready (and the CI passes).
f7cb793
to
768b98f
Compare
- Use separate Data class mechanism. - Add threshold, interrupt and wait time setters to TCS3472 Co-authored-by: Niklas Hauser <[email protected]>
6ad166a
to
ab39dcc
Compare
I'm ready, ... but let me know if you think it's worth the time. |
Yes, go for it. You can keep the protothreads, they cost next to nothing even on AVRs. |
I'm sorry, did you mean that I or that you will add another AVR example? |
This Sensor is very popular for beginners. They f.e. build candy-sorting machines of it (they work soooooooo 🐌 slow). I want to ad a second example using tcs3472s interrupt-feature, explaining: This alone frees up tons of cpu-resources. But maybe, that's over-ambitios 😓: no arduino-minded person will ever stumble over the lines. Okay, i'll rest in peace with example 3 ... coming soon. |
I also think having one example with interrupts and protothreads is best. I don't want to demotivate you, however, our examples are regrettably not very good tutorials, often they are under-documented and at the moment we mostly (ab)use them as manual integration tests. It's something I would like to change, however, my ToDo-List is quite long and there are always more important things on it… 🙃 I would perhaps recommend doing a tutorial like this as a blog post on your homepage, since that absolves you from the "pressure" of contributing to modm and you can set the level of detail and the structure of the tutorial completely by yourself. We could then link to this in the protothread module docs. |
Good recommendation. Await 2 examples later today... |
So here's one example using threads and interrupt. I'm 99% sure this works but can't test now cause my one and only Nano just got fail-fused 💀 -> reanimation failed. This is defacto my facepalm-emoji-moment... but i'm to lazy to look for it 😁 Fresh Nanos have been ordered for testing. |
10eecd4
to
548b69b
Compare
Fresh head 🧠 and got my Arduino-Nano board back to life.
Go, merge the stuff into develop 😁. Thanks for your guidance, and excuse this chaotic (noizy) contribution-trip. I've learned a lot and looking forward to my request. |
548b69b
to
850b554
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squashed into the previous commit and removed the while(!
thing for clarity.
Apologies for the CI, it usually takes 20-30mins, not 5h. CircleCI seems to have significant issues, we're in contact with their support. |
You're welcome! I'm always glad to help new contributors navigate these complex waters. There's a lot of bullshit gatekeeping in embedded, I'm not a fan of it… |
True, it requires various experience-loops to finally keep repo-things horizontal. But i appreciate the requirement and helpfulness of most of the stumbling blocks. Manually checking the result by wrapping while(! ... ) is not required 😵 the better it is 😏. I'll study the protothreads again, with new eyes. Damn, i'm glad having contributed a little - but in my scale remarkable - piece to my favorite framework 😇 |
Significantly improves possible performance. Got sample-rates up to 200Hz now:
Bug
Features
Sry for the reformatted code... if that's a problem, i'll fix it.