Outgoing bind frame
This commit is contained in:
@@ -263,6 +263,11 @@ int8_t getFrameToTransmit(QspConfiguration_t *qsp) {
|
|||||||
|
|
||||||
#ifdef DEVICE_MODE_TX
|
#ifdef DEVICE_MODE_TX
|
||||||
int8_t getFrameToTransmit(QspConfiguration_t *qsp) {
|
int8_t getFrameToTransmit(QspConfiguration_t *qsp) {
|
||||||
|
|
||||||
|
if (platformNode.isBindMode) {
|
||||||
|
return QSP_FRAME_BIND;
|
||||||
|
}
|
||||||
|
|
||||||
int8_t retVal = txSendSequence[currentSequenceIndex];
|
int8_t retVal = txSendSequence[currentSequenceIndex];
|
||||||
|
|
||||||
currentSequenceIndex++;
|
currentSequenceIndex++;
|
||||||
@@ -380,6 +385,10 @@ void loop(void)
|
|||||||
case QSP_FRAME_RC_DATA:
|
case QSP_FRAME_RC_DATA:
|
||||||
encodeRcDataPayload(&qsp, PLATFORM_CHANNEL_COUNT);
|
encodeRcDataPayload(&qsp, PLATFORM_CHANNEL_COUNT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case QSP_FRAME_BIND:
|
||||||
|
encodeBindPayload(&qsp, platformNode.bindKey);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmitPayload = true;
|
transmitPayload = true;
|
||||||
|
|||||||
@@ -238,3 +238,12 @@ void encodePingPayload(QspConfiguration_t *qsp, uint32_t currentMicros) {
|
|||||||
|
|
||||||
qsp->payloadLength = qspFrameLengths[QSP_FRAME_PING];
|
qsp->payloadLength = qspFrameLengths[QSP_FRAME_PING];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void encodeBindPayload(QspConfiguration_t *qsp, uint8_t bindKey[]) {
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < qspFrameLengths[QSP_FRAME_PING]; i++) {
|
||||||
|
qsp->payload[i] = bindKey[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
qsp->payloadLength = qspFrameLengths[QSP_FRAME_PING];
|
||||||
|
}
|
||||||
@@ -20,3 +20,4 @@ void qspClearPayload(QspConfiguration_t *qsp);
|
|||||||
void qspEncodeFrame(QspConfiguration_t *qsp, uint8_t buffer[], uint8_t *size, uint8_t radioChannel, uint8_t bindKey[]);
|
void qspEncodeFrame(QspConfiguration_t *qsp, uint8_t buffer[], uint8_t *size, uint8_t radioChannel, uint8_t bindKey[]);
|
||||||
|
|
||||||
void encodePingPayload(QspConfiguration_t *qsp, uint32_t currentMicros);
|
void encodePingPayload(QspConfiguration_t *qsp, uint32_t currentMicros);
|
||||||
|
void encodeBindPayload(QspConfiguration_t *qsp, uint8_t bindKey[]);
|
||||||
@@ -22,6 +22,13 @@ void TxOled::loop() {
|
|||||||
//Second button has notthing to do over here
|
//Second button has notthing to do over here
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TX_PAGE_BIND:
|
||||||
|
if (button1.getState() == TACTILE_STATE_LONG_PRESS) {
|
||||||
|
platformNode.isBindMode = !platformNode.isBindMode;
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case TX_PAGE_STATS:
|
case TX_PAGE_STATS:
|
||||||
//Second button refreshes this page
|
//Second button refreshes this page
|
||||||
if (button1.getState() == TACTILE_STATE_SHORT_PRESS) {
|
if (button1.getState() == TACTILE_STATE_SHORT_PRESS) {
|
||||||
@@ -93,7 +100,12 @@ void TxOled::renderPageBind() {
|
|||||||
_display.clear();
|
_display.clear();
|
||||||
_display.draw1x2String(0, 0, "Bind");
|
_display.draw1x2String(0, 0, "Bind");
|
||||||
|
|
||||||
snprintf(buf, OLED_COL_COUNT, "Bind?");
|
if (platformNode.isBindMode) {
|
||||||
|
snprintf(buf, OLED_COL_COUNT, "Binding!!");
|
||||||
|
} else {
|
||||||
|
snprintf(buf, OLED_COL_COUNT, "Bind?");
|
||||||
|
}
|
||||||
|
|
||||||
_display.draw1x2String(0, 4, buf);
|
_display.draw1x2String(0, 4, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,10 @@
|
|||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "tactile.h"
|
#include "tactile.h"
|
||||||
#include "radio_node.h"
|
#include "radio_node.h"
|
||||||
|
#include "platform_node.h"
|
||||||
|
|
||||||
extern RadioNode radioNode;
|
extern RadioNode radioNode;
|
||||||
|
extern PlatformNode platformNode;
|
||||||
extern RxDeviceState_t rxDeviceState;
|
extern RxDeviceState_t rxDeviceState;
|
||||||
extern TxDeviceState_t txDeviceState;
|
extern TxDeviceState_t txDeviceState;
|
||||||
extern Tactile button0;
|
extern Tactile button0;
|
||||||
|
|||||||
Reference in New Issue
Block a user