Создание моделей для прошивки DeviationTX

Вы просматриваете редакцию с названием "Создание моделей для прошивки Deviation", сохраненную 16.02.2017 в 10:37 в Night_Ghost

первоначально это задумывалось как перевод этой статьи,
но по мере перевода были исправлены некоторые
неточности и пояснены пропущенные моменты. 
Некоторые места потребовали сначала перевода
на человеческий язык либо были написаны "по мотивам"

 

Введение.

Давайте сначала отвлечемся от техники.

Что особенного в прошивке DeviationTx?

Стандартный (standard) режим микшера вовсе ничего особенного. Во всяком случае, он даже кажется немного менее мощным по сравнению с фирменной прошивкой передатчика. А вот расширенный (advanced) режим микшеров намного сложнее настроить, потому что вы должны понимать, как желаемое поведение управления дроном выражается через значения выходных каналов, а также как использовать миксы (mixers) для получения таких значений выходов. Зато этот режим обеспечивает прямой доступ к внутренней работе миксов, что делает его невероятно мощным.

Что в этом документе

После этого вводного материала и обзора устройства конфигурации модели, этот документ проведет вас через полную установку для современного коптера и самолета с использованием режима Advanced. Начиная с базовой конфигурации - четыре канала плюс канал выбора режима полета, которые есть у всех современных полетных контроллеров. После небольшого введения, объясняющего как выяснить привязки канала, когда они не известны, речь пойдет об использовании расширенных функций deviationTx. По пути будет рассмотрено как настроить конфигурацию канала, основную конфигурацию страницы, автоматически изменяя выходные значения, и все остальное, что по моему опыту может оказаться полезным. Как бонус, будет раздел, рассказывающий про все вещи, которые можно сделать с помощью кнопок Тримов, кроме как использовать их в качестве триммеров.
 

Предполагаемая аудитория

Этот документ предназначен для опытных RC-пилотов. По правде говоря, я сейчас не верю что прошивка  DeviationTx подходит для начинающих, хотя прогресс в этой области есть. Из-за этой целевой аудитории стандартный режим не будет рассмотрен.

Возврат долга это обязанность

Сообщество DeviationTx  является особенным. Они свободно обмениваются конфигурациями моделей и трюками миксов в форумах. Информация в данном документе происходит почти исключительно из этих форумов. Некоторые небольшие его кусочки именно мои, но большая его часть поступила из форумов, хотя я и изложил это собственными словами. Про некоторые моменты я могу вспомнить где нашел, но далеко не про все.  Так что вместо того чтобы рисковать пропустить кого-то, кто заслуживает упоминания, я буду благодарить сообщество в целом. Мои благодарность и уважение каждому в этой великой группы.
Если что-то здесь не так, то только потому что я перепутал. Вы можете предложить внести изменения в (английский оригинал статьи) тут

Обзор глав

Это введение в различные переменные, которые имеются в модели deviationTx. Эта информация из руководства по deviationTx,  но я повторю ее  здесь для вашего удобства.
В этом документе  названия, как они представлены в прошивке, будут отображаться шрифтом FIXED.  Названия переменных или их части будет курсивом. Большинство из них будут заглавными БУКВАМИ, потому что именно так они выглядят на экране передатчика.

Значения входов и выходов обычно работают от 100% до -100%, что означает переход от полного значения в одном направлении до полного значения в другом, но также и от включенного к  выключенному. Так как все значения в процентах,  знак % будет использоваться или нет в зависимости от контекста. Многие переменные могут принимать значения до 150, а не 100, а максимальные и минимальные значения выходных сигналов можно задать явно.

Выходы

Сердцем прошивки deviationTx являются миксы (Mixers) - сущности, позволяющие вычислить значения канала по определенному закону из входных значений. Конечная цель всех миксов - получить определенное поведение для выходов передатчика, которые появятся на входе контроллера вашего дрона. Итак, давайте перейдем к ним в первую очередь.

Каналы передатчика

Выходные каналы передатчика это те значения, которые он передает. Их число обычно соответствует количеству каналов на приемнике, и может варьироваться от всего лишь 1 до 12.

Виртуальные каналы

Одна из необычных особенностей deviationTx является наличие 10 виртуальных каналов. Они могут использоваться  так же, как каналы передатчика, за одним исключением - они не передаются на приемник. Они полезны для создания промежуточных значений для использования в других миксах. Вы увидите, как они используются при создании конфигураций модели.

Входы

Входы включают в себя все элементы управления на передатчике, а также некоторые внутренние значения. Я не буду описывать физические элементы управления в деталях, так как они различаются в зависимости от модели передатчика, и вы уже скорее всего знакомы с ними.
Все входы имеют общее свойство - они могут быть инвертированы, перевернуты. Просто выберите вход, тогда нажатия кнопок влево и вправо будет включать и выключать знак "!" перед именем входа, указывая, что вход инвертирован.

Стики

Две ручки управления, являющиеся основой передатчика радиоуправления. Они также имеют пару триммеров, располагающихся сбоку и снизу стика.  В прошивке deviationTx они называются ELE (elevator, управление рулем высоты), AIL (aileron, элероны), THR (throttle, дроссель) и RUD (rudder, руль направления).

Крутилки и слайдеры

Некоторые пульты также имеют аналоговые ручки или ползунки, используемые в качестве входных данных. Они обозначены AUX #, где # цифра от 2 до 7.

Триммеры

Триммеры обозначены как TRIM**D, где ** это его место: LH это левый горизонтальный (Left Horizontal), RV это правый вертикальный (Right Vertical) и так далее, или для крайних верхних _L для левого и _R для правого. Значение D это направление триммера: "+" для увеличения значения или "-" для уменьшения.

Каналы

Это либо каналы передатчика либо виртуальные каналы. Можно использовать значение любого канала как входное значение микса. Но на самом деле это предыдущее значение канала, так что можно использовать значение канала для микса этого же канала, что позволяет создавать такие вещи, как каналы, удерживающие свое значение, а не фиксированное значение, или изменять значение по определенному закону
В особых случаях можно настроить модель, чтобы иметь больше выходных каналов,  чем нужно на самом деле нужно, и использовать дополнительные каналы в качестве виртуальных каналов. Но если вы затем измените конфигурацию модели, уменьшив количество каналов снова, эти дополнительные выходные каналы сохранят старое поведение, но при этом они не должны быть переданы. Такое поведение не документировано и может измениться в будущем. Погодите с такими каналами, пока можно.

Переключатели

Есть разные штуки, которые могут быть использованы в качестве переключателя в deviationTx. Обычно они имеют значения 100% если включены и -100% когда выключены.
 
Физические переключатели

Как и любой современный передатчик, серия Devo имеет набор переключателей. Они отмечены наподобие  GEAR#, MIX# and FMOD# где # это цифра, указывающая позицию переключателя. Она может быть 0 или 1 для двухпозиционного переключателя,  для переключателя на три положения добавится 2. Каждый из них имеет значение, равное 100%, когда переключатель находится в соответствующем  названию положении, и -100% в остальных случаях. Это использование очень удобно, но это не означает, что FMOD0 и! FMOD1 одно и то же:  в положении FMOD2 значением FMOD0 будет -100%  а значением ! FMOD1  будет 100%.

 

Каналы в роли переключателей

Все каналы могут быть использованы в роли переключателей. В таком случае любое значение больше 0 означает "Включено" а любое значение меньше или равное 0 - "выключено".

Кнопочные выключатели

Любые кнопки передатчика, включая те что используются для управления самим передатчиком, могут использоваться как виртуальные переключатели. Это требует настройки их как триммеров для виртуального канала, и использования этого канала в роли переключателя. Про это будет в оследней главе.
 

PPM

И наконец, можно использовать DSC (он же тренерский разъем) передатчика для ввода PPM-сигнала. Это можно использовать для подключения к передатчику всего, что может выводить PPM. Типичные примеры это подключение второго пульта в роли ученика, и FPV очки с трекером. Такие каналы обозначены PPM #, где # это номер входного канала с 1 по 8.

 

Обзор миксов

А теперь обзор миксов deviationTx. Опять же, эта информация есть в руководстве deviationTx, но я включил ее для вашего удобства.
В отличие от нативной прошивки, где ограниченное количество миксов, каждый из которых может быть присоединен только к определенному каналу, в deviationTx каждый канал может иметь несколько миксов, связанных с ним. Они доступны в разделе Mixer страницы модели. Каждый канал представлен двумя кнопками и меткой, хотя метка может отсутствовать.
Одна кнопка это информация о канале в качестве метки. Кнопки первых 5 выходных каналов будут отображаться как # -XXX, где # это номер канала, а XXX это обычное использование этого канала в выбранном протоколе: THR, РУД, AIL, ELE и GEAR, в порядке определяемым протоколом. Остальные выходные каналы отображаются как Ch #, где # номер канала. Виртуальные каналы отображаются как Virt #, в этом случае # это номер виртуального канала.
Вторая кнопка сообщает, какой режим назначен этому каналу. Это может быть None (никакой), Simple  (простой) или Complex (сложный). Именно сложные находятся в центре внимания данного документа. Если задано что модель это вертолет, то также добавятся Cyclic1, Cyclic2 и Cyclic3. Они, как правило, используются только для старых вертолетов коллективного шага без контроллера, то есть смешивание каналов управления должно быть сделано в передатчике. Так как их можно только выбрать, но не настраивать, они не будут обсуждаться.
Все режимы кроме None это последовательность из одного или нескольких индивидуальных миксов. Каждый из них похож на микс в фирменной прошивкой, но гораздо более гибок. Каждый микс может иметь вход, связанный с ним. Если первый из миксов не None и имеет вход, название этого входа будет отображаться в роли метки этого канала на странице Mixer передатчика, вместе с двумя кнопками.

Его величество Микс

Микс принимает значение со входа, изменяет его каким-либо образом, а затем смешивает его в выходом предыдущего микса, если есть. Каждый микс имеет по меньшей мере четыре различных параметра, которые вы можете задать. Наиболее важным является Src - значение входа для этого микса. Он может быть любым из всех тех источников, что перечислены в разделе Входы выше.
Есть также возможность масштабирования и смещения значений,  изменяя значение микса, беря процент от него, или перемещая его вверх или вниз на фиксированную величину. Шкала 100% не изменяет значение вовсе. Шкала 50% оставляет ½ значения, которое иначе бы было. Шкала 120% сделает его больше на 20%. И так далее. Offset (смещение) просто прибавляется к значению. Хотя такое поведение может быть изменено с помощью выбранной кривой.
 Кривая это функцией, которая применяется к значению Src, перед смещением и масштабированием. Когда виджет выбора превращается в кнопку, при ее выборе откроется страница, позволяющая изменять параметры кривой. Доступные кривые:

  • 1-1: просто копирует входное значение.
  • Fixed: входное значение игнорируется, значение Scale идет на выход.
  • Min/Max: либо –100 либо 100. Если входное значение меньше либо равно 0 то будет -100, иначе 100
  • Zero/Max: работает как и Min/Max, за исключением что нижнее значение 0 а не -100.
  • >0:  как и Zero/Max, за исключением того чт Max значение копируется со входа, а не 100.
  • <0:  как и >0, за исключением того что Min значение копируется со входа а Max  будет 0.
  • ABSVAL: абсолютное значение со входа - отрицательные значения становятся положительными.
  • EXPO:  применяет экспоненту к кривой. Параметр позволяет установить  значение экспоненты, применяемой выше и ниже ноля. Хотя настройка в необычном месте, идея та же что и в фирменной прошивке.
  • Deadband: задает мертвую зону вблизи нуля - среднего положения стика. Имейте в виду что возвращается всегда абсолютное значение, так что скорее всего потребуется использование микса Mux типа Mult.
  • # Point: позволяет задать кривую через 3, 5, 7, 9, 11 или 13 точек. Параметр позволяет задать каждую точку и наличие/отсутствие сглаживания.

Смешивание

Смешивание это последовательность миксов. 

Они рассчитываются по порядку, смешивая входное значение, возможно измененное заданной кривой, смещается и масштабируется выход предыдущего микса, как указано настройкой параметра MUX.

Это новый параметр, который контролирует, как значение предыдущего микса и выход этого микса будут объединены. Доступны следующие настройки:

  • replace: игнорирует значение предыдущего микса, и использует только собственное выходное значение. Используется обычно в секции Switch для задания полетных режимов и подобных целей.
  • add: два значения складываются вместе. Это тот способ, как миксы работают в фирменной прошивке.
  • mult: два значения перемножаются. поскольку значения это проценты, нужно разделить отображаемое значение на 100, чтобы получить фактическое значение. То есть если было 50% и снова вычислено 50% то полные значения это 0.5 и 0.5, и произведение получается 0.25, поэтому окончательное выходное значение будет 25%.
  • min: меньшее от предыдущего микса и данного становится результатом.
  • max: большее от предыдущего микса и данного становится результатом.
  • delay: тип кривой должен быть фиксированным, а значение  Scale  задает задержку, применяемую к выходу предыдущего микса. Это используется для получения автоматически изменяемого значения.
Для первого микса в цепочке в роли выхода предыущего микса выступает предыдущее значение канала. Поэтому вы должны установить тип смешивания MUX первого микса в состояние replace  (заменить), за исключением особых случаев.Даже если вы хотите использовать это старое значение, лучше сделать это явно, подав на вход Src первого микса значение этого канала и включив режим замены значения. Делая это, вы можете обработать значение при помощи кривой перед использованием, что невозможно при неявном использовании.
Ещ один новый параметр это Switch (переключатель). Если он не в положении None, то микс включен. В противном случае он выключен, и на выходе будет значение с выхода предыдущего микса. 
А еще можно установить переключатель в состояния Trim и No Trim.  В состоянии Trim  значения триммеров этого канала будет добавлено к выходу микса.
 

Загрузка файлов .ini 

You may have noticed that there are no pictures of the transmitter settings as are commonly provided in manuals for transmitter software. That’s because the different transmitter types have radically different appearances, even though they share the same information. If you want pictures of your transmitter, you should read the deviationTx manual for it.
They do have one thing in common - the files stored on the flash drive that describe each model. This are what are uploaded to the forums, and are commonly presented in tutorials and discussions there, so you need to understand them. They provide all the information needed to configure the mixers for a channel, so I’m going to use them to illustrate example configurations.
You can access the model.ini files by plugging your transmitter into a USB port of a computer and turning on USB mode. You can do that by holding down the ENT button when you power on the transmitter - which is recommended if you’re going to modify a model.  You can also access USB mode from the Transmitter menu.  The current model will not be reloaded when you exit USB mode, and will be saved when you turn off the transmitter or load another model, so any changes made to it while in USB mode will be lost. The files will be in the models directory of the drive.

Model description

As suggested by the extension. .ini files use the Windows ini format. It is divided into sections started by the section name in square brackets, followed by lines of the form name=value. However, the first part doesn’t show up in a section, and describes the model settings. Here’s a sample for the model we’re going to configure in a bit:
  1. name=Blade 200 QX
  2. mixermode=Advanced
  3. icon=MINIQUAD.BMP
So this is a model for a Blade 200 QX, the mixer will be shown  in Advanced mode, and it uses the MINIQUAD icon. As a reminder, the mixer mode doesn’t change what’s in this file, just how the user sees the information.
  1. [radio]
  2. protocol=DSMX
  3. num_channels=5
  4. fixed_id=200123
  5. tx_power=150mW
The radio section just describes the settings for the radio. Being a Blade model, this uses Blade’s DSMX protocol.  Being a relatively simple model, it has five channels. That’s typical for quality multirotors, as they have 4 channels for attitude control and one to set the flight controllers flight mode.
Finally, we have:
  1. [protocol_opts]
  2. Telemetry=Off
which just turns off telemetry on this model, since the receiver doesn’t support it.

First sample mix

A relatively simple mix for channel 1 might look like:
  1. [channel1]
  2. template=expo_dr
  3. [mixer]
  4. src=AIL
  5. dest=Ch1
  6. [mixer]
  7. src=AIL
  8. dest=Ch1
  9. switch=AIL DR1
  10. scalar=70
Line 1 tells us this mix is for channel1. Line 2 tells us that it’s going to be displayed as a Expo&DR mixer, which only changes the user interface on the transmitter. Line 3 is the start of the first mixer. Line 4 sets the Src for this mixer to the AIL input. Line 4 is an artifact of the implementation, and will just be the display value for the channel this mix is on in every mixer.   Curve, Scale, Offset,   Switch and Trim are all unspecified, so take on the default values of 1-1, 100, 0, None and 1 (for on)  in order.
The second mixer in the mix starts at line 6, and sets the Switch with lines 9 and Scale with line 10. If the AIL DR switch is in the 1 position, this mixer will become active and scale the Src by 70%. The Mux type is missing, so defaults to Replace.
This is a typical dual rate mix, toggling channel 1 between 100% and 70% of the AIL input with the AIL DR switch.

Curved sample mixer

A mixer with a curve type might look like:
  1. [mixer]
  2. src=AIL
  3. dest=Ch1
  4. curvetype=expo
  5. points=35,35
This adds the Curve type of Expo at line 4. The points setting on line five is the parameters for the curve. In this case, we’ll be applying an expo of 35 to both halves of the curve.

The last mix setting

The last settings you’ll see in a mixer are the   mux type,  which is the mux setting for this mixer, and usetrim, which will always be 0 for No Trim,  as otherwise it has the default value of Trim.
Beyond the template type for the mix, there are other channel settings which will show up in the channel section.  I’ll cover those in the next section.

 


 

Basic model setup

In this section, we’re going to create a model.ini file for a simple five channel aircraft - the Blade 200QX. This is a four channel model with an on-board flight mode set by the fifth channel. That fifth channel gives me a chance to show a simple switch setup. As such, it should work for most four channel aircraft if you just ignore the section about the flight mode control.
The first step is to configure the model. Go to the Model->Setup menu, change the name, select the protocol and the number of channels. Unless you’re flying a helicopter, set the model type to Plane or Multi (if it’s available and appropriate). Change the icon if you want to. Unless you know the model has telemetry, make sure it is off by selecting the protocol selector and changing it.
After doing that for a Blade 200QX, I have the following in my model.ini file:
  1. name=Blade 200 QX
  2. mixermode=Advanced
  3. type=multi
  4. [radio]
  5. protocol=DSMX
  6. num_channels=5
  7. fixed_id=165827
  8. tx_power=150mW
  9. [protocol_opts]
  10. Telemetry=Off

Simple mixers

The default configuration sets up the first four channels as simple mixers for the controls they are normally used for in that protocol. For now, we’ll assume that it’s right. So the first four channels in the model.ini file look like:
  1. [channel1]
  2. template=simple
  3. [mixer]
  4. src=THR
  5. dest=Ch1
  6. [channel2]
  7. template=simple
  8. [mixer]
  9. src=AIL
  10. dest=Ch2
  11. [channel3]
  12. template=simple
  13. [mixer]
  14. src=ELE
  15. dest=Ch3
  16. [channel4]
  17. template=simple
  18. [mixer]
  19. src=RUD
  20. dest=Ch4
Channel 5 isn’t listed, because it’s not configured by default, even though there are five channels in the model. Only the first four channels are configured. As you can see, they are each a Simple mix with a 1-1 Curve with a Scale of 100 and an Offset of 0. While it’s possible to fly in this configuration, that’s not optimal. It’s normal to set up as second rate and possibly some expo, so let’s do that now.

Expo&DR mixers

I started with my normal ‘copter dual rates, using 35% expo on a 100% rate for the high rates, and a linear curve with 70% rates for the low rate. This is only applied to aileron and elevator, and both  are toggled by the AIL DR switch.  On the Mixer page, select one of those two mixes and set the type to Expo&DR. On the High-Rate mixer set the Curve to EXPO, select that and set the Value to 35.  Set the Mid-Rate  Switch to AIL DR1, and then set the Scale to 70. Now do the same for the other cyclic channel. The results for channels 2 and 3 are:
  1. [channel2]
  2. template=expo_dr
  3. [mixer]
  4. src=AIL
  5. dest=Ch2
  6. curvetype=expo
  7. points=35,35
  8. [mixer]
  9. src=AIL
  10. dest=Ch2
  11. switch=AIL DR1
  12. scalar=70
  13. [channel3]
  14. template=expo_dr
  15. [mixer]
  16. src=ELE
  17. dest=Ch3
  18. curvetype=expo
  19. points=35,35
  20. [mixer]
  21. src=ELE
  22. dest=Ch3
  23. switch=AIL DR1
  24. scalar=70
The two mixes are pretty much identical, and we’ve seen it before. So - no surprises so far.

Setting up flight modes

Now we need to control the flight mode. The 200QX uses the fifth channel for that, which is labeled GEAR. The relevant values or 100/0/-100 for the beginner, intermediate and expert flight modes. To enable that, you can use an Expo&DR mix. The High-Rate  Curve is Fixed, with a Scale of -100. The Mid-Rate  Switch is FMOD1. It stays Linked with a Scale of 0. For Low-Rate, the Switch is FMOD0 and the Scale is 100. The resulting channel is:
  1. [channel5]
  2. template=expo_dr
  3. [mixer]
  4. src=AIL
  5. dest=Ch5
  6. scalar=-100
  7. curvetype=fixed
  8. [mixer]
  9. src=AIL
  10. dest=Ch5
  11. switch=FMODE1
  12. scalar=0
  13. curvetype=fixed
  14. [mixer]
  15. src=AIL
  16. dest=Ch5
  17. switch=FMODE0
  18. curvetype=fixed
This should be obvious by now: in flight modes 1 and 2, the resulting mixer is enabled and it’s output replaces whatever was there. In flight mode 0, neither happens, so the first mixer’s output of 100 is used.
However, you can use a switch as a source and do this with two mixers and mostly default values. So change the mix type to Complex with 2 Mixers. Set the first mixer to a Fixed  Curve with a Scale of 0. Set the second mixer to a Min/Max  Curve with a Source of FMOD0 and a Switch of !FMOD1. To do that, change the Switch selector to FMOD1 then select it to invert the switch. Make sure the Scale is set to 100. If you changed the previous Expo&DR mix, you’ll have to fix that. Now the channel looks like:
  1. [channel5]
  2. template=complex
  3. [mixer]
  4. src=AIL
  5. dest=Ch5
  6. scalar=0
  7. usetrim=0
  8. curvetype=fixed
  9. [mixer]
  10. src=FMODE0
  11. dest=Ch5
  12. switch=!FMODE1
  13. usetrim=0
Much simpler than before. Now, in flight mode 1, the first mixers output of 0 is used. Otherwise, the second mixer is enabled, and it’s output is used. That is either 100 in flight mode 0, or -100 in any other flight mode. Since the only other flight mode where this mixer is enabled is flight mode 2, that’s the only one that gets the -100 value.
These two techniques cover all switch configurations that use a single channel.

Channel configuration

We’re almost ready to fly. We just need to tweak a few more things.

Throttle hold

There’s one last thing that needs to be done to complete a model before I’d fly it. It needs a Throttle Hold switch. Since the engine is the primary source of energy in the aircraft, shutting the throttle down will minimize damage to everything involved in a crash. Your aircraft is always involved, but there may be property or even people as well, so killing the engine not only potentially saves you money, but is a good idea for safety reason. On most aircraft that can fly inverted, simply lowering the throttle won’t shut the engine down. For that matter, it won’t on many multirotors, including the 200 QX.  Since you want this action to be as reflexive as possible, putting it on a switch means you do the same thing on every model, so we’ll do that.
Setting up a safety switch is easy. Go to the Mixer menu, and then select the button with the THR label on it. Use the Safety selector to select the switch you want. In this case, we’re going to use Virt1 as a switch, for reasons I’ll explain shortly. Then set the Safe Val to -125. On most models, you should set that value to -100 initially, and only lower it if that’s not enough to properly stop the engines. Some ESC’s may assume that the less-than-100 value you start with is actually 100, and adjust their behavior appropriately. The 200QX doesn’t have that problem, but I found that at -100 it doesn’t shut itself off as expected. Channel 1 now looks like:
  1. [channel1]
  2. safetysw=Virt1
  3. safetyval=-125
  4. template=simple
  5. [mixer]
  6. src=THR
  7. dest=Ch1
It just adds the values we changed from their defaults.

Other channel configuration

The other things you might want to change on the channel configuration page are Reverse, Fail-safe, and the two Scale’s, though Reverse is by far the most common one. 
Reverse does just what it sounds like - it reverses the channel so that as the output from the mix  goes from -100 to 100, the value sent to the receiver goes from 100 to -100. Even on aircraft and radios from the same company, this is sometimes necessary. While you could do this by negating the scale for every mixer in a mix, it’s easier to do it once on the channel configuration page. It also means you can work on the mix without having to invert your thinking.
Similarly, the Scale’s act as a Scale on the output from the entire mix, and you would do it here for much the same reasons. It’s similar to the travel setting found on some proprietary transmitters.
Fail-safe sets the failsafe value in the receiver.  This only works for the Devo protocol. If you’re not familiar with it, it’s the value the receiver will output on this channel if it loses contact with the transmitter.

Other niceties

If the THR Safety switch were a real switch, and not an unconfigured virtual channel, the model would be fine to fly now. So let’s fix that channel, and add a few other things that will make flying safer and more fun.

Sticky throttle hold

Let’s start with virtual channel 1, which I chose for the throttle hold switch.  We’re going to create a sticky switch, that only goes off if the throttle output is actually 0. This means that you won’t turn off the hold thinking the throttle is off when it’s not, only to have the props start spinning - and the aircraft start flying - when you aren’t expecting it. This also handles cases where other switches may need to be in the right setting for the throttle output to be zero.
So now on the Mixer page, find Virt1. Select that, and change the name to something like T Hold. Naming the virtual channels makes them a lot easier to deal with. Now back to the Mixer page, and edit the mix proper. Set the type to Complex and Mixers to 3.
Set the first mixer - Page 1 - so the Src is T Hold, and the Curve is Min/Max. This reads the old value of the channel, and outputs  -100 if the switch was off, and 100 if it was on. This normalizes the value, as we’ll be mangling it pretty badly soon.
Go the the second mixer - Page 2 - and set the mux to add, the Src to THR, the Curve to 1-1, and the Offset to -1. So, the output from this channel will run from -1 to 199 if the switch was on before, so the switch would only go 0ff if the throttle output is -100 or -99, which is close enough for every model I’ve tried. If the switch was off, the output will go from -201 to -1, and the switch will stay off no matter what the throttle does.
Finally, the third mixer - Page 3 - is a simple switch setup. Set the switch to RUD DR0, and the Curve to Fixed. The mux should already be replace. This mixer throws out the previous mixer output if the RUD DR switch is in position 0, and passes that previous value through if the switch is in position 1.
Our virtual channel should look like this:
  1. [virtchan1]
  2. name=T Hold
  3. template=complex
  4. [mixer]
  5. src=Virt1
  6. dest=Virt1
  7. usetrim=0
  8. curvetype=min/max
  9. points=0
  10. [mixer]
  11. src=THR
  12. dest=Virt1
  13. offset=-1
  14. usetrim=0
  15. muxtype=add
  16. [mixer]
  17. src=AIL
  18. dest=Virt1
  19. switch=RUD DR0
  20. usetrim=0
  21. curvetype=fixed
So now RUD DR0 turns on the throttle hold, and RUD DR1 won’t turn allow it to be turned off until the throttle output goes to -99 or -100. A sticky throttle hold.
Ok, now it’s time to deal with the different transmitters. If you have a Devo 8, 10 or 12, you can use the switches I’m going to use. If you have a Devo 6, you’ll have to pick different ones, but it’s actually got better names for this configuration. You can, for instance, use HOLD1 for the hold switch. If you have a Devo 7e - well, it can be made to work.  If you have extra switches installed, you can use those by changing the names. If not, you’ll want to look through the last section - on Trim buttons - to get everything set up.

A simple mix

The 200QX, like many quadcopters, tends to lose lift when it starts moving sideways. This is something that is normally compensated for with a mix in proprietary software. Personally, I don’t like doing this, but it’s a matter of taste. So I’ll show you how to add compensation in the throttle mix. Please note that I have not flown with this mix in place, so you’ll want to test it yourself!
Go the Mixer page, and open the mix for THR. Change it from a Simple to a Complex mixer. If you look through the first mixer, you’ll see that it’s still the same mixer you had in the simple mix. This is generally the case. Changing the mix type won’t change the mixes, at least if they are all still there.
Now set Mixers to 3. Go the the second Page, and set the Src to AIL, the Curve to ABSVAL, the mux to add, and the Scale to 20. The ABSVAL  Curve means the offset of the AIL will be used, not the actual value. The Scale is a guess for what percentage of the aileron offset we need to add to the throttle.
Now repeat the process on Page 3 with ELE as the Src. Your new throttle channel should look like:
  1. [channel1]
  2. safetysw=Virt1
  3. safetyval=-100
  4. template=complex
  5. [mixer]
  6. src=THR
  7. dest=Ch1
  8. [mixer]
  9. src=AIL
  10. dest=Ch1
  11. scalar=20
  12. usetrim=0
  13. muxtype=add
  14. curvetype=absval
  15. points=0
  16. [mixer]
  17. src=ELE
  18. dest=Ch1
  19. scalar=20
  20. usetrim=0
  21. muxtype=add
  22. curvetype=absval
  23. points=0
Note that No Trim was also on in the new mixers. Also, if you start moving on a diagonal, both aileron and elevator inputs will be added to your throttle, which may not be desirable. But you’ll have to tune this yourself.

Timers

If you’ve looked at the main page and played around some, you may have figured out that the top number on the left is the throttle output. But the other two haven’t moved. Those are timers, and we’re going to set them up now.
Since the motors turn whenever throttle hold is off, I want the timers to run when throttle hold is off, as that means the motors are running. For many aircraft, setting the Switch to THR will be a better timer, as it runs when the throttle output is above -100.  However, running when it’s above -100 also means that the T Hold channel, which works fine as a switch for  the throttle Safety, won’t work as a switch for a timer. So we need a new channel.
So, back to Mixer page, pick another virtual channel, and set the type to Simple, the Src to !T Hold, and the Curve to Min/Max. Give it a name like DT Hold (for Display Throttle Hold). Note that you can’t use !DT Hold as the switch and not invert the Src. This is a bug in the timer code, but should be fixed in the next release.
Go to the Model menu, and then the Timers page. Set Timer1 to a countdown timer, Switch to DT Hold, Reset sw to ELE DR1, and Start to 9:00. The Switch setting will cause the timer to only run when the throttle is not held.
When first setting up a model, you should probably set this Timer1 to stopwatch. After you’ve flown a few times and gotten a feel for how long the batteries last, change it back to countdown. The transmitter alarm will then go off 30 seconds before the timer runs out, and every 10 seconds after that to warn you that it’s time to land. Those two times can both be set on the Transmitter config page, under Timer  settings.
Now go down to Timer2, and set it to permanent. Again, set the switch to DT Hold or THR, whichever you used for Timer1. so it runs whenever Timer1 is running. This timer always counts up, and is saved between flights. It will record the total flight time on the model. If your model needs regularly scheduled maintenance, this is the timer to use for that.
If you now go back to the main page and tick the throttle up, both timers should start running. Here’s what my timer config looks like in the model.in file:
  1. [timer1]
  2. type=countdown
  3. src=Virt1
  4. resetsrc=ELE DR1
  5. time=420
  6. [timer2]
  7. type=permanent
  8. src=Virt1
  9. val=21271496

Channel monitor

Go to the Model menu, and then Main page config. If you have a color touch screen, select the plus sign at the top.  On either display, find the Menu 1 item and change it’s value from Telemetry monitor to Channel monitor. Now a long-press on the UP button will bring up the channel monitor, which is useful for checking your mixer.

Toggle icons

One - well, three - last things to do, and then we’re ready to fly. These really are just display tweaks, and won’t affect the flight at all. I have to apologize in advance - here is one of the few places where the different transmitters configuration is radically differently. How you set these up, which ones are on by default, and what icons are available are different depending on the transmitter.
Go to the Main page config. If you have a black and with display, find Toggle1, and use the source selector next to it to select T Hold. Now select the Toggle1 button, use the Down button to select Pos 1, and then the Left button to select an icon to indicate throttle hold. If you have a color touch screen, select the box labelled Pos 1, and then select the wrench icon. Now change the RUD DR source to T Hold, select Edit, select Pos 1 and then a throttle hold  icon.
If there is a toggle using ELE DR as a source, change the source to FMODE Otherwise, pick an unused toggle and set it’s source to FMODE. When you edit it, you will see that it has POS 0POS 1 and POS 2 unless you’re using a Devo 7e. Change the icons for all three to something appropriate for the flight modes that switch enables.
Finally, edit the icons used in the AIL DR toggle and set position 1 to a low rate indicator.
Going back to the main page now, you’ll see that your selected throttle hold icon goes on when the throttle is held, the low rate indicator goes on when you are in low rates, and the flight mode is displayed on the screen. While I don’t recommend looking at the transmitter when you’re flying, it’s nice to be able to check these things before you take off.

 


 

Finding RTF & BNF channel mappings

The techniques used for basic model setup will work on most kits and RTF and BNF models from the companies that created the protocols. But they don’t always work with off-brand RTF and BNF models, since some of those companies don’t sell transmitters except as replacement parts for specific models, and will change the protocols and channel mappings seemingly at random. So if you’ve got one of those, you may have to work out what channels actually do what.
This problem doesn’t arise with proprietary firmware - you either fly the manufacturer's models or models that license their protocol, and normally can’t change protocols. If you can, it’s only to that manufacturer’s protocols. And even if you could get an unlicensed model to bind, the firmware isn’t designed to let you change the channel mapping. Since this problem is unique to open source firmware, we’ll take a detour to talk about how to handle it when you set up a model.
The best way to find the channel mapping for a model is to search the web for it. rcgroups.com is a good source, but not the only one, so you might search google as well. But if that doesn’t turn anything up, you’re going to have to experiment with things yourself.

Experimenting to find the channels

This is a simple idea - just try things and see what they do. This should be done in deviationTx’s advanced mixer mode, since you can’t change the channel source in standard mixer mode. But there are some precursors you’ll need to deal with.
First things first: Take all the propellers off the aircraft! This is a critical safety step, as it may go to half or even full throttle the first time you bind it.
Some RTF aircraft - especially the toy-grade ones - may require some stick input to bind. Normally, that’s going to full throttle and back down. If so, you’ll have to try each channel in turn to see if the aircraft binds. Once you get it to bind, You know where the throttle channel is.

Throttle

If you didn’t find the throttle in the bind process, watch the control surfaces when you bind. If the throttle doesn’t go on when you bind it, then the throttle is correct.
If the throttle goes on, try raising the throttle stick and see what response you get. If the throttle output changes - especially if it goes down - you’ve find the throttle. If nothing happens, then one of the other channels is probably the throttle. Try them one at a time until you figure out which is the throttle, and then if necessary rearrange your channels so the throttle stick controls the throttle on your aircraft

Other control surfaces

The other control surfaces are simple after that. Just try them, and see what responds. If the wrong thing moves, you’ll want to rearrange your channels.

Rearranging channels

While doing this experimentation, you may need to rearrange the flight control channels to be different from the default settings. This is easiest to do if you just swap the control with the channel it should be on.
When you look at the mixer settings, the first few channels will have a button with a label that looks like #-????. The # will be the channel number, and the ???? will be the usual usage for that channel and protocol. There is also a button labelled Simple, which is the type of the mix, and a label which initially matches the ???? on the button, which is the current input source for that channel.
If the elevator stick currently controls the aileron, you’ll want to swap those. So find the two channels that currently have the labels ELE and AIL not on a button. Those are the two you want to swap.
To change the input used by a channel, select the Simple button. Then find the Src selector, and move it to the input you want to control that channel. The four controls are always in the same order, no matter what protocol you use: AIL, ELE, THR, RUD. Finally, select Save and you’re done with that channel.

Other controls

At this point, you’ve got the basic controls working right, so you need to figure out any other channels that may exist.
They come in four basic flavors.
Toggles. Channel high gets one behavior, channel low gets a different one. Like lights on and off.
Multi-value toggles. Like toggles, but with more than one behavior and output values. Like flight modes in the 200QX config we just finished.
Edge-triggered. Usually on a button. Causes something to happen when the channel goes from high to low or vice versa. Like taking a picture.
Analog. Uses a range of values like a flight control. Like a camera gimbals position or speed control.
For toggles and edge-triggered controls, assign a switch as the source for the suspected output channels, and just try them one at a time. If nothing happens, throw the switch the other way to see if it changes. If it’s a toggle, you can change the sense of the switch by inverting the source in the mixer - see the section on fine tuning below.
If you want an actual button, you can use the deviationTx grim button switch features. See the last section for how to set these up.
For multi-value toggles, you either need some indication from the aircraft when it changes mode, or documentation on what ranges do what. If you get an indicator, then use an analog input as a Src for the suspect channels. Go to the Channel monitor page on your controller. Now adjust the analog control, and when you get the indicator you want, note the value for that channel on the monitor. Later, you can set things up on switches as described for the 200QX flight mode controls.
If you don’t have any spare analog inputs, you can use an trim buttons to create a full-range analog control. Details are in the last section.

WLtoys channel hacks.

Just a warning. The older WLToys aircraft - anything using the FlySky protocol - use a hack to simulate extra channels. And I mean hack in the sense invoked by the phrase “repairing furniture with an axe”.
The protocol is still a four channel protocol. However, the controller will use values in one of the existing channels well outside the normal range. The flight control board will strip these values off, and treat it as an extra channel.
The WLToys option in the deviationTx implementation of this protocol uses channels 5–8 as switches to control those extra high values - at least as they were in the v9x9 quadcopters. Later aircraft apparently use the same hack, but not quite the same way.
In particular, some of the implemented version create a throttle value way above the normal range, and later WLToys aircraft will try and use that value for the throttle. This is not a good thing.

Reversing a channel

If the throttle starts at full when you bind with the throttle stick down, or a control works backwards, you need to reverse the channel. This is something that also happens with proprietary firmware, so you may be familiar with it.
The best way to reverse a channels output is to select the channel button - the one with the channel number and control on it for the ones we’re talking about. Then select the button that says Normal so it says Reversed, and select Ok and you’re done.
There are other ways to reverse a simple channel, but this is the one that always reverses the output, and won’t require more work with a more advanced configuration

Throttle safety

If you’ve had to change the throttle channel, there’s one last thing to do. When you first load a model, either by turning the controller on or using the model load  menu, deviationTx will not try and bind until the throttle is at a safe level. If you’ve changed the throttle this will check the wrong channel, meaning you could bind with the throttle up, and will probably have to clear the warning about the wrong channel every time you use this config. While you can set all of these levels, they aren’t editable on the controller.
So, the first step is to plug your controller into a USB port on your computer. Then turn the controller on while holding the ENT button. This is the same thing you did to install the file system when you installed deviationTx on the controller.
In the disk that this puts on your computer, you want to edit the file models/model#.ini, the file corresponding to the model number for your aircraft. Any text editor should do, but check the deviationTx forums if you have problems.
Find the [safety] section. It should have one line in it, that says Auto=min. Change that to be Ch#=min, where # is the channel number that controls the throttle. This will cause deviationTx to check that channel instead of the default throttle channel for this protocol.
If you are getting warnings about Ch3 being the wrong value, this means that Auto isn’t working right for some reason. Changing this to be your throttle channel as above will clear that up.

 


 

Advanced model setup

Ok, we’ve set up a simple model. But so far, we’ve not done anything that good proprietary firmware can’t do. Even modest firmware should be able to do everything but the sticky throttle hold. So now it’s time to get serious about this.

A panic switch

The Blade 200 SRX has a Panic switch that changes the flight mode to beginner mode, and disables the cyclic inputs. While I’m not sure if that’s a good idea, it’s easy to implement with deviaitonTx.
In the AIL and ELE channel configurations, set GEAR1 as the Safety, and set the Safe Val to 0. For channel five, the Safety is again GEAR1, but the Safe Val is 100. We’ll look at the gear channel in a second. The aileron channel is now:
  1. [channel2]
  2. safetysw=GEAR1
  3. template=expo_dr
  4. [mixer]
  5. src=AIL
  6. dest=Ch2
  7. curvetype=expo
  8. points=35,35
  9. [mixer]
  10. src=AIL
  11. dest=Ch2
  12. switch=AIL DR1
  13. scalar=70
As you can see, all we’ve done is changed it so the GEAR1 switch disables the cyclic inputs. Since it also switches the flight mode to beginner, the 200QX will auto-level.
While we’re doing this, it might be a good idea to add an icon to the main page to indicate that it’s on. So back to the Main page config. and get to the list of toggles. Pick an unused toggle, set it to GEAR, and then edit  it to set an appropriate icon for Pos 1.

Stagility mode

Stagility mode was invented by someone using proprietary firmware. They did it by mixing the cyclic controls on a Blade 350QX into the flight mode channel to kick it from Stability to Agility mode - or Intermediate to Expert mode on the 200QX. We can duplicate that, and do it better by not mixing into the flight mode channel, but using the mix as a switch that changes the flight mode channel properly.
First warning: “stagility mode” on the 200QX is not supported by Blade or Horizon Hobby, and the flight controller on the 200QX has been known to become disoriented by rapidly changing the flight mode. So use this mode at your own risk.
Second warning: The 200QX version 2 firmware in 3d mode  has an intermediate flight mode that has stagility-like behavior. Using this mode there is pointless, and not recommended at all.
The first step is to create a channel that will be an on switch with enough cyclic input, and off otherwise. There are a number of options for doing this, but let’s set up what I use and then talk about the others.
Pick an unused virtual channel on the Mixer page. Change the name to Stagility. Now edit the mix. Change it’s type to Complex (what else?) and set up 3 Mixers. The first mixer will have a Src of AIL, and a Curve of ABSVAL. The second will have a Src of ELE, Curve of ABSVAL and a mux of max.
So we now have the output of the second mixer being the larger offset of the two cyclic controls. Other alternatives include a mux of add, or being mathematically accurate and multiplying each cyclic by itself and then adding them. However, taking the max works well in practice. This means we now have a value between 0 (no cyclic) and 100 (one or the other at full cyclic).
The third mixer is going to provide the offset to make this so the switch will sometimes go off. If you leave off the third mixer, flight mode 1 would just be expert mode. So we’re going to add a Fixed  Curve with a Scale of  -80 and a mux of add. This means one of your cyclics will have to be 80% of the way to the edge to trigger the switch to expert mode.
The gear channel also needs a minor tweak. Change the first mixer Curve to Min/Max, the Src to Stagility, the Scale and Offset to -50. We’re repeating the technique used in the second mixer, only this time with the Stagility switch. Using Min/Max here means the output values will be 0 and -100. Well, after applying the Scale and Offset to the initial value of -100 and 100, they’ll be 0 and 100. So our Gear channel with the updated mix and Safety now looks like:
  1. [channel5]
  2. safetysw=GEAR1
  3. safetyval=100
  4. template=complex
  5. [mixer]
  6. src=Virt2
  7. dest=Ch5
  8. scalar=-50
  9. offset=-50
  10. usetrim=0
  11. curvetype=min/max
  12. points=0
  13. [mixer]
  14. src=FMODE0
  15. dest=Ch5
  16. switch=!FMODE1
  17. usetrim=0
Much the same as before: if the FMOD switch is not in position 1, we output -100 and 100 depending on whether or not it’s in position 0. If it’s in position 1, instead of just outputting 0, we output either 0 or -100 depending on the sticks and that third mixer in the Stagility channel.

Dialable stagility mode

The downside to all this is that changing the stagility behavior means you have to change the mix, which is clumsy. There ought to be an easier way. And sure enough, there is.
Instead of using a Fixed curve for the third mixer in the Stagility channel, let’s pick an analog input source. I’m using a Devo10, so I can just pick AUX5. if you don’t have a convenient dial or slider, see the last section on tricks with trim buttons to see how to turn a trim into an analog input.
So, back to the Mixer page, and then the third mixer in the Stagility channel. Set the Src to AUX5 or whatever you are using for your analog input. Set the Curve to 1-1, the Scale to 50 and the Offset to -55. This means that as AUX5 goes from -100 to 100, what gets subtracted from the cyclic offset - and hence how much offset is needed to trigger expert mode - will go from 101 to -99.  So when AUX5 is all the way down, you just have stock intermediate mode. Dialed all the way up to 100, then the slightest motion off center will turn on agility mode. And of course, you can get all the behaviors in between. Now that we’re done with it, here’s the Stagility channel:
  1. [virtchan2]
  2. name=Stagility
  3. template=complex
  4. [mixer]
  5. src=ELE
  6. dest=Virt2
  7. usetrim=0
  8. curvetype=absval
  9. points=0
  10. [mixer]
  11. src=AIL
  12. dest=Virt2
  13. usetrim=0
  14. muxtype=max
  15. curvetype=absval
  16. points=0
  17. [mixer]
  18. src=AUX5
  19. dest=Virt2
  20. scalar=50
  21. offset=-51
  22. usetrim=0
  23. muxtype=add
