Failsafe settings on individual channels
This commit is contained in:
bsongis
2015-05-11 06:43:26 +02:00
parent 218e6a77ba
commit 059ea49f2f
7 changed files with 156 additions and 43 deletions
+18 -4
View File
@@ -230,10 +230,24 @@ void setupPulsesPXX(unsigned int port)
chan = (i < sendUpperChannels ? 2048 : 0);
}
else {
if (i < sendUpperChannels)
chan = limit(2049, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4094);
else
chan = limit(1, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2046);
if (i < sendUpperChannels) {
int16_t failsafeValue = g_model.moduleData[port].failsafeChannels[8+g_model.moduleData[port].channelsStart+i];
if (failsafeValue == FAILSAFE_CHANNEL_HOLD)
chan = 4095;
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE)
chan = 2048;
else
chan = limit(2049, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (failsafeValue * 512 / 682) + 3072, 4094);
}
else {
int16_t failsafeValue = g_model.moduleData[port].failsafeChannels[g_model.moduleData[port].channelsStart+i];
if (failsafeValue == FAILSAFE_CHANNEL_HOLD)
chan = 2047;
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE)
chan = 0;
else
chan = limit(1, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (failsafeValue * 512 / 682) + 1024, 2046);
}
}
}
else {