Merge branch '2.3' into 2.4

This commit is contained in:
Raphael Coeffic
2021-05-16 12:55:21 +02:00
150 changed files with 7726 additions and 4099 deletions
+8 -3
View File
@@ -177,12 +177,17 @@ enum ModuleSubtypeMulti {
MODULE_SUBTYPE_MULTI_ELRS,
MODULE_SUBTYPE_MULTI_REALACC,
MODULE_SUBTYPE_MULTI_OMP,
MODULE_SUBTYPE_MULTI_MLINK, //75
MODULE_SUBTYPE_MULTI_MLINK, //75
MODULE_SUBTYPE_MULTI_WFLY2,
MODULE_SUBTYPE_MULTI_E016HV2,
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_E016HV2
MODULE_SUBTYPE_MULTI_E010R5,
MODULE_SUBTYPE_MULTI_LOLI,
MODULE_SUBTYPE_MULTI_E129, //80
MODULE_SUBTYPE_MULTI_JOYSWAY,
MODULE_SUBTYPE_MULTI_E016H,
MODULE_SUBTYPE_MULTI_CONFIG,
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_CONFIG
};
#define MODULE_SUBTYPE_MULTI_XN297DP 63-3
enum MMDSM2Subtypes {
MM_RF_DSM2_SUBTYPE_DSM2_22,
+1 -1
View File
@@ -706,7 +706,7 @@ inline void getMultiOptionValues(int8_t multi_proto, int8_t & min, int8_t & max)
min = 0;
max = 70;
break;
case MODULE_SUBTYPE_MULTI_XN297DP:
case MODULE_SUBTYPE_MULTI_XN297DUMP:
min = -1;
max = 84;
break;
+69 -4
View File
@@ -42,6 +42,7 @@ static void sendD16BindOption(uint8_t moduleIdx);
#if defined(LUA)
static void sendSport(uint8_t moduleIdx);
static void sendHott(uint8_t moduleIdx);
static void sendConfig(uint8_t moduleIdx);
static void sendDSM(uint8_t moduleIdx);
#endif
@@ -190,11 +191,14 @@ void setupPulsesMulti(uint8_t moduleIdx)
#if defined(LUA)
// SPort send
if (IS_D16_MULTI(moduleIdx) && outputTelemetryBuffer.destination == TELEMETRY_ENDPOINT_SPORT && outputTelemetryBuffer.size) {
sendSport(moduleIdx); //8 bytes of additional data
sendSport(moduleIdx); //8 bytes of additional data
}
else if (IS_HOTT_MULTI(moduleIdx)) {
sendHott(moduleIdx); //1 byte of additional data
}
else if (IS_CONFIG_MULTI(moduleIdx)) {
sendConfig(moduleIdx); //7 bytes of additional data
}
else if (IS_DSM_MULTI(moduleIdx)) {
sendDSM(moduleIdx); //7 bytes of additional data
}
@@ -251,10 +255,54 @@ void sendChannels(uint8_t moduleIdx)
}
}
void convertMultiProtocolToOtx(int *protocol, int *subprotocol)
{
if (*protocol == 3 && *subprotocol == 0) {
*protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1;
*subprotocol = MM_RF_FRSKY_SUBTYPE_D8;
return;
}
if (*protocol == 3 && *subprotocol == 1) {
*protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1;
*subprotocol = MM_RF_FRSKY_SUBTYPE_D8_CLONED;
return;
}
if (*protocol == 25) {
*protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1;
*subprotocol = MM_RF_FRSKY_SUBTYPE_V8;
return;
}
if (*protocol == 15) {
*protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1;
if (*subprotocol == 0)
*subprotocol = MM_RF_FRSKY_SUBTYPE_D16;
else if (*subprotocol == 1)
*subprotocol = MM_RF_FRSKY_SUBTYPE_D16_8CH;
else if (*subprotocol == 2)
*subprotocol = MM_RF_FRSKY_SUBTYPE_D16_LBT;
else if (*subprotocol == 3)
*subprotocol = MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH;
else if (*subprotocol == 4)
*subprotocol = MM_RF_FRSKY_SUBTYPE_D16_CLONED;
return;
}
if (*protocol >= 25)
*protocol -= 1;
if (*protocol >= 16)
*protocol -= 1;
}
void convertOtxProtocolToMulti(int *protocol, int *subprotocol)
{
// Special treatment for the FrSky entry...
if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY +1) {
if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY + 1) {
if (*subprotocol == MM_RF_FRSKY_SUBTYPE_D8) {
//D8
*protocol = 3;
@@ -288,10 +336,10 @@ void convertOtxProtocolToMulti(int *protocol, int *subprotocol)
// 15 for Multimodule is FrskyX or D16 which we map as a protocol of 3 (FrSky)
// all protos > frskyx are therefore also off by one
if (*protocol >= 15)
*protocol = *protocol + 1;
*protocol += 1;
// 25 is again a FrSky *protocol (FrskyV) so shift again
if (*protocol >= 25)
*protocol = *protocol + 1;
*protocol += 1;
}
}
@@ -404,6 +452,23 @@ void sendHott(uint8_t moduleIdx)
}
}
void sendConfig(uint8_t moduleIdx)
{
// Multi_Buffer[0..3]=="Conf" -> Lua script is running
// Multi_Buffer[4]==0x01 -> TX to Module data ready to be sent
// Multi_Buffer[4]==0xFF -> Clear buffer data
// Multi_Buffer[5..11]=7 bytes of TX to Module data
// Multi_Buffer[12] -> Current page
// Multi_Buffer[13..172]=8*20=160 bytes of Module to TX data
if (Multi_Buffer && memcmp(Multi_Buffer, "Conf", 4) == 0 && Multi_Buffer[4] == 0x01) {
// Config Lua script is running and sending
for (uint8_t i = 0; i < 7; i++) {
sendMulti(moduleIdx, Multi_Buffer[5 + i]);
}
Multi_Buffer[4] = 0x00; // Send data only once
}
}
void sendDSM(uint8_t moduleIdx)
{
// Multi_Buffer[0..2]=="DSM" -> Lua script is running
+1
View File
@@ -25,6 +25,7 @@
void multiPatchCustom(uint8_t moduleIdx);
void convertOtxProtocolToMulti(int *protocol, int *subprotocol);
void convertMultiProtocolToOtx(int *protocol, int *subprotocol);
class UartMultiPulses: public DataBuffer<uint8_t, 64>
{
+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
@@ -48,14 +48,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
@@ -47,6 +47,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)
@@ -269,6 +270,7 @@ enum ReceiverCapabilities {
RECEIVER_CAPABILITY_TELEMETRY_25MW,
RECEIVER_CAPABILITY_ENABLE_PWM_CH5_CH6,
RECEIVER_CAPABILITY_FPORT2,
RECEIVER_CAPABILITY_RACING_MODE,
RECEIVER_CAPABILITY_COUNT
};