Added RX options (PWM/PPM, iBUS/SBUS)

This commit is contained in:
Raphael Coeffic
2021-09-19 16:17:47 +02:00
parent 7e3b06bffd
commit e0a8b3d8c3
7 changed files with 71 additions and 12 deletions
+44 -5
View File
@@ -856,12 +856,51 @@ class ModuleWindow : public FormGroup {
[](int v) { return v == FLYSKY_SUBTYPE_AFHDS2A; });
}
#endif
// RX options:
grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_OPTIONS, 0,
COLOR_THEME_PRIMARY1);
// PPM / PWM
if (isModuleAFHDS2A(moduleIdx)) {
new Choice(
this, grid.getFieldSlot(2, 0), STR_FLYSKY_PULSE_PROTO, 0, 1,
[=]() { return g_model.moduleData[moduleIdx].flysky.mode >> 1; },
[=](int v) {
g_model.moduleData[moduleIdx].flysky.mode =
(g_model.moduleData[moduleIdx].flysky.mode & 1) |
((v & 1) << 1);
});
} else {
new Choice(
this, grid.getFieldSlot(2, 0), STR_FLYSKY_PULSE_PROTO, 0, 1,
[=]() { return g_model.moduleData[moduleIdx].afhds3.mode >> 1; },
[=](int v) {
g_model.moduleData[moduleIdx].afhds3.mode =
(g_model.moduleData[moduleIdx].afhds3.mode & 1) |
((v & 1) << 1);
});
}
// SBUS / iBUS
if (isModuleAFHDS2A(moduleIdx)) {
new Choice(
this, grid.getFieldSlot(2, 1), STR_FLYSKY_SERIAL_PROTO, 0, 1,
[=]() { return g_model.moduleData[moduleIdx].flysky.mode & 1; },
[=](int v) {
g_model.moduleData[moduleIdx].flysky.mode =
(g_model.moduleData[moduleIdx].flysky.mode & 2) | (v & 1);
});
} else {
new Choice(
this, grid.getFieldSlot(2, 1), STR_FLYSKY_SERIAL_PROTO, 0, 1,
[=]() { return g_model.moduleData[moduleIdx].afhds3.mode & 1; },
[=](int v) {
g_model.moduleData[moduleIdx].afhds3.mode =
(g_model.moduleData[moduleIdx].afhds3.mode & 2) | (v & 1);
});
}
// TODO:
// - options (currently taken from 'subType'...):
// - PWM / PPM
// - SBUS / iBUS
#if defined(AFHDS3)
if (isModuleAFHDS3(moduleIdx)) {