Thread Tools
This thread is privately moderated by on4mj, who may elect to delete unwanted replies.
Oct 29, 2014, 09:01 AM
Mike
Thread OP
Discussion

Winterpostal 2014/2015 - Get your own timer


((v1.03: the timer voice now works correctly ; THIS REQUIRES THE 2.0.13 FIRMWARE))

The Winterpostal is a friendly F3K competition that you can compete from your backyard.
For more information, see the dedicated web site.

But now, who's gonna come in your backyard to time you ?
Especially in winter ?

So, for those who own a Taranis, the good news is that the radio can do that for you. Although it won't tell you where the lift is !

The November task is the five best flights in a 30 minutes window. Unlimited throws. Max flight time : 300 seconds.

So, here's a little "telemetry" script (it doesn't use telemetry at all) which gives the remaining work time, the current flight time, the best five times, and the total (getting rid of the extra time if you fly more than the max).

There's a little catch-up : the temporary switch is used to detect the start and end of flight. It's probably a little confusing at first : once you land, you must pull the switch and hold it until you launch again.

The other 2-position switch is used to start the work time (when pulled) and end it prematurely if pushed again.

The work time (timer 1) is displayed decrementing, while the flight time (timer 2) is diplayed incrementing. Although, internally, they both are decrementing. I suggest putting voice countdown with minute call on timer 2, you will know where you are in your five minutes.

The script makes use of a few sound files :
  • task1.wav : signals the start of the working time. Use a horn sound or make your own announcement ;
  • gameover.wav : signals the end of the working time. (idem).


If you want to change the switches (if you're right-handed, you probably swapped them, right ?), look for this in the code, and change to your liking :
Code:
	-- Customize your own switches here
	local TMP_SWITCH = getFieldInfo( 'sh' ).id
	local RST_SWITCH = getFieldInfo( 'sf' ).id
TMP_SWITCH is the temporary switch.
RST_SWITCH is the reset switch.
Swapping sh and sf might be all you need.


If you already use timers in your programming, you might want to copy your model in another slot, and get rid of everything that uses them, or your program and the script will be competing for the timers.

If you find this helpful or have comments/suggestions/bug reports, don't hesitate to leave a comment.


Edit:

I added sound files for the fun (the first one is a bit long, and runs while the work time has already begun).


Edit 2

Bug correction: at the end of the working time, the last time added was incorrect.


Edit 3

Bug correction: Thanks to the timer updates in the firmware, the voice issue has been solved.
Last edited by on4mj; Nov 22, 2014 at 09:59 AM.
Sign up now
to remove ads between posts
Oct 30, 2014, 05:59 AM
Mike
Thread OP
Revision 1.02 : at the end of the working time, the last time added was incorrect.

See the first message to get the updated file.
I've added revision numbers in the header of the source code.
Nov 02, 2014, 06:39 AM
Mike
Thread OP
Okay... So there's a problem with that script up to 2.0.12 : once one has made a flight over 5 minutes (the internal countdown timer reaching 0), the voice stops and never returns.

I have no easy way to correct this.

It will only be possible once 2.0.13 is released :
https://github.com/opentx/opentx/issues/1818

Meanwhile, you can work around that problem by setting a special function to set the timer 2 to 300s,triggered by the release of the temporary switch.

Sorry about that...
Last edited by on4mj; Nov 02, 2014 at 07:08 AM.
Nov 05, 2014, 02:21 PM
Mike
Thread OP
BTW, for those who want, changing the timings in the script can turn this into a timer for Task G (5x2).
Nov 22, 2014, 09:58 AM
Mike
Thread OP
Quote:
Originally Posted by on4mj
Okay... So there's a problem with that script up to 2.0.12 : once one has made a flight over 5 minutes (the internal countdown timer reaching 0), the voice stops and never returns.

I have no easy way to correct this.

It will only be possible once 2.0.13 is released :
https://github.com/opentx/opentx/issues/1818
Updated the script so that now, this works correctly.
But this means that open-tx 2.0.13 is required.


Quick Reply
Message:
Thread Tools