Timer in custom switches not working?

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
mEnTL32
Posts: 9
Joined: Wed Sep 11, 2013 4:51 pm
Country: -

Timer in custom switches not working?

Post by mEnTL32 »

Howdy, quite a project you guys have here. Nice work!

I just installed a piezo speaker in my Turnigy 9x and wanted to play with the new sounds. I can make sense of just about every custom switch function and get it to work except the two timers. What am I doing wrong?

I use a count-up timer that turns on with the throttle (THs). So as an example:

Custom funtions:
CS1 "Play sound" Sirn -

Custom switches:
CS1 a>x Tmr1 00:09 ---

I would expect this to play the siren sound when the timer passes 9 seconds. I never hear it.

I've tried every combination I can think of. I do get the |d|>=x to work (siren plays every 'x' seconds), but not the above. What am I missing?

ETA: On a whim, I turned on the sound repeat to 10 secs and I hear the sound. So maybe the switch is only true for a very short time? What if i only want to hear the sound once?

ETA2: Found a clue. When I change the operation to 6:24, it triggers (or clears) after one second on the timer. It seems like 6:23 (or probably more accurately 6:22.5) is a magic number, being exactly halfway between 0 and 12:45 which is the maximum value for the operand. Since each step is 3 seconds, this value makes sense (765 seconds, 255 steps). So, it looks like there's a problem when doing some signed/unsigned arithmetic. If someone could point me to the code, maybe I could take a crack at it?

bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Timer in custom switches not working?

Post by bertrand35 »

I will have a look to this problem asap, but if you want to give a try before me, you will have to check the getSwitch() function.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Timer in custom switches not working?

Post by MikeB »

Sounds like a conversion problem. The values in the comparison are 8-bit signed integers but get mapped for things like the time.
The time mapping involves using the value as unsigned. 128 * 3 = 384, which corresponds to 6:24 so an addition or subtraction of 128 is probably missing somewhere.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Timer in custom switches not working?

Post by bertrand35 »

Yes it's fixed now in trunk. The conversion was forgotten when FRSKY was not defined in the code.
Bertrand.
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

hi, I thought I had this sorted but haven't

I want the timer to count up using THs to say 8 min then beep (not long if pos) and keep counting

9x with opentx-2751

cheers
Brett

User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

I thought this Might me tricky but not impossible
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Timer in custom switches not working?

Post by dinamich »

Buzzliteyear wrote:hi, I thought I had this sorted but haven't

I want the timer to count up using THs to say 8 min then beep (not long if pos) and keep counting

9x with opentx-2751

cheers
Brett
First of all, your version of openTX is quite old, I reccomend updating at least to r2940, best would be 2.0.

Now for the timer beep, use something like this:
Logical switch (or Custom switch as is called in your (old) version of openTX):

Code: Select all

L1 Timer1 > 480
Special function (or Custom function as is called in your (old) version of openTX):

Code: Select all

SF1   L1   Play Sound    Beep 1   ---
L1 gets activated when Timer1 reaches 480 seconds and Beep1 gets played once when L1 becomes active.
projectkk2glider@github
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

thanks for the reply,

ok i was going to update Then spent last couple hours or more looking for the firmware as it doesn't come with Opentx Companion and it doesnt seem to be able to download it asking for a file, so many updates and name changes that if you havent read up like me sense my last update you get lost

Where is it please
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Timer in custom switches not working?

Post by dinamich »

Download an install Companion 2.0.2 http://www.open-tx.org/2014/06/12/companion-2.0.2/ and then inside Companion set profile settings to Taranis and then look for Download firmware button.
projectkk2glider@github
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

thanks again great i downloaded and run

L1 trimer1 there is only a choice on that line of v1 max 175 and v2 max 175 which = 350 seconds

then in the simulater i just get a single beep no matter what the setting is that could be confused with the 1 minute beep

also the companion program keeps crashing on my XP laptop, i get maybe 3 minutes then crash even if im not using it
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Timer in custom switches not working?

Post by dinamich »

Buzzliteyear wrote:thanks again great i downloaded and run

L1 trimer1 there is only a choice on that line of v1 max 175 and v2 max 175 which = 350 seconds

then in the simulater i just get a single beep no matter what the setting is that could be confused with the 1 minute beep

also the companion program keeps crashing on my XP laptop, i get maybe 3 minutes then crash even if im not using it

Not sure how you got 175 seconds limit, it should be much bigger.

Generally sound inside simulator is non-existent or very poorly supported. Try it on transmitter. There you will hear real sound.

Companion crashing is not very common problem, please provide as much information as possible about the crash (when it happens, how, what is displayed, any other info, etc...).
projectkk2glider@github
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

Yes in the first line of Logical switch i get

L1 (then can only select Timer not Timer1) then V1 wont go higher than 175 same as V2 also wont go lower than 0.1

Also it is about 3 seconds out

If i set timer to 30 seconds it will beep at 27sec

My biggest problem is not being able to set timer above 2 x 175 seconds

there is not difference between beep 1 and beep3

It could be confused with the minute beep and not a set timer beep for landing timer etc

thanks brett
Attachments
opentx setings.jpg
Last edited by Buzzliteyear on Wed Jun 18, 2014 6:42 am, edited 1 time in total.
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Timer in custom switches not working?

Post by dinamich »

Buzzliteyear wrote:Yes in the first line of Logical switch i get

L1 (then can only select Timer not Timer1) then V1 wont go higher than 175 same as V2 also wont go lower than 0.1

Also it is about 3 seconds out

If i set timer to 30 seconds it will beep at 27sec

My biggest problem is not being able to set timer above 2 x 175 seconds
Your are using wrong function: Timer is for periodic ON/OFF output. Use a>x function instead, for V1 select Timer1 and for V2 treshold value.
projectkk2glider@github
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

that works thanks...............but still only a single beep no matter what parameter i change to in Special functions

and is still 3 seconds to early if i test at say 20 seconds it will beep at 17 seconds etc

even once the timer is started even with throttle lowered to stop timer it will keep going
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Timer in custom switches not working?

Post by dinamich »

Difference between beep1, beep2 and beep3 is not in number of beeps, but in pitch. If you want let say three beeps use custom wav file and use PlayTrack function.

I find it hard to believe that sound is played 3 seconds too early. Post your eepe file, so we can examine your exact settings.

If you are using THs it is the nature of this trigger. It triggers on throttle stick being moved from idle position and it never stops. If you want some other behaviour, it can be set-up of course.
projectkk2glider@github
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

here is the file attached

yes it is THs and yes i would like it to pause when throttle stick is back down to lowest position

thanks brett
Attachments
9X backup timer.eepe
(4.84 KiB) Downloaded 320 times
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Re : Timer in custom switches not working?

Post by Kilrah »

THt is the one that never stops, THs does. If your sticks are well calibrated, that is.

Envoyé de mon SM-G900F en utilisant Tapatalk
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

Not on mine, I have it set to THs in that file and with timer set to 20 seconds it beeps every 13 seconds after throttle has been raised then droped the timer will keep going

All this programing to get a simple timer to count UP doesnt make sence .......cant we have a box to tick like on screen 2/11 where it says countdown, why is it if unticked and a time entered in timer1 does in still count down

it is working backwards ............
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Timer in custom switches not working?

Post by Kilrah »

Timer counts up if the preset value is 00:00, otherwise it counts down from that value. Not sure I understand what your problem is.
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

I can not set a alarm to beep at say 8 minutes easerly and have that alarm sound different to the "minute call" beeps
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Timer in custom switches not working?

Post by Kilrah »

You can use a custom switch with a>x Tmr1 08:00 to trigger a Play Sound or Play Track Special Function.
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

I understand but as the "play sound" no matter what i set it to sounds like a beep to me with very subtle difference to small to rely on for a timer

can the 9x play tracks ?
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Timer in custom switches not working?

Post by Kilrah »

Ah, didn't know you were using a 9x, I think both dinamich and me thought you had a Taranis.

In stock state the 9x it indeed only capable of making simple beeps of a single pitch.
If you select the "audio" firmware option you can also play more "advanced" sound patterns, ideally you need to do the accompanying "audio mod", but you may also try it even with the stock buzzer, will sound a bit strange but it works.
To play tracks you would need to install the voice module that has been developed. Quite involved though: http://www.rc-miskolc.emiter.hu/rc-misk ... Itemid=150
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Timer in custom switches not working?

Post by jhsa »

Many people did it ;)

Sent from my GT-I9195 using Tapatalk
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

All good makes sense now........

Think it might be better money spend to purchase the taranis

where is the audio firmware might try that anyway ???

thanks again
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Timer in custom switches not working?

Post by Kilrah »

Tick the "audio" option in companion radio profile, redownload and reflash.
User avatar
Buzzliteyear
Posts: 30
Joined: Wed Sep 11, 2013 10:20 pm
Country: New Zealand

Re: Timer in custom switches not working?

Post by Buzzliteyear »

that works great

yes the stock peizo is crappy

I tried a better quality one which was a little better

then a very tiny speaker from my sony xperia that works the best



http://youtu.be/xR7BxBg9a0s

Post Reply

Return to “openTx”