Outgoing bind frame
This commit is contained in:
@@ -263,6 +263,11 @@ int8_t getFrameToTransmit(QspConfiguration_t *qsp) {
|
||||
|
||||
#ifdef DEVICE_MODE_TX
|
||||
int8_t getFrameToTransmit(QspConfiguration_t *qsp) {
|
||||
|
||||
if (platformNode.isBindMode) {
|
||||
return QSP_FRAME_BIND;
|
||||
}
|
||||
|
||||
int8_t retVal = txSendSequence[currentSequenceIndex];
|
||||
|
||||
currentSequenceIndex++;
|
||||
@@ -380,6 +385,10 @@ void loop(void)
|
||||
case QSP_FRAME_RC_DATA:
|
||||
encodeRcDataPayload(&qsp, PLATFORM_CHANNEL_COUNT);
|
||||
break;
|
||||
|
||||
case QSP_FRAME_BIND:
|
||||
encodeBindPayload(&qsp, platformNode.bindKey);
|
||||
break;
|
||||
}
|
||||
|
||||
transmitPayload = true;
|
||||
|
||||
@@ -237,4 +237,13 @@ void encodePingPayload(QspConfiguration_t *qsp, uint32_t currentMicros) {
|
||||
qsp->payload[3] = (currentMicros >> 24) & 255;
|
||||
|
||||
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];
|
||||
}
|
||||
@@ -19,4 +19,5 @@ void qspDecodeIncomingFrame(
|
||||
void qspClearPayload(QspConfiguration_t *qsp);
|
||||
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
|
||||
break;
|
||||
|
||||
case TX_PAGE_BIND:
|
||||
if (button1.getState() == TACTILE_STATE_LONG_PRESS) {
|
||||
platformNode.isBindMode = !platformNode.isBindMode;
|
||||
update = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case TX_PAGE_STATS:
|
||||
//Second button refreshes this page
|
||||
if (button1.getState() == TACTILE_STATE_SHORT_PRESS) {
|
||||
@@ -93,7 +100,12 @@ void TxOled::renderPageBind() {
|
||||
_display.clear();
|
||||
_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);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
#include "variables.h"
|
||||
#include "tactile.h"
|
||||
#include "radio_node.h"
|
||||
#include "platform_node.h"
|
||||
|
||||
extern RadioNode radioNode;
|
||||
extern PlatformNode platformNode;
|
||||
extern RxDeviceState_t rxDeviceState;
|
||||
extern TxDeviceState_t txDeviceState;
|
||||
extern Tactile button0;
|
||||
|
||||
Reference in New Issue
Block a user