[color] Fixed throttle trim switch setting

This commit is contained in:
Raphael Coeffic
2021-07-14 19:22:56 +02:00
parent 762ce4ce1f
commit a268a9a1d7
2 changed files with 20 additions and 1 deletions
+16
View File
@@ -672,6 +672,22 @@ PACK(struct ModelData {
return thrTrimSw + MIXSRC_FIRST_TRIM;
}
}
void setThrottleStickTrimSource(int16_t src)
{
// The order here is TERA, so that 0 (default) means Throttle
switch (src) {
case MIXSRC_TrimThr:
thrTrimSw = 0;
break;
case MIXSRC_TrimRud:
thrTrimSw = 2;
break;
default:
thrTrimSw = src - MIXSRC_FIRST_TRIM;
break;
}
}
});
/*
+4 -1
View File
@@ -1160,7 +1160,10 @@ void ModelSetupPage::build(FormWindow * window)
// Throttle trim source
new StaticText(window, grid.getLabelSlot(true), STR_TTRIM_SW);
new SourceChoice(window, grid.getFieldSlot(), 0, NUM_TRIMS - 1, GET_SET_DEFAULT( g_model.thrTrimSw));
new SourceChoice(
window, grid.getFieldSlot(), MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM,
[=]() { return g_model.getThrottleStickTrimSource(); },
[=](int16_t src) { g_model.setThrottleStickTrimSource(src); });
grid.nextLine();
}