-
Notifications
You must be signed in to change notification settings - Fork 597
New debugging facility & stm32 driver refactoring #158
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
Conversation
This pull request now also contains the STM32 driver refactoring, doh! Should have made a new branch for it. I've tested it seems to compile on the boards I've tried, and it works to set up 2x 6-PWM with hardware interfaces. I now have two motors turning on my STM32G491 based Rosmo dual ESC board. yay! If you set the build flag
|
STM32 driver refactor should now support choosing best choice of timers for a given pin combination, considering all the timers defined in the pinmap, i.e. including the alternate peripheral timers. Also some other small improvements to the initialisation logic. This means:
|
I've now tested this on another ESC board of my design, with STM32F401 and 3-PWM, and this is working fine too... I think I will merge it to dev at this point so we have a chance to test it well... |
This pull request separates the debugging concept from the telemetry concept in the monitoring.
Debugging is only used for debug output, not the automatic sending of motor variables.
A debug statement now looks like this:
It is implemented via the new class SimpleFOCDebug. The API is purely static, so you don't have to keep instances of the debug class ready to use it. Just include "SimpleFOCDebug.h" and use the macro.
If your use case needs it, you can also call SimpleFOCDebug::print(...) or SimpleFOCDebug::println(...) directly, for example to output multiple values on the same line.
Using the macro has some advantages:
So the usage pattern should be:
SIMPLEFOC_DEBUG(msg)
In this case we can completely remove the debug from the code by setting the build flag. I tried it out for SAMD21 and it makes about 1KB difference to the code size.
There are other ways we could do it of course, its only a suggestion, so @askuric if you don't like it let me know and we can change it....