From ee0c37157d8e56152415503586f7afda51c3a535 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Fri, 18 Feb 2022 12:41:14 +0100 Subject: [PATCH] Remove legacy fonts and make the bootloader compile with LVGL --- radio/src/cli.cpp | 12 +- radio/src/datastructs.h | 2 + radio/src/fonts/CMakeLists.txt | 45 - radio/src/fonts/lvgl/lv_font_roboto_bl_16.c | 1149 +++++++++++++++++ radio/src/fonts/lvgl/make_fonts.sh | 14 + radio/src/fw_version.h | 42 + radio/src/globals.h | 1 + radio/src/gui/colorlcd/LvglWrapper.cpp | 75 +- radio/src/gui/colorlcd/fonts.cpp | 7 +- radio/src/gui/colorlcd/lcd.cpp | 102 +- radio/src/gui/colorlcd/lcd.h | 28 +- radio/src/gui/colorlcd/libopenui.h | 40 +- radio/src/gui/colorlcd/popups.h | 34 + radio/src/gui/colorlcd/radio_version.cpp | 2 + radio/src/gui/colorlcd/view_text.cpp | 7 - radio/src/gui/colorlcd/view_text.h | 1 + radio/src/gui/gui_common.h | 2 + radio/src/hal/adc_driver.cpp | 146 +++ radio/src/hal/adc_driver.h | 19 + radio/src/keys.cpp | 4 +- radio/src/keys.h | 8 + radio/src/lv_conf.h | 65 +- radio/src/main.cpp | 1 - radio/src/myeeprom.h | 3 +- radio/src/opentx.cpp | 185 +-- radio/src/opentx.h | 87 +- radio/src/opentx_types.h | 1 - radio/src/serial.cpp | 4 +- radio/src/simu.cpp | 10 + radio/src/stamp.cpp | 12 +- radio/src/strhelpers.cpp | 21 +- .../common/arm/stm32/aux_serial_driver.cpp | 4 +- .../targets/common/arm/stm32/board_common.h | 29 + .../arm/stm32/bootloader/CMakeLists.txt | 12 +- .../common/arm/stm32/bootloader/bin_files.cpp | 4 +- .../common/arm/stm32/bootloader/bin_files.h | 3 +- .../common/arm/stm32/bootloader/boot.cpp | 52 +- .../common/arm/stm32/bootloader/boot.h | 3 +- .../targets/common/arm/stm32/flash_driver.cpp | 2 +- .../targets/common/arm/stm32/pwr_driver.cpp | 2 +- .../arm/stm32/rotary_encoder_driver.cpp | 12 +- .../targets/common/arm/stm32/rtc_driver.cpp | 3 +- .../common/arm/stm32/timers_driver.cpp | 15 +- .../targets/common/arm/stm32/usb_driver.cpp | 19 +- .../common/arm/stm32/usbd_storage_msd.cpp | 10 +- .../src/targets/common/arm/stm32/usbd_usr.cpp | 1 - radio/src/targets/horus/CMakeLists.txt | 1 - radio/src/targets/horus/backlight_driver.cpp | 3 +- radio/src/targets/horus/board.cpp | 20 +- radio/src/targets/horus/board.h | 16 +- .../targets/horus/bootloader/boot_menu.cpp | 135 +- radio/src/targets/horus/diskio.cpp | 10 +- radio/src/targets/horus/haptic_driver.cpp | 2 +- radio/src/targets/horus/keys_driver.cpp | 26 +- radio/src/targets/horus/lcd_driver.cpp | 13 +- radio/src/targets/horus/led_driver.cpp | 2 +- .../src/targets/horus/usb_charger_driver.cpp | 8 +- radio/src/targets/nv14/CMakeLists.txt | 2 +- radio/src/targets/nv14/backlight_driver.cpp | 3 +- radio/src/targets/nv14/battery_driver.cpp | 6 - radio/src/targets/nv14/board.cpp | 10 +- radio/src/targets/nv14/board.h | 7 +- .../src/targets/nv14/bootloader/boot_menu.cpp | 67 +- radio/src/targets/nv14/diskio.cpp | 10 +- radio/src/targets/nv14/extmodule_helper.cpp | 2 +- radio/src/targets/nv14/haptic_driver.cpp | 2 +- radio/src/targets/nv14/keys_driver.cpp | 32 +- radio/src/targets/nv14/lcd_driver.cpp | 4 +- radio/src/targets/simu/CMakeLists.txt | 9 + radio/src/targets/simu/simpgmspace.cpp | 38 +- radio/src/targets/simu/simulcd.cpp | 44 - radio/src/targets/taranis/keys_driver.cpp | 24 - radio/src/thirdparty/libopenui | 2 +- radio/src/translations.cpp | 4 + 74 files changed, 2027 insertions(+), 775 deletions(-) create mode 100644 radio/src/fonts/lvgl/lv_font_roboto_bl_16.c create mode 100644 radio/src/fw_version.h diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index 39b3f9eb4..43cd54fb0 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -517,8 +517,6 @@ void testDrawSolidFilledRoundedRectangle() ROUND | COLOR_THEME_SECONDARY3); } -void testDrawBlackOverlay() { lcdDrawBlackOverlay(); } - void testDrawSolidHorizontalLine1() { lcdDrawSolidHorizontalLine(0, 0, 1, 0); } void testDrawSolidHorizontalLine2() @@ -1275,11 +1273,7 @@ int cliDisplay(const char ** argv) if (!strcmp(argv[1], "keys")) { for (int i=0; i" */ + 0xb4, 0x0, 0xeb, 0xfd, 0x50, 0xc, 0x53, 0xfc, + 0xe0, 0x1c, 0xff, 0x60, 0x3, 0x9f, 0xd5, 0x56, + 0x7e, 0x28, 0x3, 0xed, 0x0, 0x31, 0x0, 0x78, + + /* U+003F "?" */ + 0x3, 0xbf, 0xe8, 0x1, 0xec, 0x57, 0xf8, 0x4e, + 0x10, 0x5, 0x68, 0x7, 0x4e, 0x80, 0x61, 0xe8, + 0x0, 0x87, 0x34, 0x40, 0x2a, 0xe2, 0x0, 0x87, + 0xd8, 0x3, 0xc, 0x90, 0x7, 0xfc, 0x32, 0x40, + 0x18, 0xb9, 0x0, 0x0, + + /* U+0040 "@" */ + 0x0, 0xc5, 0x3b, 0xfd, 0x68, 0x1, 0xe6, 0xe8, + 0x31, 0x26, 0xd8, 0x0, 0xcb, 0xc4, 0x1, 0xec, + 0x50, 0x0, 0xf2, 0x0, 0x1f, 0x71, 0x40, 0xb8, + 0x0, 0xd6, 0x0, 0x8d, 0x36, 0xe0, 0x6, 0x18, + 0x63, 0x0, 0xf9, 0x82, 0xe8, 0x2, 0x1c, 0x38, + 0xc1, 0xb4, 0x0, 0xd6, 0x0, 0x78, 0xf, 0x10, + 0x9a, 0x0, 0x3d, 0x0, 0x1a, 0x3, 0xc4, 0x2a, + 0x40, 0x11, 0x20, 0x8, 0x70, 0xf2, 0xa, 0x90, + 0x5, 0xc0, 0x3, 0xc, 0x31, 0x81, 0xb4, 0x57, + 0xb0, 0x1b, 0x0, 0xf, 0x80, 0xb, 0xfa, 0x1c, + 0xfb, 0x20, 0xb, 0x5c, 0x3, 0xff, 0x80, 0x5d, + 0x48, 0x22, 0x35, 0x0, 0xf8, 0x5f, 0x3f, 0xd8, + 0xc0, 0x18, + + /* U+0041 "A" */ + 0x0, 0xd3, 0xe2, 0x1, 0xfb, 0xfc, 0xc0, 0x1f, + 0x2f, 0xde, 0x0, 0x7d, 0x76, 0x4f, 0x20, 0xe, + 0x1f, 0x60, 0xf8, 0x0, 0xe6, 0xf1, 0xa, 0xd0, + 0xe, 0xcc, 0x0, 0x17, 0xcc, 0x2, 0x2f, 0x70, + 0x0, 0xfc, 0x80, 0x51, 0xff, 0xee, 0x0, 0xb7, + 0xc, 0xf3, 0x7a, 0x81, 0xfa, 0x80, 0x77, 0x58, + 0x4f, 0x0, 0x7a, 0x3c, 0x40, + + /* U+0042 "B" */ + 0xaf, 0xfd, 0x8a, 0x0, 0xae, 0x44, 0x2d, 0x7a, + 0x85, 0x68, 0x6, 0xda, 0xa, 0xd0, 0xd, 0xb6, + 0x15, 0xa0, 0x1, 0x7f, 0x40, 0xaf, 0xfe, 0x80, + 0x5, 0x69, 0x99, 0x23, 0xd8, 0x2b, 0x40, 0x35, + 0x70, 0x56, 0x80, 0x67, 0xf0, 0xad, 0x0, 0xd7, + 0xc1, 0x5c, 0x88, 0x59, 0xf6, 0xa, 0xff, 0xda, + 0xc0, 0x0, + + /* U+0043 "C" */ + 0x0, 0xa3, 0x7f, 0xa0, 0x3, 0x67, 0x3a, 0xbf, + 0xd8, 0x1, 0xbc, 0xc0, 0x24, 0xf5, 0xc, 0xb0, + 0xe, 0xd8, 0xf, 0x80, 0xf, 0xde, 0xe0, 0x1f, + 0xbd, 0xc0, 0x3f, 0x7c, 0x0, 0x7e, 0xdb, 0x0, + 0xec, 0x70, 0x7f, 0x30, 0x9, 0x3d, 0x40, 0x19, + 0xce, 0x8f, 0xd6, 0x1, 0xa7, 0xbf, 0x5c, 0x0, + + /* U+0044 "D" */ + 0xaf, 0xfb, 0xa4, 0x40, 0x15, 0xc8, 0x86, 0xde, + 0x20, 0xad, 0x0, 0xdb, 0x81, 0x5a, 0x1, 0x97, + 0xce, 0xb4, 0x3, 0xf, 0xb5, 0x68, 0x7, 0x7c, + 0x56, 0x80, 0x77, 0xc5, 0x68, 0x6, 0x1f, 0x6a, + 0xd0, 0xc, 0xbe, 0x75, 0xa0, 0x1b, 0x70, 0x2b, + 0x51, 0xd, 0xbc, 0x41, 0x5f, 0xf7, 0x48, 0x80, + 0x0, + + /* U+0045 "E" */ + 0xaf, 0xff, 0x3d, 0x72, 0x27, 0x15, 0x68, 0x7, + 0xab, 0x40, 0x3d, 0x5a, 0x1, 0xea, 0xff, 0xec, + 0xa, 0xd3, 0x3c, 0x41, 0x5a, 0x1, 0xea, 0xd0, + 0xf, 0x56, 0x80, 0x7a, 0xb9, 0x13, 0x8a, 0xbf, + 0xfd, 0x0, + + /* U+0046 "F" */ + 0xaf, 0xff, 0x35, 0x72, 0x27, 0xd, 0x68, 0x7, + 0xab, 0x40, 0x3d, 0x5a, 0x1, 0xea, 0xd0, 0xf, + 0x57, 0xff, 0x48, 0x56, 0x99, 0xe2, 0xa, 0xd0, + 0xf, 0x56, 0x80, 0x7a, 0xb4, 0x3, 0xd5, 0xa0, + 0x1e, + + /* U+0047 "G" */ + 0x0, 0xa3, 0xbf, 0x64, 0x40, 0x2c, 0xe7, 0x47, + 0xec, 0x0, 0x3f, 0x98, 0x4, 0x7e, 0xc1, 0x98, + 0x0, 0xe7, 0x50, 0xf9, 0x0, 0xfd, 0xee, 0x1, + 0xfb, 0xdc, 0x0, 0xdf, 0xf5, 0x87, 0xc8, 0x0, + 0x4c, 0xdb, 0x61, 0x7a, 0x1, 0xd9, 0x60, 0xbe, + 0xa0, 0x1b, 0x2c, 0x1, 0x5f, 0x8, 0xd5, 0xee, + 0x1, 0x36, 0xff, 0x62, 0x80, + + /* U+0048 "H" */ + 0xad, 0x0, 0xe7, 0xf1, 0xad, 0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, + 0x80, 0x14, 0x61, 0x79, 0x0, 0x39, 0x82, 0xe4, + 0x13, 0xc4, 0x17, 0x80, + + /* U+005F "_" */ + 0x0, 0xfd, 0xff, 0xf1, 0x9f, 0xe0, + + /* U+0060 "`" */ + 0x28, 0x20, 0x5, 0xe0, 0x0, 0x75, 0x80, + + /* U+0061 "a" */ + 0x0, 0x4f, 0x7e, 0xa8, 0x2, 0xf9, 0x52, 0x3c, + 0x81, 0x8, 0x2, 0xe7, 0x0, 0x3e, 0x77, 0xfa, + 0x2, 0x79, 0x48, 0x9d, 0x1, 0xec, 0x1, 0x74, + 0xf, 0xb0, 0x0, 0xbe, 0x3, 0x39, 0x99, 0xdf, + 0x20, 0x57, 0xfc, 0xd5, 0x20, + + /* U+0062 "b" */ + 0xe8, 0x0, 0xf7, 0x40, 0x7, 0xba, 0x0, 0x3d, + 0xd3, 0x5f, 0xd2, 0x0, 0xef, 0x95, 0x8f, 0x80, + 0xea, 0x0, 0xa7, 0x83, 0xa0, 0x2, 0x4f, 0x2e, + 0x80, 0x8, 0xfc, 0xfa, 0x0, 0x24, 0xf2, 0xea, + 0x0, 0xa7, 0x83, 0xbe, 0x56, 0x3d, 0xc3, 0xa2, + 0xbf, 0xa0, 0x0, + + /* U+0063 "c" */ + 0x0, 0x36, 0xfe, 0xa8, 0x1, 0xfe, 0x12, 0x7d, + 0x3, 0xa4, 0x2, 0xbb, 0x1f, 0xa0, 0x4, 0x24, + 0x9e, 0x40, 0x1c, 0x7e, 0x80, 0x1e, 0xf8, 0x0, + 0xa6, 0x81, 0xfd, 0xd2, 0x3d, 0x40, 0xf, 0xbf, + 0xaa, 0x0, + + /* U+0064 "d" */ + 0x0, 0xf4, 0xf0, 0x7, 0xa7, 0x80, 0x3d, 0x3c, + 0x0, 0x8e, 0xfa, 0xa7, 0x3, 0xfc, 0xac, 0xff, + 0x7, 0x50, 0x5, 0x5c, 0x5e, 0x80, 0x14, 0xf1, + 0xf9, 0x80, 0x53, 0xc5, 0xe8, 0x1, 0x4f, 0x7, + 0x40, 0x5, 0x3c, 0xf, 0xec, 0x4d, 0xfc, 0x0, + 0x8e, 0xe5, 0x4f, 0x0, + + /* U+0065 "e" */ + 0x0, 0x2e, 0xfe, 0xa0, 0x1, 0x7e, 0x12, 0xbc, + 0x83, 0xa8, 0x2, 0xd9, 0x2f, 0x50, 0xa, 0x75, + 0x3f, 0xfd, 0xc7, 0xec, 0x67, 0xc1, 0xf0, 0x1, + 0x8, 0x1, 0xbe, 0x11, 0x76, 0x0, 0xd, 0xbf, + 0xd0, 0x0, + + /* U+0066 "f" */ + 0x0, 0xfc, 0x7b, 0xf0, 0x0, 0xdd, 0x21, 0x0, + 0xfa, 0x80, 0x45, 0xe8, 0x0, 0x8f, 0xfc, 0x22, + 0x5f, 0x62, 0x0, 0x1f, 0xa0, 0x4, 0x7e, 0x80, + 0x11, 0xfa, 0x0, 0x47, 0xe8, 0x1, 0x1f, 0xa0, + 0x4, 0x7e, 0x80, 0x11, 0xfa, 0x0, 0x0, + + /* U+0067 "g" */ + 0x0, 0x47, 0x7d, 0x47, 0x3, 0xfc, 0xac, 0xff, + 0x7, 0x50, 0x5, 0x5c, 0x5e, 0xa0, 0x14, 0xf1, + 0xf9, 0x80, 0x53, 0xc3, 0xe8, 0x1, 0x4f, 0x7, + 0x48, 0x5, 0x5c, 0xf, 0xf2, 0xb3, 0xfc, 0x0, + 0x8e, 0xfa, 0xa6, 0x80, 0x7b, 0x2c, 0x27, 0x15, + 0x27, 0xd0, 0x1, 0x3d, 0xf8, 0x80, + + /* U+0068 "h" */ + 0xe8, 0x0, 0xee, 0x80, 0xe, 0xe8, 0x0, 0xee, + 0x99, 0x77, 0x24, 0x3b, 0xe9, 0x63, 0xdb, 0xac, + 0x2, 0xca, 0xe8, 0x0, 0xae, 0xdd, 0x0, 0x15, + 0xe7, 0x40, 0x5, 0x79, 0xd0, 0x1, 0x5e, 0x74, + 0x0, 0x57, 0x9d, 0x0, 0x15, 0xe0, + + /* U+0069 "i" */ + 0xb9, 0x76, 0x0, 0x65, 0x65, 0x65, 0x65, 0x65, + 0x65, 0x65, 0x65, 0x65, 0x0, + + /* U+006A "j" */ + 0x0, 0x64, 0x0, 0x21, 0x40, 0x3d, 0xb2, 0x0, + 0xd9, 0x0, 0x6c, 0x80, 0x36, 0x40, 0x1b, 0x20, + 0xd, 0x90, 0x6, 0xc8, 0x3, 0x64, 0x1, 0xb2, + 0x0, 0xd9, 0x26, 0xf6, 0x7f, 0xb0, + + /* U+006B "k" */ + 0xe8, 0x0, 0xf7, 0x40, 0x7, 0xba, 0x0, 0x3d, + 0xd0, 0x0, 0x7f, 0x40, 0xe8, 0x6, 0xf6, 0x0, + 0x74, 0x27, 0xc0, 0x5, 0xd7, 0xf6, 0x1, 0xbb, + 0xfd, 0xc0, 0x1b, 0xb4, 0xfe, 0x80, 0x2e, 0x80, + 0x6f, 0x50, 0x7, 0x40, 0x2, 0xb8, 0x43, 0xa0, + 0x0, 0x3d, 0x60, + + /* U+006C "l" */ + 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, + 0xca, 0xca, 0xca, 0xca, + + /* U+006D "m" */ + 0xe8, 0xaf, 0xf4, 0x84, 0x77, 0x28, 0x7b, 0xe1, + 0x67, 0xf6, 0xd5, 0xfe, 0x7a, 0x40, 0x2d, 0xe0, + 0xa, 0x77, 0xa0, 0x2, 0xbb, 0x0, 0x51, 0xdc, + 0x80, 0xa, 0xec, 0x1, 0x47, 0xf4, 0x0, 0x57, + 0x60, 0xa, 0x3f, 0xa0, 0x2, 0xbb, 0x0, 0x51, + 0xfd, 0x0, 0x15, 0xd8, 0x2, 0x8f, 0xe8, 0x0, + 0xae, 0xc0, 0x14, 0x78, + + /* U+006E "n" */ + 0xe8, 0x9e, 0xe4, 0x87, 0x7d, 0x2c, 0x7b, 0x75, + 0x80, 0x59, 0x5d, 0x0, 0x15, 0xdb, 0xa0, 0x2, + 0xbc, 0xe8, 0x0, 0xaf, 0x3a, 0x0, 0x2b, 0xce, + 0x80, 0xa, 0xf3, 0xa0, 0x2, 0xbc, + + /* U+006F "o" */ + 0x0, 0x2e, 0xfe, 0xb8, 0x4, 0xdf, 0x29, 0x1f, + 0x0, 0xe, 0xa0, 0xa, 0x3c, 0x4b, 0xd0, 0x2, + 0x2f, 0x54, 0xf3, 0x0, 0x87, 0xd8, 0xfd, 0x0, + 0x22, 0xf4, 0xe, 0x90, 0xa, 0x3c, 0x41, 0xbe, + 0x11, 0xfe, 0x0, 0x26, 0xdf, 0xd6, 0x0, 0x0, + + /* U+0070 "p" */ + 0xe8, 0xae, 0xe4, 0x0, 0x3b, 0xd8, 0x9f, 0xdc, + 0x3a, 0x40, 0x29, 0xe0, 0xe8, 0x0, 0x93, 0xc7, + 0xa0, 0x2, 0x3f, 0x3e, 0x80, 0x9, 0x7c, 0x7a, + 0x40, 0x2a, 0xe0, 0xef, 0x74, 0x8f, 0x70, 0xea, + 0xa7, 0xf4, 0x0, 0x3a, 0x0, 0x3d, 0xd0, 0x1, + 0xee, 0x80, 0xf, 0x0, + + /* U+0071 "q" */ + 0x0, 0x47, 0x7d, 0x4f, 0x3, 0xfc, 0x24, 0x7f, + 0x7, 0x48, 0x5, 0x5c, 0x5e, 0x80, 0x14, 0xf1, + 0xf9, 0x80, 0x53, 0xc5, 0xe8, 0x1, 0x4f, 0x7, + 0x48, 0x5, 0x5c, 0xf, 0xf0, 0x91, 0xfc, 0x0, + 0x8e, 0xe5, 0x53, 0x80, 0x3d, 0x3c, 0x1, 0xe9, + 0xe0, 0xf, 0x4f, 0x0, + + /* U+0072 "r" */ + 0x0, 0xee, 0xac, 0xf3, 0xef, 0x85, 0x1e, 0xa0, + 0xb, 0xa0, 0x2, 0xe8, 0x0, 0xba, 0x0, 0x2e, + 0x80, 0xb, 0xa0, 0x2, 0xe8, 0x0, 0x80, + + /* U+0073 "s" */ + 0x0, 0x4f, 0x7d, 0x98, 0x2, 0xb9, 0x53, 0x38, + 0x43, 0xa0, 0x0, 0x36,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"x" */ + 0x4f, 0x50, 0x3, 0xf9, 0x85, 0x70, 0xf, 0xc8, + 0x0, 0x7e, 0x2b, 0x80, 0x33, 0x7f, 0x94, 0x3, + 0xbf, 0x80, 0x39, 0xff, 0xcc, 0x1, 0x17, 0xbc, + 0x70, 0x80, 0x2f, 0x40, 0x1d, 0x40, 0xbe, 0x80, + 0x6, 0xf4, + + /* U+0079 "y" */ + 0xae, 0x0, 0x97, 0xcd, 0x3c, 0xc0, 0x13, 0xa0, + 0xe, 0x80, 0x7, 0x40, 0x2, 0x74, 0xf, 0xc8, + 0x0, 0x7e, 0x51, 0xa0, 0x1b, 0x63, 0x1c, 0x3, + 0x47, 0x79, 0x0, 0x62, 0xfc, 0x0, 0xf7, 0x38, + 0x7, 0x1f, 0x88, 0x4, 0x2d, 0xb4, 0x1, 0x97, + 0xec, 0x40, 0x30, + + /* U+007A "z" */ + 0x3f, 0xff, 0x10, 0x22, 0x6e, 0xd0, 0xe, 0x8f, + 0x20, 0xc, 0x7e, 0xe0, 0x1d, 0xb6, 0x1, 0xd5, + 0xc2, 0x1, 0x97, 0xd4, 0x3, 0xf, 0x61, 0x9e, + 0x15, 0xff, 0xf3, 0x0, + + /* U+007B "{" */ + 0x0, 0xc6, 0x1, 0xab, 0x84, 0x0, 0xde, 0x20, + 0x15, 0xd8, 0x3, 0x6c, 0x80, 0x6d, 0x90, 0xd, + 0xd0, 0x1, 0x37, 0xa0, 0x2, 0x3e, 0x80, 0x21, + 0x8f, 0x30, 0xd, 0xd0, 0x1, 0xb6, 0x40, 0x36, + 0xc8, 0x6, 0xca, 0x0, 0xd1, 0xc0, 0x18, 0x73, + 0x2, 0x1, 0x98, 0x0, + + /* U+007C "|" */ + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + + /* U+007D "}" */ + 0x30, 0xd, 0x3c, 0x40, 0x15, 0x68, 0x4, 0x9e, + 0x20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0x0, 0xa3, 0xff, 0xdc, 0x80, 0x8, 0xff, 0xfd, + 0xc1, 0x1f, 0x1, 0xe1, 0x68, 0x1f, 0xe8, 0xff, + 0x40, 0x78, 0x5a, 0x7, 0xff, 0x40, 0x78, 0x5a, + 0x7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xdf, + 0xff, 0xee, 0x4e, 0xff, 0xfd, 0xc8, + + /* U+F8A2 "" */ + 0x0, 0xff, 0xe1, 0x88, 0x7, 0xff, 0xc, 0xf8, + 0x3, 0x84, 0x3, 0xf1, 0x77, 0x88, 0x5, 0x7e, + 0x1, 0xf9, 0xff, 0xc2, 0x0, 0xcf, 0xf0, 0x80, + 0x7c, 0xff, 0xe1, 0x16, 0x7f, 0xce, 0xff, 0xaf, + 0xfc, 0x39, 0xff, 0xff, 0xc3, 0x17, 0xff, 0xff, + 0xe1, 0x70, 0x1, 0xff, 0xe1, 0x0, 0xff, 0xe0, + 0xb7, 0xf8, 0x40, 0x3f, 0xf8, 0x4b, 0x40, 0x1f, + 0xfc, 0x0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { + {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, + {.bitmap_index = 0, .adv_w = 63, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 0, .adv_w = 66, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 13, .adv_w = 82, .box_w = 4, .box_h = 5, .ofs_x = 1, .ofs_y = 7}, + {.bitmap_index = 23, .adv_w = 158, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 74, .adv_w = 144, .box_w = 9, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 136, .adv_w = 188, .box_w = 12, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 196, .adv_w = 159, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 252, .adv_w = 45, .box_w = 2, .box_h = 4, .ofs_x = 0, .ofs_y = 8}, + {.bitmap_index = 256, .adv_w = 88, .box_w = 5, .box_h = 18, .ofs_x = 1, .ofs_y = -4}, + {.bitmap_index = 298, .adv_w = 89, .box_w = 5, .box_h = 18, .ofs_x = 0, .ofs_y = -4}, + {.bitmap_index = 341, .adv_w = 110, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 5}, + {.bitmap_index = 365, .adv_w = 145, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 398, .adv_w = 50, .box_w = 3, .box_h = 5, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 405, .adv_w = 71, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 4}, + {.bitmap_index = 411, .adv_w = 67, .box_w = 2, .box_h = 2, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 414, .adv_w = 106, .box_w = 7, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 448, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 501, .adv_w = 144, .box_w = 5, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 530, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 573, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 617, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 661, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 704, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 750, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 787, .adv_w = 144, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 840, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 887, .adv_w = 62, .box_w = 2, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 894, .adv_w = 54, .box_w = 3, .box_h = 12, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 908, .adv_w = 130, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 932, .adv_w = 141, .box_w = 7, .box_h = 6, .ofs_x = 1, .ofs_y = 3}, + {.bitmap_index = 947, .adv_w = 134, .box_w = 7, .box_h = 8, .ofs_x = 1, .ofs_y = 1}, + {.bitmap_index = 971, .adv_w = 121, .box_w = 7, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1007, .adv_w = 230, .box_w = 14, .box_h = 15, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1105, .adv_w = 167, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1158, .adv_w = 159, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1208, .adv_w = 167, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1256, .adv_w = 168, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1305, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1339, .adv_w = 142, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1372, .adv_w = 174, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1425, .adv_w = 183, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1472, .adv_w = 70, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1484, .adv_w = 141, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1521, .adv_w = 161, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1575, .adv_w = 138, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1607, .adv_w = 224, .box_w = 12, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1677, .adv_w = 183, .box_w = 10, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1735, .adv_w = 176, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1793, .adv_w = 162, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1836, .adv_w = 176, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1900, .adv_w = 158, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1950, .adv_w = 152, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1998, .adv_w = 153, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2035, .adv_w = 166, .box_w = 9, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2084, .adv_w = 163, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2135, .adv_w = 227, .box_w = 14, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2215, .adv_w = 161, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2268, .adv_w = 154, .box_w = 10, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2314, .adv_w = 153, .box_w = 9, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2351, .adv_w = 68, .box_w = 4, .box_h = 18, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 2389, .adv_w = 105, .box_w = 7, .box_h = 13, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2423, .adv_w = 68, .box_w = 4, .box_h = 18, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2461, .adv_w = 107, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 6}, + {.bitmap_index = 2481, .adv_w = 116, .box_w = 8, .box_h = 3, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2487, .adv_w = 79, .box_w = 4, .box_h = 3, .ofs_x = 0, .ofs_y = 10}, + {.bitmap_index = 2494, .adv_w = 139, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2531, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2574, .adv_w = 134, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2608, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2652, .adv_w = 136, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2686, .adv_w = 89, .box_w = 6, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 2725, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2771, .adv_w = 141, .box_w = 7, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2809, .adv_w = 62, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2822, .adv_w = 61, .box_w = 4, .box_h = 15, .ofs_x = -1, .ofs_y = -3}, + {.bitmap_index = 2852, .adv_w = 130, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2895, .adv_w = 62, .box_w = 2, .box_h = 12, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2907, .adv_w = 224, .box_w = 12, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2959, .adv_w = 141, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 2989, .adv_w = 146, .box_w = 9, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3029, .adv_w = 144, .box_w = 8, .box_h = 12, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 3073, .adv_w = 146, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3117, .adv_w = 87, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 3140, .adv_w = 132, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3175, .adv_w = 84, .box_w = 5, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3204, .adv_w = 141, .box_w = 7, .box_h = 9, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 3235, .adv_w = 124, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3268, .adv_w = 192, .box_w = 12, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3322, .adv_w = 127, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3356, .adv_w = 121, .box_w = 8, .box_h = 12, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3399, .adv_w = 127, .box_w = 8, .box_h = 9, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3427, .adv_w = 87, .box_w = 6, .box_h = 17, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3471, .adv_w = 62, .box_w = 2, .box_h = 14, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 3485, .adv_w = 87, .box_w = 5, .box_h = 17, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 3528, .adv_w = 174, .box_w = 9, .box_h = 5, .ofs_x = 1, .ofs_y = 3}, + {.bitmap_index = 3548, .adv_w = 176, .box_w = 11, .box_h = 12, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 3604, .adv_w = 160, .box_w = 12, .box_h = 16, .ofs_x = -1, .ofs_y = -2}, + {.bitmap_index = 3667, .adv_w = 192, .box_w = 12, .box_h = 16, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 3705, .adv_w = 258, .box_w = 17, .box_h = 11, .ofs_x = 0, .ofs_y = 1} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + +static const uint16_t unicode_list_1[] = { + 0x0, 0xda, 0x7b5, 0x895 +}; + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 32, .range_length = 95, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + }, + { + .range_start = 61453, .range_length = 2198, .glyph_id_start = 96, + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 4, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + } +}; + +/*----------------- + * KERNING + *----------------*/ + + +/*Map glyph_ids to kern left classes*/ +static const uint8_t kern_left_class_mapping[] = +{ + 0, 1, 0, 2, 0, 0, 0, 0, + 2, 3, 0, 0, 0, 4, 0, 4, + 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 6, 7, 8, 9, 10, 11, + 0, 12, 12, 13, 14, 15, 12, 12, + 9, 16, 17, 18, 0, 19, 13, 20, + 21, 22, 23, 24, 25, 0, 0, 0, + 0, 0, 26, 27, 28, 0, 29, 30, + 0, 31, 0, 0, 32, 0, 31, 31, + 33, 27, 0, 34, 0, 35, 0, 36, + 37, 38, 36, 39, 40, 0, 0, 0, + 0, 0, 0, 0 +}; + +/*Map glyph_ids to kern right classes*/ +static const uint8_t kern_right_class_mapping[] = +{ + 0, 1, 0, 2, 0, 0, 0, 3, + 2, 0, 4, 5, 0, 6, 7, 6, + 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 0, 10, 0, 11, 0, 0, 0, + 11, 0, 0, 12, 0, 0, 0, 0, + 11, 0, 11, 0, 13, 14, 15, 16, + 17, 18, 19, 20, 0, 0, 21, 0, + 0, 0, 22, 0, 23, 23, 23, 24, + 23, 0, 0, 0, 0, 0, 25, 25, + 26, 25, 23, 27, 28, 29, 30, 31, + 32, 33, 31, 34, 0, 0, 35, 0, + 0, 0, 0, 0 +}; + +/*Kern values between classes*/ +static const int8_t kern_class_values[] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -13, 0, 0, 0, + 0, 0, 0, 0, -15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -6, -7, 0, -2, -8, 0, -10, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 2, 0, + 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -21, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -28, 0, 0,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, 0, -3, + -3, 0, 0, 0, -3, -5, -8, 0, + 0, 0, 0, -42, 0, 0, 0, 0, + 0, 0, 0, 2, -8, 0, 0, -34, + -7, -22, -18, 0, -30, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -5, + -17, -11, 0, 0, 0, 0, 0, 0, + 0, 0, -40, 0, 0, 0, -17, 0, + -25, 0, 0, 0, 0, 0, -4, 0, + -3, 0, -1, -2, 0, 0, -2, 0, + 0, 2, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -5, 0, -3, + -2, 0, -4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -10, 0, -2, 0, 0, -6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -5, 0, + 0, 0, 0, -27, -29, 0, 0, -10, + -3, -30, -2, 2, 0, 2, 2, 0, + 2, 0, 0, -14, -12, 0, -14, -12, + -9, -14, 0, -12, -9, -7, -10, -7, + 0, 0, 0, 0, 3, 0, -28, -5, + 0, 0, -9, -2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, -6, -5, + 0, 0, -6, -4, 0, 0, -3, -1, + 0, 0, 0, 2, 0, 0, 0, 2, + 0, -15, -7, 0, 0, -5, 0, 0, + 0, 2, 0, 0, 0, 0, 0, 0, + 2, -4, -4, 0, 0, -4, -3, 0, + 0, -2, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, -6, 0, 0, + 0, -3, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 0, -3, 0, 0, + -3, 0, 0, 0, -3, -4, 0, 0, + 0, 0, 0, 0, -4, 3, -6, -26, + -6, 0, 0, -12, -4, -12, -2, 2, + -12, 2, 2, 2, 2, 0, 2, -9, + -8, -3, -5, -8, -5, -7, -3, -5, + -2, 0, -3, -4, 2, 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 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -2, 0, + -3, -2, 0, 0, 2, 0, 0, 0, + -15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -5, -2, 2, 0, -2, 0, 0, 6, + 0, 2, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, -13, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -2, -2, + 2, 0, -2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, -15, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -2, 0, 0, + -2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -2, 0, 0, -2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + -2, 0, 0, -2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +/*Collect the kern class' data in one place*/ +static const lv_font_fmt_txt_kern_classes_t kern_classes = +{ + .class_pair_values = kern_class_values, + .left_class_mapping = kern_left_class_mapping, + .right_class_mapping = kern_right_class_mapping, + .left_class_cnt = 40, + .right_class_cnt = 35, +}; + +/*-------------------- + * ALL CUSTOM DATA + *--------------------*/ + +#if LV_VERSION_CHECK(8, 0, 0) +/*Store all the custom data of the font*/ +static lv_font_fmt_txt_glyph_cache_t cache; +static const lv_font_fmt_txt_dsc_t font_dsc = { +#else +static lv_font_fmt_txt_dsc_t font_dsc = { +#endif + .glyph_bitmap = glyph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = &kern_classes, + .kern_scale = 16, + .cmap_num = 2, + .bpp = 4, + .kern_classes = 1, + .bitmap_format = 2, +#if LV_VERSION_CHECK(8, 0, 0) + .cache = &cache +#endif +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +#if LV_VERSION_CHECK(8, 0, 0) +const lv_font_t lv_font_roboto_bl_16 = { +#else +lv_font_t lv_font_roboto_bl_16 = { +#endif + .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ + .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ + .line_height = 19, /*The maximum line height required by the font*/ + .base_line = 4, /*Baseline measured from the bottom of the line*/ +#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) + .subpx = LV_FONT_SUBPX_NONE, +#endif +#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8 + .underline_position = -1, + .underline_thickness = 1, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + + + +#endif /*#if LV_FONT_ROBOTO_BL_16*/ + diff --git a/radio/src/fonts/lvgl/make_fonts.sh b/radio/src/fonts/lvgl/make_fonts.sh index fadc9b8f7..9b5d1a817 100755 --- a/radio/src/fonts/lvgl/make_fonts.sh +++ b/radio/src/fonts/lvgl/make_fonts.sh @@ -25,6 +25,19 @@ function make_font() { --format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format } +# LV_SYMBOL_CHARGE, LV_SYMBOL_NEW_LINE, LV_SYMBOL_SD_CARD, LV_SYMBOL_CLOSE +BL_SYMBOLS="61671,63650,63426,61453" + +function make_bootloader_font() { + local name=$1 + local ttf=$2 + local size=$3 + lv_font_conv --no-prefilter --bpp 4 --size ${size} \ + --font ${TTF_DIR}${ttf} -r ${ASCII} \ + --font ${SYMBOLS_FONT} -r ${BL_SYMBOLS} \ + --format lvgl -o lv_font_${name}_${size}.c --force-fast-kern-format +} + make_font "roboto" "Roboto/Roboto-Regular.ttf" 9 make_font "roboto" "Roboto/Roboto-Regular.ttf" 13 make_font "roboto" "Roboto/Roboto-Regular.ttf" 14 @@ -38,4 +51,5 @@ make_font "roboto_bold" "Roboto/Roboto-Bold.ttf" 17 make_font "roboto_bold" "Roboto/Roboto-Bold.ttf" 16 make_font "roboto_bold" "Roboto/Roboto-Bold.ttf" 32 make_font "roboto_bold" "Roboto/Roboto-Bold.ttf" 64 +make_bootloader_font "roboto_bl" "Roboto/Roboto-Regular.ttf" 16 diff --git a/radio/src/fw_version.h b/radio/src/fw_version.h new file mode 100644 index 000000000..7edb1d0df --- /dev/null +++ b/radio/src/fw_version.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#pragma once +#include "stamp.h" + +#if defined(COLORLCD) +extern const char fw_stamp[]; +extern const char vers_stamp[]; +extern const char date_stamp[]; +extern const char time_stamp[]; +extern const char cfgv_stamp[]; +#else +extern const char vers_stamp[]; +#endif + +#if defined(STM32) +/** + * Tries to find opentx version in the first 1024 byte of either firmware/bootloader + * (the one not running) or the buffer + * @param buffer If non-null find the firmware version in the buffer instead + */ +const char * getFirmwareVersion(const char * buffer = nullptr); +#endif diff --git a/radio/src/globals.h b/radio/src/globals.h index 808894953..1e903e10c 100644 --- a/radio/src/globals.h +++ b/radio/src/globals.h @@ -24,6 +24,7 @@ #include "definitions.h" #include "dataconstants.h" +#include "opentx_types.h" PACK(struct GlobalData { uint8_t unexpectedShutdown:1; diff --git a/radio/src/gui/colorlcd/LvglWrapper.cpp b/radio/src/gui/colorlcd/LvglWrapper.cpp index 93491bb5b..4ca6c6753 100644 --- a/radio/src/gui/colorlcd/LvglWrapper.cpp +++ b/radio/src/gui/colorlcd/LvglWrapper.cpp @@ -26,8 +26,6 @@ LvglWrapper* LvglWrapper::_instance = nullptr; -static lv_disp_t* disp; -static lv_disp_draw_buf_t disp_buf; static lv_indev_drv_t touchDriver; static lv_indev_drv_t keyboard_drv; static lv_indev_drv_t rotaryDriver; @@ -50,38 +48,6 @@ TouchState getLastTochState() } #endif -void newLcdRefresh(uint16_t* buffer, const rect_t& copy_area); -static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) -{ - lv_area_t refr_area; - lv_area_copy(&refr_area, area); - -#if defined(LCD_VERTICAL_INVERT) - lv_coord_t tmp_coord; - tmp_coord = refr_area.y2; - refr_area.y2 = LCD_H - refr_area.y1 - 1; - refr_area.y1 = LCD_H - tmp_coord - 1; - tmp_coord = refr_area.x2; - refr_area.x2 = LCD_W - refr_area.x1 - 1; - refr_area.x1 = LCD_W - tmp_coord - 1; -#endif - - if (refr_area.x1 != 0 || refr_area.x2 != 479 || refr_area.y1 != 0 || - refr_area.y2 != 271) { - TRACE("partial refresh @ 0x%p {%d,%d,%d,%d}", color_p, refr_area.x1, - refr_area.y1, refr_area.x2, refr_area.y2); - } else { - TRACE("full refresh @ 0x%p", color_p); - } - - rect_t copy_area = {refr_area.x1, refr_area.y1, - refr_area.x2 - refr_area.x1 + 1, - refr_area.y2 - refr_area.y1 + 1}; - - newLcdRefresh((uint16_t*)color_p, copy_area); - lv_disp_flush_ready(disp_drv); -} - extern "C" void keyboardDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data) { // if there is a keyboard event then call checkevents @@ -197,41 +163,15 @@ lv_color_t makeLvColor(uint32_t colorFlags) return lv_color_make(GET_RED(color), GET_GREEN(color), GET_BLUE(color)); } - -extern BitmapBuffer * lcdFront; -extern BitmapBuffer * lcd; - -static lv_disp_drv_t disp_drv; - -void init_disp_drv() -{ - lv_disp_draw_buf_init(&disp_buf, lcdFront->getData(), lcd->getData(), LCD_W*LCD_H); - lv_disp_drv_init(&disp_drv); /*Basic initialization*/ - disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/ - disp_drv.flush_cb = flushLcd; /*Set a flush callback to draw to the display*/ - disp_drv.hor_res = LCD_PHYS_W; /*Set the horizontal resolution in pixels*/ - disp_drv.ver_res = LCD_PHYS_H; /*Set the vertical resolution in pixels*/ - disp_drv.full_refresh = 0; - disp_drv.direct_mode = 0; -#if defined (LCD_VERTICAL_INVERT) - disp_drv.rotated = LV_DISP_ROT_180; -#endif -// disp_drv.rotated = LV_DISP_ROT_90; - disp_drv.sw_rotate = 1; - - // Register the driver and save the created display objects - disp = lv_disp_drv_register(&disp_drv); -} - static void init_lvgl_drivers() { + // Register the driver and save the created display object + lcdInitDisplayDriver(); + // add all lvgl object automatically to a input handling group inputGroup = lv_group_create(); lv_group_set_default(inputGroup); - // Register the driver and save the created display objects - init_disp_drv(); - // Register the driver in LVGL and save the created input device object lv_indev_drv_init(&touchDriver); /*Basic initialization*/ touchDriver.type = LV_INDEV_TYPE_POINTER; /*See below.*/ @@ -341,7 +281,6 @@ static void init_theme() LvglWrapper::LvglWrapper() { - lv_init(); init_lvgl_drivers(); init_theme(); @@ -352,8 +291,8 @@ LvglWrapper::LvglWrapper() void LvglWrapper::run() { - tmr10ms_t tick = get_tmr10ms(); - lv_tick_inc((tick - lastTick) * 10); - lastTick = tick; - lv_timer_handler(); + tmr10ms_t tick = get_tmr10ms(); + lv_tick_inc((tick - lastTick) * 10); + lastTick = tick; + lv_timer_handler(); } diff --git a/radio/src/gui/colorlcd/fonts.cpp b/radio/src/gui/colorlcd/fonts.cpp index b3231fc2f..eae04ad9a 100644 --- a/radio/src/gui/colorlcd/fonts.cpp +++ b/radio/src/gui/colorlcd/fonts.cpp @@ -19,19 +19,20 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "libopenui_config.h" +#include "font.h" +#if !defined(BOOT) static const lv_font_t* lvglFontTable[FONTS_COUNT] = { LV_FONT_DEFAULT, // FONT_STD_INDEX -#if !defined(BOOT) &lv_font_roboto_bold_16, // FONT_BOLD_INDEX &lv_font_roboto_9, // FONT_XXS_INDEX &lv_font_roboto_13, // FONT_XS_INDEX &lv_font_roboto_24, // FONT_L_INDEX &lv_font_roboto_bold_32, // FONT_XL_INDEX &lv_font_roboto_bold_64, // FONT_XXL_INDEX -#endif }; +#endif const lv_font_t* getFont(LcdFlags flags) { diff --git a/radio/src/gui/colorlcd/lcd.cpp b/radio/src/gui/colorlcd/lcd.cpp index f92860886..13092e4ba 100644 --- a/radio/src/gui/colorlcd/lcd.cpp +++ b/radio/src/gui/colorlcd/lcd.cpp @@ -20,13 +20,109 @@ */ #include "lcd.h" -#include "opentx.h" +#include -void lcdSetContrast() +extern BitmapBuffer * lcdFront; +extern BitmapBuffer * lcd; + +static lv_disp_draw_buf_t disp_buf; +static lv_disp_drv_t disp_drv; +static lv_disp_t* disp = nullptr; + +static lv_area_t screen_area = { + 0, 0, LCD_W-1, LCD_H-1 +}; + +void newLcdRefresh(uint16_t* buffer, const rect_t& copy_area); + +static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { - lcdSetRefVolt(g_eeGeneral.contrast); + lv_area_t refr_area; + lv_area_copy(&refr_area, area); + +#if defined(LCD_VERTICAL_INVERT) + lv_coord_t tmp_coord; + tmp_coord = refr_area.y2; + refr_area.y2 = LCD_H - refr_area.y1 - 1; + refr_area.y1 = LCD_H - tmp_coord - 1; + tmp_coord = refr_area.x2; + refr_area.x2 = LCD_W - refr_area.x1 - 1; + refr_area.x1 = LCD_W - tmp_coord - 1; +#endif + + if (refr_area.x1 != 0 || refr_area.x2 != LCD_W-1 || refr_area.y1 != 0 || + refr_area.y2 != LCD_H-1) { + TRACE("partial refresh @ 0x%p {%d,%d,%d,%d}", color_p, refr_area.x1, + refr_area.y1, refr_area.x2, refr_area.y2); + } else { + TRACE("full refresh @ 0x%p", color_p); + } + + rect_t copy_area = {refr_area.x1, refr_area.y1, + refr_area.x2 - refr_area.x1 + 1, + refr_area.y2 - refr_area.y1 + 1}; + + newLcdRefresh((uint16_t*)color_p, copy_area); + lv_disp_flush_ready(disp_drv); } +void lcdInitDisplayDriver() +{ + lv_init(); + + lv_disp_draw_buf_init(&disp_buf, lcdFront->getData(), lcd->getData(), LCD_W*LCD_H); + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/ + disp_drv.flush_cb = flushLcd; /*Set a flush callback to draw to the display*/ + disp_drv.hor_res = LCD_W; /*Set the horizontal resolution in pixels*/ + disp_drv.ver_res = LCD_H; /*Set the vertical resolution in pixels*/ + disp_drv.full_refresh = 0; + disp_drv.direct_mode = 0; +#if defined (LCD_VERTICAL_INVERT) + disp_drv.rotated = LV_DISP_ROT_180; +#endif + disp_drv.sw_rotate = 1; + + // Register the driver and save the created display object + disp = lv_disp_drv_register(&disp_drv); + + // remove all styles on default screen (makes it transparent as well) + lv_obj_remove_style_all(lv_scr_act()); + + // transparent background: + // - this prevents LVGL overwritting things drawn directly into the bitmap buffer + lv_disp_set_bg_opa(disp, LV_OPA_TRANSP); + + // allow drawing at any moment + _lv_refr_set_disp_refreshing(disp); + + lv_draw_ctx_t * draw_ctx = disp->driver->draw_ctx; + lcd->setDrawCtx(draw_ctx); + lcdFront->setDrawCtx(draw_ctx); +} + +void lcdInitDirectDrawing() +{ + lv_draw_ctx_t* draw_ctx = disp->driver->draw_ctx; + draw_ctx->buf = disp->driver->draw_buf->buf_act; + draw_ctx->buf_area = &screen_area; + draw_ctx->clip_area = &screen_area; + lcd->setData((pixel_t*)draw_ctx->buf); +} + +void lcdRefresh() +{ + _lv_inv_area(nullptr, &screen_area); + lv_refr_now(nullptr); +} + +void lcdFlushed() +{ + lv_disp_t* disp = _lv_refr_get_disp_refreshing(); + lv_disp_flush_ready(disp->driver); +} + +//TODO: move this somewhere else event_t getWindowEvent() { return getEvent(false); diff --git a/radio/src/gui/colorlcd/lcd.h b/radio/src/gui/colorlcd/lcd.h index 1535825e4..39c688518 100644 --- a/radio/src/gui/colorlcd/lcd.h +++ b/radio/src/gui/colorlcd/lcd.h @@ -25,28 +25,11 @@ #include "bitmapbuffer.h" #include "opentx_types.h" -#if LCD_W >= 480 - #define LCD_COLS 40 -#else - #define LCD_COLS 30 -#endif - -#define CENTER - #include "colors.h" #define DISPLAY_PIXELS_COUNT (LCD_W * LCD_H) #define DISPLAY_BUFFER_SIZE (DISPLAY_PIXELS_COUNT) -extern coord_t lcdNextPos; - -inline void lcdClear() -{ - lcd->clear(); -} - -void lcdDrawBlackOverlay(); - #if defined(BOOT) #define BLINK_ON_PHASE (0) #else @@ -55,4 +38,15 @@ void lcdDrawBlackOverlay(); #define SLOW_BLINK_ON_PHASE (g_blinkTmr10ms & (1<<7)) #endif +// Init LVGL and its display driver +void lcdInitDisplayDriver(); + +// Patch the draw context to allow for direct drawing +void lcdInitDirectDrawing(); + +inline void lcdClear() { lcd->clear(); } + +void lcdRefresh(); +void lcdFlushed(); + #endif // _LCD_H_ diff --git a/radio/src/gui/colorlcd/libopenui.h b/radio/src/gui/colorlcd/libopenui.h index f72dfe94b..de5a42451 100644 --- a/radio/src/gui/colorlcd/libopenui.h +++ b/radio/src/gui/colorlcd/libopenui.h @@ -19,9 +19,9 @@ * GNU General Public License for more details. */ -#ifndef _LIBOPENUI_H_ -#define _LIBOPENUI_H_ +#pragma once +#if !defined(BOOT) #include "libopenui_config.h" #include "libopenui_file.h" #include "font.h" @@ -58,38 +58,4 @@ #include "draw_functions.h" #include "textedits.h" #include "LvglWrapper.h" - -inline MessageDialog * createPopupInformation(const char * message) -{ - return new MessageDialog(MainWindow::instance(), "Message", message); -} - -inline MessageDialog * createPopupWarning(const char * message) -{ - return new MessageDialog(MainWindow::instance(), "Warning", message); -} - -inline void POPUP_INFORMATION(const char * message) -{ - auto popup = createPopupInformation(message); - while (popup->getParent()) { - WDG_RESET(); - MainWindow::instance()->run(false); - LvglWrapper::instance()->run(); - } -} - -inline void POPUP_WARNING(const char * message, const char * info = nullptr) -{ - auto popup = createPopupWarning(message); - if (info) { - popup->setInfoText(std::string(info)); - } - while (popup->getParent()) { - WDG_RESET(); - MainWindow::instance()->run(false); - LvglWrapper::instance()->run(); - } -} - -#endif // _LIBOPENUI_H_ +#endif diff --git a/radio/src/gui/colorlcd/popups.h b/radio/src/gui/colorlcd/popups.h index ff7928e19..ee7e7afaa 100644 --- a/radio/src/gui/colorlcd/popups.h +++ b/radio/src/gui/colorlcd/popups.h @@ -22,8 +22,42 @@ #ifndef _POPUPS_H_ #define _POPUPS_H_ +#include "libopenui.h" #include typedef std::function ProgressHandler; +inline MessageDialog * createPopupInformation(const char * message) +{ + return new MessageDialog(MainWindow::instance(), "Message", message); +} + +inline MessageDialog * createPopupWarning(const char * message) +{ + return new MessageDialog(MainWindow::instance(), "Warning", message); +} + +inline void POPUP_INFORMATION(const char * message) +{ + auto popup = createPopupInformation(message); + while (popup->getParent()) { + WDG_RESET(); + MainWindow::instance()->run(false); + LvglWrapper::instance()->run(); + } +} + +inline void POPUP_WARNING(const char * message, const char * info = nullptr) +{ + auto popup = createPopupWarning(message); + if (info) { + popup->setInfoText(std::string(info)); + } + while (popup->getParent()) { + WDG_RESET(); + MainWindow::instance()->run(false); + LvglWrapper::instance()->run(); + } +} + #endif // _POPUPS_H_ diff --git a/radio/src/gui/colorlcd/radio_version.cpp b/radio/src/gui/colorlcd/radio_version.cpp index d14a68c17..f799ad072 100644 --- a/radio/src/gui/colorlcd/radio_version.cpp +++ b/radio/src/gui/colorlcd/radio_version.cpp @@ -23,6 +23,8 @@ #include "opentx.h" #include "options.h" #include "libopenui.h" +#include "fw_version.h" + #if defined(CROSSFIRE) #include "mixer_scheduler.h" #endif diff --git a/radio/src/gui/colorlcd/view_text.cpp b/radio/src/gui/colorlcd/view_text.cpp index fcc4f0480..a4a968106 100644 --- a/radio/src/gui/colorlcd/view_text.cpp +++ b/radio/src/gui/colorlcd/view_text.cpp @@ -55,13 +55,6 @@ void ViewTextWindow::extractNameSansExt() openFromEnd = !strcmp(ext, LOGS_EXT); } -void ViewTextWindow::buildBody(Window *window) -{ - GridLayout grid(window); - grid.spacer(); - int i; - FIL file; - // assume average characte is 10 pixels wide, round the string length to tens. // Font is not fixed width, so this is for the worst case... maxLineLength = static_cast(window->width() / 10 / 10) * 10 - 2; diff --git a/radio/src/gui/colorlcd/view_text.h b/radio/src/gui/colorlcd/view_text.h index b126c0843..640d5324a 100644 --- a/radio/src/gui/colorlcd/view_text.h +++ b/radio/src/gui/colorlcd/view_text.h @@ -69,6 +69,7 @@ class ViewTextWindow : public Page Page::paint(dc); drawVerticalScrollbar(dc); } + void checkEvents() override; #if defined(DEBUG_WINDOWS) diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index d3ae98ce3..34e8ab563 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -33,9 +33,11 @@ #define HIDDEN_ROW ((uint8_t)-2) #if defined(ROTARY_ENCODER_NAVIGATION) + #define CASE_ROTARY_ENCODER(x) x, #define CASE_EVT_ROTARY_LEFT case EVT_ROTARY_LEFT: #define CASE_EVT_ROTARY_RIGHT case EVT_ROTARY_RIGHT: #else + #define CASE_ROTARY_ENCODER(x) #define CASE_EVT_ROTARY_LEFT #define CASE_EVT_ROTARY_RIGHT #endif diff --git a/radio/src/hal/adc_driver.cpp b/radio/src/hal/adc_driver.cpp index 4ffcfe784..bcb4af69a 100644 --- a/radio/src/hal/adc_driver.cpp +++ b/radio/src/hal/adc_driver.cpp @@ -201,4 +201,150 @@ uint16_t getAnalogValue(uint8_t index) else return adcValues[index]; } + +static uint32_t s_anaFilt[NUM_ANALOGS]; + +#define JITTER_ALPHA (1< 32) + #error "JITTER_FILTER_STRENGTH and ANALOG_SCALE are too big, their summ should be <= 5 !!!" +#endif + +uint16_t anaIn(uint8_t chan) +{ + return ANA_FILT(chan); +} + +#if defined(JITTER_MEASURE) +JitterMeter rawJitter[NUM_ANALOGS]; +JitterMeter avgJitter[NUM_ANALOGS]; +tmr10ms_t jitterResetTime = 0; +#endif + +uint16_t getBatteryVoltage() +{ + // using filtered ADC value on purpose + int32_t instant_vbat = anaIn(TX_VOLTAGE); + return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / + BATTERY_DIVIDER); +} + +extern uint16_t get_flysky_hall_adc_value(uint8_t ch); + +void getADC() +{ +#if defined(JITTER_MEASURE) + if (JITTER_MEASURE_ACTIVE() && jitterResetTime < get_tmr10ms()) { + // reset jitter measurement every second + for (uint32_t x=0; x> (1 - ANALOG_SCALE); + } else { + v = getAnalogValue(x) >> (1 - ANALOG_SCALE); + } + } + else +#endif + { + v = getAnalogValue(x) >> (1 - ANALOG_SCALE); + } + + // Jitter filter: + // * pass trough any big change directly + // * for small change use Modified moving average (MMA) filter + // + // Explanation: + // + // Normal MMA filter has this formula: + // = ((ALPHA-1)* + )/ALPHA + // + // If calculation is done this way with integer arithmetics, then any small change in + // input signal is lost. One way to combat that, is to rearrange the formula somewhat, + // to store a more precise (larger) number between iterations. The basic idea is to + // store undivided value between iterations. Therefore an new variable is + // used. The new formula becomes: + // = - /ALPHA + + // = /ALPHA (use only when out is needed) + // + // The above formula with a maximum allowed ALPHA value (we are limited by + // the 16 bit s_anaFilt[]) was tested on the radio. The resulting signal still had + // some jitter (a value of 1 was observed). The jitter might be bigger on other + // radios. + // + // So another idea is to use larger input values for filtering. So instead of using + // input in a range from 0 to 2047, we use twice larger number (temp[x] is divided less) + // + // This also means that ALPHA must be lowered (remember 16 bit limit), but test results + // have proved that this kind of filtering gives better results. So the recommended values + // for filter are: + // JITTER_FILTER_STRENGTH 4 + // ANALOG_SCALE 1 + // + // Variables mapping: + // * = v + // * = s_anaFilt[x] + uint32_t previous = s_anaFilt[x] / JITTER_ALPHA; + uint32_t diff = (v > previous) ? (v - previous) : (previous - v); + + // Combine ADC jitter filter setting form radio and model. + // Model can override (on or off) or use setting from radio setup. + // Model setting is active when 1, radio setting is active when 0 + uint8_t useJitterFilter = 0; + if (g_model.jitterFilter == OVERRIDE_GLOBAL) { + // Use radio setting - which is inverted + useJitterFilter = !g_eeGeneral.noJitterFilter; + } else { + // Enable if value is "On", disable if "Off" + useJitterFilter = (g_model.jitterFilter == OVERRIDE_ON)?1:0; + } + + if (useJitterFilter && diff < (10*ANALOG_MULTIPLIER)) { + // apply jitter filter + s_anaFilt[x] = (s_anaFilt[x] - previous) + v; + } + else { + // use unfiltered value + s_anaFilt[x] = v * JITTER_ALPHA; + } + +#if defined(JITTER_MEASURE) + if (JITTER_MEASURE_ACTIVE()) { + avgJitter[x].measure(ANA_FILT(x)); + } +#endif + + #define ANAFILT_MAX (2 * RESX * JITTER_ALPHA * ANALOG_MULTIPLIER - 1) + StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[x]; + if (IS_POT_MULTIPOS(x) && IS_MULTIPOS_CALIBRATED(calib)) { + // TODO: consider adding another low pass filter to eliminate multipos switching glitches + uint8_t vShifted = ANA_FILT(x) >> 4; + s_anaFilt[x] = ANAFILT_MAX; + for (uint32_t i=0; icount; i++) { + if (vShifted < calib->steps[i]) { + s_anaFilt[x] = (i * ANAFILT_MAX) / calib->count; + break; + } + } + } + } +} + #endif // #if !defined(SIMU) diff --git a/radio/src/hal/adc_driver.h b/radio/src/hal/adc_driver.h index 8c67af924..c47b31778 100644 --- a/radio/src/hal/adc_driver.h +++ b/radio/src/hal/adc_driver.h @@ -56,5 +56,24 @@ bool adcInit(const etx_hal_adc_driver_t* driver); // void adcDeInit(); bool adcRead(); +uint16_t getBatteryVoltage(); uint16_t getRTCBatteryVoltage(); uint16_t getAnalogValue(uint8_t index); + +#define JITTER_FILTER_STRENGTH 4 // tune this value, bigger value - more filtering (range: 1-5) (see explanation below) +#define ANALOG_SCALE 1 // tune this value, bigger value - more filtering (range: 0-1) (see explanation below) + +#if defined(JITTER_MEASURE) +extern JitterMeter rawJitter[NUM_ANALOGS]; +extern JitterMeter avgJitter[NUM_ANALOGS]; +#if defined(PCBHORUS) || defined(PCBTARANIS) + #define JITTER_MEASURE_ACTIVE() (menuHandlers[menuLevel] == menuRadioDiagAnalogs) +#elif defined(CLI) + #define JITTER_MEASURE_ACTIVE() (1) +#else + #define JITTER_MEASURE_ACTIVE() (0) +#endif +#endif + +void getADC(); +uint16_t anaIn(uint8_t chan); diff --git a/radio/src/keys.cpp b/radio/src/keys.cpp index 06a0c682f..7f7d8c447 100644 --- a/radio/src/keys.cpp +++ b/radio/src/keys.cpp @@ -19,7 +19,9 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "keys.h" +#include "timers.h" +#include "opentx_helpers.h" #define KEY_LONG_DELAY 32 // long key press minimum duration (x10ms), must be less than KEY_REPEAT_DELAY #define KEY_REPEAT_DELAY 40 // press longer than this enables repeat (but does not fire it yet) diff --git a/radio/src/keys.h b/radio/src/keys.h index ddd12c3ec..519f2854c 100644 --- a/radio/src/keys.h +++ b/radio/src/keys.h @@ -205,4 +205,12 @@ bool keyDown(); extern uint8_t rotencSpeed; #endif +struct InactivityData +{ + uint16_t counter; + uint8_t sum; +}; + +extern InactivityData inactivity; + #endif // _KEYS_H_ diff --git a/radio/src/lv_conf.h b/radio/src/lv_conf.h index c8b586e91..b77e97c5e 100644 --- a/radio/src/lv_conf.h +++ b/radio/src/lv_conf.h @@ -105,7 +105,13 @@ /*Enable complex draw engine. *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ -#define LV_DRAW_COMPLEX 1 + +#if defined(BOOT) + #define LV_DRAW_COMPLEX 0 +#else + #define LV_DRAW_COMPLEX 1 +#endif + #if LV_DRAW_COMPLEX != 0 /*Allow buffering some shadow calculation. @@ -369,7 +375,9 @@ /*Optionally declare custom fonts here. *You can use these fonts as default font too and they will be available globally. *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ -#define LV_FONT_CUSTOM_DECLARE \ + +#if !defined(BOOT) + #define LV_FONT_CUSTOM_DECLARE \ LV_FONT_DECLARE(lv_font_roboto_9) \ LV_FONT_DECLARE(lv_font_roboto_14) \ LV_FONT_DECLARE(lv_font_roboto_13) \ @@ -383,8 +391,13 @@ LV_FONT_DECLARE(lv_font_roboto_bold_32) \ LV_FONT_DECLARE(lv_font_roboto_bold_64) -/*Always set a default font*/ -#define LV_FONT_DEFAULT &lv_font_roboto_16 + /*Always set a default font*/ + #define LV_FONT_DEFAULT &lv_font_roboto_16 +#else + /* Bootloader font */ + #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_roboto_bl_16) + #define LV_FONT_DEFAULT &lv_font_roboto_bl_16 +#endif /*Enable handling large font and/or fonts with a lot of characters. *The limit depends on the font size, font face and bpp. @@ -453,6 +466,7 @@ /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ +#if !defined(BOOT) #define LV_USE_ARC 1 #define LV_USE_ANIMIMG 1 @@ -584,6 +598,45 @@ /*A layout similar to Grid in CSS.*/ #define LV_USE_GRID 1 +#else +#define LV_USE_ARC 0 +#define LV_USE_ANIMIMG 0 +#define LV_USE_BAR 0 +#define LV_USE_BTN 0 +#define LV_USE_BTNMATRIX 0 +#define LV_USE_CANVAS 0 +#define LV_USE_CHECKBOX 0 +#define LV_USE_DROPDOWN 0 /*Requires: lv_label*/ +#define LV_USE_IMG 0 /*Requires: lv_label*/ +#define LV_USE_LABEL 0 +#define LV_USE_LINE 0 +#define LV_USE_ROLLER 0 /*Requires: lv_label*/ +#define LV_USE_SLIDER 0 /*Requires: lv_bar*/ +#define LV_USE_SWITCH 0 +#define LV_USE_TEXTAREA 0 /*Requires: lv_label*/ +#define LV_USE_TABLE 0 +#define LV_USE_CALENDAR 0 +#define LV_USE_CHART 0 +#define LV_USE_COLORWHEEL 0 +#define LV_USE_IMGBTN 0 +#define LV_USE_KEYBOARD 0 +#define LV_USE_LED 0 +#define LV_USE_LIST 0 +#define LV_USE_MENU 0 +#define LV_USE_METER 0 +#define LV_USE_MSGBOX 0 +#define LV_USE_SPINBOX 0 +#define LV_USE_SPINNER 0 +#define LV_USE_TABVIEW 0 +#define LV_USE_TILEVIEW 0 +#define LV_USE_WIN 0 +#define LV_USE_SPAN 0 +#define LV_USE_THEME_DEFAULT 0 +#define LV_USE_THEME_BASIC 0 +#define LV_USE_THEME_MONO 0 +#define LV_USE_FLEX 0 +#define LV_USE_GRID 0 +#endif /*--------------------- * 3rd party libraries *--------------------*/ @@ -622,10 +675,14 @@ #endif /*PNG decoder library*/ +#if !defined(BOOT) #define LV_USE_PNG 1 +#endif /*BMP decoder library*/ +#if !defined(BOOT) #define LV_USE_BMP 1 +#endif /* JPG + split JPG decoder library. * Split JPG is a custom format optimized for embedded systems. */ diff --git a/radio/src/main.cpp b/radio/src/main.cpp index 901996a5c..e26ff0992 100644 --- a/radio/src/main.cpp +++ b/radio/src/main.cpp @@ -158,7 +158,6 @@ void handleUsbConnection() if (getSelectedUsbMode() == USB_MASS_STORAGE_MODE) { opentxClose(false); - usbPluggedIn(); } #if defined(USB_SERIAL) else if (getSelectedUsbMode() == USB_SERIAL_MODE) { diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index deb994b63..14766f7e4 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -24,6 +24,7 @@ #include "datastructs.h" #include "libopenui/src/bitfield.h" +#include "storage/yaml/yaml_defs.h" #if defined(SDCARD_YAML) #define EEPROM_VER 221 @@ -105,7 +106,7 @@ #define ALTERNATE_VIEW 0x10 -#if defined(COLORLCD) +#if defined(COLORLCD) && !defined(BOOT) #include "layout.h" #include "theme.h" #include "topbar.h" diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index a1e8dd803..cf53df535 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -30,14 +30,11 @@ #include "radio_calibration.h" #include "view_main.h" #include "view_text.h" -#include "lvgl/lvgl.h" #include "gui/colorlcd/LvglWrapper.h" #endif -extern uint16_t get_flysky_hall_adc_value(uint8_t ch); - RadioData g_eeGeneral; ModelData g_model; @@ -92,12 +89,6 @@ const uint8_t modn12x3[] = { 3, 2, 1, 0 }; volatile uint8_t rtc_count = 0; -uint32_t watchdogTimeout = 0; - -void watchdogSuspend(uint32_t timeout) -{ - watchdogTimeout = timeout; -} #if defined(DEBUG_LATENCY) void toggleLatencySwitch() @@ -118,15 +109,37 @@ void toggleLatencySwitch() } #endif +static void readKeysAndTrims() +{ + uint32_t i; + + uint8_t index = 0; + uint32_t keys_input = readKeys(); + for (i = 0; i < TRM_BASE; i++) { + keys[index++].input(keys_input & (1 << i)); + } + + uint32_t trims_input = readTrims(); + for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) { + keys[index++].input(trims_input & i); + } + +#if defined(PWR_BUTTON_PRESS) + if ((keys_input || trims_input || pwrPressed()) && + (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { +#else + if ((keys_input || trims_input) && + (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { +#endif + // on keypress turn the light on + resetBacklightTimeout(); + } +} + void per10ms() { g_tmr10ms++; - if (watchdogTimeout) { - watchdogTimeout -= 1; - WDG_RESET(); // Retrigger hardware watchdog - } - #if defined(GUI) if (lightOffCounter) lightOffCounter--; if (flashCounter) flashCounter--; @@ -200,6 +213,11 @@ void per10ms() cw = new_cw; lastEvent = g_tmr10ms; } + + if (g_eeGeneral.backlightMode & e_backlight_mode_keys) { + resetBacklightTimeout(); + } + inactivity.counter = 0; } } #endif @@ -1061,142 +1079,6 @@ void checkTrims() } } -#if !defined(SIMU) -uint32_t s_anaFilt[NUM_ANALOGS]; -#endif - -#if defined(JITTER_MEASURE) -JitterMeter rawJitter[NUM_ANALOGS]; -JitterMeter avgJitter[NUM_ANALOGS]; -tmr10ms_t jitterResetTime = 0; -#endif - -#define ANA_FILT(chan) (s_anaFilt[chan] / (JITTER_ALPHA * ANALOG_MULTIPLIER)) - -#if !defined(SIMU) -uint16_t anaIn(uint8_t chan) -{ - return ANA_FILT(chan); -} - -void getADC() -{ -#if defined(JITTER_MEASURE) - if (JITTER_MEASURE_ACTIVE() && jitterResetTime < get_tmr10ms()) { - // reset jitter measurement every second - for (uint32_t x=0; x> (1 - ANALOG_SCALE); - } else { - v = getAnalogValue(x) >> (1 - ANALOG_SCALE); - } - } - else -#endif - { - v = getAnalogValue(x) >> (1 - ANALOG_SCALE); - } - - // Jitter filter: - // * pass trough any big change directly - // * for small change use Modified moving average (MMA) filter - // - // Explanation: - // - // Normal MMA filter has this formula: - // = ((ALPHA-1)* + )/ALPHA - // - // If calculation is done this way with integer arithmetics, then any small change in - // input signal is lost. One way to combat that, is to rearrange the formula somewhat, - // to store a more precise (larger) number between iterations. The basic idea is to - // store undivided value between iterations. Therefore an new variable is - // used. The new formula becomes: - // = - /ALPHA + - // = /ALPHA (use only when out is needed) - // - // The above formula with a maximum allowed ALPHA value (we are limited by - // the 16 bit s_anaFilt[]) was tested on the radio. The resulting signal still had - // some jitter (a value of 1 was observed). The jitter might be bigger on other - // radios. - // - // So another idea is to use larger input values for filtering. So instead of using - // input in a range from 0 to 2047, we use twice larger number (temp[x] is divided less) - // - // This also means that ALPHA must be lowered (remember 16 bit limit), but test results - // have proved that this kind of filtering gives better results. So the recommended values - // for filter are: - // JITTER_FILTER_STRENGTH 4 - // ANALOG_SCALE 1 - // - // Variables mapping: - // * = v - // * = s_anaFilt[x] - uint32_t previous = s_anaFilt[x] / JITTER_ALPHA; - uint32_t diff = (v > previous) ? (v - previous) : (previous - v); - - // Combine ADC jitter filter setting form radio and model. - // Model can override (on or off) or use setting from radio setup. - // Model setting is active when 1, radio setting is active when 0 - uint8_t useJitterFilter = 0; - if (g_model.jitterFilter == OVERRIDE_GLOBAL) { - // Use radio setting - which is inverted - useJitterFilter = !g_eeGeneral.noJitterFilter; - } else { - // Enable if value is "On", disable if "Off" - useJitterFilter = (g_model.jitterFilter == OVERRIDE_ON)?1:0; - } - - if (useJitterFilter && diff < (10*ANALOG_MULTIPLIER)) { - // apply jitter filter - s_anaFilt[x] = (s_anaFilt[x] - previous) + v; - } - - else { - // use unfiltered value - s_anaFilt[x] = v * JITTER_ALPHA; - } - -#if defined(JITTER_MEASURE) - if (JITTER_MEASURE_ACTIVE()) { - avgJitter[x].measure(ANA_FILT(x)); - } -#endif - - #define ANAFILT_MAX (2 * RESX * JITTER_ALPHA * ANALOG_MULTIPLIER - 1) - StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[x]; - if (IS_POT_MULTIPOS(x) && IS_MULTIPOS_CALIBRATED(calib)) { - // TODO: consider adding another low pass filter to eliminate multipos switching glitches - uint8_t vShifted = ANA_FILT(x) >> 4; - s_anaFilt[x] = ANAFILT_MAX; - for (uint32_t i=0; icount; i++) { - if (vShifted < calib->steps[i]) { - s_anaFilt[x] = (i * ANAFILT_MAX) / calib->count; - break; - } - } - } - } -} - -#endif // SIMU - uint8_t g_vbat100mV = 0; uint16_t lightOffCounter; uint8_t flashCounter = 0; @@ -1764,7 +1646,6 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim } #if defined(ROTARY_ENCODER_NAVIGATION) - volatile rotenc_t rotencValue = 0; uint8_t rotencSpeed; #endif @@ -1933,7 +1814,7 @@ void opentxInit() } #endif -#if defined(GUI) +#if defined(GUI) && !defined(COLORLCD) lcdSetContrast(); #endif diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 52d8ec9f2..4a1aeabab 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -275,12 +275,6 @@ void memswap(void * a, void * b, uint8_t size); #define IS_SWITCH_MULTIPOS(x) (false) #endif -#if defined(PWR_BUTTON_PRESS) - #define pwrOffPressed() pwrPressed() -#else - #define pwrOffPressed() (!pwrPressed()) -#endif - #define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4) #define SAVE_POT_POSITION(i) g_model.potsWarnPosition[i] = GET_LOWRES_POT_POSITION(i) @@ -372,23 +366,6 @@ inline bool SPLASH_NEEDED() #define SPLASH_TIMEOUT (4 * 100) // 4 seconds #endif -#if defined(ROTARY_ENCODER_NAVIGATION) - #define CASE_ROTARY_ENCODER(x) x, - #define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() true - extern volatile rotenc_t rotencValue; - #define ROTARY_ENCODER_NAVIGATION_VALUE rotencValue - #define ROTENC_LOWSPEED 1 - #define ROTENC_MIDSPEED 5 - #define ROTENC_HIGHSPEED 50 - #define ROTENC_DELAY_MIDSPEED 32 - #define ROTENC_DELAY_HIGHSPEED 16 -#else - #define CASE_ROTARY_ENCODER(x) - #if defined(RADIO_T8) - constexpr uint8_t rotencSpeed = 1; - #endif -#endif - constexpr uint8_t HEART_TIMER_10MS = 0x01; constexpr uint8_t HEART_TIMER_PULSES = 0x02; // when multiple modules this is the first one @@ -403,23 +380,8 @@ constexpr uint8_t HEART_WDT_CHECK = HEART_TIMER_10MS extern uint8_t heartbeat; -#if !defined(BOOT) -void watchdogSuspend(uint32_t timeout); -#define WATCHDOG_SUSPEND(x) watchdogSuspend(x) -#else -#define WATCHDOG_SUSPEND(...) -#endif - #define MAX_ALERT_TIME 60 -struct InactivityData -{ - uint16_t counter; - uint8_t sum; -}; - -extern InactivityData inactivity; - #define LEN_STD_CHARS 40 #if defined(TRANSLATIONS_CZ) @@ -437,7 +399,6 @@ extern uint8_t potsPos[NUM_XPOTS]; #endif bool trimDown(uint8_t idx); -void readKeysAndTrims(); #if defined(KEYS_GPIO_REG_BIND) void bindButtonHandler(event_t event); @@ -562,8 +523,6 @@ int getTrimValue(uint8_t phase, uint8_t idx); bool setTrimValue(uint8_t phase, uint8_t idx, int trim); - #define ROTARY_ENCODER_GRANULARITY (2) - #include "gvars.h" void flightReset(uint8_t check=true); @@ -668,23 +627,6 @@ inline int calcRESXto100(int x) return divRoundClosest(x*100, RESX); } -#if defined(COLORLCD) -extern const char fw_stamp[]; -extern const char vers_stamp[]; -extern const char date_stamp[]; -extern const char time_stamp[]; -extern const char cfgv_stamp[]; -#else -extern const char vers_stamp[]; -#endif - -/** - * Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer - * @param buffer If non-null find the firmware version in the buffer instead - * @return The opentx version string starting with "opentx-" or "no version found" if the version string is not found - */ -const char * getFirmwareVersion(const char * buffer = nullptr); - #define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms) #include "trainer.h" @@ -1078,11 +1020,13 @@ union ReusableBuffer int8_t preset; } curveEdit; +#if !defined(COLORLCD) struct { char filename[TEXT_FILENAME_MAXLEN]; char lines[NUM_BODY_LINES][LCD_COLS + 1]; int linesCount; } viewText; +#endif struct { bool longNames; @@ -1179,8 +1123,6 @@ void varioWakeup(); extern const unsigned char logo_taranis[]; #endif -void usbPluggedIn(); - #include "lua/lua_api.h" #if defined(SDCARD) @@ -1212,31 +1154,6 @@ struct Clipboard { extern Clipboard clipboard; #endif -#if !defined(SIMU) -extern uint32_t s_anaFilt[NUM_ANALOGS]; -#endif - -#define JITTER_FILTER_STRENGTH 4 // tune this value, bigger value - more filtering (range: 1-5) (see explanation below) -#define ANALOG_SCALE 1 // tune this value, bigger value - more filtering (range: 0-1) (see explanation below) - -#define JITTER_ALPHA (1< 32) - #error "JITTER_FILTER_STRENGTH and ANALOG_SCALE are too big, their summ should be <= 5 !!!" -#endif - -#if defined(JITTER_MEASURE) -extern JitterMeter rawJitter[NUM_ANALOGS]; -extern JitterMeter avgJitter[NUM_ANALOGS]; -#if defined(PCBHORUS) || defined(PCBTARANIS) - #define JITTER_MEASURE_ACTIVE() (menuHandlers[menuLevel] == menuRadioDiagAnalogs) -#elif defined(CLI) - #define JITTER_MEASURE_ACTIVE() (1) -#else - #define JITTER_MEASURE_ACTIVE() (0) -#endif -#endif - #if defined(INTERNAL_GPS) #include "gps.h" #endif diff --git a/radio/src/opentx_types.h b/radio/src/opentx_types.h index 52e82584b..94622cf38 100644 --- a/radio/src/opentx_types.h +++ b/radio/src/opentx_types.h @@ -25,7 +25,6 @@ #include "thirdparty/libopenui/src/libopenui_types.h" typedef uint32_t tmr10ms_t; -typedef int32_t rotenc_t; typedef int32_t getvalue_t; typedef uint32_t mixsrc_t; typedef int32_t swsrc_t; diff --git a/radio/src/serial.cpp b/radio/src/serial.cpp index 0d4448796..f15e17cb4 100644 --- a/radio/src/serial.cpp +++ b/radio/src/serial.cpp @@ -19,8 +19,10 @@ * GNU General Public License for more details. */ -#include "opentx.h" #include "serial.h" +#include "board.h" +#include "debug.h" + #include #include #include "aux_serial_driver.h" diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index f323775b5..ac1c65170 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -489,7 +489,12 @@ long OpenTxSim::onTimeout(FXObject*, FXSelector, void*) #endif } +#if !defined(SIMU_BOOTLOADER) per10ms(); +#else + void interrupt10ms(); + interrupt10ms(); +#endif static int timeToRefresh; if (++timeToRefresh >= 5) { timeToRefresh = 0; @@ -518,6 +523,9 @@ void OpenTxSim::setPixel(int x, int y, FXColor color) #endif } +// from lcd driver +void lcdFlushed(); + void OpenTxSim::refreshDisplay() { static bool lightEnabled = (bool)isBacklightEnabled(); @@ -575,6 +583,7 @@ void OpenTxSim::refreshDisplay() bmf->setImage(bmp); simuLcdRefresh = false; + lcdFlushed(); } } @@ -629,6 +638,7 @@ int main(int argc, char ** argv) #if defined(EEPROM) || defined(EEPROM_RLC) startEepromThread(argc >= 2 ? argv[1] : "eeprom.bin"); #endif + startAudioThread(); simuStart(true/*false*/, argc >= 3 ? argv[2] : 0, argc >= 4 ? argv[3] : 0); diff --git a/radio/src/stamp.cpp b/radio/src/stamp.cpp index ca96c1c0f..2bc3fff8b 100644 --- a/radio/src/stamp.cpp +++ b/radio/src/stamp.cpp @@ -19,8 +19,11 @@ * GNU General Public License for more details. */ -#include "opentx.h" -#include "stamp.h" +#include "definitions.h" +#include "board.h" +#include "fw_version.h" + +#include #define STR2(s) #s #define DEFNUMSTR(s) STR2(s) @@ -113,4 +116,9 @@ const char * getFirmwareVersion(const char * buffer) return "no version found"; } +#else +const char * getFirmwareVersion(const char * buffer) +{ + return "edgetx-" FLAVOUR "-" VERSION DISPLAY_VERSION " (" GIT_STR ")"; +} #endif diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 00799bdb7..eede2b34d 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -20,10 +20,11 @@ */ #include "strhelpers.h" - -#include "opentx.h" +#include #if !defined(BOOT) +#include "opentx.h" + const char s_charTab[] = "_-.,"; char hex2zchar(uint8_t hex) { return (hex >= 10 ? hex - 9 : 27 + hex); } @@ -406,20 +407,6 @@ char *getFlightModeString(char *dest, int8_t idx) return dest; } -// char * getSwitchWarningString(char * dest, swsrc_t idx) -// { -// char * s = dest; -// uint8_t state = g_model.switchWarningState >> (3*idx) & 0x07; -// *s++ = 'A' + idx; -// if (state == 0) -// *s = '\0'; -// else { -// *s++ = "x\300-\301"[state]; -// *s = '\0'; -// } -// return dest; -// } - int getRawSwitchIdx(char sw) { if (sw < 'A' || sw > 'Z') @@ -763,6 +750,8 @@ char *strAppendFilename(char *dest, const char *filename, const int size) } #if defined(LIBOPENUI) +#include "bitmapbuffer.h" + std::string formatNumberAsString(int32_t val, LcdFlags flags, uint8_t len, const char *prefix, const char *suffix) { diff --git a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp index bc5c78ef5..0f833ad01 100644 --- a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp +++ b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp @@ -21,11 +21,9 @@ #include "stm32_hal_ll.h" #include "stm32_usart_driver.h" - -#include "opentx.h" -#include "targets/horus/board.h" #include "aux_serial_driver.h" +#include "board.h" #include "fifo.h" #include "dmafifo.h" diff --git a/radio/src/targets/common/arm/stm32/board_common.h b/radio/src/targets/common/arm/stm32/board_common.h index 197d83dfb..ecfd92e24 100644 --- a/radio/src/targets/common/arm/stm32/board_common.h +++ b/radio/src/targets/common/arm/stm32/board_common.h @@ -132,6 +132,13 @@ void delay_ms(uint32_t count); } #endif +#if !defined(BOOT) +void watchdogSuspend(uint32_t timeout); +#define WATCHDOG_SUSPEND(x) watchdogSuspend(x) +#else +#define WATCHDOG_SUSPEND(...) +#endif + #define INIT_KEYS_PINS(GPIO) \ GPIO_InitStructure.GPIO_Pin = KEYS_ ## GPIO ## _PINS; \ GPIO_Init(GPIO, &GPIO_InitStructure) @@ -141,4 +148,26 @@ void delay_ms(uint32_t count); GPIO_Init(GPIO, &GPIO_InitStructure); \ GPIO_SetBits(GPIO, KEYS_ ## GPIO ## _PINS) +#if defined(ROTARY_ENCODER_NAVIGATION) + typedef int32_t rotenc_t; + extern volatile rotenc_t rotencValue; + #define IS_ROTARY_ENCODER_NAVIGATION_ENABLE() true + #define ROTARY_ENCODER_NAVIGATION_VALUE rotencValue + #define ROTENC_LOWSPEED 1 + #define ROTENC_MIDSPEED 5 + #define ROTENC_HIGHSPEED 50 + #define ROTENC_DELAY_MIDSPEED 32 + #define ROTENC_DELAY_HIGHSPEED 16 +#elif defined(RADIO_T8) + constexpr uint8_t rotencSpeed = 1; +#endif + +#define ROTARY_ENCODER_GRANULARITY (2) + +#if defined(PWR_BUTTON_PRESS) + #define pwrOffPressed() pwrPressed() +#else + #define pwrOffPressed() (!pwrPressed()) +#endif + #endif diff --git a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt index b2700d5ad..77745b364 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/bootloader/CMakeLists.txt @@ -114,7 +114,7 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14) ${BOOTLOADER_SRC} ../../../../../gui/colorlcd/fonts.cpp ../../../../../gui/colorlcd/colors.cpp - ../../../../../fonts/lvgl/lv_font_roboto_16.c + ../../../../../fonts/lvgl/lv_font_roboto_bl_16.c ../../../../../thirdparty/libopenui/src/bitmapbuffer.cpp ../../../../../targets/${TARGET_DIR}/sdram_driver.c ../../../../../targets/common/arm/stm32/sdio_sd.c @@ -124,7 +124,7 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14) ) # Add LVGL sources - foreach(LVGL_FILE ${LVGL_SRC_FILES}) + foreach(LVGL_FILE ${LVGL_SRC_FILES_MINIMAL}) set(BOOTLOADER_SRC ${BOOTLOADER_SRC} ../../../../../${LVGL_FILE}) endforeach() @@ -174,15 +174,9 @@ set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC # use smaller nano libc set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs") -add_executable(bootloader EXCLUDE_FROM_ALL - ${BOOTLOADER_SRC} - ) +add_executable(bootloader EXCLUDE_FROM_ALL ${BOOTLOADER_SRC}) add_dependencies(bootloader ${BITMAPS_TARGET} radio_translations) -if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14) - add_dependencies(bootloader truetype_fonts) -endif() - add_custom_command( TARGET bootloader POST_BUILD COMMAND ${CMAKE_OBJCOPY} -O binary bootloader.elf ${CMAKE_BINARY_DIR}/bootloader.bin diff --git a/radio/src/targets/common/arm/stm32/bootloader/bin_files.cpp b/radio/src/targets/common/arm/stm32/bootloader/bin_files.cpp index 240bdf94b..7933331bb 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/bin_files.cpp +++ b/radio/src/targets/common/arm/stm32/bootloader/bin_files.cpp @@ -19,9 +19,11 @@ * GNU General Public License for more details. */ -#include "opentx.h" #include "boot.h" +#include "sdcard.h" #include "bin_files.h" +#include "fw_version.h" +#include "strhelpers.h" // 'private' static DIR dir; diff --git a/radio/src/targets/common/arm/stm32/bootloader/bin_files.h b/radio/src/targets/common/arm/stm32/bootloader/bin_files.h index 481198cd3..9ae2909ad 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/bin_files.h +++ b/radio/src/targets/common/arm/stm32/bootloader/bin_files.h @@ -22,7 +22,8 @@ #ifndef _bin_files_h_ #define _bin_files_h_ -#include "opentx.h" +#include +#include "bitmapbuffer.h" enum MemoryType { MEM_FLASH, diff --git a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp index 3fd63880c..c49c96fb9 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp +++ b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp @@ -19,9 +19,11 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" #include "boot.h" #include "bin_files.h" +#include "dataconstants.h" +#include "lcd.h" #if defined(PCBXLITE) #define BOOTLOADER_KEYS 0x0F @@ -47,16 +49,14 @@ typedef void (*voidFunction)(void); jumpFn(); \ } while(0) +#if !defined(SIMU) // Bootloader marker: // -> used to detect valid bootloader files const uint8_t bootloaderVersion[] __attribute__ ((section(".version"), used)) = {'B', 'O', 'O', 'T', '1', '0'}; - -#if defined(ROTARY_ENCODER_NAVIGATION) -volatile rotenc_t rotencValue = 0; #endif -#if defined(DEBUG) +#if defined(DEBUG) && !defined(SIMU) volatile tmr10ms_t g_tmr10ms; #endif @@ -113,14 +113,17 @@ void init10msTimer() NVIC_EnableIRQ(INTERRUPT_xMS_IRQn); } +#if !defined(SIMU) extern "C" void INTERRUPT_xMS_IRQHandler() { INTERRUPT_xMS_TIMER->SR &= ~TIM_SR_UIF; interrupt10ms(); } +#endif uint32_t isValidBufferStart(const uint8_t * buffer) { +#if !defined(SIMU) #if defined(EEPROM) if (memoryType == MEM_FLASH) return isFirmwareStart(buffer); @@ -129,6 +132,9 @@ uint32_t isValidBufferStart(const uint8_t * buffer) #else return isFirmwareStart(buffer); #endif +#else + return 1; +#endif } FlashCheckRes checkFlashFile(unsigned int index, FlashCheckRes res) @@ -175,7 +181,9 @@ void flashWriteBlock() { uint32_t blockOffset = 0; while (BlockCount) { +#if !defined(SIMU) flashWrite((uint32_t *)firmwareAddress, (uint32_t *)&Block_buffer[blockOffset]); +#endif blockOffset += FLASH_PAGESIZE; firmwareAddress += FLASH_PAGESIZE; if (BlockCount > FLASH_PAGESIZE) { @@ -195,14 +203,9 @@ void writeEepromBlock() } #endif -int main() +#if !defined(SIMU) +void bootloaderInitApp() { - BootloaderState state = ST_START; - uint32_t vpos = 0; - uint8_t index = 0; - FRESULT fr; - uint32_t nameCount = 0; - RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | AUX_SERIAL_RCC_AHB1Periph | AUX2_SERIAL_RCC_AHB1Periph | @@ -281,6 +284,22 @@ int main() // SD card detect pin sdInit(); usbInit(); +} + +int main() +#else // SIMU +void bootloaderInitApp() {} +int bootloaderMain() +#endif +{ + BootloaderState state = ST_START; + uint32_t vpos = 0; + uint8_t index = 0; + FRESULT fr; + uint32_t nameCount = 0; + + // init hardware (may jump to app) + bootloaderInitApp(); // init screen bootloaderInitScreen(); @@ -305,15 +324,18 @@ int main() unlocked = 1; unlockFlash(); } +#if !defined(SIMU) usbStart(); - usbPluggedIn(); +#endif } } if (state == ST_USB) { if (usbPlugged() == 0) { vpos = 0; +#if !defined(SIMU) usbStop(); +#endif if (unlocked) { lockFlash(); unlocked = 0; @@ -528,12 +550,16 @@ int main() lcdRefresh(); lcdRefreshWait(); +#if !defined(SIMU) #if defined(RTC_BACKUP_RAM) rtcInit(); RTC->BKP0R = SOFTRESET_REQUEST; #endif NVIC_SystemReset(); +#else + exit(1); +#endif } } diff --git a/radio/src/targets/common/arm/stm32/bootloader/boot.h b/radio/src/targets/common/arm/stm32/bootloader/boot.h index d07871942..bf35702da 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/boot.h +++ b/radio/src/targets/common/arm/stm32/bootloader/boot.h @@ -22,6 +22,7 @@ #ifndef _boot_h_ #define _boot_h_ +#include #include "stamp.h" #if LCD_W < 212 @@ -86,7 +87,7 @@ void bootloaderInitScreen(); // Depending on the state, up to two optional parameters are passed. // See boot.cpp/main for more details -void bootloaderDrawScreen(BootloaderState st, int opt, const char* str = NULL); +void bootloaderDrawScreen(BootloaderState st, int opt, const char* str = nullptr); // Once for each file in a filename list on screen void bootloaderDrawFilename(const char* str, uint8_t line, bool selected); diff --git a/radio/src/targets/common/arm/stm32/flash_driver.cpp b/radio/src/targets/common/arm/stm32/flash_driver.cpp index b834d89f9..b3b697779 100644 --- a/radio/src/targets/common/arm/stm32/flash_driver.cpp +++ b/radio/src/targets/common/arm/stm32/flash_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void waitFlashIdle() { diff --git a/radio/src/targets/common/arm/stm32/pwr_driver.cpp b/radio/src/targets/common/arm/stm32/pwr_driver.cpp index 30d32e90b..ab73735a3 100644 --- a/radio/src/targets/common/arm/stm32/pwr_driver.cpp +++ b/radio/src/targets/common/arm/stm32/pwr_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void pwrInit() { diff --git a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp index f0359561a..06af16fe7 100644 --- a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp +++ b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp @@ -19,10 +19,10 @@ * GNU General Public License for more details. */ -#include "opentx.h" -#include "heartbeat_driver.h" +#include "board.h" -uint8_t rotencPosition; +static uint8_t rotencPosition; +volatile rotenc_t rotencValue; void rotaryEncoderInit() { @@ -123,12 +123,6 @@ void rotaryEncoderCheck() rotencValue += INC_ROT; } rotencPosition = newPosition; -#endif -#if !defined(BOOT) - if (g_eeGeneral.backlightMode & e_backlight_mode_keys) { - resetBacklightTimeout(); - } - inactivity.counter = 0; #endif } } diff --git a/radio/src/targets/common/arm/stm32/rtc_driver.cpp b/radio/src/targets/common/arm/stm32/rtc_driver.cpp index ab3388d76..26281bc60 100644 --- a/radio/src/targets/common/arm/stm32/rtc_driver.cpp +++ b/radio/src/targets/common/arm/stm32/rtc_driver.cpp @@ -19,7 +19,8 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" +#include "rtc.h" void rtcSetTime(const struct gtm * t) { diff --git a/radio/src/targets/common/arm/stm32/timers_driver.cpp b/radio/src/targets/common/arm/stm32/timers_driver.cpp index 1fe4644c3..3384458e6 100644 --- a/radio/src/targets/common/arm/stm32/timers_driver.cpp +++ b/radio/src/targets/common/arm/stm32/timers_driver.cpp @@ -52,7 +52,14 @@ void stop1msTimer() NVIC_DisableIRQ(INTERRUPT_xMS_IRQn); } -static void interrupt1ms() +static uint32_t watchdogTimeout = 0; + +void watchdogSuspend(uint32_t timeout) +{ + watchdogTimeout = timeout; +} + +void interrupt1ms() { static uint8_t pre_scale; // Used to get 10 Hz counter @@ -78,6 +85,12 @@ static void interrupt1ms() // 10ms loop if (pre_scale == 10) { pre_scale = 0; + + if (watchdogTimeout) { + watchdogTimeout -= 1; + WDG_RESET(); // Retrigger hardware watchdog + } + DEBUG_TIMER_START(debugTimerPer10ms); DEBUG_TIMER_SAMPLE(debugTimerPer10msPeriod); per10ms(); diff --git a/radio/src/targets/common/arm/stm32/usb_driver.cpp b/radio/src/targets/common/arm/stm32/usb_driver.cpp index 57a1c9028..ea948fee3 100644 --- a/radio/src/targets/common/arm/stm32/usb_driver.cpp +++ b/radio/src/targets/common/arm/stm32/usb_driver.cpp @@ -19,24 +19,18 @@ * GNU General Public License for more details. */ -#include "opentx.h" -#include "debug.h" - #include "usb_driver.h" extern "C" { #include "usb_conf.h" #include "usb_dcd_int.h" #include "usb_bsp.h" - -#include "usbd_cdc_core.h" -#include "usbd_msc_core.h" -#include "usbd_hid_core.h" -#include "usbd_usr.h" -#include "usbd_desc.h" -#include "usbd_conf.h" } +#include "board.h" +#include "debug.h" +#include "debounce.h" + static bool usbDriverStarted = false; #if defined(BOOT) static usbMode selectedUsbMode = USB_MASS_STORAGE_MODE; @@ -75,6 +69,8 @@ void usbInit() usbDriverStarted = false; } +extern void usbInitLUNs(); + void usbStart() { switch (getSelectedUsbMode()) { @@ -93,6 +89,7 @@ void usbStart() default: case USB_MASS_STORAGE_MODE: // initialize USB as MSC device + usbInitLUNs(); USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb); break; } @@ -111,6 +108,8 @@ bool usbStarted() } #if !defined(BOOT) +#include "globals.h" + /* Prepare and send new USB data packet diff --git a/radio/src/targets/common/arm/stm32/usbd_storage_msd.cpp b/radio/src/targets/common/arm/stm32/usbd_storage_msd.cpp index 5bc65ea97..71fe73e30 100644 --- a/radio/src/targets/common/arm/stm32/usbd_storage_msd.cpp +++ b/radio/src/targets/common/arm/stm32/usbd_storage_msd.cpp @@ -20,9 +20,13 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "opentx.h" + #include "FatFs/diskio.h" -#include "stamp.h" +#include "fw_version.h" +#include "board.h" +#include "debug.h" + +#include #if defined(__cplusplus) && !defined(SIMU) extern "C" { @@ -168,7 +172,7 @@ int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_si uint8_t lunReady[STORAGE_LUN_NBR]; -void usbPluggedIn() +void usbInitLUNs() { lunReady[STORAGE_SDCARD_LUN] = 1; lunReady[STORAGE_EEPROM_LUN] = 1; diff --git a/radio/src/targets/common/arm/stm32/usbd_usr.cpp b/radio/src/targets/common/arm/stm32/usbd_usr.cpp index 8fe561fe5..3bb39c9f9 100644 --- a/radio/src/targets/common/arm/stm32/usbd_usr.cpp +++ b/radio/src/targets/common/arm/stm32/usbd_usr.cpp @@ -20,7 +20,6 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "opentx.h" extern "C" { #include "usbd_usr.h" diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index 858fc5e9c..f65d64ca2 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -179,7 +179,6 @@ add_definitions(-DPCBREV_${PCBREV}) set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET} - truetype_fonts ) set(FIRMWARE_DEPENDENCIES datacopy) diff --git a/radio/src/targets/horus/backlight_driver.cpp b/radio/src/targets/horus/backlight_driver.cpp index f98fa8d77..8a759c139 100644 --- a/radio/src/targets/horus/backlight_driver.cpp +++ b/radio/src/targets/horus/backlight_driver.cpp @@ -19,7 +19,8 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "board.h" void backlightInit() { diff --git a/radio/src/targets/horus/board.cpp b/radio/src/targets/horus/board.cpp index 41e4aab0f..364f6990c 100644 --- a/radio/src/targets/horus/board.cpp +++ b/radio/src/targets/horus/board.cpp @@ -20,13 +20,17 @@ */ #include "stm32_hal_ll.h" -#include "opentx.h" - #include "hal/adc_driver.h" #include "hal/serial_driver.h" #include "hal/serial_port.h" +#include "board.h" #include "timers_driver.h" +#include "dataconstants.h" +#include "opentx_types.h" +#include "globals.h" +#include "sdcard.h" +#include "debug.h" #if defined(AUX_SERIAL) || defined(AUX2_SERIAL) #include "aux_serial_driver.h" @@ -317,18 +321,6 @@ void boardOff() } } -#if defined (RADIO_TX16S) - #define BATTERY_DIVIDER 1495 -#else - #define BATTERY_DIVIDER 1629 -#endif - -uint16_t getBatteryVoltage() -{ - int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose - return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / BATTERY_DIVIDER); -} - bool isBacklightEnabled() { if(globalData.unexpectedShutdown) diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 14f4bfe0e..2aca7b805 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -24,6 +24,10 @@ #include "definitions.h" #include "opentx_constants.h" + +// Defines used in board_common.h +#define ROTARY_ENCODER_NAVIGATION + #include "board_common.h" #include "hal.h" #include "hal/serial_port.h" @@ -310,7 +314,6 @@ uint32_t readTrims(); #define TRIMS_PRESSED() (readTrims()) // Rotary encoder driver -#define ROTARY_ENCODER_NAVIGATION void rotaryEncoderInit(); void rotaryEncoderCheck(); @@ -530,17 +533,12 @@ void ledBlue(); #define LCD_PHYS_W LCD_W #define LCD_DEPTH 16 void lcdInit(); -void lcdRefresh(); void lcdCopy(void * dest, void * src); void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color); void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h); void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h); void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format); -void lcdStoreBackupBuffer(); -int lcdRestoreBackupBuffer(); -void lcdSetContrast(); #define lcdOff() backlightEnable(0) /* just disable the backlight */ -#define lcdSetRefVolt(...) #define lcdRefreshWait(...) // Backlight driver @@ -677,4 +675,10 @@ void bluetoothWriteWakeup(); uint8_t bluetoothIsWriting(); void bluetoothDisable(); +#if defined (RADIO_TX16S) + #define BATTERY_DIVIDER 1495 +#else + #define BATTERY_DIVIDER 1629 +#endif + #endif // _BOARD_H_ diff --git a/radio/src/targets/horus/bootloader/boot_menu.cpp b/radio/src/targets/horus/bootloader/boot_menu.cpp index b346ec024..003f4bbbf 100644 --- a/radio/src/targets/horus/bootloader/boot_menu.cpp +++ b/radio/src/targets/horus/bootloader/boot_menu.cpp @@ -19,9 +19,14 @@ * GNU General Public License for more details. */ -#include "opentx.h" -#include "../../common/arm/stm32/bootloader/boot.h" -#include "../../common/arm/stm32/bootloader/bin_files.h" +#include "board.h" +#include "fw_version.h" +#include "lcd.h" + +#include "targets/common/arm/stm32/bootloader/boot.h" +#include "targets/common/arm/stm32/bootloader/bin_files.h" + +#include const uint8_t __bmp_plug_usb_rle[] { #include "bmp_plug_usb.lbm" @@ -38,26 +43,12 @@ const uint8_t __bmp_background_rle[] { }; RLEBitmap BMP_BACKGROUND(BMP_ARGB4444, __bmp_background_rle); -const uint8_t LBM_FLASH[] = { -#include "icon_flash.lbm" -}; - -const uint8_t LBM_EXIT[] = { -#include "icon_exit.lbm" -}; - -const uint8_t LBM_SD[] = { -#include "icon_sd.lbm" -}; - +//TODO: replace with LV_SYMBOL_FILE const uint8_t LBM_FILE[] = { #include "icon_file.lbm" }; -const uint8_t LBM_ERROR[] = { -#include "icon_error.lbm" -}; - +//TODO: replace with LV_SYMBOL_OK const uint8_t LBM_OK[] = { #include "icon_ok.lbm" }; @@ -68,11 +59,12 @@ const uint8_t LBM_OK[] = { #define BL_FOREGROUND COLOR2FLAGS(WHITE) #define BL_SELECTED COLOR2FLAGS(RGB(11, 65, 244)) // deep blue +extern BitmapBuffer * lcd; void bootloaderInitScreen() { backlightEnable(BACKLIGHT_LEVEL_MAX); - // TODO: init LVGL + lcdInitDisplayDriver(); } static void bootloaderDrawTitle(unsigned int x, const char* text) @@ -113,18 +105,21 @@ static void bootloaderDrawBackground() void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) { + lcdInitDirectDrawing(); bootloaderDrawBackground(); if (st == ST_START) { - bootloaderDrawTitle(88, BOOTLOADER_TITLE); + bootloaderDrawTitle(88, BOOTLOADER_TITLE); - lcd->drawBitmapPattern(90, 72, LBM_FLASH, BL_FOREGROUND); - lcd->drawText(124, 75, "Write Firmware", BL_FOREGROUND); + lcd->drawText(102, 75, LV_SYMBOL_CHARGE, BL_FOREGROUND); + coord_t pos = lcd->drawText(124, 75, "Write Firmware", BL_FOREGROUND); + pos += 8; - lcd->drawBitmapPattern(90, 107, LBM_EXIT, BL_FOREGROUND); + lcd->drawText(100, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); lcd->drawText(124, 110, "Exit", BL_FOREGROUND); - lcd->drawSolidRect(119, (opt == 0) ? 72 : 107, 270, 26, 2, BL_SELECTED); + pos -= 92; + lcd->drawSolidRect(92, (opt == 0) ? 72 : 107, pos, 26, 2, BL_SELECTED); lcd->drawBitmap(60, 166, &BMP_PLUG_USB); lcd->drawText(195, 175, "Or plug in a USB cable", BL_FOREGROUND); @@ -141,62 +136,55 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) else if (st == ST_FILE_LIST || st == ST_DIR_CHECK || st == ST_FLASH_CHECK || st == ST_FLASHING || st == ST_FLASH_DONE) { - bootloaderDrawTitle(126, "SD>FIRMWARE"); - lcd->drawBitmapPattern(87, 16, LBM_SD, BL_FOREGROUND); + bootloaderDrawTitle(88, LV_SYMBOL_SD_CARD " /FIRMWARE"); if (st == ST_FLASHING || st == ST_FLASH_DONE) { + LcdFlags color = BL_RED; - LcdFlags color = BL_RED; + if (st == ST_FLASH_DONE) { + color = BL_GREEN; + opt = 100; // Completed > 100% + } - if (st == ST_FLASH_DONE) { - color = BL_GREEN; - opt = 100; // Completed > 100% - } + lcd->drawRect(70, 120, 340, 31, 2, SOLID, BL_SELECTED); + lcd->drawSolidFilledRect(74, 124, (332 * opt) / 100, 23, color); + } else if (st == ST_DIR_CHECK) { + if (opt == FR_NO_PATH) { + lcd->drawText(90, 168, LV_SYMBOL_CLOSE " Directory is missing", + BL_FOREGROUND); + } else { + lcd->drawText(90, 168, LV_SYMBOL_CLOSE " Directory is empty", + BL_FOREGROUND); + } + } else if (st == ST_FLASH_CHECK) { + bootloaderDrawFilename(str, 0, true); - lcd->drawRect(70, 120, 340, 31, 2, SOLID, BL_SELECTED); - lcd->drawSolidFilledRect(74, 124, (332 * opt) / 100, 23, color); + if (opt == FC_ERROR) { + lcd->drawText(94, 168, LV_SYMBOL_CLOSE " " STR_INVALID_FIRMWARE, + BL_FOREGROUND); + } else if (opt == FC_OK) { + VersionTag tag; + memset(&tag, 0, sizeof(tag)); + extractFirmwareVersion(&tag); + + lcd->drawText(168, 138, "Fork:", RIGHT | BL_FOREGROUND); + lcd->drawSizedText(174, 138, tag.fork, 6, BL_FOREGROUND); + + lcd->drawText(168, 158, "Version:", RIGHT | BL_FOREGROUND); + lcd->drawText(174, 158, tag.version, BL_FOREGROUND); + + lcd->drawText(168, 178, "Radio:", RIGHT | BL_FOREGROUND); + lcd->drawText(174, 178, tag.flavour, BL_FOREGROUND); + + lcd->drawBitmapPattern(356, 158, LBM_OK, BL_GREEN); + } } - else if (st == ST_DIR_CHECK) { - if (opt == FR_NO_PATH) { - lcd->drawText(90, 168, "Directory is missing", BL_FOREGROUND); - } - else { - lcd->drawText(90, 168, "Directory is empty", BL_FOREGROUND); - } - - lcd->drawBitmapPattern(356, 158, LBM_ERROR, BL_RED); - } - else if (st == ST_FLASH_CHECK) { - bootloaderDrawFilename(str, 0, true); - - if (opt == FC_ERROR) { - lcd->drawText(94, 168, STR_INVALID_FIRMWARE, BL_FOREGROUND); - lcd->drawBitmapPattern(356, 158, LBM_ERROR, BL_RED); - } - else if (opt == FC_OK) { - VersionTag tag; - memset(&tag, 0, sizeof(tag)); - extractFirmwareVersion(&tag); - - lcd->drawText(168, 138, "Fork:", RIGHT | BL_FOREGROUND); - lcd->drawSizedText(174, 138, tag.fork, 6, BL_FOREGROUND); - - lcd->drawText(168, 158, "Version:", RIGHT | BL_FOREGROUND); - lcd->drawText(174, 158, tag.version, BL_FOREGROUND); - - lcd->drawText(168, 178, "Radio:", RIGHT | BL_FOREGROUND); - lcd->drawText(174, 178, tag.flavour, BL_FOREGROUND); - - lcd->drawBitmapPattern(356, 158, LBM_OK, BL_GREEN); - } - } - bootloaderDrawFooter(); if ( st != ST_DIR_CHECK && (st != ST_FLASH_CHECK || opt == FC_OK)) { - lcd->drawBitmapPattern(28, 242, LBM_FLASH, BL_FOREGROUND); + lcd->drawText(28, 242, LV_SYMBOL_CHARGE, BL_FOREGROUND); if (st == ST_FILE_LIST) { lcd->drawText(56, 244, "[ENT] to select file", BL_FOREGROUND); @@ -213,14 +201,11 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) } if (st != ST_FLASHING) { - lcd->drawBitmapPattern(305, 242, LBM_EXIT, BL_FOREGROUND); + //lcd->drawBitmapPattern(305, 242, LBM_EXIT, BL_FOREGROUND); + lcd->drawText(305, 244, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); lcd->drawText(335, 244, "[RTN] to exit", BL_FOREGROUND); } } - - // wait for next frame - // while ((LTDC->CDSR & LTDC_CDSR_VSYNCS) == 0); - // while ((LTDC->CDSR & LTDC_CDSR_VSYNCS) != 0); } void bootloaderDrawFilename(const char* str, uint8_t line, bool selected) diff --git a/radio/src/targets/horus/diskio.cpp b/radio/src/targets/horus/diskio.cpp index bee2ee643..09727cfcd 100644 --- a/radio/src/targets/horus/diskio.cpp +++ b/radio/src/targets/horus/diskio.cpp @@ -26,10 +26,11 @@ /*-----------------------------------------------------------------------*/ #include "diskio.h" -#include -#include "opentx.h" +#include "debug.h" #include "targets/common/arm/stm32/sdio_sd.h" +#include + /*-----------------------------------------------------------------------*/ /* Lock / unlock functions */ /*-----------------------------------------------------------------------*/ @@ -328,6 +329,11 @@ void sdInit(void) } } #else + +#include "audio.h" +#include "sdcard.h" +#include "disk_cache.h" + void sdInit() { TRACE("sdInit"); diff --git a/radio/src/targets/horus/haptic_driver.cpp b/radio/src/targets/horus/haptic_driver.cpp index 18cebf87f..d9c6180e0 100644 --- a/radio/src/targets/horus/haptic_driver.cpp +++ b/radio/src/targets/horus/haptic_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void hapticOff(void) { diff --git a/radio/src/targets/horus/keys_driver.cpp b/radio/src/targets/horus/keys_driver.cpp index 33319c72c..e93efdf46 100755 --- a/radio/src/targets/horus/keys_driver.cpp +++ b/radio/src/targets/horus/keys_driver.cpp @@ -19,7 +19,9 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "board.h" +#include "keys.h" uint32_t readKeys() { @@ -90,28 +92,6 @@ bool keyDown() return readKeys() || readTrims(); } -/* TODO common to ARM */ -void readKeysAndTrims() -{ - uint32_t i; - - uint8_t index = 0; - uint32_t keys_input = readKeys(); - for (i = 0; i < TRM_BASE; i++) { - keys[index++].input(keys_input & (1 << i)); - } - - uint32_t trims_input = readTrims(); - for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) { - keys[index++].input(trims_input & i); - } - - if ((keys_input || trims_input) && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { - // on keypress turn the light on - resetBacklightTimeout(); - } -} - #define ADD_2POS_CASE(x) \ case SW_S ## x ## 0: \ xxx = SWITCHES_GPIO_REG_ ## x & SWITCHES_GPIO_PIN_ ## x ; \ diff --git a/radio/src/targets/horus/lcd_driver.cpp b/radio/src/targets/horus/lcd_driver.cpp index decf33364..a0ef79ef1 100644 --- a/radio/src/targets/horus/lcd_driver.cpp +++ b/radio/src/targets/horus/lcd_driver.cpp @@ -19,7 +19,9 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "libopenui_config.h" +#include "lcd.h" #if defined(RADIO_T18) #define HBP 43 @@ -279,7 +281,7 @@ void LCD_LayerInit() Active high width = LCD_W number of bytes per pixel = 2 (pixel_format : RGB565) */ - LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCD__PHYS_W * 2) + 3); + LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCD_PHYS_W * 2) + 3); /* the pitch is the increment from the start of one line of pixels to the start of the next line in bytes, then : Pitch = Active high width x number of bytes per pixel */ @@ -657,8 +659,9 @@ static void lcdSwitchLayers() while(_frameBufferAddressReloaded == 0); } -void newLcdRefresh(uint16_t * buffer) +void newLcdRefresh(uint16_t * buffer, const rect_t& refr_area) { + (void)refr_area; #if 0 lcdSwitchLayers(); #else @@ -669,7 +672,3 @@ void newLcdRefresh(uint16_t * buffer) #endif } -void lcdRefresh() -{ - //lcdSwitchLayers(); -} diff --git a/radio/src/targets/horus/led_driver.cpp b/radio/src/targets/horus/led_driver.cpp index 199fbd1ba..656f0a87c 100644 --- a/radio/src/targets/horus/led_driver.cpp +++ b/radio/src/targets/horus/led_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void ledInit() { diff --git a/radio/src/targets/horus/usb_charger_driver.cpp b/radio/src/targets/horus/usb_charger_driver.cpp index 32ebe60e1..c55f86ed7 100644 --- a/radio/src/targets/horus/usb_charger_driver.cpp +++ b/radio/src/targets/horus/usb_charger_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void usbChargerInit() { @@ -34,6 +34,8 @@ void usbChargerInit() bool usbChargerLed() { - return GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_USBDet_GPIO_PIN) == 0 ? 0 : GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_CHARGER_GPIO_PIN) == Bit_RESET; -} + if (GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_USBDet_GPIO_PIN) == 0) + return 0; + return GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_CHARGER_GPIO_PIN) == Bit_RESET; +} diff --git a/radio/src/targets/nv14/CMakeLists.txt b/radio/src/targets/nv14/CMakeLists.txt index a9a7ffcdd..a091e0e3a 100644 --- a/radio/src/targets/nv14/CMakeLists.txt +++ b/radio/src/targets/nv14/CMakeLists.txt @@ -62,7 +62,7 @@ set(LUA_EXPORT lua_export_nv14) set(TOUCH_DRIVER touch_driver.cpp) set(HARDWARE_TOUCH YES) -set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET} truetype_fonts) +set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET}) set(FIRMWARE_DEPENDENCIES datacopy) set(HARDWARE_TOUCH ON) diff --git a/radio/src/targets/nv14/backlight_driver.cpp b/radio/src/targets/nv14/backlight_driver.cpp index 2308939f9..7a324fd43 100644 --- a/radio/src/targets/nv14/backlight_driver.cpp +++ b/radio/src/targets/nv14/backlight_driver.cpp @@ -19,7 +19,8 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "board.h" void backlightInit() { diff --git a/radio/src/targets/nv14/battery_driver.cpp b/radio/src/targets/nv14/battery_driver.cpp index 2f92e415b..b935e3e9c 100644 --- a/radio/src/targets/nv14/battery_driver.cpp +++ b/radio/src/targets/nv14/battery_driver.cpp @@ -188,9 +188,3 @@ void handle_battery_charge(uint32_t last_press_time) } #endif } - -uint16_t getBatteryVoltage() -{ - int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose - return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / 2942); -} diff --git a/radio/src/targets/nv14/board.cpp b/radio/src/targets/nv14/board.cpp index 41f886716..8f6284f0f 100644 --- a/radio/src/targets/nv14/board.cpp +++ b/radio/src/targets/nv14/board.cpp @@ -19,13 +19,21 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" +#include "globals.h" +#include "sdcard.h" #include "touch.h" +#include "debug.h" #include "hal/adc_driver.h" #include "stm32_hal_adc.h" #include "timers_driver.h" +#include "bitmapbuffer.h" +#include "colors.h" + +#include + #if defined(__cplusplus) && !defined(SIMU) extern "C" { #endif diff --git a/radio/src/targets/nv14/board.h b/radio/src/targets/nv14/board.h index ad7c859e9..29501f8a3 100644 --- a/radio/src/targets/nv14/board.h +++ b/radio/src/targets/nv14/board.h @@ -403,18 +403,13 @@ const etx_serial_port_t* auxSerialGetPort(int port_nr); #define LCD_DEPTH 16 #define LCD_CONTRAST_DEFAULT 20 void lcdInit(); -void lcdRefresh(); void lcdCopy(void * dest, void * src); void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color); void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h); void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h); void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format); -void lcdStoreBackupBuffer(); -int lcdRestoreBackupBuffer(); -void lcdSetContrast(); void lcdOff(); void lcdOn(); -#define lcdSetRefVolt(...) #define lcdRefreshWait(...) // Backlight driver @@ -521,4 +516,6 @@ bool touchPanelEventOccured(); struct TouchState touchPanelRead(); struct TouchState getInternalTouchState(); +#define BATTERY_DIVIDER 2942 + #endif // _BOARD_H_ diff --git a/radio/src/targets/nv14/bootloader/boot_menu.cpp b/radio/src/targets/nv14/bootloader/boot_menu.cpp index 50193a90b..6bd79c144 100644 --- a/radio/src/targets/nv14/bootloader/boot_menu.cpp +++ b/radio/src/targets/nv14/bootloader/boot_menu.cpp @@ -19,10 +19,14 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" +#include "fw_version.h" + #include "../../common/arm/stm32/bootloader/boot.h" #include "../../common/arm/stm32/bootloader/bin_files.h" +#include + #define SELECTED_COLOR (INVERS | COLOR_THEME_SECONDARY1) #define DEFAULT_PADDING 28 #define DOUBLE_PADDING 56 @@ -73,10 +77,69 @@ const uint8_t LBM_OK[] = { #define BL_FOREGROUND COLOR2FLAGS(WHITE) #define BL_SELECTED COLOR2FLAGS(RGB(11, 65, 244)) // deep blue +extern BitmapBuffer * lcdFront; +extern BitmapBuffer * lcd; + +static lv_disp_t* disp = nullptr; +static lv_disp_drv_t disp_drv; +static lv_disp_draw_buf_t disp_buf; + +void newLcdRefresh(uint16_t* buffer, const rect_t& copy_area); +static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) +{ + lv_area_t refr_area; + lv_area_copy(&refr_area, area); + +#if defined(LCD_VERTICAL_INVERT) + lv_coord_t tmp_coord; + tmp_coord = refr_area.y2; + refr_area.y2 = LCD_H - refr_area.y1 - 1; + refr_area.y1 = LCD_H - tmp_coord - 1; + tmp_coord = refr_area.x2; + refr_area.x2 = LCD_W - refr_area.x1 - 1; + refr_area.x1 = LCD_W - tmp_coord - 1; +#endif + + if (refr_area.x1 != 0 || refr_area.x2 != 479 || refr_area.y1 != 0 || + refr_area.y2 != 271) { + TRACE("partial refresh @ 0x%p {%d,%d,%d,%d}", color_p, refr_area.x1, + refr_area.y1, refr_area.x2, refr_area.y2); + } else { + TRACE("full refresh @ 0x%p", color_p); + } + + rect_t copy_area = {refr_area.x1, refr_area.y1, + refr_area.x2 - refr_area.x1 + 1, + refr_area.y2 - refr_area.y1 + 1}; + + newLcdRefresh((uint16_t*)color_p, copy_area); + lv_disp_flush_ready(disp_drv); +} + +static void init_disp_drv() +{ + lv_disp_draw_buf_init(&disp_buf, lcdFront->getData(), lcd->getData(), LCD_W*LCD_H); + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/ + disp_drv.flush_cb = flushLcd; /*Set a flush callback to draw to the display*/ + disp_drv.hor_res = LCD_W; /*Set the horizontal resolution in pixels*/ + disp_drv.ver_res = LCD_H; /*Set the vertical resolution in pixels*/ + disp_drv.full_refresh = 0; + disp_drv.direct_mode = 0; +#if defined (LCD_VERTICAL_INVERT) + disp_drv.rotated = LV_DISP_ROT_180; +#endif + disp_drv.sw_rotate = 1; + + // Register the driver and save the created display objects + disp = lv_disp_drv_register(&disp_drv); +} + void bootloaderInitScreen() { backlightEnable(BACKLIGHT_LEVEL_MAX); - // TODO: init LVGL + lv_init(); + init_disp_drv(); } static void bootloaderDrawTitle(const char* text) diff --git a/radio/src/targets/nv14/diskio.cpp b/radio/src/targets/nv14/diskio.cpp index c44c85a97..8de94e478 100644 --- a/radio/src/targets/nv14/diskio.cpp +++ b/radio/src/targets/nv14/diskio.cpp @@ -26,10 +26,11 @@ /*-----------------------------------------------------------------------*/ #include "diskio.h" -#include -#include "opentx.h" +#include "debug.h" #include "targets/common/arm/stm32/sdio_sd.h" +#include + // TODO share this with Horus (and perhaps other STM32) /*-----------------------------------------------------------------------*/ @@ -325,6 +326,11 @@ void sdInit(void) } } #else + +#include "audio.h" +#include "sdcard.h" +#include "disk_cache.h" + void sdInit() { TRACE("sdInit"); diff --git a/radio/src/targets/nv14/extmodule_helper.cpp b/radio/src/targets/nv14/extmodule_helper.cpp index e9ff82bd4..8780a3f81 100644 --- a/radio/src/targets/nv14/extmodule_helper.cpp +++ b/radio/src/targets/nv14/extmodule_helper.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void EXTERNAL_MODULE_ON() { diff --git a/radio/src/targets/nv14/haptic_driver.cpp b/radio/src/targets/nv14/haptic_driver.cpp index b4a45357f..d8fc8f809 100644 --- a/radio/src/targets/nv14/haptic_driver.cpp +++ b/radio/src/targets/nv14/haptic_driver.cpp @@ -19,7 +19,7 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "board.h" void hapticOff(void) { diff --git a/radio/src/targets/nv14/keys_driver.cpp b/radio/src/targets/nv14/keys_driver.cpp index 9d66d0275..a6196a068 100644 --- a/radio/src/targets/nv14/keys_driver.cpp +++ b/radio/src/targets/nv14/keys_driver.cpp @@ -19,9 +19,16 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "board.h" +#include "keys.h" + #include "hal/adc_driver.h" +#if defined(LUA) +#include "lua/lua_api.h" +#endif + bool trimsAsButtons = false; void setTrimsAsButtons(bool val) { trimsAsButtons = val; } @@ -106,29 +113,6 @@ bool keyDown() return readKeys() || readTrims(); } -/* TODO common to ARM */ -void readKeysAndTrims() -{ - int i; - - uint8_t index = 0; - uint32_t in = readKeys(); - uint32_t trims = readTrims(); - - for (i = 0; i < TRM_BASE; i++) { - keys[index++].input(in & (1 << i)); - } - - for (i = 1; i <= 1 << (TRM_LAST-TRM_BASE); i <<= 1) { - keys[index++].input(trims & i); - } - - if ((in || trims) && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { - // on keypress turn the light on - resetBacklightTimeout(); - } -} - #if !defined(BOOT) uint32_t switchState(uint8_t index) { diff --git a/radio/src/targets/nv14/lcd_driver.cpp b/radio/src/targets/nv14/lcd_driver.cpp index 3f4c8f896..04d0edfcf 100644 --- a/radio/src/targets/nv14/lcd_driver.cpp +++ b/radio/src/targets/nv14/lcd_driver.cpp @@ -19,7 +19,9 @@ * GNU General Public License for more details. */ -#include "opentx.h" +#include "opentx_types.h" +#include "libopenui_config.h" +#include "lcd.h" #define LCD_FIRST_LAYER 0 #define LCD_SECOND_LAYER 1 diff --git a/radio/src/targets/simu/CMakeLists.txt b/radio/src/targets/simu/CMakeLists.txt index ace09b021..2e2addde2 100644 --- a/radio/src/targets/simu/CMakeLists.txt +++ b/radio/src/targets/simu/CMakeLists.txt @@ -38,6 +38,15 @@ if(SIMU_LUA_COMPILER) add_definitions(-DLUA_COMPILER) endif() +if(SIMU_BOOTLOADER) + add_definitions(-DSIMU_BOOTLOADER) + set(SIMU_SRC ${SIMU_SRC} + ../../targets/common/arm/stm32/bootloader/bin_files.cpp + ../../targets/common/arm/stm32/bootloader/boot.cpp + ../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp + ) +endif() + if(Qt5Widgets_FOUND) set(SIMULATOR_FLAVOUR edgetx-${FLAVOUR}) set(SIMULATOR_TARGET ${SIMULATOR_FLAVOUR}-simulator) diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index c6b2fb326..eaea1543b 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -137,6 +137,15 @@ void simuSetSwitch(uint8_t swtch, int8_t state) switchesStates[swtch] = state; } +#if defined(SIMU_BOOTLOADER) +int bootloaderMain(); +static void* bootloaderThread(void*) +{ + bootloaderMain(); + return nullptr; +} +#endif + void simuStart(bool tests, const char * sdPath, const char * settingsPath) { if (simu_running) @@ -195,7 +204,18 @@ void simuStart(bool tests, const char * sdPath, const char * settingsPath) try { #endif +#if !defined(SIMU_BOOTLOADER) simuMain(); +#else + pthread_attr_t attr; + pthread_attr_init(&attr); + struct sched_param sp; + sp.sched_priority = SCHED_RR; + pthread_attr_setschedparam(&attr, &sp); + + pthread_t bl_pid; + pthread_create(&bl_pid, &attr, &bootloaderThread, nullptr); +#endif simu_running = true; @@ -464,24 +484,6 @@ void pwrInit() {} void pwrOn() {} void pwrOff() {} -void readKeysAndTrims() -{ - uint8_t index = 0; - auto keysInput = readKeys(); - for (auto mask = (1 << 0); mask < (1 << TRM_BASE); mask <<= 1) { - keys[index++].input(keysInput & mask); - } - - auto trimsInput = readTrims(); - for (auto mask = (1 << 0); mask < (1 << NUM_TRIMS_KEYS); mask <<= 1) { - keys[index++].input(trimsInput & mask); - } - - if (keysInput || trimsInput) { - resetBacklightTimeout(); - } -} - bool keyDown() { return readKeys(); diff --git a/radio/src/targets/simu/simulcd.cpp b/radio/src/targets/simu/simulcd.cpp index a40495ca9..cafa8378b 100644 --- a/radio/src/targets/simu/simulcd.cpp +++ b/radio/src/targets/simu/simulcd.cpp @@ -59,9 +59,6 @@ void lcdRefresh() pixel_t displayBuf1[DISPLAY_BUFFER_SIZE]; pixel_t displayBuf2[DISPLAY_BUFFER_SIZE]; -pixel_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE]; - -BitmapBuffer lcdBackup(BMP_RGB565, LCD_W, LCD_H, LCD_BACKUP_FRAME_BUFFER); BitmapBuffer _lcd1(BMP_RGB565, LCD_W, LCD_H, displayBuf1); BitmapBuffer _lcd2(BMP_RGB565, LCD_W, LCD_H, displayBuf2); @@ -69,20 +66,6 @@ BitmapBuffer _lcd2(BMP_RGB565, LCD_W, LCD_H, displayBuf2); BitmapBuffer * lcd = &_lcd1; BitmapBuffer * lcdFront = &_lcd2; - -void lcdStoreBackupBuffer() -{ - memcpy(simuLcdBackupBuf, lcd->getData(), - DISPLAY_BUFFER_SIZE * sizeof(pixel_t)); -} - -int lcdRestoreBackupBuffer() -{ - memcpy(lcd->getData(), simuLcdBackupBuf, - DISPLAY_BUFFER_SIZE * sizeof(pixel_t)); - return 1; -} - void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area) { @@ -111,33 +94,6 @@ void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area) // Mark screen dirty for async refresh simuLcdRefresh = true; - - // // .. and wait for refresh - // auto start = RTOS_GET_MS(); - // while(simuLcdRefresh || - // (RTOS_GET_MS() - start <= 100)); -} -void lcdRefresh() -{ - // Mark screen dirty for async refresh - simuLcdRefresh = true; - - pixel_t* lcdData = lcd->getData(); - -#if defined(LCD_VERTICAL_INVERT) - auto src = lcdData + DISPLAY_BUFFER_SIZE - 1; - auto dst = simuLcdBuf; - auto end = dst + DISPLAY_BUFFER_SIZE; - - while (dst != end) { - *(dst++) = *(src--); - } -#else - memcpy(simuLcdBuf, lcdData, DISPLAY_BUFFER_SIZE * sizeof(pixel_t)); -#endif - - // Swap back & front buffers - std::swap(lcd, lcdFront); } void lcdInit() diff --git a/radio/src/targets/taranis/keys_driver.cpp b/radio/src/targets/taranis/keys_driver.cpp index 561a673a7..a86baf9ea 100644 --- a/radio/src/targets/taranis/keys_driver.cpp +++ b/radio/src/targets/taranis/keys_driver.cpp @@ -140,30 +140,6 @@ bool keyDown() return readKeys() || readTrims(); } -/* TODO common to ARM */ -void readKeysAndTrims() -{ - uint8_t index = 0; - uint32_t keys_input = readKeys(); - for (unsigned i = 1; i != unsigned(1 << TRM_BASE); i <<= 1) { - keys[index++].input(keys_input & i); - } - - uint32_t trims_input = readTrims(); - for (uint8_t i = 1; i != uint8_t(1 << 8); i <<= 1) { - keys[index++].input(trims_input & i); - } - -#if defined(PWR_BUTTON_PRESS) - if ((keys_input || trims_input || pwrPressed()) && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { -#else - if ((keys_input || trims_input) && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) { -#endif - // on keypress turn the light on - resetBacklightTimeout(); - } -} - #if defined(PCBX9E) #define ADD_2POS_CASE(x) \ case SW_S ## x ## 2: \ diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index 781c808fa..c70784cbd 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit 781c808faf0ffe270b0a9a6cf3fafe8ff016cbf8 +Subproject commit c70784cbd054cd03c8feed4349fdd32e048bea06 diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index bb35c9e64..c528b27d8 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -21,6 +21,10 @@ #include "opentx.h" +#if defined(COLORLCD) + #define CENTER +#endif + #define ISTR(x) const char STR_##x[] = LEN_##x TR_##x #if defined(COLORLCD)