The difference between this and the non-dialable version is only the third mixer, which had a Fixed curve. Of course, the reality is that you may want to adjust the Offset here to make sure that you actually get a blue light when in flight mode 1 with AUX5 dialed to +100. Stick calibration, trim, and who knows what might be enough to kick it up to turning on expert mode.
Given how important AUX5 has become, let’s put it on the main page. Unfortunately, you can’t do that directly - we need to make it available in an output channel. So to the Mixer page, and pick an unused virtual channel. Name it St Dial or something similar for “stagillity dial”. Set the type to Simple, the Src to AUX5, the Curve to 1-1, the Scale to -50 and the Offset to 51. This makes the output value goe from 101% to 1% as AUX5 goes from -100% to 100%. It’s now how much you have to offset the cyclic sticks to switch to agility mode. To display it, go to the Main page config page, and find the unused box. Or add one if you need to, and position it where you want it. I put it underneath the timers and above the rudder trim indicator on my Devo 10. Set the input to St Dial, and you’re done. I could add the St Dial channel here, but I don’t think you need it.
One last thing you might do is create a safety for AUX5, just to remind you to set it when you load this model. I know I like having that. So plug your transmitter into the USB port on your computer, hold down the ENT key, and power it on. In the disk that this puts on your computer, you want to edit the file models/model#.ini, the file corresponding to the model number for your aircraft. Any text editor should do, but check the deviationTx forums if you have problems.
Find the [safety] section. It should have one line in it, that says Auto=min. Below that, add a line that says AUX5=min. That will cause deviationTx to check that input as well as the throttle channel when this model is loaded. If it’s not in the position where the sticks don’t change modes, it reminds you to correct it.

Initialize the flight controller

Ok, one last tweak that you can’t do with most proprietary controllers. Right now, you have to do a stick dance to initialize the flight controller. We’re going to automate that, so that turning off throttle hold initializes the flight controller.
First, we need a moving value just to start with. The Delay  mux setting gives us that.  So choose a virtual channel, give it the name Delay, and set Mixers to 2. The first mixer should have a source of T Hold and a Curve of Min/Max. If you remember, the output of T Hold covers a wide range. Using a Min/Max curve causes it to go back to -100 to 100.
Now add the delay. Literally. Set the second mixer Curve to Fixed, and the mux to delay.  Set the Scale to 3 to start with. You’ll want to experiment with that, though. Here’s the resulting Delay channel.
  1. [virtchan4]
  2. name=Delay
  3. template=complex
  4. [mixer]
  5. src=!Virt1
  6. dest=Virt4
  7. usetrim=0
  8. curvetype=min/max
  9. points=0
  10. [mixer]
  11. src=AIL
  12. dest=Virt4
  13. scalar=3
  14. usetrim=0
  15. muxtype=delay
  16. curvetype=fixed
We now need to use this moving value to make the rudder channel cycle as required by the 200QX. So change it from a Simple mix to a Complex mix. Leave the first mixer as is, and change the second one to have a Src of Delay, a mux of add, and a 5 Point  Curve. Select the Curve button so you can set the points in the curve. You want them to be 0, 100, 0, -100 and 0 in order. We are going to be adding either the first or last value to the rudder all the time it’s not initializing, so they need to be 0. In between, you need to have a 100 and a -100 in that order. I put the extra 0 in the middle because I like symmetry, but it could be at either end as well. I now have:
  1. Rudder channel:
  2. [channel4]
  3. template=complex
  4. [mixer]
  5. src=RUD
  6. dest=Ch4
  7. [mixer]
  8. src=Virt4
  9. dest=Ch4
  10. usetrim=0
  11. muxtype=add
  12. curvetype=5point
  13. points=0,100,0,-100,0
You will want to experiment with the Scale value on the Delay channel. I can set it to 2 and things still work, but they don’t if I set it to 1. I also know it works at 5, and presumably 4. I set it to 3 because I want to avoid possible boundary problems from it being 2.

Advanced Flight Mode Settings

While the 200QX is a great multirotor, it’s an older flight controller and only has 3 flight modes, which works very well with the 3-position switches on Devo transmitters. However, modern flight controllers have 5 or more flight modes, and the ability to use a single channel to set them.
Four or five flight modes with two switches are both easy, you just need to set up a three position switch for three flight modes, then add a mix that’s switched on a second switch, and outputs either a fixed value or the value of one of the other switch positions. Here’s a five-way switch on FMODE and MIX. MIX0 causes FMODE to control the ouput for vlues of 100, 50, 0, and then MIX1 outputing 50 and MIX2 100.
  1. [channel5]
  2. template=complex
  3. [mixer]
  4. src=AIL
  5. dest=Ch5
  6. scalar=50
  7. usetrim=0
  8. curvetype=fixed
  9. [mixer]
  10. src=FMODE0
  11. dest=Ch5
  12. switch=!FMODE1
  13. scalar=50
  14. offset=50
  15. usetrim=0
  16. curvetype=min/max
  17. points=0
  18. [mixer]
  19. src=MIX1
  20. dest=Ch5
  21. switch=!MIX0
  22. scalar=25
  23. offset=-75
  24. usetrim=0
  25. curvetype=min/max
  26. points=0
The first two mixers are the same as the previous flight mode selection, except that the scalar and offset move it to the values we want. The last mixer is similar to the second one: when MIX0 is not on, disable this mix, so we use the value selected by FMODE. Otherwise, use the value selected by MIX1 and MIX2, again with a scalar and offset to get the desired values.
This clearly doesn’t work with if you need six flight modes. In this case,a 2-position switch and the Mult mux type can be used, like so:
  1. [channel1]
  2. template=complex
  3. [mixer]
  4. src=GEAR1
  5. dest=Ch1
  6. usetrim=0
  7. [mixer]
  8. src=AIL
  9. dest=Ch1
  10. switch=FMODE1
  11. scalar=67
  12. usetrim=0
  13. muxtype=multiply
  14. curvetype=fixed
  15. [mixer]
  16. src=AIL
  17. dest=Ch1
  18. switch=FMODE2
  19. scalar=33
  20. usetrim=0
  21. muxtype=multiply
  22. curvetype=fixed
This uses the GEAR switch to toggle  between positive and negative values based on FMODE.  For GEAR1, FMODE goes from 10o to 67 to 33, and GEAR1 negates those values.
The add mux type can be used to do something similar. Set up a three-positions switch to output values of 100, 67, 33, and then use a final mix enabled by the second switch with an add mux type, fixed curve type, and a scalar of -100.

 

 


 

Tricks with trim buttons

Normally, trim values are associated with an output channel, and the trim value is added to the channel after the mix value is calculated. But deviationTx has an incredibly flexible trim support, and can do a lot more than that. Not only can trims be used to create a variety of different kinds of switch behaviors, the configuration buttons can also be used as trim buttons. This lets you create controls that aren’t available on your transmitter.  Of course, these means you get no feedback on their value like you do with a real switch. Toggle icons on the main page can help with that.
Because of their use as normal trim buttons, these extra controls interact oddly with output channels. If you want to use one as a Src in some mixer, you have to make sure there is No Trim on that mixer, otherwise the trim will get added twice, making the output go from -200 to 200. This means it has to be in a Complex mix so you can set No Trim.
If you want to use an output channel as the switch instead of a virtual channel as described below, then you have to make sure you have No Trim instead of Trim, otherwise it’ll be added twice. Of course, this also means the mix configuration doesn’t really matter, so long as the output is always 0. But this usage isn’t documented, so the behavior may change in the future. I again recommend sticking with virtual channels unless you’ve run out.
As a final note, the navigation buttons only work on the main page. If you’re not on the main page, they don’t do anything. For the non touch-screen transmitters, this means that the ENT button can’t be used, because you use it to start configuration! It works fine on the touch-screen transmitters, though. Similarly, you want to be careful about using the UP and DOWN buttons as momentary switches, as holding them down will cause you to jump to the shortcut page, which will disable changes on it and leave it on.

A momentary button

