Skip to content

Commit

Permalink
Initial support of Fatfish F16 radio
Browse files Browse the repository at this point in the history
  • Loading branch information
richardclli committed Jan 1, 2024
1 parent 795789a commit b6973ea
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ body:
options:
- BetaFPV LiteRadio3 Pro
- iFlight Commando8
- Fatfish F16
- Flysky EL18
- Flysky NV14
- FrSky Q X7 / Q X7S (ACCST)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
- t20
- tx12;tx12mk2;boxer
- tx16s
- f16
- x10;x10-access
- x12s
- x7;x7-access
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- t20
- tx12;tx12mk2;boxer
- tx16s
- f16
- x10;x10-access
- x12s
- x7;x7-access
Expand Down
1 change: 1 addition & 0 deletions fw.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"targets": [
["BETAFPV LiteRadio 3 Pro", "lr3pro-"],
["Fatfish F16","f16-"],
["Flysky EL18", "el18-"],
["Flysky NV14", "nv14-"],
["Flysky PL18", "pl18-"],
Expand Down
2 changes: 1 addition & 1 deletion radio/src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void audioTask(void * pdata)

setSampleRate(AUDIO_SAMPLE_RATE);

#if defined(PCBX12S) || defined(RADIO_TX16S)
#if defined(PCBX12S) || defined(RADIO_TX16S) || defined(RADIO_F16)
// The audio amp needs ~2s to start
RTOS_WAIT_MS(1000); // 1s
#endif
Expand Down
11 changes: 11 additions & 0 deletions radio/src/targets/horus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ if (PCB STREQUAL X10)
set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
set(FLYSKY_GIMBAL ON)
set(FLEXSW "2" CACHE STRING "Max flex inputs usable as switches")
elseif (PCBREV STREQUAL F16)
set(FLAVOUR f16)
add_definitions(-DRADIO_F16)
add_definitions(-DRADIO_FAMILY_T16)
set(DEFAULT_INTERNAL_MODULE MULTIMODULE CACHE STRING "Default internal module")
option(BLUETOOTH "Support for bluetooth module" OFF)
option(INTERNAL_GPS "Support for internal NMEA GPS" OFF)
set(DEFAULT_THEME "DARKBLUE")
add_definitions(-DMANUFACTURER_FATFISH)
set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
set(FLEXSW "2" CACHE STRING "Max flex inputs usable as switches")
elseif (PCBREV STREQUAL T18)
set(FLAVOUR t18)
add_definitions(-DRADIO_T18)
Expand Down
6 changes: 3 additions & 3 deletions radio/src/targets/horus/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void SDRAM_Init();
#endif

// POTS and SLIDERS default configuration
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define XPOS_CALIB_DEFAULT {0x3, 0xc, 0x15, 0x1e, 0x26}
#endif

Expand Down Expand Up @@ -291,7 +291,7 @@ void telemetryPortInvertedInit(uint32_t baudrate);


// Aux serial port driver
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define DEBUG_BAUDRATE 400000
#define LUA_DEFAULT_BAUDRATE 115200
#else
Expand All @@ -318,7 +318,7 @@ void bluetoothWriteWakeup();
uint8_t bluetoothIsWriting();
void bluetoothDisable();

#if defined (RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define BATTERY_DIVIDER 1495
#else
#define BATTERY_DIVIDER 1629
Expand Down
18 changes: 9 additions & 9 deletions radio/src/targets/horus/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_6 // PI.06
#define KEYS_GPIO_REG_TELE GPIOC
#define KEYS_GPIO_PIN_TELE LL_GPIO_PIN_4 // PC.04
#elif defined(RADIO_TX16S)
#elif defined(RADIO_TX16S) || defined(RADIO_F16)
#define KEYS_GPIO_REG_ENTER GPIOI
#define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_8 // PI.08
#define KEYS_GPIO_REG_PAGEUP GPIOC
Expand Down Expand Up @@ -204,7 +204,7 @@
#define TRIMS_GPIO_REG_LSU GPIOB
#define TRIMS_GPIO_PIN_LSU LL_GPIO_PIN_13 // PB.13
#elif defined(PCBX10)
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define TRIMS_GPIO_REG_LHL GPIOA
#define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_6 // PA.06
#define TRIMS_GPIO_REG_LHR GPIOC
Expand Down Expand Up @@ -302,7 +302,7 @@
#define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_9 // PF.09
#define ADC_GPIO_PIN_EXT3 ADC_GPIO_PIN_STICK_RH
#define ADC_GPIO_PIN_EXT4 ADC_GPIO_PIN_STICK_RV
#if !defined(RADIO_TX16S)
#if !(defined(RADIO_TX16S) || defined(RADIO_F16))
#define PWM_STICKS
#define PWM_TIMER TIM5
#define PWM_GPIO GPIOA
Expand Down Expand Up @@ -346,7 +346,7 @@
#define ADC_DMA_STREAM_IRQHandler DMA2_Stream0_IRQHandler

// VBat divider is /4 on F42x and F43x devices
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define ADC_VREF_PREC2 660
#elif defined(RADIO_T16) || defined(RADIO_T18)
#define ADC_VREF_PREC2 600
Expand All @@ -359,7 +359,7 @@
#define ADC_DIRECTION {1,-1,1,-1, 1,1,1, -1,1,1,1, -1,1 }
#elif defined(RADIO_T18)
#define ADC_DIRECTION {1,-1,1,-1, -1,1,-1, -1,1,1,1, -1,1 }
#elif defined(RADIO_TX16S)
#elif defined(RADIO_TX16S) || defined(RADIO_F16)
#define ADC_DIRECTION {1,-1,1,-1, 1,1,1, -1,1,1,1, -1,1 }
#elif defined(PCBX10)
#define ADC_DIRECTION {1,-1,1,-1, -1,1,-1, 1,-1,1,1, 1,-1 }
Expand Down Expand Up @@ -462,7 +462,7 @@
#define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1
#define AUX_SERIAL_DMA_Stream_RX_LL LL_DMA_STREAM_1
#define AUX_SERIAL_DMA_Channel_RX LL_DMA_CHANNEL_4
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define AUX_SERIAL_PWR_GPIO GPIOA
#define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PA.15
#endif
Expand Down Expand Up @@ -728,7 +728,7 @@
#endif

#if defined(RADIO_FAMILY_T16)
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define AUDIO_UNMUTE_DELAY 150 // ms
#else
#define AUDIO_UNMUTE_DELAY 120 // ms
Expand Down Expand Up @@ -766,7 +766,7 @@
#endif // HARDWARE_TOUCH

// First I2C Bus
#if defined(RADIO_TX16S) || defined(PCBX12S)
#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(PCBX12S)
#define I2C_B1 I2C1
#define I2C_B1_GPIO GPIOB
#define I2C_B1_SCL_GPIO_PIN LL_GPIO_PIN_8 // PB.08
Expand All @@ -787,7 +787,7 @@
#define I2C_B2_SCL_GPIO_PIN LL_GPIO_PIN_10 // PB.10
#define I2C_B2_SDA_GPIO_PIN LL_GPIO_PIN_11 // PB.11
#define I2C_B2_GPIO_AF LL_GPIO_AF_4 // I2C2
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define I2C_B2_PWR_GPIO GPIOA
#define I2C_B2_PWR_GPIO_PIN LL_GPIO_PIN_15 // PA.15
#endif
Expand Down
2 changes: 1 addition & 1 deletion radio/src/targets/horus/lcd_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void LCD_Init_LTDC()
clkConfig.PLLSAI.PLLSAIN = 192;
clkConfig.PLLSAI.PLLSAIR = 3;
clkConfig.PLLSAIDivQ = 6;
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
clkConfig.PLLSAIDivR = RCC_PLLSAIDIVR_8;
#else
clkConfig.PLLSAIDivR = RCC_PLLSAIDIVR_4;
Expand Down
4 changes: 4 additions & 0 deletions radio/src/targets/horus/usb_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#define USB_NAME "RM TX16S"
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
#define USB_PRODUCT 'R', 'M', ' ', 'T', 'X', '1', '6', 'S' /* 8 Bytes */
#elif defined(RADIO_F16)
#define USB_NAME "FF F16"
#define USB_MANUFACTURER 'F', 'A', 'T', 'F', 'I', 'S', 'H', ' ' /* 8 bytes */
#define USB_PRODUCT 'F', 'F', ' ', 'F', '1', '6', ' ', ' ' /* 8 Bytes */
#elif defined(PCBX10)
#define USB_NAME "FrSky X10"
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
Expand Down
2 changes: 1 addition & 1 deletion radio/src/telemetry/frsky.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum FrSkyDataState {
};

#define FRSKY_SPORT_BAUDRATE 57600
#if defined(RADIO_TX16S)
#if defined(RADIO_TX16S) || defined(RADIO_F16)
#define FRSKY_TELEM_MIRROR_BAUDRATE 115200
#else
#define FRSKY_TELEM_MIRROR_BAUDRATE FRSKY_SPORT_BAUDRATE
Expand Down
5 changes: 5 additions & 0 deletions radio/util/build-firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ def main():
cmake_options["PCBREV"] = "TX16S"
firmware_options = options_radiomaster_tx16s
maxsize = 2 * 1024 * 1024
elif board_name == "f16":
cmake_options["PCB"] = "X10"
cmake_options["PCBREV"] = "F16"
firmware_options = options_fatfish_f16
maxsize = 2 * 1024 * 1024
else:
return INVALID_BOARD

Expand Down
13 changes: 13 additions & 0 deletions radio/util/fwoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,19 @@
"externalaccessmod": ("HARDWARE_EXTERNAL_ACCESS_MOD", "YES", "NO"),
}

