diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 952c86f37ea..d2a321b9dec 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -144,6 +144,7 @@ body: - RadioMaster TX16S MK3 - RadioMaster Zorro - Senduwing H17 + - DumboRC DRO1 - Other (Please specify below) validations: required: true diff --git a/.github/workflows/build_fw.yml b/.github/workflows/build_fw.yml index 513ea2f41c0..cab7af7108d 100644 --- a/.github/workflows/build_fw.yml +++ b/.github/workflows/build_fw.yml @@ -51,6 +51,7 @@ jobs: - c14 - v12 - h17 + - dro1 container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: @@ -100,6 +101,7 @@ jobs: - c14 - v12 - h17 + - dro1 container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ec606493a97..0c788fe18b0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -42,6 +42,7 @@ jobs: - t15pro - v12 - h17 + - dro1 container: image: ghcr.io/edgetx/edgetx-dev:latest volumes: diff --git a/companion/src/firmwares/boardjson.cpp b/companion/src/firmwares/boardjson.cpp index 494771305a5..68436ad3a9a 100644 --- a/companion/src/firmwares/boardjson.cpp +++ b/companion/src/firmwares/boardjson.cpp @@ -138,7 +138,7 @@ void BoardJson::afterLoadFixups(Board::Type board, InputsTable * inputs, Switche // Must match the targets that set FLEXSW (MAX_FLEX_SWITCHES) in the firmware int count = IS_RADIOMASTER_TX16S(board) || IS_RADIOMASTER_TX16SMK3(board) || IS_FATFISH_F16(board) || IS_HELLORADIOSKY_V16(board) || - IS_RADIOMASTER_MT12(board) ? 2 : 0; + IS_RADIOMASTER_MT12(board) || IS_DUMBORC_DRO1(board) ? 2 : 0; for (int i = 1; i <= count; i++) { QString tag = QString("FL%1").arg(i); diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 878c4561acd..56eb9d189a3 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -175,6 +175,8 @@ uint32_t Boards::getFourCC(Type board) return 0x4E78746F; case BOARD_SENDUWING_H17: return 0x5078746F; + case BOARD_DUMBORC_DRO1: + return 0x5178746F; default: return 0; } @@ -243,6 +245,7 @@ int Boards::getEEpromSize(Board::Type board) case BOARD_FATFISH_F16: case BOARD_HELLORADIOSKY_V12: case BOARD_HELLORADIOSKY_V16: + case BOARD_DUMBORC_DRO1: return 0; default: return 0; @@ -312,6 +315,7 @@ int Boards::getFlashSize(Type board) case BOARD_FATFISH_F16: case BOARD_HELLORADIOSKY_V12: // 8MB SDRAM case BOARD_HELLORADIOSKY_V16: + case BOARD_DUMBORC_DRO1: return FSIZE_2MB; case BOARD_UNKNOWN: return FSIZE_MAX; @@ -708,6 +712,8 @@ QString Boards::getBoardName(Board::Type board) return "HelloRadioSky V14"; case BOARD_HELLORADIOSKY_V14LCD: return "HelloRadioSky V14LCD"; + case BOARD_DUMBORC_DRO1: + return "DumboRC DRO1"; default: return CPN_STR_UNKNOWN_ITEM; } @@ -809,6 +815,7 @@ int Boards::getDefaultInternalModules(Board::Type board) case BOARD_FLYSKY_PL18: case BOARD_FLYSKY_PL18EV: case BOARD_FLYSKY_NB4P: + case BOARD_DUMBORC_DRO1: return (int)MODULE_TYPE_MULTIMODULE; case BOARD_BETAFPV_LR3PRO: @@ -900,6 +907,7 @@ void Boards::getBattRange(Board::Type board, int& vmin, int& vmax, unsigned int& case BOARD_JUMPER_T18: case BOARD_JUMPER_T20: case BOARD_JUMPER_T20V2: + case BOARD_DUMBORC_DRO1: BR(67, 83, 66) break; case BOARD_JUMPER_TLITE: diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 7bfacf9ad5e..493a5db383d 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -103,6 +103,7 @@ namespace Board { BOARD_IFLIGHT_COMMANDO14, BOARD_HELLORADIOSKY_V12, BOARD_SENDUWING_H17, + BOARD_DUMBORC_DRO1, BOARD_TYPE_COUNT, BOARD_TYPE_MAX = BOARD_TYPE_COUNT - 1 }; @@ -687,6 +688,11 @@ inline bool IS_HELLORADIOSKY_V16(Board::Type board) return board == Board::BOARD_HELLORADIOSKY_V16; } +inline bool IS_DUMBORC_DRO1(Board::Type board) +{ + return board == Board::BOARD_DUMBORC_DRO1; +} + inline bool IS_FAMILY_T16(Board::Type board) { return board == Board::BOARD_FATFISH_F16 || @@ -699,7 +705,8 @@ inline bool IS_FAMILY_T16(Board::Type board) board == Board::BOARD_RADIOMASTER_TX15 || board == Board::BOARD_RADIOMASTER_GX15 || board == Board::BOARD_RADIOMASTER_TX16S || - board == Board::BOARD_RADIOMASTER_TX16SMK3; + board == Board::BOARD_RADIOMASTER_TX16SMK3|| + board == Board::BOARD_DUMBORC_DRO1; } inline bool IS_FAMILY_T12(Board::Type board) diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 8fe1c185fb3..6d1558fc228 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -777,6 +777,14 @@ void registerOpenTxFirmwares() addOpenTxRfOptions(firmware, FLEX); registerOpenTxFirmware(firmware); + /* DumboRC DRO1 board */ + firmware = new OpenTxFirmware(FIRMWAREID("dro1"), QCoreApplication::translate("Firmware", "DumboRC DRO1"), Board::BOARD_DUMBORC_DRO1); + addOpenTxCommonOptions(firmware); + firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen")); + addOpenTxFontOptions(firmware); + registerOpenTxFirmware(firmware); + addOpenTxRfOptions(firmware, FLEX); + Firmware::sortRegisteredFirmwares(); Firmware::setDefaultVariant(Firmware::getFirmwareForFlavour("tx16s")); Firmware::setCurrentVariant(Firmware::getDefaultVariant()); diff --git a/fw.json b/fw.json index 431e3c30f6d..cb39476c6d7 100644 --- a/fw.json +++ b/fw.json @@ -1,5 +1,6 @@ { "targets": [ + ["DumboRC DRO1", "dro1-"], ["Fatfish F16","f16-"], ["Flysky EL18", "el18-"], ["Flysky NB4+", "nb4p-"], diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index dbcebbae4dd..a38b53b4383 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -454,6 +454,10 @@ if(BETAFPV_RELEASE) add_definitions(-DBETAFPV_RELEASE) endif() +if(DUMBORC_RELEASE) + add_definitions(-DDUMBORC_RELEASE) +endif() + if(HARDWARE_TRAINER_MULTI) add_definitions(-DHARDWARE_TRAINER_MULTI) endif() diff --git a/radio/src/boards/generic_stm32/switches.cpp b/radio/src/boards/generic_stm32/switches.cpp index c748ba99efe..b0ba9024f34 100644 --- a/radio/src/boards/generic_stm32/switches.cpp +++ b/radio/src/boards/generic_stm32/switches.cpp @@ -25,6 +25,7 @@ #include "drivers/pca95xx.h" #include "drivers/aw9523b.h" +#include "drivers/dumborc_extchannel.h" #include "definitions.h" #include "myeeprom.h" diff --git a/radio/src/boards/hw_defs/dro1.json b/radio/src/boards/hw_defs/dro1.json new file mode 100644 index 00000000000..21cb9ae0cc0 --- /dev/null +++ b/radio/src/boards/hw_defs/dro1.json @@ -0,0 +1,644 @@ +{ + "adc_inputs": { + "adcs": [ + { + "name": "MAIN", + "adc": "ADC3", + "dma": "DMA2", + "dma_channel": "LL_DMA_CHANNEL_2", + "dma_stream": "LL_DMA_STREAM_0", + "dma_stream_irq": "DMA2_Stream0_IRQn", + "dma_stream_irq_handler": "DMA2_Stream0_IRQHandler", + "sample_time": "LL_ADC_SAMPLINGTIME_56CYCLES" + }, + { + "name": "EXT", + "adc": "ADC1", + "dma": null, + "sample_time": "LL_ADC_SAMPLINGTIME_56CYCLES" + } + ], + "inputs": [ + { + "name": "LH", + "type": "STICK", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_0", + "channel": "LL_ADC_CHANNEL_0" + }, + { + "name": "LV", + "type": "STICK", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_1", + "channel": "LL_ADC_CHANNEL_1", + "inverted": true + }, + { + "name": "RV", + "type": "STICK", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_3", + "channel": "LL_ADC_CHANNEL_3" + }, + { + "name": "RH", + "type": "STICK", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_2", + "channel": "LL_ADC_CHANNEL_2", + "inverted": true + }, + { + "name": "P1", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_0", + "channel": "LL_ADC_CHANNEL_10", + "inverted": true, + "label": "S1", + "short_label": "1", + "default": "POT_CENTER" + }, + { + "name": "P2", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_1", + "channel": "LL_ADC_CHANNEL_11", + "label": "6POS", + "short_label": "3", + "default": "MULTIPOS" + }, + { + "name": "P3", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_2", + "channel": "LL_ADC_CHANNEL_12", + "inverted": true, + "label": "S2", + "short_label": "2", + "default": "POT_CENTER" + }, + { + "name": "SL1", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOF", + "pin": "LL_GPIO_PIN_6", + "channel": "LL_ADC_CHANNEL_4", + "inverted": true, + "label": "LS", + "short_label": "L", + "default": "SLIDER" + }, + { + "name": "SL2", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_3", + "channel": "LL_ADC_CHANNEL_13", + "label": "RS", + "short_label": "R", + "default": "SLIDER" + }, + { + "name": "EXT1", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOF", + "pin": "LL_GPIO_PIN_8", + "channel": "LL_ADC_CHANNEL_6", + "label": "EXT1", + "short_label": "E1", + "default": "SLIDER" + }, + { + "name": "EXT2", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOF", + "pin": "LL_GPIO_PIN_9", + "channel": "LL_ADC_CHANNEL_7", + "label": "EXT2", + "short_label": "E2", + "default": "SLIDER" + }, + { + "name": "EXT3", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_2", + "channel": "LL_ADC_CHANNEL_2", + "inverted": true, + "label": "EXT3", + "short_label": "E3", + "default": "NONE" + }, + { + "name": "EXT4", + "type": "FLEX", + "adc": "MAIN", + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_3", + "channel": "LL_ADC_CHANNEL_3", + "label": "EXT4", + "short_label": "E4", + "default": "NONE" + }, + { + "name": "VBAT", + "type": "VBAT", + "adc": "MAIN", + "gpio": "GPIOF", + "pin": "LL_GPIO_PIN_7", + "channel": "LL_ADC_CHANNEL_5" + }, + { + "name": "RTC_BAT", + "type": "RTC_BAT", + "adc": "EXT", + "gpio": null, + "pin": null, + "channel": "LL_ADC_CHANNEL_VBAT" + } + ] + }, + "switches": [ + { + "name": "SA", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": "GPIOH", + "pin_high": "LL_GPIO_PIN_9", + "gpio_low": "GPIOI", + "pin_low": "LL_GPIO_PIN_15", + "is_cfs": false + }, + { + "name": "SB", + "type": "3POS", + "flags": 0, + "inverted": true, + "default": "3POS", + "display": null, + "gpio_high": "GPIOH", + "pin_high": "LL_GPIO_PIN_12", + "gpio_low": "GPIOB", + "pin_low": "LL_GPIO_PIN_12", + "is_cfs": false + }, + { + "name": "SC", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": "GPIOD", + "pin_high": "LL_GPIO_PIN_11", + "gpio_low": "GPIOB", + "pin_low": "LL_GPIO_PIN_15", + "is_cfs": false + }, + { + "name": "SD", + "type": "3POS", + "flags": 0, + "inverted": true, + "default": "3POS", + "display": null, + "gpio_high": "GPIOJ", + "pin_high": "LL_GPIO_PIN_7", + "gpio_low": "GPIOG", + "pin_low": "LL_GPIO_PIN_2", + "is_cfs": false + }, + { + "name": "SE", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": "GPIOH", + "pin_high": "LL_GPIO_PIN_4", + "gpio_low": "GPIOE", + "pin_low": "LL_GPIO_PIN_3", + "is_cfs": false + }, + { + "name": "SF", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": "GPIOH", + "pin_high": "LL_GPIO_PIN_7", + "gpio_low": "GPIOH", + "pin_low": "LL_GPIO_PIN_3", + "is_cfs": false + }, + { + "name": "SG", + "type": "3POS", + "flags": 0, + "inverted": true, + "default": "3POS", + "display": null, + "gpio_high": "GPIOG", + "pin_high": "LL_GPIO_PIN_6", + "gpio_low": "GPIOG", + "pin_low": "LL_GPIO_PIN_3", + "is_cfs": false + }, + { + "name": "SH", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": "GPIOH", + "pin_high": "LL_GPIO_PIN_8", + "gpio_low": "GPIOG", + "pin_low": "LL_GPIO_PIN_7", + "is_cfs": false + }, + { + "name": "SI", + "type": "2POS", + "flags": 0, + "inverted": false, + "default": "2POS", + "display": null, + "gpio": "GPIOH", + "pin": "LL_GPIO_PIN_14", + "is_cfs": false + }, + { + "name": "SJ", + "type": "2POS", + "flags": 0, + "inverted": false, + "default": "2POS", + "display": null, + "gpio": "GPIOH", + "pin": "LL_GPIO_PIN_15", + "is_cfs": false + }, + { + "name": "SK", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_1", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_0", + "is_cfs": false + }, + { + "name": "SL", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_3", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_2", + "is_cfs": false + }, + { + "name": "SM", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_5", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_4", + "is_cfs": false + }, + { + "name": "SN", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_7", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_6", + "is_cfs": false + }, + { + "name": "SO", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_9", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_8", + "is_cfs": false + }, + { + "name": "SQ", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_16", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_17", + "is_cfs": false + }, + { + "name": "SR", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_18", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_19", + "is_cfs": false + }, + { + "name": "SS", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_20", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_21", + "is_cfs": false + }, + { + "name": "ST", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_22", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_23", + "is_cfs": false + }, + { + "name": "SU", + "type": "3POS", + "flags": 0, + "inverted": false, + "default": "3POS", + "display": null, + "gpio_high": null, + "pin_high": "DUMBORC_EXTCHANNEL_PIN_24", + "gpio_low": null, + "pin_low": "DUMBORC_EXTCHANNEL_PIN_25", + "is_cfs": false + } + ], + "keys": [ + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_4", + "active_low": true, + "key": "KEY_EXIT", + "name": "EXIT", + "label": "RTN" + }, + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_8", + "active_low": true, + "key": "KEY_ENTER", + "name": "ENTER", + "label": "Enter" + }, + { + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_13", + "active_low": true, + "key": "KEY_PAGEUP", + "name": "PAGEUP", + "label": "PAGE<" + }, + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_11", + "active_low": true, + "key": "KEY_PAGEDN", + "name": "PAGEDN", + "label": "PAGE>" + }, + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_6", + "active_low": true, + "key": "KEY_MODEL", + "name": "MDL", + "label": "MDL" + }, + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_5", + "active_low": true, + "key": "KEY_TELE", + "name": "TELE", + "label": "TELE" + }, + { + "gpio": "GPIOI", + "pin": "LL_GPIO_PIN_7", + "active_low": true, + "key": "KEY_SYS", + "name": "SYS", + "label": "SYS" + } + ], + "trims": [ + { + "name": "T1", + "dec": { + "gpio": "GPIOD", + "pin": "LL_GPIO_PIN_3", + "active_low": true + }, + "inc": { + "gpio": "GPIOD", + "pin": "LL_GPIO_PIN_7", + "active_low": true + }, + "active_low": true + }, + { + "name": "T2", + "dec": { + "gpio": "GPIOJ", + "pin": "LL_GPIO_PIN_13", + "active_low": true + }, + "inc": { + "gpio": "GPIOJ", + "pin": "LL_GPIO_PIN_12", + "active_low": true + }, + "active_low": true + }, + { + "name": "T3", + "dec": { + "gpio": "GPIOG", + "pin": "LL_GPIO_PIN_12", + "active_low": true + }, + "inc": { + "gpio": "GPIOJ", + "pin": "LL_GPIO_PIN_14", + "active_low": true + }, + "active_low": true + }, + { + "name": "T4", + "dec": { + "gpio": "GPIOA", + "pin": "LL_GPIO_PIN_6", + "active_low": true + }, + "inc": { + "gpio": "GPIOC", + "pin": "LL_GPIO_PIN_4", + "active_low": true + }, + "active_low": true + }, + { + "name": "T5", + "dec": { + "gpio": "GPIOJ", + "pin": "LL_GPIO_PIN_8", + "active_low": true + }, + "inc": { + "gpio": "GPIOD", + "pin": "LL_GPIO_PIN_13", + "active_low": true + }, + "active_low": true + }, + { + "name": "T6", + "dec": { + "gpio": "GPIOB", + "pin": "LL_GPIO_PIN_13", + "active_low": true + }, + "inc": { + "gpio": "GPIOB", + "pin": "LL_GPIO_PIN_14", + "active_low": true + }, + "active_low": true + } + ], + "display": { + "lcd_w": 480, + "lcd_h": 272, + "lcd_phys_w": 480, + "lcd_phys_h": 272, + "lcd_depth": 16, + "lcd_vertical_invert": false, + "ltdc_irq_prio": 4, + "dma_screen_irq_prio": 6 + }, + "leds": { + "led_strip_length": 36, + "bling_led_strip_start": 6, + "bling_led_strip_length": 30, + "led_strip_gpio": "GPIO_PIN(GPIOA, 5)", + "led_strip_gpio_af": "LL_GPIO_AF_1", + "led_strip_timer": "TIM2", + "led_strip_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)", + "led_strip_timer_channel": "LL_TIM_CHANNEL_CH1", + "led_strip_timer_dma": "DMA1", + "led_strip_timer_dma_channel": "LL_DMA_CHANNEL_3", + "led_strip_timer_dma_stream": "LL_DMA_STREAM_7", + "led_strip_timer_dma_irqn": "DMA1_Stream7_IRQn", + "led_strip_timer_dma_irqhandler": "DMA1_Stream7_IRQHandler", + "led_strip_refresh_period": 50, + "status_leds": true, + "led_red_gpio": "GPIO_PIN(GPIOE, 2)", + "led_green_gpio": "GPIO_PIN(GPIOE, 4)", + "led_blue_gpio": "GPIO_PIN(GPIOE, 5)" + }, + "hardware": { + "has_audio_mute": true, + "has_ext_module_support": true, + "has_int_module_support": false, + "sport_max_baudrate": 400000, + "cpu": "STM32F429xI", + "cpu_type": "STM32F4" + }, + "timers": { + "cpu_freq": 168000000, + "peri1_frequency": 42000000, + "peri2_frequency": 84000000, + "timer_mult_apb1": 2, + "timer_mult_apb2": 2, + "ms_timer": "TIM14", + "ms_timer_irqn": "TIM8_TRG_COM_TIM14_IRQn", + "ms_timer_irqhandler": "TIM8_TRG_COM_TIM14_IRQHandler", + "mixer_scheduler_timer": "TIM13", + "mixer_scheduler_timer_freq": "(PERI1_FREQUENCY * TIMER_MULT_APB1)", + "mixer_scheduler_timer_irqn": "TIM8_UP_TIM13_IRQn", + "mixer_scheduler_timer_irqhandler": "TIM8_UP_TIM13_IRQHandler" + }, + "haptic": { + "haptic_pwm": true, + "haptic_gpio": "GPIO_PIN(GPIOE, 6)", + "haptic_gpio_timer": "TIM9", + "haptic_gpio_af": "GPIO_AF3", + "haptic_timer_output_enable": "TIM_CCER_CC2E", + "haptic_timer_mode": "TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2", + "haptic_timer_compare_value": "HAPTIC_GPIO_TIMER->CCR2" + }, + "key_lock_combo": [ + "KEY_SYS", + "KEY_MODEL" + ] +} diff --git a/radio/src/drivers/dumborc_extchannel.cpp b/radio/src/drivers/dumborc_extchannel.cpp new file mode 100644 index 00000000000..894e3c60102 --- /dev/null +++ b/radio/src/drivers/dumborc_extchannel.cpp @@ -0,0 +1,745 @@ +/* + * Copyright (C) EdgeTx + * + * Authors: + * FreedomLJS + * + * 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 "dumborc_extchannel.h" + + + +#if ( DUMBORC_EXTCHANNEL_ENABLED ) + +#include +#include + +#include "hal.h" +#include "stm32_hal.h" +#include "stm32_hal_ll.h" +#include "stm32_gpio_driver.h" +#include "delays_driver.h" + +#include "os/time.h" +#include "os/task.h" +#include "os/sleep.h" +#include "tasks.h" + + + +/*** ###### ###### ###### >>>>>> LJS : INNER <<<<<< ###### ###### ###### ***/ + +#define DUMBORC_EXTCHANNEL_COUNT_OF(__TARGET__) \ + (sizeof(__TARGET__) / sizeof((__TARGET__)[0])) + + +#define DUMBORC_EXTCHANNEL_CPU_FREQ_HZ (CPU_FREQ) + +#define DUMBORC_EXTCHANNEL_DELAY_US_TO_TICK(__TIME_US__) \ + ((uint32_t)((__TIME_US__) * ((DUMBORC_EXTCHANNEL_CPU_FREQ_HZ) / 1000000UL))) + +#define DUMBORC_EXTCHANNEL_DELAY_TICK_TO_US(__TIME_TICK__) \ + ((uint32_t)((__TIME_TICK__) / ((DUMBORC_EXTCHANNEL_CPU_FREQ_HZ) / 1000000UL))) + + +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_SDA GPIOA +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_SCL GPIOA +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_SDA 13 +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_SCL 14 + +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(__GPIO__) \ + DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_##__GPIO__ +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_X(__GPIO__) \ + DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_##__GPIO__ +#define DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(__GPIO__) \ + (1UL << DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_X(__GPIO__)) + +#define DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(__GPIO__) \ + LL_GPIO_ResetOutputPin(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(__GPIO__) , \ + DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(__GPIO__)) +#define DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(__GPIO__) \ + LL_GPIO_SetOutputPin(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(__GPIO__) , \ + DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(__GPIO__)) +#define DUMBORC_EXTCHANNEL_I2C_GPIO_GET_X(__GPIO__) \ + LL_GPIO_IsInputPinSet(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(__GPIO__) , \ + DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(__GPIO__)) + + +#define DUMBORC_EXTCHANNEL_I2C_ADDR_A (0x27 << 1) +#define DUMBORC_EXTCHANNEL_I2C_ADDR_B (0x26 << 1) + + +#define DUMBORC_EXTCHANNEL_TASK_STACK_SIZE (64) +#define DUMBORC_EXTCHANNEL_TASK_PRIO (CLI_TASK_PRIO) + + + +static task_handle_t s_dumborc_extchannel_task_id = {0}; +static TASK_DEFINE_STACK(s_dumborc_extchannel_task_stack , \ + DUMBORC_EXTCHANNEL_TASK_STACK_SIZE); + +static uint8_t s_dumborc_extchannel_i2c_req_buf_reg[2][8] = {0}; +static uint32_t s_dumborc_extchannel_i2c_clk_cycle_tick_div3 = 0; +static uint32_t s_dumborc_extchannel_i2c_req_cnt = 0; +static uint32_t s_dumborc_extchannel_i2c_req_pins_status = 0; +static uint32_t s_dumborc_extchannel_task_status = 0; + + + +/* LJS : Software I2C BEGIN >>> */ +static void i_dumborc_extchannel_delay_init(void) +{ + delaysInit(); +} + +static void i_dumborc_extchannel_delay_uninit(void) +{ + return; +} + +static uint32_t i_dumborc_extchannel_delay_get_tick(void) +{ + return ticksNow(); +} + +#pragma GCC push_options +#pragma GCC optimize("O0") +static void i_dumborc_extchannel_delay_us(uint32_t const time_us) +{ + uint32_t val_tick , val_tick_dt; + + + val_tick = i_dumborc_extchannel_delay_get_tick(); + val_tick_dt = DUMBORC_EXTCHANNEL_DELAY_US_TO_TICK(time_us); + while ( (i_dumborc_extchannel_delay_get_tick() - val_tick) < val_tick_dt ); +} + +static int i_dumborc_extchannel_delay_check(void) +{ + uint32_t val , val_tick; + + + /* LJS : Get timer current tick */ + val_tick = i_dumborc_extchannel_delay_get_tick(); + /* LJS : Simulate a 2us delay! */ + val = DUMBORC_EXTCHANNEL_DELAY_US_TO_TICK(2); + while ( val-- > 0 ) { + __NOP(); + } + /* LJS : Check the change in timer tick */ + if ( i_dumborc_extchannel_delay_get_tick() == val_tick ) { + /* LJS : Timer hasn't started! (-1) */ + return -1; + } + + return 0; +} +#pragma GCC pop_options + + +static void i_dumborc_extchannel_i2c_gpio_init(void) +{ + /* LJS : Init Software-I2C SDA & SCL GPIO */ + LL_GPIO_InitTypeDef pinInit; + + + stm32_gpio_enable_clock(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SDA)); + stm32_gpio_enable_clock(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SCL)); + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + + LL_GPIO_StructInit(&pinInit); + pinInit.Pin = DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(SDA); + pinInit.Mode = LL_GPIO_MODE_OUTPUT; + pinInit.Speed = LL_GPIO_SPEED_FREQ_MEDIUM; + pinInit.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; + pinInit.Pull = LL_GPIO_PULL_UP; + pinInit.Alternate = LL_GPIO_AF_0; + LL_GPIO_Init(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SDA) , &pinInit); + pinInit.Pin = DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(SCL); + LL_GPIO_Init(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SCL) , &pinInit); +} + +static void i_dumborc_extchannel_i2c_gpio_uninit(void) +{ + /* LJS : Uninit Software-I2C SDA & SCL GPIO */ + LL_GPIO_InitTypeDef pinInit; + + + LL_GPIO_StructInit(&pinInit); + pinInit.Pin = DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(SDA); + pinInit.Mode = LL_GPIO_MODE_INPUT; + pinInit.Speed = LL_GPIO_SPEED_FREQ_LOW; + pinInit.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + pinInit.Pull = LL_GPIO_PULL_NO; + pinInit.Alternate = LL_GPIO_AF_0; + LL_GPIO_Init(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SDA) , &pinInit); + pinInit.Pin = DUMBORC_EXTCHANNEL_I2C_GPIO_PIN_LL_X(SCL); + LL_GPIO_Init(DUMBORC_EXTCHANNEL_I2C_GPIO_PORT_X(SCL) , &pinInit); +} + +static void i_dumborc_extchannel_i2c_bus_start(void) +{ + /** + * SCL XXXXXX XXXXXX HHHHHH HHHHHH LLLLLL + * SDA XXXXXX HHHHHH HHHHHH LLLLLL LLLLLL + */ + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); +} + +static void i_dumborc_extchannel_i2c_bus_stop(void) +{ + /** + * SCL XXXXXX XXXXXX HHHHHH HHHHHH + * SDA XXXXXX LLLLLL LLLLLL HHHHHH + */ + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); +} + +static uint8_t i_dumborc_extchannel_i2c_bus_read_1byte(void) +{ + uint32_t count , rx_byte; + + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + + count = 8; + rx_byte = 0; + do { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + + rx_byte <<= 1; + if ( DUMBORC_EXTCHANNEL_I2C_GPIO_GET_X(SDA) ) { + rx_byte |= 0x01; + } + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + } while ( --count ); + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + + return (rx_byte & 0xFF); +} + +static void i_dumborc_extchannel_i2c_bus_write_1byte(uint8_t const data) +{ + uint32_t count , tx_byte; + + + count = 8; + tx_byte = data; + do { + if ( tx_byte & 0x80 ) { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + } else { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SDA); + } + tx_byte <<= 1; + + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SCL); + if ( count == 1 ) { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SDA); + } + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + } while ( --count ); +} + +static uint8_t i_dumborc_extchannel_i2c_bus_get_ack(void) +{ + uint32_t count , status; + + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + + count = 10; + do { + status = DUMBORC_EXTCHANNEL_I2C_GPIO_GET_X(SDA); + if ( status == 0 ) { + break; + } + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + } while ( --count ); + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + + return (!!status); +} + +static void i_dumborc_extchannel_i2c_bus_set_ack(uint32_t const status) +{ + if ( status ) { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SDA); + } else { + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SDA); + } + + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_H(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); + DUMBORC_EXTCHANNEL_I2C_GPIO_SET_L(SCL); + i_dumborc_extchannel_delay_us(s_dumborc_extchannel_i2c_clk_cycle_tick_div3); +} + +static uint8_t i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(uint8_t const data) +{ + i_dumborc_extchannel_i2c_bus_write_1byte(data); + + return i_dumborc_extchannel_i2c_bus_get_ack(); +} + +static int i_dumborc_extchannel_i2c_bus_read(\ + uint8_t const dev_address , \ + uint8_t const * const p_tx_buffer , \ + uint32_t const tx_length , \ + uint8_t * const p_rx_buffer , \ + uint32_t const rx_length) +{ + int status; + uint32_t i , value; + + + if ( (dev_address & 0x01) || (p_rx_buffer == NULL) || (rx_length == 0) ) { + /* LJS : Input parameter error! (-1) */ + return -1; + } + + /* LJS : READ-PROCESS BEGIN >>> */ + do { + if ( (p_tx_buffer != NULL) && (tx_length != 0) ) { + /* LJS : Need to write data! Bus start! */ + i_dumborc_extchannel_i2c_bus_start(); + status = -2; + + /* LJS : Write device address (write mode , bit0 = 0). */ + if ( i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(dev_address) ) { + /* LJS : Hasn't ack (not exist device) , break it (READ-PROCESS). */ + break; + } + + /* LJS : Write device data. */ + for (i = 0 ; i < tx_length ; ++i) { + if ( i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(p_tx_buffer[i]) ) { + /* LJS : Hasn't ack (wirte error) , break it (write device data). */ + break; + } + } + if ( i != tx_length ) { + /* LJS : Not enough quantity , break it (READ-PROCESS). */ + break; + } + } + + /* LJS : Need to read data! Bus restart! */ + i_dumborc_extchannel_i2c_bus_start(); + status = -3; + + /* LJS : Write device address (read mode , bit0 = 1). */ + if ( i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(dev_address | 0x01) ) { + /* LJS : Hasn't ack (not exist device) , break it (READ-PROCESS). */ + break; + } + + /* LJS : Read device data. */ + value = rx_length - 1; + for (i = 0 ; i < rx_length ; ++i) { + p_rx_buffer[i] = i_dumborc_extchannel_i2c_bus_read_1byte(); + i_dumborc_extchannel_i2c_bus_set_ack(i == value); + } + /* LJS : Process succeed! */ + status = 0; + } while ( 0 ); + + /* LJS : READ-PROCESS END <<< */ + i_dumborc_extchannel_i2c_bus_stop(); + + return status; +} + +static int i_dumborc_extchannel_i2c_bus_write(\ + uint8_t const dev_address , \ + uint8_t const * const p_tx_buffer , \ + uint32_t const tx_length) +{ + int status; + uint32_t i; + + + if ( (dev_address & 0x01) || (p_tx_buffer == NULL) || (tx_length == 0) ) { + /* LJS : Input parameter error! (-1) */ + return -1; + } + + /* LJS : WRITE-PROCESS BEGIN >>> */ + do { + /* LJS : Need to write data! Bus start! */ + i_dumborc_extchannel_i2c_bus_start(); + status = -2; + + /* LJS : Write device address (write mode , bit0 = 0). */ + if ( i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(dev_address) ) { + /* LJS : Hasn't ack (not exist device) , break it (WRITE-PROCESS). */ + break; + } + + /* LJS : Write device data. */ + for (i = 0 ; i < tx_length ; ++i) { + if ( i_dumborc_extchannel_i2c_bus_write_1byte_with_ack(p_tx_buffer[i]) ) { + /* LJS : Hasn't ack (wirte error) , break it (write device data). */ + break; + } + } + if ( i != tx_length ) { + /* LJS : Not enough quantity , break it (WRITE-PROCESS). */ + break; + } + /* LJS : Process succeed! */ + status = 0; + } while ( 0 ); + + /* LJS : WRITE-PROCESS END <<< */ + i_dumborc_extchannel_i2c_bus_stop(); + + return status; +} +/* LJS : Software I2C END <<< */ + + +/* LJS : Dumborc_extchannel handle task BEGIN <<< */ +static void i_dumborc_extchannel_task_cb(void) +{ + for ( ; ; ) { + while ( !s_dumborc_extchannel_task_status ) { + sleep_ms(1); + } + + dumborc_extchannel_handle(); + + sleep_ms(100); + } +} + +static int i_dumborc_extchannel_task_init(void) +{ + if ( (s_dumborc_extchannel_task_id._stack_size) <= 0 ) { + /* LJS : Task (static_task) create. */ + task_create(&s_dumborc_extchannel_task_id , \ + i_dumborc_extchannel_task_cb , \ + "DR_EC:P" , \ + s_dumborc_extchannel_task_stack , \ + DUMBORC_EXTCHANNEL_TASK_STACK_SIZE , \ + DUMBORC_EXTCHANNEL_TASK_PRIO); + if ( (s_dumborc_extchannel_task_id._stack_size) <= 0 ) { + /* LJS : Task hasn't create! (-1) */ + return -1; + } + } + + return 0; +} + +static int i_dumborc_extchannel_task_uninit(void) +{ + return 0; +} +/* LJS : Dumborc_extchannel handle task END <<< */ + + +static void i_dumborc_extchannel_para_reset(void) +{ + memset(s_dumborc_extchannel_i2c_req_buf_reg , 0x00 , \ + sizeof(s_dumborc_extchannel_i2c_req_buf_reg)); + s_dumborc_extchannel_i2c_clk_cycle_tick_div3 = \ + DUMBORC_EXTCHANNEL_DELAY_US_TO_TICK(1); + s_dumborc_extchannel_i2c_req_cnt = 0; + s_dumborc_extchannel_i2c_req_pins_status = 0; + s_dumborc_extchannel_task_status = 0; +} + +/*** ###### ###### ###### >>>>>> ----------- <<<<<< ###### ###### ###### ***/ + + + +/*** ###### ###### ###### >>>>>> LJS : OUTER <<<<<< ###### ###### ###### ***/ + +/** + * [dumborc_extchannel_init (dumborc_extchannel init)] + * @return [error code (int)] + * [0 : succeed ; !0 : failed] + */ +int dumborc_extchannel_init(void) +{ + i_dumborc_extchannel_delay_init(); + i_dumborc_extchannel_para_reset(); + i_dumborc_extchannel_i2c_gpio_init(); + + if ( i_dumborc_extchannel_delay_check() < 0 ) { + /* LJS : Timer hasn't started! (-1) */ + return -1; + } + + if ( i_dumborc_extchannel_task_init() < 0 ) { + /* LJS : Task hasn't init! (-2) */ + return -2; + } + + return 0; +} + +/** + * [dumborc_extchannel_uninit (dumborc_extchannel uninit)] + * @return [error code (int)] + * [0 : succeed ; !0 : failed] + */ +int dumborc_extchannel_uninit(void) +{ + i_dumborc_extchannel_i2c_gpio_uninit(); + i_dumborc_extchannel_para_reset(); + i_dumborc_extchannel_delay_uninit(); + + if ( i_dumborc_extchannel_task_uninit() < 0 ) { + /* LJS : Task hasn't uninit! (-1) */ + return -1; + } + + return 0; +} + + +/** + * [dumborc_extchannel_handle (dumborc_extchannel handle)] + */ +void dumborc_extchannel_handle(void) +{ + static const uint8_t buf_cfg[][3] = {\ + {0x02 , 0xFF , 0xFF} , \ + {0x04 , 0x00 , 0x00} , \ + {0x06 , 0xFF , 0xFF} , \ + }; + int ret; + uint32_t i; + uint8_t reg; + + + if ( !s_dumborc_extchannel_task_status ) { + return; + } + + /* LJS : PROCESS BEGIN >>> */ + if ( s_dumborc_extchannel_i2c_req_cnt <= 0 ) { + /* LJS : First-time use requires initializing the configuration */ + for ( i = 0 , ret = 0 ; \ + i < DUMBORC_EXTCHANNEL_COUNT_OF(buf_cfg) ; \ + ++i ) { + ret |= i_dumborc_extchannel_i2c_bus_write(\ + DUMBORC_EXTCHANNEL_I2C_ADDR_A , \ + buf_cfg[i] , sizeof(buf_cfg[0])); + ret |= i_dumborc_extchannel_i2c_bus_write(\ + DUMBORC_EXTCHANNEL_I2C_ADDR_B , \ + buf_cfg[i] , sizeof(buf_cfg[0])); + } + } + + for ( i = 0 , ret = 0 ; \ + i < (DUMBORC_EXTCHANNEL_COUNT_OF(\ + s_dumborc_extchannel_i2c_req_buf_reg[0]) >> 1) ; \ + ++i ) { + if ( (i >= 1) && \ + ((s_dumborc_extchannel_i2c_req_cnt % 10) != 0) ) { + /* LJS : Execute every 10 times! (Slow refresh 'reg[2:7]') */ + break; + } + reg = (i << 1); + ret |= i_dumborc_extchannel_i2c_bus_read(\ + DUMBORC_EXTCHANNEL_I2C_ADDR_A , \ + ® , sizeof(reg) , \ + &(s_dumborc_extchannel_i2c_req_buf_reg[0][reg]) , 2); + ret |= i_dumborc_extchannel_i2c_bus_read(\ + DUMBORC_EXTCHANNEL_I2C_ADDR_B , \ + ® , sizeof(reg) , \ + &(s_dumborc_extchannel_i2c_req_buf_reg[1][reg]) , 2); + } + s_dumborc_extchannel_i2c_req_pins_status = \ + ( (((uint32_t)(s_dumborc_extchannel_i2c_req_buf_reg[0][0])) << 0) | \ + (((uint32_t)(s_dumborc_extchannel_i2c_req_buf_reg[0][1])) << 8) | \ + (((uint32_t)(s_dumborc_extchannel_i2c_req_buf_reg[1][0])) << 16) | \ + (((uint32_t)(s_dumborc_extchannel_i2c_req_buf_reg[1][1])) << 24) ); + + ++s_dumborc_extchannel_i2c_req_cnt; + /* LJS : PROCESS END <<< */ +} + + +/** + * [dumborc_extchannel_get_task_status (dumborc_extchannel get task status)] + * @return [task status (uint32_t)] + * [0 : stop ; !0 : running] + */ +uint32_t dumborc_extchannel_get_task_status(void) +{ + return s_dumborc_extchannel_task_status; +} + +/** + * [dumborc_extchannel_set_task_status (dumborc_extchannel set task status)] + * @param status [task status (uint32_t)] + * [0 : stop ; !0 : running] + */ +void dumborc_extchannel_set_task_status(uint32_t const status) +{ + s_dumborc_extchannel_task_status = (!!status); +} + + +/** + * [dumborc_extchannel_get_reg_data (dumborc_extchannel get register data)] + * @param idx [IC index (uint32_t)] + * @param reg [IC register (uint32_t)] + * @return [register data (uint32_t)] + */ +uint32_t dumborc_extchannel_get_reg_data(uint32_t const idx , uint32_t const reg) +{ + if ( (s_dumborc_extchannel_i2c_req_cnt <= 0) || \ + (idx >= DUMBORC_EXTCHANNEL_COUNT_OF(\ + s_dumborc_extchannel_i2c_req_buf_reg)) || \ + (reg >= DUMBORC_EXTCHANNEL_COUNT_OF(\ + s_dumborc_extchannel_i2c_req_buf_reg[0])) ) { + /* LJS : Dumborc_extchannel hasn't run, or input parameter error! (0) */ + return 0; + } + + return (s_dumborc_extchannel_i2c_req_buf_reg[idx][reg]); +} + +/** + * [dumborc_extchannel_get_pin_status (dumborc_extchannel get pin status)] + * @param pin_mask [pin mask (uint32_t)] + * @return [pin status (uint32_t)] + */ +uint32_t dumborc_extchannel_get_pin_status(uint32_t const pin_mask) +{ + if ( s_dumborc_extchannel_i2c_req_cnt <= 0 ) { + /* LJS : Dumborc_extchannel hasn't run! (0) */ + return 0; + } + + return (s_dumborc_extchannel_i2c_req_pins_status & pin_mask); +} + + + +#if 1 +#include "stm32_switch_driver.h" + + + +/** + * [boardSwitchGetPosition (System board swith get position , Override)] + * @param idx [System board switch index (uint8_t)] + * @return [System board switch position (SwitchHwPos)] + */ +SwitchHwPos boardSwitchGetPosition(uint8_t idx) +{ + extern const stm32_switch_t * boardGetSwitchDef(uint8_t idx); + static uint32_t time_ms_prev = 0; + const stm32_switch_t * sw = boardGetSwitchDef(idx); + SwitchHwPos ret = SWITCH_HW_UP; + uint32_t time_ms_curr , pin_sta_hi , pin_sta_lo; + + + time_ms_curr = time_get_ms(); + if ( ((time_ms_curr - time_ms_prev) >= (1 * 1000)) && \ + (dumborc_extchannel_get_pin_status(0xFFFFFFFF) == 0) ) { + /* LJS : Dumborc_extchannel hasn't init! Reinit! */ + time_ms_prev = time_ms_curr; + dumborc_extchannel_set_task_status(0); + dumborc_extchannel_uninit(); + dumborc_extchannel_init(); + dumborc_extchannel_set_task_status(1); + } + + if ( (sw->type == SWITCH_HW_ADC) || (sw->GPIOx_high != NULL) ) { + /* LJS : Belongs to a system call! */ + return stm32_switch_get_position(sw); + } + + pin_sta_hi = dumborc_extchannel_get_pin_status(sw->Pin_high); + switch ( sw->type ) { + case SWITCH_HW_2POS: { + if ( !pin_sta_hi ) { + ret = SWITCH_HW_DOWN; + } + } break; + + case SWITCH_HW_3POS: { + pin_sta_lo = dumborc_extchannel_get_pin_status(sw->Pin_low); + if ( pin_sta_hi && pin_sta_lo ) { + ret = SWITCH_HW_MID; + } else if ( !pin_sta_hi && pin_sta_lo ) { + ret = SWITCH_HW_DOWN; + } + } break; + + default:{ + } break; + } + + if ( sw->inverted ) { + if ( ret == SWITCH_HW_UP ) { + ret = SWITCH_HW_DOWN; + } else if ( ret == SWITCH_HW_DOWN ) { + ret = SWITCH_HW_UP; + } + } + + return ret; +} +#endif + +/*** ###### ###### ###### >>>>>> ----------- <<<<<< ###### ###### ###### ***/ + +#endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ + + diff --git a/radio/src/drivers/dumborc_extchannel.h b/radio/src/drivers/dumborc_extchannel.h new file mode 100644 index 00000000000..f5dd77b9ca1 --- /dev/null +++ b/radio/src/drivers/dumborc_extchannel.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) EdgeTx + * + * Authors: + * FreedomLJS + * + * 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. + */ + +#ifndef __DUMBORC_EXTCHANNEL_H__ +#define __DUMBORC_EXTCHANNEL_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +#include +#include + + + +#if ( DUMBORC_EXTCHANNEL_ENABLED ) + + + +/* LJS : Dumborc extchannel PIN_[0:31] define. */ +#define DUMBORC_EXTCHANNEL_PIN_0 (1UL << 0U) +#define DUMBORC_EXTCHANNEL_PIN_1 (1UL << 1U) +#define DUMBORC_EXTCHANNEL_PIN_2 (1UL << 2U) +#define DUMBORC_EXTCHANNEL_PIN_3 (1UL << 3U) +#define DUMBORC_EXTCHANNEL_PIN_4 (1UL << 4U) +#define DUMBORC_EXTCHANNEL_PIN_5 (1UL << 5U) +#define DUMBORC_EXTCHANNEL_PIN_6 (1UL << 6U) +#define DUMBORC_EXTCHANNEL_PIN_7 (1UL << 7U) +#define DUMBORC_EXTCHANNEL_PIN_8 (1UL << 8U) +#define DUMBORC_EXTCHANNEL_PIN_9 (1UL << 9U) +#define DUMBORC_EXTCHANNEL_PIN_10 (1UL << 10U) +#define DUMBORC_EXTCHANNEL_PIN_11 (1UL << 11U) +#define DUMBORC_EXTCHANNEL_PIN_12 (1UL << 12U) +#define DUMBORC_EXTCHANNEL_PIN_13 (1UL << 13U) +#define DUMBORC_EXTCHANNEL_PIN_14 (1UL << 14U) +#define DUMBORC_EXTCHANNEL_PIN_15 (1UL << 15U) +#define DUMBORC_EXTCHANNEL_PIN_16 (1UL << 16U) +#define DUMBORC_EXTCHANNEL_PIN_17 (1UL << 17U) +#define DUMBORC_EXTCHANNEL_PIN_18 (1UL << 18U) +#define DUMBORC_EXTCHANNEL_PIN_19 (1UL << 19U) +#define DUMBORC_EXTCHANNEL_PIN_20 (1UL << 20U) +#define DUMBORC_EXTCHANNEL_PIN_21 (1UL << 21U) +#define DUMBORC_EXTCHANNEL_PIN_22 (1UL << 22U) +#define DUMBORC_EXTCHANNEL_PIN_23 (1UL << 23U) +#define DUMBORC_EXTCHANNEL_PIN_24 (1UL << 24U) +#define DUMBORC_EXTCHANNEL_PIN_25 (1UL << 25U) +#define DUMBORC_EXTCHANNEL_PIN_26 (1UL << 26U) +#define DUMBORC_EXTCHANNEL_PIN_27 (1UL << 27U) +#define DUMBORC_EXTCHANNEL_PIN_28 (1UL << 28U) +#define DUMBORC_EXTCHANNEL_PIN_29 (1UL << 29U) +#define DUMBORC_EXTCHANNEL_PIN_30 (1UL << 30U) +#define DUMBORC_EXTCHANNEL_PIN_31 (1UL << 31U) + + + +/** + * [dumborc_extchannel_init (dumborc_extchannel init)] + * @return [error code (int)] + * [0 : succeed ; !0 : failed] + */ +int dumborc_extchannel_init(void); + +/** + * [dumborc_extchannel_uninit (dumborc_extchannel uninit)] + * @return [error code (int)] + * [0 : succeed ; !0 : failed] + */ +int dumborc_extchannel_uninit(void); + + +/** + * [dumborc_extchannel_handle (dumborc_extchannel handle)] + */ +void dumborc_extchannel_handle(void); + + +/** + * [dumborc_extchannel_get_task_status (dumborc_extchannel get task status)] + * @return [task status (uint32_t)] + * [0 : stop ; !0 : running] + */ +uint32_t dumborc_extchannel_get_task_status(void); + +/** + * [dumborc_extchannel_set_task_status (dumborc_extchannel set task status)] + * @param status [task status (uint32_t)] + * [0 : stop ; !0 : running] + */ +void dumborc_extchannel_set_task_status(uint32_t const status); + + +/** + * [dumborc_extchannel_get_reg_data (dumborc_extchannel get register data)] + * @param idx [IC index (uint32_t)] + * @param reg [IC register (uint32_t)] + * @return [register data (uint32_t)] + */ +uint32_t dumborc_extchannel_get_reg_data(uint32_t const idx , uint32_t const reg); + +/** + * [dumborc_extchannel_get_pin_status (dumborc_extchannel get pin status)] + * @param pin_mask [pin mask (uint32_t)] + * @return [pin status (uint32_t)] + */ +uint32_t dumborc_extchannel_get_pin_status(uint32_t const pin_mask); + + + +#endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ + + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/radio/src/edgetx.cpp b/radio/src/edgetx.cpp index 95490627b30..782c84d0a00 100644 --- a/radio/src/edgetx.cpp +++ b/radio/src/edgetx.cpp @@ -431,7 +431,7 @@ void generalDefault() g_eeGeneral.rotEncMode = ROTARY_ENCODER_MODE_INVERT_BOTH; #endif -#if defined(MANUFACTURER_RADIOMASTER) +#if defined(MANUFACTURER_RADIOMASTER) || defined(MANUFACTURER_DUMBORC) g_eeGeneral.audioMuteEnable = 1; #if defined(RADIO_TX15) || defined(RADIO_GX15) g_eeGeneral.backlightBright = 50; // Screen looks off if not set high enough diff --git a/radio/src/gui/colorlcd/fonts.cpp b/radio/src/gui/colorlcd/fonts.cpp index 1d4b03a2af1..3fa573619ce 100644 --- a/radio/src/gui/colorlcd/fonts.cpp +++ b/radio/src/gui/colorlcd/fonts.cpp @@ -341,6 +341,12 @@ void decompressFont(int idx, etxLvglFont* fonts) const etxLz4Font* etxFont = fonts[idx].lz4Font; + /** + * FIX : If 'etxFont' does not exist, decompression is not required!!! + * NOTE : This situation will only occur after 'ENABLE_FALLBACK' has been defined!!! + */ + if ( etxFont == nullptr ) return; + // Init SDRAM buffer initFontBuffers(); uint8_t* data = (uint8_t*)fonts[idx].lvglFont; diff --git a/radio/src/gui/colorlcd/model/model_setup.cpp b/radio/src/gui/colorlcd/model/model_setup.cpp index 7317b909094..10b6a008f55 100644 --- a/radio/src/gui/colorlcd/model/model_setup.cpp +++ b/radio/src/gui/colorlcd/model/model_setup.cpp @@ -456,8 +456,14 @@ const static SetupLineDef setupLines[] = { const static PageButtonDef modelSetupButtons[] = { // Modules +/* FIX : Valid only if HARDWARE_INTERNAL_MODULE is defined */ +#if defined(HARDWARE_INTERNAL_MODULE) {STR_DEF(STR_INTERNALRF), []() { new ModulePage(INTERNAL_MODULE); }, []() { return g_model.moduleData[INTERNAL_MODULE].type > 0; }}, +#endif /* defined(HARDWARE_INTERNAL_MODULE) */ +/* FIX : Valid only if HARDWARE_EXTERNAL_MODULE is defined */ +#if defined(HARDWARE_EXTERNAL_MODULE) {STR_DEF(STR_EXTERNALRF), []() { new ModulePage(EXTERNAL_MODULE); }, []() { return g_model.moduleData[EXTERNAL_MODULE].type > 0; }}, +#endif /* defined(HARDWARE_EXTERNAL_MODULE) */ {STR_DEF(STR_TRAINER), []() { new TrainerPage(); }, []() { return g_model.trainerData.mode > 0; }}, // Timer buttons {STR_DEF(STR_TIMER_1), []() { new TimerWindow(0); }, []() { return g_model.timers[0].mode > 0; }}, diff --git a/radio/src/gui/colorlcd/module/crossfire_settings.cpp b/radio/src/gui/colorlcd/module/crossfire_settings.cpp index 9a3aac3f559..54816828eab 100644 --- a/radio/src/gui/colorlcd/module/crossfire_settings.cpp +++ b/radio/src/gui/colorlcd/module/crossfire_settings.cpp @@ -63,7 +63,13 @@ CrossfireSettings::CrossfireSettings(Window* parent, const FlexGridLayout& g, char msg[64] = ""; // sprintf(msg, "%d Hz %" PRIu32 " Err", 1000000 / getMixerSchedulerPeriod(), // telemetryErrors); + #if ( DUMBORC_EXTCHANNEL_ENABLED ) + sprintf(msg, "%d Hz%s", 1000000 / getMixerSchedulerPeriod() , + ((md->channelsStart == 0) && (md->channelsCount == (16 - 8))) ? + " (CH[17:32] : '/5' Hz)" : ""); + #else sprintf(msg, "%d Hz", 1000000 / getMixerSchedulerPeriod()); + #endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ return std::string(msg); }); diff --git a/radio/src/gui/colorlcd/module/module_setup.cpp b/radio/src/gui/colorlcd/module/module_setup.cpp index 21e88b1da3a..45ffd0dc053 100644 --- a/radio/src/gui/colorlcd/module/module_setup.cpp +++ b/radio/src/gui/colorlcd/module/module_setup.cpp @@ -439,7 +439,7 @@ class ModuleWindow : public Window edit->setStep(SBUS_STEPSIZE); new Choice(box, rect_t{}, STR_SBUS_INVERSION_VALUES, 0, 1, GET_SET_DEFAULT(md->sbus.noninverted)); - #if defined(RADIO_TX16S) + #if defined(RADIO_TX16S) || defined(RADIO_DRO1) new StaticText(this, rect_t{}, STR_WARN_5VOLTS); #endif } diff --git a/radio/src/pulses/crossfire.cpp b/radio/src/pulses/crossfire.cpp index 1cd9259c405..d42fe812fdb 100644 --- a/radio/src/pulses/crossfire.cpp +++ b/radio/src/pulses/crossfire.cpp @@ -45,6 +45,12 @@ #define MODULE_ALIVE_TIMEOUT 50 // if the module has sent a valid frame within 500ms it is declared alive static tmr10ms_t lastAlive[NUM_MODULES]; // last time stamp module sent CRSF frames static bool moduleAlive[NUM_MODULES]; // module alive status +#if ( DUMBORC_EXTCHANNEL_ENABLED ) +/* Record CRSF send count. */ +static uint32_t s_module_crsf_send_cnt[NUM_MODULES] = {0}; +/* Control CRSF send period. "(X-1) : 1" <=> "CRSF[1:16] : (X-1) times ; CRSF[17:31] : 1 time */ +static const uint32_t module_crsf_send_period = 5; +#endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ uint8_t createCrossfireBindFrame(uint8_t moduleIdx, uint8_t * frame) { @@ -146,10 +152,32 @@ uint8_t createCrossfireChannelsFrame(uint8_t moduleIdx, uint8_t * frame, int16_t return buf - frame; } +#if ( DUMBORC_EXTCHANNEL_ENABLED ) +/* CRSF-CHANNELS_17_32_ID [BEGIN] */ +uint8_t createCrossfireChannelsFrame_17_32(uint8_t moduleIdx, uint8_t * frame, int16_t * pulses) +{ + uint8_t len = createCrossfireChannelsFrame(moduleIdx, frame, pulses); + + + /* 1(ID) + 22(channel data) + 1(CRC) */ + frame[1] = 24; + frame[2] = CHANNELS_17_32_ID; + frame[3 + ((CROSSFIRE_CHANNELS_COUNT * CROSSFIRE_CH_BITS) / 8)] = crc8(frame + 2, 23); + + return (len - 1); +} +/* CRSF-CHANNELS_17_32_ID [END] */ +#endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ + static void setupPulsesCrossfire(uint8_t module, uint8_t*& p_buf, uint8_t endpoint, int16_t* channels, uint8_t nChannels) { + #if ( DUMBORC_EXTCHANNEL_ENABLED ) + uint32_t * p_module_crsf_send_cnt = s_module_crsf_send_cnt + module; + #endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ + + #if defined(LUA) if (outputTelemetryBuffer.destination == endpoint) { auto len = outputTelemetryBuffer.size; @@ -182,6 +210,9 @@ static void setupPulsesCrossfire(uint8_t module, uint8_t*& p_buf, if(moduleAlive[module] == false) { // if the module was dead and came back to live, e.g. reset moduleAlive[module] = true; // declare the module as alive moduleState[module].counter = CRSF_FRAME_MODELID; // and send it the modelID again + #if ( DUMBORC_EXTCHANNEL_ENABLED ) + (*p_module_crsf_send_cnt) = 0; + #endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ } } } @@ -197,7 +228,18 @@ static void setupPulsesCrossfire(uint8_t module, uint8_t*& p_buf, moduleState[module].mode = MODULE_MODE_NORMAL; } else { /* TODO: nChannels */ + #if ( DUMBORC_EXTCHANNEL_ENABLED ) + (*p_module_crsf_send_cnt)++; + if ( ((channels != channelOutputs) || (nChannels != 16)) || + ((*p_module_crsf_send_cnt) < module_crsf_send_period) ) { + p_buf += createCrossfireChannelsFrame(module, p_buf, channels); + } else { + p_buf += createCrossfireChannelsFrame_17_32(module, p_buf, channels + nChannels); + (*p_module_crsf_send_cnt) = 0; + } + #else p_buf += createCrossfireChannelsFrame(module, p_buf, channels); + #endif /* ( DUMBORC_EXTCHANNEL_ENABLED ) */ } } } diff --git a/radio/src/stamp.cpp b/radio/src/stamp.cpp index 0a29a3c1c35..2f027c44337 100644 --- a/radio/src/stamp.cpp +++ b/radio/src/stamp.cpp @@ -44,6 +44,8 @@ #define FACTORY_RELEASE "-imrc" #elif defined(BETAFPV_RELEASE) #define FACTORY_RELEASE "-betafpv" +#elif defined(DUMBORC_RELEASE) +#define FACTORY_RELEASE "-DRO" #endif // If factory release, append mfg tag to version diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index 5df38dffdec..81d4b23b09a 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -133,6 +133,26 @@ if (PCB STREQUAL X10) set(AUX2_SERIAL ON) endif() set(FLYSKY_GIMBAL ON) + elseif (PCBREV STREQUAL DRO1) + set(FLAVOUR dro1) + add_definitions(-DRADIO_FAMILY_T16) + +# Uncomment the line below to enable bootloader support for SPI flash +# add_definitions(-DSPI_FLASH) + + unset(INTERNAL_MODULES CACHE) + option(BLUETOOTH "Support for bluetooth module" OFF) + option(INTERNAL_GPS "Support for internal GPS" OFF) + set(SWSERIALPOWER YES) + set(USB_CHARGER YES) + add_definitions(-DMANUFACTURER_DUMBORC) + if (NOT BLUETOOTH) + set(AUX2_SERIAL ON) + endif() + add_definitions(-DDUMBORC_EXTCHANNEL_ENABLED) + set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS") + set(FLYSKY_GIMBAL OFF) + # set(FLEXSW "2" CACHE STRING "Max flex inputs usable as switches") else() set(FLAVOUR x10) set(DEFAULT_INTERNAL_MODULE XJT_PXX1 CACHE STRING "Default internal module") @@ -297,6 +317,7 @@ add_library(board OBJECT EXCLUDE_FROM_ALL drivers/lsm6ds.cpp drivers/icm42627.cpp drivers/sc7u22.cpp + drivers/dumborc_extchannel.cpp targets/common/arm/stm32/mixer_scheduler_driver.cpp targets/common/arm/stm32/module_timer_driver.cpp targets/common/arm/stm32/sticks_pwm_driver.cpp diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 19544888f3b..35bd75ed322 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -133,7 +133,7 @@ enum { #define EXTERNAL_MODULE_OFF() gpio_clear(EXTMODULE_PWR_GPIO) // POTS and SLIDERS default configuration -#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_DRO1) #define XPOS_CALIB_DEFAULT {0x3, 0xc, 0x15, 0x1e, 0x26} #endif @@ -262,7 +262,7 @@ void telemetryPortInvertedInit(uint32_t baudrate); // Aux serial port driver -#if defined(RADIO_TX16S) || defined(RADIO_F16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_DRO1) #define DEBUG_BAUDRATE 460800 #define LUA_DEFAULT_BAUDRATE 115200 #else @@ -289,7 +289,7 @@ void bluetoothWriteWakeup(); uint8_t bluetoothIsWriting(); void bluetoothDisable(); -#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_DRO1) #define BATTERY_DIVIDER 1495 #else #define BATTERY_DIVIDER 1629 diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 10118d3528f..47a5ebe4478 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -53,6 +53,11 @@ #define SIXPOS_LED_RED 200 #define SIXPOS_LED_GREEN 0 #define SIXPOS_LED_BLUE 0 +#elif defined(RADIO_DRO1) + #define SIXPOS_SWITCH_INDEX 5 + #define SIXPOS_LED_RED 170 + #define SIXPOS_LED_GREEN 85 + #define SIXPOS_LED_BLUE 0 #endif // ADC @@ -73,7 +78,7 @@ #include "hal_pwm_sticks.h" #endif // VBat divider is /4 on F42x and F43x devices - #if defined(RADIO_TX16S) || defined(RADIO_T15) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_T18) + #if defined(RADIO_TX16S) || defined(RADIO_T15) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_T18) || defined(RADIO_DRO1) #define ADC_VREF_PREC2 330 #elif defined(RADIO_T16) #define ADC_VREF_PREC2 300 @@ -121,7 +126,7 @@ #if defined(RADIO_T15) #define PCBREV_GPIO GPIO_PIN(GPIOH, 8) // PH.08 #define PCBREV_VALUE() (gpio_read(PCBREV_GPIO) >> 8) -#elif defined(RADIO_V16) +#elif defined(RADIO_V16) || defined(RADIO_DRO1) #define PCBREV_VALUE() {0} #elif defined(PCBX10) #define PCBREV_GPIO_1 GPIO_PIN(GPIOH, 7) // PH.07 @@ -176,7 +181,7 @@ #define AUX_SERIAL_DMA_RX DMA1 #define AUX_SERIAL_DMA_RX_STREAM LL_DMA_STREAM_1 #define AUX_SERIAL_DMA_RX_CHANNEL LL_DMA_CHANNEL_4 - #if defined(RADIO_TX16S) || defined(RADIO_F16) + #if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_DRO1) #define AUX_SERIAL_PWR_GPIO GPIO_PIN(GPIOA, 15) // PA.15 #endif #endif @@ -401,7 +406,7 @@ #endif #if defined(RADIO_FAMILY_T16) -#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_DRO1) #define AUDIO_UNMUTE_DELAY 150 // ms #else #define AUDIO_UNMUTE_DELAY 120 // ms @@ -434,7 +439,7 @@ #endif // HARDWARE_TOUCH // First I2C Bus -#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(PCBX12S) || defined(RADIO_T15) || defined(RADIO_V16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(PCBX12S) || defined(RADIO_T15) || defined(RADIO_V16) || defined(RADIO_DRO1) #define I2C_B1 I2C1 #define I2C_B1_SCL_GPIO GPIO_PIN(GPIOB, 8) // PB.08 #define I2C_B1_SDA_GPIO GPIO_PIN(GPIOB, 9) // PB.09 @@ -455,7 +460,7 @@ #define I2C_B2_SDA_GPIO GPIO_PIN(GPIOB, 11) // PB.11 #define I2C_B2_GPIO_AF LL_GPIO_AF_4 // I2C2 #define I2C_B2_CLK_RATE 400000 - #if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) + #if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_DRO1) #define I2C_B2_PWR_GPIO GPIO_PIN(GPIOA, 15) // PA.15 #endif #endif @@ -650,7 +655,7 @@ #define BT_USART_GPIO GPIOG #define BT_TX_GPIO GPIO_PIN(GPIOG, 14) // PG.14 #define BT_RX_GPIO GPIO_PIN(GPIOG, 9) // PG.09 - #if defined(RADIO_TX16S) + #if defined(RADIO_TX16S) || defined(RADIO_DRO1) #define BT_PWR_GPIO GPIO_PIN(GPIOB, 0) // PB.00 #endif #endif diff --git a/radio/src/targets/horus/lcd_driver.cpp b/radio/src/targets/horus/lcd_driver.cpp index 3f2b2e2f302..12c826c7fec 100644 --- a/radio/src/targets/horus/lcd_driver.cpp +++ b/radio/src/targets/horus/lcd_driver.cpp @@ -288,7 +288,7 @@ void LCD_Init_LTDC() clkConfig.PLLSAI.PLLSAIN = 192; clkConfig.PLLSAI.PLLSAIR = 3; clkConfig.PLLSAIDivQ = 6; - #if defined(RADIO_TX16S) || defined(RADIO_F16) + #if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_DRO1) clkConfig.PLLSAIDivR = RCC_PLLSAIDIVR_8; #else clkConfig.PLLSAIDivR = RCC_PLLSAIDIVR_4; diff --git a/radio/src/targets/horus/tp_gt911.cpp b/radio/src/targets/horus/tp_gt911.cpp index 5d2936d3149..52a380bf3a3 100644 --- a/radio/src/targets/horus/tp_gt911.cpp +++ b/radio/src/targets/horus/tp_gt911.cpp @@ -230,6 +230,194 @@ const uint8_t TOUCH_GT911_Cfg[] = { 0xFF // 0x80FE Reserved }; +#elif defined (RADIO_DRO1) +const uint8_t TOUCH_GT911_Cfg[] = { + GT911_CFG_NUMBER, // 0x8047 Config version + 0xE0, // 0x8048 X output map : x 480 + 0x01, + 0x10, // 0x804A Y ouptut max : y 272 + 0x01, + GT911_MAX_TP, // 0x804C Touch number + 0x0C, // 0x804D Module switch 1 : 180° rotation + 0x00, // 0x804E Module switch 2 + 0x01, // 0x804F Shake_Count + 0x08, // 0x8050 Filter + 0x28, // 0x8051 Larger touch + 0x05, // 0x8052 Noise reduction + 0x50, // 0x8053 Screen touch level + 0x32, // 0x8054 Screen touch leave + 0x03, // 0x8055 Low power control + 0x05, // 0x8056 Refresh rate + 0x00, // 0x8057 X threshold + 0x00, // 0x8058 Y threshold + 0x00, // 0x8059 Reserved + 0x00, // 0x805A Reserved + 0x00, // 0x805B Space (top, bottom) + 0x00, // 0x805C Space (left, right) + 0x00, // 0x805D Mini filter + 0x00, // 0x805E Strech R0 + 0x00, // 0x805F Strech R1 + 0x00, // 0x8060 Strech R2 + 0x00, // 0x8061 Strech RM + 0x8B, // 0x8062 Drv groupA num + 0x2B, // 0x8063 Drv groupB num + 0x0C, // 0x8064 Sensor num + 0x17, // 0x8065 FreqA factor + 0x15, // 0x8066 FreqB factor + 0x31, // 0x8067 Panel bit freq + 0x0D, + 0x00, // 0x8069 Reserved + 0x00, + 0x01, // 0x806B Panel tx gain + 0x9A, // 0x806C Panel rx gain + 0x04, // 0x806D Panel dump shift + 0x2C, // 0x806E Drv frame control + 0x00, // 0x806F Charging level up + 0x00, // 0x8070 Module switch 3 + 0x00, // 0x8071 Gesture distance + 0x00, // 0x8072 Gesture long press time + 0x00, // 0x8073 X/Y slope adjust + 0x03, // 0x8074 Gesture control + 0x64, // 0x8075 Gesture switch 1 + 0x32, // 0x8076 Gesture switch 2 + 0x00, // 0x8077 Gesture refresh rate + 0x00, // 0x8078 Gesture touch level + 0x00, // 0x8079 New green wake up level + 0x00, // 0x807A Freq hopping start + 0x00, // 0x807B Freq hopping end + 0x00, // 0x807C Noise detect time + 0xC0, // 0x807D Hopping flag + 0x00, // 0x807E Hopping flag + 0x00, // 0x807F Noise threshold + 0x00, // 0x8080 Nois min threshold old + 0x00, // 0x8081 Reserved + 0x00, // 0x8082 Hopping sensor group + 0x9B, // 0x8083 Hopping Seg1 normalize + 0x11, // 0x8084 Hopping Seg1 factor + 0x00, // 0x8085 Main clock adjust + 0x59, // 0x8086 Hopping Seg2 normalize + 0x1F, // 0x8087 Hopping Seg2 factor + 0x00, // 0x8088 Reserved + 0x35, // 0x8089 Hopping Seg3 normalize + 0x37, // 0x808A Hopping Seg3 factor + 0x00, // 0x808B Reserved + 0x22, // 0x808C Hopping Seg4 normalize + 0x61, // 0x808D Hopping Seg4 factor + 0x00, // 0x808E Reserved + 0x1B, // 0x808F Hopping Seg5 normalize + 0xAB, // 0x8090 Hopping Seg5 factor + 0x00, // 0x8091 Reserved + 0x1B, // 0x8092 Hopping Seg6 normalize + 0x00, // 0x8093 Key1 + 0x00, // 0x8094 Key2 + 0x00, // 0x8095 Key3 + 0x00, // 0x8096 Key4 + 0x00, // 0x8097 Key area + 0x00, // 0x8098 Key touch level + 0x00, // 0x8099 Key leave level + 0x00, // 0x809A Key sens + 0x00, // 0x809B Key sens + 0x00, // 0x809C Key restrain + 0x00, // 0x809D Key restrain time + 0x00, // 0x809E Large gesture touch + 0x00, // 0x809F Reserved + 0x00, // 0x80A0 Reserved + 0x00, // 0x80A1 Hotknot noise map + 0x00, // 0x80A2 Link threshold + 0x00, // 0x80A3 Pxy threshold + 0x00, // 0x80A4 GHot dump shift + 0x00, // 0x80A5 GHot rx gain + 0x00, // 0x80A6 Freg gain + 0x00, // 0x80A7 Freg gain 1 + 0x00, // 0x80A8 Freg gain 2 + 0x00, // 0x80A9 Freg gain 3 + 0x00, // 0x80AA Reserved + 0x00, // 0x80AB Reserved + 0x00, // 0x80AC Reserved + 0x00, // 0x80AD Reserved + 0x00, // 0x80AE Reserved + 0x00, // 0x80AF Reserved + 0x00, // 0x80B0 Reserved + 0x00, // 0x80B1 Reserved + 0x00, // 0x80B2 Reserved + 0x00, // 0x80B3 Combine dis + 0x00, // 0x80B4 Split set + 0x00, // 0x80B5 Reserved + 0x00, // 0x80B6 Reserved + 0x18, // 0x80B7 Sensor CH0 + 0x16, // 0x80B8 Sensor CH1 + 0x14, // 0x80B9 Sensor CH2 + 0x12, // 0x80BA Sensor CH3 + 0x10, // 0x80BB Sensor CH4 + 0x0E, // 0x80BC Sensor CH5 + 0x0C, // 0x80BD Sensor CH6 + 0x0A, // 0x80BE Sensor CH7 + 0x08, // 0x80BF Sensor CH8 + 0x06, // 0x80C0 Sensor CH9 + 0x04, // 0x80C1 Sensor CH10 + 0x02, // 0x80C2 Sensor CH11 + 0xFF, // 0x80C3 Sensor CH12 + 0xFF, // 0x80C4 Sensor CH13 + 0xFF, // 0x80C5 Reserved + 0xFF, // 0x80C6 Reserved + 0xFF, // 0x80C7 Reserved + 0xFF, // 0x80C8 Reserved + 0xFF, // 0x80C9 Reserved + 0xFF, // 0x80CA Reserved + 0xFF, // 0x80CB Reserved + 0xFF, // 0x80CC Reserved + 0xFF, // 0x80CD Reserved + 0xFF, // 0x80CE Reserved + 0xFF, // 0x80CF Reserved + 0xFF, // 0x80D0 Reserved + 0xFF, // 0x80D1 Reserved + 0xFF, // 0x80D2 Reserved + 0xFF, // 0x80D3 Reserved + 0xFF, // 0x80D4 Reserved + 0x26, // 0x80D5 Driver CH0 + 0x24, // 0x80D6 Driver CH1 + 0x22, // 0x80D7 Driver CH2 + 0x21, // 0x80D8 Driver CH3 + 0x20, // 0x80D9 Driver CH4 + 0x1F, // 0x80DA Driver CH5 + 0x1E, // 0x80DB Driver CH6 + 0x1D, // 0x80DC Driver CH7 + 0x1C, // 0x80DD Driver CH8 + 0x18, // 0x80DE Driver CH9 + 0x16, // 0x80DF Driver CH10 + 0x13, // 0x80E0 Driver CH11 + 0x12, // 0x80E1 Driver CH12 + 0x10, // 0x80E2 Driver CH13 + 0x0F, // 0x80E3 Driver CH14 + 0x0C, // 0x80E4 Driver CH15 + 0x0A, // 0x80E5 Driver CH16 + 0x08, // 0x80E6 Driver CH17 + 0x06, // 0x80E7 Driver CH18 + 0x04, // 0x80E8 Driver CH19 + 0x02, // 0x80E9 Driver CH20 + 0x00, // 0x80EA Driver CH21 + 0xFF, // 0x80EB Driver CH22 + 0xFF, // 0x80EC Driver CH23 + 0xFF, // 0x80ED Driver CH24 + 0xFF, // 0x80EE Driver CH25 + 0xFF, // 0x80EF Reserved + 0xFF, // 0x80F0 Reserved + 0xFF, // 0x80F1 Reserved + 0xFF, // 0x80F2 Reserved + 0xFF, // 0x80F3 Reserved + 0xFF, // 0x80F4 Reserved + 0xFF, // 0x80F5 Reserved + 0xFF, // 0x80F6 Reserved + 0xFF, // 0x80F7 Reserved + 0xFF, // 0x80F8 Reserved + 0xFF, // 0x80F9 Reserved + 0xFF, // 0x80FA Reserved + 0xFF, // 0x80FB Reserved + 0xFF, // 0x80FC Reserved + 0xFF, // 0x80FD Reserved + 0xFF // 0x80FE Reserved +}; + #else //GT911 param table diff --git a/radio/src/targets/horus/usb_descriptor.h b/radio/src/targets/horus/usb_descriptor.h index 93cdbbd4218..8c2529c22b6 100644 --- a/radio/src/targets/horus/usb_descriptor.h +++ b/radio/src/targets/horus/usb_descriptor.h @@ -53,4 +53,8 @@ #define USB_NAME "FrSky X10" #define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */ #define USB_PRODUCT 'X', '1', '0', ' ', ' ', ' ', ' ', ' ' /* 8 Bytes */ +#elif defined(RADIO_DRO1) + #define USB_NAME "DumboRC DRO1" + #define USB_MANUFACTURER 'D', 'U', 'M', 'B', 'O', 'R', 'C', ' ' /* 8 bytes */ + #define USB_PRODUCT 'D', 'R', 'O', '1', ' ', ' ', ' ', ' ' /* 8 Bytes */ #endif diff --git a/radio/src/tasks.cpp b/radio/src/tasks.cpp index b4d31ff17be..5debf577932 100644 --- a/radio/src/tasks.cpp +++ b/radio/src/tasks.cpp @@ -108,7 +108,7 @@ static void audioTask() sleep_ms(1); } -#if defined(PCBX12S) || defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) +#if defined(PCBX12S) || defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_V16) || defined(RADIO_DRO1) // The audio amp needs ~2s to start sleep_ms(1000); // 1s #endif diff --git a/radio/src/telemetry/crossfire.h b/radio/src/telemetry/crossfire.h index bdfc4956180..3340cea6465 100644 --- a/radio/src/telemetry/crossfire.h +++ b/radio/src/telemetry/crossfire.h @@ -43,6 +43,7 @@ #define VOLT_ARRAY_ID 0xFE // Pseudo sensor out of 0x0E frame #define LINK_ID 0x14 #define CHANNELS_ID 0x16 +#define CHANNELS_17_32_ID 0x1A /* channel[32:17] */ #define LINK_RX_ID 0x1C #define LINK_TX_ID 0x1D #define ATTITUDE_ID 0x1E diff --git a/radio/src/telemetry/frsky.h b/radio/src/telemetry/frsky.h index 5df512ec47a..112fa9b9e42 100644 --- a/radio/src/telemetry/frsky.h +++ b/radio/src/telemetry/frsky.h @@ -35,7 +35,7 @@ enum FrSkyDataState { }; #define FRSKY_SPORT_BAUDRATE 57600 -#if defined(RADIO_TX16S) || defined(RADIO_F16) +#if defined(RADIO_TX16S) || defined(RADIO_F16) || defined(RADIO_DRO1) #define FRSKY_TELEM_MIRROR_BAUDRATE 115200 #else #define FRSKY_TELEM_MIRROR_BAUDRATE FRSKY_SPORT_BAUDRATE diff --git a/radio/src/tests/module_ports.cpp b/radio/src/tests/module_ports.cpp index 28c3357e6f2..919f07ff9b5 100644 --- a/radio/src/tests/module_ports.cpp +++ b/radio/src/tests/module_ports.cpp @@ -80,6 +80,8 @@ TEST(ports, isPortUsed) } #endif +/* FIX : Valid only if HARDWARE_INTERNAL_MODULE is defined */ +#if defined(HARDWARE_INTERNAL_MODULE) #if defined(INTERNAL_MODULE_PXX1) && defined(HARDWARE_EXTERNAL_MODULE) #include "pulses/pxx1.h" @@ -277,3 +279,4 @@ TEST(ports, isTelemAllowedOnBind) EXPECT_TRUE(isTelemAllowedOnBind(EXTERNAL_MODULE)); } #endif +#endif /* defined(HARDWARE_INTERNAL_MODULE) */ diff --git a/radio/util/build-firmware.py b/radio/util/build-firmware.py index d253fca7f4f..e273c122761 100755 --- a/radio/util/build-firmware.py +++ b/radio/util/build-firmware.py @@ -217,7 +217,12 @@ def main(): cmake_options["PCB"] = "X10" cmake_options["PCBREV"] = "V16" firmware_options = options_helloradiosky_v16 - maxsize = 2 * 1024 * 1024 + maxsize = 2 * 1024 * 1024 + elif board_name == "dro1": + cmake_options["PCB"] = "X10" + cmake_options["PCBREV"] = "DRO1" + firmware_options = options_dumborc_dro1 + maxsize = 2 * 1024 * 1024 else: return INVALID_BOARD diff --git a/radio/util/fwoptions.py b/radio/util/fwoptions.py index 304cc0ef0b6..87f36b4c774 100755 --- a/radio/util/fwoptions.py +++ b/radio/util/fwoptions.py @@ -376,3 +376,16 @@ "faichoice": ("FAI", "CHOICE", None), "nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"), } + +options_dumborc_dro1 = { + "noheli": ("HELI", "NO", "YES"), + "lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"), + "nogvars": ("GVARS", "NO", "YES"), + "faimode": ("FAI", "YES", None), + "faichoice": ("FAI", "CHOICE", None), + "nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"), + "flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None), + "bluetooth": ("BLUETOOTH", "YES", "NO"), + "internalgps": ("INTERNAL_GPS", "YES", "NO"), + "externalaccessmod": ("HARDWARE_EXTERNAL_ACCESS_MOD", "YES", "NO"), +} diff --git a/radio/util/hw_defs/legacy_names.py b/radio/util/hw_defs/legacy_names.py index 444f64fd17f..46ece93263b 100644 --- a/radio/util/hw_defs/legacy_names.py +++ b/radio/util/hw_defs/legacy_names.py @@ -2,7 +2,7 @@ LEGACY_NAMES = [ { - "targets": {"x10", "x10express", "t16", "tx16s", "t18", "f16", "v16"}, + "targets": {"x10", "x10express", "t16", "tx16s", "t18", "f16", "v16", "dro1"}, "inputs": { "LH": { "yaml": "Rud", diff --git a/tools/boards.py b/tools/boards.py index 83ca2000cc7..956b3bc098f 100755 --- a/tools/boards.py +++ b/tools/boards.py @@ -104,4 +104,9 @@ "PCB": "X7", "PCBREV": "T14", }, + "DRO1": { + "PCB": "X10", + "PCBREV": "DRO1", + "INTERNAL_MODULE_MULTI": "NO" + }, } diff --git a/tools/build-common.sh b/tools/build-common.sh index 4122bd8e4b4..fb3042254ff 100644 --- a/tools/build-common.sh +++ b/tools/build-common.sh @@ -173,6 +173,9 @@ get_target_build_options() { h17) BUILD_OPTIONS+="-DPCB=H17" ;; + dro1) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=DRO1" + ;; *) echo "Unknown target: $target_name" return 1 diff --git a/tools/build-dumborc.py b/tools/build-dumborc.py new file mode 100644 index 00000000000..905662bef37 --- /dev/null +++ b/tools/build-dumborc.py @@ -0,0 +1,77 @@ +#!/usr/bin/python3 + +import argparse +import datetime +import os +from builtins import NotADirectoryError +import shutil +import tempfile + + +boards = { + "DRO1_1": { + "PCB": "X10", + "PCBREV": "DRO1", + "DEFAULT_MODE": "1", + }, + "DRO1_2": { + "PCB": "X10", + "PCBREV": "DRO1", + "DEFAULT_MODE": "2", + } +} + +translations = [ + "EN", +] + + +def timestamp(): + return datetime.datetime.now().strftime("%y%m%d") + + +def build(board, translation, srcdir): + cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in boards[board].items()]) + cwd = os.getcwd() + if not os.path.exists("output"): + os.mkdir("output") + path = tempfile.mkdtemp() + os.chdir(path) + command = "cmake %s -DTRANSLATIONS=%s -DDUMBORC_RELEASE=YES %s" % (cmake_options, translation, srcdir) + print(command) + os.system(command) + os.system("make firmware -j6") + os.chdir(cwd) + index = 0 + while 1: + suffix = "" if index == 0 else "_%d" % index + filename = "output/firmware_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix) + if not os.path.exists(filename): + shutil.copy("%s/arm-none-eabi/firmware.bin" % path, filename) + break + index += 1 + shutil.rmtree(path) + + +def dir_path(string): + if os.path.isdir(string): + return string + else: + raise NotADirectoryError(string) + + +def main(): + parser = argparse.ArgumentParser(description="Build DumboRC firmware") + parser.add_argument("-b", "--boards", action="append", help="Destination boards", required=True) + parser.add_argument("-t", "--translations", action="append", help="Translations", required=True) + parser.add_argument("srcdir", type=dir_path) + + args = parser.parse_args() + + for board in (boards.keys() if "ALL" in args.boards else args.boards): + for translation in (translations if "ALL" in args.translations else args.translations): + build(board, translation, args.srcdir) + + +if __name__ == "__main__": + main() diff --git a/tools/generate-hw-defs.sh b/tools/generate-hw-defs.sh index d02062b303b..e9858966d9e 100755 --- a/tools/generate-hw-defs.sh +++ b/tools/generate-hw-defs.sh @@ -9,7 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" : "${SRCDIR:=$(dirname "$(pwd)/$0")/..}" -: ${FLAVOR:="nv14;el18;pl18;pl18ev;pl18u;nb4p;st16;c14;pa01;t12;t12max;t15;t15pro;t22;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;bumblebee;t20;t20v2;t14;lr3pro;mt12;gx12;tx12;tx12mk2;boxer;tx16s;tx16smk3;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites;f16;v16;v14;v14lcd;v12;tx15;gx15;h17"} +: ${FLAVOR:="nv14;el18;pl18;pl18ev;pl18u;nb4p;st16;c14;pa01;t12;t12max;t15;t15pro;t22;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;bumblebee;t20;t20v2;t14;lr3pro;mt12;gx12;tx12;tx12mk2;boxer;tx16s;tx16smk3;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites;f16;v16;v14;v14lcd;v12;tx15;gx15;h17;dro1"} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"} # wipe build directory clean diff --git a/tools/generate-yaml.sh b/tools/generate-yaml.sh index d2205c2455b..3ac3eb7c418 100755 --- a/tools/generate-yaml.sh +++ b/tools/generate-yaml.sh @@ -11,7 +11,7 @@ if [[ -n ${GCC_ARM} ]] ; then export PATH=${GCC_ARM}:$PATH fi -: ${FLAVOR:="x10;t15;pl18;nv14;pl18u;nb4p;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16;gx12;st16;c14;pa01;tx15;gx15;t15pro;tx16smk3;t22;v12;h17"} +: ${FLAVOR:="x10;t15;pl18;nv14;pl18u;nb4p;x9d;x9dp2019;x9e;xlite;xlites;x7;tpro;t20;f16;gx12;st16;c14;pa01;tx15;gx15;t15pro;tx16smk3;t22;v12;h17;dro1"} : ${SRCDIR:="$(dirname "$SCRIPT_DIR")"} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDISABLE_COMPANION=YES -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"} diff --git a/web/public/radios.json b/web/public/radios.json index ea729d2f81e..12c99c62e3a 100644 --- a/web/public/radios.json +++ b/web/public/radios.json @@ -1,4 +1,248 @@ [ + { + "name": "DumboRC DRO1", + "wasm": "edgetx-dro1-simulator.wasm", + "display": { + "w": 480, + "h": 272, + "depth": 16 + }, + "inputs": [ + { + "name": "LH", + "type": "STICK", + "label": "LH" + }, + { + "name": "LV", + "type": "STICK", + "label": "LV" + }, + { + "name": "RV", + "type": "STICK", + "label": "RV" + }, + { + "name": "RH", + "type": "STICK", + "label": "RH" + }, + { + "name": "P1", + "type": "FLEX", + "label": "S1", + "default": "POT_CENTER" + }, + { + "name": "P2", + "type": "FLEX", + "label": "6POS", + "default": "MULTIPOS" + }, + { + "name": "P3", + "type": "FLEX", + "label": "S2", + "default": "POT_CENTER" + }, + { + "name": "SL1", + "type": "FLEX", + "label": "LS", + "default": "SLIDER" + }, + { + "name": "SL2", + "type": "FLEX", + "label": "RS", + "default": "SLIDER" + }, + { + "name": "EXT1", + "type": "FLEX", + "label": "EXT1", + "default": "SLIDER" + }, + { + "name": "EXT2", + "type": "FLEX", + "label": "EXT2", + "default": "SLIDER" + }, + { + "name": "EXT3", + "type": "FLEX", + "label": "EXT3", + "default": "NONE" + }, + { + "name": "EXT4", + "type": "FLEX", + "label": "EXT4", + "default": "NONE" + } + ], + "switches": [ + { + "name": "SA", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SB", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SC", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SD", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SE", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SF", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SG", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SH", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SI", + "type": "2POS", + "default": "2POS" + }, + { + "name": "SJ", + "type": "2POS", + "default": "2POS" + }, + { + "name": "SK", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SL", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SM", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SN", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SO", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SQ", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SR", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SS", + "type": "3POS", + "default": "3POS" + }, + { + "name": "ST", + "type": "3POS", + "default": "3POS" + }, + { + "name": "SU", + "type": "3POS", + "default": "3POS" + } + ], + "trims": [ + { + "name": "T1" + }, + { + "name": "T2" + }, + { + "name": "T3" + }, + { + "name": "T4" + }, + { + "name": "T5" + }, + { + "name": "T6" + } + ], + "keys": [ + { + "key": "KEY_MODEL", + "label": "MDL", + "side": "R" + }, + { + "key": "KEY_SYS", + "label": "SYS", + "side": "L" + }, + { + "key": "KEY_PAGEUP", + "label": "PAGE◀", + "side": "L" + }, + { + "key": "KEY_PAGEDN", + "label": "PAGE▶", + "side": "R" + }, + { + "key": "KEY_TELE", + "label": "TELE", + "side": "R" + }, + { + "key": "KEY_EXIT", + "label": "RTN", + "side": "L" + }, + { + "key": "KEY_ENTER", + "label": "Enter ⏎", + "side": "R" + } + ] + }, { "name": "Fatfish F16", "wasm": "edgetx-f16-simulator.wasm",