diff --git a/flight/targets/boards/sparky2/firmware/pios_board.c b/flight/targets/boards/sparky2/firmware/pios_board.c index 5435c5e6e..0fe91d9c9 100644 --- a/flight/targets/boards/sparky2/firmware/pios_board.c +++ b/flight/targets/boards/sparky2/firmware/pios_board.c @@ -661,18 +661,17 @@ void PIOS_Board_Init(void) /* Configure main USART port */ uint8_t hwsettings_mainport; - HwSettingsRM_MainPortGet(&hwsettings_mainport); + HwSettingsSPK2_MainPortGet(&hwsettings_mainport); switch (hwsettings_mainport) { - case HWSETTINGS_RM_MAINPORT_DISABLED: - case HWSETTINGS_RM_MAINPORT_SBUS: + case HWSETTINGS_SPK2_MAINPORT_DISABLED: break; - case HWSETTINGS_RM_MAINPORT_TELEMETRY: + case HWSETTINGS_SPK2_MAINPORT_TELEMETRY: PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_TELEM_RF_RX_BUF_LEN, PIOS_COM_TELEM_RF_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_telem_rf_id); break; - case HWSETTINGS_RM_MAINPORT_GPS: + case HWSETTINGS_SPK2_MAINPORT_GPS: PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_GPS_RX_BUF_LEN, PIOS_COM_GPS_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_gps_id); break; - case HWSETTINGS_RM_MAINPORT_DSM: + case HWSETTINGS_SPK2_MAINPORT_DSM: // Force binding to zero on the main port hwsettings_DSMxBind = 0; @@ -680,17 +679,17 @@ void PIOS_Board_Init(void) PIOS_Board_configure_dsm(&pios_usart_dsm_main_cfg, &pios_dsm_main_cfg, &pios_usart_com_driver, MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT, &hwsettings_DSMxBind); break; - case HWSETTINGS_RM_MAINPORT_DEBUGCONSOLE: + case HWSETTINGS_SPK2_MAINPORT_DEBUGCONSOLE: #if defined(PIOS_INCLUDE_DEBUG_CONSOLE) { PIOS_Board_configure_com(&pios_usart_main_cfg, 0, PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_debug_id); } #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */ break; - case HWSETTINGS_RM_MAINPORT_COMBRIDGE: + case HWSETTINGS_SPK2_MAINPORT_COMBRIDGE: PIOS_Board_configure_com(&pios_usart_main_cfg, PIOS_COM_BRIDGE_RX_BUF_LEN, PIOS_COM_BRIDGE_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_bridge_id); break; - case HWSETTINGS_RM_MAINPORT_OSDHK: + case HWSETTINGS_SPK2_MAINPORT_OSDHK: PIOS_Board_configure_com(&pios_usart_hkosd_main_cfg, PIOS_COM_HKOSD_RX_BUF_LEN, PIOS_COM_HKOSD_TX_BUF_LEN, &pios_usart_com_driver, &pios_com_hkosd_id); break; } /* hwsettings_rm_mainport */ @@ -831,15 +830,15 @@ void PIOS_Board_Init(void) // Sparky2 receiver input on PC7 TIM8 CH2 // that appears to include PPM, DSM, DSM-HSUM, SBUS uint8_t hwsettings_rcvrport; - HwSettingsRM_RcvrPortGet(&hwsettings_rcvrport); + HwSettingsSPK2_RcvrPortGet(&hwsettings_rcvrport); // switch (hwsettings_rcvrport) { - case HWSETTINGS_RM_RCVRPORT_PPM: + case HWSETTINGS_SPK2_RCVRPORT_PPM: #if defined(PIOS_INCLUDE_PPM) PIOS_Board_configure_ppm(&pios_ppm_cfg); #endif /* PIOS_INCLUDE_PPM */ break; - case HWSETTINGS_RM_RCVRPORT_SBUS: + case HWSETTINGS_SPK2_RCVRPORT_SBUS: #if defined(PIOS_INCLUDE_SBUS) { uint32_t pios_usart_sbus_id; @@ -864,7 +863,7 @@ void PIOS_Board_Init(void) break; } - if (hwsettings_rcvrport != HWSETTINGS_RM_RCVRPORT_SBUS) { + if (hwsettings_rcvrport != HWSETTINGS_SPK2_RCVRPORT_SBUS) { GPIO_Init(pios_sbus_cfg.inv.gpio, &pios_sbus_cfg.inv.init); GPIO_WriteBit(pios_sbus_cfg.inv.gpio, pios_sbus_cfg.inv.init.GPIO_Pin, pios_sbus_cfg.gpio_inv_disable); } diff --git a/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index ace6b0685..763d5788b 100644 --- a/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -209,7 +209,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() break; case VehicleConfigurationSource::INPUT_SBUS: if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_SPARKY2) { - data.RM_RcvrPort = HwSettings::RM_RCVRPORT_SBUS; + data.SPK2_RcvrPort = HwSettings::SPK2_RCVRPORT_SBUS; } else { data.RM_MainPort = HwSettings::RM_MAINPORT_SBUS; // We have to set telemetry on flexport since s.bus needs the mainport on all but Revo. @@ -238,7 +238,10 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; data.GPSSpeed = HwSettings::GPSSPEED_57600; - if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS) { + // if using GPS and SBUS on Revo, we must use FlexiPort for GPS + // since we must use MainPort for SBUS + if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS + && m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_GPS; } else { data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; diff --git a/shared/uavobjectdefinition/hwsettings.xml b/shared/uavobjectdefinition/hwsettings.xml index c1c6ea04c..6eb7ff874 100644 --- a/shared/uavobjectdefinition/hwsettings.xml +++ b/shared/uavobjectdefinition/hwsettings.xml @@ -16,6 +16,13 @@ limits="%0905NE:PPM+PWM:PPM+Telemetry:Telemetry:ComBridge;"/> + + + + +