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

LP-72 handle rcvrport and sbus differences with revo - sparky version of GCS hw tab

This commit is contained in:
Cliff Geerdes 2015-10-15 02:08:55 -04:00 committed by Laurent Lalanne
parent 0c0b04233b
commit f230678479
3 changed files with 24 additions and 15 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -16,6 +16,13 @@
limits="%0905NE:PPM+PWM:PPM+Telemetry:Telemetry:ComBridge;"/>
<field name="RM_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM,DebugConsole,ComBridge,OsdHk,MSP" defaultvalue="Disabled"/>
<field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM,EX.Bus,HoTT SUMD,HoTT SUMH,SRXL,DebugConsole,ComBridge,OsdHk,MSP" defaultvalue="Disabled"/>
<field name="SPK2_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PPM,S.Bus,DSM,SRXL"
defaultvalue="S.Bus"/>
<field name="SPK2_I2CPort" units="function" type="enum" elements="1" options="Disabled,I2C"
defaultvalue="Disabled"/>
<field name="SPK2_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,DSM,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/>
<field name="TelemetrySpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>
<field name="GPSSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200,230400" defaultvalue="57600"/>
<field name="ComUsbBridgeSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>