platformio-vscode-ide icon indicating copy to clipboard operation
platformio-vscode-ide copied to clipboard

Selecting remote monitor does not pass the correct [env] to pio remote monitor

Open sticilface opened this issue 1 year ago • 0 comments

image

[platformio]
default_envs = mega_A_LEDS, mega_B_SWITCH, mega_C_RELAY, mega_D_2560, router, server

[env]
lib_deps = 
    gioblu/PJON@^13.1
build_flags = 
 -D PJON_PACKET_MAX_LENGTH=120
 -D PJON_MAX_PACKETS=2
 -D SWBB_MAX_ATTEMPTS=10
 -D PJON_INCLUDE_PACKET_ID=true
 -D PJON_INCLUDE_PORT
 -D PJON_MAX_RECENT_PACKET_IDS=1
 -D SWBB_MODE=2
 -D SWBB_RESPONSE_TIMEOUT=1500
 -D PJON_MASTER_ID=254

[env:mega_A_LEDS]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_port = /dev/cu.usbserial-100 
monitor_port = /dev/cu.usbserial-100 
;monitor_port = /dev/ttyUSB2
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_INCLUDE_SWBB
  -D PJON_ID=5
  -D PJON_PIN=2
  -D PJON_WAKE=3
  -D LED1_PIN=14
  -D LED2_PIN=15
  -D LED3_PIN=16
  -D ENABLE_LEDS=4
lib_deps = 
  ${env.lib_deps}

[env:mega_B_SWITCH]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_port = /dev/cu.usbserial-101
monitor_port = /dev/cu.usbserial-101 
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_INCLUDE_SWBB
  -D PJON_ID=6
  -D PJON_PIN=2
  -D PJON_WAKE=3
  -D SWITCH1_PIN=8
  -D SWITCH2_PIN=5
  -D SWITCH3_PIN=6
  -D SWITCH4_PIN=9
  -D SWITCH5_PIN=10
  -D SWITCH6_PIN=4
  -D LED1_PIN=14
  -D LED2_PIN=15
  -D LED3_PIN=16
lib_deps = 
  ${env.lib_deps}

[env:mega_C_RELAY]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_port = /dev/cu.usbserial-102
monitor_port = /dev/cu.usbserial-102
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_INCLUDE_SWBB
  -D PJON_ID=7
  -D PJON_PIN=2
  -D PJON_WAKE=3
  -D SWITCH1_PIN=8
  -D SWITCH2_PIN=5
  -D SWITCH3_PIN=6
  -D SWITCH4_PIN=9
  -D SWITCH5_PIN=10
  -D SWITCH6_PIN=4
  -D LED1_PIN=14
  -D LED2_PIN=15
  -D LED3_PIN=16
lib_deps = 
  ${env.lib_deps}

[env:mega_D_2560]
platform = atmelavr
board = ATmega2560
framework = arduino
upload_port = /dev/cu.usbserial-103
monitor_port = /dev/cu.usbserial-103 
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_INCLUDE_SWBB
  -D PJON_ID=8
  -D PJON_PIN=3
  -D PJON_WAKE=2
  -D LED1_PIN=14
  -D LED2_PIN=15
  -D LED3_PIN=16
  -D I2C_PD_ACTIVATE_PIN=10
  -D USB_DEVICE_CONNECTED_PIN=12
  -D MEASURE_12V_PIN=A0
  -D MEASURE_5V_PIN=A1
  -D MEASURE_3V3_PIN=A2
  -D MEASURE_TEMP_PIN=A4
  -D SHUTDOWN_TEMP_PIN=22
  -D SWITCH1_PIN=46
  -D SWITCH2_PIN=47
  -D ESP_EN_PIN=48
  -D ESP_RST_PIN=49
lib_deps = 
  ${env.lib_deps}


[env:router]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_port = /dev/cu.usbserial-1103
monitor_port = /dev/cu.usbserial-1103
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_ID=9
  -D PJON_PIN=2
  -D PJON_LED_PIN=5
  -D PJON_WAKE=4
  -D I2C_LED=6
  -D INT_OUT=10
  -D INT_IN=3 ; Port expander int... not sure of role here.  it can maybe used wake the ESP32
lib_deps = 
  ${env.lib_deps}

[env:server]
board = lolin_d32_pro
platform = espressif32
framework = arduino
;upload_port =   /dev/cu.usbserial-1102
upload_port =   /dev/ttyUSB2
upload_protocol = esptool
;monitor_port =   /dev/cu.usbserial-1102
monitor_port = /dev/ttyUSB2
upload_speed = 2000000
monitor_speed = 115200
build_src_filter = +<./${PIOENV}/*.cpp> +<./${PIOENV}/*.h>
build_flags = 
  ${env.build_flags}
  -D PJON_ID=254
lib_deps = 
  ${env.lib_deps}

[env:buspirate]
platform = atmelavr
board = ATmega328P
framework = arduino
upload_protocol = buspirate
upload_flags =
    -P$UPLOAD_PORT
    -b$UPLOAD_SPEED
    -V
    -v
upload_port =  /dev/cu.usbserial-AI04Y0KK
upload_speed = 115200

I have several environments specified. When I am using the 'server' environment... The correct port via '''pio remote list''' is '/dev/ttyUSB2' which I have set for both 'upload_port' and 'monitor_port'. When I run 'remote upload' it works correctly. When I run 'remote monitor' it uses the 'monitor_port' specified in the 1st environment which is '[env:mega_A_LEDS]'. If I set the monitor port in '[env:mega_A_LEDS]' to '/dev/ttyUSB2' then it works correctly, but this is obviously not good as this env has its own monitor port.

image

Looking at the command being used it looks like it is missing the correct env setting as manually running

'''pio remote device monitor -e server'''

image

sticilface avatar Jul 21 '24 14:07 sticilface