Skip to content

Debug Console uses different environment than Terminal #4597

@dzid26

Description

@dzid26

Configuration

Operating system:
Windows 11
PlatformIO Version (platformio --version):
6.1.6

Description of the problem

Debug console uses an environment from default_envs rather than one containing build_type = debug and the whole thing builds twice

Steps to Reproduce

  1. Clone https://github.com/dzid26/StepperServoCAN/tree/40397a218978ff0f77b2964e72a9b1478b8d6af4/firmware
  2. Replace platformio.ini with the one provided here Debugger does not honor selected environment #4098 (comment)
  3. Environment switcher is set to Default (Auto).
  4. Run debug (F5)

Actual Results

Terminal builds ServoCAN_debug env.
Debug console clears build folder and build ServoCAN env

Expected Results

Both terminal and debug console should build ServoCAN_debug env when debugging is run because ServoCAN_debug contains build_type = debug directive.

If problems with PlatformIO Build System:

Additional info

If I change the default env on the toolbar or modify "projectEnvName": to "ServoCAN_debug" manually then both terminal and debug_console build the same thing.

I used Python debugger to figure out what was going on.
So far I noticed that the terminal uses the following to determine the environment name,

for env in default_envs:
if config.get("env:" + env, "build_type") == "debug":
return env
for env in all_envs:
if config.get("env:" + env, "build_type") == "debug":
return env
return default_envs[0] if default_envs else all_envs[0]

while Debug console uses
environment and env not in environment,
not environment and default_envs and env not in default_envs,
logic for some reason.

I think both should use the same determination logic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions