1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 11:29:51 +03:00

Compilation fix

This commit is contained in:
Bertrand Songis 2019-11-15 16:33:11 +01:00
parent 3a7e006635
commit 42a59dca35
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
5 changed files with 10 additions and 10 deletions

View file

@ -180,7 +180,7 @@ void Bluetooth::processTrainerByte(uint8_t data)
break; break;
case STATE_DATA_IN_FRAME: case STATE_DATA_IN_FRAME:
if (data == BYTESTUFF) { if (data == BYTE_STUFF) {
dataState = STATE_DATA_XOR; // XOR next byte dataState = STATE_DATA_XOR; // XOR next byte
} }
else if (data == START_STOP) { else if (data == START_STOP) {
@ -225,8 +225,8 @@ void Bluetooth::processTrainerByte(uint8_t data)
void Bluetooth::pushByte(uint8_t byte) void Bluetooth::pushByte(uint8_t byte)
{ {
crc ^= byte; crc ^= byte;
if (byte == START_STOP || byte == BYTESTUFF) { if (byte == START_STOP || byte == BYTE_STUFF) {
buffer[bufferIndex++] = 0x7d; buffer[bufferIndex++] = BYTE_STUFF;
byte ^= STUFF_MASK; byte ^= STUFF_MASK;
} }
buffer[bufferIndex++] = byte; buffer[bufferIndex++] = byte;

View file

@ -353,7 +353,7 @@ void sendSport(uint8_t moduleIdx)
// unstuff and remove crc // unstuff and remove crc
for (uint8_t i = 0; i < outputTelemetryBuffer.size - 1 && j < 8; i++, j++) { for (uint8_t i = 0; i < outputTelemetryBuffer.size - 1 && j < 8; i++, j++) {
if (outputTelemetryBuffer.data[i] == BYTESTUFF) { if (outputTelemetryBuffer.data[i] == BYTE_STUFF) {
i++; i++;
sendMulti(moduleIdx, outputTelemetryBuffer.data[i] ^ STUFF_MASK); sendMulti(moduleIdx, outputTelemetryBuffer.data[i] ^ STUFF_MASK);
} }

View file

@ -64,7 +64,7 @@ bool pushFrskyTelemetryData(uint8_t data)
break; break;
case STATE_DATA_IN_FRAME: case STATE_DATA_IN_FRAME:
if (data == BYTESTUFF) { if (data == BYTE_STUFF) {
dataState = STATE_DATA_XOR; // XOR next byte dataState = STATE_DATA_XOR; // XOR next byte
} }
else if (data == START_STOP) { else if (data == START_STOP) {

View file

@ -234,9 +234,9 @@ inline uint8_t TELEMETRY_RSSI()
return telemetryData.rssi.value(); return telemetryData.rssi.value();
} }
#define START_STOP 0x7E constexpr uint8_t START_STOP = 0x7E;
#define BYTESTUFF 0x7D constexpr uint8_t BYTE_STUFF = 0x7D;
#define STUFF_MASK 0x20 constexpr uint8_t STUFF_MASK = 0x20;
typedef enum { typedef enum {
TS_IDLE = 0, // waiting for 0x5e frame marker TS_IDLE = 0, // waiting for 0x5e frame marker

View file

@ -10,7 +10,7 @@ import struct
START_STOP = '\x7e' START_STOP = '\x7e'
BYTESTUFF = '\x7d' BYTE_STUFF = '\x7d'
STUFF_MASK = '\x20' STUFF_MASK = '\x20'
DATA_FRAME = 0x10 DATA_FRAME = 0x10
@ -110,7 +110,7 @@ def ParsePacket(packet):
global lineNumber global lineNumber
# unstuff packet # unstuff packet
while True: while True:
pos = packet.find(BYTESTUFF) pos = packet.find(BYTE_STUFF)
if pos == -1: if pos == -1:
break break
# print "found stuff at %d in %s" % (pos, dump(packet, 20)) # print "found stuff at %d in %s" % (pos, dump(packet, 20))