Feature: Create PlatformIO DeviceMonitorFilter
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?
- Create
platformio.pyfile in https://github.com/yhur/arduplot/tree/main/src/arduplot - Implement
class ArduPlotDeviceMonitorFilteraccording to https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#custom-filters and https://github.com/platformio/platformio-core/pull/4058 - Publish the new version to PyPi.
@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.
@ivankravets After spending some time on this, I think this is what you want to do.
<project_dir>/monitor directory is similar to
On second thought, I would like to suggest this. This suggestion is a minor modification to your idea, I guess.
- create this folder
/packages/tool-community-filter - any community filter like arduplot place the filter(subclass of DeviceMonitorFilter) is placed here
- 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?
@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
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/