Custom switch in Turnigy 9xr pro

ersky9xr is the port of the er9x firmware to the 9XRPRO radio.
Post Reply
ekranoplan
Posts: 3
Joined: Mon Oct 24, 2022 5:13 am
Country: -

Custom switch in Turnigy 9xr pro

Post by ekranoplan » Tue Oct 25, 2022 3:51 am

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


User avatar
MikeB
9x Developer
Posts: 17823
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Custom switch in Turnigy 9xr pro

Post by MikeB » Tue Oct 25, 2022 1:55 pm

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
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ekranoplan
Posts: 3
Joined: Mon Oct 24, 2022 5:13 am
Country: -

Re: Custom switch in Turnigy 9xr pro

Post by ekranoplan » Wed Oct 26, 2022 8:03 pm

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!

User avatar
MikeB
9x Developer
Posts: 17823
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Custom switch in Turnigy 9xr pro

Post by MikeB » Wed Oct 26, 2022 9:48 pm

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
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ekranoplan
Posts: 3
Joined: Mon Oct 24, 2022 5:13 am
Country: -

Re: Custom switch in Turnigy 9xr pro

Post by ekranoplan » Mon Oct 31, 2022 10:42 am

The problem is solved. Thank you so much master!!

Best regards,
Peter


Post Reply

Return to “ersky9xr”