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
Custom switch in Turnigy 9xr pro
-
- Posts: 3
- Joined: Mon Oct 24, 2022 5:13 am
- Country: -
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Custom switch in Turnigy 9xr pro
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
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!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 3
- Joined: Mon Oct 24, 2022 5:13 am
- Country: -
Re: Custom switch in Turnigy 9xr pro
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!
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!
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Custom switch in Turnigy 9xr pro
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
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!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 3
- Joined: Mon Oct 24, 2022 5:13 am
- Country: -
Re: Custom switch in Turnigy 9xr pro
The problem is solved. Thank you so much master!!
Best regards,
Peter
Best regards,
Peter