Fix the custom protocol logic for multi

There parts that were not handling custom vs non custom right
This commit is contained in:
Arne Schwabe
2016-10-16 22:24:18 +02:00
parent b56b7d06cb
commit 278e71d6f9
8 changed files with 50 additions and 34 deletions
+5 -1
View File
@@ -644,6 +644,8 @@ PACK(struct TelemetrySensor {
* Module structure
*/
// Only used in case switch and if statements as "virtual" protocol
#define MM_RF_CUSTOM_SELECTED 0xff
PACK(struct ModuleData {
uint8_t type:4;
int8_t rfProtocol:4;
@@ -677,8 +679,10 @@ PACK(struct ModuleData {
};
// Helper functions to set both of the rfProto protocol at the same time
inline uint8_t getMultiProtocol()
inline uint8_t getMultiProtocol(bool returnCustom)
{
if (returnCustom && multi.customProto)
return MM_RF_CUSTOM_SELECTED;
return ((uint8_t) (rfProtocol & 0x0f)) + (multi.rfProtocolExtra << 4);
}