Files
edgetx/radio/util/hw_defs/lua_inputs.jinja
T
2026-08-03 16:37:20 +08:00

43 lines
1.5 KiB
Django/Jinja

//
// WARNING: DO NOT EDIT THIS FILE
// This file has been generated from the target's JSON hardware description
//
{% macro lua_input(first, offset, input) %}
{% set li = legacy_inputs[input.name] %}
{ {{ first }} + {{ offset }}, "{{ li.lua }}", "{{ li.description }}" },
{%- endmacro %}
{% macro lua_inputs(first, inputs) %}
{% for input in inputs %}
{{ lua_input(first, loop.index0, input) }}
{% endfor %}
{%- endmacro %}
static const LuaSingleField _lua_inputs[] = {
// main inputs
{% set main_inputs = adc_inputs.inputs | selectattr('type', '==', 'STICK') | list %}
{{ lua_inputs('MIXSRC_FIRST_STICK', main_inputs) }}
// flex inputs
{% set inputs = adc_inputs.inputs | selectattr('type', '==', 'FLEX') | list %}
{{ lua_inputs('MIXSRC_FIRST_POT', inputs) }}
// switches
{% set inputs = switches | selectattr('type','!=','FSWITCH') | list %}
{% set sw_count = inputs | count %}
{% for n in range(sw_count) %}
{% set sw = switches[loop.index0] %}
{ MIXSRC_FIRST_SWITCH + {{ loop.index0 }}, "{{ sw.name }}", "{{ sw.name }}" },
{% endfor %}
// trims
{% set trims_count = trims | count %}
{% for n in range(trims_count) %}
{% if n < (main_inputs | length) %}
{% set input = main_inputs[loop.index0] %}
{% set li = legacy_inputs[input.name] %}
{ MIXSRC_FIRST_TRIM + {{ loop.index0 }}, "trim-{{ li.lua }}", "{{ li.description}} trim" },
{% else %}
{ MIXSRC_FIRST_TRIM + {{ loop.index0 }}, "trim-t{{ loop.index }}", "Aux trim T{{ loop.index }}" },
{% endif %}
{% endfor %}
};