Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and use define for radio chip #1425

Merged
merged 4 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#ifndef UNIT_TEST
#include "targets.h"

#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)
#if defined(RADIO_SX127X)
#include "SX127xDriver.h"
#elif defined(Regulatory_Domain_ISM_2400)
#elif defined(RADIO_SX128X)
#include "SX1280Driver.h"
#else
#error "Radio configuration is not valid!"
Expand Down Expand Up @@ -122,15 +122,14 @@ typedef struct expresslrs_mod_settings_s
} expresslrs_mod_settings_t;

#ifndef UNIT_TEST
#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)
#if defined(RADIO_SX127X)
#define RATE_MAX 4
#define RATE_DEFAULT 0
#define RATE_BINDING 2 // 50Hz bind mode

extern SX127xDriver Radio;

#elif defined(Regulatory_Domain_ISM_2400)
#elif defined(RADIO_SX128X)
#define RATE_MAX 4
#define RATE_DEFAULT 0
#define RATE_BINDING 2 // 50Hz bind mode
Expand Down
2 changes: 2 additions & 0 deletions src/include/native.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <math.h>
#include <sys/time.h>

#define RADIO_SX128X 1

typedef uint8_t byte;

#define HEX 16
Expand Down
3 changes: 1 addition & 2 deletions src/include/target/AXIS_THOR_2400_RX.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define DEVICE_NAME "AXIS THOR 2400RX"

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -13,5 +14,3 @@
#endif

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/AXIS_THOR_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,3 @@
#define MaxPower PWR_1000mW
#define DefaultPower PWR_10mW
#define POWER_OUTPUT_VALUES {-16,-12,-9,-6,-2,0,7}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/BETAFPV_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@

// Output Power
#define POWER_OUTPUT_FIXED 1 // -10=10mW, -6=25mW, -3=50mW, 1=100mW

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/BETAFPV_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_500mW
#define POWER_OUTPUT_VALUES {-18,-15,-13,-9,-4,3}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/BETAFPV_2400_TX_MICRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@

/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {2839, 2191, 1616, 3511, 0, 4095}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/DIY_2400_RX_ESP8285_SX1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@
#endif

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/DIY_2400_RX_PWMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
#else
#define GPIO_PIN_PWM_OUTPUTS {0, 1, 3, 9, 10}
#endif

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/DIY_2400_RX_STM32_CCG_Nano_v0_5.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@
#define GPIO_PIN_LED_RED PB5

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/DIY_2400_TX_DUPLETX_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#endif

// Any device features
#define USE_TX_BACKPACK
#define USE_SX1280_DCDC
#define USE_TX_BACKPACK
#define USE_SKY85321
#define SKY85321_PDET_SLOPE 0.035
#define SKY85321_PDET_INTERCEPT 2.4
Expand Down Expand Up @@ -35,5 +35,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-17,-13,-9,-6,-2}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/DIY_2400_TX_ESP32_SX1280_E28.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#endif

// Any device features
#define USE_SX1280_DCDC
#if !defined(USE_OLED_I2C)
#define USE_OLED_SPI
#endif
#define USE_SX1280_DCDC

// GPIO pin definitions
#define GPIO_PIN_NSS 5
Expand Down Expand Up @@ -38,5 +38,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-15,-11,-8,-5,-1}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/DIY_2400_TX_ESP32_SX1280_Mini.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_25mW
#define POWER_OUTPUT_VALUES {8, 13}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/DIY_2400_TX_ESP8285_SX1280.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_10mW
#define POWER_OUTPUT_VALUES {13}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/FM30_RX_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,3 @@
#define POWER_OUTPUT_FIXED -1 // 100mW (uses values as above)
#endif
#endif

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/FM30_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@
#define HighPower PWR_100mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-15,-11,-7,-1,6}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/GHOST_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,3 @@
/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {459, 509, 326, 182, 91, 1021}
#endif

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/GHOST_ATTO_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@
//#define GPIO_PIN_BUTTON PA12

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/HGLRC_Hermes_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-18,-15,-11,-8,-4}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/HappyModel_ES24TX_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#endif

// Any device features
#define USE_TX_BACKPACK
#define USE_SX1280_DCDC
#define USE_TX_BACKPACK

// GPIO pin definitions
#define GPIO_PIN_NSS 5
Expand All @@ -25,5 +25,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-17,-13,-9,-6,-2}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/HappyModel_ES24TX_Pro_Series_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#endif

// Any device features
#define USE_TX_BACKPACK
#define USE_SX1280_DCDC
#define USE_TX_BACKPACK
#define WS2812_IS_GRB

// GPIO pin definitions
Expand All @@ -26,5 +26,3 @@
#define MinPower PWR_25mW
#define MaxPower PWR_1000mW
#define POWER_OUTPUT_VALUES {-18,-15,-12,-7,-4,2}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/Jumper_AION_2400_T-Pro_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

// Backpack pins
#define GPIO_PIN_DEBUG_RX 13
#define GPIO_PIN_DEBUG_TX 12
#define GPIO_PIN_DEBUG_TX 12

// Output Power
#define MinPower PWR_25mW
#define MaxPower PWR_1000mW
#define POWER_OUTPUT_VALUES {-18,-13,-10,-5,-2,3}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/Jumper_AION_NANO_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#endif

// Any device features
#define USE_OLED_I2C
#define USE_SX1280_DCDC
#define USE_OLED_I2C
#define HAS_FIVE_WAY_BUTTON
#define WS2812_IS_GRB

Expand Down Expand Up @@ -36,5 +36,3 @@
/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {870, 600, 230, 35, 0, 4095}
#endif

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/MATEK_2400_RX.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DEVICE_NAME
#define DEVICE_NAME "MATEK R24"
#endif

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -18,5 +19,3 @@

