1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 11:29:51 +03:00

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-07 01:04:19 +02:00
parent b56b7d06cb
commit 278e71d6f9
8 changed files with 50 additions and 34 deletions

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);
}