This commit is contained in:
Pawel Spychalski (DzikuVx)
2017-10-27 11:25:48 +02:00
parent 5c090b6868
commit 0f735f0054
4 changed files with 20 additions and 2 deletions

View File

@@ -47,6 +47,14 @@ Total length of `RC_DATA` payload is 9 bytes
| 3 | RX supply volatage, sent in 0,1V |
| 4 | RX analog input 1 sent in 0,1V |
| 5 | RX analog input 2 sent in 0,1V |
| 6 | Flags |
#### Flags
| Bit | Meaning |
| ---- | ---- |
| 00000001 | Device in Failsafe mode |
### `PING` and `PONG` frames

View File

@@ -1,7 +1,7 @@
#define LORA_HARDWARE_SPI
// #define DEVICE_MODE_TX
#define DEVICE_MODE_RX
#define DEVICE_MODE_TX
// #define DEVICE_MODE_RX
#define FEATURE_TX_OLED

View File

@@ -61,6 +61,14 @@ void encodeRxHealthPayload(QspConfiguration_t *qsp, RxDeviceState_t *rxDeviceSta
qsp->payload[3] = rxDeviceState->a1Voltage;
qsp->payload[4] = rxDeviceState->a2Voltage;
uint8_t flags = 0;
if (qsp->deviceState == DEVICE_STATE_FAILSAFE) {
flags |= 0x01 << 0;
}
qsp->payload[5] = flags;
qsp->payloadLength = 6;
}
@@ -70,6 +78,7 @@ void decodeRxHealthPayload(QspConfiguration_t *qsp, RxDeviceState_t *rxDeviceSta
rxDeviceState->rxVoltage = qsp->payload[2];
rxDeviceState->a1Voltage = qsp->payload[3];
rxDeviceState->a2Voltage = qsp->payload[4];
rxDeviceState->flags = qsp->payload[5];
}
/**

View File

@@ -89,4 +89,5 @@ struct RxDeviceState_t {
uint8_t a1Voltage = 0;
uint8_t a2Voltage = 0;
uint32_t roundtrip = 0;
uint8_t flags = 0;
};