From 236c4570cfad99bfd417f9a1efe1642a5130c1c0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2022 13:26:43 +0300 Subject: [PATCH] Added new ``monitor_encoding`` project configuration option // Resolve #4350 --- HISTORY.rst | 1 + docs | 2 +- platformio/device/monitor/command.py | 8 +++++--- platformio/project/options.py | 6 ++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 23fc34a1..caa6cf3a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,7 @@ PlatformIO Core 6 6.1.1 (2022-??-??) ~~~~~~~~~~~~~~~~~~ +* Added new ``monitor_encoding`` project configuration option to configure `Device Monitor `__ (`issue #4350 `_) * Allowed specifying project environments for `pio ci `__ command (`issue #4347 `_) * Show "TimeoutError" only in the verbose mode when can not find a serial port * Fixed an issue when a serial port was not automatically detected if the board has predefined HWIDs diff --git a/docs b/docs index 31b7d077..d2d72c9a 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 31b7d077be62b407798c69ea624fc6a28ebc64ac +Subproject commit d2d72c9a4e6c51d5bd2bd94fa7019d7bf6995565 diff --git a/platformio/device/monitor/command.py b/platformio/device/monitor/command.py index 44df4043..0a484eee 100644 --- a/platformio/device/monitor/command.py +++ b/platformio/device/monitor/command.py @@ -56,9 +56,11 @@ from platformio.project.options import ProjectOptions @click.option("--echo", is_flag=True, help="Enable local echo") @click.option( "--encoding", - default="UTF-8", - show_default=True, - help="Set the encoding for the serial port (e.g. hexlify, Latin1, UTF-8)", + help=( + "Set the encoding for the serial port " + "(e.g. hexlify, Latin1, UTF-8) [default=%s]" + % ProjectOptions["env.monitor_encoding"].default + ), ) @click.option( "-f", diff --git a/platformio/project/options.py b/platformio/project/options.py index 4c29b925..e1aa8280 100644 --- a/platformio/project/options.py +++ b/platformio/project/options.py @@ -567,6 +567,12 @@ ProjectOptions = OrderedDict( type=click.BOOL, default=False, ), + ConfigEnvOption( + group="monitor", + name="monitor_encoding", + description="Custom encoding (e.g. hexlify, Latin1, UTF-8)", + default="UTF-8", + ), # Library ConfigEnvOption( group="library",