mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
PXX2 always defined. PROTOCOL enums renamed. IRPROTOS removed
This commit is contained in:
parent
b30c9b63cd
commit
b72ccb4836
34 changed files with 174 additions and 343 deletions
|
@ -42,21 +42,21 @@ uint8_t serialInversion = 0;
|
|||
void processTelemetryData(uint8_t data)
|
||||
{
|
||||
#if defined(CROSSFIRE)
|
||||
if (telemetryProtocol == PROTOCOL_PULSES_CROSSFIRE) {
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_CROSSFIRE) {
|
||||
processCrossfireTelemetryData(data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_SPEKTRUM) {
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_SPEKTRUM) {
|
||||
processSpektrumTelemetryData(data);
|
||||
return;
|
||||
}
|
||||
if (telemetryProtocol == PROTOCOL_FLYSKY_IBUS) {
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_FLYSKY_IBUS) {
|
||||
processFlySkyTelemetryData(data);
|
||||
return;
|
||||
}
|
||||
if (telemetryProtocol == PROTOCOL_MULTIMODULE) {
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE) {
|
||||
processMultiTelemetryData(data);
|
||||
return;
|
||||
}
|
||||
|
@ -67,15 +67,18 @@ void processTelemetryData(uint8_t data)
|
|||
void telemetryWakeup()
|
||||
{
|
||||
uint8_t requiredTelemetryProtocol = modelTelemetryProtocol();
|
||||
|
||||
#if defined(REVX)
|
||||
uint8_t requiredSerialInversion = g_model.moduleData[EXTERNAL_MODULE].invertedSerial;
|
||||
if (telemetryProtocol != requiredTelemetryProtocol || serialInversion != requiredSerialInversion) {
|
||||
serialInversion = requiredSerialInversion;
|
||||
#else
|
||||
if (telemetryProtocol != requiredTelemetryProtocol) {
|
||||
#endif
|
||||
telemetryInit(requiredTelemetryProtocol);
|
||||
}
|
||||
#else
|
||||
if (telemetryProtocol != requiredTelemetryProtocol) {
|
||||
telemetryInit(requiredTelemetryProtocol);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
uint8_t data;
|
||||
|
@ -87,7 +90,7 @@ void telemetryWakeup()
|
|||
} while (telemetryGetByte(&data));
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
if (telemetryProtocol == PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY) {
|
||||
uint8_t data;
|
||||
while (telemetrySecondPortReceive(data)) {
|
||||
processTelemetryData(data);
|
||||
|
@ -99,7 +102,6 @@ void telemetryWakeup()
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED) {
|
||||
|
@ -223,12 +225,12 @@ void telemetryInit(uint8_t protocol)
|
|||
{
|
||||
telemetryProtocol = protocol;
|
||||
|
||||
if (protocol == PROTOCOL_FRSKY_D) {
|
||||
if (protocol == PROTOCOL_TELEMETRY_FRSKY_D) {
|
||||
telemetryPortInit(FRSKY_D_BAUDRATE, TELEMETRY_SERIAL_DEFAULT);
|
||||
}
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
else if (protocol == PROTOCOL_MULTIMODULE || protocol == PROTOCOL_FLYSKY_IBUS) {
|
||||
else if (protocol == PROTOCOL_TELEMETRY_MULTIMODULE || protocol == PROTOCOL_TELEMETRY_FLYSKY_IBUS) {
|
||||
// The DIY Multi module always speaks 100000 baud regardless of the telemetry protocol in use
|
||||
telemetryPortInit(MULTIMODULE_BAUDRATE, TELEMETRY_SERIAL_8E2);
|
||||
#if defined(LUA)
|
||||
|
@ -236,14 +238,14 @@ void telemetryInit(uint8_t protocol)
|
|||
outputTelemetryBufferTrigger = 0x7E;
|
||||
#endif
|
||||
}
|
||||
else if (protocol == PROTOCOL_SPEKTRUM) {
|
||||
else if (protocol == PROTOCOL_TELEMETRY_SPEKTRUM) {
|
||||
// Spektrum's own small race RX (SPM4648) uses 125000 8N1, use the same since there is no real standard
|
||||
telemetryPortInit(125000, TELEMETRY_SERIAL_DEFAULT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
else if (protocol == PROTOCOL_PULSES_CROSSFIRE) {
|
||||
else if (protocol == PROTOCOL_TELEMETRY_CROSSFIRE) {
|
||||
telemetryPortInit(CROSSFIRE_BAUDRATE, TELEMETRY_SERIAL_DEFAULT);
|
||||
#if defined(LUA)
|
||||
outputTelemetryBufferSize = 0;
|
||||
|
@ -254,12 +256,19 @@ void telemetryInit(uint8_t protocol)
|
|||
#endif
|
||||
|
||||
#if defined(SERIAL2) || defined(PCBSKY9X)
|
||||
else if (protocol == PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
else if (protocol == PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY) {
|
||||
telemetryPortInit(0, TELEMETRY_SERIAL_DEFAULT);
|
||||
serial2TelemetryInit(PROTOCOL_FRSKY_D_SECONDARY);
|
||||
serial2TelemetryInit(PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY);
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (protocol == PROTOCOL_TELEMETRY_PXX2) {
|
||||
telemetryPortInit(PXX2_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA);
|
||||
#if defined(LUA)
|
||||
outputTelemetryBufferSize = 0;
|
||||
outputTelemetryBufferTrigger = 0x7E;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
telemetryPortInit(FRSKY_SPORT_BAUDRATE, TELEMETRY_SERIAL_WITHOUT_DMA);
|
||||
#if defined(LUA)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue