-- Telemetry script: RES Training App -- ################################# -- -- version 16 10.05.2022 -- by ChrisOHara -- original written on OpenTX version 2.3.7; last version on 2.3.15 -- for Horus and Taranis radios (but may run on other openTX radios) -- This Software is free -- -- Information: Using a barometer this software is not allowed in official RES competion. -- -- Requirements: Telemetry value "Alt" (so a barometer is required) -- Momentary switch has to be definded to match logical switch ls61 -- (example for ls61: L61 OR SEv SEv ) -- -- -- Reaching 5m (starting height) you will hear a beep (1000 Hz). -- During the following 15 seconds you can start the timer by operating momentary switch "ls61" -- when plane is released from leash. -- If you do not operate a switch the timer will start after 15 seconds on its own. -- When timer starts the current altitude is announced. -- -- reaching landing height (2m) there is another beep (1000Hz). -- During the next 15 seconds you can stop the timer by operating momentary switch "ls61" -- when having contact with ground. -- If you do not operate a switch the timer will stop after 15 seconds on its own. -- When timer stops you can hear a beep (2000Hz). -- -- Hint: If you do not use a switch you will get the flighttime between -- 5m (starting altidude) and 2m (landing altidude). -- -- The script does use/define timer 1 on its own. (6 minutes, countdown) -- -- The last flights will be displayed. -- Horus: max is 2,6,8,19 depending on screen zone you select for widget -- Taranis: max is 8 -- -- Information displayed: -- Flight = Start-time of flight hour:minutes (newest flight always on top) -- Time = Flight-time in minutes:seconds -- Alt-S = starting altidude -- Alt-F = maximum altidude (during flight from start timer to stop timer) -- -- Flight status: -- Global variable Gvar9 FM0 does show the status of the flight -- -- -- New features in version 16 -- 1. the script writes a logfile to sdcard folder /LOGS/ -- name of the file is: ResLog--MODELNAME.csv -- logfile is in csv format and can be opened with Excel -- When script is activated it reads the logfile of the model and displays the last flights -- -- 2. the definition of the switch to be used is done outside the script by defining a momentary switch to ls61 -- -- 3. When timer is started beep is in again and start altitude is announced after beep. -- -- 4. The script does set a value to Gvar9 (Global Variable 9) of FM0 (Flight Mode 0) which can be used for logical switches. -- 0 = waiting for receiver to be armed -- 1 = waiting 3 seconds to reset telemetry values "Alt" and VSped" -- 2 = Waiting for launch (less than 5m altitude) -- 3 = launching 5m altitude is reached but timer has not been started. -- 4 = released from leach (flying), timer is running -- 5 = landing, altitude is below 2m but timer is still running -- example: I do use this with a logical switch so that my taranis does play-value "Alt" during condition 4 only. -- -- if you want to use another global variable or want to dismiss it look for this lines and follow instructions -- -- -- you can store the flight_condition in a in a global variable of a flightmode to use them for logical switches or special functions -- -- you can choose the gvar and flight_number (or dismiss storage by setting one incorrect value) -- local my_gvar_index = 8; -- (0 to 8) select another number (for example -1 or 9) if you do not want to store the condition in a global variable) -- local my_flightmode_index = 0; -- (0 to 8) select another number (for example -1 or 9) if you do not want to store the condition in a global variable) -- -- New features in Version 13: -- 1. When timer is started the current altitude is anounced (instead of beep). -- 2. The script does work also with unit "ft", when unit "ft" is set for telemetry value "Alt". -- Starting-/landing-altitude (5m and 2m) are automatically recalculated in "ft". -- 3. Time slot for starting and stopping timer is now 15 seconds (was 10). -- 4. While flying there is no realistic chance to read the displayed list. -- So the display now shows altitude and time as large as possible instead (only while flight is going on) -- 6. The file dummy.lua in /SCRIPTS/TELEMETRY/ is no longer needed. -- 7. Did some optimization concerning CPU usage in the Horus version. -- -- New features in Version 11: -- 1. If receiver is switch off you get a 3s beep and a warning on the screen "not armed". -- If you don't like that you search the two lines starting with "-- armed-warning" at the end -- and change the line to comment. -- (I added this function after I successfully launching my plane without switching on the receiver. Haha) -- 2. The GR6 firmware (at least access version) has a firmware bug. When switching on the receiver the altitdue rises -- from zero to geografical altitude. Therefore openTX function auto-offset does not work properly and also this -- lua script wrongly started a flight. Now the script does reset the telemetry value "Alt" (and "VSpd") three seconds -- after the receiver is switched on. But this works only for OpenTx 2.3.11 or higher. -- For older releases there is only one solution: Do switch on the receiver first and then switch on the transmitter. -- Or select the model after switching on the receiver. -- 3. In the Horus version the code was moved from the telemetry script to the widget (telemetry script is a dummy now) -- -- Installation: -- Horus: Copy /WIDGETS/res_H/main.lua to the sd_card of your Horus. -- Add the widget res_H to your telemetry screen. -- Taranis: Copy /SCRIPTS/TELEMETRY/res_T.lua to the sd_card of your Taranis. -- Add the script res_T to your telemetry screen. -- -- Errors: Scripts aborts when function getValue() is called with nil. -- -> Telemetry value "Alt" is not available -- -> or logical switch LS61 is not defined -- -- -- #######################################################################################################