-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
Feature request: Custom Device Monitor Filters for projects not platforms #3924
Comments
+1 for this. I wrote a filter for debugging some communications from a device I was interfacing with and alas and alack putting it in the So I went ahead and tweaked the device monitor loading code a bit to also load filters from projects. Probably would only take someone who knows what they are doing a few minutes, but took me 30 or so.... Here is what I changed in case anyone else wants to have this for their projects while we wait for this to (hopefully) be added.
With this:
In commands/device/helpers.py:
With this:
|
Thanks for the feature request! Please re-test with |
So this is a great feature I'm trying to leverage--but here almost 2 years after this issue was closed, I can't seem to figure out how to get it to work. Been digging all over the place for answers, only finding one (unanswered) PIO forum post in the same vein (https://community.platformio.org/t/possible-to-write-serial-monitor-custom-filters-to-process-raw-binary-data/35190) I'm trying to write a custom project-specific monitor filter. Starting as simple as possible, I've started with https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#cmd-device-monitor-custom-filters . Added the following to the platformio.ini "project environment" section:
That didn't work. I've tried "demo", "filter_demo", and "filter_demo.py" for "monitor_encoding" all with no luck. I've also tried renaming the "demo" and "Demo" names inside "filter_demo.py" with "filter_demo" but to no avail. So maybe it wasn't looking in the right place. Based on https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/monitor_dir.html#projectconf-pio-monitor-dir I added what is indicated as the "default filter search path" to the head of the "platformio.ini" file:
Doesn't work. Guessing based on the above page, I then tried this:
This time it added a "_pycache_" folder inside the "monitor" directory. But the "Serial Monitor" still failed. All I ever get from the Serial Monitor is a long error trace, ending with, "LookupError: unknown encoding: [whatever is on the 'monitor_encoding' line]" What am I missing here? |
Think I might have figured it out...
works just fine--and I know that's a Python filter. Which is what threw me off. Apparently I missed the memo about using "monitor_filters" (https://docs.platformio.org/en/latest/projectconf/sections/env/options/monitor/monitor_filters.html)
surprisingly works. Almost anticlimactic after all the errors... That's with the following inside of "filter_demo.py", which is located in "/monitor/filter_demo.py"
And I don't even need the "[platformio] monitor_dir" stuff. Whew. I can get back to actual work now. |
I find myself wanting to write a custom device monitor filter that colors the output according to the syntax of the serial protocol I use for a particular project.
Unfortunately it seems one can only write custom filters as part of a platform.
It would be nice to be able to add a "monitor" folder in a project, or directly pass the path to a Python file to the --filter option.
The text was updated successfully, but these errors were encountered: