1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

DSM protocol improvement

added item in DSM protocol in GCS
This commit is contained in:
Gasté Olivier 2014-08-08 13:14:39 +02:00
parent 50956a8620
commit dfb21482f4
10 changed files with 76 additions and 63 deletions

View File

@ -111,7 +111,8 @@
/* DSM protocol variations */ /* DSM protocol variations */
enum pios_dsm_proto { enum pios_dsm_proto {
PIOS_DSM_PROTO_DSM2, PIOS_DSM_PROTO_DSM210BIT,
PIOS_DSM_PROTO_DSM211BIT,
PIOS_DSM_PROTO_DSMX10BIT, PIOS_DSM_PROTO_DSMX10BIT,
PIOS_DSM_PROTO_DSMX11BIT, PIOS_DSM_PROTO_DSMX11BIT,
}; };

View File

@ -181,7 +181,7 @@ static void PIOS_DSM_ResetState(struct pios_dsm_dev *dsm_dev)
static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev) static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev)
{ {
struct pios_dsm_state *state = &(dsm_dev->state); struct pios_dsm_state *state = &(dsm_dev->state);
uint8_t resolution; uint8_t resolution=10;
#ifdef DSM_LOST_FRAME_COUNTER #ifdef DSM_LOST_FRAME_COUNTER
/* increment the lost frame counter */ /* increment the lost frame counter */
@ -191,35 +191,16 @@ static int PIOS_DSM_UnrollChannels(struct pios_dsm_dev *dsm_dev)
#endif #endif
/* check the frame type assuming master satellite stream */ /* check the frame type assuming master satellite stream */
uint8_t type = state->received_data[1];
switch (type) { switch(dsm_dev->proto) {
case 0x01: case PIOS_DSM_PROTO_DSM210BIT:
case 0x02: case PIOS_DSM_PROTO_DSMX10BIT:
case 0x12: resolution = 10;
/* DSM2, DSMJ stream */ break;
if (dsm_dev->proto == PIOS_DSM_PROTO_DSM2) { case PIOS_DSM_PROTO_DSM211BIT:
/* DSM2/DSMJ resolution is known from the header */ case PIOS_DSM_PROTO_DSMX11BIT:
resolution = (type & DSM_DSM2_RES_MASK) ? 11 : 10; resolution = 11;
} else { break;
/* DSMX resolution should explicitly be selected */
goto stream_error;
}
break;
case 0xA2:
case 0xB2:
/* DSMX stream */
if (dsm_dev->proto == PIOS_DSM_PROTO_DSMX10BIT) {
resolution = 10;
} else if (dsm_dev->proto == PIOS_DSM_PROTO_DSMX11BIT) {
resolution = 11;
} else {
/* DSMX resolution should explicitly be selected */
goto stream_error;
}
break;
default:
/* unknown yet data stream */
goto stream_error;
} }
/* unroll channels */ /* unroll channels */

View File

@ -477,15 +477,19 @@ void PIOS_Board_Init(void)
} }
#endif /* PIOS_INCLUDE_GPS */ #endif /* PIOS_INCLUDE_GPS */
break; break;
case HWSETTINGS_CC_MAINPORT_DSM2: case HWSETTINGS_CC_MAINPORT_DSM210BIT:
case HWSETTINGS_CC_MAINPORT_DSM211BIT:
case HWSETTINGS_CC_MAINPORT_DSMX10BIT: case HWSETTINGS_CC_MAINPORT_DSMX10BIT:
case HWSETTINGS_CC_MAINPORT_DSMX11BIT: case HWSETTINGS_CC_MAINPORT_DSMX11BIT:
#if defined(PIOS_INCLUDE_DSM) #if defined(PIOS_INCLUDE_DSM)
{ {
enum pios_dsm_proto proto; enum pios_dsm_proto proto;
switch (hwsettings_cc_mainport) { switch (hwsettings_cc_mainport) {
case HWSETTINGS_CC_MAINPORT_DSM2: case HWSETTINGS_CC_MAINPORT_DSM210BIT:
proto = PIOS_DSM_PROTO_DSM2; proto = PIOS_DSM_PROTO_DSM210BIT;
break;
case HWSETTINGS_CC_MAINPORT_DSM211BIT:
proto = PIOS_DSM_PROTO_DSM211BIT;
break; break;
case HWSETTINGS_CC_MAINPORT_DSMX10BIT: case HWSETTINGS_CC_MAINPORT_DSMX10BIT:
proto = PIOS_DSM_PROTO_DSMX10BIT; proto = PIOS_DSM_PROTO_DSMX10BIT;

View File

@ -624,14 +624,18 @@ void PIOS_Board_Init(void)
} }
#endif #endif
break; break;
case HWSETTINGS_RM_MAINPORT_DSM2: case HWSETTINGS_RM_MAINPORT_DSM210BIT:
case HWSETTINGS_RM_MAINPORT_DSM211BIT:
case HWSETTINGS_RM_MAINPORT_DSMX10BIT: case HWSETTINGS_RM_MAINPORT_DSMX10BIT:
case HWSETTINGS_RM_MAINPORT_DSMX11BIT: case HWSETTINGS_RM_MAINPORT_DSMX11BIT:
{ {
enum pios_dsm_proto proto; enum pios_dsm_proto proto;
switch (hwsettings_mainport) { switch (hwsettings_mainport) {
case HWSETTINGS_RM_MAINPORT_DSM2: case HWSETTINGS_RM_MAINPORT_DSM210BIT:
proto = PIOS_DSM_PROTO_DSM2; proto = PIOS_DSM_PROTO_DSM210BIT;
break;
case HWSETTINGS_RM_MAINPORT_DSM211BIT:
proto = PIOS_DSM_PROTO_DSM211BIT;
break; break;
case HWSETTINGS_RM_MAINPORT_DSMX10BIT: case HWSETTINGS_RM_MAINPORT_DSMX10BIT:
proto = PIOS_DSM_PROTO_DSMX10BIT; proto = PIOS_DSM_PROTO_DSMX10BIT;
@ -693,14 +697,18 @@ void PIOS_Board_Init(void)
case HWSETTINGS_RM_FLEXIPORT_GPS: case HWSETTINGS_RM_FLEXIPORT_GPS:
PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_GPS_RX_BUF_LEN, -1, &pios_usart_com_driver, &pios_com_gps_id); PIOS_Board_configure_com(&pios_usart_flexi_cfg, PIOS_COM_GPS_RX_BUF_LEN, -1, &pios_usart_com_driver, &pios_com_gps_id);
break; break;
case HWSETTINGS_RM_FLEXIPORT_DSM2: case HWSETTINGS_RM_FLEXIPORT_DSM210BIT:
case HWSETTINGS_RM_FLEXIPORT_DSM211BIT:
case HWSETTINGS_RM_FLEXIPORT_DSMX10BIT: case HWSETTINGS_RM_FLEXIPORT_DSMX10BIT:
case HWSETTINGS_RM_FLEXIPORT_DSMX11BIT: case HWSETTINGS_RM_FLEXIPORT_DSMX11BIT:
{ {
enum pios_dsm_proto proto; enum pios_dsm_proto proto;
switch (hwsettings_flexiport) { switch (hwsettings_flexiport) {
case HWSETTINGS_RM_FLEXIPORT_DSM2: case HWSETTINGS_RM_FLEXIPORT_DSM210BIT:
proto = PIOS_DSM_PROTO_DSM2; proto = PIOS_DSM_PROTO_DSM210BIT;
break;
case HWSETTINGS_RM_FLEXIPORT_DSM211BIT:
proto = PIOS_DSM_PROTO_DSM211BIT;
break; break;
case HWSETTINGS_RM_FLEXIPORT_DSMX10BIT: case HWSETTINGS_RM_FLEXIPORT_DSMX10BIT:
proto = PIOS_DSM_PROTO_DSMX10BIT; proto = PIOS_DSM_PROTO_DSMX10BIT;

View File

@ -139,7 +139,8 @@ void ConnectionDiagram::setupGraphicsScene()
break; break;
case VehicleConfigurationSource::INPUT_DSMX10: case VehicleConfigurationSource::INPUT_DSMX10:
case VehicleConfigurationSource::INPUT_DSMX11: case VehicleConfigurationSource::INPUT_DSMX11:
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
case VehicleConfigurationSource::INPUT_DSM2_11:
elementsToShow << "satellite"; elementsToShow << "satellite";
break; break;
default: default:

View File

@ -54,7 +54,7 @@ bool InputPage::validatePage()
} else if (ui->sbusButton->isChecked()) { } else if (ui->sbusButton->isChecked()) {
getWizard()->setInputType(SetupWizard::INPUT_SBUS); getWizard()->setInputType(SetupWizard::INPUT_SBUS);
} else if (ui->spectrumButton->isChecked()) { } else if (ui->spectrumButton->isChecked()) {
getWizard()->setInputType(SetupWizard::INPUT_DSM2); getWizard()->setInputType(SetupWizard::INPUT_DSM2_11);
} else { } else {
getWizard()->setInputType(SetupWizard::INPUT_PWM); getWizard()->setInputType(SetupWizard::INPUT_PWM);
} }
@ -85,9 +85,13 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp
case VehicleConfigurationSource::INPUT_SBUS: case VehicleConfigurationSource::INPUT_SBUS:
return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS; return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS;
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
// TODO: Handle all of the DSM types ?? Which is most common? // TODO: Handle all of the DSM types ?? Which is most common?
return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM2; return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM210BIT;
case VehicleConfigurationSource::INPUT_DSM2_11:
// TODO: Handle all of the DSM types ?? Which is most common?
return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM211BIT;
default: return true; default: return true;
} }
@ -105,9 +109,13 @@ bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedTyp
case VehicleConfigurationSource::INPUT_SBUS: case VehicleConfigurationSource::INPUT_SBUS:
return data.RM_MainPort != HwSettings::CC_MAINPORT_SBUS; return data.RM_MainPort != HwSettings::CC_MAINPORT_SBUS;
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
// TODO: Handle all of the DSM types ?? Which is most common? // TODO: Handle all of the DSM types ?? Which is most common?
return data.RM_MainPort != HwSettings::CC_MAINPORT_DSM2; return data.RM_MainPort != HwSettings::CC_MAINPORT_DSM210BIT;
case VehicleConfigurationSource::INPUT_DSM2_11:
// TODO: Handle all of the DSM types ?? Which is most common?
return data.RM_MainPort != HwSettings::CC_MAINPORT_DSM211BIT;
default: return true; default: return true;
} }

View File

@ -252,14 +252,17 @@ QString SetupWizard::getSummaryText()
case INPUT_SBUS: case INPUT_SBUS:
summary.append(tr("Futaba S.Bus")); summary.append(tr("Futaba S.Bus"));
break; break;
case INPUT_DSM2: case INPUT_DSM2_10:
summary.append(tr("Spektrum satellite (DSM2)")); summary.append(tr("Spektrum satellite (DSM2 10bits)"));
break;
case INPUT_DSM2_11:
summary.append(tr("Spektrum satellite (DSM2 11bits)"));
break; break;
case INPUT_DSMX10: case INPUT_DSMX10:
summary.append(tr("Spektrum satellite (DSMX10BIT)")); summary.append(tr("Spektrum satellite (DSMX 10bits)"));
break; break;
case INPUT_DSMX11: case INPUT_DSMX11:
summary.append(tr("Spektrum satellite (DSMX11BIT)")); summary.append(tr("Spektrum satellite (DSMX 11bits)"));
break; break;
default: default:
summary.append(tr("Unknown")); summary.append(tr("Unknown"));

View File

@ -139,8 +139,11 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
case VehicleConfigurationSource::INPUT_DSMX11: case VehicleConfigurationSource::INPUT_DSMX11:
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSMX11BIT; data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSMX11BIT;
break; break;
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSM2; data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSM210BIT;
break;
case VehicleConfigurationSource::INPUT_DSM2_11:
data.CC_FlexiPort = HwSettings::CC_FLEXIPORT_DSM211BIT;
break; break;
default: default:
break; break;
@ -172,8 +175,11 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
case VehicleConfigurationSource::INPUT_DSMX11: case VehicleConfigurationSource::INPUT_DSMX11:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX11BIT; data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSMX11BIT;
break; break;
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM2; data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM210BIT;
break;
case VehicleConfigurationSource::INPUT_DSM2_11:
data.RM_FlexiPort = HwSettings::RM_FLEXIPORT_DSM211BIT;
break; break;
default: default:
break; break;
@ -486,7 +492,8 @@ void VehicleConfigurationHelper::applyManualControlDefaults()
break; break;
case VehicleConfigurationSource::INPUT_DSMX10: case VehicleConfigurationSource::INPUT_DSMX10:
case VehicleConfigurationSource::INPUT_DSMX11: case VehicleConfigurationSource::INPUT_DSMX11:
case VehicleConfigurationSource::INPUT_DSM2: case VehicleConfigurationSource::INPUT_DSM2_10:
case VehicleConfigurationSource::INPUT_DSM2_11:
channelType = ManualControlSettings::CHANNELGROUPS_DSMMAINPORT; channelType = ManualControlSettings::CHANNELGROUPS_DSMMAINPORT;
break; break;
default: default:

View File

@ -62,7 +62,7 @@ public:
MULTI_ROTOR_OCTO_X, MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS, MULTI_ROTOR_OCTO_X, MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS,
FIXED_WING_AILERON, FIXED_WING_VTAIL, HELI_CCPM }; FIXED_WING_AILERON, FIXED_WING_VTAIL, HELI_CCPM };
enum ESC_TYPE { ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN }; enum ESC_TYPE { ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN };
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN }; enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2_10, INPUT_DSM2_11, INPUT_UNKNOWN };
enum GPS_SETTING { GPS_UBX, GPS_NMEA, GPS_DISABLED }; enum GPS_SETTING { GPS_UBX, GPS_NMEA, GPS_DISABLED };
enum RADIO_SETTING { RADIO_TELEMETRY, RADIO_DISABLED }; enum RADIO_SETTING { RADIO_TELEMETRY, RADIO_DISABLED };

