mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-10 01:18:15 +00:00
WFLY2: add switch from PPM <-> WBUS
This commit is contained in:
parent
5ac41fdd15
commit
a2559a65d3
@ -387,7 +387,7 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_WFLY, STR_WFLY, 1, STR_SUBTYPE_WFLY, OPTION_NONE },
|
{PROTO_WFLY, STR_WFLY, 1, STR_SUBTYPE_WFLY, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(WFLY2_A7105_INO)
|
#if defined(WFLY2_A7105_INO)
|
||||||
{PROTO_WFLY2, STR_WFLY2, 1, STR_SUBTYPE_WFLY2, OPTION_NONE },
|
{PROTO_WFLY2, STR_WFLY2, 1, STR_SUBTYPE_WFLY2, OPTION_OPTION },
|
||||||
#endif
|
#endif
|
||||||
#if defined(XK_NRF24L01_INO)
|
#if defined(XK_NRF24L01_INO)
|
||||||
{PROTO_XK, STR_XK , 2, STR_SUBTYPE_XK, OPTION_RFTUNE },
|
{PROTO_XK, STR_XK , 2, STR_SUBTYPE_XK, OPTION_RFTUNE },
|
||||||
|
@ -32,7 +32,6 @@ enum{
|
|||||||
static void __attribute__((unused)) WFLY2_build_packet()
|
static void __attribute__((unused)) WFLY2_build_packet()
|
||||||
{
|
{
|
||||||
static uint16_t pseudo=0;
|
static uint16_t pseudo=0;
|
||||||
uint8_t offset=0;
|
|
||||||
|
|
||||||
//End bind
|
//End bind
|
||||||
if(IS_BIND_IN_PROGRESS && bind_counter)
|
if(IS_BIND_IN_PROGRESS && bind_counter)
|
||||||
@ -72,18 +71,6 @@ static void __attribute__((unused)) WFLY2_build_packet()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Header
|
|
||||||
//packet[0] = 0x00; // Normal packet
|
|
||||||
#ifdef FAILSAFE_ENABLE
|
|
||||||
if(IS_FAILSAFE_VALUES_on)
|
|
||||||
{
|
|
||||||
packet[0] = 0x01; //Failsafe packet
|
|
||||||
packet[5] = 0x58; // unknown, values are counting 58,59,5A,5B and rollover
|
|
||||||
packet[6] = 0x55; // unknown and constant
|
|
||||||
offset=2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Pseudo
|
//Pseudo
|
||||||
uint16_t high_bit=(pseudo & 0x8000) ^ 0x8000; // toggle 0x8000 every other line
|
uint16_t high_bit=(pseudo & 0x8000) ^ 0x8000; // toggle 0x8000 every other line
|
||||||
pseudo <<= 1; // *2
|
pseudo <<= 1; // *2
|
||||||
@ -111,6 +98,33 @@ static void __attribute__((unused)) WFLY2_build_packet()
|
|||||||
packet[3] = rx_tx_addr[3];
|
packet[3] = rx_tx_addr[3];
|
||||||
packet[4] = rx_tx_addr[2] & 0x03;
|
packet[4] = rx_tx_addr[2] & 0x03;
|
||||||
|
|
||||||
|
//Header
|
||||||
|
if(prev_option!=option)
|
||||||
|
{//Set the RX PPM/WBUS on change
|
||||||
|
packet[0] = 0x05; //PPM/WBUS packet
|
||||||
|
packet[5] = 0x01;
|
||||||
|
if(option)
|
||||||
|
packet[6] = 0x00; // WBUS
|
||||||
|
else
|
||||||
|
packet[6] = 0x01; // PPM
|
||||||
|
prev_option = option;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//Normal or Failsafe packets
|
||||||
|
uint8_t offset=0;
|
||||||
|
|
||||||
|
//packet[0] = 0x00; // Normal packet
|
||||||
|
|
||||||
|
#ifdef FAILSAFE_ENABLE
|
||||||
|
if(IS_FAILSAFE_VALUES_on)
|
||||||
|
{//Failsafe packet
|
||||||
|
packet[0] = 0x01; //Failsafe packet
|
||||||
|
packet[5] = 0x58; // unknown, values are counting 58,59,5A,5B and rollover
|
||||||
|
packet[6] = 0x55; // unknown and constant
|
||||||
|
offset=2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//10 channels -100%=0x2C1...0%=0x800...+100%=0xD3F
|
//10 channels -100%=0x2C1...0%=0x800...+100%=0xD3F
|
||||||
for(uint8_t i = 0; i < 5; i++)
|
for(uint8_t i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
@ -128,6 +142,7 @@ static void __attribute__((unused)) WFLY2_build_packet()
|
|||||||
FAILSAFE_VALUES_off;
|
FAILSAFE_VALUES_off;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Debug
|
//Debug
|
||||||
#if 0
|
#if 0
|
||||||
@ -289,6 +304,7 @@ uint16_t initWFLY2()
|
|||||||
rf_ch_num = 0;
|
rf_ch_num = 0;
|
||||||
bind_counter = WFLY2_BIND_COUNT;
|
bind_counter = WFLY2_BIND_COUNT;
|
||||||
phase = WFLY2_DATA;
|
phase = WFLY2_DATA;
|
||||||
|
prev_option = option;
|
||||||
#ifdef WFLY2_HUB_TELEMETRY
|
#ifdef WFLY2_HUB_TELEMETRY
|
||||||
packet_count = 0;
|
packet_count = 0;
|
||||||
telemetry_lost = 1;
|
telemetry_lost = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user