Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Console uses different environment than Terminal #4597

Closed
dzid26 opened this issue Apr 12, 2023 · 1 comment
Closed

Debug Console uses different environment than Terminal #4597

dzid26 opened this issue Apr 12, 2023 · 1 comment

Comments

@dzid26
Copy link

dzid26 commented Apr 12, 2023

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.

@ivankravets
Copy link
Member

Thanks for the report. Please re-test with pio upgrade --dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants