Skip to content

Commit

Permalink
fix(x9e): missing F3/F4 pots, slider hwdef changes (#5012)
Browse files Browse the repository at this point in the history
Co-authored-by: elecpower <[email protected]>
  • Loading branch information
3djc and elecpower authored May 19, 2024
1 parent f243f3a commit fe8e092
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 22 deletions.
7 changes: 6 additions & 1 deletion companion/src/firmwares/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,8 @@ bool GeneralSettings::convertLegacyConfiguration(Board::Type board)
else
idx = Boards::getInputPotIndex(i + 1, board);

// qDebug() << "i:" << i << "idx:" << idx << "pot name:" << potName[i];

if (idx >= 0) {
inputConfig[idx].type = Board::AIT_FLEX;
YamlValidateName(potName[i], board);
Expand All @@ -852,7 +854,7 @@ bool GeneralSettings::convertLegacyConfiguration(Board::Type board)

for (int i = 0; i < CPN_MAX_SLIDERS && i < Boards::getCapability(board, Board::Sliders); i++) {
int offset = 0;
if (IS_TARANIS_X9E(board) || IS_HORUS_X12S(board)) {
if (IS_HORUS_X12S(board)) {
// 0 - 1 extra sliders eg L1 - L2 or S1 - S2
// 2 - 3 LS - RS
// hw json flips the pairs
Expand All @@ -863,6 +865,9 @@ bool GeneralSettings::convertLegacyConfiguration(Board::Type board)
}

int idx = Boards::getInputSliderIndex(i + offset + 1, board);

// qDebug() << "i:" << i << "idx:" << idx << "slider name:" << sliderName[i];

if (idx >= 0) {
inputConfig[idx].type = Board::AIT_FLEX;
YamlValidateName(sliderName[i], board);
Expand Down
10 changes: 5 additions & 5 deletions companion/src/firmwares/opentx/opentxeeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,15 @@ class SourcesConversionTable: public ConversionTable {
offset -= 2;
}
else if (IS_TARANIS_X9E(board)) {
if (i == 6)
offset -= 2; // F3 -> F1 as F3 dropped at version 2.?? and F3 not on factory radio or included in radio hw json
else if (i >= 10 && i <= 11) // this range could be affected if F3 dropped whilst still supporting binaries
offset -= 4;
if (i >= 8 && i <= 9)
offset += 2;
else if (i >= 10 && i <= 11)
offset -= 2;
}
// end ADC refactor shuffles

addConversion(RawSource(SOURCE_TYPE_STICK, i + offset), val++);
// qDebug() << "i:" << i << "offset:" << offset << "index:" << i + offset << "desc:" << RawSource(SOURCE_TYPE_STICK, i + offset).toString() << "val:" << val;
//qDebug() << "i:" << i << "offset:" << offset << "index:" << i + offset << "desc:" << RawSource(SOURCE_TYPE_STICK, i + offset).toString() << "val:" << val;
}

for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) {
Expand Down
46 changes: 30 additions & 16 deletions radio/util/hw_defs/legacy_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,34 +214,48 @@
"short_label": "F2",
"description": "Potentiometer 2"
},
"P3": {
"yaml": "POT3",
"lua": "s3",
"label": "F3",
"short_label": "F3",
"description": "Potentiometer 3"
},
"P4": {
"yaml": "POT4",
"lua": "s4",
"label": "F4",
"short_label": "F4",
"description": "Potentiometer 4"
},
"SL1": {
"yaml": "SLIDER1",
"lua": "lcs",
"label": "S1",
"short_label": "S1",
"description": "Left center slider"
},
"SL2": {
"yaml": "SLIDER2",
"lua": "rcs",
"label": "S2",
"short_label": "S2",
"description": "Right center slider"
},
"SL3": {
"yaml": "SLIDER3",
"lua": "ls",
"label": "LS",
"short_label": "L",
"description": "Left slider"
},
"SL2": {
"yaml": "SLIDER2",
"SL4": {
"yaml": "SLIDER4",
"lua": "rs",
"label": "RS",
"short_label": "R",
"description": "Right slider"
},
"SL3": {
"yaml": "SLIDER3",
"lua": "lcs",
"label": "S1",
"short_label": "S1",
"description": "Left center slider"
},
"SL4": {
"yaml": "SLIDER4",
"lua": "rcs",
"label": "S2",
"short_label": "S2",
"description": "Right center slider"
}
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions radio/util/hw_defs/pot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
"x9e": {
"P1": {"default": "POT_CENTER"},
"P2": {"default": "POT_CENTER"},
"P3": {"default": "NONE"},
"P4": {"default": "NONE"},
"SL1": {"default": "SLIDER"},
"SL2": {"default": "SLIDER"},
"SL3": {"default": "SLIDER"},
Expand Down

0 comments on commit fe8e092

Please sign in to comment.