1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 17:55:19 +03:00

Multi R9/DSM (#7804)

This commit is contained in:
3djc 2020-07-08 14:55:59 +02:00 committed by GitHub
parent 2bca354029
commit 044c3bbf86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 167 additions and 72 deletions

View file

@ -178,7 +178,7 @@ void setupPulsesMulti(uint8_t moduleIdx)
if (getMultiModuleStatus(moduleIdx).isValid()) {
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
if (status.minor >= 3 && !(status.flags & 0x80)) { //Version 1.3.x.x or more and Buffer not full
if (IS_D16_MULTI(moduleIdx) && moduleState[moduleIdx].mode == MODULE_MODE_BIND) {
if ((IS_D16_MULTI(moduleIdx) || IS_R9_MULTI(moduleIdx)) && moduleState[moduleIdx].mode == MODULE_MODE_BIND) {
sendD16BindOption(moduleIdx);//1 byte of additional data
}
#if defined(LUA)
@ -313,15 +313,14 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
// rfProtocol
if (type == MODULE_SUBTYPE_MULTI_DSM2 +1 ) {
// Autobinding should always be done in DSMX 11ms
if (g_model.moduleData[moduleIdx].multi.autoBindMode && moduleState[moduleIdx].mode == MODULE_MODE_BIND)
subtype = MM_RF_DSM2_SUBTYPE_AUTO;
// Multi module in DSM mode wants the number of channels to be used as option value
if (optionValue)
optionValue = 0x80 | sentModuleChannels(moduleIdx); // Max throw
// Multi module in DSM mode wants the number of channels to be used as option value along with other flags
if (optionValue & 0x01)
optionValue = 0x80; // Max throw
else
optionValue = sentModuleChannels(moduleIdx);
optionValue = 0x00;
if (g_model.moduleData[moduleIdx].multi.optionValue & 0x02)
optionValue |= 0x40; // 11ms servo refresh
optionValue |= sentModuleChannels(moduleIdx); //add number of channels
}
// Special treatment for the FrSky entry...
@ -336,7 +335,6 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MM_RF_CUSTOM_SELECTED)
type = g_model.moduleData[moduleIdx].getMultiProtocol();
uint8_t headerByte = 0x55;
// header, byte 0, 0x55 for proto 0-31, 0x54 for proto 32-63
if (type & 0x20)