Fixed bug thata was failing to process frames without preamble
This commit is contained in:
2
.vscode/arduino.json
vendored
2
.vscode/arduino.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"board": "bsfrance:avr:lora32u4",
|
"board": "bsfrance:avr:lora32u4",
|
||||||
"sketch": "crossbow.ino",
|
"sketch": "crossbow.ino",
|
||||||
"port": "COM15",
|
"port": "COM19",
|
||||||
"output": "./build"
|
"output": "./build"
|
||||||
}
|
}
|
||||||
@@ -272,15 +272,15 @@ void loop(void)
|
|||||||
|
|
||||||
#ifdef DEVICE_MODE_TX
|
#ifdef DEVICE_MODE_TX
|
||||||
if (txDeviceState.readPacket) {
|
if (txDeviceState.readPacket) {
|
||||||
int incomingByte = LoRa.read();
|
int incomingByte;
|
||||||
if (incomingByte > -1) {
|
while (incomingByte = LoRa.read(), incomingByte > -1)
|
||||||
|
{
|
||||||
qspDecodeIncomingFrame(&qsp, incomingByte, ppm, &rxDeviceState, &txDeviceState);
|
qspDecodeIncomingFrame(&qsp, incomingByte, ppm, &rxDeviceState, &txDeviceState);
|
||||||
} else {
|
}
|
||||||
txDeviceState.rssi = getRadioRssi();
|
txDeviceState.rssi = getRadioRssi();
|
||||||
txDeviceState.snr = getRadioSnr();
|
txDeviceState.snr = getRadioSnr();
|
||||||
txDeviceState.readPacket = false;
|
txDeviceState.readPacket = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t currentMillis = millis();
|
uint32_t currentMillis = millis();
|
||||||
|
|||||||
2
qsp.cpp
2
qsp.cpp
@@ -161,7 +161,7 @@ void qspDecodeIncomingFrame(
|
|||||||
{
|
{
|
||||||
qsp->frameDecodingStartedAt = millis();
|
qsp->frameDecodingStartedAt = millis();
|
||||||
qsp->protocolState = QSP_STATE_CHANNEL_RECEIVED;
|
qsp->protocolState = QSP_STATE_CHANNEL_RECEIVED;
|
||||||
qsp->crc ^= incomingByte;
|
qsp->crc = 0 ^ incomingByte;
|
||||||
|
|
||||||
qspClearPayload(qsp);
|
qspClearPayload(qsp);
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#define CHANNEL_ID 0x01
|
#define CHANNEL_ID 0x01
|
||||||
#define QSP_PAYLOAD_LENGTH 32
|
#define QSP_PAYLOAD_LENGTH 32
|
||||||
|
|
||||||
#define QSP_MAX_FRAME_DECODE_TIME 10 //max time that frame can be decoded in ms
|
#define QSP_MAX_FRAME_DECODE_TIME 5 //max time that frame can be decoded in ms
|
||||||
|
|
||||||
#define QSP_FRAME_RC_DATA 0x0
|
#define QSP_FRAME_RC_DATA 0x0
|
||||||
#define QSP_FRAME_RX_HEALTH 0x1
|
#define QSP_FRAME_RX_HEALTH 0x1
|
||||||
|
|||||||
Reference in New Issue
Block a user