1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 01:05:10 +03:00

Implement s.port polling for multi (#5521)

Sport polling is implemented quite low level for regular s.port.
Go another approach for multi and add another multi type for s.port polling
This commit is contained in:
Arne Schwabe 2017-12-18 23:00:03 +01:00 committed by Bertrand Songis
parent d0ec3e0266
commit 7dd32c8878
2 changed files with 13 additions and 0 deletions

View file

@ -35,6 +35,7 @@ enum MultiPacketTypes : uint8_t {
FlyskyIBusTelemetry, FlyskyIBusTelemetry,
ConfigCommand, ConfigCommand,
InputSync, InputSync,
FrskySportPolling
}; };
enum MultiBufferState : uint8_t { enum MultiBufferState : uint8_t {
@ -147,6 +148,14 @@ static void processMultiTelemetryPaket(const uint8_t *packet)
case ConfigCommand: case ConfigCommand:
// Just an ack to our command, ignore for now // Just an ack to our command, ignore for now
break; break;
case FrskySportPolling:
#if defined(LUA)
if (len >= 1 && outputTelemetryBufferSize > 0 && data[0] == outputTelemetryBufferTrigger) {
TRACE("MP Sending sport data out.");
sportSendBuffer(outputTelemetryBuffer, outputTelemetryBufferSize);
}
#endif
break;
default: default:
TRACE("[MP] Unkown multi packet type 0x%02X, len %d", type, len); TRACE("[MP] Unkown multi packet type 0x%02X, len %d", type, len);
break; break;

View file

@ -386,6 +386,10 @@ void telemetryInit(uint8_t protocol)
else if (protocol == PROTOCOL_MULTIMODULE || protocol == PROTOCOL_FLYSKY_IBUS) { else if (protocol == PROTOCOL_MULTIMODULE || protocol == PROTOCOL_FLYSKY_IBUS) {
// The DIY Multi module always speaks 100000 baud regardless of the telemetry protocol in use // The DIY Multi module always speaks 100000 baud regardless of the telemetry protocol in use
telemetryPortInit(MULTIMODULE_BAUDRATE, TELEMETRY_SERIAL_8E2); telemetryPortInit(MULTIMODULE_BAUDRATE, TELEMETRY_SERIAL_8E2);
#if defined(LUA)
outputTelemetryBufferSize = 0;
outputTelemetryBufferTrigger = 0x7E;
#endif
} }
else if (protocol == PROTOCOL_SPEKTRUM) { else if (protocol == PROTOCOL_SPEKTRUM) {
// Spektrum's own small race RX (SPM4648) uses 125000 8N1, use the same since there is no real standard // Spektrum's own small race RX (SPM4648) uses 125000 8N1, use the same since there is no real standard