6 #if defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) || defined(Regulatory_Domain_FCC_915) || defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433)
7 #include "SX127xDriver.h"
10 #if defined(Regulatory_Domain_ISM_2400)
11 #include "SX1280Driver.h"
16 extern uint8_t BindingUID
[6];
17 extern uint8_t UID
[6];
18 extern uint8_t MasterUID
[6];
19 extern uint16_t CRCInitializer
;
32 } expresslrs_tlm_ratio_e
;
39 disconnectPending
, // used on modelmatch change to drop the connection
41 // States below here are special mode states
45 // Failure states go below here to display immediately
51 * On the TX, tracks what to do when the Tock timer fires
55 ttrpTransmitting
, // Transmitting RC channels as normal
56 ttrpInReceiveMode
, // Has switched to Receive mode for telemetry on the next slot (set on TX done)
57 ttrpWindowInProgress
// Tock has fired while in receive mode, receiving telemetry on this slot
58 // Next slot will go back to ttrsTransmitting
68 extern connectionState_e connectionState
;
69 extern connectionState_e connectionStatePrev
;
75 RF_AIRMODE_PARAMETERS
= 2
76 } expresslrs_tlm_header_e
;
89 } expresslrs_RFrates_e
; // Max value of 16 since only 4 bits have been assigned in the sync package.
91 typedef struct expresslrs_rf_pref_params_s
94 expresslrs_RFrates_e enum_rate
; // Max value of 16 since only 4 bits have been assigned in the sync package.
95 int32_t RXsensitivity
; // expected RF sensitivity based on
96 uint32_t TOA
; // time on air in microseconds
97 uint32_t DisconnectTimeoutMs
; // Time without a packet before receiver goes to disconnected (ms)
98 uint32_t RxLockTimeoutMs
; // Max time to go from tentative -> connected state on receiver (ms)
99 uint32_t SyncPktIntervalDisconnected
; // how often to send the SYNC_PACKET packet (ms) when there is no response from RX
100 uint32_t SyncPktIntervalConnected
; // how often to send the SYNC_PACKET packet (ms) when there we have a connection
102 } expresslrs_rf_pref_params_s
;
105 #if defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) || defined(Regulatory_Domain_FCC_915) || defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433)
107 #define RATE_DEFAULT 0
108 #define RATE_BINDING 2 // 50Hz bind mode
109 typedef struct expresslrs_mod_settings_s
112 expresslrs_RFrates_e enum_rate
; // Max value of 16 since only 4 bits have been assigned in the sync package.
114 SX127x_SpreadingFactor sf
;
115 SX127x_CodingRate cr
;
116 uint32_t interval
; // interval in us seconds that corresponds to that frequency
117 expresslrs_tlm_ratio_e TLMinterval
; // every X packets is a response TLM packet, should be a power of 2
118 uint8_t FHSShopInterval
; // every X packets we hop to a new frequency. Max value of 16 since only 4 bits have been assigned in the sync package.
120 uint8_t PayloadLength
; // Number of OTA bytes to be sent.
121 } expresslrs_mod_settings_t
;
125 #if defined(Regulatory_Domain_ISM_2400)
127 #define RATE_DEFAULT 0
128 #define RATE_BINDING 3 // 50Hz bind mode
129 typedef struct expresslrs_mod_settings_s
132 expresslrs_RFrates_e enum_rate
; // Max value of 16 since only 4 bits have been assigned in the sync package.
133 SX1280_RadioLoRaBandwidths_t bw
;
134 SX1280_RadioLoRaSpreadingFactors_t sf
;
135 SX1280_RadioLoRaCodingRates_t cr
;
136 uint32_t interval
; // interval in us seconds that corresponds to that frequency
137 expresslrs_tlm_ratio_e TLMinterval
; // every X packets is a response TLM packet, should be a power of 2
138 uint8_t FHSShopInterval
; // every X packets we hop to a new frequency. Max value of 16 since only 4 bits have been assigned in the sync package.
140 uint8_t PayloadLength
; // Number of OTA bytes to be sent.
141 } expresslrs_mod_settings_t
;
146 expresslrs_mod_settings_s
*get_elrs_airRateConfig(int8_t index
);
147 expresslrs_rf_pref_params_s
*get_elrs_RFperfParams(int8_t index
);
149 uint8_t ICACHE_RAM_ATTR
TLMratioEnumToValue(expresslrs_tlm_ratio_e enumval
);
150 uint16_t RateEnumToHz(expresslrs_RFrates_e eRate
);
152 extern expresslrs_mod_settings_s
*ExpressLRS_currAirRate_Modparams
;
153 extern expresslrs_rf_pref_params_s
*ExpressLRS_currAirRate_RFperfParams
;
154 extern uint8_t ExpressLRS_nextAirRateIndex
;
155 //extern expresslrs_mod_settings_s *ExpressLRS_nextAirRate;
156 //extern expresslrs_mod_settings_s *ExpressLRS_prevAirRate;
157 uint8_t ICACHE_RAM_ATTR
enumRatetoIndex(expresslrs_RFrates_e rate
);
161 uint32_t uidMacSeedGet(void);
176 //ELRS SPECIFIC OTA CRC
177 //Koopman formatting https://users.ece.cmu.edu/~koopman/crc/
178 #define ELRS_CRC_POLY 0x07 // 0x83
179 #define ELRS_CRC14_POLY 0x2E57 // 0x372B