New Products Flash Sale
Fig Newton's blog View Details
Posted by Fig Newton | Jun 07, 2014 @ 12:27 AM | 6,113 Views
Version 1.3 - Fixed issue in averaging calculation.
Version 1.4 - Added in array to allow you to select multiple locations that get averaged. Fixed averaging again. See my notes in the replies below.
Version 1.5 - OpenTX 2.0.7+. Somewhere between 2.0.5 and 2.0.7 the constant name for pilot latitude and longitude changed. This version fixes the script to use the new values and not throw an error. I will leave v1.4 up since if you are running an older firmware you will have to use that version.

This Lua script will calculate the GPS heading your plane is flying and give the following outputs:

PHDG - GPS Heading.
Hout - Bearing of the plane from the pilot (start) location. If you fly due north, this should say 0.
Hbak - Bearing for the plane to return to the pilot (start) location. This would be the heading you want to fly if you needed to get ome.
Lon - Latest Longitude reading (rounded for display).
Lat - Latest Latitude reading (rounded for display).
Timr - The sample timer. Every time this timer cycles the location is read.

Keep in mind this is still in development. I was able to do some rather crude tests using hardcoded variables, and also by running up and down my driveway with a radian glider in the middle of the night. So far so good. Another variable here is how well the GPS locks in. I noticed just sitting still the heading was wandering but I believe that's due to some gps drifting.

I set the sample time to an input variable so that you can go...Continue Reading
Posted by Fig Newton | Jun 05, 2014 @ 01:51 PM | 3,509 Views

Written by Fig Newton.

I was working on the trainer settings the other day and had an idea for a game using the lua scripts. Depending on who uses this and how, it could also (potentially) be used to help build skills. The concept here is that you link up a trainer radio and put a plane in the air. The person with the master radio flies the plane. The trainee tries to mimic the controls that the master is using to fly the plane. If the trainee moves the stick too far, it's out of bounds and a sound can be played on the master radio. Depending on the way you set it up, you can have different beeps for Aileron out of bounds, Elevator out of bounds, or both out of bounds at the same time. You could also place the activation of the sounds on a switch so that it isn't beeping when you don't have a trainee attached or say they fall asleep on you from excitement.

At no point does any of the input affect real flight of the plane, and nothing is touched as far as trainer mode, etc. This should be completely safe and harmless. Not sure how much fun this will turn out to be, but I bet there could be some competitions involving a beer (purchased after flying) wagered here and there.

Here are the settings for Inputs:
Aileron: Set this to your Aileron input source.
Trainr Ail: Set this to TRx for aileron input. On my radio TR2 was aileron input from the trainer radio.
Elevator: Set this to your Elevator input source.
Trainr Elevator: Set this to your TRx for elevator input....Continue Reading
Posted by Fig Newton | Jun 01, 2014 @ 11:09 PM | 2,386 Views
Here is my setup for this (firmware v2940 compatible):

CH 16
(+100%) Ele No Trim No DR/Expo
(-100%) PPM3 No Trim
(+100%) Ail No Trim No DR/Expo
(-100%) PPM2 No Trim

Custom Switches
CS1 |a|>x CH16 20
CS2 a~x GV1 20 And !CS3
CS3 a~x PPM1 0 And !CS2

Custom Functions
CF1 SH↓l Adjust GV1 Value 20 ON
CF2 CS1 Adjust GV1 Value 0 ON
CF3 CS2 Trainer 0 ON
CF4 CS2 Play Track trainon 0 ---
CF5 !CS2 Play Track trainoff 0 ---
CF6 CS3 Adjust GV1 Value 0 ON

So GV1 is used to set Trainer mode. If it's set to 0, then trainer mode is off. If it's set to 20 then trainer mode is on.

CF 1 - SH↓l sets GV1 to 20. This then triggers the custom switch CST to true. That in turn triggers CF3 to turn on trainer mode, and CF4 to announce trainer mode is on. At that point any input from the student radio aileron or elevator input is mixed in to channel 16, and then subtracted back out using the -100% corresponding PPM value. This channel should stay at 0 until either the aileron or elevator are pushed on the Taranis. At that point (stick is moved on the trainer radio) the elevator and/or aileron value is added or subtracted from CH16, but since there will not be a corresponding PPM value it will move CH16 up or down.

Custom switch CS1 will then be triggered when the value goes over or below by 20. I used a value of 20 here because the lower the number the more sensitive the trigger is. I didn't want it too sensitive. At this point when CS1 is...Continue Reading