From d0cba7ac012904ed73a8717fc5d572ec18e456ad Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 27 Mar 2024 15:01:08 +0800 Subject: [PATCH 01/36] Initial support of NB4+ --- fw.json | 1 + radio/src/datastructs.h | 8 +++- radio/src/targets/pl18/CMakeLists.txt | 5 +- radio/src/targets/pl18/hal.h | 16 +++++-- radio/src/targets/pl18/lcd_driver.cpp | 39 +++++++++++----- radio/src/targets/pl18/usb_descriptor.h | 20 ++++---- radio/util/hw_defs/legacy_names.py | 62 +++++++++++++++++++++++++ radio/util/hw_defs/pot_config.py | 7 +++ radio/util/hw_defs/switch_config.py | 10 ++++ tools/build-common.sh | 3 ++ 10 files changed, 143 insertions(+), 28 deletions(-) diff --git a/fw.json b/fw.json index f836ad03335..e38488b64ee 100644 --- a/fw.json +++ b/fw.json @@ -6,6 +6,7 @@ ["Flysky NV14", "nv14-"], ["Flysky PL18", "pl18-"], ["Flysky PL18EV", "pl18ev-"], + ["Flysky NB4+", "nb4p-"], ["FrSky Horus X10", "x10-"], ["FrSky Horus X10 Express", "x10express-"], ["FrSky Horus X12s", "x12s-"], diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index f20d1f0318c..5d48b1d6786 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -73,7 +73,7 @@ static inline void check_struct() CHKSIZE(TimerData, 17); CHKSIZE(ModelHeader, 131); CHKSIZE(CustomScreenData, 1892); - #if defined(PCBNV14) + #if defined(PCBNV14) || defined(RADIO_NB4P) CHKTYPE(TopBarPersistentData, 704); #else CHKTYPE(TopBarPersistentData, 1048); @@ -105,7 +105,11 @@ static inline void check_struct() #elif defined(PCBNV14) CHKSIZE(ModelData, 26463); #elif defined(PCBPL18) - CHKSIZE(ModelData, 26845); + #if defined(RADIO_NB4P) + CHKSIZE(ModelData, 26499); + #else + CHKSIZE(ModelData, 26845); + #endif #elif defined(RADIO_T15) CHKSIZE(ModelData, 26834); #elif defined(PCBHORUS) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 9d4393ad9db..82820074ab2 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -40,7 +40,10 @@ add_definitions(-DSOFTWARE_VOLUME) add_definitions(-DSPI_FLASH) add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) -if(PCBREV STREQUAL PL18EV) +if(PCBREV STREQUAL NB4P) + set(FLAVOUR nb4p) + add_definitions(-DRADIO_NB4P) +elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) add_definitions(-DRADIO_PL18EV) else() diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index c5c47c9594e..949d1813bf5 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -641,11 +641,17 @@ // SDRAM #define SDRAM_BANK1 -#define PORTRAIT_LCD false -#define LANDSCAPE_LCD true - -#define LCD_W 480 -#define LCD_H 320 +#if defined(RADIO_NB4P) + #define PORTRAIT_LCD true + #define LANDSCAPE_LCD false + #define LCD_W 320 + #define LCD_H 480 +#else + #define PORTRAIT_LCD false + #define LANDSCAPE_LCD true + #define LCD_W 480 + #define LCD_H 320 +#endif #define LCD_PHYS_W 320 #define LCD_PHYS_H 480 diff --git a/radio/src/targets/pl18/lcd_driver.cpp b/radio/src/targets/pl18/lcd_driver.cpp index 6b398fb3ff8..070bdb5f19a 100644 --- a/radio/src/targets/pl18/lcd_driver.cpp +++ b/radio/src/targets/pl18/lcd_driver.cpp @@ -1150,18 +1150,33 @@ void LCD_ST7796S_Init(void) { lcdWriteData( 0x96 ); lcdWriteCommand( 0x36 ); - lcdWriteData( 0x28 ); - - lcdWriteCommand( 0x2A ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x01 ); - lcdWriteData( 0xDF ); - lcdWriteCommand( 0x2B ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x00 ); - lcdWriteData( 0x01 ); - lcdWriteData( 0x3F ); + if (LCD_W != LCD_PHYS_W) { + lcdWriteData( 0x28 ); + + lcdWriteCommand( 0x2A ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0xDF ); + lcdWriteCommand( 0x2B ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0x3F ); + } else { + lcdWriteData( 0x88 ); + + lcdWriteCommand( 0x2A ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0x3F ); + lcdWriteCommand( 0x2B ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x00 ); + lcdWriteData( 0x01 ); + lcdWriteData( 0xDF ); + } lcdWriteCommand( 0x3A ); lcdWriteData( 0x66 ); diff --git a/radio/src/targets/pl18/usb_descriptor.h b/radio/src/targets/pl18/usb_descriptor.h index 27ec010c9a5..3e5c3293fa4 100644 --- a/radio/src/targets/pl18/usb_descriptor.h +++ b/radio/src/targets/pl18/usb_descriptor.h @@ -21,12 +21,16 @@ #pragma once -#if defined(RADIO_PL18EV) -#define USB_NAME "FlySky PL18EV" -#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ -#define USB_PRODUCT 'P', 'L', '1', '8', 'E', 'V', ' ', ' ' /* 8 Bytes */ -#else -#define USB_NAME "FlySky PL18" -#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ -#define USB_PRODUCT 'P', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#if defined(RADIO_NB4P) + #define USB_NAME "FlySky NB4+" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'N', 'B', '4', '+', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_PL18EV) + #define USB_NAME "FlySky PL18EV" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'P', 'L', '1', '8', 'E', 'V', ' ', ' ' /* 8 Bytes */ +#else + #define USB_NAME "FlySky PL18" + #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'P', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ #endif diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index 76f2c70b475..d2a79df8531 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -626,6 +626,68 @@ } } }, + { + "targets": { + "nb4p" + }, + "inputs": { + "LH": { + "yaml": "Rud", + "lua": "rud", + "description": "Rudder" + }, + "LV": { + "yaml": "Ele", + "lua": "ele", + "description": "Elevator" + }, + "RV": { + "yaml": "Thr", + "lua": "thr", + "description": "Throttle" + }, + "RH": { + "yaml": "Ail", + "lua": "ail", + "description": "Aileron" + }, + "P1": { + "yaml": "POT1", + "lua": "s1", + "label": "S1", + "short_label": "1", + "description": "Potentiometer 1" + }, + "P2": { + "yaml": "POT2", + "lua": "s2", + "label": "S2", + "short_label": "2", + "description": "Potentiometer 2" + }, + "P3": { + "yaml": "POT3", + "lua": "s3", + "label": "S3", + "short_label": "3", + "description": "Potentiometer 3" + }, + "SL1": { + "yaml": "LS", + "lua": "ls", + "label": "LS", + "short_label": "L", + "description": "Left slider" + }, + "SL2": { + "yaml": "RS", + "lua": "rs", + "label": "RS", + "short_label": "R", + "description": "Right slider" + }, + } + }, { "targets": {"v12", "v14"}, "inputs": { diff --git a/radio/util/hw_defs/pot_config.py b/radio/util/hw_defs/pot_config.py index 2d3159065cf..1b63b707b3f 100644 --- a/radio/util/hw_defs/pot_config.py +++ b/radio/util/hw_defs/pot_config.py @@ -32,6 +32,13 @@ "EXT3": {"default": "MULTIPOS"}, "EXT4": {"default": "MULTIPOS"} }, + "nb4p": { + "P1": {"default": "POT"}, + "P2": {"default": "POT"}, + "P3": {"default": "POT"}, + "SL1": {"default": "SLIDER"}, + "SL2": {"default": "SLIDER"} + }, "v12": { "P1": {"default": "POT_CENTER"}, "P2": {"default": "POT_CENTER"}, diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index 8dd9a8f55f7..950c933c6c3 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -51,6 +51,16 @@ "SI": { "default": "3POS" }, "SJ": { "default": "3POS" } }, + "nb4p": { + "SA": { "default": "2POS" }, + "SB": { "default": "3POS" }, + "SC": { "default": "2POS" }, + "SD": { "default": "3POS" }, + "SE": { "default": "3POS" }, + "SF": { "default": "2POS" }, + "SG": { "default": "3POS" }, + "SH": { "default": "TOGGLE" } + }, "lr3pro": { # left side "SA": {"default": "3POS", "display": [0, 0]}, diff --git a/tools/build-common.sh b/tools/build-common.sh index d1c8cd23d3b..7e1e281a07f 100644 --- a/tools/build-common.sh +++ b/tools/build-common.sh @@ -140,6 +140,9 @@ get_target_build_options() { pl18ev) BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" ;; + nb4p) + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=NB4P" + ;; *) echo "Unknown target: $target_name" return 1 From eb0ffa4012658e32b2cd828d2e37c0f429e981b2 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Fri, 29 Mar 2024 17:18:57 +0800 Subject: [PATCH 02/36] Current works: LCD, touch, ST, TH, some switches --- radio/src/targets/pl18/CMakeLists.txt | 7 +- radio/src/targets/pl18/backlight_driver.cpp | 8 +- radio/src/targets/pl18/battery_driver.cpp | 2 + radio/src/targets/pl18/battery_driver.h | 6 +- radio/src/targets/pl18/board.cpp | 10 ++- radio/src/targets/pl18/hal.h | 87 ++++++++++++++++++++- radio/src/targets/pl18/key_driver.cpp | 4 + radio/src/targets/pl18/touch_driver.cpp | 48 +++++++++--- radio/util/hw_defs/legacy_names.py | 45 ++++------- radio/util/hw_defs/pot_config.py | 3 +- radio/util/hw_defs/switch_config.py | 8 +- 11 files changed, 168 insertions(+), 60 deletions(-) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 82820074ab2..501a3b7c427 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -18,7 +18,6 @@ set(RTC_BACKUP_RAM YES) set(PPM_LIMITS_SYMETRICAL YES) set(USB_SERIAL ON CACHE BOOL "Enable USB serial (CDC)") set(HARDWARE_EXTERNAL_MODULE YES) -set(WIRELESS_CHARGER YES) #option(STICKS_DEAD_ZONE "Enable sticks dead zone" YES) #option(AFHDS2 "Support for AFHDS2" OFF) @@ -46,9 +45,14 @@ if(PCBREV STREQUAL NB4P) elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) add_definitions(-DRADIO_PL18EV) + set(WIRELESS_CHARGER YES) + set(FLYSKY_GIMBAL ON) + set(ROTARY_ENCODER YES) else() set(FLAVOUR pl18) add_definitions(-DRADIO_PL18) + set(WIRELESS_CHARGER YES) + set(FLYSKY_GIMBAL ON) # Defines internal modules for PL18 via UART7 set(INTERNAL_MODULES MULTI CACHE STRING "Internal modules") @@ -65,7 +69,6 @@ set(FIRMWARE_DEPENDENCIES datacopy) set(HARDWARE_TOUCH ON) set(SOFTWARE_KEYBOARD ON) -set(FLYSKY_GIMBAL ON) add_definitions( -DSTM32F429_439xx -DSTM32F429xx diff --git a/radio/src/targets/pl18/backlight_driver.cpp b/radio/src/targets/pl18/backlight_driver.cpp index 3f72815f64a..38216247b6e 100644 --- a/radio/src/targets/pl18/backlight_driver.cpp +++ b/radio/src/targets/pl18/backlight_driver.cpp @@ -40,13 +40,12 @@ void backlightInit() // PIN init gpio_init_af(BACKLIGHT_GPIO, BACKLIGHT_GPIO_AF, GPIO_PIN_SPEED_LOW); - // TODO review this when the timer will be chosen stm32_timer_enable_clock(BACKLIGHT_TIMER); BACKLIGHT_TIMER->ARR = 100; BACKLIGHT_TIMER->PSC = BACKLIGHT_TIMER_FREQ / 1000000 - 1; // 10kHz (same as FrOS) BACKLIGHT_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE; // PWM mode 1 BACKLIGHT_TIMER->CCER = TIM_CCER_CC1E | TIM_CCER_CC1NE; - BACKLIGHT_TIMER->CCR1 = 100; // 100% on init + BACKLIGHT_TIMER->CCR1 = 0; BACKLIGHT_TIMER->EGR = TIM_EGR_UG; BACKLIGHT_TIMER->CR1 |= TIM_CR1_CEN; // Counter enable BACKLIGHT_TIMER->BDTR |= TIM_BDTR_MOE; @@ -68,6 +67,11 @@ void backlightEnable(uint8_t dutyCycle) lastDutyCycle = dutyCycle; } +void backlightFullOn() +{ + backlightEnable(BACKLIGHT_LEVEL_MAX); +} + void lcdOff() { backlightEnable(0); } diff --git a/radio/src/targets/pl18/battery_driver.cpp b/radio/src/targets/pl18/battery_driver.cpp index f0ad2a93eeb..aa9797d35ea 100644 --- a/radio/src/targets/pl18/battery_driver.cpp +++ b/radio/src/targets/pl18/battery_driver.cpp @@ -273,7 +273,9 @@ void battery_charge_init() // USB charger control pins +#if defined(UCHARGER_EN_GPIO) gpio_init(UCHARGER_EN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); +#endif // USB charger state init ENABLE_UCHARGER(); diff --git a/radio/src/targets/pl18/battery_driver.h b/radio/src/targets/pl18/battery_driver.h index 60460686c9f..020b8a4a235 100644 --- a/radio/src/targets/pl18/battery_driver.h +++ b/radio/src/targets/pl18/battery_driver.h @@ -44,9 +44,13 @@ enum ChargeState #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 +#if defined(UCHARGER_EN_GPIO) #define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) #define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) - +#else +#define ENABLE_UCHARGER() +#define DISABLE_UCHARGER() +#endif #define IS_WCHARGER_ACTIVE() gpio_read(WCHARGER_GPIO) ? 1 : 0 #define IS_WCHARGER_CHARGE_END_ACTIVE() gpio_read(WCHARGER_CHARGE_END_GPIO) ? 1 : 0 #define ENABLE_WCHARGER() gpio_set(WCHARGER_EN_GPIO) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 0fcb42f0360..db13ffbfd39 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -42,7 +42,9 @@ #include "touch.h" #include "debug.h" -#include "flysky_gimbal_driver.h" +#if defined(FLYSKY_GIMBAL) + #include "flysky_gimbal_driver.h" +#endif #include "timers_driver.h" #include "battery_driver.h" @@ -109,7 +111,11 @@ void boardInit() board_trainer_init(); battery_charge_init(); - flysky_gimbal_init(); + + #if defined(FLYSKY_GIMBAL) + flysky_gimbal_init(); + #endif + timersInit(); touchPanelInit(); usbInit(); diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 949d1813bf5..7f45a549eac 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -51,6 +51,7 @@ // PL18/PL18EV only has virtual keys via trim buttons // #define KEYS_GPIO_PIN_PGUP /* for activating PGUP in keys diagnose screen */ +#if !defined(RADIO_NB4P) // Trims #define TRIMS_GPIO_REG_LHL #define TRIMS_GPIO_PIN_LHL @@ -303,16 +304,64 @@ } #endif +#else + #define ADC_RCC_AHB1Periph (RCC_AHB1Periph_DMA2) + #define ADC_RCC_APB1Periph 0 + #define ADC_RCC_APB2Periph 0 + #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 + #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 + #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 + #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 + #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 + #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 + #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 + #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_7 // PA.07 + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_POT3 LL_GPIO_PIN_6 // PA.06 + #define ADC_GPIO_PIN_POT4 LL_GPIO_PIN_4 // PC.04 + #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 + #define ADC_CHANNEL_POT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_POT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 + #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_POT3) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_SWA | ADC_GPIO_PIN_SWB | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_POT4 | ADC_GPIO_PIN_BATT) + +#define ADC_MAIN ADC1 +#define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES +#define ADC_DMA DMA2 +#define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 +#define ADC_DMA_STREAM LL_DMA_STREAM_4 +#define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn +#define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler + +#define ADC_VREF_PREC2 660 + +#define ADC_DIRECTION { \ + 0,0, /* gimbals */ \ + 0,0,0,0, /* pots */ \ + 0, /* vbat */ \ + 0, /* rtc_bat */ \ + 0, /* SWA */ \ + 0 /* SWB */ \ + } + +#endif + + // Power #define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 #define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 // Chargers (USB and wireless) #define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input - #define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input - -#define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output +#if defined(RADIO_PL18) || defined(RADIO_PL18EV) + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output +#endif #if defined (WIRELESS_CHARGER) #define WCHARGER_GPIO GPIO_PIN(GPIOI, 9) // PI.09 input @@ -416,7 +465,29 @@ //used in BOOTLOADER #define SERIAL_RCC_AHB1Periph 0 #define SERIAL_RCC_APB1Periph 0 + +#if defined(RADIO_NB4P) +// Rotary Encoder +#define ROTARY_ENCODER_RCC_APB1Periph RCC_APB1Periph_TIM12 +#define ROTARY_ENCODER_GPIO GPIOH +#define ROTARY_ENCODER_GPIO_PIN_A GPIO_Pin_11 // PH.11 +#define ROTARY_ENCODER_GPIO_PIN_B GPIO_Pin_10 // PH.10 +#define ROTARY_ENCODER_POSITION() ((ROTARY_ENCODER_GPIO->IDR >> 10) & 0x03) +#define ROTARY_ENCODER_EXTI_LINE1 LL_EXTI_LINE_11 +#define ROTARY_ENCODER_EXTI_LINE2 LL_EXTI_LINE_10 +#if !defined(USE_EXTI15_10_IRQ) + #define USE_EXTI15_10_IRQ + #define EXTI15_10_IRQ_Priority 5 +#endif +#define ROTARY_ENCODER_EXTI_PORT LL_SYSCFG_EXTI_PORTH +#define ROTARY_ENCODER_EXTI_SYS_LINE1 LL_SYSCFG_EXTI_LINE11 +#define ROTARY_ENCODER_EXTI_SYS_LINE2 LL_SYSCFG_EXTI_LINE10 +#define ROTARY_ENCODER_TIMER TIM12 +#define ROTARY_ENCODER_TIMER_IRQn TIM8_BRK_TIM12_IRQn +#define ROTARY_ENCODER_TIMER_IRQHandler TIM8_BRK_TIM12_IRQHandler +#else #define ROTARY_ENCODER_RCC_APB1Periph 0 +#endif // SPI NOR Flash #define FLASH_SPI SPI6 @@ -471,6 +542,15 @@ #endif // Haptic: TIM1_CH1 +#if defined(RADIO_NB4P) +#define HAPTIC_PWM +#define HAPTIC_GPIO GPIO_PIN(GPIOB, 0) // PB.00 +#define HAPTIC_GPIO_TIMER TIM1 +#define HAPTIC_GPIO_AF GPIO_AF1 +#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE; +#define HAPTIC_TIMER_MODE TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE +#define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR1 +#else #define HAPTIC_PWM #define HAPTIC_GPIO GPIO_PIN(GPIOA, 8) // PA.08 #define HAPTIC_GPIO_TIMER TIM1 @@ -478,6 +558,7 @@ #define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE; #define HAPTIC_TIMER_MODE TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE #define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR1 +#endif // Flysky Hall Stick #define FLYSKY_HALL_SERIAL_USART UART4 diff --git a/radio/src/targets/pl18/key_driver.cpp b/radio/src/targets/pl18/key_driver.cpp index 89f39913692..fefd7783d78 100644 --- a/radio/src/targets/pl18/key_driver.cpp +++ b/radio/src/targets/pl18/key_driver.cpp @@ -28,6 +28,8 @@ #include "delays_driver.h" #include "keys.h" +#if !defined(RADIO_NB4P) + /* The output bit-order has to be: 0 LHL TR7L (Left equals down) 1 LHR TR7R @@ -218,3 +220,5 @@ uint32_t readTrims() return result; } + +#endif diff --git a/radio/src/targets/pl18/touch_driver.cpp b/radio/src/targets/pl18/touch_driver.cpp index 8e09f810bd2..c2ca11cdc0a 100644 --- a/radio/src/targets/pl18/touch_driver.cpp +++ b/radio/src/targets/pl18/touch_driver.cpp @@ -74,12 +74,20 @@ const char TOUCH_CONTROLLER_STR[][10] = {"", "FT6236", "CST340", "CHSC5448"}; TouchController touchController = TC_NONE; +enum TouchRotate +{ + DEG_0, + DEG_90, + DEG_180, + DEG_270 +}; + struct TouchControllerDescriptor { bool (*hasTouchEvent)(); bool (*touchRead)(uint16_t * X, uint16_t * Y); void (*printDebugInfo)(); - bool needTranspose; + TouchRotate rotate; }; union rpt_point_t @@ -131,7 +139,7 @@ static void _i2c_init(void) static void _i2c_reInit(void) { - stm32_i2c_deinit(TOUCH_I2C_BUS); +// stm32_i2c_deinit(TOUCH_I2C_BUS); _i2c_init(); } @@ -283,7 +291,11 @@ static const TouchControllerDescriptor FT6236 = .hasTouchEvent = ft6236HasTouchEvent, .touchRead = ft6236TouchRead, .printDebugInfo = ft6236PrintDebugInfo, - .needTranspose = true, +#if defined(RADIO_NB4P) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif }; static const TouchControllerDescriptor CST340 = @@ -291,7 +303,11 @@ static const TouchControllerDescriptor CST340 = .hasTouchEvent = cst340HasTouchEvent, .touchRead = cst340TouchRead, .printDebugInfo = cst340PrintDebugInfo, - .needTranspose = true, +#if defined(RADIO_NB4P) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif }; static const TouchControllerDescriptor CHSC5448 = @@ -299,7 +315,7 @@ static const TouchControllerDescriptor CHSC5448 = .hasTouchEvent = chsc5448HasTouchEvent, .touchRead = chsc5448TouchRead, .printDebugInfo = chsc5448PrintDebugInfo, - .needTranspose = false, + .rotate = DEG_0, }; void _detect_touch_controller() @@ -315,7 +331,11 @@ void _detect_touch_controller() } else { touchController = TC_FT6236; tcd = &FT6236; +#if defined(RADIO_NB4P) + TouchControllerType = 0; +#else TouchControllerType = 1; +#endif } } @@ -354,11 +374,19 @@ struct TouchState touchPanelRead() unsigned short touchY; bool hasTouchContact = tcd->touchRead(&touchX, &touchY); - if (tcd->needTranspose) { - // Touch sensor is rotated by 90 deg - unsigned short tmp = touchY; - touchY = 319 - touchX; - touchX = tmp; + unsigned short tmp; + switch(tcd->rotate) { + case DEG_270: + tmp = touchY; + touchY = 319 - touchX; + touchX = tmp; + break; + case DEG_180: + touchY = 479 - touchY; + touchX = 319 - touchX; + break; + default: + break; } if (hasTouchContact) { diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index d2a79df8531..4b2c849bc04 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -631,26 +631,16 @@ "nb4p" }, "inputs": { - "LH": { - "yaml": "Rud", - "lua": "rud", - "description": "Rudder" - }, - "LV": { - "yaml": "Ele", - "lua": "ele", - "description": "Elevator" + "ST": { + "yaml": "ST", + "lua": "ste", + "description": "Steering" }, - "RV": { - "yaml": "Thr", + "TH": { + "yaml": "TH", "lua": "thr", "description": "Throttle" }, - "RH": { - "yaml": "Ail", - "lua": "ail", - "description": "Aileron" - }, "P1": { "yaml": "POT1", "lua": "s1", @@ -670,22 +660,15 @@ "lua": "s3", "label": "S3", "short_label": "3", - "description": "Potentiometer 3" - }, - "SL1": { - "yaml": "LS", - "lua": "ls", - "label": "LS", - "short_label": "L", - "description": "Left slider" - }, - "SL2": { - "yaml": "RS", - "lua": "rs", - "label": "RS", - "short_label": "R", - "description": "Right slider" + "description": "Analog 3" }, + "P4": { + "yaml": "POT4", + "lua": "s4", + "label": "S4", + "short_label": "4", + "description": "Analog 4" + } } }, { diff --git a/radio/util/hw_defs/pot_config.py b/radio/util/hw_defs/pot_config.py index 1b63b707b3f..dc6a268b308 100644 --- a/radio/util/hw_defs/pot_config.py +++ b/radio/util/hw_defs/pot_config.py @@ -36,8 +36,7 @@ "P1": {"default": "POT"}, "P2": {"default": "POT"}, "P3": {"default": "POT"}, - "SL1": {"default": "SLIDER"}, - "SL2": {"default": "SLIDER"} + "P4": {"default": "POT"} }, "v12": { "P1": {"default": "POT_CENTER"}, diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index 950c933c6c3..feee4a97894 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -53,13 +53,7 @@ }, "nb4p": { "SA": { "default": "2POS" }, - "SB": { "default": "3POS" }, - "SC": { "default": "2POS" }, - "SD": { "default": "3POS" }, - "SE": { "default": "3POS" }, - "SF": { "default": "2POS" }, - "SG": { "default": "3POS" }, - "SH": { "default": "TOGGLE" } + "SB": { "default": "2POS" } }, "lr3pro": { # left side From e558076ac41578800fbc47269f0b45c70f198f53 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 2 Apr 2024 13:09:28 +0800 Subject: [PATCH 03/36] Fixed battery charging and USB detection --- radio/src/targets/pl18/battery_driver.h | 12 ++++++++++-- radio/src/targets/pl18/board.cpp | 4 ++++ radio/src/targets/pl18/hal.h | 5 +++++ radio/util/hw_defs/switch_config.py | 4 ++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/radio/src/targets/pl18/battery_driver.h b/radio/src/targets/pl18/battery_driver.h index 020b8a4a235..14fce17bcda 100644 --- a/radio/src/targets/pl18/battery_driver.h +++ b/radio/src/targets/pl18/battery_driver.h @@ -42,8 +42,16 @@ enum ChargeState CHARGE_FINISHED }; -#define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 -#define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 +#if defined(UCHARGER_GPIO_PIN_INV) + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 0 : 1 +#else + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 +#endif +#if defined(UCHARGER_CHARGE_END_GPIO_PIN_INV) + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1 +#else + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 +#endif #if defined(UCHARGER_EN_GPIO) #define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) #define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index db13ffbfd39..418da67f283 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -237,6 +237,10 @@ int usbPlugged() static uint8_t lastState = 0; uint8_t state = gpio_read(UCHARGER_GPIO) ? 1 : 0; +#if defined(UCHARGER_GPIO_PIN_INV) + state = !state; +#endif + if (state == lastState) debouncedState = state; else diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 7f45a549eac..c0de8211228 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -359,6 +359,11 @@ // Chargers (USB and wireless) #define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input #define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input +#if defined(RADIO_NB4P) + #define UCHARGER_GPIO_PIN_INV + #define UCHARGER_CHARGE_END_GPIO_PIN_INV +#endif + #if defined(RADIO_PL18) || defined(RADIO_PL18EV) #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output #endif diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index feee4a97894..aab37f85a3d 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -52,8 +52,8 @@ "SJ": { "default": "3POS" } }, "nb4p": { - "SA": { "default": "2POS" }, - "SB": { "default": "2POS" } + "SA": { "default": "3POS" }, + "SB": { "default": "3POS" } }, "lr3pro": { # left side From a543463e041db2cfaa166d1507d229c53b6d1ead Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 2 Apr 2024 13:38:21 +0800 Subject: [PATCH 04/36] Mapped audio mute --- radio/src/targets/pl18/hal.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index c0de8211228..0649fc25799 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -524,6 +524,13 @@ #define AUDIO_TIMER TIM6 #define AUDIO_DMA DMA1 +#if defined(RADIO_NB4P) + #define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 9) // PH.09 audio amp control pin + #define AUDIO_UNMUTE_DELAY 120 // ms + #define AUDIO_MUTE_DELAY 500 // ms + #define INVERTED_MUTE_PIN +#endif + // I2C Bus #define I2C_B1 I2C1 #define I2C_B1_SCL_GPIO GPIO_PIN(GPIOB, 8) // PB.08 From b5f3dbf6de7f2639ddbdff1ad329a91a0294377c Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 9 Jul 2024 14:40:38 +0800 Subject: [PATCH 05/36] Disable voice chip --- radio/src/targets/pl18/board.cpp | 11 +++++++++++ radio/src/targets/pl18/hal.h | 1 + 2 files changed, 12 insertions(+) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 418da67f283..04720741bc8 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -85,6 +85,14 @@ void ledStripOff() ws2812_update(&_led_timer); } +#if defined(RADIO_NB4P) +void disableVoiceChip() +{ + gpio_init(VOICE_CHIP_EN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); + gpio_clear(VOICE_CHIP_EN_GPIO); +} +#endif + void boardBLInit() { // USB charger status pins @@ -156,6 +164,9 @@ void boardInit() keysInit(); switchInit(); +#if defined(RADIO_NB4P) + disableVoiceChip(); +#endif audioInit(); adcInit(&_adc_driver); hapticInit(); diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 0649fc25799..26ec8e44c36 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -529,6 +529,7 @@ #define AUDIO_UNMUTE_DELAY 120 // ms #define AUDIO_MUTE_DELAY 500 // ms #define INVERTED_MUTE_PIN + #define VOICE_CHIP_EN_GPIO GPIO_PIN(GPIOI, 5) // PI.05 #endif // I2C Bus From d2805ece2fa099ec576fd0152ec345b283c766ce Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 10 Jul 2024 09:03:26 +0800 Subject: [PATCH 06/36] Added encoder --- radio/src/targets/pl18/CMakeLists.txt | 14 ++++++++++---- radio/src/targets/pl18/board.cpp | 4 ++++ .../src/targets/pl18/bootloader/boot_menu.cpp | 2 ++ radio/src/targets/pl18/hal.h | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 501a3b7c427..52bf8cb7f9e 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -42,15 +42,15 @@ add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) if(PCBREV STREQUAL NB4P) set(FLAVOUR nb4p) add_definitions(-DRADIO_NB4P) + set(ROTARY_ENCODER YES) elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) - add_definitions(-DRADIO_PL18EV) + add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) - set(ROTARY_ENCODER YES) else() set(FLAVOUR pl18) - add_definitions(-DRADIO_PL18) + add_definitions(-DRADIO_PL18 -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) @@ -74,7 +74,7 @@ add_definitions( -DSTM32F429_439xx -DSTM32F429xx -DSDRAM -DCCMRAM -DCOLORLCD -DLIBOPENUI -DHARDWARE_TOUCH -DHARDWARE_KEYS - -DSOFTWARE_KEYBOARD -DUSE_HATS_AS_KEYS) + -DSOFTWARE_KEYBOARD) set(SDRAM ON) @@ -124,6 +124,12 @@ set(BOARD_COMMON_SRC drivers/frftl.cpp ) +if(ROTARY_ENCODER) + list(APPEND BOARD_COMMON_SRC + targets/common/arm/stm32/rotary_encoder_driver.cpp + ) +endif() + # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 04720741bc8..b384de3d749 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -36,6 +36,7 @@ #include "hal/watchdog_driver.h" #include "hal/usb_driver.h" #include "hal/gpio.h" +#include "hal/rotary_encoder.h" #include "globals.h" #include "sdcard.h" @@ -164,6 +165,9 @@ void boardInit() keysInit(); switchInit(); +#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS) + rotaryEncoderInit(); +#endif #if defined(RADIO_NB4P) disableVoiceChip(); #endif diff --git a/radio/src/targets/pl18/bootloader/boot_menu.cpp b/radio/src/targets/pl18/bootloader/boot_menu.cpp index c2b578b504b..e26699fa1af 100644 --- a/radio/src/targets/pl18/bootloader/boot_menu.cpp +++ b/radio/src/targets/pl18/bootloader/boot_menu.cpp @@ -56,7 +56,9 @@ extern BitmapBuffer * lcd; void bootloaderInitScreen() { lcdInitDisplayDriver(); +#if defined(USE_HATS_AS_KEYS) setHatsAsKeys(true); +#endif } static void bootloaderDrawTitle(const char* text) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 26ec8e44c36..d5d25a7aa33 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -473,10 +473,9 @@ #if defined(RADIO_NB4P) // Rotary Encoder -#define ROTARY_ENCODER_RCC_APB1Periph RCC_APB1Periph_TIM12 #define ROTARY_ENCODER_GPIO GPIOH -#define ROTARY_ENCODER_GPIO_PIN_A GPIO_Pin_11 // PH.11 -#define ROTARY_ENCODER_GPIO_PIN_B GPIO_Pin_10 // PH.10 +#define ROTARY_ENCODER_GPIO_PIN_A LL_GPIO_PIN_11 // PH.11 +#define ROTARY_ENCODER_GPIO_PIN_B LL_GPIO_PIN_10 // PH.10 #define ROTARY_ENCODER_POSITION() ((ROTARY_ENCODER_GPIO->IDR >> 10) & 0x03) #define ROTARY_ENCODER_EXTI_LINE1 LL_EXTI_LINE_11 #define ROTARY_ENCODER_EXTI_LINE2 LL_EXTI_LINE_10 @@ -487,11 +486,9 @@ #define ROTARY_ENCODER_EXTI_PORT LL_SYSCFG_EXTI_PORTH #define ROTARY_ENCODER_EXTI_SYS_LINE1 LL_SYSCFG_EXTI_LINE11 #define ROTARY_ENCODER_EXTI_SYS_LINE2 LL_SYSCFG_EXTI_LINE10 -#define ROTARY_ENCODER_TIMER TIM12 -#define ROTARY_ENCODER_TIMER_IRQn TIM8_BRK_TIM12_IRQn -#define ROTARY_ENCODER_TIMER_IRQHandler TIM8_BRK_TIM12_IRQHandler -#else -#define ROTARY_ENCODER_RCC_APB1Periph 0 +#define ROTARY_ENCODER_TIMER TIM13 +#define ROTARY_ENCODER_TIMER_IRQn TIM8_UP_TIM13_IRQn +#define ROTARY_ENCODER_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler #endif // SPI NOR Flash @@ -646,8 +643,13 @@ #define EXTMODULE_RX_GPIO_AF_USART GPIO_AF_USART6 #define EXTMODULE_TIMER TIM8 #define EXTMODULE_TIMER_Channel LL_TIM_CHANNEL_CH1 +#if defined(RADIO_NB4P) +#define EXTMODULE_TIMER_IRQn TIM5_IRQn +#define EXTMODULE_TIMER_IRQHandler TIM5_IRQHandler +#else #define EXTMODULE_TIMER_IRQn TIM8_UP_TIM13_IRQn #define EXTMODULE_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler +#endif #define EXTMODULE_TIMER_FREQ (PERI2_FREQUENCY * TIMER_MULT_APB2) #define EXTMODULE_TIMER_TX_GPIO_AF LL_GPIO_AF_3 //USART From 85c96813efe85c02b7e6a0e9ab2d5e3361b3fbda Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 18 Apr 2024 14:42:19 +0800 Subject: [PATCH 07/36] Fixed haptic --- radio/src/targets/pl18/hal.h | 8 ++++---- radio/src/targets/pl18/haptic_driver.cpp | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index d5d25a7aa33..b78acef167f 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -557,15 +557,15 @@ #define HAPTIC_GPIO GPIO_PIN(GPIOB, 0) // PB.00 #define HAPTIC_GPIO_TIMER TIM1 #define HAPTIC_GPIO_AF GPIO_AF1 -#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE; -#define HAPTIC_TIMER_MODE TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE -#define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR1 +#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC2NE +#define HAPTIC_TIMER_MODE TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2 | TIM_CCMR1_OC2PE +#define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR2 #else #define HAPTIC_PWM #define HAPTIC_GPIO GPIO_PIN(GPIOA, 8) // PA.08 #define HAPTIC_GPIO_TIMER TIM1 #define HAPTIC_GPIO_AF GPIO_AF1 -#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE; +#define HAPTIC_TIMER_OUTPUT_ENABLE TIM_CCER_CC1E | TIM_CCER_CC1NE #define HAPTIC_TIMER_MODE TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE #define HAPTIC_TIMER_COMPARE_VALUE HAPTIC_GPIO_TIMER->CCR1 #endif diff --git a/radio/src/targets/pl18/haptic_driver.cpp b/radio/src/targets/pl18/haptic_driver.cpp index 7a9b79a5e29..7b49304745e 100644 --- a/radio/src/targets/pl18/haptic_driver.cpp +++ b/radio/src/targets/pl18/haptic_driver.cpp @@ -47,7 +47,9 @@ void hapticInit(void) HAPTIC_GPIO_TIMER->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 10000 - 1; HAPTIC_GPIO_TIMER->CCMR1 = HAPTIC_TIMER_MODE; // PWM HAPTIC_GPIO_TIMER->CCER = HAPTIC_TIMER_OUTPUT_ENABLE; - HAPTIC_GPIO_TIMER->CCR1 = 0; + + hapticOff(); + HAPTIC_GPIO_TIMER->EGR = TIM_EGR_UG; HAPTIC_GPIO_TIMER->CR1 = TIM_CR1_CEN; // counter enable HAPTIC_GPIO_TIMER->BDTR |= TIM_BDTR_MOE; From 27cf0d83c643a0b2c4f6bca160beb25325e47955 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 18 Apr 2024 13:12:15 +0800 Subject: [PATCH 08/36] Unified bootloader menu for all Flysky radios --- .../src/targets/pl18/bootloader/boot_menu.cpp | 174 ++++++++++++++---- radio/src/translations/cn.h | 18 +- radio/src/translations/cz.h | 18 +- radio/src/translations/da.h | 26 ++- radio/src/translations/de.h | 18 +- radio/src/translations/en.h | 18 +- radio/src/translations/es.h | 18 +- radio/src/translations/fi.h | 18 +- radio/src/translations/fr.h | 18 +- radio/src/translations/he.h | 18 +- radio/src/translations/it.h | 18 +- radio/src/translations/jp.h | 18 +- radio/src/translations/nl.h | 18 +- radio/src/translations/pl.h | 18 +- radio/src/translations/pt.h | 18 +- radio/src/translations/ru.h | 18 +- radio/src/translations/se.h | 24 ++- radio/src/translations/tw.h | 18 +- radio/src/translations/ua.h | 18 ++ 19 files changed, 387 insertions(+), 125 deletions(-) diff --git a/radio/src/targets/pl18/bootloader/boot_menu.cpp b/radio/src/targets/pl18/bootloader/boot_menu.cpp index e26699fa1af..006dc164568 100644 --- a/radio/src/targets/pl18/bootloader/boot_menu.cpp +++ b/radio/src/targets/pl18/bootloader/boot_menu.cpp @@ -19,6 +19,9 @@ * GNU General Public License for more details. */ +#include "hal/gpio.h" +#include "stm32_gpio.h" + #include "board.h" #include "fw_version.h" #include "lcd.h" @@ -30,6 +33,8 @@ #include +#define RADIO_MENU_LEN 2 + #define SELECTED_COLOR (INVERS | COLOR_THEME_SECONDARY1) #define DEFAULT_PADDING 28 #define DOUBLE_PADDING 56 @@ -53,6 +58,12 @@ LZ4BitmapBuffer BMP_USB_PLUGGED(BMP_ARGB4444, (LZ4Bitmap*)__bmp_usb_plugged); extern BitmapBuffer * lcd; +#if defined(USB_SW_GPIO) + #define USB_SW_TO_INTERNAL_MODULE() gpio_set(USB_SW_GPIO); + #define USB_SW_TO_MCU() gpio_clear(USB_SW_GPIO); + static bool rfUsbAccess = false; +#endif + void bootloaderInitScreen() { lcdInitDisplayDriver(); @@ -69,7 +80,10 @@ static void bootloaderDrawTitle(const char* text) static void bootloaderDrawFooter() { + if (LCD_W > LCD_H) lcd->drawSolidFilledRect(DEFAULT_PADDING, LCD_H - (DEFAULT_PADDING + 10), LCD_W - DOUBLE_PADDING, 2, BL_FOREGROUND); + else + lcd->drawSolidFilledRect(DEFAULT_PADDING, LCD_H - (DOUBLE_PADDING + 4), LCD_W - DOUBLE_PADDING, 2, BL_FOREGROUND); } static void bootloaderDrawBackground() @@ -89,34 +103,53 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) } int center = LCD_W/2; + int menuItemX = center - 120; if (st == ST_START) { + int y = 75; bootloaderDrawTitle(BOOTLOADER_TITLE); - lcd->drawText(102, 75, LV_SYMBOL_CHARGE, BL_FOREGROUND); - coord_t pos = lcd->drawText(124, 75, TR_BL_WRITE_FW, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, y, LV_SYMBOL_CHARGE, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, y, TR_BL_WRITE_FW, BL_FOREGROUND); pos += 8; + coord_t npos; + y += 35; #if defined(SPI_FLASH) - lcd->drawText(102, 110, LV_SYMBOL_SD_CARD, BL_FOREGROUND); - pos = lcd->drawText(124, 110, TR_BL_ERASE_FLASH, BL_FOREGROUND); - pos += 8; - - lcd->drawText(100, 145, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 145, TR_BL_EXIT, BL_FOREGROUND); -#else - lcd->drawText(100, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 110, TR_BL_EXIT, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, y, LV_SYMBOL_SD_CARD, BL_FOREGROUND); + npos = lcd->drawText(menuItemX + 24, y, TR_BL_ERASE_FLASH, BL_FOREGROUND); + npos += 8; + if (npos > pos) + pos = npos; + y += 35; +#endif +#if defined(USB_SW_GPIO) + lcd->drawText(menuItemX, y, LV_SYMBOL_WIFI, BL_FOREGROUND); + npos = lcd->drawText(menuItemX + 24, y, TR_BL_RF_USB_ACCESS, BL_FOREGROUND); + npos += 8; + if (npos > pos) + pos = npos; + y += 35; #endif + lcd->drawText(menuItemX, y, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, y, TR_BL_EXIT, BL_FOREGROUND); - pos -= 92; - lcd->drawSolidRect(92, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); - - lcd->drawBitmap(60, 214, (const BitmapBuffer*)&BMP_PLUG_USB); - lcd->drawText(195, 223, TR_BL_USB_PLUGIN, BL_FOREGROUND); - lcd->drawText(195, 248, TR_BL_USB_MASS_STORE, BL_FOREGROUND); + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + + if (LCD_W > LCD_H) { + lcd->drawBitmap(menuItemX - 40, LCD_H - 106, (const BitmapBuffer*)&BMP_PLUG_USB); + lcd->drawText(menuItemX + 95, LCD_H - 97, TR_BL_USB_PLUGIN, BL_FOREGROUND); + lcd->drawText(menuItemX + 95, LCD_H - 72, TR_BL_USB_MASS_STORE, BL_FOREGROUND); + } else { + lcd->drawBitmap(center - 55, LCD_H - DEFAULT_PADDING - 157, (const BitmapBuffer*)&BMP_PLUG_USB); + lcd->drawText(center, LCD_H - DEFAULT_PADDING - 97, TR_BL_USB_PLUGIN, CENTERED | BL_FOREGROUND); + lcd->drawText(center, LCD_H - DEFAULT_PADDING - 72, TR_BL_USB_MASS_STORE, CENTERED | BL_FOREGROUND); + } bootloaderDrawFooter(); + if (LCD_W < LCD_H) + lcd->drawText(center, LCD_H - DOUBLE_PADDING, TR_BL_CURRENT_FW, CENTERED | BL_FOREGROUND); lcd->drawText(center, LCD_H - DEFAULT_PADDING, getFirmwareVersion(), CENTERED | BL_FOREGROUND); } #if defined(SPI_FLASH) @@ -124,21 +157,28 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawTitle(TR_BL_ERASE_INT_FLASH); - lcd->drawText(102, 75, LV_SYMBOL_SD_CARD, BL_FOREGROUND); - coord_t pos = lcd->drawText(124, 75, TR_BL_ERASE_FLASH, BL_FOREGROUND); + lcd->drawText(menuItemX + 2, 75, LV_SYMBOL_SD_CARD, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, 75, TR_BL_ERASE_FLASH, BL_FOREGROUND); pos += 8; - lcd->drawText(100, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); - lcd->drawText(124, 110, TR_BL_EXIT, BL_FOREGROUND); + lcd->drawText(menuItemX, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, 110, TR_BL_EXIT, BL_FOREGROUND); - pos -= 92; - lcd->drawSolidRect(92, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); bootloaderDrawFooter(); - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_SD_CARD TR_BL_ERASE_KEY, BL_FOREGROUND); - lcd->drawText(305, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_NEW_LINE TR_BL_EXIT_KEY, BL_FOREGROUND); + if (LCD_W > LCD_H) { + lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_SD_CARD " " TR_BL_ERASE_KEY, BL_FOREGROUND); + lcd->drawText(LCD_W - 175, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } else { + lcd->drawText(DOUBLE_PADDING, LCD_H - DOUBLE_PADDING, + LV_SYMBOL_SD_CARD " " TR_BL_ERASE_KEY, BL_FOREGROUND); + lcd->drawText(DOUBLE_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } } else if (st == ST_CLEAR_FLASH) { bootloaderDrawTitle(TR_BL_ERASE_INT_FLASH); @@ -147,7 +187,21 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawFooter(); } #endif +#if defined(USB_SW_GPIO) + else if (st == ST_RADIO_MENU) { + bootloaderDrawTitle(TR_BL_RF_USB_ACCESS); + + lcd->drawText(menuItemX + 2, 75, LV_SYMBOL_USB, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, 75, rfUsbAccess ? TR_DISABLE : TR_ENABLE, BL_FOREGROUND); + pos += 8; + lcd->drawText(menuItemX + 2, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); + lcd->drawText(menuItemX + 24, 110, TR_BL_EXIT, BL_FOREGROUND); + + pos -= menuItemX - 8; + lcd->drawSolidRect(menuItemX - 8, 72 + (opt * 35), pos, 26, 2, BL_SELECTED); + } +#endif else if (st == ST_USB) { lcd->drawBitmap(center - 26, 98, (const BitmapBuffer*)&BMP_USB_PLUGGED); lcd->drawText(center, 168, TR_BL_USB_CONNECTED, CENTERED | BL_FOREGROUND); @@ -221,24 +275,32 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) if (st != ST_DIR_CHECK && (st != ST_FLASH_CHECK || opt == FC_OK)) { + int padding = DOUBLE_PADDING; + if (LCD_W > LCD_H) + padding = DEFAULT_PADDING; if (st == ST_FILE_LIST) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_SELECT_KEY, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_SELECT_KEY, BL_FOREGROUND); } else if (st == ST_FLASH_CHECK && opt == FC_OK) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_FLASH_KEY, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_FLASH_KEY, BL_FOREGROUND); } else if (st == ST_FLASHING) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_WRITING_FW, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_WRITING_FW, BL_FOREGROUND); } else if (st == ST_FLASH_DONE) { - lcd->drawText(DEFAULT_PADDING, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_CHARGE TR_BL_WRITING_COMPL, BL_FOREGROUND); + lcd->drawText(padding, LCD_H - padding, + LV_SYMBOL_CHARGE " " TR_BL_WRITING_COMPL, BL_FOREGROUND); } } if (st != ST_FLASHING) { - lcd->drawText(305, LCD_H - DEFAULT_PADDING, - LV_SYMBOL_NEW_LINE TR_BL_EXIT_KEY, BL_FOREGROUND); + if (LCD_W > LCD_H) { + lcd->drawText(LCD_W - 175, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } else { + lcd->drawText(DOUBLE_PADDING, LCD_H - DEFAULT_PADDING, + LV_SYMBOL_NEW_LINE " " TR_BL_EXIT_KEY, BL_FOREGROUND); + } } } _first_screen = false; @@ -256,12 +318,50 @@ void bootloaderDrawFilename(const char* str, uint8_t line, bool selected) } uint32_t bootloaderGetMenuItemCount(int baseCount) { +#if defined(USB_SW_GPIO) + return baseCount+1; +#else return baseCount; +#endif } bool bootloaderRadioMenu(uint32_t menuItem, event_t event) { +#if defined(USB_SW_GPIO) + static int pos = 0; + + if (event == EVT_KEY_FIRST(KEY_DOWN)) { + if (pos < RADIO_MENU_LEN-1) + pos++; + } else if (event == EVT_KEY_FIRST(KEY_UP)) { + if (pos > 0) + pos--; + } else if (event == EVT_KEY_BREAK(KEY_ENTER)) { + switch (pos) { + case 0: + if (rfUsbAccess) + { + rfUsbAccess = false; + INTERNAL_MODULE_OFF(); + USB_SW_TO_MCU(); + } else { + rfUsbAccess = true; + INTERNAL_MODULE_ON(); + USB_SW_TO_INTERNAL_MODULE(); + } + break; + case 1: // fall through + default: + USB_SW_TO_MCU(); + pos = 0; + return true; + } + } + bootloaderDrawScreen(ST_RADIO_MENU, pos, nullptr); + return false; +#else return true; +#endif } void blExit(void) diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index fdb16e0e662..6c4f8f1a31a 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -1077,15 +1077,23 @@ #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index 49776023cde..31858edca58 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -1092,15 +1092,23 @@ #define TR_BL_ENABLE "Povoleno" #define TR_BL_DISABLE "Zakazano" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 4b06b3a9dbd..437f1449399 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -1080,15 +1080,31 @@ #define TR_BL_ENABLE "Aktiver" #define TR_BL_DISABLE "Deaktiver" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB adgang" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Slet intern flash lager" #define TR_BL_ERASE_FLASH "Slet flash lager" #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] for at bruge fil" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] længe, for brænding" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] længe, for sletning" - #define TR_BL_EXIT_KEY " [TR4 Up] for at forlade" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY " [SW2] for at bruge fil" + #define TR_BL_FLASH_KEY " Hold [SW2] længe, for brænding" + #define TR_BL_ERASE_KEY " Hold [SW2] længe, for sletning" + #define TR_BL_EXIT_KEY " [SW3] for at forlade" + #else + #define TR_BL_SELECT_KEY " [TR4 Dn] for at bruge fil" + #define TR_BL_FLASH_KEY " Hold [TR4 Dn] længe, for brænding" + #define TR_BL_ERASE_KEY " Hold [TR4 Dn] længe, for sletning" + #define TR_BL_EXIT_KEY " [TR4 Up] for at forlade" +#endif + + + // Bootloader PL18/NB4+ specific - Ascii only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #endif // About screen diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 79d9d91b52e..5ae8eaf079e 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -1068,15 +1068,23 @@ #define TR_BL_ENABLE "Aktivieren" #define TR_BL_DISABLE "Deaktivieren" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // Taranis Info Zeile Anzeigen diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index 973f12dea00..f7117da7a1e 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -1079,15 +1079,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index b814b8c1faf..834367cd091 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -1078,15 +1078,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 412b1daf2a4..160096e50f0 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -1090,15 +1090,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index 4563daf5c93..b339efa30f4 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -1089,15 +1089,23 @@ #define TR_BL_ENABLE "Activer" #define TR_BL_DISABLE "Désactiver" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index 45f7349029d..2288f728a58 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -1080,15 +1080,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index 81e8824ca1d..181d6e315af 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -1075,15 +1075,23 @@ #define TR_BL_ENABLE "Abilita" #define TR_BL_DISABLE "Disabilita" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/jp.h b/radio/src/translations/jp.h index 59653809da1..61ed3e61eac 100644 --- a/radio/src/translations/jp.h +++ b/radio/src/translations/jp.h @@ -1080,15 +1080,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index 08a6719dca0..b09a49a0b88 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -1083,15 +1083,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index 163e4f3892e..0df011118f8 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -1078,15 +1078,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index b2762922195..2812f3f5b42 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -1084,15 +1084,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Desativar" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/ru.h b/radio/src/translations/ru.h index be6f159ca32..f01f7e7c293 100644 --- a/radio/src/translations/ru.h +++ b/radio/src/translations/ru.h @@ -1083,15 +1083,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index eb42eab6307..e66960cb622 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -1104,15 +1104,23 @@ #define TR_BL_ENABLE "Aktivera" #define TR_BL_DISABLE "Inaktivera" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Radera interna flashminnet" - #define TR_BL_ERASE_FLASH "Radera flashminnet" - #define TR_BL_ERASE_FLASH_MSG "Detta kan ta upp till 200s" - #define TR_BL_SELECT_KEY " Tryck [TR4 Ner] foer att vaelja fil" - #define TR_BL_FLASH_KEY " Haall [TR4 Ner] foer att flasha" - #define TR_BL_ERASE_KEY " Haall [TR4 Ner] foer att radera" - #define TR_BL_EXIT_KEY " Tryck [TR4 Upp] foer att avbryta" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index e15d2792535..fe181e2a9c7 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -1082,15 +1082,23 @@ #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen diff --git a/radio/src/translations/ua.h b/radio/src/translations/ua.h index b3d54a8b422..248cbdc42f9 100644 --- a/radio/src/translations/ua.h +++ b/radio/src/translations/ua.h @@ -1088,6 +1088,24 @@ #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY " [TR4 Up] to exit" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - Ascii only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #if defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW2] to select file" + #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" + #define TR_BL_EXIT_KEY "[SW3] to exit" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] to exit" + #endif #endif // About screen From a4dd0f01bd9b77bdcd2873261a0fa18ced7aabd3 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 17 Apr 2024 16:30:26 +0800 Subject: [PATCH 09/36] Can enter bootloader with S2 + S3 --- radio/src/targets/pl18/CMakeLists.txt | 5 +- radio/src/targets/pl18/board.cpp | 7 ++ radio/src/targets/pl18/hal.h | 1 + radio/src/targets/pl18/key_driver.cpp | 4 - radio/src/targets/pl18/nb4p_key_driver.cpp | 122 +++++++++++++++++++++ 5 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 radio/src/targets/pl18/nb4p_key_driver.cpp diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 52bf8cb7f9e..2e08067b2f5 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -43,16 +43,19 @@ if(PCBREV STREQUAL NB4P) set(FLAVOUR nb4p) add_definitions(-DRADIO_NB4P) set(ROTARY_ENCODER YES) + set(KEY_DRIVER nb4p_key_driver.cpp) elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(KEY_DRIVER key_driver.cpp) else() set(FLAVOUR pl18) add_definitions(-DRADIO_PL18 -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(KEY_DRIVER key_driver.cpp) # Defines internal modules for PL18 via UART7 set(INTERNAL_MODULES MULTI CACHE STRING "Internal modules") @@ -107,7 +110,7 @@ set(TARGET_SRC_DIR targets/${TARGET_DIR}) set(BOARD_COMMON_SRC ${TARGET_SRC_DIR}/board.cpp ${TARGET_SRC_DIR}/led_driver.cpp - ${TARGET_SRC_DIR}/key_driver.cpp + ${TARGET_SRC_DIR}/${KEY_DRIVER} ${TARGET_SRC_DIR}/haptic_driver.cpp ${TARGET_SRC_DIR}/backlight_driver.cpp ${TARGET_SRC_DIR}/${LCD_DRIVER} diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index b384de3d749..43df6747061 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -100,6 +100,13 @@ void boardBLInit() gpio_init(UCHARGER_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); } +#if defined(RADIO_NB4P) +void boardBLPreJump() +{ + LL_ADC_Disable(ADC_MAIN); +} +#endif + void boardInit() { #if defined(SEMIHOSTING) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index b78acef167f..bc3e2275ab2 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -313,6 +313,7 @@ #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 + #define ADC_GPIO_SWB GPIOC #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 diff --git a/radio/src/targets/pl18/key_driver.cpp b/radio/src/targets/pl18/key_driver.cpp index fefd7783d78..89f39913692 100644 --- a/radio/src/targets/pl18/key_driver.cpp +++ b/radio/src/targets/pl18/key_driver.cpp @@ -28,8 +28,6 @@ #include "delays_driver.h" #include "keys.h" -#if !defined(RADIO_NB4P) - /* The output bit-order has to be: 0 LHL TR7L (Left equals down) 1 LHR TR7R @@ -220,5 +218,3 @@ uint32_t readTrims() return result; } - -#endif diff --git a/radio/src/targets/pl18/nb4p_key_driver.cpp b/radio/src/targets/pl18/nb4p_key_driver.cpp new file mode 100644 index 00000000000..5d41e93f8e6 --- /dev/null +++ b/radio/src/targets/pl18/nb4p_key_driver.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "hal/key_driver.h" + +#include "stm32_hal_ll.h" +#include "stm32_gpio_driver.h" + +#include "hal.h" +#include "delays_driver.h" +#include "keys.h" + +#define BOOTLOADER_KEYS 0x42 + +void keysInit() +{ +#if defined(BOOT) + LL_GPIO_InitTypeDef pinInit; + LL_GPIO_StructInit(&pinInit); + + pinInit.Pin = ADC_GPIO_PIN_SWB; + pinInit.Mode = LL_GPIO_MODE_ANALOG; + pinInit.Pull = LL_GPIO_PULL_NO; + stm32_gpio_enable_clock(ADC_GPIO_SWB); + LL_GPIO_Init(ADC_GPIO_SWB, &pinInit); + + // Init ADC clock + uint32_t adc_idx = (((uint32_t) ADC_MAIN) - ADC1_BASE) / 0x100UL; + uint32_t adc_msk = RCC_APB2ENR_ADC1EN << adc_idx; + LL_APB2_GRP1_EnableClock(adc_msk); + + // Init common to all ADCs + LL_ADC_CommonInitTypeDef commonInit; + LL_ADC_CommonStructInit(&commonInit); + + commonInit.CommonClock = LL_ADC_CLOCK_SYNC_PCLK_DIV4; + LL_ADC_CommonInit(__LL_ADC_COMMON_INSTANCE(ADC_MAIN), &commonInit); + + // ADC must be disabled for the functions used here + LL_ADC_Disable(ADC_MAIN); + + LL_ADC_InitTypeDef adcInit; + LL_ADC_StructInit(&adcInit); + adcInit.SequencersScanMode = LL_ADC_SEQ_SCAN_DISABLE; + adcInit.DataAlignment = LL_ADC_DATA_ALIGN_RIGHT; + adcInit.Resolution = LL_ADC_RESOLUTION_12B; + LL_ADC_Init(ADC_MAIN, &adcInit); + + LL_ADC_REG_InitTypeDef adcRegInit; + LL_ADC_REG_StructInit(&adcRegInit); + adcRegInit.TriggerSource = LL_ADC_REG_TRIG_SOFTWARE; + adcRegInit.ContinuousMode = LL_ADC_REG_CONV_SINGLE; + LL_ADC_REG_Init(ADC_MAIN, &adcRegInit); + + // Enable ADC + LL_ADC_Enable(ADC_MAIN); +#endif +} + +#if defined(BOOT) +uint16_t _adcRead() +{ + // Configure ADC channel + LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_SWB); + LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_SWB, LL_ADC_SAMPLINGTIME_3CYCLES); + + // Start ADC conversion + LL_ADC_REG_StartConversionSWStart(ADC_MAIN); + + // Wait until ADC conversion is complete + uint32_t timeout = 0; + while (!LL_ADC_IsActiveFlag_EOCS(ADC_MAIN)); + + // Read ADC converted value + return LL_ADC_REG_ReadConversionData12(ADC_MAIN); +} +#endif + +uint32_t readKeys() +{ + uint32_t result = 0; + +#if defined(BOOT) + uint16_t value = _adcRead(); + if (value >= 3584) + result |= 1 << KEY_ENTER; + else if (value < 512) + result |= 1 << KEY_EXIT; +#endif + + return result; +} + +uint32_t readTrims() +{ + uint32_t result = 0; + +#if defined(BOOT) + uint16_t value = _adcRead(); + if (value >= 1536 && value < 2560) + result = BOOTLOADER_KEYS; +#endif + return result; +} \ No newline at end of file From d46302f3dc82a40878a2dff9a6fd3e1c554634d0 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 23 Apr 2024 14:59:11 +0800 Subject: [PATCH 10/36] Switch driver, key/trim driver --- radio/src/boards/generic_stm32/switches.cpp | 18 +-- .../src/gui/colorlcd/radio/radio_diagkeys.cpp | 4 +- radio/src/targets/pl18/CMakeLists.txt | 11 ++ radio/src/targets/pl18/hal.h | 28 ++-- radio/src/targets/pl18/nb4p_key_driver.cpp | 62 ++++++++- radio/src/targets/pl18/switch_driver.cpp | 122 ++++++++++++++++++ radio/util/hw_defs/legacy_names.py | 38 ++++-- radio/util/hw_defs/pot_config.py | 6 +- radio/util/hw_defs/switch_config.py | 6 +- 9 files changed, 251 insertions(+), 44 deletions(-) create mode 100644 radio/src/targets/pl18/switch_driver.cpp diff --git a/radio/src/boards/generic_stm32/switches.cpp b/radio/src/boards/generic_stm32/switches.cpp index 8479521a7e3..394abc0bc06 100644 --- a/radio/src/boards/generic_stm32/switches.cpp +++ b/radio/src/boards/generic_stm32/switches.cpp @@ -31,32 +31,34 @@ #include -void boardInitSwitches() +#define __weak __attribute__((weak)) + +__weak void boardInitSwitches() { _init_switches(); } -SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) +__weak SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) { return stm32_switch_get_position(&_switch_offsets[cat][idx]); } -const char* boardSwitchGetName(uint8_t cat, uint8_t idx) +__weak const char* boardSwitchGetName(uint8_t cat, uint8_t idx) { return _switch_offsets[cat][idx].name; } -SwitchHwType boardSwitchGetType(uint8_t cat, uint8_t idx) +__weak SwitchHwType boardSwitchGetType(uint8_t cat, uint8_t idx) { return _switch_offsets[cat][idx].type; } -uint8_t boardGetMaxSwitches() { return n_switches; } -uint8_t boardGetMaxFctSwitches() { return n_fct_switches; } +__weak uint8_t boardGetMaxSwitches() { return n_switches; } +__weak uint8_t boardGetMaxFctSwitches() { return n_fct_switches; } -swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; } +__weak swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; } -switch_display_pos_t switchGetDisplayPosition(uint8_t idx) +__weak switch_display_pos_t switchGetDisplayPosition(uint8_t idx) { // TODO: find a solution for FLEX switches so they can be displayed on main view if (idx >= DIM(_switch_display)) return {0, 0}; diff --git a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp index 641808edf9e..3f17e90c535 100644 --- a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp @@ -25,7 +25,9 @@ #include "libopenui.h" #include "edgetx.h" -#if defined(PCBPL18) +#if defined(RADIO_NB4P) +static const uint8_t _trimMap[MAX_TRIMS * 2] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; +#elif defined(PCBPL18) static const uint8_t _trimMap[MAX_TRIMS * 2] = {8, 9, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 0, 1, 6, 7}; #else diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 2e08067b2f5..5203e0e14c7 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -133,6 +133,14 @@ if(ROTARY_ENCODER) ) endif() +if(PCBREV STREQUAL NB4P) + set(BOARD_SPECIFIC_SRC + ${TARGET_SRC_DIR}/switch_driver.cpp + ) +#else() +# set(BOARD_SPECIFIC_SRC) +endif() + # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} @@ -144,6 +152,7 @@ set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $) # Firmware board library add_library(board OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} + ${BOARD_SPECIFIC_SRC} ${TARGET_SRC_DIR}/${TOUCH_DRIVER} ${TARGET_SRC_DIR}/battery_driver.cpp targets/common/arm/stm32/audio_dac_driver.cpp @@ -159,7 +168,9 @@ add_library(board OBJECT EXCLUDE_FROM_ALL targets/common/arm/stm32/spi_flash.cpp targets/common/arm/stm32/diskio_spi_flash.cpp drivers/frftl.cpp + ) + set(FIRMWARE_SRC ${FIRMWARE_SRC} $) set(FIRMWARE_SRC diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index bc3e2275ab2..d2674d48b47 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -51,7 +51,6 @@ // PL18/PL18EV only has virtual keys via trim buttons // #define KEYS_GPIO_PIN_PGUP /* for activating PGUP in keys diagnose screen */ -#if !defined(RADIO_NB4P) // Trims #define TRIMS_GPIO_REG_LHL #define TRIMS_GPIO_PIN_LHL @@ -65,6 +64,7 @@ #define TRIMS_GPIO_REG_LVU #define TRIMS_GPIO_PIN_LVU +#if !defined(RADIO_NB4P) #define TRIMS_GPIO_REG_RHL #define TRIMS_GPIO_PIN_RHL @@ -312,24 +312,28 @@ #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 - #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 - #define ADC_GPIO_SWB GPIOC - #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 - #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 - #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 +// #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 + #define ADC_GPIO_EXT2 GPIOC +// #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 +// #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 +// #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_7 // PA.07 #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_2 // PC.02 - #define ADC_GPIO_PIN_POT3 LL_GPIO_PIN_6 // PA.06 - #define ADC_GPIO_PIN_POT4 LL_GPIO_PIN_4 // PC.04 + #define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_1 // PC.01 (SW1) + #define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_0 // PC.00 (SW2 SW3) + #define ADC_GPIO_PIN_EXT3 LL_GPIO_PIN_6 // PA.06 (TR1) + #define ADC_GPIO_PIN_EXT4 LL_GPIO_PIN_4 // PC.04 (TR2) #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 - #define ADC_CHANNEL_POT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 - #define ADC_CHANNEL_POT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_EXT1 LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 + #define ADC_CHANNEL_EXT2 LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 + #define ADC_CHANNEL_EXT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_EXT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 - #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_POT3) - #define ADC_GPIOC_PINS (ADC_GPIO_PIN_SWA | ADC_GPIO_PIN_SWB | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_POT4 | ADC_GPIO_PIN_BATT) + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_EXT3) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2 | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_EXT4 | ADC_GPIO_PIN_BATT) #define ADC_MAIN ADC1 #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES diff --git a/radio/src/targets/pl18/nb4p_key_driver.cpp b/radio/src/targets/pl18/nb4p_key_driver.cpp index 5d41e93f8e6..13242cb9451 100644 --- a/radio/src/targets/pl18/nb4p_key_driver.cpp +++ b/radio/src/targets/pl18/nb4p_key_driver.cpp @@ -28,19 +28,42 @@ #include "delays_driver.h" #include "keys.h" +#if !defined(BOOT) + #include "hal/adc_driver.h" +#endif + #define BOOTLOADER_KEYS 0x42 +/* The output bit-order has to be: + 0 LHL STD (Left equals down) + 1 LHR STU + 2 LVD THD + 3 LVU THU +*/ + +enum PhysicalTrims +{ + STD = 0, + STU, + THD = 2, + THU, +/* TR2L = 4, + TR2R, + TR2D = 8, + TR2U,*/ +}; + void keysInit() { #if defined(BOOT) LL_GPIO_InitTypeDef pinInit; LL_GPIO_StructInit(&pinInit); - pinInit.Pin = ADC_GPIO_PIN_SWB; + pinInit.Pin = ADC_GPIO_PIN_EXT2; pinInit.Mode = LL_GPIO_MODE_ANALOG; pinInit.Pull = LL_GPIO_PULL_NO; - stm32_gpio_enable_clock(ADC_GPIO_SWB); - LL_GPIO_Init(ADC_GPIO_SWB, &pinInit); + stm32_gpio_enable_clock(ADC_GPIO_EXT2); + LL_GPIO_Init(ADC_GPIO_EXT2, &pinInit); // Init ADC clock uint32_t adc_idx = (((uint32_t) ADC_MAIN) - ADC1_BASE) / 0x100UL; @@ -79,8 +102,8 @@ void keysInit() uint16_t _adcRead() { // Configure ADC channel - LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_SWB); - LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_SWB, LL_ADC_SAMPLINGTIME_3CYCLES); + LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_EXT2); + LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_EXT2, LL_ADC_SAMPLINGTIME_3CYCLES); // Start ADC conversion LL_ADC_REG_StartConversionSWStart(ADC_MAIN); @@ -101,9 +124,10 @@ uint32_t readKeys() #if defined(BOOT) uint16_t value = _adcRead(); if (value >= 3584) - result |= 1 << KEY_ENTER; - else if (value < 512) result |= 1 << KEY_EXIT; + else if (value < 512) + result |= 1 << KEY_ENTER; +#else #endif return result; @@ -117,6 +141,30 @@ uint32_t readTrims() uint16_t value = _adcRead(); if (value >= 1536 && value < 2560) result = BOOTLOADER_KEYS; +#else + uint16_t tr1Val = getAnalogValue(6); + uint16_t tr2Val = getAnalogValue(7); + if (tr1Val < 500) // Physical TR1 Left +// result |= 1 << TR1L; + ; + else if (tr1Val < 1500) // Physical TR1 Up + result |= 1 << STD; + else if (tr1Val < 2500) // Physical TR1 Right +// result |= 1 << TR1R; + ; + else if (tr1Val < 3500) // Physical TR1 Down + result |= 1 << STU; + if (tr2Val < 500) // Physical TR2 Left +// result |= 1 << TR2L; + ; + else if (tr2Val < 1500) // Physical TR2 Up + result |= 1 << THD; + else if (tr2Val < 2500) // Physical TR2 Right +// result |= 1 << TR2R; + ; + else if (tr2Val < 3500) // Physical TR2 Down + result |= 1 << THU; #endif + return result; } \ No newline at end of file diff --git a/radio/src/targets/pl18/switch_driver.cpp b/radio/src/targets/pl18/switch_driver.cpp new file mode 100644 index 00000000000..ad2e56bd96e --- /dev/null +++ b/radio/src/targets/pl18/switch_driver.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "hal/switch_driver.h" +#include "stm32_switch_driver.h" +//#include "stm32_gpio_driver.h" + +#include "definitions.h" +#include "opentx_constants.h" +#include "myeeprom.h" +#include "hal/adc_driver.h" + +#include + +#define __weak __attribute__((weak)) + +static const stm32_switch_t _switch_defs[] = { + { + "S1A", + nullptr, 0, + nullptr, 0, + SWITCH_HW_2POS, 0 + }, + { + "S1B", + nullptr, 0, + nullptr, 0, + SWITCH_HW_2POS, 0 + }, + { + "S2", + nullptr, 0, + nullptr, 0, + SWITCH_HW_2POS, 0 + }, + { + "S3", + nullptr, 0, + nullptr, 0, + SWITCH_HW_2POS, 0 + } +}; + +constexpr uint8_t n_switches = 4; +constexpr uint8_t n_fct_switches = 0; + +constexpr swconfig_t _switch_default_config = (swconfig_t)0 + | ((swconfig_t)SWITCH_2POS << (0 * SW_CFG_BITS)) + | ((swconfig_t)SWITCH_2POS << (1 * SW_CFG_BITS)) + | ((swconfig_t)SWITCH_2POS << (2 * SW_CFG_BITS)) + | ((swconfig_t)SWITCH_2POS << (3 * SW_CFG_BITS)) +; + +const switch_display_pos_t _switch_display[] = { + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, +}; + +SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) +{ + if (idx <= 1) { + uint16_t swVal = getAnalogValue(4); + if (idx == 0 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + if (idx == 1 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + } else if (idx <= 3) { + uint16_t swVal = getAnalogValue(5); + if (idx == 3 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + if (idx == 2 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { + return SWITCH_HW_DOWN; + } + } + return SWITCH_HW_UP; +} + +const char* boardSwitchGetName(uint8_t cat, uint8_t idx) +{ + return _switch_defs[idx].name; +} + +SwitchHwType boardSwitchGetType(uint8_t cat, uint8_t idx) +{ + return _switch_defs[idx].type; +} + +uint8_t boardGetMaxSwitches() { return n_switches; } +uint8_t boardGetMaxFctSwitches() { return n_fct_switches; } + +swconfig_t boardSwitchGetDefaultConfig() { return _switch_default_config; } + +switch_display_pos_t switchGetDisplayPosition(uint8_t idx) +{ + // TODO: find a solution for FLEX switches so they can be displayed on main view + if (idx >= DIM(_switch_display)) return {0, 0}; + + return _switch_display[idx]; +} diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index 4b2c849bc04..b2891c2611f 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -655,19 +655,33 @@ "short_label": "2", "description": "Potentiometer 2" }, - "P3": { - "yaml": "POT3", - "lua": "s3", - "label": "S3", - "short_label": "3", - "description": "Analog 3" + "EXT1": { + "yaml": "EXT1", + "lua": "ext1", + "label": "EXT1", + "short_label": "E1", + "description": "Ext 1" }, - "P4": { - "yaml": "POT4", - "lua": "s4", - "label": "S4", - "short_label": "4", - "description": "Analog 4" + "EXT2": { + "yaml": "EXT2", + "lua": "ext2", + "label": "EXT2", + "short_label": "E2", + "description": "Ext 2" + }, + "EXT3": { + "yaml": "EXT3", + "lua": "ext3", + "label": "EXT3", + "short_label": "E3", + "description": "Ext 3" + }, + "EXT4": { + "yaml": "EXT4", + "lua": "ext4", + "label": "EXT4", + "short_label": "E4", + "description": "Ext 4" } } }, diff --git a/radio/util/hw_defs/pot_config.py b/radio/util/hw_defs/pot_config.py index dc6a268b308..f0c23c536db 100644 --- a/radio/util/hw_defs/pot_config.py +++ b/radio/util/hw_defs/pot_config.py @@ -35,8 +35,10 @@ "nb4p": { "P1": {"default": "POT"}, "P2": {"default": "POT"}, - "P3": {"default": "POT"}, - "P4": {"default": "POT"} + "EXT1": {"default": "MULTIPOS"}, + "EXT2": {"default": "MULTIPOS"}, + "EXT3": {"default": "MULTIPOS"}, + "EXT4": {"default": "MULTIPOS"} }, "v12": { "P1": {"default": "POT_CENTER"}, diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index aab37f85a3d..482cf7d14c7 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -52,8 +52,10 @@ "SJ": { "default": "3POS" } }, "nb4p": { - "SA": { "default": "3POS" }, - "SB": { "default": "3POS" } + "S1A": { "default": "TOGGLE" }, + "S1B": { "default": "TOGGLE" }, + "S2" : { "default": "TOGGLE" }, + "S3" : { "default": "TOGGLE" } }, "lr3pro": { # left side From 10619fc1596cffeb430337c09055d7c86871a162 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Fri, 12 Jul 2024 16:36:55 +0800 Subject: [PATCH 11/36] Mapped SW1 to encoder control, SW2 and SW3 are user usable switches, reverse 2 pots --- radio/src/targets/pl18/hal.h | 26 +++++++++------------- radio/src/targets/pl18/nb4p_key_driver.cpp | 15 ++++++++----- radio/src/targets/pl18/switch_driver.cpp | 21 ++++++++--------- radio/src/translations/cn.h | 8 +++---- radio/src/translations/cz.h | 8 +++---- radio/src/translations/da.h | 8 +++---- radio/src/translations/de.h | 8 +++---- radio/src/translations/en.h | 8 +++---- radio/src/translations/es.h | 8 +++---- radio/src/translations/fi.h | 8 +++---- radio/src/translations/fr.h | 8 +++---- radio/src/translations/he.h | 8 +++---- radio/src/translations/it.h | 8 +++---- radio/src/translations/jp.h | 8 +++---- radio/src/translations/nl.h | 8 +++---- radio/src/translations/pl.h | 8 +++---- radio/src/translations/pt.h | 8 +++---- radio/src/translations/ru.h | 8 +++---- radio/src/translations/se.h | 8 +++---- radio/src/translations/tw.h | 8 +++---- radio/src/translations/ua.h | 8 +++---- radio/util/hw_defs/switch_config.py | 2 -- 22 files changed, 104 insertions(+), 104 deletions(-) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index d2674d48b47..638034f8e70 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -305,35 +305,32 @@ #endif #else - #define ADC_RCC_AHB1Periph (RCC_AHB1Periph_DMA2) - #define ADC_RCC_APB1Periph 0 - #define ADC_RCC_APB2Periph 0 #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 // #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 - #define ADC_GPIO_EXT2 GPIOC // #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 // #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 // #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 - #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_7 // PA.07 - #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_EXT1 GPIOC + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_7 // PA.07 #define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_1 // PC.01 (SW1) #define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_0 // PC.00 (SW2 SW3) #define ADC_GPIO_PIN_EXT3 LL_GPIO_PIN_6 // PA.06 (TR1) #define ADC_GPIO_PIN_EXT4 LL_GPIO_PIN_4 // PC.04 (TR2) #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 - #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 - #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 #define ADC_CHANNEL_EXT1 LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 #define ADC_CHANNEL_EXT2 LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 #define ADC_CHANNEL_EXT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 #define ADC_CHANNEL_EXT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 - #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_EXT3) - #define ADC_GPIOC_PINS (ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2 | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_EXT4 | ADC_GPIO_PIN_BATT) + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_EXT3) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2 | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_EXT4 | ADC_GPIO_PIN_BATT) #define ADC_MAIN ADC1 #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES @@ -346,12 +343,11 @@ #define ADC_VREF_PREC2 660 #define ADC_DIRECTION { \ - 0,0, /* gimbals */ \ - 0,0,0,0, /* pots */ \ + 0,0, /* gimbals */ \ + 0,0, /* pots */ \ + 0,0,0,0, /* ext1-4 */ \ 0, /* vbat */ \ - 0, /* rtc_bat */ \ - 0, /* SWA */ \ - 0 /* SWB */ \ + 0 /* rtc_bat */ \ } #endif diff --git a/radio/src/targets/pl18/nb4p_key_driver.cpp b/radio/src/targets/pl18/nb4p_key_driver.cpp index 13242cb9451..9a76ee3f9f6 100644 --- a/radio/src/targets/pl18/nb4p_key_driver.cpp +++ b/radio/src/targets/pl18/nb4p_key_driver.cpp @@ -59,11 +59,11 @@ void keysInit() LL_GPIO_InitTypeDef pinInit; LL_GPIO_StructInit(&pinInit); - pinInit.Pin = ADC_GPIO_PIN_EXT2; + pinInit.Pin = ADC_GPIO_PIN_EXT1; pinInit.Mode = LL_GPIO_MODE_ANALOG; pinInit.Pull = LL_GPIO_PULL_NO; - stm32_gpio_enable_clock(ADC_GPIO_EXT2); - LL_GPIO_Init(ADC_GPIO_EXT2, &pinInit); + stm32_gpio_enable_clock(ADC_GPIO_EXT1); + LL_GPIO_Init(ADC_GPIO_EXT1, &pinInit); // Init ADC clock uint32_t adc_idx = (((uint32_t) ADC_MAIN) - ADC1_BASE) / 0x100UL; @@ -102,8 +102,8 @@ void keysInit() uint16_t _adcRead() { // Configure ADC channel - LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_EXT2); - LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_EXT2, LL_ADC_SAMPLINGTIME_3CYCLES); + LL_ADC_REG_SetSequencerRanks(ADC_MAIN, LL_ADC_REG_RANK_1, ADC_CHANNEL_EXT1); + LL_ADC_SetChannelSamplingTime(ADC_MAIN, ADC_CHANNEL_EXT1, LL_ADC_SAMPLINGTIME_3CYCLES); // Start ADC conversion LL_ADC_REG_StartConversionSWStart(ADC_MAIN); @@ -128,6 +128,11 @@ uint32_t readKeys() else if (value < 512) result |= 1 << KEY_ENTER; #else + uint16_t value = getAnalogValue(4); + if (value >= 3584) + result |= 1 << KEY_EXIT; + else if (value < 512) + result |= 1 << KEY_ENTER; #endif return result; diff --git a/radio/src/targets/pl18/switch_driver.cpp b/radio/src/targets/pl18/switch_driver.cpp index ad2e56bd96e..24624469d88 100644 --- a/radio/src/targets/pl18/switch_driver.cpp +++ b/radio/src/targets/pl18/switch_driver.cpp @@ -33,7 +33,7 @@ #define __weak __attribute__((weak)) static const stm32_switch_t _switch_defs[] = { - { +/* { "S1A", nullptr, 0, nullptr, 0, @@ -44,7 +44,7 @@ static const stm32_switch_t _switch_defs[] = { nullptr, 0, nullptr, 0, SWITCH_HW_2POS, 0 - }, + },*/ { "S2", nullptr, 0, @@ -59,34 +59,35 @@ static const stm32_switch_t _switch_defs[] = { } }; -constexpr uint8_t n_switches = 4; +constexpr uint8_t n_switches = 2; constexpr uint8_t n_fct_switches = 0; constexpr swconfig_t _switch_default_config = (swconfig_t)0 | ((swconfig_t)SWITCH_2POS << (0 * SW_CFG_BITS)) | ((swconfig_t)SWITCH_2POS << (1 * SW_CFG_BITS)) - | ((swconfig_t)SWITCH_2POS << (2 * SW_CFG_BITS)) - | ((swconfig_t)SWITCH_2POS << (3 * SW_CFG_BITS)) +/* | ((swconfig_t)SWITCH_2POS << (2 * SW_CFG_BITS)) + | ((swconfig_t)SWITCH_2POS << (3 * SW_CFG_BITS))*/ ; const switch_display_pos_t _switch_display[] = { { 0, 0 }, { 0, 0 }, - { 0, 0 }, - { 0, 0 }, +/* { 0, 0 }, + { 0, 0 },*/ }; SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) { if (idx <= 1) { - uint16_t swVal = getAnalogValue(4); +// uint16_t swVal = getAnalogValue(4); + uint16_t swVal = getAnalogValue(5); if (idx == 0 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { return SWITCH_HW_DOWN; } if (idx == 1 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { return SWITCH_HW_DOWN; } - } else if (idx <= 3) { + } /*else if (idx <= 3) { uint16_t swVal = getAnalogValue(5); if (idx == 3 && (swVal < 512 || (swVal >= 1536 && swVal < 2560))) { return SWITCH_HW_DOWN; @@ -94,7 +95,7 @@ SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx) if (idx == 2 && (swVal >= 3584 || (swVal >= 1536 && swVal < 2560))) { return SWITCH_HW_DOWN; } - } + }*/ return SWITCH_HW_UP; } diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index 6c4f8f1a31a..1a3fd4d2632 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -1084,10 +1084,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index 31858edca58..16d5c2189f7 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -1099,10 +1099,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 437f1449399..2b363d6af0e 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -1087,10 +1087,10 @@ #define TR_BL_ERASE_FLASH "Slet flash lager" #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY " [SW2] for at bruge fil" - #define TR_BL_FLASH_KEY " Hold [SW2] længe, for brænding" - #define TR_BL_ERASE_KEY " Hold [SW2] længe, for sletning" - #define TR_BL_EXIT_KEY " [SW3] for at forlade" + #define TR_BL_SELECT_KEY " [SW1A] for at bruge fil" + #define TR_BL_FLASH_KEY " Hold [SW1A] længe, for brænding" + #define TR_BL_ERASE_KEY " Hold [SW1A] længe, for sletning" + #define TR_BL_EXIT_KEY " [SW1B] for at forlade" #else #define TR_BL_SELECT_KEY " [TR4 Dn] for at bruge fil" #define TR_BL_FLASH_KEY " Hold [TR4 Dn] længe, for brænding" diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 5ae8eaf079e..8d551ef37de 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -1075,10 +1075,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index f7117da7a1e..e9c05bb8ade 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -1086,10 +1086,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index 834367cd091..ffb2391ed77 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -1085,10 +1085,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 160096e50f0..123638825a7 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -1097,10 +1097,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index b339efa30f4..a138945c39d 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -1096,10 +1096,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index 2288f728a58..b8c18d3f68a 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -1087,10 +1087,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index 181d6e315af..ddacbaa0dc9 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -1082,10 +1082,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/jp.h b/radio/src/translations/jp.h index 61ed3e61eac..031849e8500 100644 --- a/radio/src/translations/jp.h +++ b/radio/src/translations/jp.h @@ -1087,10 +1087,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index b09a49a0b88..0ccd301daa9 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -1090,10 +1090,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index 0df011118f8..3657d088295 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -1085,10 +1085,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index 2812f3f5b42..685e73b1750 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -1091,10 +1091,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/ru.h b/radio/src/translations/ru.h index f01f7e7c293..06c3e0b4ca2 100644 --- a/radio/src/translations/ru.h +++ b/radio/src/translations/ru.h @@ -1090,10 +1090,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index e66960cb622..19f7185ec1c 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -1111,10 +1111,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index fe181e2a9c7..9a70bff4faf 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -1089,10 +1089,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/src/translations/ua.h b/radio/src/translations/ua.h index 248cbdc42f9..4c0272a3295 100644 --- a/radio/src/translations/ua.h +++ b/radio/src/translations/ua.h @@ -1096,10 +1096,10 @@ #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW2] to select file" - #define TR_BL_FLASH_KEY "Hold [SW2] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW2] long to erase" - #define TR_BL_EXIT_KEY "[SW3] to exit" + #define TR_BL_SELECT_KEY "[SW1A] to select file" + #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" + #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] to exit" #else #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index 482cf7d14c7..ead72fb97d7 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -52,8 +52,6 @@ "SJ": { "default": "3POS" } }, "nb4p": { - "S1A": { "default": "TOGGLE" }, - "S1B": { "default": "TOGGLE" }, "S2" : { "default": "TOGGLE" }, "S3" : { "default": "TOGGLE" } }, From 5d93e7265971e61197932c99cfa56973296b9d81 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Mon, 15 Jul 2024 11:59:05 +0800 Subject: [PATCH 12/36] Update Cmakelist --- radio/src/targets/pl18/CMakeLists.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 5203e0e14c7..a7d14e8b9d5 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -128,19 +128,11 @@ set(BOARD_COMMON_SRC ) if(ROTARY_ENCODER) - list(APPEND BOARD_COMMON_SRC + set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC} targets/common/arm/stm32/rotary_encoder_driver.cpp ) endif() -if(PCBREV STREQUAL NB4P) - set(BOARD_SPECIFIC_SRC - ${TARGET_SRC_DIR}/switch_driver.cpp - ) -#else() -# set(BOARD_SPECIFIC_SRC) -endif() - # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} @@ -167,12 +159,14 @@ add_library(board OBJECT EXCLUDE_FROM_ALL targets/common/arm/stm32/trainer_driver.cpp targets/common/arm/stm32/spi_flash.cpp targets/common/arm/stm32/diskio_spi_flash.cpp - drivers/frftl.cpp - + drivers/frftl.cpp ) - set(FIRMWARE_SRC ${FIRMWARE_SRC} $) +if(PCBREV STREQUAL NB4P) + target_sources(board PRIVATE ${TARGET_SRC_DIR}/switch_driver.cpp) +endif() + set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common/arm/loadboot.cpp From 35ee97670348ccf37cc86cb3c690ec01d447c24c Mon Sep 17 00:00:00 2001 From: Richard Li Date: Mon, 15 Jul 2024 15:39:47 +0800 Subject: [PATCH 13/36] Update battery divider for NB4+ --- radio/src/targets/pl18/board.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index d05b45a7b9e..8e3e5ba697a 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -94,7 +94,12 @@ extern "C" void SDRAM_Init(); #define BATTERY_WARN 37 // 3.7V #define BATTERY_MIN 35 // 3.4V #define BATTERY_MAX 43 // 4.3V -#define BATTERY_DIVIDER 962 + +#if defined(RADIO_NB4P) + #define BATTERY_DIVIDER 3102 // = 2047 * (10k / 10k + 10k) * 10 / 3.3V +#else + #define BATTERY_DIVIDER 962 // = 2047 * (22k / 120k + 22k) * 10 / 3.3V +#endif #if defined(__cplusplus) && !defined(SIMU) extern "C" { From ee2badc1a44d16fb85eb39f6f29804564413951e Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 16 Jul 2024 14:20:03 +0800 Subject: [PATCH 14/36] Fixed EM in keys diagnostic screen --- radio/src/targets/pl18/hal.h | 5 +++++ radio/util/hw_defs/stm32_keys.jinja | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 638034f8e70..f2ad38d0499 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -305,6 +305,11 @@ #endif #else + #define KEYS_GPIO_PIN_ENTER + #define KEYS_GPIO_REG_ENTER + #define KEYS_GPIO_PIN_EXIT + #define KEYS_GPIO_REG_EXIT + #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 diff --git a/radio/util/hw_defs/stm32_keys.jinja b/radio/util/hw_defs/stm32_keys.jinja index e3271f56778..2a01d08a2d9 100644 --- a/radio/util/hw_defs/stm32_keys.jinja +++ b/radio/util/hw_defs/stm32_keys.jinja @@ -3,15 +3,18 @@ // This file has been generated from the target's JSON hardware description // +{% set hw_keys = keys | rejectattr('pin', 'none') | rejectattr('gpio', 'none') | list %} static inline void _init_keys() { {% for key_gpio, pins in key_gpios | dictsort %} - stm32_gpio_enable_clock({{ key_gpio }}); + {% if key_gpio %} + stm32_gpio_enable_clock({{ key_gpio }}); + {% endif %} {% endfor %} LL_GPIO_InitTypeDef pinInit; LL_GPIO_StructInit(&pinInit); pinInit.Mode = LL_GPIO_MODE_INPUT; -{% for key in keys %} +{% for key in hw_keys %} pinInit.Pin = {{ key.pin }}; pinInit.Pull = {{ 'LL_GPIO_PULL_UP' if key.active_low else 'LL_GPIO_PULL_DOWN' }}; LL_GPIO_Init({{ key.gpio }}, &pinInit); @@ -21,7 +24,7 @@ static inline void _init_keys() static inline uint32_t _read_keys() { uint32_t keys = 0; -{% for key in keys %} +{% for key in hw_keys %} if ({{'!' if key.active_low }}LL_GPIO_IsInputPinSet({{ key.gpio }}, {{ key.pin }})) keys |= (1 << {{ key.key }}); {% endfor %} From b2039dcb0683d817006f9d8f93e36a420b2f2a20 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Mon, 5 Aug 2024 13:02:05 +0800 Subject: [PATCH 15/36] Map bluetooth port as int module (2 wires) --- radio/src/targets/pl18/CMakeLists.txt | 4 ++ radio/src/targets/pl18/hal.h | 64 ++++++++++++++++++--------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index a7d14e8b9d5..556a0a0c8bc 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -44,6 +44,10 @@ if(PCBREV STREQUAL NB4P) add_definitions(-DRADIO_NB4P) set(ROTARY_ENCODER YES) set(KEY_DRIVER nb4p_key_driver.cpp) + + # Defines internal modules for PL18 via UART7 + set(INTERNAL_MODULES MULTI;AFHDS3;CRSF CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE MULTIMODULE CACHE STRING "Default internal module") elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index f2ad38d0499..f9277403b04 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -611,31 +611,49 @@ // Internal Module #if defined(RADIO_PL18) -#define INTMODULE_RCC_AHB1Periph (RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_DMA1) -#define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 0) // PI.00 -#define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 -#define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 -#define INTMODULE_USART UART7 -#define INTMODULE_GPIO_AF LL_GPIO_AF_8 -#define INTMODULE_USART_IRQn UART7_IRQn -#define INTMODULE_USART_IRQHandler UART7_IRQHandler -#define INTMODULE_DMA DMA1 -#define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 -#define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn -#define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 -#define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 -#define INTMODULE_RX_DMA DMA1 -#define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 -#define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 0) // PI.00 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 + #define INTMODULE_USART UART7 + #define INTMODULE_GPIO_AF LL_GPIO_AF_8 + #define INTMODULE_USART_IRQn UART7_IRQn + #define INTMODULE_USART_IRQHandler UART7_IRQHandler + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn + #define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 // #define INTMODULE_RX_DMA_Stream_IRQn DMA1_Stream3_IRQn // #define INTMODULE_RX_DMA_Stream_IRQHandler DMA1_Stream_IRQHandler -#define INTMODULE_TIMER TIM3 -#define INTMODULE_TIMER_IRQn TIM3_IRQn -#define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler -#define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) -#else -#define INTMODULE_RCC_AHB1Periph 0 + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#elif defined(RADIO_NB4P) + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOI, 8) // PI.08 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOB, 10) // PB.10 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOB, 11) // PB.11 + #define INTMODULE_USART USART3 + #define INTMODULE_GPIO_AF LL_GPIO_AF_7 + #define INTMODULE_USART_IRQn USART3_IRQn + #define INTMODULE_USART_IRQHandler USART3_IRQHandler + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream3_IRQn + #define INTMODULE_DMA_FLAG_TC DMA_FLAG_TCIF1 + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_4 + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_4 + + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) #endif // External Module @@ -706,6 +724,7 @@ #define ROTARY_ENCODER_NAVIGATION //BLUETOOTH +#if !defined(RADIO_NB4P) #define BT_EN_GPIO GPIOI #define BT_EN_GPIO_PIN GPIO_Pin_8 // PI.8 @@ -728,6 +747,7 @@ #define BT_CMD_MODE_GPIO GPIOH #define BT_CMD_MODE_GPIO_PIN GPIO_Pin_6 // PH.6 +#endif // Millisecond timer #define MS_TIMER TIM14 From 583cb716d7b0e9aee4665e248f7e509d9a3bf32c Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 6 Aug 2024 12:57:17 +0800 Subject: [PATCH 16/36] USB should switch back to MCU when exiting bootloader --- radio/src/targets/pl18/bootloader/boot_menu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/src/targets/pl18/bootloader/boot_menu.cpp b/radio/src/targets/pl18/bootloader/boot_menu.cpp index 006dc164568..58e3c5fbff0 100644 --- a/radio/src/targets/pl18/bootloader/boot_menu.cpp +++ b/radio/src/targets/pl18/bootloader/boot_menu.cpp @@ -366,6 +366,9 @@ bool bootloaderRadioMenu(uint32_t menuItem, event_t event) void blExit(void) { +#if defined(USB_SW_GPIO) + USB_SW_TO_MCU(); +#endif lcdClear(); lcdRefresh(); lcdRefreshWait(); From e9961ba7c41ed1db486d7a76a003c55d0eed120b Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 6 Aug 2024 13:57:03 +0800 Subject: [PATCH 17/36] Cleaned up hal.h --- radio/src/targets/pl18/hal.h | 112 +++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index f9277403b04..c9db92e2140 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -51,6 +51,66 @@ // PL18/PL18EV only has virtual keys via trim buttons // #define KEYS_GPIO_PIN_PGUP /* for activating PGUP in keys diagnose screen */ +#if defined(RADIO_NB4P) + // Trims + #define TRIMS_GPIO_REG_LHL + #define TRIMS_GPIO_PIN_LHL + #define TRIMS_GPIO_REG_LHR + #define TRIMS_GPIO_PIN_LHR + #define TRIMS_GPIO_REG_LVD + #define TRIMS_GPIO_PIN_LVD + #define TRIMS_GPIO_REG_LVU + #define TRIMS_GPIO_PIN_LVU + + // Keys + #define KEYS_GPIO_PIN_ENTER + #define KEYS_GPIO_REG_ENTER + #define KEYS_GPIO_PIN_EXIT + #define KEYS_GPIO_REG_EXIT + + #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 + #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 + #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 + #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 + #define ADC_GPIO_EXT1 GPIOC + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_7 // PA.07 + #define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_1 // PC.01 (SW1) + #define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_0 // PC.00 (SW2 SW3) + #define ADC_GPIO_PIN_EXT3 LL_GPIO_PIN_6 // PA.06 (TR1) + #define ADC_GPIO_PIN_EXT4 LL_GPIO_PIN_4 // PC.04 (TR2) + #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 + #define ADC_CHANNEL_EXT1 LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 + #define ADC_CHANNEL_EXT2 LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 + #define ADC_CHANNEL_EXT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_EXT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 + #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_EXT3) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2 | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_EXT4 | ADC_GPIO_PIN_BATT) + + #define ADC_MAIN ADC1 + #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_DMA DMA2 + #define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 + #define ADC_DMA_STREAM LL_DMA_STREAM_4 + #define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn + #define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler + + #define ADC_VREF_PREC2 660 + + #define ADC_DIRECTION { \ + 0,0, /* gimbals */ \ + 0,0, /* pots */ \ + 0,0,0,0, /* ext1-4 */ \ + 0, /* vbat */ \ + 0 /* rtc_bat */ \ + } + +#else // !defined(RADIO_NB4P) + // Trims #define TRIMS_GPIO_REG_LHL #define TRIMS_GPIO_PIN_LHL @@ -64,7 +124,6 @@ #define TRIMS_GPIO_REG_LVU #define TRIMS_GPIO_PIN_LVU -#if !defined(RADIO_NB4P) #define TRIMS_GPIO_REG_RHL #define TRIMS_GPIO_PIN_RHL @@ -304,57 +363,6 @@ } #endif -#else - #define KEYS_GPIO_PIN_ENTER - #define KEYS_GPIO_REG_ENTER - #define KEYS_GPIO_PIN_EXIT - #define KEYS_GPIO_REG_EXIT - - #define ADC_GPIO_PIN_STICK_TH LL_GPIO_PIN_3 // PA.03 - #define ADC_GPIO_PIN_STICK_ST LL_GPIO_PIN_2 // PA.02 - #define ADC_CHANNEL_STICK_TH LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 - #define ADC_CHANNEL_STICK_ST LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 -// #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 //PC.01 -// #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_0 //PC.00 -// #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 -// #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 - #define ADC_GPIO_EXT1 GPIOC - #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_2 // PC.02 - #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_7 // PA.07 - #define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_1 // PC.01 (SW1) - #define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_0 // PC.00 (SW2 SW3) - #define ADC_GPIO_PIN_EXT3 LL_GPIO_PIN_6 // PA.06 (TR1) - #define ADC_GPIO_PIN_EXT4 LL_GPIO_PIN_4 // PC.04 (TR2) - #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 - #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_12 // ADC123_IN12 -> ADC1_IN12 - #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 - #define ADC_CHANNEL_EXT1 LL_ADC_CHANNEL_11 // ADC123_IN11 -> ADC1_IN11 - #define ADC_CHANNEL_EXT2 LL_ADC_CHANNEL_10 // ADC123_IN10 -> ADC1_IN10 - #define ADC_CHANNEL_EXT3 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 - #define ADC_CHANNEL_EXT4 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 - #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 - #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 - #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_TH | ADC_GPIO_PIN_STICK_ST | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_EXT3) - #define ADC_GPIOC_PINS (ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2 | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_EXT4 | ADC_GPIO_PIN_BATT) - -#define ADC_MAIN ADC1 -#define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES -#define ADC_DMA DMA2 -#define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 -#define ADC_DMA_STREAM LL_DMA_STREAM_4 -#define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn -#define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler - -#define ADC_VREF_PREC2 660 - -#define ADC_DIRECTION { \ - 0,0, /* gimbals */ \ - 0,0, /* pots */ \ - 0,0,0,0, /* ext1-4 */ \ - 0, /* vbat */ \ - 0 /* rtc_bat */ \ - } - #endif From f849f1e65c62c9d46d6c547e2d0da094b0ae8e19 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 8 Aug 2024 06:14:44 +0000 Subject: [PATCH 18/36] chore(ci): build nb4p firmware --- .github/workflows/actions.yml | 2 ++ .github/workflows/nightly.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index d101050c1c1..a28ab43e0d6 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -70,6 +70,7 @@ jobs: - xlite - xlites - mt12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: @@ -115,6 +116,7 @@ jobs: - x9lite;x9lites - xlite;xlites - mt12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 22a237b88e4..164b6ec81dc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -35,6 +35,7 @@ jobs: - x9lite;x9lites - xlite;xlites - mt12 + - nb4p container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: From c36348dea39a678240fae5ec2b083d75dc8a1a07 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 8 Aug 2024 06:28:49 +0000 Subject: [PATCH 19/36] chore: define nb4p as a surface radio --- radio/src/targets/pl18/board.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 8e3e5ba697a..968456c9862 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -29,6 +29,10 @@ #include "hal/serial_port.h" #include "hal/watchdog_driver.h" +#ifdef ADC_GPIO_PIN_STICK_TH +#define SURFACE_RADIO true +#endif + #define FLASHSIZE 0x200000 #define FLASH_PAGESIZE 256 #define BOOTLOADER_SIZE 0x20000 From 7ee556fc3a4a4d389e6d7e660ffcde7a4b5bdccf Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 8 Aug 2024 06:30:03 +0000 Subject: [PATCH 20/36] chore: consistent formatting --- radio/src/targets/pl18/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 968456c9862..d48634cd956 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -29,7 +29,7 @@ #include "hal/serial_port.h" #include "hal/watchdog_driver.h" -#ifdef ADC_GPIO_PIN_STICK_TH +#if defined(ADC_GPIO_PIN_STICK_TH) #define SURFACE_RADIO true #endif From 6b1c2835757c5d294f989d418cb604a24f51b941 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 8 Aug 2024 16:28:37 +0800 Subject: [PATCH 21/36] Updated naming of switches and pots according to what is printed in the radio --- radio/src/targets/pl18/switch_driver.cpp | 8 ++++---- radio/util/hw_defs/legacy_names.py | 4 ++-- radio/util/hw_defs/switch_config.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/radio/src/targets/pl18/switch_driver.cpp b/radio/src/targets/pl18/switch_driver.cpp index 24624469d88..77f62ab7085 100644 --- a/radio/src/targets/pl18/switch_driver.cpp +++ b/radio/src/targets/pl18/switch_driver.cpp @@ -34,25 +34,25 @@ static const stm32_switch_t _switch_defs[] = { /* { - "S1A", + "SW1L", nullptr, 0, nullptr, 0, SWITCH_HW_2POS, 0 }, { - "S1B", + "SW1R", nullptr, 0, nullptr, 0, SWITCH_HW_2POS, 0 },*/ { - "S2", + "SW2", nullptr, 0, nullptr, 0, SWITCH_HW_2POS, 0 }, { - "S3", + "SW3", nullptr, 0, nullptr, 0, SWITCH_HW_2POS, 0 diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index b2891c2611f..6f1b6e02413 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -644,14 +644,14 @@ "P1": { "yaml": "POT1", "lua": "s1", - "label": "S1", + "label": "VR1L", "short_label": "1", "description": "Potentiometer 1" }, "P2": { "yaml": "POT2", "lua": "s2", - "label": "S2", + "label": "VR1R", "short_label": "2", "description": "Potentiometer 2" }, diff --git a/radio/util/hw_defs/switch_config.py b/radio/util/hw_defs/switch_config.py index ead72fb97d7..848ad501d01 100644 --- a/radio/util/hw_defs/switch_config.py +++ b/radio/util/hw_defs/switch_config.py @@ -52,8 +52,8 @@ "SJ": { "default": "3POS" } }, "nb4p": { - "S2" : { "default": "TOGGLE" }, - "S3" : { "default": "TOGGLE" } + "SW2" : { "default": "TOGGLE" }, + "SW3" : { "default": "TOGGLE" } }, "lr3pro": { # left side From e9c8ee151172cbefe63ea8c27369f0b323fdadc4 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 18 Aug 2024 17:31:26 +0800 Subject: [PATCH 22/36] Fixed build problem by PR #5396 --- radio/src/targets/pl18/switch_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/pl18/switch_driver.cpp b/radio/src/targets/pl18/switch_driver.cpp index 77f62ab7085..a8d644b30fc 100644 --- a/radio/src/targets/pl18/switch_driver.cpp +++ b/radio/src/targets/pl18/switch_driver.cpp @@ -24,7 +24,7 @@ //#include "stm32_gpio_driver.h" #include "definitions.h" -#include "opentx_constants.h" +#include "edgetx_constants.h" #include "myeeprom.h" #include "hal/adc_driver.h" From d5e9c22a4412d5e85610aa5e3566c45c699807ee Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 19 Aug 2024 05:01:22 +0000 Subject: [PATCH 23/36] chore: formatting --- radio/src/gui/colorlcd/radio/radio_diagkeys.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp index 3f17e90c535..343ea4602af 100644 --- a/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp +++ b/radio/src/gui/colorlcd/radio/radio_diagkeys.cpp @@ -26,7 +26,8 @@ #include "edgetx.h" #if defined(RADIO_NB4P) -static const uint8_t _trimMap[MAX_TRIMS * 2] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; +static const uint8_t _trimMap[MAX_TRIMS * 2] = {0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15}; #elif defined(PCBPL18) static const uint8_t _trimMap[MAX_TRIMS * 2] = {8, 9, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 0, 1, 6, 7}; From ab73c60b976d9cb27c06b71d990ed7b97757de60 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 21 Aug 2024 11:35:14 +0800 Subject: [PATCH 24/36] Added touch type display --- radio/src/gui/colorlcd/radio/radio_version.cpp | 4 ++++ radio/src/targets/pl18/touch_driver.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/radio/src/gui/colorlcd/radio/radio_version.cpp b/radio/src/gui/colorlcd/radio/radio_version.cpp index 826ae4d4f5a..23e176d1a3e 100644 --- a/radio/src/gui/colorlcd/radio/radio_version.cpp +++ b/radio/src/gui/colorlcd/radio/radio_version.cpp @@ -340,6 +340,7 @@ RadioVersionPage::RadioVersionPage() : #if defined(PCBNV14) || defined(PCBPL18) extern const char* boardLcdType; +extern const char* boardTouchType; #endif void RadioVersionPage::build(Window* window) @@ -370,6 +371,9 @@ void RadioVersionPage::build(Window* window) version += nl; version += "LCD: "; version += boardLcdType; + version += nl; + version += "Touch: "; + version += boardTouchType; #endif auto txt = new StaticText(window, rect_t{}, version); diff --git a/radio/src/targets/pl18/touch_driver.cpp b/radio/src/targets/pl18/touch_driver.cpp index c2ca11cdc0a..97931c2d37f 100644 --- a/radio/src/targets/pl18/touch_driver.cpp +++ b/radio/src/targets/pl18/touch_driver.cpp @@ -107,6 +107,7 @@ union rpt_point_t extern uint8_t TouchControllerType; +const char* boardTouchType = ""; static const TouchControllerDescriptor *tcd = nullptr; static TouchState internalTouchState = {}; volatile static bool touchEventOccured; @@ -323,14 +324,17 @@ void _detect_touch_controller() if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CST340_I2C_ADDRESS, 3, I2C_TIMEOUT_MAX) == 0) { touchController = TC_CST340; tcd = &CST340; + boardTouchType = "CST340"; TouchControllerType = 0; } else if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CHSC5448_I2C_ADDRESS, 3, I2C_TIMEOUT_MAX) == 0) { touchController = TC_CHSC5448; tcd = &CHSC5448; TouchControllerType = 0; + boardTouchType = "CHSC5448"; } else { touchController = TC_FT6236; tcd = &FT6236; + boardTouchType = "FT6236"; #if defined(RADIO_NB4P) TouchControllerType = 0; #else From 072708fc4d47df2b777e1149a24990961cb27dc8 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Wed, 21 Aug 2024 06:38:30 +0000 Subject: [PATCH 25/36] chore: add USE_RTC_CLOCK build time option To allow easier disabling --- radio/src/targets/pl18/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 556a0a0c8bc..0d1db905258 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -22,6 +22,8 @@ set(HARDWARE_EXTERNAL_MODULE YES) #option(STICKS_DEAD_ZONE "Enable sticks dead zone" YES) #option(AFHDS2 "Support for AFHDS2" OFF) +option(USE_RTC_CLOCK "RTC Clock" ON) + # for size report script set(CPU_TYPE_FULL STM32F429xI) set(TARGET_LINKER_DIR stm32f429_sdram) @@ -85,12 +87,17 @@ add_definitions( set(SDRAM ON) -add_definitions(-DAUDIO -DVOICE -DRTCLOCK) +add_definitions(-DAUDIO -DVOICE) add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE}) add_definitions(-DPWR_BUTTON_${PWR_BUTTON}) add_definitions(-DCROSSFIRE_NATIVE) add_definitions(-DHARDWARE_EXTERNAL_MODULE) +if(USE_RTC_CLOCK) + message("-- RTC Clock enabled") + add_definitions(-DRTCLOCK) +endif() + if(WIRELESS_CHARGER) add_definitions(-DWIRELESS_CHARGER) endif() From c37c293d2e6eee1080f9b916e2c151abf6500df3 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 22 Aug 2024 09:58:55 +0800 Subject: [PATCH 26/36] Fixed nv14 target build error --- radio/src/targets/nv14/touch_driver.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/src/targets/nv14/touch_driver.cpp b/radio/src/targets/nv14/touch_driver.cpp index e79ba84acfb..36467e0ad14 100644 --- a/radio/src/targets/nv14/touch_driver.cpp +++ b/radio/src/targets/nv14/touch_driver.cpp @@ -45,6 +45,7 @@ volatile static bool touchEventOccured; enum TouchControllers {TC_NONE, TC_FT6236, TC_CST836U}; TouchControllers touchController = TC_NONE; +const char* boardTouchType = ""; static tc_handle_TypeDef tc_handle = {0, 0}; tmr10ms_t downTime = 0; @@ -388,9 +389,11 @@ void detectTouchController() { touchController = TC_CST836U; tc = &CST836U; + boardTouchType = "CST836U"; } else { touchController = TC_FT6236; tc = &FT6236; + boardTouchType = "FT6236"; } } From 6addcb01c65b11960fcb4360398b2585de5116b3 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 22 Aug 2024 11:23:07 +0800 Subject: [PATCH 27/36] Fixed NB4+ int module power logic --- radio/src/targets/pl18/board.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index d48634cd956..9054787d86f 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -65,8 +65,14 @@ extern "C" void SDRAM_Init(); // Pulses driver #if !defined(SIMU) -#define INTERNAL_MODULE_ON() gpio_set(INTMODULE_PWR_GPIO) -#define INTERNAL_MODULE_OFF() gpio_clear(INTMODULE_PWR_GPIO); +#if defined(RADIO_NB4P) + #define INTERNAL_MODULE_ON() gpio_clear(INTMODULE_PWR_GPIO) + #define INTERNAL_MODULE_OFF() gpio_set(INTMODULE_PWR_GPIO); +#else + #define INTERNAL_MODULE_ON() gpio_set(INTMODULE_PWR_GPIO) + #define INTERNAL_MODULE_OFF() gpio_clear(INTMODULE_PWR_GPIO); +#endif + #define EXTERNAL_MODULE_ON() gpio_set(EXTMODULE_PWR_GPIO) #define EXTERNAL_MODULE_OFF() gpio_clear(EXTMODULE_PWR_GPIO) #define EXTERNAL_MODULE_PWR_OFF EXTERNAL_MODULE_OFF From 8652c9663b7c4ed9e6a90dc3602c79dddaacf28a Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 7 Aug 2024 16:27:13 +0800 Subject: [PATCH 28/36] Better handling reboot --- radio/src/targets/pl18/board.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 43df6747061..0454695628d 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -221,7 +221,6 @@ void boardOff() ledStripOff(); if (isChargerActive()) { - delay_ms(100); // Add a delay to wait for lcdOff // RTC->BKP0R = SOFTRESET_REQUEST; NVIC_SystemReset(); } From 1c9d01aad66df2d8e1e48623ad152e583fbb3c48 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 6 Aug 2024 12:26:52 +0800 Subject: [PATCH 29/36] Initial merge of nv14 target to pl18 target --- radio/src/datastructs.h | 6 +- radio/src/targets/pl18/CMakeLists.txt | 33 ++- radio/src/targets/pl18/board.cpp | 38 +++ radio/src/targets/pl18/board.h | 13 + .../src/targets/pl18/bootloader/boot_menu.cpp | 2 +- radio/src/targets/pl18/hal.h | 268 ++++++++++++++---- radio/src/targets/pl18/usb_descriptor.h | 10 +- radio/src/translations/cn.h | 27 +- radio/src/translations/cz.h | 43 +-- radio/src/translations/da.h | 51 ++-- radio/src/translations/de.h | 43 +-- radio/src/translations/en.h | 27 +- radio/src/translations/es.h | 27 +- radio/src/translations/fi.h | 27 +- radio/src/translations/fr.h | 43 +-- radio/src/translations/he.h | 27 +- radio/src/translations/it.h | 43 +-- radio/src/translations/jp.h | 27 +- radio/src/translations/nl.h | 27 +- radio/src/translations/pl.h | 43 +-- radio/src/translations/pt.h | 27 +- radio/src/translations/ru.h | 27 +- radio/src/translations/se.h | 43 +-- radio/src/translations/tw.h | 27 +- radio/src/translations/ua.h | 39 ++- 25 files changed, 668 insertions(+), 320 deletions(-) diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 5d48b1d6786..0fe3baab2c6 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -102,14 +102,14 @@ static inline void check_struct() CHKSIZE(ModelData, 6770); #elif defined(PCBX7) || defined(PCBXLITE) || defined(PCBX9LITE) CHKSIZE(ModelData, 6329); -#elif defined(PCBNV14) - CHKSIZE(ModelData, 26463); #elif defined(PCBPL18) - #if defined(RADIO_NB4P) + #if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) CHKSIZE(ModelData, 26499); #else CHKSIZE(ModelData, 26845); #endif +#elif defined(PCBNV14) + CHKSIZE(ModelData, 21899); #elif defined(RADIO_T15) CHKSIZE(ModelData, 26834); #elif defined(PCBHORUS) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 0d1db905258..247304cf1f4 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -41,10 +41,30 @@ add_definitions(-DSOFTWARE_VOLUME) add_definitions(-DSPI_FLASH) add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) -if(PCBREV STREQUAL NB4P) +if (PCBREV STREQUAL EL18) + set(FLAVOUR el18) + add_definitions(-DRADIO_EL18 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) + set(USE_VS1053B ON) + set(AFHDS3 ON) + + # defines existing internal modules + set(INTERNAL_MODULES AFHDS3;CRSF CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS3 CACHE STRING "Default internal module") +elseif(PCBREV STREQUAL NV14) + set(FLAVOUR nv14) + add_definitions(-DRADIO_NV14 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) + set(USE_VS1053B ON) + set(HAS_SDIO ON) + set(AFHDS2 ON) + + # defines existing internal modules + set(INTERNAL_MODULES AFHDS2A CACHE STRING "Internal modules") + set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS2A CACHE STRING "Default internal module") +elseif(PCBREV STREQUAL NB4P) set(FLAVOUR nb4p) add_definitions(-DRADIO_NB4P) set(ROTARY_ENCODER YES) + set(AFHDS3 ON) set(KEY_DRIVER nb4p_key_driver.cpp) # Defines internal modules for PL18 via UART7 @@ -55,12 +75,14 @@ elseif(PCBREV STREQUAL PL18EV) add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(AFHDS3 ON) set(KEY_DRIVER key_driver.cpp) else() set(FLAVOUR pl18) add_definitions(-DRADIO_PL18 -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(AFHDS3 ON) set(KEY_DRIVER key_driver.cpp) # Defines internal modules for PL18 via UART7 @@ -110,8 +132,6 @@ if(NOT UNEXPECTED_SHUTDOWN) add_definitions(-DNO_UNEXPECTED_SHUTDOWN) endif() -set(AFHDS3 ON) - # VCP CLI set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough") set(CLI ON CACHE BOOL "Enable CLI") @@ -158,7 +178,6 @@ add_library(board OBJECT EXCLUDE_FROM_ALL ${BOARD_SPECIFIC_SRC} ${TARGET_SRC_DIR}/${TOUCH_DRIVER} ${TARGET_SRC_DIR}/battery_driver.cpp - targets/common/arm/stm32/audio_dac_driver.cpp targets/common/arm/stm32/delays_driver.cpp targets/common/arm/stm32/heartbeat_driver.cpp targets/common/arm/stm32/mixer_scheduler_driver.cpp @@ -178,6 +197,12 @@ if(PCBREV STREQUAL NB4P) target_sources(board PRIVATE ${TARGET_SRC_DIR}/switch_driver.cpp) endif() +if(USE_VS1053B) + target_sources(board PRIVATE targets/common/arm/stm32/vs1053b.cpp) +else() + target_sources(board PRIVATE targets/common/arm/stm32/audio_dac_driver.cpp) +endif() + set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common/arm/loadboot.cpp diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index 0454695628d..f934fb79459 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -70,6 +70,25 @@ extern "C" void initialise_monitor_handles(); extern "C" void flushFTL(); #endif +#if defined(RADIO_NV14_FAMILY) + HardwareOptions hardwareOptions; + + static uint8_t boardGetPcbRev() + { + gpio_init(INTMODULE_PWR_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); + delay_ms(1); // delay to let the input settle, else it does not work properly + + // detect NV14 vs EL18 + if (gpio_read(INTMODULE_PWR_GPIO)) { + // pull-up connected: EL18 + return PCBREV_EL18; + } else { + // pull-down connected: NV14 + return PCBREV_NV14; + } + } +#endif + void delay_self(int count) { for (int i = 50000; i > 0; i--) @@ -98,6 +117,15 @@ void boardBLInit() { // USB charger status pins gpio_init(UCHARGER_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); + +#if defined(USB_SW_GPIO) + gpio_init(USB_SW_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW); +#endif + +#if defined(RADIO_NV14_FAMILY) + // detect NV14 vs EL18 + hardwareOptions.pcbrev = boardGetPcbRev(); +#endif } #if defined(RADIO_NB4P) @@ -107,6 +135,13 @@ void boardBLPreJump() } #endif +static void monitorInit() +{ +#if defined(VBUS_MONITOR_GPIO) + gpio_init(VBUS_MONITOR_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW); +#endif +} + void boardInit() { #if defined(SEMIHOSTING) @@ -179,6 +214,7 @@ void boardInit() disableVoiceChip(); #endif audioInit(); + monitorInit(); adcInit(&_adc_driver); hapticInit(); @@ -252,6 +288,7 @@ void boardOff() } } +#if !defined(RADIO_NV14_FAMILY) int usbPlugged() { static uint8_t debouncedState = 0; @@ -269,3 +306,4 @@ int usbPlugged() return debouncedState; } +#endif diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 9054787d86f..5acce298ee0 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -59,6 +59,19 @@ void boardOff(); #define LEN_CPU_UID (3*8+2) void getCPUUniqueID(char * s); +#if defined(RADIO_NV14_FAMILY) + enum { + PCBREV_NV14 = 0, + PCBREV_EL18 = 1, + }; + + typedef struct { + uint8_t pcbrev; + } HardwareOptions; + + extern HardwareOptions hardwareOptions; +#endif + // SDRAM driver extern "C" void SDRAM_Init(); diff --git a/radio/src/targets/pl18/bootloader/boot_menu.cpp b/radio/src/targets/pl18/bootloader/boot_menu.cpp index 58e3c5fbff0..151bf7c4226 100644 --- a/radio/src/targets/pl18/bootloader/boot_menu.cpp +++ b/radio/src/targets/pl18/bootloader/boot_menu.cpp @@ -192,7 +192,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawTitle(TR_BL_RF_USB_ACCESS); lcd->drawText(menuItemX + 2, 75, LV_SYMBOL_USB, BL_FOREGROUND); - coord_t pos = lcd->drawText(menuItemX + 24, 75, rfUsbAccess ? TR_DISABLE : TR_ENABLE, BL_FOREGROUND); + coord_t pos = lcd->drawText(menuItemX + 24, 75, rfUsbAccess ? TR_BL_DISABLE : TR_BL_ENABLE, BL_FOREGROUND); pos += 8; lcd->drawText(menuItemX + 2, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index c9db92e2140..060a73d300b 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -51,7 +51,106 @@ // PL18/PL18EV only has virtual keys via trim buttons // #define KEYS_GPIO_PIN_PGUP /* for activating PGUP in keys diagnose screen */ -#if defined(RADIO_NB4P) +#if defined(RADIO_NV14_FAMILY) + // Trims + #define TRIMS_GPIO_REG_RHL GPIOD + #define TRIMS_GPIO_PIN_RHL LL_GPIO_PIN_7 // PD.07 + #define TRIMS_GPIO_REG_RHR GPIOG + #define TRIMS_GPIO_PIN_RHR LL_GPIO_PIN_10 // PG.10 + #define TRIMS_GPIO_REG_RVD GPIOJ + #define TRIMS_GPIO_PIN_RVD LL_GPIO_PIN_0 // PJ.00 + #define TRIMS_GPIO_REG_RVU GPIOB + #define TRIMS_GPIO_PIN_RVU LL_GPIO_PIN_15 // PB.15 + + #define TRIMS_GPIO_REG_LHL GPIOH + #define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_2 // PH.02 + #define TRIMS_GPIO_REG_LHR GPIOG + #define TRIMS_GPIO_PIN_LHR LL_GPIO_PIN_2 // PG.02 + #define TRIMS_GPIO_REG_LVU GPIOH + #define TRIMS_GPIO_PIN_LVU LL_GPIO_PIN_7 // PH.07 + #define TRIMS_GPIO_REG_LVD GPIOJ + #define TRIMS_GPIO_PIN_LVD LL_GPIO_PIN_12 // PJ.12 + + // Keys + #define KEYS_GPIO_REG_ENTER GPIOC + #define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_13 // PC.13 + #define KEYS_GPIO_REG_EXIT GPIOG + #define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_11 // PG.11 + + // Monitor pin + #define VBUS_MONITOR_GPIO GPIO_PIN(GPIOJ, 14) // PJ.14 + + // ADC + + #define ADC_GPIO_PIN_STICK_LH LL_GPIO_PIN_2 // PA.02 + #define ADC_GPIO_PIN_STICK_LV LL_GPIO_PIN_3 // PA.03 + #define ADC_GPIO_PIN_STICK_RH LL_GPIO_PIN_4 // PA.04 + #define ADC_GPIO_PIN_STICK_RV LL_GPIO_PIN_5 // PA.05 + + #define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_6 // PA.06 VRA + #define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_4 // PC.04 VRB + #define ADC_GPIO_PIN_SWA LL_GPIO_PIN_1 // PB.01 + #define ADC_GPIO_PIN_SWB LL_GPIO_PIN_8 // PF.08 + #define ADC_GPIO_PIN_SWC LL_GPIO_PIN_0 // PB.00 + #define ADC_GPIO_PIN_SWD LL_GPIO_PIN_10 // PF.10 + #define ADC_GPIO_PIN_SWE LL_GPIO_PIN_0 // PC.00 + #define ADC_GPIO_PIN_SWF LL_GPIO_PIN_1 // PC.01 + #define ADC_GPIO_PIN_SWG LL_GPIO_PIN_2 // PC.02 + #define ADC_GPIO_PIN_SWH LL_GPIO_PIN_7 // PA.07 + + #define ADC_GPIO_PIN_BATT LL_GPIO_PIN_5 // PC.05 + + #define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_STICK_RV | ADC_GPIO_PIN_STICK_RH \ + | ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_SWH) + #define ADC_GPIOB_PINS (ADC_GPIO_PIN_SWA | ADC_GPIO_PIN_SWC) + #define ADC_GPIOC_PINS (ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_SWE | ADC_GPIO_PIN_SWF | ADC_GPIO_PIN_SWG | ADC_GPIO_PIN_BATT) + #define ADC_GPIOF_PINS (ADC_GPIO_PIN_SWB | ADC_GPIO_PIN_SWD) + + #define ADC_CHANNEL_STICK_LH LL_ADC_CHANNEL_2 // ADC123_IN2 -> ADC1_IN2 + #define ADC_CHANNEL_STICK_LV LL_ADC_CHANNEL_3 // ADC123_IN3 -> ADC1_IN3 + #define ADC_CHANNEL_STICK_RH LL_ADC_CHANNEL_4 // ADC12_IN4 -> ADC1_IN4 + #define ADC_CHANNEL_STICK_RV LL_ADC_CHANNEL_5 // ADC12_IN5 -> ADC1_IN5 + + #define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_6 // ADC12_IN6 -> ADC1_IN6 + #define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_14 // ADC12_IN14 -> ADC1_IN14 + #define ADC_CHANNEL_SWA LL_ADC_CHANNEL_9 // ADC12_IN9 -> ADC1_IN9 + #define ADC_CHANNEL_SWB LL_ADC_CHANNEL_6 // ADC3_IN6 -> ADC3_IN6 + #define ADC_CHANNEL_SWC LL_ADC_CHANNEL_8 // ADC12_IN8 -> ADC1_IN8 + #define ADC_CHANNEL_SWD LL_ADC_CHANNEL_8 // ADC3_IN8 -> ADC3_IN8 + #define ADC_CHANNEL_SWE LL_ADC_CHANNEL_10 // ADC123_IN10-> ADC1_IN10 + #define ADC_CHANNEL_SWF LL_ADC_CHANNEL_11 // ADC123_IN11-> ADC1_IN11 + #define ADC_CHANNEL_SWG LL_ADC_CHANNEL_12 // ADC123_IN12-> ADC1_IN12 + #define ADC_CHANNEL_SWH LL_ADC_CHANNEL_7 // ADC12_IN7 -> ADC1_IN7 + + #define ADC_CHANNEL_BATT LL_ADC_CHANNEL_15 // ADC12_IN15 -> ADC1_IN15 + #define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18 + + #define ADC_MAIN ADC1 + #define ADC_EXT ADC3 + #define ADC_EXT_CHANNELS { ADC_CHANNEL_SWB, ADC_CHANNEL_SWD } + #define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_DMA DMA2 + #define ADC_DMA_CHANNEL LL_DMA_CHANNEL_0 + #define ADC_DMA_STREAM LL_DMA_STREAM_4 + #define ADC_DMA_STREAM_IRQ DMA2_Stream4_IRQn + #define ADC_DMA_STREAM_IRQHandler DMA2_Stream4_IRQHandler + + #define ADC_EXT_DMA DMA2 + #define ADC_EXT_DMA_CHANNEL LL_DMA_CHANNEL_2 + #define ADC_EXT_DMA_STREAM LL_DMA_STREAM_0 + #define ADC_EXT_DMA_STREAM_IRQ DMA2_Stream0_IRQn + #define ADC_EXT_DMA_STREAM_IRQHandler DMA2_Stream0_IRQHandler + #define ADC_EXT_SAMPTIME LL_ADC_SAMPLINGTIME_28CYCLES + #define ADC_VREF_PREC2 660 + + #define ADC_DIRECTION \ + { 0 /*STICK1*/, 0 /*STICK2*/, 0 /*STICK3*/, 0 /*STICK4*/, \ + -1 /*POT1*/, 0 /*POT2*/, 0 /*TX_VOLTAGE*/, 0 /*TX_VBAT*/, \ + 0 /*SWA*/, 0 /*SWB*/, 0 /*SWC*/, 0 /*SWD*/, 0 /*SWE*/, \ + -1 /*SWF*/, -1 /*SWG*/, 0 /*SWH*/ \ + } + +#elif defined(RADIO_NB4P) // Trims #define TRIMS_GPIO_REG_LHL #define TRIMS_GPIO_PIN_LHL @@ -109,7 +208,7 @@ 0 /* rtc_bat */ \ } -#else // !defined(RADIO_NB4P) +#else // !defined(RADIO_NB4P) && !defined(RADIO_NV14_FAMILY) // Trims #define TRIMS_GPIO_REG_LHL @@ -365,7 +464,6 @@ #endif - // Power #define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 #define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 @@ -459,11 +557,15 @@ // USB #define USB_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOA #define USB_GPIO GPIOA -// #define USB_GPIO_VBUS GPIO_PIN(GPIOA,9) // PA.09 #define USB_GPIO_DM GPIO_PIN(GPIOA, 11) // PA.11 #define USB_GPIO_DP GPIO_PIN(GPIOA, 12) // PA.12 #define USB_GPIO_AF GPIO_AF10 +#if defined(RADIO_NV14_FAMILY) +#define USB_GPIO_VBUS GPIO_PIN(GPIOA,9) // PA.09 +#define USB_SW_GPIO GPIO_PIN(GPIOI, 10) // PI.10 +#endif + // LCD #define LCD_NRST_GPIO GPIO_PIN(GPIOG, 9) // PG.09 #define LCD_SPI_CS_GPIO GPIO_PIN(GPIOE, 4) // PE.04 @@ -476,7 +578,7 @@ // Backlight // TODO TIM3, TIM8, TIM14, review the channel in backlight_driver.cpp according to the chosen timer #define BACKLIGHT_RCC_APB2Periph 0 -#define BACKLIGHT_GPIO GPIO_PIN(GPIOA, 15) +#define BACKLIGHT_GPIO GPIO_PIN(GPIOA, 15) // PA.15 #define BACKLIGHT_TIMER TIM2 #define BACKLIGHT_GPIO_AF GPIO_AF1 #define BACKLIGHT_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) @@ -505,6 +607,19 @@ #define ROTARY_ENCODER_TIMER_IRQHandler TIM8_UP_TIM13_IRQHandler #endif +#if defined(RADIO_NV14_FAMILY) + // SD card + #define SD_PRESENT_GPIO GPIO_PIN(GPIOH, 10) // PH.10 + #define SD_SDIO_DMA DMA2 + #define SD_SDIO_DMA_STREAM DMA2_Stream3 + #define SD_SDIO_DMA_CHANNEL LL_DMA_CHANNEL_4 + #define SD_SDIO_DMA_IRQn DMA2_Stream3_IRQn + #define SD_SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler + #define SD_SDIO_CLK_DIV(fq) ((48000000 / (fq)) - 2) + #define SD_SDIO_INIT_CLK_DIV SD_SDIO_CLK_DIV(400000) + #define SD_SDIO_TRANSFER_CLK_DIV SD_SDIO_CLK_DIV(24000000) +#endif + // SPI NOR Flash #define FLASH_SPI SPI6 #define FLASH_SPI_CS_GPIO GPIOG @@ -517,25 +632,54 @@ #define FLASH_SPI_DMA_CHANNEL LL_DMA_CHANNEL_1 #define FLASH_SPI_DMA_TX_STREAM LL_DMA_STREAM_5 #define FLASH_SPI_DMA_RX_STREAM LL_DMA_STREAM_6 -#define STORAGE_USE_SPI_FLASH + +#if defined(RADIO_NV14_FAMILY) + #define STORAGE_USE_SDIO +#else + #define STORAGE_USE_SPI_FLASH +#endif // SDRAM #define SDRAM_RCC_AHB1Periph (RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOH) #define SDRAM_RCC_AHB3Periph RCC_AHB3Periph_FMC // Audio -#define AUDIO_RCC_APB1Periph (RCC_APB1Periph_TIM6 | RCC_APB1Periph_DAC) -#define AUDIO_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_DMA1) -#define AUDIO_OUTPUT_GPIO GPIO_PIN(GPIOA, 4) // PA.04 -#define AUDIO_DMA_Stream DMA1_Stream5 -#define AUDIO_DMA_Stream_IRQn DMA1_Stream5_IRQn -#define AUDIO_TIM_IRQn TIM6_DAC_IRQn -#define AUDIO_TIM_IRQHandler TIM6_DAC_IRQHandler -#define AUDIO_DMA_Stream_IRQHandler DMA1_Stream5_IRQHandler -#define AUDIO_TIMER TIM6 -#define AUDIO_DMA DMA1 +#if defined(RADIO_NV14_FAMILY) + #define AUDIO_XDCS_GPIO GPIOH + #define AUDIO_XDCS_GPIO_PIN LL_GPIO_PIN_14 // PH.14 + #define AUDIO_CS_GPIO GPIOH + #define AUDIO_CS_GPIO_PIN LL_GPIO_PIN_13 // PH.13 + #define AUDIO_DREQ_GPIO GPIOH + #define AUDIO_DREQ_GPIO_PIN LL_GPIO_PIN_15 // PH.15 + #define AUDIO_RST_GPIO GPIOD + #define AUDIO_RST_GPIO_PIN LL_GPIO_PIN_4 // PD.04 + #define AUDIO_SPI SPI1 + #define AUDIO_SPI_GPIO_AF LL_GPIO_AF_5 + #define AUDIO_SPI_SCK_GPIO GPIOB + #define AUDIO_SPI_SCK_GPIO_PIN LL_GPIO_PIN_3 // PB.03 + #define AUDIO_SPI_MISO_GPIO GPIOB + #define AUDIO_SPI_MISO_GPIO_PIN LL_GPIO_PIN_4 // PB.04 + #define AUDIO_SPI_MOSI_GPIO GPIOB + #define AUDIO_SPI_MOSI_GPIO_PIN LL_GPIO_PIN_5 // PB.05 +#else + #define AUDIO_RCC_APB1Periph (RCC_APB1Periph_TIM6 | RCC_APB1Periph_DAC) + #define AUDIO_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_DMA1) + #define AUDIO_OUTPUT_GPIO GPIO_PIN(GPIOA, 4) // PA.04 + #define AUDIO_DMA_Stream DMA1_Stream5 + #define AUDIO_DMA_Stream_IRQn DMA1_Stream5_IRQn + #define AUDIO_TIM_IRQn TIM6_DAC_IRQn + #define AUDIO_TIM_IRQHandler TIM6_DAC_IRQHandler + #define AUDIO_DMA_Stream_IRQHandler DMA1_Stream5_IRQHandler + #define AUDIO_TIMER TIM6 + #define AUDIO_DMA DMA1 +#endif -#if defined(RADIO_NB4P) +#if defined(RADIO_NV14_FAMILY) + #define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 8) // PH.08 audio amp control pin + #define AUDIO_UNMUTE_DELAY 120 // ms + #define AUDIO_MUTE_DELAY 500 // ms + #define INVERTED_MUTE_PIN +#elif defined(RADIO_NB4P) #define AUDIO_MUTE_GPIO GPIO_PIN(GPIOH, 9) // PH.09 audio amp control pin #define AUDIO_UNMUTE_DELAY 120 // ms #define AUDIO_MUTE_DELAY 500 // ms @@ -601,21 +745,22 @@ #define FLYSKY_HALL_DMA_Stream_TX LL_DMA_STREAM_4 // LED Strip -#define LED_STRIP_LENGTH 4 -#define LED_STRIP_GPIO GPIO_PIN(GPIOH, 12) // PH.12 / TIM5_CH3 -#define LED_STRIP_GPIO_AF LL_GPIO_AF_2 // TIM3/4/5 -#define LED_STRIP_TIMER TIM5 -#define LED_STRIP_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) -#define LED_STRIP_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 -#define LED_STRIP_TIMER_DMA DMA1 -#define LED_STRIP_TIMER_DMA_CHANNEL LL_DMA_CHANNEL_6 -#define LED_STRIP_TIMER_DMA_STREAM LL_DMA_STREAM_0 -#define LED_STRIP_TIMER_DMA_IRQn DMA1_Stream0_IRQn -#define LED_STRIP_TIMER_DMA_IRQHandler DMA1_Stream0_IRQHandler -#define LED_STRIP_REFRESH_PERIOD 50 //ms - -#define STATUS_LEDS - +#if !defined(RADIO_NV14_FAMILLY) + #define LED_STRIP_LENGTH 4 + #define LED_STRIP_GPIO GPIO_PIN(GPIOH, 12) // PH.12 / TIM5_CH3 + #define LED_STRIP_GPIO_AF LL_GPIO_AF_2 // TIM3/4/5 + #define LED_STRIP_TIMER TIM5 + #define LED_STRIP_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) + #define LED_STRIP_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 + #define LED_STRIP_TIMER_DMA DMA1 + #define LED_STRIP_TIMER_DMA_CHANNEL LL_DMA_CHANNEL_6 + #define LED_STRIP_TIMER_DMA_STREAM LL_DMA_STREAM_0 + #define LED_STRIP_TIMER_DMA_IRQn DMA1_Stream0_IRQn + #define LED_STRIP_TIMER_DMA_IRQHandler DMA1_Stream0_IRQHandler + #define LED_STRIP_REFRESH_PERIOD 50 //ms + + #define STATUS_LEDS +#endif // Internal Module #if defined(RADIO_PL18) @@ -658,6 +803,27 @@ #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_1 #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_4 + #define INTMODULE_TIMER TIM3 + #define INTMODULE_TIMER_IRQn TIM3_IRQn + #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler + #define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1) +#elif defined(RADIO_NV14_FAMILY) + #define INTMODULE_PWR_GPIO GPIO_PIN(GPIOH, 9) // PH.09 + #define INTMODULE_TX_GPIO GPIO_PIN(GPIOF, 7) // PF.07 + #define INTMODULE_RX_GPIO GPIO_PIN(GPIOF, 6) // PF.06 + #define INTMODULE_USART UART7 + #define INTMODULE_USART_IRQn UART7_IRQn + #define INTMODULE_DMA DMA1 + #define INTMODULE_DMA_STREAM LL_DMA_STREAM_1 + #define INTMODULE_DMA_STREAM_IRQ DMA1_Stream1_IRQn + #define INTMODULE_DMA_CHANNEL LL_DMA_CHANNEL_5 + + #define INTMODULE_RX_DMA DMA1 + #define INTMODULE_RX_DMA_STREAM LL_DMA_STREAM_3 + #define INTMODULE_RX_DMA_CHANNEL LL_DMA_CHANNEL_5 + // #define INTMODULE_RX_DMA_Stream_IRQn DMA1_Stream3_IRQn + // #define INTMODULE_RX_DMA_Stream_IRQHandler DMA1_Stream_IRQHandler + #define INTMODULE_TIMER TIM3 #define INTMODULE_TIMER_IRQn TIM3_IRQn #define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler @@ -668,6 +834,9 @@ #define EXTMODULE #define EXTMODULE_PULSES #define EXTMODULE_PWR_GPIO GPIO_PIN(GPIOD, 11) // PD.11 +#if defined(RADIO_NV14_FAMILY) + #define EXTMODULE_PWR_FIX_GPIO GPIO_PIN(GPIOA, 2) // PA.02 +#endif #define EXTMODULE_TX_GPIO GPIO_PIN(GPIOC, 6) // PC.06 #define EXTMODULE_RX_GPIO GPIO_PIN(GPIOC, 7) // PC.07 #define EXTMODULE_TX_GPIO_AF LL_GPIO_AF_3 // TIM8_CH1 @@ -731,30 +900,17 @@ //ROTARY emulation for trims as buttons #define ROTARY_ENCODER_NAVIGATION -//BLUETOOTH +// Bluetooth #if !defined(RADIO_NB4P) -#define BT_EN_GPIO GPIOI -#define BT_EN_GPIO_PIN GPIO_Pin_8 // PI.8 - -#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOH) -#define BT_RCC_APB1Periph (RCC_APB1Periph_USART3) -#define BT_RCC_APB2Periph 0 - -#define BT_USART USART3 -#define BT_GPIO_AF GPIO_AF_USART3 -#define BT_USART_IRQn USART3_IRQn -#define BT_GPIO_TXRX GPIOB -#define BT_TX_GPIO_PIN GPIO_Pin_10 // PB.10 -#define BT_RX_GPIO_PIN GPIO_Pin_11 // PB.11 -#define BT_TX_GPIO_PinSource GPIO_PinSource10 -#define BT_RX_GPIO_PinSource GPIO_PinSource11 -#define BT_USART_IRQHandler USART3_IRQHandler - -#define BT_CONNECTED_GPIO GPIOJ -#define BT_CONNECTED_GPIO_PIN GPIO_Pin_1 // PJ.01 - -#define BT_CMD_MODE_GPIO GPIOH -#define BT_CMD_MODE_GPIO_PIN GPIO_Pin_6 // PH.6 + #define BLUETOOTH_ON_GPIO GPIO_PIN(GPIOI, 8) // PI.8 + #define BT_USART USART3 + #define BT_USART_IRQn USART3_IRQn + #define BT_GPIO_TXRX GPIOB + #define BT_TX_GPIO GPIO_PIN(GPIOB, 10) // PB.10 + #define BT_RX_GPIO GPIO_PIN(GPIOB, 11) // PB.11 + #define BT_EN_GPIO GPIO_PIN(GPIOI, 8) // PI.08 + #define BT_CONNECTED_GPIO GPIO_PIN(GPIOJ, 1) // PJ.01 + #define BT_CMD_MODE_GPIO GPIO_PIN(GPIOH, 6) // PH.06 #endif // Millisecond timer @@ -771,7 +927,7 @@ // SDRAM #define SDRAM_BANK1 -#if defined(RADIO_NB4P) +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) #define PORTRAIT_LCD true #define LANDSCAPE_LCD false #define LCD_W 320 diff --git a/radio/src/targets/pl18/usb_descriptor.h b/radio/src/targets/pl18/usb_descriptor.h index 3e5c3293fa4..43e3fe62542 100644 --- a/radio/src/targets/pl18/usb_descriptor.h +++ b/radio/src/targets/pl18/usb_descriptor.h @@ -21,7 +21,15 @@ #pragma once -#if defined(RADIO_NB4P) +#if defined(RADIO_EL18) + #define USB_NAME "Flysky EL18" + #define USB_MANUFACTURER 'F', 'l', 'y', 's', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'E', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_NV14) + #define USB_NAME "Flysky NV14" + #define USB_MANUFACTURER 'F', 'l', 'y', 's', 'k', 'y', ' ', ' ' /* 8 bytes */ + #define USB_PRODUCT 'N', 'V', '1', '4', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_NB4P) #define USB_NAME "FlySky NB4+" #define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */ #define USB_PRODUCT 'N', 'B', '4', '+', ' ', ' ', ' ', ' ' /* 8 Bytes */ diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index 1a3fd4d2632..f0205f31be7 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -1044,8 +1044,6 @@ #define TR_BL_HOLD_ENTER_TO_START "\012Hold [ENT] to start writing" #define TR_BL_INVALID_FIRMWARE "\011Not a valid firmware file! " #define TR_BL_INVALID_EEPROM "\011Not a valid EEPROM file! " - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #else #define TR_BL_OR_PLUGIN_USB_CABLE TR_BL_USB_PLUGIN #define TR_BL_HOLD_ENTER_TO_START "\006Hold [ENT] to start" @@ -1069,13 +1067,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1083,7 +1074,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1094,6 +1092,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index 16d5c2189f7..6b5099d9571 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -1082,6 +1082,31 @@ #define TR_BL_FLASH_KEY "Drzet dlouze [ENT] pro nahrani" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] pro ukonceni" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB pristup" + #define TR_BL_CURRENT_FW "Aktualni firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Povoleno" + #define TR_BL_DISABLE "Zakazano" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [R TRIM] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] pro ukonceni" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [SW1A] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [SW1A] long to erase" + #define TR_BL_EXIT_KEY "[SW1B] pro ukonceni" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] pro vybrani souboru" + #define TR_BL_FLASH_KEY "Drzet dlouze [TR4 Dn] pro nahrani" + #define TR_BL_ERASE_KEY "Drzet dlouze [TR4 Dn] long to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] pro ukonceni" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB pristup" @@ -1091,24 +1116,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] pro ukonceni" #define TR_BL_ENABLE "Povoleno" #define TR_BL_DISABLE "Zakazano" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // About screen diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index 2b363d6af0e..1f0baddc3a5 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -1070,6 +1070,31 @@ #define TR_BL_FLASH_KEY "[ENT] længe, for at starte" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] for at forlade" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB adgang" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_ERASE_INT_FLASH "Slet intern flash lager" + #define TR_BL_ERASE_FLASH "Slet flash lager" + #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" + #define TR_BL_ENABLE "Aktiver" + #define TR_BL_DISABLE "Deaktiver" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] for at bruge fil" + #define TR_BL_FLASH_KEY "[R TRIM] længe, for at starte" + #define TR_BL_ERASE_KEY "[R TRIM] længe, for sletning" + #define TR_BL_EXIT_KEY "[L TRIM] for at forlade" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] for at bruge fil" + #define TR_BL_FLASH_KEY "Hold [SW1A] længe, for brænding" + #define TR_BL_ERASE_KEY "Hold [SW1A] længe, for sletning" + #define TR_BL_EXIT_KEY "[SW1B] for at forlade" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] for at bruge fil" + #define TR_BL_FLASH_KEY "Hold [TR4 Dn] længe, for brænding" + #define TR_BL_ERASE_KEY "Hold [TR4 Dn] længe, for sletning" + #define TR_BL_EXIT_KEY "[TR4 Up] for at forlade" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB adgang" @@ -1079,32 +1104,6 @@ #define TR_BL_EXIT_KEY "[L TRIM] for at forlade" #define TR_BL_ENABLE "Aktiver" #define TR_BL_DISABLE "Deaktiver" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB adgang" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Slet intern flash lager" - #define TR_BL_ERASE_FLASH "Slet flash lager" - #define TR_BL_ERASE_FLASH_MSG "Dette kan vare op til 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY " [SW1A] for at bruge fil" - #define TR_BL_FLASH_KEY " Hold [SW1A] længe, for brænding" - #define TR_BL_ERASE_KEY " Hold [SW1A] længe, for sletning" - #define TR_BL_EXIT_KEY " [SW1B] for at forlade" - #else - #define TR_BL_SELECT_KEY " [TR4 Dn] for at bruge fil" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] længe, for brænding" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] længe, for sletning" - #define TR_BL_EXIT_KEY " [TR4 Up] for at forlade" -#endif - - - // Bootloader PL18/NB4+ specific - Ascii only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" #endif // About screen diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 8d551ef37de..d4e1d14cbc4 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -1058,6 +1058,31 @@ #define TR_BL_FLASH_KEY "Halte [ENT] gedrückt, zum schreiben" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] zum beenden" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB Zugriff" + #define TR_BL_CURRENT_FW "Aktuelle Firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Aktivieren" + #define TR_BL_DISABLE "Deaktivieren" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [R TRIM] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [R TRIM] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[L TRIM] zum beenden" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [SW1A] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [SW1A] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[SW1B] zum beenden" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] um Datei auszuwählen" + #define TR_BL_FLASH_KEY "Halte [TR4 Dn] gedrückt, zum schreiben" + #define TR_BL_ERASE_KEY "Halte [TR4 Dn] gedrückt, to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] zum beenden" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB Zugriff" @@ -1067,24 +1092,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] zum beenden" #define TR_BL_ENABLE "Aktivieren" #define TR_BL_DISABLE "Deaktivieren" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // Taranis Info Zeile Anzeigen diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index e9c05bb8ade..ae28e8732fd 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -1069,15 +1069,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1085,7 +1076,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1096,6 +1094,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index ffb2391ed77..45ce8ac1b2a 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -1068,15 +1068,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1084,7 +1075,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1095,6 +1093,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index 123638825a7..c272de30c32 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -1080,15 +1080,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1096,7 +1087,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1107,6 +1105,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index a138945c39d..795ecbc49c1 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -1079,6 +1079,31 @@ #define TR_BL_FLASH_KEY "Appui long [ENT] pour flasher" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] pour quitter" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Firmware actuel:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Activer" + #define TR_BL_DISABLE "Désactiver" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [R TRIM] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [R TRIM] to erase" + #define TR_BL_EXIT_KEY " [L TRIM] pour quitter" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [SW1A] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] pour quitter" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] pour sélect. fichier" + #define TR_BL_FLASH_KEY "Appui long [TR4 Dn] pour flasher" + #define TR_BL_ERASE_KEY "Appui long [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 U] pour quitter" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1088,24 +1113,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] pour quitter" #define TR_BL_ENABLE "Activer" #define TR_BL_DISABLE "Désactiver" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // About screen diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index b8c18d3f68a..e90854c1905 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -1070,15 +1070,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1086,7 +1077,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1097,6 +1095,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index ddacbaa0dc9..2a2ceb663a1 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -1065,6 +1065,31 @@ #define TR_BL_FLASH_KEY "Tenere premuto [ENT] per scrivere" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] per uscire" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF Accesso USB" + #define TR_BL_CURRENT_FW "Firmware corrente:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Abilita" + #define TR_BL_DISABLE "Disabilita" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [R TRIM] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [R TRIM] to erase" + #define TR_BL_EXIT_KEY "[L TRIM] per uscire" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [SW1A] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] per uscire" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] per scegliere il file" + #define TR_BL_FLASH_KEY "Tener premuto [TR4 Dn] per scrivere" + #define TR_BL_ERASE_KEY "Tener premuto [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] per uscire" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF Accesso USB" @@ -1074,24 +1099,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] per uscire" #define TR_BL_ENABLE "Abilita" #define TR_BL_DISABLE "Disabilita" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // About screen diff --git a/radio/src/translations/jp.h b/radio/src/translations/jp.h index 031849e8500..67164b37f60 100644 --- a/radio/src/translations/jp.h +++ b/radio/src/translations/jp.h @@ -1070,15 +1070,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1086,7 +1077,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1097,6 +1095,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index 0ccd301daa9..17065c5497f 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -1073,15 +1073,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1089,7 +1080,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1100,6 +1098,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index 3657d088295..ab653c216e0 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -1068,6 +1068,31 @@ #define TR_BL_FLASH_KEY "Przytrzymaj [ENT] aby flashowac" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] aby wyjsc" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "Dostep RF USB" + #define TR_BL_CURRENT_FW "Obecny firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [R TRIM] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [R TRIM] to erase" + #define TR_BL_EXIT_KEY "[L TRIM] aby wyjsc" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [SW1A] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [SW1A] to erase" + #define TR_BL_EXIT_KEY "[SW1B] aby wyjsc" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] aby wybrac plik" + #define TR_BL_FLASH_KEY "Przytrzymaj [TR4 Dn] aby flashowac" + #define TR_BL_ERASE_KEY "Przytrzymaj [TR4 Dn] to erase" + #define TR_BL_EXIT_KEY "[TR4 Up] aby wyjsc" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "Dostep RF USB" @@ -1077,24 +1102,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] aby wyjsc" #define TR_BL_ENABLE "Enable" #define TR_BL_DISABLE "Disable" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // About screen diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index 685e73b1750..cc3626efd63 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -1074,15 +1074,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Desativar" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1090,7 +1081,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1101,6 +1099,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/ru.h b/radio/src/translations/ru.h index 06c3e0b4ca2..d7d341d9505 100644 --- a/radio/src/translations/ru.h +++ b/radio/src/translations/ru.h @@ -1073,15 +1073,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1089,7 +1080,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1100,6 +1098,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index 19f7185ec1c..a5ba265d325 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -1094,6 +1094,31 @@ #define TR_BL_FLASH_KEY "Tryck [ENT] foer att flasha" #define TR_BL_ERASE_KEY "Haall ner [ENT] foer att raderag" #define TR_BL_EXIT_KEY "[RTN] foer att avbryta" +#elif defined(PCBPL18) + // Bootloader PL18/NB4+ specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Nuvarande firmware:" + #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" + #define TR_BL_ERASE_FLASH "Erase Flash Storage" + #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" + #define TR_BL_ENABLE "Aktivera" + #define TR_BL_DISABLE "Inaktivera" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [R TRIM] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [R TRIM] foer att erase" + #define TR_BL_EXIT_KEY "[L TRIM] för att avsluta" + #elif defined(RADIO_NB4P) + #define TR_BL_SELECT_KEY "[SW1A] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [SW1A] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [SW1A] foer att erase" + #define TR_BL_EXIT_KEY "[SW1B] för att avsluta" + #else + #define TR_BL_SELECT_KEY "[TR4 Dn] foer att vaelja fil" + #define TR_BL_FLASH_KEY "Tryck [TR4 Dn] foer att flasha" + #define TR_BL_ERASE_KEY "Tryck [TR4 Dn] foer att erase" + #define TR_BL_EXIT_KEY "[TR4 Up] för att avsluta" + #endif #elif defined(PCBNV14) // Bootloader NV14 specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1103,24 +1128,6 @@ #define TR_BL_EXIT_KEY " [L TRIM] för att avsluta" #define TR_BL_ENABLE "Aktivera" #define TR_BL_DISABLE "Inaktivera" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) - #define TR_BL_SELECT_KEY "[SW1A] to select file" - #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" - #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" - #define TR_BL_EXIT_KEY "[SW1B] to exit" - #else - #define TR_BL_SELECT_KEY "[TR4 Dn] to select file" - #define TR_BL_FLASH_KEY "Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY "[TR4 Up] to exit" - #endif #endif // About screen diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index 9a70bff4faf..f3d393fc3c4 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -1072,15 +1072,6 @@ #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_ERASE_KEY "Hold [ENT] long to erase" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" @@ -1088,7 +1079,14 @@ #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1099,6 +1097,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/ua.h b/radio/src/translations/ua.h index 4c0272a3295..c51c62cd8f4 100644 --- a/radio/src/translations/ua.h +++ b/radio/src/translations/ua.h @@ -1069,33 +1069,21 @@ #define TR_BL_SELECT_KEY "[ENT] to select file" #define TR_BL_FLASH_KEY "Hold [ENT] long to flash" #define TR_BL_EXIT_KEY "[RTN] to exit" -#elif defined(PCBNV14) - // Bootloader NV14 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_CURRENT_FW "Current Firmware:" - #define TR_BL_SELECT_KEY "[R TRIM] to select file" - #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" - #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #elif defined(PCBPL18) - // Bootloader PL18 specific - ASCII characters only - #define TR_BL_RF_USB_ACCESS "RF USB access" - #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" - #define TR_BL_ERASE_FLASH "Erase Flash Storage" - #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #define TR_BL_SELECT_KEY " [TR4 Dn] to select file" - #define TR_BL_FLASH_KEY " Hold [TR4 Dn] long to flash" - #define TR_BL_ERASE_KEY " Hold [TR4 Dn] long to erase" - #define TR_BL_EXIT_KEY " [TR4 Up] to exit" -#elif defined(PCBPL18) - // Bootloader PL18/NB4+ specific - Ascii only + // Bootloader PL18/NB4+ specific - ASCII characters only #define TR_BL_RF_USB_ACCESS "RF USB access" #define TR_BL_CURRENT_FW "Current Firmware:" #define TR_BL_ERASE_INT_FLASH "Erase Internal Flash Storage" #define TR_BL_ERASE_FLASH "Erase Flash Storage" #define TR_BL_ERASE_FLASH_MSG "This may take up to 200s" - #if defined(RADIO_NB4P) + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" + #if defined(RADIO_NV14_FAMILY) + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_ERASE_KEY "Hold [R TRIM] long to erase" + #define TR_BL_EXIT_KEY "[L TRIM] to exit" + #elif defined(RADIO_NB4P) #define TR_BL_SELECT_KEY "[SW1A] to select file" #define TR_BL_FLASH_KEY "Hold [SW1A] long to flash" #define TR_BL_ERASE_KEY "Hold [SW1A] long to erase" @@ -1106,6 +1094,15 @@ #define TR_BL_ERASE_KEY "Hold [TR4 Dn] long to erase" #define TR_BL_EXIT_KEY "[TR4 Up] to exit" #endif +#elif defined(PCBNV14) + // Bootloader NV14 specific - ASCII characters only + #define TR_BL_RF_USB_ACCESS "RF USB access" + #define TR_BL_CURRENT_FW "Current Firmware:" + #define TR_BL_SELECT_KEY "[R TRIM] to select file" + #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" + #define TR_BL_EXIT_KEY " [L TRIM] to exit" + #define TR_BL_ENABLE "Enable" + #define TR_BL_DISABLE "Disable" #endif // About screen From e6a8676c867b3f5755fbd568dcee5e47df59f0be Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 6 Aug 2024 16:40:24 +0800 Subject: [PATCH 30/36] LCD and touch works for EL18 --- radio/src/targets/pl18/hal.h | 2 +- radio/src/targets/pl18/touch_driver.cpp | 92 ++++++++++++++++++++----- 2 files changed, 76 insertions(+), 18 deletions(-) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 060a73d300b..6deb8cea965 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -471,7 +471,7 @@ // Chargers (USB and wireless) #define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input #define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input -#if defined(RADIO_NB4P) +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) #define UCHARGER_GPIO_PIN_INV #define UCHARGER_CHARGE_END_GPIO_PIN_INV #endif diff --git a/radio/src/targets/pl18/touch_driver.cpp b/radio/src/targets/pl18/touch_driver.cpp index 97931c2d37f..dbb3ca5918b 100644 --- a/radio/src/targets/pl18/touch_driver.cpp +++ b/radio/src/targets/pl18/touch_driver.cpp @@ -66,7 +66,22 @@ #define TOUCH_CHSC5448_EVT_CONTACT 0x08 #define TOUCH_CHSC5448_MAX_POINTS 5 -typedef enum {TC_NONE, TC_FT6236, TC_CST340, TC_CHSC5448} TouchController; +// CST836U definitions +#define TOUCH_CST836U_I2C_ADDRESS 0x15 +#define TOUCH_CST836U_REG_NUM 0x02 +#define TOUCH_CST836U_REG_P1_XH 0x03 +#define TOUCH_CST836U_EVT_SHIFT 6 +#define TOUCH_CST836U_EVT_MASK (3 << TOUCH_FT6206_EVT_SHIFT) +#define TOUCH_CST836U_EVT_CONTACT 0x02 +#define TOUCH_CST836U_FW_VERSION_L_REG 0xa6 +#define TOUCH_CST836U_FW_VERSION_H_REG 0xa7 +#define TOUCH_CST836U_MODULE_VERSION_REG 0xa8 +#define TOUCH_CST836U_PROJECT_NAME_REG 0xa9 +#define TOUCH_CST836U_CHIP_TYPE_L_REG 0xaa +#define TOUCH_CST836U_CHIP_TYPE_H_REG 0xab + + +typedef enum {TC_NONE, TC_FT6236, TC_CST836U, TC_CST340, TC_CHSC5448} TouchController; #if defined(DEBUG) const char TOUCH_CONTROLLER_STR[][10] = {"", "FT6236", "CST340", "CHSC5448"}; @@ -141,7 +156,7 @@ static void _i2c_init(void) static void _i2c_reInit(void) { // stm32_i2c_deinit(TOUCH_I2C_BUS); - _i2c_init(); +// _i2c_init(); } static int _i2c_read(uint8_t addr, uint32_t reg, uint8_t regSize, uint8_t* data, uint16_t len, uint32_t timeout) @@ -179,6 +194,11 @@ static uint16_t _i2c_readMultipleRetry(uint8_t addr, uint32_t reg, uint8_t regSi return length; } +static bool defaultHasTouchEvent() +{ + return touchEventOccured; +} + static bool ft6236TouchRead(uint16_t * X, uint16_t * Y) { // Read register FT6206_TD_STAT_REG to check number of touches detection @@ -202,11 +222,6 @@ static bool ft6236TouchRead(uint16_t * X, uint16_t * Y) return false; } -static bool ft6236HasTouchEvent() -{ - return touchEventOccured; -} - static void ft6236PrintDebugInfo() { #if defined(DEBUG) @@ -222,6 +237,38 @@ static void ft6236PrintDebugInfo() } +static bool cst836uTouchRead(uint16_t * X, uint16_t * Y) +{ + // Read register TOUCH_CST836U_REG_NUM to check number of touches detection + uint8_t nbTouch = _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_REG_NUM, 1); + bool hasTouch = nbTouch > 0; + + if (hasTouch) { + uint8_t dataxy[4]; + // Read X and Y positions and event + _i2c_readMultipleRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_REG_P1_XH, 1, dataxy, sizeof(dataxy)); + + // Send back ready X position to caller + *X = ((dataxy[0] & 0x0f) << 8) | dataxy[1]; + // Send back ready Y position to caller + *Y = ((dataxy[2] & 0x0f) << 8) | dataxy[3]; + + uint8_t event = (dataxy[0] & TOUCH_CST836U_EVT_MASK) >> TOUCH_CST836U_EVT_SHIFT; + return event == TOUCH_CST836U_EVT_CONTACT; + } + return false; +} + +static void cst836uPrintDebugInfo(void) +{ +#if defined(DEBUG) + TRACE("cst836u: fw ver 0x%02X %02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_FW_VERSION_H_REG, 1), _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_FW_VERSION_L_REG, 1)); + TRACE("cst836u: module version 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_MODULE_VERSION_REG, 1)); + TRACE("cst836u: project name 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_PROJECT_NAME_REG, 1)); + TRACE("cst836u: chip type 0x%02X 0x%02X", _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_CHIP_TYPE_H_REG, 1), _i2c_readRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_CHIP_TYPE_L_REG, 1)); +#endif +} + static bool cst340TouchRead(uint16_t * X, uint16_t * Y) { uint8_t data[4]; @@ -277,11 +324,6 @@ static bool chsc5448TouchRead(uint16_t * X, uint16_t * Y) return ptCnt > 0 && event == TOUCH_CHSC5448_EVT_CONTACT; } -static bool chsc5448HasTouchEvent() -{ - return touchEventOccured; -} - static void chsc5448PrintDebugInfo() { // TODO, when necessary @@ -289,10 +331,22 @@ static void chsc5448PrintDebugInfo() static const TouchControllerDescriptor FT6236 = { - .hasTouchEvent = ft6236HasTouchEvent, + .hasTouchEvent = defaultHasTouchEvent, .touchRead = ft6236TouchRead, .printDebugInfo = ft6236PrintDebugInfo, -#if defined(RADIO_NB4P) +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + .rotate = DEG_180, +#else + .rotate = DEG_270, +#endif +}; + +static const TouchControllerDescriptor CST836U = +{ + .hasTouchEvent = defaultHasTouchEvent, + .touchRead = cst836uTouchRead, + .printDebugInfo = cst836uPrintDebugInfo, +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) .rotate = DEG_180, #else .rotate = DEG_270, @@ -304,7 +358,7 @@ static const TouchControllerDescriptor CST340 = .hasTouchEvent = cst340HasTouchEvent, .touchRead = cst340TouchRead, .printDebugInfo = cst340PrintDebugInfo, -#if defined(RADIO_NB4P) +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) .rotate = DEG_180, #else .rotate = DEG_270, @@ -313,7 +367,7 @@ static const TouchControllerDescriptor CST340 = static const TouchControllerDescriptor CHSC5448 = { - .hasTouchEvent = chsc5448HasTouchEvent, + .hasTouchEvent = defaultHasTouchEvent, .touchRead = chsc5448TouchRead, .printDebugInfo = chsc5448PrintDebugInfo, .rotate = DEG_0, @@ -331,11 +385,15 @@ void _detect_touch_controller() tcd = &CHSC5448; TouchControllerType = 0; boardTouchType = "CHSC5448"; + } else if (stm32_i2c_is_dev_ready(TOUCH_I2C_BUS, TOUCH_CST836U_I2C_ADDRESS, 3, 5) == 0) { + touchController = TC_CST836U; + tcd = &CST836U; + boardTouchType = "CST836U"; } else { touchController = TC_FT6236; tcd = &FT6236; boardTouchType = "FT6236"; -#if defined(RADIO_NB4P) +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) TouchControllerType = 0; #else TouchControllerType = 1; From d2a763dba4c61d398de46840d72ef35d596fc525 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 7 Aug 2024 11:44:02 +0800 Subject: [PATCH 31/36] Fixed audio volume, LED strip, int module pwr, battery divider --- radio/src/audio.h | 2 +- radio/src/datastructs.h | 2 +- radio/src/targets/pl18/CMakeLists.txt | 27 +++++++++++++---- radio/src/targets/pl18/battery_driver.cpp | 2 ++ radio/src/targets/pl18/board.cpp | 19 ++++++++---- radio/src/targets/pl18/board.h | 36 +++++++++++++++++++---- radio/src/targets/pl18/hal.h | 2 +- 7 files changed, 70 insertions(+), 20 deletions(-) diff --git a/radio/src/audio.h b/radio/src/audio.h index b9b6fd75156..0720557fb81 100644 --- a/radio/src/audio.h +++ b/radio/src/audio.h @@ -109,7 +109,7 @@ enum AudioBufferState #define AUDIO_DATA_MIN 0 #define AUDIO_DATA_MAX 0xffff #define AUDIO_BITS_PER_SAMPLE 16 -#elif defined(PCBX12S) || defined(PCBNV14) +#elif defined(AUDIO_SPI) typedef int16_t audio_data_t; #define AUDIO_DATA_SILENCE 0 #define AUDIO_DATA_MIN INT16_MIN diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 0fe3baab2c6..89d41e0dc70 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -73,7 +73,7 @@ static inline void check_struct() CHKSIZE(TimerData, 17); CHKSIZE(ModelHeader, 131); CHKSIZE(CustomScreenData, 1892); - #if defined(PCBNV14) || defined(RADIO_NB4P) + #if defined(PCBNV14) || defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) CHKTYPE(TopBarPersistentData, 704); #else CHKTYPE(TopBarPersistentData, 1048); diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 247304cf1f4..83161daefb1 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -37,13 +37,13 @@ set(SIZE_TARGET_MEM_DEFINE "MEM_SIZE_SDRAM1=8192") add_definitions(-DPCBPL18 -DPCBFLYSKY) add_definitions(-DBATTERY_CHARGE) -add_definitions(-DSOFTWARE_VOLUME) add_definitions(-DSPI_FLASH) add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) if (PCBREV STREQUAL EL18) set(FLAVOUR el18) add_definitions(-DRADIO_EL18 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) + set(DISK_CACHE ON) set(USE_VS1053B ON) set(AFHDS3 ON) @@ -52,9 +52,10 @@ if (PCBREV STREQUAL EL18) set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS3 CACHE STRING "Default internal module") elseif(PCBREV STREQUAL NV14) set(FLAVOUR nv14) - add_definitions(-DRADIO_NV14 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) + add_definitions(-DRADIO_NV14 -DRADIO_NV14_FAMILY -DPCBNV14) + add_definitions(-DUSE_HATS_AS_KEYS -DAFHDS2_BAUDRATE=${PCB_RF_BAUD}) + set(DISK_CACHE ON) set(USE_VS1053B ON) - set(HAS_SDIO ON) set(AFHDS2 ON) # defines existing internal modules @@ -64,6 +65,7 @@ elseif(PCBREV STREQUAL NB4P) set(FLAVOUR nb4p) add_definitions(-DRADIO_NB4P) set(ROTARY_ENCODER YES) + set(LED_STRIP ON) set(AFHDS3 ON) set(KEY_DRIVER nb4p_key_driver.cpp) @@ -75,6 +77,7 @@ elseif(PCBREV STREQUAL PL18EV) add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(LED_STRIP ON) set(AFHDS3 ON) set(KEY_DRIVER key_driver.cpp) else() @@ -82,6 +85,7 @@ else() add_definitions(-DRADIO_PL18 -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) + set(LED_STRIP ON) set(AFHDS3 ON) set(KEY_DRIVER key_driver.cpp) @@ -140,7 +144,6 @@ set(TARGET_SRC_DIR targets/${TARGET_DIR}) set(BOARD_COMMON_SRC ${TARGET_SRC_DIR}/board.cpp - ${TARGET_SRC_DIR}/led_driver.cpp ${TARGET_SRC_DIR}/${KEY_DRIVER} ${TARGET_SRC_DIR}/haptic_driver.cpp ${TARGET_SRC_DIR}/backlight_driver.cpp @@ -164,6 +167,13 @@ if(ROTARY_ENCODER) ) endif() +if(DISK_CACHE) + set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC} + disk_cache.cpp + ) + add_definitions(-DDISK_CACHE) +endif() + # Bootloader board library add_library(board_bl OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} @@ -175,7 +185,6 @@ set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $) # Firmware board library add_library(board OBJECT EXCLUDE_FROM_ALL ${BOARD_COMMON_SRC} - ${BOARD_SPECIFIC_SRC} ${TARGET_SRC_DIR}/${TOUCH_DRIVER} ${TARGET_SRC_DIR}/battery_driver.cpp targets/common/arm/stm32/delays_driver.cpp @@ -185,7 +194,6 @@ add_library(board OBJECT EXCLUDE_FROM_ALL targets/common/arm/stm32/stm32_pulse_driver.cpp targets/common/arm/stm32/stm32_softserial_driver.cpp targets/common/arm/stm32/stm32_switch_driver.cpp - targets/common/arm/stm32/stm32_ws2812.cpp targets/common/arm/stm32/trainer_driver.cpp targets/common/arm/stm32/spi_flash.cpp targets/common/arm/stm32/diskio_spi_flash.cpp @@ -201,8 +209,15 @@ if(USE_VS1053B) target_sources(board PRIVATE targets/common/arm/stm32/vs1053b.cpp) else() target_sources(board PRIVATE targets/common/arm/stm32/audio_dac_driver.cpp) + add_definitions(-DSOFTWARE_VOLUME) endif() +if(LED_STRIP) + target_sources(board PRIVATE ${TARGET_SRC_DIR}/led_driver.cpp) + target_sources(board PRIVATE targets/common/arm/stm32/stm32_ws2812.cpp) +endif() + + set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common/arm/loadboot.cpp diff --git a/radio/src/targets/pl18/battery_driver.cpp b/radio/src/targets/pl18/battery_driver.cpp index aa9797d35ea..c13ac7ca570 100644 --- a/radio/src/targets/pl18/battery_driver.cpp +++ b/radio/src/targets/pl18/battery_driver.cpp @@ -298,6 +298,7 @@ void battery_charge_init() } void ledChargingInfo(uint16_t chargeState) { +#if defined(LED_STRIP_GPIO) static int ledIdx = 0; ledIdx--; if (ledIdx < 0) { @@ -311,6 +312,7 @@ void ledChargingInfo(uint16_t chargeState) { } } rgbLedColorApply(); +#endif } void drawChargingInfo(uint16_t chargeState) { diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index f934fb79459..cd3d59cf279 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -23,8 +23,11 @@ #include "stm32_gpio.h" #include "stm32_gpio_driver.h" -#include "stm32_ws2812.h" -#include "boards/generic_stm32/rgb_leds.h" + +#if defined(LED_STRIP_GPIO) + #include "stm32_ws2812.h" + #include "boards/generic_stm32/rgb_leds.h" +#endif #include "board.h" #include "boards/generic_stm32/module_ports.h" @@ -59,9 +62,6 @@ // Common ADC driver extern const etx_hal_adc_driver_t _adc_driver; -// Common LED driver -extern const stm32_pulse_timer_t _led_timer; - #if defined(SEMIHOSTING) extern "C" void initialise_monitor_handles(); #endif @@ -97,6 +97,10 @@ void delay_self(int count) } } +#if defined(LED_STRIP_GPIO) +// Common LED driver +extern const stm32_pulse_timer_t _led_timer; + void ledStripOff() { for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) { @@ -104,6 +108,7 @@ void ledStripOff() } ws2812_update(&_led_timer); } +#endif #if defined(RADIO_NB4P) void disableVoiceChip() @@ -171,8 +176,10 @@ void boardInit() touchPanelInit(); usbInit(); +#if defined(LED_STRIP_GPIO) ws2812_init(&_led_timer, LED_STRIP_LENGTH, WS2812_GRB); ledStripOff(); +#endif uint32_t press_start = 0; uint32_t press_end = 0; @@ -254,7 +261,9 @@ void boardOff() rtcDisableBackupReg(); #if !defined(BOOT) +#if defined(LED_STRIP_GPIO) ledStripOff(); +#endif if (isChargerActive()) { // RTC->BKP0R = SOFTRESET_REQUEST; diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 5acce298ee0..1118af4e088 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -78,7 +78,23 @@ extern "C" void SDRAM_Init(); // Pulses driver #if !defined(SIMU) -#if defined(RADIO_NB4P) +#if defined(RADIO_NV14_FAMILLY) + #define INTERNAL_MODULE_OFF() \ + do { \ + if (hardwareOptions.pcbrev == PCBREV_NV14) \ + gpio_set(INTMODULE_PWR_GPIO); \ + else \ + gpio_clear(INTMODULE_PWR_GPIO); \ + } while (0) + + #define INTERNAL_MODULE_ON() \ + do { \ + if (hardwareOptions.pcbrev == PCBREV_NV14) \ + gpio_clear(INTMODULE_PWR_GPIO); \ + else \ + gpio_set(INTMODULE_PWR_GPIO); \ + } while (0) +#elif defined(RADIO_NB4P) #define INTERNAL_MODULE_ON() gpio_clear(INTMODULE_PWR_GPIO) #define INTERNAL_MODULE_OFF() gpio_set(INTMODULE_PWR_GPIO); #else @@ -94,7 +110,7 @@ extern "C" void SDRAM_Init(); #define IS_INTERNAL_MODULE_ON() (false) #define IS_EXTERNAL_MODULE_ON() (gpio_read(EXTMODULE_PWR_GPIO) ? 1 : 0) -#else +#else // defined(SIMU) #define INTERNAL_MODULE_OFF() #define INTERNAL_MODULE_ON() @@ -114,11 +130,19 @@ extern "C" void SDRAM_Init(); #define NUM_TRIMS 8 #define DEFAULT_STICK_DEADZONE 2 -#define BATTERY_WARN 37 // 3.7V -#define BATTERY_MIN 35 // 3.4V -#define BATTERY_MAX 43 // 4.3V +#if defined(RADIO_NV14_FAMILY) + #define BATTERY_WARN 36 // 3.6V + #define BATTERY_MIN 35 // 3.5V + #define BATTERY_MAX 42 // 4.2V +#else + #define BATTERY_WARN 37 // 3.7V + #define BATTERY_MIN 35 // 3.4V + #define BATTERY_MAX 43 // 4.3V +#endif -#if defined(RADIO_NB4P) +#if defined(RADIO_NV14_FAMILY) + #define BATTERY_DIVIDER 2942 +#elif defined(RADIO_NB4P) #define BATTERY_DIVIDER 3102 // = 2047 * (10k / 10k + 10k) * 10 / 3.3V #else #define BATTERY_DIVIDER 962 // = 2047 * (22k / 120k + 22k) * 10 / 3.3V diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 6deb8cea965..3f9f5d8d7dc 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -745,7 +745,7 @@ #define FLYSKY_HALL_DMA_Stream_TX LL_DMA_STREAM_4 // LED Strip -#if !defined(RADIO_NV14_FAMILLY) +#if !defined(RADIO_NV14_FAMILY) #define LED_STRIP_LENGTH 4 #define LED_STRIP_GPIO GPIO_PIN(GPIOH, 12) // PH.12 / TIM5_CH3 #define LED_STRIP_GPIO_AF LL_GPIO_AF_2 // TIM3/4/5 From 28472dc61e2f3e938ad0171867c837444bd986e0 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 7 Aug 2024 12:48:33 +0800 Subject: [PATCH 32/36] Fixed gimbal, SPI flash, yaml saving, keys, trims --- radio/src/storage/yaml/yaml_datastructs.cpp | 4 ++-- radio/src/targets/pl18/CMakeLists.txt | 15 ++++++------ radio/src/targets/pl18/hal.h | 26 ++++++++++++++++++++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/radio/src/storage/yaml/yaml_datastructs.cpp b/radio/src/storage/yaml/yaml_datastructs.cpp index 5c644889613..ae1b73ce597 100644 --- a/radio/src/storage/yaml/yaml_datastructs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs.cpp @@ -36,10 +36,10 @@ #else #include "yaml_datastructs_x10.cpp" #endif -#elif defined(PCBNV14) - #include "yaml_datastructs_nv14.cpp" #elif defined(PCBPL18) #include "yaml_datastructs_pl18.cpp" +#elif defined(PCBNV14) + #include "yaml_datastructs_nv14.cpp" #elif defined(PCBX7) #if defined(RADIO_TPRO) || defined(RADIO_TPROV2) || defined(RADIO_BUMBLEBEE) #include "yaml_datastructs_tpro.cpp" diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 83161daefb1..6debf09f6ae 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -31,19 +31,19 @@ set(TARGET_SDRAM_START 0xC0000000) set(SIZE_TARGET_MEM_DEFINE "MEM_SIZE_SDRAM1=8192") -#set(RF_BAUD_RATE 921600 230400 115200 57600 38400 19200 9600 4800 2400 1200) -#set(PCB_RF_BAUD 921600 CACHE STRING "INTERNAL_MODULE_BAUDRATE: ${RF_BAUD_RATE}") -#set_property(CACHE PCB_RF_BAUD PROPERTY STRINGS ${RF_BAUD_RATE}) +set(RF_BAUD_RATE 921600 230400 115200 57600 38400 19200 9600 4800 2400 1200) +set(PCB_RF_BAUD 921600 CACHE STRING "INTERNAL_MODULE_BAUDRATE: ${RF_BAUD_RATE}") +set_property(CACHE PCB_RF_BAUD PROPERTY STRINGS ${RF_BAUD_RATE}) add_definitions(-DPCBPL18 -DPCBFLYSKY) add_definitions(-DBATTERY_CHARGE) -add_definitions(-DSPI_FLASH) add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS) if (PCBREV STREQUAL EL18) set(FLAVOUR el18) add_definitions(-DRADIO_EL18 -DRADIO_NV14_FAMILY -DPCBNV14 -DUSE_HATS_AS_KEYS) set(DISK_CACHE ON) + set(FLYSKY_GIMBAL ON) set(USE_VS1053B ON) set(AFHDS3 ON) @@ -55,6 +55,7 @@ elseif(PCBREV STREQUAL NV14) add_definitions(-DRADIO_NV14 -DRADIO_NV14_FAMILY -DPCBNV14) add_definitions(-DUSE_HATS_AS_KEYS -DAFHDS2_BAUDRATE=${PCB_RF_BAUD}) set(DISK_CACHE ON) + set(FLYSKY_GIMBAL ON) set(USE_VS1053B ON) set(AFHDS2 ON) @@ -63,7 +64,7 @@ elseif(PCBREV STREQUAL NV14) set(DEFAULT_INTERNAL_MODULE FLYSKY_AFHDS2A CACHE STRING "Default internal module") elseif(PCBREV STREQUAL NB4P) set(FLAVOUR nb4p) - add_definitions(-DRADIO_NB4P) + add_definitions(-DRADIO_NB4P -DSPI_FLASH) set(ROTARY_ENCODER YES) set(LED_STRIP ON) set(AFHDS3 ON) @@ -74,7 +75,7 @@ elseif(PCBREV STREQUAL NB4P) set(DEFAULT_INTERNAL_MODULE MULTIMODULE CACHE STRING "Default internal module") elseif(PCBREV STREQUAL PL18EV) set(FLAVOUR pl18ev) - add_definitions(-DRADIO_PL18EV -DUSE_HATS_AS_KEYS) + add_definitions(-DRADIO_PL18EV -DSPI_FLASH -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) set(LED_STRIP ON) @@ -82,7 +83,7 @@ elseif(PCBREV STREQUAL PL18EV) set(KEY_DRIVER key_driver.cpp) else() set(FLAVOUR pl18) - add_definitions(-DRADIO_PL18 -DUSE_HATS_AS_KEYS) + add_definitions(-DRADIO_PL18 -DSPI_FLASH -DUSE_HATS_AS_KEYS) set(WIRELESS_CHARGER YES) set(FLYSKY_GIMBAL ON) set(LED_STRIP ON) diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 3f9f5d8d7dc..2b7b936ba32 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -80,6 +80,28 @@ // Monitor pin #define VBUS_MONITOR_GPIO GPIO_PIN(GPIOJ, 14) // PJ.14 +// Switches +#define HARDWARE_SWITCH_A +#define STORAGE_SWITCH_A +#define HARDWARE_SWITCH_B +#define STORAGE_SWITCH_B +#define HARDWARE_SWITCH_C +#define STORAGE_SWITCH_C +#define HARDWARE_SWITCH_D +#define STORAGE_SWITCH_D +#define HARDWARE_SWITCH_E +#define STORAGE_SWITCH_E +#define HARDWARE_SWITCH_F +#define STORAGE_SWITCH_F +#define HARDWARE_SWITCH_G +#define STORAGE_SWITCH_G +#define HARDWARE_SWITCH_H +#define STORAGE_SWITCH_H + +// Index of all switches / trims +#define KEYS_GPIO_ACTIVE_HIGH +#define TRIMS_GPIO_ACTIVE_HIGH + // ADC #define ADC_GPIO_PIN_STICK_LH LL_GPIO_PIN_2 // PA.02 @@ -478,6 +500,8 @@ #if defined(RADIO_PL18) || defined(RADIO_PL18EV) #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output +#elif defined(RADIO_NV14_FAMILY) + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOH, 11) // PH.11 output #endif #if defined (WIRELESS_CHARGER) @@ -562,7 +586,7 @@ #define USB_GPIO_AF GPIO_AF10 #if defined(RADIO_NV14_FAMILY) -#define USB_GPIO_VBUS GPIO_PIN(GPIOA,9) // PA.09 +#define USB_GPIO_VBUS GPIO_PIN(GPIOA, 9) // PA.09 #define USB_SW_GPIO GPIO_PIN(GPIOI, 10) // PI.10 #endif From 236331c05a1e3c3b17548c67719e40876e148d73 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 7 Aug 2024 12:56:07 +0800 Subject: [PATCH 33/36] Updated build scripts --- companion/src/CMakeLists.txt | 2 +- radio/src/targets/pl18/CMakeLists.txt | 1 + radio/src/targets/pl18/board.h | 8 +++++--- tools/build-common.sh | 4 ++-- tools/build-flysky.py | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 5a671294a93..fe861c27b02 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -349,7 +349,7 @@ elseif(PCB STREQUAL X10 AND PCBREV STREQUAL T16) set(FLAVOUR t16) elseif(PCB STREQUAL X10 AND PCBREV STREQUAL T18) set(FLAVOUR t18) -elseif(PCB STREQUAL NV14 AND PCBREV STREQUAL EL18) +elseif(PCB STREQUAL PL18 AND PCBREV STREQUAL EL18) set(FLAVOUR el18) elseif(PCB STREQUAL PL18) set(FLAVOUR pl18) diff --git a/radio/src/targets/pl18/CMakeLists.txt b/radio/src/targets/pl18/CMakeLists.txt index 6debf09f6ae..96abea2bd86 100644 --- a/radio/src/targets/pl18/CMakeLists.txt +++ b/radio/src/targets/pl18/CMakeLists.txt @@ -1,3 +1,4 @@ +option(DISK_CACHE "Enable SD card disk cache" ON) option(UNEXPECTED_SHUTDOWN "Enable the Unexpected Shutdown screen" ON) option(PXX1 "PXX1 protocol support" ON) option(PXX2 "PXX2 protocol support" OFF) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 1118af4e088..4f8ca522849 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -249,11 +249,13 @@ bool audioChipReset(); #define audioDisableIrq() // interrupts must stay enabled on Horus #define audioEnableIrq() // interrupts must stay enabled on Horus -#if defined(PCBNV14) -#define setSampleRate(freq) + +#if defined(AUDIO_SPI) + #define setSampleRate(freq) #else -void setSampleRate(uint32_t frequency); + void setSampleRate(uint32_t frequency); #endif + void setScaledVolume(uint8_t volume); void setVolume(uint8_t volume); int32_t getVolume(); diff --git a/tools/build-common.sh b/tools/build-common.sh index 7e1e281a07f..d9d3272f871 100644 --- a/tools/build-common.sh +++ b/tools/build-common.sh @@ -129,10 +129,10 @@ get_target_build_options() { BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=V16" ;; nv14) - BUILD_OPTIONS+="-DPCB=NV14" + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=NV14" ;; el18) - BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=EL18" ;; pl18) BUILD_OPTIONS+="-DPCB=PL18" diff --git a/tools/build-flysky.py b/tools/build-flysky.py index 22be920ccee..a327f5c49e0 100644 --- a/tools/build-flysky.py +++ b/tools/build-flysky.py @@ -9,8 +9,8 @@ boards = { - "NV14": { "PCB": "NV14" }, - "EL18": { "PCB": "NV14", "PCBREV": "EL18" }, + "NV14": { "PCB": "PL18", "PCBREV": "NV14" }, + "EL18": { "PCB": "PL18", "PCBREV": "EL18" }, "PL18": { "PCB": "PL18" }, "PL18EV": { "PCB": "PL18", "PCBREV": "PL18EV" }, } From 0fc657298bba462d1cdc4369bf62ad2eedfc3804 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 7 Aug 2024 13:35:59 +0800 Subject: [PATCH 34/36] Fixed charging mechanism, EL18 and NB4P use the same chip have the same problem --- radio/src/targets/pl18/battery_driver.cpp | 4 +++- radio/src/targets/pl18/battery_driver.h | 17 --------------- radio/src/targets/pl18/board.cpp | 5 +---- radio/src/targets/pl18/board.h | 25 +++++++++++++++++++++++ radio/src/targets/pl18/hal.h | 21 ++++++++++--------- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/radio/src/targets/pl18/battery_driver.cpp b/radio/src/targets/pl18/battery_driver.cpp index c13ac7ca570..399f2c0eddb 100644 --- a/radio/src/targets/pl18/battery_driver.cpp +++ b/radio/src/targets/pl18/battery_driver.cpp @@ -26,7 +26,7 @@ #define __BATTERY_DRIVER_C__ #define BATTERY_W 140 -#define BATTERY_H 200 +#define BATTERY_H (LCD_H - 120) #define BATTERY_TOP ((LCD_H - BATTERY_H)/2) #define BATTERY_CONNECTOR_W 32 #define BATTERY_CONNECTOR_H 10 @@ -420,11 +420,13 @@ void handle_battery_charge(uint32_t last_press_time) sprintf(buffer, "%d,%d,%d,%d,%d,", uCharger.isChargingDetectionReady, uCharger.isChargeEnd, IS_UCHARGER_CHARGE_END_ACTIVE(), uCharger.chargingSamplingCount, uCharger.chargeEndSamplingCount); lcd->drawSizedText(100, 40, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); +#if defined(WIRELESS_CHARGER) sprintf(buffer, "%d,%d,%d,%d,%d", wCharger.isChargerDetectionReady, wCharger.hasCharger, IS_WCHARGER_ACTIVE(), wCharger.chargerSamplingCount, wCharger.isHighCurrent); lcd->drawSizedText(100, 70, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); sprintf(buffer, "%d,%d,%d,%d,%d,", wCharger.isChargingDetectionReady, wCharger.isChargeEnd, IS_WCHARGER_CHARGE_END_ACTIVE(), wCharger.chargingSamplingCount, wCharger.chargeEndSamplingCount); lcd->drawSizedText(100, 100, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); +#endif sprintf(buffer, "%d", isChargerActive()); lcd->drawSizedText(100, 130, buffer, strlen(buffer), CENTERED | COLOR_THEME_PRIMARY2); diff --git a/radio/src/targets/pl18/battery_driver.h b/radio/src/targets/pl18/battery_driver.h index 14fce17bcda..a03ac70d6e6 100644 --- a/radio/src/targets/pl18/battery_driver.h +++ b/radio/src/targets/pl18/battery_driver.h @@ -42,23 +42,6 @@ enum ChargeState CHARGE_FINISHED }; -#if defined(UCHARGER_GPIO_PIN_INV) - #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 0 : 1 -#else - #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 -#endif -#if defined(UCHARGER_CHARGE_END_GPIO_PIN_INV) - #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1 -#else - #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 -#endif -#if defined(UCHARGER_EN_GPIO) -#define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) -#define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) -#else -#define ENABLE_UCHARGER() -#define DISABLE_UCHARGER() -#endif #define IS_WCHARGER_ACTIVE() gpio_read(WCHARGER_GPIO) ? 1 : 0 #define IS_WCHARGER_CHARGE_END_ACTIVE() gpio_read(WCHARGER_CHARGE_END_GPIO) ? 1 : 0 #define ENABLE_WCHARGER() gpio_set(WCHARGER_EN_GPIO) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index cd3d59cf279..cfd42fd3b23 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -303,10 +303,7 @@ int usbPlugged() static uint8_t debouncedState = 0; static uint8_t lastState = 0; - uint8_t state = gpio_read(UCHARGER_GPIO) ? 1 : 0; -#if defined(UCHARGER_GPIO_PIN_INV) - state = !state; -#endif + uint8_t state = IS_UCHARGER_ACTIVE(); if (state == lastState) debouncedState = state; diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 4f8ca522849..3e5e4c552b2 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -225,6 +225,31 @@ bool isBacklightEnabled(); } #endif +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? (gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1) : 1 +#else + #define IS_UCHARGER_ACTIVE() gpio_read(UCHARGER_GPIO) ? 1 : 0 +#endif + +#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 0 : 1 +#else + #define IS_UCHARGER_CHARGE_END_ACTIVE() gpio_read(UCHARGER_CHARGE_END_GPIO) ? 1 : 0 +#endif + +#if defined(UCHARGER_EN_GPIO) + #if defined(RADIO_NV14_FAMILY) + #define ENABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) + #define DISABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) + #else + #define ENABLE_UCHARGER() gpio_set(UCHARGER_EN_GPIO) + #define DISABLE_UCHARGER() gpio_clear(UCHARGER_EN_GPIO) + #endif +#else + #define ENABLE_UCHARGER() + #define DISABLE_UCHARGER() +#endif + // Audio driver void audioInit(); void audioConsumeCurrentBuffer(); diff --git a/radio/src/targets/pl18/hal.h b/radio/src/targets/pl18/hal.h index 2b7b936ba32..3142a922cf1 100644 --- a/radio/src/targets/pl18/hal.h +++ b/radio/src/targets/pl18/hal.h @@ -487,21 +487,22 @@ #endif // Power -#define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 -#define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 +#define PWR_SWITCH_GPIO GPIO_PIN(GPIOI, 11) // PI.11 +#define PWR_ON_GPIO GPIO_PIN(GPIOI, 14) // PI.14 // Chargers (USB and wireless) -#define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input -#define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input -#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) - #define UCHARGER_GPIO_PIN_INV - #define UCHARGER_CHARGE_END_GPIO_PIN_INV -#endif +#define UCHARGER_GPIO GPIO_PIN(GPIOB, 14) // PB.14 input +#define UCHARGER_CHARGE_END_GPIO GPIO_PIN(GPIOB, 13) // PB.13 input +//#if defined(RADIO_NB4P) || defined(RADIO_NV14_FAMILY) +// #define UCHARGER_GPIO_INV +// #define UCHARGER_CHARGE_END_GPIO_INV +//#endif #if defined(RADIO_PL18) || defined(RADIO_PL18EV) - #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOG, 3) // PG.03 output #elif defined(RADIO_NV14_FAMILY) - #define UCHARGER_EN_GPIO GPIO_PIN(GPIOH, 11) // PH.11 output + #define UCHARGER_EN_GPIO GPIO_PIN(GPIOH, 11) // PH.11 output +// #define UCHARGER_EN_GPIO_INV #endif #if defined (WIRELESS_CHARGER) From fedf794f28c74919d79525bf4ca6b045d28f0cef Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 8 Aug 2024 13:05:31 +0800 Subject: [PATCH 35/36] Fixed build errors of other targets --- radio/src/targets/pl18/board.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/radio/src/targets/pl18/board.cpp b/radio/src/targets/pl18/board.cpp index cfd42fd3b23..3d6b6eb9364 100644 --- a/radio/src/targets/pl18/board.cpp +++ b/radio/src/targets/pl18/board.cpp @@ -21,16 +21,7 @@ #include "stm32_adc.h" #include "stm32_gpio.h" - -#include "stm32_gpio_driver.h" - -#if defined(LED_STRIP_GPIO) - #include "stm32_ws2812.h" - #include "boards/generic_stm32/rgb_leds.h" -#endif - -#include "board.h" -#include "boards/generic_stm32/module_ports.h" +#include "stm32_ws2812.h" #include "hal/adc_driver.h" #include "hal/trainer_driver.h" @@ -41,6 +32,10 @@ #include "hal/gpio.h" #include "hal/rotary_encoder.h" +#include "board.h" +#include "boards/generic_stm32/module_ports.h" +#include "boards/generic_stm32/rgb_leds.h" + #include "globals.h" #include "sdcard.h" #include "touch.h" From acccede6b896ab3153ec7bbee3ed5face68454ea Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 11 Sep 2024 10:22:10 +0800 Subject: [PATCH 36/36] Battery divider value is wrong according to schematic --- radio/src/targets/pl18/board.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/src/targets/pl18/board.h b/radio/src/targets/pl18/board.h index 3e5e4c552b2..4e2f28957ee 100644 --- a/radio/src/targets/pl18/board.h +++ b/radio/src/targets/pl18/board.h @@ -141,11 +141,11 @@ extern "C" void SDRAM_Init(); #endif #if defined(RADIO_NV14_FAMILY) - #define BATTERY_DIVIDER 2942 + #define BATTERY_DIVIDER 3102 // = 2047 * 510k / (510k + 510k) * 10 / 3.3V #elif defined(RADIO_NB4P) - #define BATTERY_DIVIDER 3102 // = 2047 * (10k / 10k + 10k) * 10 / 3.3V + #define BATTERY_DIVIDER 3102 // = 2047 * 10k / (10k + 10k) * 10 / 3.3V #else - #define BATTERY_DIVIDER 962 // = 2047 * (22k / 120k + 22k) * 10 / 3.3V + #define BATTERY_DIVIDER 962 // = 2047 * 22k / (120k + 22k) * 10 / 3.3V #endif #if defined(__cplusplus) && !defined(SIMU)