EdgeTX / edgetx

EdgeTX is the cutting edge open source firmware for your R/C radio
https://edgetx.org
GNU General Public License v2.0
1.54k stars 329 forks source link

Enable supply for AUX1 / AUX2 (TX16S) does not work after off/on #4632

Open wimalopaan opened 6 months ago

wimalopaan commented 6 months ago

Is there an existing issue for this problem?

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

Switching on the supply for AUX1/AUX2 under system->hardware works. But if the radio is then switched off and then on again, the supply for AUX1/AUX2 is not on, altough the toggle button in the UI is on. One has to de/activate the supply to turn it on again.

Expected Behavior

After power-cycle of the radio the supply for AUX1/AUX2 is on if the UI-button is also on.

Steps To Reproduce

Turn on supply for AUX1. Measure on supply-pin of AUX1 to verify. Power-cycle the radio. Measure on supply-pin again.

Version

Nightly (Please give date/commit below)

Transmitter

RadioMaster TX16S / TX16SMK2

Operating System (OS)

No response

OS Version

No response

Anything else?

No response

pfeerick commented 6 months ago

What mode do you have AUX1 configured in? As I don't seem to be able to reproduce this.

With AUX2, it appears to only happen when set to OFF or "Telemetry In" ... all the other modes appear to honour the power setting.

Are you using a recent bootloader? As IIRC there was a change in the bootloader back when the power switching toggles were added, which may have some impact here.

wimalopaan commented 6 months ago

I'm using the actual 07e0bfa git version. And flashed also the bootloader to this version.

I'm using "Telemetry In" at AUX2: in this mode the power supply turns not on, but - you are right - switching e.g. to "LUA" mode the power supply turn on on powercycle the radio.

pfeerick commented 6 months ago

Thanks for the confirm, looks like we're seeing the exact same behaviour then.

Tracing back through the code, all that I think of so far is this check (or the serialSetPowerState() function itself) as a possible culprit as initSerialPorts() is responsible for initialising all the serial ports at boot, calls serialInit() to initialise each port (including power state if it is controllable) as needed, but the call to serialSetPowerState() then has a limiter on it. We know that serialSetPower() works as it is what is called when you flip the toggles in the Radio Settings -> Hardware page. Which makes this even more fun because it calls serialSetPowerState() itself, suggesting that function does work... What a rabbit hole! Guess will need the debugger for this one :rofl:

https://github.com/EdgeTX/edgetx/blob/07e0bfa4bd77c1b49ad38f3c6f82a8b2ae15a5c7/radio/src/serial.cpp#L477-L478