Correction init A7105

This commit is contained in:
tipouic 2016-10-05 22:56:39 +02:00
parent 068b21cbb1
commit 950ee9ddc2
4 changed files with 15 additions and 10 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.ffs_db

View File

@ -159,10 +159,10 @@ const uint8_t PROGMEM FLYSKY_A7105_regs[] = {
0x13, 0xc3, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, 0x13, 0xc3, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00,
0x01, 0x0f, 0xff 0x01, 0x0f, 0xff
}; };
const uint8_t AFHDS2A_regs[] = { const uint8_t PROGMEM AFHDS2A_regs[] = {
-1 , 0x42 | (1<<5), 0x00, 0x25, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x05, 0x00, 0x50, // 00 - 0f 0xFF , 0x42 | (1<<5), 0x00, 0x25, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x05, 0x00, 0x50, // 00 - 0f
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x4f, 0x62, 0x80, -1, -1, 0x2a, 0x32, 0xc3, 0x1f, // 10 - 1f 0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x4f, 0x62, 0x80, 0xFF, 0xFF, 0x2a, 0x32, 0xc3, 0x1f, // 10 - 1f
0x1e, -1, 0x00, -1, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f 0x1e, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
0x01, 0x0f // 30 - 31 0x01, 0x0f // 30 - 31
}; };
#define ID_NORMAL 0x55201041 #define ID_NORMAL 0x55201041
@ -185,7 +185,7 @@ void A7105_Init(uint8_t protocol)
A7105_Regs=(void *)HUBSAN_A7105_regs; A7105_Regs=(void *)HUBSAN_A7105_regs;
} }
for (uint8_t i = 0; i < 0x33; i++){ for (uint8_t i = 0; i < 0x33; i++){
if( pgm_read_byte_near((uint16_t)(A7105_Regs)+i) != 0xFF) if( pgm_read_byte_near((uint16_t)(A7105_Regs)+i != 0xFF)
A7105_WriteReg(i, pgm_read_byte_near((uint16_t)(A7105_Regs)+i)); A7105_WriteReg(i, pgm_read_byte_near((uint16_t)(A7105_Regs)+i));
} }
A7105_Strobe(A7105_STANDBY); A7105_Strobe(A7105_STANDBY);

View File

@ -9,6 +9,7 @@
#define TXID_SIZE 4 #define TXID_SIZE 4
#define RXID_SIZE 4 #define RXID_SIZE 4
static uint8_t txid[RXID_SIZE];
static uint8_t rxid[RXID_SIZE]; static uint8_t rxid[RXID_SIZE];
static uint8_t packet_type; static uint8_t packet_type;
static uint8_t bind_reply; static uint8_t bind_reply;
@ -39,7 +40,7 @@
switch(type) { switch(type) {
case PACKET_STICKS: case PACKET_STICKS:
packet[0] = 0x58; packet[0] = 0x58;
memcpy( &packet[1], rx_tx_addr, 4); memcpy( &packet[1], txid, 4);
memcpy( &packet[5], rxid, 4); memcpy( &packet[5], rxid, 4);
for(uint8_t ch=0; ch<14; ch++) { for(uint8_t ch=0; ch<14; ch++) {
packet[9 + ch*2] = Servo_data[CH_AETR[ch]]&0xFF; packet[9 + ch*2] = Servo_data[CH_AETR[ch]]&0xFF;
@ -50,7 +51,7 @@
case PACKET_SETTINGS: case PACKET_SETTINGS:
packet[0] = 0xaa; packet[0] = 0xaa;
memcpy( &packet[1], rx_tx_addr, 4); memcpy( &packet[1], txid, 4);
memcpy( &packet[5], rxid, 4); memcpy( &packet[5], rxid, 4);
packet[9] = 0xfd; packet[9] = 0xfd;
packet[10]= 0xff; packet[10]= 0xff;
@ -75,7 +76,7 @@
case PACKET_FAILSAFE: case PACKET_FAILSAFE:
packet[0] = 0x56; packet[0] = 0x56;
memcpy( &packet[1], rx_tx_addr, 4); memcpy( &packet[1], txid, 4);
memcpy( &packet[5], rxid, 4); memcpy( &packet[5], rxid, 4);
for(uint8_t ch=0; ch<14; ch++) { for(uint8_t ch=0; ch<14; ch++) {
if(ch==0) { if(ch==0) {
@ -133,7 +134,7 @@
static void afhds2a_build_bind_packet() { static void afhds2a_build_bind_packet() {
uint8_t ch; uint8_t ch;
memcpy( &packet[1], rx_tx_addr, 4); memcpy( &packet[1], txid, 4);
memset( &packet[5], 0xff, 4); memset( &packet[5], 0xff, 4);
packet[10]= 0x00; packet[10]= 0x00;
for(ch=0; ch<16; ch++) { for(ch=0; ch<16; ch++) {
@ -298,6 +299,9 @@
static uint16_t AFHDS2A_setup() static uint16_t AFHDS2A_setup()
{ {
A7105_Init(INIT_FLYSKY_AFHDS2A); //flysky_init(); A7105_Init(INIT_FLYSKY_AFHDS2A); //flysky_init();
for (u8 i = 0; i < TXID_SIZE; ++i) {
txid[i] = rx_tx_addr[0];
}
calc_afhds_channels(MProtocol_id); calc_afhds_channels(MProtocol_id);
packet_type = PACKET_STICKS; packet_type = PACKET_STICKS;

View File

@ -138,7 +138,7 @@
//Below are some standard transmitters already preconfigured. //Below are some standard transmitters already preconfigured.
//Uncomment only the one which matches your transmitter. //Uncomment only the one which matches your transmitter.
//#define TX_ER9X //ER9X/ERSKY9X/OpenTX ( 988<->2012µs) //#define TX_ER9X //ER9X/ERSKY9X/OpenTX ( 988<->2012µs)
#define TX_TARANIS //TARANIS TAER (1100<->1900µs) #define TX_TARANIS //TARANIS AETR (1100<->1900µs)
//#define TX_DEVO7 //DEVO (1120<->1920µs) //#define TX_DEVO7 //DEVO (1120<->1920µs)
//#define TX_SPEKTRUM //Spektrum (1100<->1900µs) //#define TX_SPEKTRUM //Spektrum (1100<->1900µs)
//#define TX_HISKY //HISKY (1100<->1900µs) //#define TX_HISKY //HISKY (1100<->1900µs)