BAYANG RX: enables 6 analog channels

Fix channels range -100%..+100%
This commit is contained in:
pascallanger 2019-11-29 20:26:10 +01:00
parent d3c3fac4f7
commit 396c005b0a
3 changed files with 27 additions and 22 deletions

View File

@ -65,23 +65,28 @@ static void __attribute__((unused)) Bayang_Rx_build_telemetry_packet()
uint8_t idx = 0;
packet_in[idx++] = RX_LQI;
packet_in[idx++] = 100; // no RSSI
packet_in[idx++] = 0; // start channel
packet_in[idx++] = 8; // number of channels in packet
packet_in[idx++] = RX_LQI; // no RSSI
packet_in[idx++] = 0; // start channel
packet_in[idx++] = 10; // number of channels in packet
// convert & pack channels
for (uint8_t i = 0; i < packet_in[3]; i++) {
uint32_t val = CHANNEL_MIN_125;
uint32_t val = CHANNEL_MIN_100;
if (i < 4) {
// AETR
val = (((packet[4 + i * 2] & ~0x7C) << 8) | packet[5 + i * 2]) << 1;
}
else if (((i == 4) && (packet[2] & 0x08)) || // flip
((i == 5) && (packet[2] & 0x01)) || // rth
((i == 6) && (packet[2] & 0x20)) || // picture
((i == 7) && (packet[2] & 0x10))) { // video
//val = (((packet[4 + i * 2] & ~0x7C) << 8) | packet[5 + i * 2]) << 1;
val=packet[4 + i * 2]&0x03;
val=(val<<8)+packet[5 + i * 2];
val=((val+128)<<3)/5;
} else if (i == 4 || i == 5) {
val=packet[i==4?1:13];
val=((val+32)<<5)/5; // extra analog channel
} else if (((i == 6) && (packet[2] & 0x08)) || // flip
((i == 7) && (packet[2] & 0x01)) || // rth
((i == 8) && (packet[2] & 0x20)) || // picture
((i == 9) && (packet[2] & 0x10))) { // video
// set channel to 100% if feature is enabled
val = CHANNEL_MAX_125;
val = CHANNEL_MAX_100;
}
bits |= val << bitsavailable;
bitsavailable += 11;
@ -127,7 +132,7 @@ uint16_t Bayang_Rx_callback()
case BAYANG_RX_BIND:
if (NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR)) {
// data received from TX
if (XN297_ReadPayload(packet, BAYANG_RX_PACKET_SIZE) && packet[0] == 0xA4 && Bayang_Rx_check_validity()) {
if (XN297_ReadPayload(packet, BAYANG_RX_PACKET_SIZE) && ( packet[0] == 0xA4 || packet[0] == 0xA2 ) && Bayang_Rx_check_validity()) {
// store tx info into eeprom
uint16_t temp = BAYANG_RX_EEPROM_OFFSET;
for (i = 0; i < 5; i++) {

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 0
#define VERSION_PATCH_LEVEL 46
#define VERSION_PATCH_LEVEL 47
//******************
// Protocols

View File

@ -195,7 +195,7 @@ Note that the RX ouput will be AETR whatever the input channel order is.
## FLYSKY AFHDS2A RX - *56*
The Flysky AFHDS2A receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
Available in OpenTX 2.3.2, Trainer Mode Master/Multi
Available in OpenTX 2.3.3, Trainer Mode Master/Multi
Extended limits supported
@ -358,7 +358,7 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
## FRSKYX_RX - *55*
The FrSkyX receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
Available in OpenTX 2.3.2, Trainer Mode Master/Multi
Available in OpenTX 2.3.3, Trainer Mode Master/Multi
Extended limits supported
@ -398,7 +398,7 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
### Sub_protocol OPT_FW - *0*
OPTIMA RXs
Full telemetry available on OpenTX 2.3.2+, still in progress for erskyTx.
Full telemetry available on OpenTX 2.3.3+, still in progress for erskyTx.
**The TX must be close to the RX for the bind negotiation to complete successfully**
@ -430,7 +430,7 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
---|---|---|---|---|---|---|---|---|----|----|----
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12
Basic telemetry is available on OpenTX 2.3.2+ with RX voltage, Rx temperature, RX RSSI, RX LQI, TX RSSI and TX LQI.
Basic telemetry is available on OpenTX 2.3.3+ with RX voltage, Rx temperature, RX RSSI, RX LQI, TX RSSI and TX LQI.
## SFHSS - *21*
Models: Futaba RXs and XK models.
@ -678,13 +678,13 @@ TAKE_OFF|EMG_STOP
## BAYANG RX - *59*
The Bayang receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
---|---|---|---|---|---|---|---
A|E|T|R|FLIP|RTH|PICTURE|VIDEO
See the [BAYANG protocol](Protocols_Details.md#BAYANG---14) on how to activate ANAUX1 and ANAUX2 (Option/Telemetry=2).
Extended limits not supported
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
---|---|---|---|---|---|---|---|---|---
A|E|T|R|ANAUX1|ANAUX2|FLIP|RTH|PICTURE|VIDEO
Available in OpenTX 2.3.2, Trainer Mode Master/Multi
Available in OpenTX 2.3.3, Trainer Mode Master/Multi
## BUGSMINI - *42*
Models: MJX Bugs 3 Mini and 3H