1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

OP-1905 Fix OPLM in PPM mode blocks telemetry stream if no USB connected

This commit is contained in:
Steve Evans 2015-05-24 10:18:54 +01:00
parent 97780a2106
commit 31eae08bba

View File

@ -123,6 +123,8 @@ static channelContext radioChannel;
static int32_t transmitRadioData(uint8_t *data, int32_t length);
static void registerRadioObject(UAVObjHandle obj);
static uint32_t radioPort();
static uint32_t radio_port = PIOS_COM_RF;
// Telemetry stats
static uint32_t txErrors;
@ -254,6 +256,20 @@ int32_t TelemetryInitialize(void)
{
HwSettingsInitialize();
#ifdef PIOS_INCLUDE_RFM22B
OPLinkSettingsInitialize();
OPLinkSettingsData data;
OPLinkSettingsGet(&data);
if (data.PPMOnly) {
radio_port = 0;
} else {
radio_port = PIOS_COM_RF;
}
#else /* PIOS_INCLUDE_RFM22B */
radio_port = 0;
#endif /* PIOS_INCLUDE_RFM22B */
FlightTelemetryStatsInitialize();
GCSTelemetryStatsInitialize();
@ -636,11 +652,8 @@ static uint32_t localPort()
*/
static uint32_t radioPort()
{
#ifdef PIOS_INCLUDE_RFM22B
uint32_t port = PIOS_COM_RF;
#else /* PIOS_INCLUDE_RFM22B */
uint32_t port = 0;
#endif /* PIOS_INCLUDE_RFM22B */
uint32_t port = radio_port;
#ifdef PIOS_INCLUDE_USB
// if USB is connected, USB takes precedence for telemetry
if (PIOS_COM_Available(PIOS_COM_TELEM_USB)) {