Rx_health frame encoding, no data is yet acquired from Rx hardware

This commit is contained in:
Pawel Spychalski
2017-10-12 13:29:10 +02:00
parent 0071b7880f
commit 021decff98
5 changed files with 61 additions and 18 deletions

View File

@@ -52,12 +52,14 @@ bool canTransmit = false;
* Start of QSP protocol implementation
*/
QspConfiguration_t qsp = {};
RxDeviceState_t rxDeviceState = {};
/*
* End of QSP protocol implementation
*/
static uint32_t lastRcFrameTransmit = 0;
static uint32_t lastRxHealthFrameTransmit = 0;
/*
* Serial port used to send data
@@ -250,8 +252,6 @@ void loop(void)
bool transmitPayload = false;
#ifdef DEVICE_MODE_TX
//TODO It should be only possible to transmit when radio is not receiveing
/*
* RC_DATA QSP frame
*/
@@ -268,6 +268,23 @@ void loop(void)
#endif
#ifdef DEVICE_MODE_RX
/*
* RC_DATA QSP frame
*/
if (currentMillis - lastRxHealthFrameTransmit > RX_RX_HEALTH_FRAME_RATE && !transmitPayload && qsp.protocolState == QSP_STATE_IDLE)
{
lastRxHealthFrameTransmit = currentMillis;
qspClearPayload(&qsp);
encodeRxHealthPayload(&qsp, &rxDeviceState);
qsp.frameToSend = QSP_FRAME_RX_HEALTH;
transmitPayload = true;
}
#endif
#ifdef LORA_HARDWARE_SERIAL
if (Serial.available())
{