Implement autobind and low power setting and specifying a custom protocol for the multi module
Specifying a custom prtocol is useful if OpenTX firmware is older than the multi module firmware and the protocol in question is not yet in the protocol list of the OpenTX firmware.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#define MULTI_SEND_BIND (1 << 7)
|
||||
#define MULTI_SEND_RANGECHECK (1 << 5)
|
||||
#define MULTI_SEND_AUTOBIND (1 << 6)
|
||||
|
||||
|
||||
#define BITLEN_MULTI (10*2) //100000 Baud => 10uS per bit
|
||||
@@ -114,7 +115,7 @@ void setupPulsesMultimodule(unsigned int port)
|
||||
protoByte |= MULTI_SEND_RANGECHECK;
|
||||
|
||||
// rfProtocol
|
||||
// 15 is FrskyX or D16 which we map as a subprotocol of 3 (FrSky)
|
||||
// 15 for Multimodule is FrskyX or D16 which we map as a subprotocol of 3 (FrSky)
|
||||
// all protos > frskyx are therefore also off by one
|
||||
if (type >=15)
|
||||
type= type +1;
|
||||
@@ -127,13 +128,19 @@ void setupPulsesMultimodule(unsigned int port)
|
||||
subtype = 0;
|
||||
}
|
||||
|
||||
protoByte |= (type & 0x1f);
|
||||
if (g_model.moduleData[port].multi.rfProtocol >= MM_RF_PROTO_CUSTOM)
|
||||
type = g_model.moduleData[port].multi.rfProtocol & 0x1f;
|
||||
|
||||
protoByte |= (type & 0x1f) | (g_model.moduleData[port].multi.autoBindMode << 6);
|
||||
sendByteMulti(protoByte);
|
||||
|
||||
|
||||
// power always set to high (0 << 7)
|
||||
sendByteMulti((g_model.header.modelId[port] & 0x0f)
|
||||
| (0 << 7) | ((subtype & 0x7) << 4));
|
||||
| ((subtype & 0x7) << 4)
|
||||
| (g_model.moduleData[port].multi.lowPowerMode << 7)
|
||||
);
|
||||
|
||||
|
||||
|
||||
//TODO: option_protocol, use same default as multi module
|
||||
|
||||
Reference in New Issue
Block a user