You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/userguide/device/cmd_monitor.rst
+45-13Lines changed: 45 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,8 +175,12 @@ You can also specify which environments should be processed by default using
175
175
Filters
176
176
-------
177
177
178
-
A list of filters that can be applied for monitor output using :option:`pio device monitor --filter` or :ref:`projectconf` and :ref:`projectconf_monitor_filters` options.
179
-
option.
178
+
PlatformIO allows you to apply multiple filters to the device monitor INPUT & OUTPUT
179
+
streams using :option:`pio device monitor --filter` command or
180
+
:ref:`projectconf_monitor_filters` option.
181
+
182
+
Built-in Filters
183
+
~~~~~~~~~~~~~~~~
180
184
181
185
.. list-table::
182
186
:header-rows: 1
@@ -208,8 +212,46 @@ option.
208
212
* - ``esp8266_exception_decoder``
209
213
- Custom filter for :ref:`platform_espressif8266` which decodes crash exception
210
214
215
+
.. _cmd_device_monitor_custom_filters:
216
+
217
+
Custom Filters
218
+
~~~~~~~~~~~~~~
219
+
220
+
:ref:`piocore` provides an API to extend device monitor with custom filters declared
221
+
in :ref:`projectconf_pio_monitor_dir` or in "monitor" folder of :ref:`platforms`.
222
+
Each filter is a Python-based file and its name should have the ``filter_`` prefix.
223
+
In a Python code, you need to extend ``DeviceMonitorFilter`` class to get access to
224
+
the ``rx()`` and ``tx()`` methods/callbacks. See the base API below:
225
+
226
+
**filter_demo.py**
227
+
228
+
.. code-block:: python
229
+
230
+
from platformio.commands.device import DeviceMonitorFilter
0 commit comments