View File

@ -2,19 +2,19 @@
<object name="HwSettings" singleinstance="true" settings="true" category="System"> <object name="HwSettings" singleinstance="true" settings="true" category="System">
<description>Selection of optional hardware configurations.</description> <description>Selection of optional hardware configurations.</description>
<field name="CC_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Outputs,Outputs" defaultvalue="PWM"/> <field name="CC_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
<field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2,DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Telemetry"/> <field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Telemetry"/>
<field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,PPM,DSM2,DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,PPM,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/>
<field name="RV_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+Outputs,Outputs" defaultvalue="PWM"/> <field name="RV_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
<field name="RV_AuxPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="RV_AuxPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/>
<field name="RV_AuxSBusPort" units="function" type="enum" elements="1" options="Disabled,S.Bus,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="RV_AuxSBusPort" units="function" type="enum" elements="1" options="Disabled,S.Bus,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/>
<field name="RV_FlexiPort" units="function" type="enum" elements="1" options="Disabled,I2C,DSM2,DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Disabled"/> <field name="RV_FlexiPort" units="function" type="enum" elements="1" options="Disabled,I2C,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),ComAux,ComBridge" defaultvalue="Disabled"/>
<field name="RV_TelemetryPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,ComAux,ComBridge" defaultvalue="Telemetry"/> <field name="RV_TelemetryPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,ComAux,ComBridge" defaultvalue="Telemetry"/>
<field name="RV_GPSPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,ComAux,ComBridge" defaultvalue="GPS"/> <field name="RV_GPSPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,ComAux,ComBridge" defaultvalue="GPS"/>
<field name="RM_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Outputs,Outputs" defaultvalue="PWM"/> <field name="RM_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+PWM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
<field name="RM_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2,DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Telemetry"/> <field name="RM_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Telemetry"/>
<field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM2,DSMX (10bit),DSMX (11bit),DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/> <field name="RM_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,DSM2 (10bit),DSM2 (11bit),DSMX (10bit),DSMX (11bit),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="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" defaultvalue="57600"/> <field name="GPSSpeed" units="bps" type="enum" elements="1" options="2400,4800,9600,19200,38400,57600,115200" defaultvalue="57600"/>