None of the Devo transmitters have any kind of momentary button. There’s really no good way to simulate them with switches. When configured, these buttons provide a 1 when the button is down, and a 0 otherwise. For the 200QX config, you could use one to reset the timers.
Momentary buttons are also great for edge-triggered controls, like the WLToys cameras. I use one for changing flight modes on the Blade NanoQX.
So let’s create one. Go to the Mixer page, and pick an unused virtual channel. Rename it to Reset. Set the mix type to Complex with 1 Mixers. Set that mixer to have a Src of Reset, a Curve of 1-1 and a Scale 0f 0. Make sure the Trim is on. Your channel should like like this:
  1. [virtchan5]
  2. name=Reset
  3. template=complex
  4. [mixer]
  5. src=Virt5
  6. dest=Virt5
  7. scalar=0
Now got to the Trims page. Choose an unused trim, and set the Input to Reset, and the Trim Step to Momentary. The Momentary setting, like the other switch settings,  is to the left of the 0.1 value in the Trim Step selector. Finally, set the Trim + to Exit. In the model.ini file, you get:
  1. [trim5]
  2. src=Virt5
  3. pos=Exit
  4. step=193
  5. value=-100,0,0
You now have a switch that will be on when you’re holding down the EXT button, and off otherwise.

A toggle button

If you use the above configuration except set the Trim Step to Toggle, the channel value will toggle between -100 and 100 every time you press that button. They are great for things that you can see the effect of on the aircraft, especially if they are cosmetic in nature. Turning lights on and off, for instance. In the 200QX model, you could use one as the switch for the last mixer in the T Hold channel, but the possibility of bumping it and shutting down the motors while in flight makes me a bit leary of that.
One interesting use of these is for tracking an edge-triggered control’s state. You can set up a second virtual channel and a second virtual switch that uses the same button for Trim +, but has a Trim step of Toggle instead of Momentary. If you set up a main page toggle to use this switch, it will change the icon every time you press the button. So you can use it as a flight mode icon on the NanoQX, or to note when video is recording on a camera that uses that button for start and stop.
The channel setup is identical to the momentary button, except you probably want to use a name like Lights. As state, the Trim Step is Toggle. Here’s a model.ini showing a pair of trims providing a momentary and toggle on the TRIM_L+ button on the Devo 10:
  1. [trim5]
  2. src=Virt5
  3. pos=TRIM_L+
  4. step=193
  5. value=-100,0,0
  6. [trim6]
  7. src=Virt6
  8. pos=TRIM_L+
  9. step=192
  10. value=-100,0,0
Note that value settings in the model.ini file. It’s the last value of this trim.  Like any other trim value, it is saved between sessions. You’ll want to watch out for that if you depend on it being in the right state when you first load the model.

A switch

The toggle switch above has the problem that you need to know the current state in order to know what state you’ll get when you push it. If you instead configure it with an On/Off  Trim Step, you get to use one button to turn it on, and a second to turn it off. This makes a nice way to create an extra two-way switch on a transmitter that doesn’t have enough of them. On the 200QX config, one might make a nice panic switch, or you could use one for dual rates.
Of course, it does require two buttons, so I recommend using the ones that are already paired. The throttle trims are available on all transmitters, and unused in most models. Some transmitters have extra pairs of trim buttons. And they all have Left/Right and Up/Down button pairs.
Again, the configuration is pretty much the same as before, except that Trim Step is now On/Off, and you have to configure the Trim - button as well. So here’s what the model.ini looks like for an On/Off trim pair:
  1. [trim5]
  2. src=Virt5
  3. pos=TRIM_L+
  4. neg=TRIM_L-
  5. step=191
  6. value=100,0,0

Adding an analog input

Again, this doesn’t add a new capability, but provides an extra control should your transmitter run out.  For the 200QX config here, you could use this for the Stagility dial.
The channel setup is the same as for the switches above. Either a virtual channel with a 1-1  Curve, 0 Scale and Trim, or an output channel with an output of 0 and No Trim. But for these, we are going to use the numeric steps of the trim buttons, not the ones below .1. You get 100 steps in each direction. So if you set the Trim Step to 1, the trim value will go from -100 to 100. If you want a shorter range, you can set the Trim step  to less than 1.
If you want a longer range that -100 to 100, that’s a bit more work. You can’t get it directly, no matter what you set the Trim step to. Even using an output channel with Trim on the mix won’t work. You can use the virtual channel as a Src and leave Trim on in the mix. But in that case it’s probably better to just set the Scale instead.
These are still trim values. As such, the have features common to all trim values:
  • They beep when you set them to zero.
  • If you are holding the button, it’ll stop changing at zero.
  • The Switch setting will enable or disable its use.
  • It is saved when you stop using the model to be restored when you next load it.
And here’s a model.ini example with a 1.0 step using the Left and Right buttons, with MIX as a switch:
  1. [trim6]
  2. src=Virt5
  3. pos=Right
  4. neg=Left
  5. step=10
  6. switch=MIX
  7. value=27,0,0
In this case, the step value has a meaning.  The Trim Step will be one tenth of this value.

A three position switch

As a special case of the above, you can create a three position switch. Unfortunately, it won’t show up with three positions in the various switch and source settings in the configuration. You’ll need to use two more virtual channels to get those. For the 200QX, this could provide a flight mode switch on a transmitter that doesn’t have a three position switch.
Star by setting up the virtual channel as usual. Let’s call it FMODE0. As a switch, it will only be true in the -100 position. The trim configuration is just the analog input as above with FMODE0 as Input, except set the Trim step to 100. It now moves between the three values -100, 0 and 100  as you use the up and down buttons.
Now set up a second virtual channel. It’s going to be FMODE1. It’s a Complex mix, with 1 Mixers. That mixer has a FMODE0 as the Src, an ABSVAL  Curve, Scale is -1, and offset is 1. No Trim, of course. And now the third, as FMODE2. Another Complex mix with 1 Mixers.   Src is again FMODE0 (make sure you use the virtual channel, not the switch if you already have one!), Curve is 1-1 and Scale is -1. And again, No Trim.
These three virtual channels, when used as switches, will follow the trim values as expected. FMODE2 will be on and the others off when the trim value is 100. FMODE1 when it’s 0, and FMODE0 when it’s -100.
Here’s what you get in model.ini with all of them together:
  1. [virtchan5]
  2. name=FMODE0
  3. template=complex
  4. [mixer]
  5. src=Virt5
  6. dest=Virt5
  7. scalar=0
  8. [virtchan6]
  9. name=FMODE1
  10. template=complex
  11. [mixer]
  12. src=Virt5
  13. dest=Virt6
  14. scalar=-1
  15. offset=1
  16. usetrim=0
  17. curvetype=absval
  18. points=0
  19. [virtchan7]
  20. name=FMODE2
  21. template=complex
  22. [mixer]
  23. src=Virt5
  24. dest=Virt7
  25. scalar=-1
  26. usetrim=0
  27. [trim6]
  28. src=Virt5
  29. pos=TRIM_L+
  30. neg=TRIM_L-
  31. step=190
  32. value=-100,0,0


Старые Новые Дата создания Автор Действия
16.02.2017 в 18:23 Night_Ghost
16.02.2017 в 18:22 Night_Ghost
16.02.2017 в 17:56 Night_Ghost
16.02.2017 в 17:01 Night_Ghost
16.02.2017 в 16:52 Night_Ghost
16.02.2017 в 14:35 Night_Ghost
16.02.2017 в 14:33 Night_Ghost
16.02.2017 в 14:23 Night_Ghost
16.02.2017 в 14:09 Night_Ghost
16.02.2017 в 13:40 Night_Ghost
16.02.2017 в 11:37 Night_Ghost
16.02.2017 в 11:30 Night_Ghost
16.02.2017 в 10:58 Night_Ghost
16.02.2017 в 10:37 Night_Ghost
15.02.2017 в 22:50 Night_Ghost
-
Рейтинг@Mail.ru