[Taranis] Failsafe settings changed for NOPULSES and HOLD

This commit is contained in:
bsongis@gmail.com
2013-05-22 09:08:15 +00:00
parent c36d366ef1
commit 212b02dfc6
+18 -25
View File
@@ -168,14 +168,12 @@ void setupPulsesPXX(unsigned int port)
else {
flag1 = (g_model.moduleData[port].rfProtocol << 6) | pxxFlag[port];
if (g_model.moduleData[port].failsafeMode != FAILSAFE_HOLD) {
if (failsafeCounter[port]-- == 0) {
failsafeCounter[port] = 1000;
flag1 |= PXX_SEND_FAILSAFE;
}
if (failsafeCounter[port] == 0 && g_model.moduleData[port].channelsCount > 0) {
flag1 |= PXX_SEND_FAILSAFE;
}
if (failsafeCounter[port]-- == 0) {
failsafeCounter[port] = 1000;
flag1 |= PXX_SEND_FAILSAFE;
}
if (failsafeCounter[port] == 0 && g_model.moduleData[port].channelsCount > 0) {
flag1 |= PXX_SEND_FAILSAFE;
}
}
@@ -192,31 +190,26 @@ void setupPulsesPXX(unsigned int port)
}
for (int i=0; i<8; i++) {
if (flag1 & PXX_SEND_FAILSAFE) {
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) {
if (i < sendUpperChannels)
chan = 3072;
else
chan = 1024;
if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD) {
chan = 2047;
}
else if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) {
chan = 0;
}
else {
if (i < sendUpperChannels) {
if (i < sendUpperChannels)
chan = limit(2048, 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, 4095);
if (chan == 3072) chan = 3073;
}
else {
chan = limit(0, 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, 2047);
if (chan == 1024) chan = 1025;
}
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);
}
}
else {
if (i < sendUpperChannels)
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
else if (i < NUM_CHANNELS(port))
chan = limit(1, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2046);
else
if(i >= NUM_CHANNELS(port))
chan = 1024;
else
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2047);
chan = 1024;
}
if (i & 1) {