Lua scripting LED lights switch on by vtx power switches

@Yuri_Rage
I notice something that I did not set. but it happens. The ws2812 led is not on until the vtx power switches to the low postion. the script I was using is a color change with roll position change. once its on it will not be off again with vtx power change again. I don’t why this is happening.

my goal is to assign a switch to turn on or off the ws2812 led by any lua script which can make led indicating roll changing or something like that.

here are the lua scripts I am using and bin file of the plane.

I’m sorry, I still do not understand. Let me ask a few simple questions:

Is there a power supply problem to your LEDs? Is it caused by the VTX power?

OR

Do you want the LEDs to turn on when the VTX power is switched low?

OR

Do you want to separate the LED function from the VTX? In which case, we will need more information about how things are wired.

ALSO

When you say “switch,” what do you mean? An RC channel assignment?

I recognize that we may be dealing with a bit of a language barrier here, so I will try to be patient.

Thank you for your patient. I appreciate it.

I don’t have power supply problem. The switch of VTX power can turn on the LED which I did want to do so and it happened anyway. and I don’t know why and I would to know why.

It is a coincident which I would find it out why.

yes I want to separate the led function from the VTX. WS2812 connected to the LED of matekF765wing ((EOL)Flight Controller F765-WING – Matek Systems) . VTX is rushtank plus by using smartaudio to adjust the power which was working fine.

Yes. the switch is the RC channel assignment.
pleae tell me if there is still anything missing. I am chinese and telling such stuff is kind chanllenge to me. but I will try to make it clear.

Thank you for your time.

another two things to tell if you could help.

1, why the failsafe is on for the reason3. the rssi was pretty much 50% above. and the plane was just couple of km away. can you tell what is the reason to cause this failsafe.
https://onedrive.live.com/redir?resid=7793DECAD4FD72F!8883&authkey=!AIL6EIYLhf_nJmM&e=rrXzJI

2, why powering on the FC while the VTX power switch is at non low position. then I switch it again. the FC will be rebooted even the plane was armed. lucky I didn’t change it when the plane in the air.