idf.py: add monitor-baud option to monitor command
This commit is contained in:
parent
20742db676
commit
767cde7b1c
2 changed files with 42 additions and 20 deletions
|
@ -789,7 +789,7 @@ def main():
|
||||||
'--baud', '-b',
|
'--baud', '-b',
|
||||||
help='Serial port baud rate',
|
help='Serial port baud rate',
|
||||||
type=int,
|
type=int,
|
||||||
default=os.environ.get('MONITOR_BAUD', 115200))
|
default=os.getenv('IDF_MONITOR_BAUD', os.getenv('MONITORBAUD', 115200)))
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--make', '-m',
|
'--make', '-m',
|
||||||
|
|
|
@ -2,6 +2,8 @@ import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
from idf_py_actions.errors import FatalError
|
from idf_py_actions.errors import FatalError
|
||||||
from idf_py_actions.global_options import global_options
|
from idf_py_actions.global_options import global_options
|
||||||
from idf_py_actions.tools import ensure_build_directory, run_tool
|
from idf_py_actions.tools import ensure_build_directory, run_tool
|
||||||
|
@ -60,7 +62,7 @@ def action_extensions(base_actions, project_path):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def monitor(action, ctx, args, print_filter):
|
def monitor(action, ctx, args, print_filter, monitor_baud):
|
||||||
"""
|
"""
|
||||||
Run idf_monitor.py to watch build output
|
Run idf_monitor.py to watch build output
|
||||||
"""
|
"""
|
||||||
|
@ -81,7 +83,16 @@ def action_extensions(base_actions, project_path):
|
||||||
monitor_args = [PYTHON, idf_monitor]
|
monitor_args = [PYTHON, idf_monitor]
|
||||||
if args.port is not None:
|
if args.port is not None:
|
||||||
monitor_args += ["-p", args.port]
|
monitor_args += ["-p", args.port]
|
||||||
monitor_args += ["-b", project_desc["monitor_baud"]]
|
|
||||||
|
if not monitor_baud:
|
||||||
|
if os.getenv("IDF_MONITOR_BAUD"):
|
||||||
|
monitor_baud = os.getenv("IDF_MONITOR_BAUD", None)
|
||||||
|
elif os.getenv("MONITORBAUD"):
|
||||||
|
monitor_baud = os.getenv("MONITORBAUD", None)
|
||||||
|
else:
|
||||||
|
monitor_baud = project_desc["monitor_baud"]
|
||||||
|
|
||||||
|
monitor_args += ["-b", monitor_baud]
|
||||||
monitor_args += ["--toolchain-prefix", project_desc["monitor_toolprefix"]]
|
monitor_args += ["--toolchain-prefix", project_desc["monitor_toolprefix"]]
|
||||||
|
|
||||||
if print_filter is not None:
|
if print_filter is not None:
|
||||||
|
@ -119,7 +130,7 @@ def action_extensions(base_actions, project_path):
|
||||||
|
|
||||||
baud_rate = {
|
baud_rate = {
|
||||||
"names": ["-b", "--baud"],
|
"names": ["-b", "--baud"],
|
||||||
"help": "Baud rate.",
|
"help": "Baud rate for flashing.",
|
||||||
"scope": "global",
|
"scope": "global",
|
||||||
"envvar": "ESPBAUD",
|
"envvar": "ESPBAUD",
|
||||||
"default": 460800,
|
"default": 460800,
|
||||||
|
@ -148,24 +159,35 @@ def action_extensions(base_actions, project_path):
|
||||||
"options": [baud_rate, port],
|
"options": [baud_rate, port],
|
||||||
},
|
},
|
||||||
"monitor": {
|
"monitor": {
|
||||||
"callback": monitor,
|
"callback":
|
||||||
"help": "Display serial output.",
|
monitor,
|
||||||
|
"help":
|
||||||
|
"Display serial output.",
|
||||||
"options": [
|
"options": [
|
||||||
port,
|
port, {
|
||||||
{
|
|
||||||
"names": ["--print-filter", "--print_filter"],
|
"names": ["--print-filter", "--print_filter"],
|
||||||
"help": (
|
"help":
|
||||||
"Filter monitor output.\n"
|
("Filter monitor output.\n"
|
||||||
"Restrictions on what to print can be specified as a series of <tag>:<log_level> items "
|
"Restrictions on what to print can be specified as a series of <tag>:<log_level> items "
|
||||||
"where <tag> is the tag string and <log_level> is a character from the set "
|
"where <tag> is the tag string and <log_level> is a character from the set "
|
||||||
"{N, E, W, I, D, V, *} referring to a level. "
|
"{N, E, W, I, D, V, *} referring to a level. "
|
||||||
'For example, "tag1:W" matches and prints only the outputs written with '
|
'For example, "tag1:W" matches and prints only the outputs written with '
|
||||||
'ESP_LOGW("tag1", ...) or at lower verbosity level, i.e. ESP_LOGE("tag1", ...). '
|
'ESP_LOGW("tag1", ...) or at lower verbosity level, i.e. ESP_LOGE("tag1", ...). '
|
||||||
'Not specifying a <log_level> or using "*" defaults to Verbose level.\n'
|
'Not specifying a <log_level> or using "*" defaults to Verbose level.\n'
|
||||||
'Please see the IDF Monitor section of the ESP-IDF documentation '
|
'Please see the IDF Monitor section of the ESP-IDF documentation '
|
||||||
'for a more detailed description and further examples.'),
|
'for a more detailed description and further examples.'),
|
||||||
"default": None,
|
"default":
|
||||||
},
|
None,
|
||||||
|
}, {
|
||||||
|
"names": ["--monitor-baud", "-B"],
|
||||||
|
"type":
|
||||||
|
click.INT,
|
||||||
|
"help": ("Baud rate for monitor.\n"
|
||||||
|
"If this option is not provided IDF_MONITOR_BAUD and MONITORBAUD "
|
||||||
|
"environment variables and project_description.json in build directory "
|
||||||
|
"(generated by CMake from project's sdkconfig) "
|
||||||
|
"will be checked for default value."),
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"order_dependencies": [
|
"order_dependencies": [
|
||||||
"flash",
|
"flash",
|
||||||
|
|
Loading…
Reference in a new issue