fix: Throttle idle trim handling for surface, enable MT12 tests (#4520)

Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
3djc
2024-01-21 13:53:25 +10:00
committed by GitHub
co-authored by 3djc raphaelcoeffic
parent 4c2ea7a60a
commit dfaad73070
36 changed files with 596 additions and 1328 deletions
+138 -46
View File
@@ -5,16 +5,24 @@ LEGACY_NAMES = [
"targets": {"x10", "x10express", "t16", "tx16s", "t18"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "S1",
@@ -85,16 +93,24 @@ LEGACY_NAMES = [
"targets": {"x12s"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "S1",
@@ -165,16 +181,24 @@ LEGACY_NAMES = [
"targets": {"x9e"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -224,16 +248,24 @@ LEGACY_NAMES = [
"targets": {"boxer"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -262,10 +294,14 @@ LEGACY_NAMES = [
"targets": {"mt12"},
"inputs": {
"ST": {
"yaml": "ST"
"yaml": "ST",
"lua": "ste",
"description": "Steering"
},
"TH": {
"yaml": "TH"
"yaml": "TH",
"lua": "thr",
"description": "Throttle"
},
"P1": {
"yaml": "POT1",
@@ -342,16 +378,24 @@ LEGACY_NAMES = [
},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -375,16 +419,24 @@ LEGACY_NAMES = [
},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -429,16 +481,24 @@ LEGACY_NAMES = [
},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -509,16 +569,24 @@ LEGACY_NAMES = [
"targets": {"t20"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -568,16 +636,24 @@ LEGACY_NAMES = [
"targets": {"pocket"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -592,16 +668,24 @@ LEGACY_NAMES = [
"targets": {"x9lite", "x9lites"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
@@ -616,16 +700,24 @@ LEGACY_NAMES = [
"targets": {"x9d", "x9d+", "x9d+2019"},
"inputs": {
"LH": {
"yaml": "Rud"
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele"
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr"
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail"
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
+26 -4
View File
@@ -3,11 +3,33 @@
// This file has been generated from the target's JSON hardware description
//
{% set inputs = adc_inputs.inputs | selectattr('type', '==', 'FLEX') | list %}
{% 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[] = {
{% for input in inputs %}
{% set li = legacy_inputs[input.name] %}
{ MIXSRC_FIRST_POT + {{ loop.index0 }}, "{{ li.lua }}", "{{ li.description }}" },
// 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) }}
// 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 %}
};
+13
View File
@@ -12,12 +12,25 @@ struct legacy_input_t {
};
static const legacy_input_t _legacy_inputs[] = {
// main inputs
{% for input in main_inputs %}
{% set li = legacy_inputs[input.name] %}
{ "{{ li.yaml }}", MIXSRC_FIRST_STICK + {{ loop.index0 }} },
{% endfor %}
// flex inputs
{% for input in flex_inputs %}
{% set li = legacy_inputs[input.name] %}
{ "{{ li.yaml }}", MIXSRC_FIRST_POT + {{ loop.index0 }} },
{% 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] %}
{ "Trim{{ li.yaml }}", MIXSRC_FIRST_TRIM + {{ loop.index0 }} },
{% else %}
{ "TrimT{{ loop.index }}", MIXSRC_FIRST_TRIM + {{ loop.index0 }} },
{% endif %}
{% endfor %}
};