Add support for R9M module (#5101)

* Implement R9M protocol according to PXX spec 1.7

Some of the things here are guesswork as I don’t have a R9M at hand. Also Companion support for the extra R9M options is not implemented yet.

* Fix build errors
This commit is contained in:
Arne Schwabe
2017-08-12 00:27:23 +02:00
committed by Bertrand Songis
parent 87295776ff
commit 51be7b000e
33 changed files with 244 additions and 120 deletions
+13 -17
View File
@@ -372,29 +372,25 @@ void setupPulsesPXX(uint8_t port)
pulseValueLow = pulseValue;
}
}
#if defined(BINDING_OPTIONS)
uint8_t extra_flags = 0;
/* Ext. flag (holds antenna selection on Horus internal module, 0x00 otherwise) */
uint8_t extra_flags = XJT_INTERNAL_ANTENNA;
if (port == INTERNAL_MODULE) {
#if defined(PCBHORUS)
extra_flags = g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna;
#endif
extra_flags |= g_model.moduleData[INTERNAL_MODULE].pxx.receiver_telem_off << 1;
extra_flags |= g_model.moduleData[INTERNAL_MODULE].pxx.receiver_channel_9_16 << 2;
}
putPcmByte(port, extra_flags);
#else //BINDING_OPTIONS
/* Ext. flag (holds antenna selection on Horus internal module, 0x00 otherwise) */
#if defined(PCBHORUS)
uint8_t antenna = XJT_INTERNAL_ANTENNA;
if (port == INTERNAL_MODULE) {
antenna = g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna;
extra_flags |= g_model.moduleData[port].pxx.external_antenna;
}
putPcmByte(port, antenna);
#else
putPcmByte(port, 0);
#endif
#if defined(BINDING_OPTIONS)
extra_flags |= g_model.moduleData[port].pxx.receiver_telem_off << 1;
extra_flags |= g_model.moduleData[port].pxx.receiver_channel_9_16 << 2;
#endif
if (IS_MODULE_R9M(port)) {
extra_flags |= g_model.moduleData[port].pxx.power << 3;
extra_flags |= g_model.moduleData[port].pxx.sport_out << 5;
}
putPcmByte(port, extra_flags);
/* CRC */
putPcmCrc(port);