Commit 7cbbdfb8 authored by Don Gagne's avatar Don Gagne

Fix live values

parent f36d8d03
...@@ -50,23 +50,26 @@ void APMFlightModesComponentController::_rcChannelsChanged(int channelCount, int ...@@ -50,23 +50,26 @@ void APMFlightModesComponentController::_rcChannelsChanged(int channelCount, int
Q_UNUSED(channelCount); Q_UNUSED(channelCount);
_activeFlightMode = 0; _activeFlightMode = 0;
int channelValue = pwmValues[4]; int channelValue = pwmValues[4];
if (channelValue != -1) { if (channelValue != -1) {
bool found = false;
int rgThreshold[] = { 1230, 1360, 1490, 1620, 1749 }; int rgThreshold[] = { 1230, 1360, 1490, 1620, 1749 };
for (int i=0; i<5; i++) { for (int i=0; i<5; i++) {
if (channelValue <= rgThreshold[i]) { if (channelValue <= rgThreshold[i]) {
_activeFlightMode = i + 1; _activeFlightMode = i + 1;
found = true;
break; break;
} }
} }
_activeFlightMode = 5; if (!found) {
_activeFlightMode = 6;
}
} }
emit activeFlightModeChanged(_activeFlightMode); emit activeFlightModeChanged(_activeFlightMode);
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
_rgChannelOptionEnabled[i] = QVariant(false); _rgChannelOptionEnabled[i] = QVariant(false);
channelValue = pwmValues[i+7]; channelValue = pwmValues[i+6];
if (channelValue != -1 && channelValue > 1800) { if (channelValue != -1 && channelValue > 1800) {
_rgChannelOptionEnabled[i] = QVariant(true); _rgChannelOptionEnabled[i] = QVariant(true);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment