[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
+11 -18
View File
@@ -168,7 +168,6 @@ void setupPulsesPXX(unsigned int port)
else { else {
flag1 = (g_model.moduleData[port].rfProtocol << 6) | pxxFlag[port]; flag1 = (g_model.moduleData[port].rfProtocol << 6) | pxxFlag[port];
if (g_model.moduleData[port].failsafeMode != FAILSAFE_HOLD) {
if (failsafeCounter[port]-- == 0) { if (failsafeCounter[port]-- == 0) {
failsafeCounter[port] = 1000; failsafeCounter[port] = 1000;
flag1 |= PXX_SEND_FAILSAFE; flag1 |= PXX_SEND_FAILSAFE;
@@ -177,7 +176,6 @@ void setupPulsesPXX(unsigned int port)
flag1 |= PXX_SEND_FAILSAFE; flag1 |= PXX_SEND_FAILSAFE;
} }
} }
}
putPcmByte(flag1, port); putPcmByte(flag1, port);
@@ -192,31 +190,26 @@ void setupPulsesPXX(unsigned int port)
} }
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
if (flag1 & PXX_SEND_FAILSAFE) { if (flag1 & PXX_SEND_FAILSAFE) {
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) { 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 = 3072;
else
chan = 1024;
}
else {
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); 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(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 {
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 { else {
if (i < sendUpperChannels) 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 else
if(i >= NUM_CHANNELS(port))
chan = 1024; 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);
} }
if (i & 1) { if (i & 1) {