mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 16:48:10 +00:00
Few modifications
This commit is contained in:
parent
aa8a059553
commit
8906c85d06
@ -31,6 +31,7 @@ enum{
|
||||
AFHDS2A_BIND2,
|
||||
AFHDS2A_BIND3,
|
||||
AFHDS2A_BIND4,
|
||||
AFHDS2A_DATA_INIT,
|
||||
AFHDS2A_DATA,
|
||||
};
|
||||
|
||||
@ -226,8 +227,8 @@ static void AFHDS2A_build_packet(uint8_t type)
|
||||
#define AFHDS2A_WAIT_WRITE 0x80
|
||||
uint16_t ReadAFHDS2A()
|
||||
{
|
||||
static uint8_t packet_type = AFHDS2A_PACKET_STICKS;
|
||||
static uint16_t packet_counter=0;
|
||||
static uint8_t packet_type;
|
||||
static uint16_t packet_counter;
|
||||
uint8_t data_rx;
|
||||
uint16_t start;
|
||||
#ifndef FORCE_AFHDS2A_TUNING
|
||||
@ -243,18 +244,12 @@ uint16_t ReadAFHDS2A()
|
||||
if(!(A7105_ReadReg(A7105_00_MODE) & (1<<5 | 1<<6)))
|
||||
{ // FECF+CRCF Ok
|
||||
A7105_ReadData(AFHDS2A_RXPACKET_SIZE);
|
||||
if(packet[0] == 0xbc && packet[9] == 0x01)
|
||||
if(packet[0] == 0xbc)
|
||||
{
|
||||
uint8_t temp=50+RX_num*4;
|
||||
uint8_t i;
|
||||
for(i=0; i<4; i++)
|
||||
{
|
||||
for(uint8_t i=0; i<4; i++)
|
||||
rx_id[i] = packet[5+i];
|
||||
eeprom_write_byte((EE_ADDR)(temp+i),rx_id[i]);
|
||||
}
|
||||
phase = AFHDS2A_BIND4;
|
||||
packet_count++;
|
||||
return 3850;
|
||||
if(packet[9] == 0x01)
|
||||
phase = AFHDS2A_BIND4;
|
||||
}
|
||||
}
|
||||
packet_count++;
|
||||
@ -283,14 +278,18 @@ uint16_t ReadAFHDS2A()
|
||||
bind_phase++;
|
||||
if(bind_phase>=4)
|
||||
{
|
||||
packet_counter=0;
|
||||
packet_type = AFHDS2A_PACKET_STICKS;
|
||||
uint8_t eeadr=AFHDS2A_EEPROM_OFFSET+RX_num*4;
|
||||
for(uint8_t i=0; i<4; i++)
|
||||
eeprom_write_byte((EE_ADDR)(eeadr+i),rx_id[i]);
|
||||
hopping_frequency_no=1;
|
||||
phase = AFHDS2A_DATA;
|
||||
phase = AFHDS2A_DATA_INIT;
|
||||
BIND_DONE;
|
||||
}
|
||||
}
|
||||
return 3850;
|
||||
case AFHDS2A_DATA:
|
||||
case AFHDS2A_DATA_INIT:
|
||||
packet_counter=0;
|
||||
packet_type = AFHDS2A_PACKET_STICKS;
|
||||
case AFHDS2A_DATA:
|
||||
AFHDS2A_build_packet(packet_type);
|
||||
if((A7105_ReadReg(A7105_00_MODE) & 0x01)) // Check if something has been received...
|
||||
data_rx=0;
|
||||
@ -359,7 +358,7 @@ uint16_t initAFHDS2A()
|
||||
phase = AFHDS2A_BIND1;
|
||||
else
|
||||
{
|
||||
phase = AFHDS2A_DATA;
|
||||
phase = AFHDS2A_DATA_INIT;
|
||||
//Read RX ID from EEPROM based on RX_num, RX_num must be uniq for each RX
|
||||
uint8_t temp=AFHDS2A_EEPROM_OFFSET+RX_num*4;
|
||||
for(uint8_t i=0;i<4;i++)
|
||||
|
@ -29,15 +29,6 @@ int16_t map16b( int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int1
|
||||
}
|
||||
|
||||
#ifndef STM32_BOARD
|
||||
// replacement millis() and micros()
|
||||
// These work polled, no interrupts
|
||||
// micros() MUST be called at least once every 32 milliseconds
|
||||
uint16_t MillisPrecount ;
|
||||
uint16_t lastTimerValue ;
|
||||
uint32_t TotalMicros ;
|
||||
uint32_t TotalMillis ;
|
||||
uint8_t Correction ;
|
||||
|
||||
int16_t map( int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max)
|
||||
{
|
||||
// return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
@ -49,6 +40,15 @@ int16_t map( int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t
|
||||
return x + out_min ;
|
||||
}
|
||||
|
||||
// replacement millis() and micros()
|
||||
// These work polled, no interrupts
|
||||
// micros() MUST be called at least once every 32 milliseconds
|
||||
uint16_t MillisPrecount ;
|
||||
uint16_t lastTimerValue ;
|
||||
uint32_t TotalMicros ;
|
||||
uint32_t TotalMillis ;
|
||||
uint8_t Correction ;
|
||||
|
||||
uint32_t micros()
|
||||
{
|
||||
uint16_t elapsed ;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_REVISION 0
|
||||
#define VERSION_PATCH_LEVEL 17
|
||||
#define VERSION_PATCH_LEVEL 19
|
||||
//******************
|
||||
// Protocols
|
||||
//******************
|
||||
@ -425,7 +425,7 @@ enum NRF_POWER
|
||||
NRF_POWER_2 = 0x02, // 2 : -6dBm (250uW) 14dBm (25mW)
|
||||
NRF_POWER_3 = 0x03 // 3 : 0dBm (1mW) 20dBm (100mW)
|
||||
};
|
||||
#define NRF_HIGH_POWER NRF_POWER_2
|
||||
#define NRF_HIGH_POWER NRF_POWER_3
|
||||
#define NRF_LOW_POWER NRF_POWER_1
|
||||
#define NRF_RANGE_POWER NRF_POWER_0
|
||||
#define NRF_BIND_POWER NRF_POWER_0
|
||||
|
@ -43,16 +43,16 @@
|
||||
#undef ESKY150_NRF24L01_INO
|
||||
#undef H8_3D_NRF24L01_INO
|
||||
|
||||
#elseif defined Module_2
|
||||
#elif defined Module_2
|
||||
//Example of a module which doesn't need the telemetry signal to be inverted
|
||||
#undef INVERT_TELEMETRY
|
||||
|
||||
#elseif defined Module_3
|
||||
#elif defined Module_3
|
||||
//Example of a module which will be used with OpenTX
|
||||
#undef MULTI_STATUS
|
||||
#define MULTI_TELEMETRY
|
||||
|
||||
#elseif defined Module_4
|
||||
#elif defined Module_4
|
||||
//Example of a module which will be PPM only
|
||||
#undef ENABLE_SERIAL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user