Fixed current channel indication and next channel computation

This commit is contained in:
Pawel Spychalski (DzikuVx)
2018-04-19 12:49:40 +02:00
parent b6814509a2
commit 12e2bca441
6 changed files with 9 additions and 16 deletions

View File

@@ -189,7 +189,6 @@ void qspDecodeIncomingFrame(
qsp->frameId = (incomingByte >> 4) & 0x0f;
payloadLength = qspFrameLengths[qsp->frameId];
receivedChannel = incomingByte & 0x0f;
qsp->protocolState = QSP_STATE_FRAME_TYPE_RECEIVED;
}
else if (qsp->protocolState == QSP_STATE_FRAME_TYPE_RECEIVED)
@@ -228,7 +227,7 @@ void qspDecodeIncomingFrame(
/**
* Encode frame is corrent format and write to hardware
*/
void qspEncodeFrame(QspConfiguration_t *qsp, uint8_t buffer[], uint8_t *size) {
void qspEncodeFrame(QspConfiguration_t *qsp, volatile RadioState_t *radioState, uint8_t buffer[], uint8_t *size) {
//Zero CRC
qsp->crc = 0;
@@ -238,7 +237,7 @@ void qspEncodeFrame(QspConfiguration_t *qsp, uint8_t buffer[], uint8_t *size) {
//Write frame type and length
// We are no longer sending payload length, so 4 bits are now free for other usages
// uint8_t data = qsp->payloadLength & 0x0f;
uint8_t data = 0;
uint8_t data = radioState->channel;
data |= (qsp->frameToSend << 4) & 0xf0;
qspComputeCrc(qsp, data);
buffer[1] = data;