// Output Power
#define POWER_OUTPUT_FIXED 3

#define Regulatory_Domain_ISM_2400 1
3 changes: 0 additions & 3 deletions src/include/target/NamimnoRC_FLASH_2400_OLED_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,3 @@

/* Joystick values {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}*/
#define JOY_ADC_VALUES {1850, 900, 490, 1427, 0, 2978}

/* Frequency */
#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/NamimnoRC_FLASH_2400_RX_ESP8285.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define DEVICE_NAME "Namimno 2400RX"

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_BUSY 5
Expand All @@ -15,5 +16,3 @@
#endif

// Output Power - use default SX1280

#define Regulatory_Domain_ISM_2400 1
3 changes: 1 addition & 2 deletions src/include/target/NamimnoRC_FLASH_2400_RX_STM32.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DEVICE_NAME
#define DEVICE_NAME "Namimno 2G4RX"
#endif

// GPIO pin definitions
#define GPIO_PIN_RST PB4
#define GPIO_PIN_BUSY PB5
Expand All @@ -16,5 +17,3 @@
#define GPIO_PIN_RCSIGNAL_TX PA9

// Output Power - default for SX120

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/NamimnoRC_FLASH_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@
#define MinPower PWR_25mW
#define MaxPower PWR_1000mW
#define POWER_OUTPUT_VALUES {-18,-15,-12,-8,-5,3}

#define Regulatory_Domain_ISM_2400 1
1 change: 1 addition & 0 deletions src/include/target/NamimnoRC_VOYAGER_900_ESP_RX.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DEVICE_NAME
#define DEVICE_NAME "Namimno 900RX"
#endif

// GPIO pin definitions
#define GPIO_PIN_NSS 15
#define GPIO_PIN_DIO0 5
Expand Down
1 change: 1 addition & 0 deletions src/include/target/NamimnoRC_VOYAGER_900_RX.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DEVICE_NAME
#define DEVICE_NAME "Namimno 900RX"
#endif

// GPIO pin definitions
#define GPIO_PIN_RST PC14
#define GPIO_PIN_DIO0 PA15
Expand Down
2 changes: 0 additions & 2 deletions src/include/target/QuadKopters_JR_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-15,-11,-8,-5,0}

#define Regulatory_Domain_ISM_2400 1
4 changes: 1 addition & 3 deletions src/include/target/RadioMaster_Zorro_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// Copied from DupleTX

// Any device features
#define USE_TX_BACKPACK
#define USE_SX1280_DCDC
#define USE_SKY85321
#define SKY85321_PDET_SLOPE 0.035
#define SKY85321_PDET_INTERCEPT 2.4
#define USE_TX_BACKPACK

// GPIO pin definitions
#define GPIO_PIN_NSS 5
Expand Down Expand Up @@ -36,5 +36,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_250mW
#define POWER_OUTPUT_VALUES {-17,-13,-9,-6,-2}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/Vantac_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@

// Output Power
#define POWER_OUTPUT_FIXED 1 // -10=10mW, -6=25mW, -3=50mW, 1=100mW

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/Vantac_Lite_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_500mW
#define POWER_OUTPUT_VALUES {-17,-14,-11,-7,-1,2}

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/iFlight_2400_RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@

// Output Power
#define POWER_OUTPUT_FIXED 3

#define Regulatory_Domain_ISM_2400 1
2 changes: 0 additions & 2 deletions src/include/target/iFlight_2400_TX.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@
#define MinPower PWR_10mW
#define MaxPower PWR_500mW
#define POWER_OUTPUT_VALUES {-18,-15,-13,-9,-4,3}

#define Regulatory_Domain_ISM_2400 1
17 changes: 9 additions & 8 deletions src/include/targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,23 @@
#endif
#endif

#if defined(Regulatory_Domain_EU_CE_2400) && !defined(Regulatory_Domain_ISM_2400)
#define Regulatory_Domain_ISM_2400
#endif

#if defined(Regulatory_Domain_ISM_2400)
// ISM 2400 band is use => undefine other requlatory domain defines
#if defined(RADIO_SX128X)
#define Regulatory_Domain_ISM_2400 1
// ISM 2400 band is in use => undefine other requlatory domain defines
#undef Regulatory_Domain_AU_915
#undef Regulatory_Domain_EU_868
#undef Regulatory_Domain_IN_866
#undef Regulatory_Domain_FCC_915
#undef Regulatory_Domain_AU_433
#undef Regulatory_Domain_EU_433

#elif !(defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_FCC_915) || \
#elif defined(RADIO_SX127X)
#if !(defined(Regulatory_Domain_AU_915) || defined(Regulatory_Domain_FCC_915) || \
defined(Regulatory_Domain_EU_868) || defined(Regulatory_Domain_IN_866) || \
defined(Regulatory_Domain_AU_433) || defined(Regulatory_Domain_EU_433) || \
defined(UNIT_TEST))
#error "Regulatory_Domain is not defined for 900MHz devices. Check user_defines.txt!"
#error "Regulatory_Domain is not defined for 900MHz device. Check user_defines.txt!"
#endif
#else
#error "Either RADIO_SX127X or RADIO_SX128X must be defined!"
#endif
8 changes: 1 addition & 7 deletions src/lib/BLE/devBLE.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#include "common.h"
#include "devBLE.h"

#if defined(PLATFORM_ESP32)

#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)
extern SX127xDriver Radio;
#elif defined(Regulatory_Domain_ISM_2400)
extern SX1280Driver Radio;
#endif

#include "common.h"
#include "CRSF.h"
#include "POWERMGNT.h"
#include "hwTimer.h"
Expand Down