Merge pull request #8267 from opentx/wismy/racing_mode_rollback

Wismy/racing mode
This commit is contained in:
Bertrand Songis
2021-04-16 17:57:10 +02:00
committed by GitHub
31 changed files with 180 additions and 59 deletions
+4 -3
View File
@@ -547,7 +547,7 @@ bool setupPulsesInternalModule(uint8_t protocol)
else {
#if defined(INTMODULE_HEARTBEAT)
mixerSchedulerResetTimer();
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 1000 /* backup */);
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD + 2000 /* backup */);
#else
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
#endif
@@ -641,10 +641,11 @@ void setCustomFailsafe(uint8_t moduleIndex)
g_model.failsafeChannels[ch] = channelOutputs[ch];
}
}
storageDirty(EE_MODEL);
}
}
int32_t getChannelValue(uint8_t channel) {
int32_t getChannelValue(uint8_t channel)
{
return channelOutputs[channel] + 2*PPM_CH_CENTER(channel) - 2*PPM_CENTER;
}
+9 -3
View File
@@ -47,14 +47,20 @@ void Pxx2Pulses::addFlag1(uint8_t module)
else {
subType = g_model.moduleData[module].subType;
}
Pxx2Transport::addByte(subType << 4);
uint8_t flag1 = subType << 4u;
if (isRacingModeEnabled() && isFunctionActive(FUNCTION_RACING_MODE)) {
flag1 |= PXX2_CHANNELS_FLAG1_RACING_MODE;
}
Pxx2Transport::addByte(flag1);
}
void Pxx2Pulses::addPulsesValues(uint16_t low, uint16_t high)
{
Pxx2Transport::addByte(low); // Low byte of channel
Pxx2Transport::addByte(((low >> 8) & 0x0F) | (high << 4)); // 4 bits each from 2 channels
Pxx2Transport::addByte(high >> 4); // High byte of channel
Pxx2Transport::addByte(((low >> 8u) & 0x0Fu) | (high << 4u)); // 4 bits each from 2 channels
Pxx2Transport::addByte(high >> 4u); // High byte of channel
}
void Pxx2Pulses::addChannels(uint8_t module)
+2
View File
@@ -46,6 +46,7 @@
#define PXX2_CHANNELS_FLAG0_FAILSAFE (1 << 6)
#define PXX2_CHANNELS_FLAG0_RANGECHECK (1 << 7)
#define PXX2_CHANNELS_FLAG1_RACING_MODE (1 << 3)
#define PXX2_RX_SETTINGS_FLAG0_WRITE (1 << 6)
@@ -268,6 +269,7 @@ enum ReceiverCapabilities {
RECEIVER_CAPABILITY_TELEMETRY_25MW,
RECEIVER_CAPABILITY_ENABLE_PWM_CH5_CH6,
RECEIVER_CAPABILITY_FPORT2,
RECEIVER_CAPABILITY_RACING_MODE,
RECEIVER_CAPABILITY_COUNT
};