Skip to content

Commit 0782340

Browse files
[VSC-1721] add detect option auto assign serial port, show current selected port (#1632)
* add detect option auto assing serial port, show current selected port * add missing chip arg to detect option * add readSerialPort function to read serial port and detect * fix convertMacOSPortName * fix serial port not updated in settings * update only on flash related tasks add update * add setting to configure detection timeout * remove await to not block calling function progress
1 parent 859eb22 commit 0782340

28 files changed

+556
-122
lines changed

docs_espressif/en/settings.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ These settings are specific to the ESP32 Chip/Board.
120120
- Enable use of ``idf.usbSerialPortFilters`` list to filter serial port devices list. Scope can only be **Global (User Settings)**.
121121
* - **idf.usbSerialPortFilters**
122122
- USB productID and vendorID list to filter known Espressif devices. Scope can only be **Global (User Settings)**.
123+
* - **idf.serialPortDetectionTimeout**
124+
- Timeout in seconds for serial port detection using esptool.py (Default: 60)
123125
* - **openocd.jtag.command.force_unix_path_separator**
124126
- Forced to use ``/`` instead of ``\\`` as path separator for Win32 based OS
125127
* - **idf.svdFilePath**
@@ -136,6 +138,7 @@ This is how the extension uses them:
136138
5. **idf.openOcdDebugLevel** is the log level for OpenOCD server output from 0 (error messages only) to 4 (Verbose low-level debug message).
137139
6. **idf.openOcdLaunchArgs** is the launch arguments string array for OpenOCD. If not defined, the resulting OpenOCD launch command looks like this: ``openocd -d${idf.openOcdDebugLevel} -f ${idf.openOcdConfigs}``.
138140
7. **idf.jtagFlashCommandExtraArgs** is used for OpenOCD JTAG flash task. Please review `Upload application for debugging <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.html#upload-application-for-debugging>`.
141+
8. **idf.serialPortDetectionTimeout** is the timeout value in seconds used for the **ESP-IDF: Select Port** command when auto-detecting serial ports using esptool.py. This setting allows users to configure how long the extension should wait when scanning for compatible devices on available serial ports.
139142

140143
.. note::
141144

docs_espressif/zh_CN/settings.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ ESP-IDF 相关设置
108108
- 启用 ``idf.usbSerialPortFilters`` 列表以过滤串口设备列表
109109
* - **idf.usbSerialPortFilters**
110110
- 用于过滤已知乐鑫设备的 USB productID 和 vendorID 列表
111+
* - **idf.serialPortDetectionTimeout**
112+
- 使用 esptool.py 检测串口时的超时时间(秒)(默认值:60)
111113
* - **openocd.jtag.command.force_unix_path_separator**
112114
- 强制在 Windows 操作系统中使用 ``/`` 作为路径分隔符,而不是 ``\\``
113115
* - **idf.svdFilePath**
@@ -124,6 +126,7 @@ ESP-IDF 相关设置
124126
5. **idf.openOcdDebugLevel** 是 OpenOCD 服务器输出的日志级别,范围为 0 到 4。
125127
6. **idf.openOcdLaunchArgs** 是用于配置 OpenOCD 启动的参数字符串数组。生成的 OpenOCD 启动命令格式如下:``openocd -d${idf.openOcdDebugLevel} -f ${idf.openOcdConfigs} ${idf.openOcdLaunchArgs}``。
126128
7. **idf.jtagFlashCommandExtraArgs** 用于OpenCD JTAG闪存任务。请查看 `上传待调试的应用程序 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/jtag-debugging/index.html#jtag-upload-app-debug>`.
129+
8. **idf.serialPortDetectionTimeout** 是用于 **ESP-IDF:选择端口** 命令的超时值(秒),当使用 esptool.py 自动检测串口时使用。此设置允许用户配置扩展在扫描可用串口上的兼容设备时应等待多长时间。
127130

128131
.. note::
129132

l10n/bundle.l10n.es.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
"Error encountered while calling idf_size.py": "Error encontrado al llamar a idf_size.py",
136136
"Select the available serial port where your device is connected.": "Seleccione el puerto serie disponible donde está conectado su dispositivo.",
137137
"Port has been updated to ": "El puerto ha sido actualizado a ",
138+
"No serial port found for current IDF_TARGET: {0}": "No se encontró puerto serie para el IDF_TARGET actual: {0}",
139+
"Detecting Espressif device serial port...": "Detectando puerto serie del dispositivo Espressif...",
140+
"Auto-detect port (let esptool.py find the device automatically)": "Detección automática de puerto (deja que esptool.py encuentre el dispositivo automáticamente)",
138141
"{buildFile} doesn't exist. Build first.": "{buildFile} no existe. Compile primero.",
139142
"SDK Configuration editor": "Editor de configuración del SDK",
140143
"Save": "Ahorrar",
@@ -201,6 +204,7 @@
201204
"{0} settings will be removed.": "{0} configuraciones serán eliminadas.",
202205
"Yes": "",
203206
"No": "No",
207+
"Detect": "Detectar",
204208
"Starting ESP-IDF settings cleanup...": "Iniciando limpieza de configuraciones ESP-IDF...",
205209
"Removed {0} setting: {1}": "Configuración {0} eliminada: {1}",
206210
"Warning: Could not fully remove setting {0}: {1}": "Advertencia: No se pudo eliminar completamente la configuración {0}: {1}",

l10n/bundle.l10n.pt.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
"Error encountered while calling idf_size.py": "Erro encontrado ao chamar idf_size.py",
136136
"Select the available serial port where your device is connected.": "Selecione a porta serial disponível onde seu dispositivo está conectado.",
137137
"Port has been updated to ": "A porta foi atualizada para ",
138+
"No serial port found for current IDF_TARGET: {0}": "Nenhuma porta serial encontrada para o IDF_TARGET atual: {0}",
139+
"Detecting Espressif device serial port...": "Detectando porta serial do dispositivo Espressif...",
140+
"Auto-detect port (let esptool.py find the device automatically)": "Detectar porta automaticamente (deixe o esptool.py encontrar o dispositivo automaticamente)",
138141
"{buildFile} doesn't exist. Build first.": "{buildFile} {buildFile} não existe. Crie primeiro.",
139142
"SDK Configuration editor": "Editor de configuração do SDK",
140143
"Save": "Salvar",
@@ -202,6 +205,7 @@
202205
"{0} settings will be removed.": "{0} configurações serão removidas.",
203206
"Yes": "Sim",
204207
"No": "Não",
208+
"Detect": "Detectar",
205209
"Starting ESP-IDF settings cleanup...": "Iniciando limpeza das configurações ESP-IDF...",
206210
"Removed {0} setting: {1}": "Configuração ${0} removida: {1}",
207211
"Warning: Could not fully remove setting {0}: {1}": "Aviso: Não foi possível remover completamente a configuração {0}: {1}",

l10n/bundle.l10n.ru.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
"Error encountered while calling idf_size.py": "Ошибка при вызове idf_size.py",
136136
"Select the available serial port where your device is connected.": "Выберите доступный последовательный порт, к которому подключено ваше устройство.",
137137
"Port has been updated to ": "Порт обновлен до ",
138+
"No serial port found for current IDF_TARGET: {0}": "Последовательный порт не найден для текущего IDF_TARGET: {0}",
139+
"Detecting Espressif device serial port...": "Обнаружение последовательного порта устройства Espressif...",
140+
"Auto-detect port (let esptool.py find the device automatically)": "Автоматически определить порт (пусть esptool.py найдет устройство)",
138141
"{buildFile} doesn't exist. Build first.": "{buildFile} не существует. Сначала выполните сборку.",
139142
"SDK Configuration editor": "Редактор конфигурации SDK",
140143
"Save": "Сохранить",
@@ -202,6 +205,7 @@
202205
"{0} settings will be removed.": "{0} настроек будет удалено.",
203206
"Yes": "Да",
204207
"No": "Нет",
208+
"Detect": "Обнаружить",
205209
"Starting ESP-IDF settings cleanup...": "Начинается очистка настроек ESP-IDF...",
206210
"Removed {0} setting: {1}": "Удалена {0} настройка: {1}",
207211
"Warning: Could not fully remove setting {0}: {1}": "Предупреждение: Не удалось полностью удалить настройку {0}: {1}",

l10n/bundle.l10n.zh-CN.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
"Error encountered while calling idf_size.py": "调用 idf_size.py 时出错",
136136
"Select the available serial port where your device is connected.": "为设备选择可用的串口。",
137137
"Port has been updated to ": "端口已更新为 ",
138+
"No serial port found for current IDF_TARGET: {0}": "未找到当前 IDF_TARGET 的串口:{0}",
139+
"Detecting Espressif device serial port...": "正在检测 Espressif 设备串口...",
140+
"Auto-detect port (let esptool.py find the device automatically)": "自动检测端口(让 esptool.py 自动查找设备)",
138141
"{buildFile} doesn't exist. Build first.": "{buildFile}不存在,请先进行生成。",
139142
"SDK Configuration editor": "SDK 配置编辑器",
140143
"Save": "保存",
@@ -202,6 +205,7 @@
202205
"{0} settings will be removed.": "{0}个设置将被删除。",
203206
"Yes": "",
204207
"No": "",
208+
"Detect": "检测",
205209
"Starting ESP-IDF settings cleanup...": "正在开始清理ESP-IDF设置...",
206210
"Removed {0} setting: {1}": "已删除 {0} 设置:{1}",
207211
"Warning: Could not fully remove setting {0}: {1}": "警告:无法完全删除设置 {0}:{1}",

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,13 @@
701701
},
702702
"idf.port": {
703703
"type": "string",
704-
"default": "/dev/ttyUSB1",
704+
"default": "detect",
705705
"description": "%param.port%",
706706
"scope": "resource"
707707
},
708708
"idf.portWin": {
709709
"type": "string",
710-
"default": "COM1",
710+
"default": "detect",
711711
"description": "%param.port%",
712712
"scope": "resource"
713713
},
@@ -1289,6 +1289,12 @@
12891289
"items": {
12901290
"type": "string"
12911291
}
1292+
},
1293+
"idf.serialPortDetectionTimeout": {
1294+
"type": "number",
1295+
"default": 60,
1296+
"scope": "resource",
1297+
"description": "%param.serialPortDetectionTimeout%"
12921298
}
12931299
}
12941300
}
@@ -1384,6 +1390,12 @@
13841390
"category": "ESP-IDF",
13851391
"when": "!isWeb"
13861392
},
1393+
{
1394+
"command": "espIdf.detectSerialPort",
1395+
"title": "%espIdf.detectSerialPort.title%",
1396+
"category": "ESP-IDF",
1397+
"when": "!isWeb"
1398+
},
13871399
{
13881400
"command": "espIdf.buildDevice",
13891401
"title": "%espIdf.buildDevice.title%",

package.nls.es.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
"espIdf.selectNotificationMode.title": "Seleccionar modo de notificación y salida",
8585
"espIdf.selectOpenOcdConfigFiles.title": "Seleccionar archivos de configuración de placa OpenOCD",
8686
"espIdf.selectPort.title": "Seleccionar puerto a usar (COM, tty, usbserial)",
87-
"espIdf.setClangSettings.title": "Configurar el proyecto para usar ESP-Clang",
87+
"espIdf.detectSerialPort.title": "Detectar puerto serie",
88+
"espIdf.setClangSettings.title": "Configurar el proyecto para usar ESP-Clang",
8889
"espIdf.setGcovConfig.title": "Configurar SDKConfig del proyecto para cobertura",
8990
"espIdf.setMatterDevicePath.title": "Establecer Ruta del Dispositivo ESP-MATTER (ESP_MATTER_DEVICE_PATH)",
9091
"espIdf.setTarget.title": "Establecer Objetivo del Dispositivo Espressif",
@@ -186,6 +187,7 @@
186187
"param.hasWalkthroughBeenShown": "Indica si se ha mostrado el recorrido de bienvenida",
187188
"param.unitTestFilePattern.title": "Patrón glob para descubrir archivos de prueba unitaria",
188189
"param.pyTestEmbeddedServices.title": "Lista de servicios integrados para la ejecución de pytest",
190+
"param.serialPortDetectionTimeout": "Tiempo de espera en segundos para la detección del puerto serie usando esptool.py",
189191
"trace.poll_period.description": "poll_period se establecerá para el rastreo de la aplicación",
190192
"trace.skip_size.description": "skip_size se establecerá para el rastreo de la aplicación",
191193
"trace.stop_tmo.description": "stop_tmo se establecerá para el rastreo de la aplicación",

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"espIdf.selectNotificationMode.title": "Select Output and Notification Mode",
8585
"espIdf.selectOpenOcdConfigFiles.title": "Select OpenOCD Board Configuration",
8686
"espIdf.selectPort.title": "Select Port to Use (COM, tty, usbserial)",
87+
"espIdf.detectSerialPort.title": "Detect Serial Port",
8788
"espIdf.setClangSettings.title": "Configure project for ESP-Clang",
8889
"espIdf.setGcovConfig.title": "Configure Project SDKConfig for Coverage",
8990
"espIdf.setMatterDevicePath.title": "Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH)",
@@ -187,6 +188,7 @@
187188
"param.hasWalkthroughBeenShown": "Has the walkthrough been shown",
188189
"param.unitTestFilePattern.title": "Glob pattern for unit test files to discover",
189190
"param.pyTestEmbeddedServices.title": "List of embedded services for pytest execution",
191+
"param.serialPortDetectionTimeout": "Timeout in seconds for serial port detection using esptool.py",
190192
"trace.poll_period.description": "poll_period will be set for the apptrace",
191193
"trace.skip_size.description": "skip_size will be set for the apptrace",
192194
"trace.stop_tmo.description": "stop_tmo will be set for the apptrace",

package.nls.pt.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
"espIdf.selectNotificationMode.title": "Selecione o modo de saída e notificação",
8585
"espIdf.selectOpenOcdConfigFiles.title": "Selecione a configuração da placa OpenOCD",
8686
"espIdf.selectPort.title": "Selecione a porta a ser usada (COM, tty, usbserial)",
87-
"espIdf.setClangSettings.title": "Configurar o projeto para ESP-Clang",
87+
"espIdf.detectSerialPort.title": "Detectar porta serial",
88+
"espIdf.setClangSettings.title": "Configurar o projeto para ESP-Clang",
8889
"espIdf.setGcovConfig.title": "Configurar o projeto SDKConfig para cobertura",
8990
"espIdf.setMatterDevicePath.title": "Definir caminho do dispositivo ESP-MATTER (ESP_MATTER_DEVICE_PATH)",
9091
"espIdf.setTarget.title": "Definir destino do dispositivo Espressif",
@@ -185,6 +186,7 @@
185186
"param.hasWalkthroughBeenShown": "Mostrar o guia de introdução na inicialização da extensão",
186187
"param.unitTestFilePattern.title": "Padrão glob para descobrir arquivos de teste unitário",
187188
"param.pyTestEmbeddedServices.title": "Lista de serviços incorporados para execução do pytest",
189+
"param.serialPortDetectionTimeout": "Tempo limite em segundos para detecção de porta serial usando esptool.py",
188190
"trace.poll_period.description": "poll_period será definido para o apptrace",
189191
"trace.skip_size.description": "skip_size será definido para o apptrace",
190192
"trace.stop_tmo.description": "stop_tmo será definido para o apptrace",

0 commit comments

Comments
 (0)