Skip to content

Save last UnifiedConfiguration as default for target - #3449

Merged
CapnBry merged 5 commits into
ExpressLRS:masterfrom
CapnBry:default-unified-conf
Feb 8, 2026
Merged

CapnBry merged 5 commits into
ExpressLRS:masterfrom
CapnBry:default-unified-conf

Conversation

@CapnBry

@CapnBry CapnBry commented Dec 16, 2025 •

Copy link
Copy Markdown
Member

QOL feature to save the product chosen during UnifiedConfiguration to allow the developer to just press enter to apply the last used configuration instead of having to remember which number they are working with each time. Upload also will use the default without prompting.

The product is saved per-target without the upload method, e.g Unified_LR1121_TX_via_WIFI is the same as Unified_LR1121_TX_via_UART. The value is stored in .pio/default_target_config.json just to keep it out of the way. PIO might periodically remove this directory but no real loss here as it is just here to allow us to press enter after starting a build to have it build, append the config, while going to get a drink!

  • This changes the behavior when pressing "enter" from "leave bare" to "use default" and the default is to leave bare if there's no previously-saved default.
  • An entry of '0' will force a leave bare operation.
  • Leaving bare will not save any default.
  • No prompt for which configuration to apply will be presented if there are no configurations for the built module_type, frequency, and platform.
  • UPLOAD PlatformIO task will not prompt if there is a default, and just use the default
  • CLEAN PlatformIO task will clear the default for that target
appendConfiguration([".pio/build/Unified_ESP32_LR1121_TX_via_WIFI/firmware.bin"], [".pio/build/Unified_ESP32_LR1121_TX_via_WIFI/firmware.elf"])
0) Leave bare (no configuration)
1) BAYCKRC 900/2400 Dual Band 1W Micro Gemini TX
2) BAYCKRC 900/2400 Dual Band 1W Nano Gemini TX
3) BAYCKRC 900/2400 Dual Band 1W Nano TX
4) Gemini XrossBand 2.4/900 TX
5) RadioMaster GX12 2.4/900 TX
6) RadioMaster Nomad 2.4/900 TX
7) RadioMaster TX15 2.4/900 TX
default) RadioMaster Nomad 2.4/900 TX
Choose a configuration to load into the firmware file

@CapnBry CapnBry added enhancement 🪄 New feature or request V4.1 🍑 labels Dec 16, 2025

@pkendall64 pkendall64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice QoL feature for us devs. 👏

@mha1 mha1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my keyboard says "yay"

@CapnBry

CapnBry commented Dec 17, 2025

Copy link
Copy Markdown
Member Author

Oh so I wasn't the only person struggling to remember if Generic 8285 RX was 16 or 18? :-D

I'd also like to implement that if you're performing the platformio "Upload" operation (not just build), it skips the interactive prompt and just uses the default if it exists for the target. How do you feel about that, and if you like that idea too, does anyone have suggestions on how to better pass all this information to the DoConfiguration function that now has like 10 parameters? Passing a dict with string values would be a terrible solution and passing a class with just all the parameters in a struct-like form just adds more code for callers without any benefit. Is 10 function parameters the only way?

@pkendall64

Copy link
Copy Markdown
Collaborator

Sadly, I think 10 params is probably the only way 😮‍💨

@CapnBry

CapnBry commented Dec 22, 2025 •

Copy link
Copy Markdown
Member Author

The only way to detect "upload" is pretty crazy since it isn't in the PIO environment

  • In a pre: script there's globals().get('COMMAND_LINE_TARGETS', []) which will return ['upload'] if it is an upload task, but it is not in the environment of the post build step.
  • There's an SCons.Script.COMMAND_LINE_TARGETS member in the post-build step which has the same value so I wrote a function that hopefully just looks and sees if this module is currently loaded and sees if it has this value it in is_pio_upload() that hopefully x2 works when the script is run standalone doing a binary configure operation

The default is always used on an "Upload" PIO operation, so if you need to clear it, use the "Clean" PIO operation which will remove the target's product default from the json file.

@CapnBry
CapnBry merged commit 1a23ca1 into ExpressLRS:master Feb 8, 2026
@CapnBry
CapnBry deleted the default-unified-conf branch February 8, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🪄 New feature or request V4.1 🍑

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants