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

Add config option to disable TX backpack #2054

Merged
merged 3 commits into from Mar 2, 2023

Conversation

CapnBry
Copy link
Member

@CapnBry CapnBry commented Jan 20, 2023

This adds a Lua config option to disable the TX Backpack on hardware where the backpack's enable pin is wired to the main MCU. Disabling the Backpack saves ~80mA @ 3.3V.

Details

We all love our backpacks and VTX admin, but what if we didn't? The backpack always has its wifi block running and therefore pulls quite a bit of power. On the OG Zorro hardware, it consumes 0.36W (13% total handset power), and on the Boxer it is a little less, at 0.28W (14% total handset power). For weirdos who are like "idgaf about backpak", I offer an option to just turn it off entirely in software.

The option is under > Backpack in the Lua and is just Backpack: Off/On (default On). Setting it to Off will change the display of all Backpack sub-options to "Disabled" (although their configured values are retained). The user is prevented from changing the values of any of the suboptions as long as the backpack is disabled.

This is available on anything that has a GPIO_PIN_BACKPACK_EN, which are:

  • RadioMaster TX16S MkII
  • RadioMaster TX12 MkII
  • RadioMaster Zorro
  • RadioMaster Boxer -- Tested
  • RadioMaster Ranger (Bling)
  • RadioMaster Ranger Micro -- Tested
  • RadioMaster Ranger Nano
  • EMAX 2400 OLED
  • EMAX 900 OLED
  • EMAX 900 Nano
  • Anything using the generic DupleTX target

Config changes

This uses an unused bit in the main config struct, which is defaulted to 0 already so the option is backpackDisabled (instead of the logical backpackEnabled). On ESP32, because the config loader checks for the presence of the item, there's no need to increment the config version. If the value isn't there, it will just stay the default of backpackDisabled = 0. Dumber platforms that use the struct get 0 default as well due to the entire struct being set to 0 to start.

FAQ

Why didn't you make it "On a switch" so the backpack can be disabled when armed or just turned on to change VTX channels? Wouldn't that be super useful?

It would be! Unfortunately, our Lua script has already exceeded the tipping point for using too much RAM and frequently OOM crashes on some handsets. Adding a select with all the switch names and positions in it is a massive RAM hog. Even adding this makes me a bit nervous. We can revisit this when the Lua is rewritten at some point.

What about devices without a BACKPACK_EN pin, maybe a software solution?

Yes, that would be a good idea too. At some point a more formal CRSF-based backpack protocol should be realized, which would allow setting the mode of the backpack: Wifi Telemetry Mode (telem mirror over wifi AP from the backpack, VTX (current mode), Disabled (ESP deep sleep). The complexity of creating such a system touches a lot of code in both this and the backpack project. The Disabled mode would also be somewhat janky because once it is in deep sleep, it can't receive the serial command to take it out of that mode. The user is stuck rebooting if they want to change it from Disabled to anything else.

@freasy
Copy link

freasy commented Jan 20, 2023

Can confirm, it's working!

DIY ESP32 E28 with ESP-01F module (EN to GPIO33 via flying wire)
QX7 ACCST

backpack off - goggles get no image after power on
backpack on - goggles get image after power on 🙂

@wvarty
Copy link
Collaborator

wvarty commented Mar 2, 2023

@CapnBry looks like this is ready to go once conflicts are resolved.

# Conflicts:
#	src/lib/LUA/tx_devLUA.cpp
# Conflicts:
#	src/lib/LUA/tx_devLUA.cpp
@pkendall64 pkendall64 merged commit fd962f6 into ExpressLRS:master Mar 2, 2023
@CapnBry CapnBry deleted the user-backpack-en branch June 22, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants