Page 1 of 1

Custom switch in Turnigy 9xr pro

Posted: Tue Oct 25, 2022 3:51 am
by ekranoplan
Hello all. I'm new to this forum and RC project.

Recently, I have a project customize a new RC based on Sky board. I want to change 2-pos switch (it is 3-pos in the firmware, such as SW_GEAR) to push button to switch between 2 states every time I push it. Now, when I push the button, the pwm rate (status of switch) changes but when I release, it turns back to the begin rate. I have read the firmware ersky9x, I found a function getMovedSwitch() where these switches are coded but I don't know how to modify the code to change from toggle switch to push switch. Can you guy show me how to solve it?

Thanks in advance!
Peter

Re: Custom switch in Turnigy 9xr pro

Posted: Tue Oct 25, 2022 1:55 pm
by MikeB
The SKY board is an upgrade for the 9X, so, by default, the only 3-pos switch is the ID0-ID1-ID2 switch, all the others are 2-pos switches.
By using a logical switch, you may achieve your aim, no need to modify the firmware.
Set up a logical switch:
L1 F-flop GEA !L1
This will then change state (toggle) every time the GEA switch turns on. So then just use L1 to control your output.

Mike

Re: Custom switch in Turnigy 9xr pro

Posted: Wed Oct 26, 2022 8:03 pm
by ekranoplan
Hello Mike!

You mentioned setting up a logical switch (L1 F-flop GEA !L1). I don't get it very well. If I remember correctly, there is a logic switch in the device. But I never used it (I have no experience with it). You mean I'm going to use that to set up a logical switch? Or I need to make an external F-flop circuit?

Thank you so much!

Re: Custom switch in Turnigy 9xr pro

Posted: Wed Oct 26, 2022 9:48 pm
by MikeB
Yes, there are logical switches in the firmware (24 of them available!), so no hardware needed.
So just set the first logical switch (L1) as I show above, then you may use L1 as the source of a mix, and then the output of the channel the mix is on will change between 1mS and 2mS as L1 changes (actually 0.988 and 1.012mS).

Mike

Re: Custom switch in Turnigy 9xr pro

Posted: Mon Oct 31, 2022 10:42 am
by ekranoplan
The problem is solved. Thank you so much master!!

Best regards,
Peter