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

Feature: Create PlatformIO DeviceMonitorFilter #2

Closed
ivankravets opened this issue Oct 25, 2021 · 4 comments
Closed

Feature: Create PlatformIO DeviceMonitorFilter #2

ivankravets opened this issue Oct 25, 2021 · 4 comments

Comments

@ivankravets
Copy link

The upcoming PlatformIO Core 5.2.3 will allow users to add custom monitor filters to a project. See https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#custom-filters

Installation

It would be great if this package will provide an API for DeviceMonitorFilter named ArduPlotDeviceMonitorFilter. Later, you can update README on how to use arduplot and recommend using this code:

from arduplot.platformio import ArduPlotDeviceMonitorFilter

Need to create filter_arduplot.py file in <project>/monitor folder and copy Python-code above.

Benefits

  • The installation is very simple
  • No need to install any Python packages, the "filter" will do this automatically
  • User will always use the latest functionality

What to do?

  1. Create platformio.py file in https://github.com/yhur/arduplot/tree/main/src/arduplot
  2. Implement class ArduPlotDeviceMonitorFilter according to https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#custom-filters and serialplotter filter platformio/platformio-core#4058
  3. Publish the new version to PyPi.
@yhur
Copy link
Owner

yhur commented Oct 26, 2021

@ivankravets
I created the platformio.py under the src/arduplot along with the plotserialdata.py ( ie. serialplotter filter).
Would you let me know how I test it out with new 5.2.3?
Thanks.

@yhur
Copy link
Owner

yhur commented Oct 28, 2021

@ivankravets
After spending some time on this, I think this is what you want to do.

<project_dir>/monitor directory is similar to /platforms/espressif8266/monitor
where additional filters are provided. So the project specific monitor can be placed here.

On second thought, I would like to suggest this. This suggestion is a minor modification to your idea, I guess.

  1. create this folder /packages/tool-community-filter
  2. any community filter like arduplot place the filter(subclass of DeviceMonitorFilter) is placed here
  3. pio device monitor -f will check and pick up the additional filter

This way, the users can configure the VSCode/PIO environment with the needed community filter once and don't have to configure the projects every time.

What do you think?

@ivankravets
Copy link
Author

@yhur great idea! We added support of custom filters in PlatformIO packages. PlatformIO Core 5.2.3 is out! https://github.com/platformio/platformio-core/releases/tag/v5.2.3

@yhur
Copy link
Owner

yhur commented Nov 13, 2021

It's done.

The user can copy filter_plotter.py to either

(project_dir)/monitor, 
or 
~/.platformio/platform/espressif8266/monitor (or ~/.platformio/platform/espressif32/monitor for esp32)

and run pio device monitor -f plotter after installation of the arduplot.

Or they can set the environment variable and run this too.

export PLATFORMIO_MONITOR_DIR=$(HOME)/.platformio/penv/lib/python3.9/site-packages/arduplot/

@yhur yhur closed this as completed Nov 13, 2021
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

No branches or pull requests

2 participants