protocol preamble removed as not required for LoRa packet processing

This commit is contained in:
Pawel Spychalski
2017-11-09 14:56:59 +01:00
parent 47f9a37270
commit 1057c0995c
4 changed files with 8 additions and 19 deletions

View File

@@ -10,11 +10,10 @@ Development, ready for testing
| Byte | Description | Notes |
| ---- | ---- | ---- |
| 1 | Preamble | "Q" 0x51 |
| 2 | Channel ID | channel used for comunication between TX and RX |
| 3 | Frame type & Length | bits 7-5 defines frame, bits 4-0 payload length |
| 5 - 36 | Payload | 32 bytes max |
| payload length + 4 | CRC | XOR of all previous bytes |
| 1 | Channel ID | channel used for comunication between TX and RX |
| 2 | Frame type & Length | bits 7-5 defines frame, bits 4-0 payload length |
| 3 - 34 | Payload | 32 bytes max |
| payload length + 3 | CRC | XOR of all previous bytes |
## Frame types

View File

@@ -1,5 +1,5 @@
// #define DEVICE_MODE_TX
#define DEVICE_MODE_RX
#define DEVICE_MODE_TX
// #define DEVICE_MODE_RX
#define FEATURE_TX_OLED

12
qsp.cpp
View File

@@ -154,18 +154,12 @@ void qspDecodeIncomingFrame(
static uint8_t payloadLength;
static uint8_t receivedPayload;
if (qsp->protocolState == QSP_STATE_IDLE && incomingByte == QSP_PREAMBLE)
{
//If in IDLE and correct preamble comes, start to decode frame
qsp->protocolState = QSP_STATE_PREAMBLE_RECEIVED;
qsp->crc = 0 ^ incomingByte;
qsp->frameDecodingStartedAt = millis();
}
else if (qsp->protocolState == QSP_STATE_PREAMBLE_RECEIVED)
if (qsp->protocolState == QSP_STATE_IDLE)
{
// Check if incomming channel ID is the same as receiver
if (incomingByte == CHANNEL_ID)
{
qsp->frameDecodingStartedAt = millis();
qsp->protocolState = QSP_STATE_CHANNEL_RECEIVED;
qsp->crc ^= incomingByte;
@@ -269,8 +263,6 @@ void qspEncodeFrame(QspConfiguration_t *qsp) {
//Zero CRC
qsp->crc = 0;
//Write preamble
qsp->hardwareWriteFunction(QSP_PREAMBLE, qsp);
//Write CHANNEL_ID
qsp->hardwareWriteFunction(CHANNEL_ID, qsp);

View File

@@ -16,7 +16,6 @@
#define TX_FAILSAFE_DELAY (RX_FAILSAFE_DELAY * 4)
#define CHANNEL_ID 0x01
#define QSP_PREAMBLE 0x51
#define QSP_PAYLOAD_LENGTH 32
#define QSP_MAX_FRAME_DECODE_TIME 10 //max time that frame can be decoded in ms
@@ -36,7 +35,6 @@
enum dataStates {
QSP_STATE_IDLE,
QSP_STATE_PREAMBLE_RECEIVED,
QSP_STATE_CHANNEL_RECEIVED,
QSP_STATE_FRAME_TYPE_RECEIVED,
QSP_STATE_PAYLOAD_RECEIVED,