diff --git a/flight/modules/ComUsbBridge/ComUsbBridge.c b/flight/modules/ComUsbBridge/ComUsbBridge.c index 5c0541b80..ad3cad4ce 100644 --- a/flight/modules/ComUsbBridge/ComUsbBridge.c +++ b/flight/modules/ComUsbBridge/ComUsbBridge.c @@ -42,7 +42,7 @@ static void com2UsbBridgeTask(void *parameters); static void usb2ComBridgeTask(void *parameters); -static void updateSettings(); +static void updateSettings(UAVObjEvent *ev); // **************** // Private constants @@ -106,8 +106,7 @@ static int32_t comUsbBridgeInitialize(void) HwSettingsOptionalModulesGet(&optionalModules); - if (usart_port && vcp_port && - (optionalModules.ComUsbBridge == HWSETTINGS_OPTIONALMODULES_ENABLED)) { + if (usart_port && vcp_port) { bridge_enabled = true; } else { bridge_enabled = false; @@ -119,8 +118,8 @@ static int32_t comUsbBridgeInitialize(void) PIOS_Assert(com2usb_buf); usb2com_buf = pios_malloc(BRIDGE_BUF_LEN); PIOS_Assert(usb2com_buf); - - updateSettings(); + HwSettingsConnectCallback(&updateSettings); + updateSettings(0); } return 0; @@ -170,7 +169,7 @@ static void usb2ComBridgeTask(__attribute__((unused)) void *parameters) } -static void updateSettings() +static void updateSettings(__attribute__((unused)) UAVObjEvent *ev) { if (usart_port) { // Retrieve settings diff --git a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp index d7e947216..902716058 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevohwwidget.cpp @@ -123,15 +123,6 @@ void ConfigRevoHWWidget::updateObjectsFromWidgets() data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = HwSettings::OPTIONALMODULES_DISABLED; } - // If any port is configured to be ComBridge port, enable UsbComBridge module if it is not enabled. - // Otherwise disable UsbComBridge module. - if (m_ui->cbFlexi->currentIndex() == HwSettings::RM_FLEXIPORT_COMBRIDGE || m_ui->cbMain->currentIndex() == HwSettings::RM_MAINPORT_COMBRIDGE || - m_ui->cbUSBVCPFunction->currentIndex() == HwSettings::USB_VCPPORT_COMBRIDGE) { - data.OptionalModules[HwSettings::OPTIONALMODULES_COMUSBBRIDGE] = HwSettings::OPTIONALMODULES_ENABLED; - } else { - data.OptionalModules[HwSettings::OPTIONALMODULES_COMUSBBRIDGE] = HwSettings::OPTIONALMODULES_DISABLED; - } - hwSettings->setData(data); } diff --git a/shared/uavobjectdefinition/hwsettings.xml b/shared/uavobjectdefinition/hwsettings.xml index c41187009..7fa821da4 100644 --- a/shared/uavobjectdefinition/hwsettings.xml +++ b/shared/uavobjectdefinition/hwsettings.xml @@ -15,14 +15,14 @@ - + - +