options_fatfish_f16 = {
"noheli": ("HELI", "NO", "YES"),
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
"nogvars": ("GVARS", "NO", "YES"),
"faimode": ("FAI", "YES", None),
"faichoice": ("FAI", "CHOICE", None),
"nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"),
"flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None),
"bluetooth": ("BLUETOOTH", "YES", "NO"),
"internalgps": ("INTERNAL_GPS", "YES", "NO"),
"externalaccessmod": ("HARDWARE_EXTERNAL_ACCESS_MOD", "YES", "NO"),
}

options_commando8_t8 = {
"noheli": ("HELI", "NO", "YES"),
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
Expand Down
2 changes: 1 addition & 1 deletion radio/util/hw_defs/legacy_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LEGACY_NAMES = [
{
"targets": {"x10", "x10express", "t16", "tx16s", "t18"},
"targets": {"x10", "x10express", "t16", "tx16s", "t18", "f16"},
"inputs": {
"LH": {
"yaml": "Rud"
Expand Down
7 changes: 7 additions & 0 deletions radio/util/hw_defs/pot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
"SL1": {"default": "SLIDER"},
"SL2": {"default": "SLIDER"}
},
"f16": {
"P1": {"default": "POT_CENTER"},
"P2": {"default": "MULTIPOS"},
"P3": {"default": "POT_CENTER"},
"SL1": {"default": "SLIDER"},
"SL2": {"default": "SLIDER"}
},
"x7": {
"P1": {"default": "POT"},
"P2": {"default": "POT_CENTER"}
Expand Down
10 changes: 10 additions & 0 deletions radio/util/hw_defs/switch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@
"SG": {"default": "3POS"},
"SH": {"default": "TOGGLE"}
},
"f16": {
"SA": {"default": "3POS"},
"SB": {"default": "3POS"},
"SC": {"default": "3POS"},
"SD": {"default": "3POS"},
"SE": {"default": "3POS"},
"SF": {"default": "2POS"},
"SG": {"default": "3POS"},
"SH": {"default": "TOGGLE"}
},
"tx12mk2": {
# left side
"SA": {"default": "TOGGLE", "display": [0, 0]},
Expand Down
5 changes: 5 additions & 0 deletions tools/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"PCBREV": "TX16S",
"INTERNAL_MODULE_MULTI": "YES"
},
"F16": {
"PCB": "X10",
"PCBREV": "F16",
"INTERNAL_MODULE_MULTI": "YES"
},
"T12": {
"PCB": "X7",
"PCBREV": "T12",
Expand Down
3 changes: 3 additions & 0 deletions tools/build-gh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ do
tx16s)
BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S"
;;
f16)
BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=F16"
;;
nv14)
BUILD_OPTIONS+="-DPCB=NV14"
;;
Expand Down

0 comments on commit b6973ea

Please sign in to comment.