Thread Tools
This thread is privately moderated by Miami Mike, who may elect to delete unwanted replies.
Mar 26, 2019, 05:21 PM
Pompano Hill Flyers
Miami Mike's Avatar
Thread OP
Download

OpenTX: Export your calibration settings and then import them into another model.


Export Model Settings.lua - A Script That Writes a Script




Export Model Settings.lua is for Taranis X9D, X9D+, X9E, QX-7, and X-Lite users who use a common model setup across two or more models and would like an easy way to import each model's specific output settings and model-specific curves into its own copy of that common setup. It may have other uses as well.

This is a user-configurable one-time script that exports Outputs page and Curves page settings from the current model memory into an executable one-time script, which it stores in a folder on the radio's SD card. The generated script can then be used to import those settings into another model memory in the same radio, or copied to another radio's SD card to import the settings into a model memory in that radio.

The script that it creates will have a name that incorporates the model's name. For example, if your model is named "My Big Model" then the script containing its settings will be named "Import My Big Model Settings.lua". Several import scripts can be stored together in a folder on your SD card. All you have to do is select the one you want and execute it, and the settings will be imported into your currently selected model memory.

Here are the user-configurable settings as they appear at the beginning of the script:
Code:
--[[ User-configurable settings:
The Outputs page settings for channels that aren't transmitted generally don't affect
anything and are usually left at their default values, therefore they don't need to be exported
or imported. So, although it's possible to transfer the output settings for any or all of the
32 channels, in most cases "channels_to_export" should be set to "{1, 2, 3, 4, 5, 6, 7, 8}".
]]
local channels_to_export = {1, 2, 3, 4, 5, 6, 7, 8}
--[[
Generally, curves that represent calibration settings unique to each model are the ones to export
and import. For example, Mike Shellim's sailplane setups use curve 2 for crow compensation and
curves 11, 12, 13, 14, 15, and 16 for calibration of the first six output channels. For one those
setups, "local curves_to_export = {2, 12, 13, 14, 15, 16}" would be appropriate.
]]
local curves_to_export = {1, 2, 3, 4, 5, 6, 7, 8}
--[[
Values for channels_to_export and curves_to_export can be arranged in any order.

"settings_folder" is the path from the root directory of your SD card to the folder where your
generated import scripts will be stored. I like "/-SETTINGS/", beginning with "-", because that
causes it to conveniently appears at the top of the list on my radio's SD CARD page.
]]
local settings_folder = "/-SETTINGS/"
--[[
Whatever you name it, you must create this folder yourself. The script can't automatically create it.
]]
Notes:
  • If you plan to store Export Model Settings.lua on your radio then be sure to configure it first because there's no way to change the configuration once it's there.
      
  • Export Model Settings.lua can be located anywhere on your SD card but for convenience I keep mine in the same folder as the import scripts that it creates.
     
  • The export script can export settings under OpenTX version 2.1 or 2.2, but the import script that it creates will only work under version 2.2.2 RC5 or later, due to previous OpenTX Lua versions lacking a functional way to set curves.
     
  • Export Model Settings.lua can be run on Companion simulator. The resulting import script will be stored in Companion's SD Structure path folder on your computer.
     
  • You can also run import scripts on Companion simulator, but to preserve changes before you exit the simulator, you'll need to navigate to the VERSION screen and long-press ENTER to store the .bin file in the EEPROM folder of Companion's SD Structure path folder. You can then exit the simulator, load the .bin file into Companion, and work on the model setup from there. See below.
     
  • model.setCurve() can't set a 2-point curve, so any 2-point curves included in the curves_to_export array will be converted to equivalent 3-point curves. That block of code can be removed by the user if desired, if and when the bug is fixed.
    Code:
    if table.points == 2 then -- model.setCurve() cannot set a 2-point curve.
    	table.type = 0
    	table.points = 3 -- Set a 3-point curve instead.
    	table.y[2] = table.y[1]
    	table.y[1] = (table.y[0] + table.y[2]) / 2
    end

Export Model Settings.lua and the scripts it creates are one-time scripts. The procedure to execute one-time scripts varies among radio types, but ...
  • ... to execute them on a Taranis X9D+ radio:


     
  • Long-press MENU to go to RADIO SETUP:


     
  • Short-press PAGE once to go to SD CARD:


     
  • Use PLUS (+), MINUS (-), and ENTER (ENT) to navigate to the script:


     
  • Long-press ENTER to get the sub-menu with Execute highlighted at the top:


     
  • Short-press ENTER to execute the script. It will display a screen offering you a choice of long-pressing ENTER to proceed or long-pressing EXIT to abort:


     
  • Long-press ENTER to execute the script and the screen will return to the previous folder. If you then short-click EXIT you should see the newly-created import script:


     
  • Long-press EXIT to return to the home screen, and select a different model:


     
  • Navigate to the newly-created import script:


     
  • and execute it as before:


     
  • Long-press ENTER and the settings will be imported into the current model.
     
  • If you perform this procedure with your radio then the changes will be stored in the radio, but if you do it with Companion simulator then the changes will be lost when you exit the simulator, unless you first do an EEPROM backup:


      

Download Export Model Settings.txt and save it to your computer in Companion's SD Structure path folder as Export Model Settings.lua. Then configure it with any text editor, such as Notepad, and create the folder where your import files will be stored.

Your questions and comments are welcome! Please post them below.

Last edited by Miami Mike; Aug 02, 2021 at 07:36 PM. Reason: We can now upload Lua files without renaming to ".txt".
Sign up now
to remove ads between posts
Mar 27, 2019, 11:09 PM
ancora imparo
jj604's Avatar
Nice tool, Mike!
Feb 04, 2020, 03:39 PM
Registered User
jims123's Avatar
Yes! looks really useful.. wish I had a good use for it.. hope to have models with curves soon..
Thanks for sharing this utility Mike.


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Newbie question about OpenTX servo calibration justinhow Servos 2 Oct 07, 2016 10:31 AM
Discussion How to calibrate Sticks T9X / OpenTX Peter Volland Radios 1 May 06, 2015 03:26 PM
Mini-HowTo How To: Set Throttle range calibration on your Devo Radio to Hobbywing Skywalker mattjk Multirotor Drone Electronics 1 Mar 03, 2015 08:58 AM
Discussion Exporter ASKS:Pick Your Poison Texas Buzzard Life, The Universe, and Politics 69 Jan 26, 2007 03:38 PM