From e642183deeeb7e88b8ce31a44a3a7e5a156c61e0 Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Sun, 28 Apr 2013 15:16:34 +0100 Subject: [PATCH] OP-924: Any disconnect between radios causes a reset, which causes a re-configuration of I/O devices (com ports, PPM, etc). This causes problems due to certain devices (PPM in particular) not supporting re-configuration. This patch forces configuration to only happen once (on initial connection), which should fix this issue. --- flight/modules/RadioComBridge/RadioComBridge.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flight/modules/RadioComBridge/RadioComBridge.c b/flight/modules/RadioComBridge/RadioComBridge.c index ccb6199ef..ea1579c6f 100644 --- a/flight/modules/RadioComBridge/RadioComBridge.c +++ b/flight/modules/RadioComBridge/RadioComBridge.c @@ -91,6 +91,9 @@ typedef struct { // Should we parse UAVTalk? bool parseUAVTalk; + // We can only configure the hardware once. + bool configured; + // The current configured uart speed OPLinkSettingsComSpeedOptions comSpeed; @@ -232,6 +235,7 @@ static int32_t RadioComBridgeInitialize(void) data->comTxRetries = 0; data->UAVTalkErrors = 0; data->parseUAVTalk = false; + data->configured = false; data->comSpeed = OPLINKSETTINGS_COMSPEED_9600; PIOS_COM_RADIO = PIOS_COM_RFM22B; @@ -590,6 +594,12 @@ static void updateSettings() OPLinkSettingsData oplinkSettings; OPLinkSettingsGet(&oplinkSettings); + // We can only configure the hardware once. + if (data->configured) { + return; + } + data->configured = true; + // Configure the main port bool is_coordinator = PIOS_RFM22B_IsCoordinator(pios_rfm22b_id); switch (oplinkSettings.MainPort) {