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",
|
||||
"sketch": "crossbow.ino",
|
||||
"port": "COM15",
|
||||
"port": "COM19",
|
||||
"output": "./build"
|
||||
}
|
||||
12
crossbow.ino
12
crossbow.ino
@@ -272,14 +272,14 @@ void loop(void)
|
||||
|
||||
#ifdef DEVICE_MODE_TX
|
||||
if (txDeviceState.readPacket) {
|
||||
int incomingByte = LoRa.read();
|
||||
if (incomingByte > -1) {
|
||||
int incomingByte;
|
||||
while (incomingByte = LoRa.read(), incomingByte > -1)
|
||||
{
|
||||
qspDecodeIncomingFrame(&qsp, incomingByte, ppm, &rxDeviceState, &txDeviceState);
|
||||
} else {
|
||||
txDeviceState.rssi = getRadioRssi();
|
||||
txDeviceState.snr = getRadioSnr();
|
||||
txDeviceState.readPacket = false;
|
||||
}
|
||||
txDeviceState.rssi = getRadioRssi();
|
||||
txDeviceState.snr = getRadioSnr();
|
||||
txDeviceState.readPacket = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
2
qsp.cpp
2
qsp.cpp
@@ -161,7 +161,7 @@ void qspDecodeIncomingFrame(
|
||||
{
|
||||
qsp->frameDecodingStartedAt = millis();
|
||||
qsp->protocolState = QSP_STATE_CHANNEL_RECEIVED;
|
||||
qsp->crc ^= incomingByte;
|
||||
qsp->crc = 0 ^ incomingByte;
|
||||
|
||||
qspClearPayload(qsp);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define CHANNEL_ID 0x01
|
||||
#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_RX_HEALTH 0x1
|
||||
|
||||
Reference in New Issue
Block a user