From d1e40ee71c67c5a1b8fcaaf3970478cc37838e35 Mon Sep 17 00:00:00 2001 From: pascallanger Date: Thu, 20 Oct 2016 22:55:50 +0200 Subject: [PATCH] AFHDS2A cosmetic changes --- Multiprotocol/A7105_SPI.ino | 13 +++++++------ Multiprotocol/AFHDS2A_a7105.ino | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Multiprotocol/A7105_SPI.ino b/Multiprotocol/A7105_SPI.ino index 183444d..6a95cb0 100644 --- a/Multiprotocol/A7105_SPI.ino +++ b/Multiprotocol/A7105_SPI.ino @@ -154,7 +154,7 @@ const uint8_t PROGMEM HUBSAN_A7105_regs[] = { 0xFF, 0x63, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF ,0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2B, 0xFF, 0xFF, 0x62, 0x80, 0xFF, 0xFF, 0x0A, 0xFF, 0xFF, 0x07, 0x17, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF + 0xFF, 0xFF }; #endif #ifdef FLYSKY_A7105_INO @@ -162,7 +162,7 @@ const uint8_t PROGMEM FLYSKY_A7105_regs[] = { 0xff, 0x42, 0x00, 0x14, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x00, 0x50, 0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x0f, 0x13, 0xc3, 0x00, 0xff, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, - 0x01, 0x0f, 0xff + 0x01, 0x0f }; #endif #ifdef AFHDS2A_A7105_INO @@ -170,7 +170,7 @@ const uint8_t PROGMEM AFHDS2A_A7105_regs[] = { 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, 0xFF, 0xFF, 0x2a, 0x32, 0xc3, 0x1f, // 10 - 1f 0x1e, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x3b, 0x00, 0x17, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f - 0x01, 0x0f, 0xFF // 30 - 32 + 0x01, 0x0f // 30 - 31 }; #endif @@ -202,10 +202,11 @@ void A7105_Init(void) } } - for (uint8_t i = 0; i < 0x33; i++) + for (uint8_t i = 0; i < 0x32; i++) { - if( pgm_read_byte_near(&A7105_Regs[i]) != 0xFF) - A7105_WriteReg(i, pgm_read_byte_near(&A7105_Regs[i])); + uint8_t val=pgm_read_byte_near(&A7105_Regs[i]); + if( val != 0xFF) + A7105_WriteReg(i, val); } A7105_Strobe(A7105_STANDBY); diff --git a/Multiprotocol/AFHDS2A_a7105.ino b/Multiprotocol/AFHDS2A_a7105.ino index 97280e1..76881fd 100644 --- a/Multiprotocol/AFHDS2A_a7105.ino +++ b/Multiprotocol/AFHDS2A_a7105.ino @@ -269,7 +269,7 @@ uint16_t ReadAFHDS2A() A7105_Strobe(A7105_STANDBY); AFHDS2A_build_packet(packet_type); A7105_WriteData(AFHDS2A_TXPACKET_SIZE, hopping_frequency[hopping_frequency_no++]); - if(hopping_frequency_no >= 16) + if(hopping_frequency_no >= AFHDS2A_NUMFREQ) hopping_frequency_no = 0; if(!(packet_counter % 1313)) packet_type = AFHDS2A_PACKET_SETTINGS;