Kyosho/Hype: another attempt to fix bind...

This commit is contained in:
Pascal Langer 2020-09-30 11:06:30 +02:00
parent 25ebd55c85
commit 4058f04b39
3 changed files with 36 additions and 23 deletions

View File

@ -27,7 +27,7 @@ void A7105_WriteData(uint8_t len, uint8_t channel)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
SPI_Write(packet[i]); SPI_Write(packet[i]);
A7105_CSN_on; A7105_CSN_on;
if(protocol!=PROTO_FLYSKY) if(!(protocol==PROTO_FLYSKY || protocol==PROTO_KYOSHO))
{ {
A7105_Strobe(A7105_STANDBY); //Force standby mode, ie cancel any TX or RX... A7105_Strobe(A7105_STANDBY); //Force standby mode, ie cancel any TX or RX...
A7105_SetTxRxMode(TX_EN); //Switch to PA A7105_SetTxRxMode(TX_EN); //Switch to PA

View File

@ -81,35 +81,47 @@ static void __attribute__((unused)) kyosho_hype_send_packet()
{ {
if(IS_BIND_IN_PROGRESS) if(IS_BIND_IN_PROGRESS)
{ {
packet[0] = rx_tx_addr[1]; if(packet_sent==0)
packet[1] = rx_tx_addr[3]; {//build the packet and send it
//RF table packet[0] = rx_tx_addr[1];
for(uint8_t i=0; i<15;i++) packet[1] = rx_tx_addr[3];
packet[i+2]=hopping_frequency[i]; //RF table
rf_ch_num=0x01; for(uint8_t i=0; i<15;i++)
packet_length=17; packet[i+2]=hopping_frequency[i];
packet_period=1423; A7105_WriteData(17, 0x01);
packet_sent++;
packet_period=1421;
#if 0
debug("ch=01 P=");
for(uint8_t i=0; i<17; i++)
debug("%02X ", packet[i]);
debugln("");
#endif
}
else
A7105_Strobe(A7105_TX); //only send
} }
else else
{ {
//original TX is only refreshing the packet every 20ms and only do retransmit in between //original TX is only refreshing the packet every 20ms and keep repeating the same packet in between (STROBE_TX)
//6 channels: AETR //build packet=6 channels with order AETR
for(uint8_t i=0; i<6;i++) for(uint8_t i=0;i<6;i++)
packet[i] = convert_channel_8b(i); packet[i] = convert_channel_8b(i);
//set RF channel
rf_ch_num=hopping_frequency[hopping_frequency_no]; rf_ch_num=hopping_frequency[hopping_frequency_no];
hopping_frequency_no++; hopping_frequency_no++;
if(hopping_frequency_no>14) if(hopping_frequency_no>14)
hopping_frequency_no = 0; hopping_frequency_no = 0;
packet_length=6; //send it
packet_period=909; //packet period fluctuates a lot... A7105_WriteData(6, rf_ch_num);
packet_period=931; //packet period fluctuates a lot on the original TX from one packet to the other but stable if looking over a period of 40ms
#if 0
debug("ch=%02X P=",rf_ch_num);
for(uint8_t i=0; i<6; i++)
debug("%02X ", packet[i]);
debugln("");
#endif
} }
#if 0
debug("ch=%02X P=",rf_ch_num);
for(uint8_t i=0; i<packet_length; i++)
debug("%02X ", packet[i]);
debugln("");
#endif
A7105_WriteData(packet_length, rf_ch_num);
} }
uint16_t ReadKyosho() uint16_t ReadKyosho()
@ -181,6 +193,7 @@ uint16_t initKyosho()
if(IS_BIND_IN_PROGRESS) if(IS_BIND_IN_PROGRESS)
bind_counter = KYOSHO_BIND_COUNT; bind_counter = KYOSHO_BIND_COUNT;
packet_sent=0;
packet_period=3852; //FHSS packet_period=3852; //FHSS
return 2000; return 2000;
} }

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_REVISION 1 #define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 71 #define VERSION_PATCH_LEVEL 72
//****************** //******************
// Protocols // Protocols