diff --git a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp index a721d414b..5f5dd2570 100644 --- a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp @@ -78,8 +78,8 @@ namespace Open9xGruvin9x { #include "radio/src/gui/9X/navigation.cpp" #include "radio/src/gui/9X/popups.cpp" #include "radio/src/gui/9X/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/9X/menus.cpp" +#include "radio/src/gui/9X/menu_model.cpp" #include "radio/src/gui/9X/menu_model_select.cpp" #include "radio/src/gui/9X/menu_model_setup.cpp" #include "radio/src/gui/9X/menu_model_heli.cpp" @@ -91,7 +91,7 @@ namespace Open9xGruvin9x { #include "radio/src/gui/9X/menu_model_limits.cpp" #include "radio/src/gui/9X/menu_model_telemetry.cpp" #include "radio/src/gui/9X/menu_model_templates.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/9X/menu_general.cpp" #include "radio/src/gui/9X/menu_general_setup.cpp" #include "radio/src/gui/9X/menu_general_trainer.cpp" #include "radio/src/gui/9X/menu_general_version.cpp" @@ -107,7 +107,7 @@ namespace Open9xGruvin9x { #include "radio/src/targets/simu/simpgmspace.cpp" #include "radio/src/templates.cpp" #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/9X/fonts.cpp" #include "radio/src/audio_avr.cpp" #include "radio/src/buzzer.cpp" #include "radio/src/targets/gruvin9x/somo14d.cpp" diff --git a/companion/src/firmwares/opentx/opentxM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp index a062a6c96..3cfcd0963 100644 --- a/companion/src/firmwares/opentx/opentxM128simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp @@ -79,8 +79,8 @@ namespace OpenTxM128 { #include "radio/src/gui/9X/navigation.cpp" #include "radio/src/gui/9X/popups.cpp" #include "radio/src/gui/9X/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/9X/menus.cpp" +#include "radio/src/gui/9X/menu_model.cpp" #include "radio/src/gui/9X/menu_model_select.cpp" #include "radio/src/gui/9X/menu_model_setup.cpp" #include "radio/src/gui/9X/menu_model_heli.cpp" @@ -92,7 +92,7 @@ namespace OpenTxM128 { #include "radio/src/gui/9X/menu_model_limits.cpp" #include "radio/src/gui/9X/menu_model_telemetry.cpp" #include "radio/src/gui/9X/menu_model_templates.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/9X/menu_general.cpp" #include "radio/src/gui/9X/menu_general_setup.cpp" #include "radio/src/gui/9X/menu_general_trainer.cpp" #include "radio/src/gui/9X/menu_general_version.cpp" @@ -108,7 +108,7 @@ namespace OpenTxM128 { #include "radio/src/targets/simu/simpgmspace.cpp" #include "radio/src/templates.cpp" #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/9X/fonts.cpp" #include "radio/src/audio_avr.cpp" #include "radio/src/targets/stock/voice.cpp" #include "radio/src/telemetry/frsky.cpp" diff --git a/companion/src/firmwares/opentx/opentxM64simulator.cpp b/companion/src/firmwares/opentx/opentxM64simulator.cpp index 1fafe32c3..f79c4cfa7 100644 --- a/companion/src/firmwares/opentx/opentxM64simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM64simulator.cpp @@ -82,8 +82,8 @@ namespace OpenTxM64 { #include "radio/src/gui/9X/navigation.cpp" #include "radio/src/gui/9X/popups.cpp" #include "radio/src/gui/9X/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/9X/menus.cpp" +#include "radio/src/gui/9X/menu_model.cpp" #include "radio/src/gui/9X/menu_model_select.cpp" #include "radio/src/gui/9X/menu_model_setup.cpp" #include "radio/src/gui/9X/menu_model_heli.cpp" @@ -95,7 +95,7 @@ namespace OpenTxM64 { #include "radio/src/gui/9X/menu_model_limits.cpp" #include "radio/src/gui/9X/menu_model_telemetry.cpp" #include "radio/src/gui/9X/menu_model_templates.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/9X/menu_general.cpp" #include "radio/src/gui/9X/menu_general_setup.cpp" #include "radio/src/gui/9X/menu_general_trainer.cpp" #include "radio/src/gui/9X/menu_general_version.cpp" @@ -113,7 +113,7 @@ namespace OpenTxM64 { #include "radio/src/telemetry/frsky_d.cpp" #include "radio/src/templates.cpp" #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/9X/fonts.cpp" #include "radio/src/targets/stock/voice.cpp" #include "radio/src/buzzer.cpp" #include "radio/src/translations/tts_en.cpp" diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp index 5a52cb040..a2e1487a5 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp @@ -94,8 +94,8 @@ namespace Open9xSky9x { #include "radio/src/gui/9X/navigation.cpp" #include "radio/src/gui/9X/popups.cpp" #include "radio/src/gui/9X/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/9X/menus.cpp" +#include "radio/src/gui/9X/menu_model.cpp" #include "radio/src/gui/9X/menu_model_select.cpp" #include "radio/src/gui/9X/menu_model_setup.cpp" #include "radio/src/gui/9X/menu_model_heli.cpp" @@ -107,7 +107,7 @@ namespace Open9xSky9x { #include "radio/src/gui/9X/menu_model_limits.cpp" #include "radio/src/gui/9X/menu_model_telemetry.cpp" #include "radio/src/gui/9X/menu_model_templates.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/9X/menu_general.cpp" #include "radio/src/gui/9X/menu_general_setup.cpp" #include "radio/src/gui/9X/menu_general_sdmanager.cpp" #include "radio/src/gui/9X/menu_general_trainer.cpp" @@ -119,7 +119,7 @@ namespace Open9xSky9x { #include "radio/src/gui/9X/view_main.cpp" #include "radio/src/gui/9X/view_statistics.cpp" #include "radio/src/gui/9X/view_telemetry.cpp" -#include "radio/src/gui/view_about.cpp" +#include "radio/src/gui/9X/view_about.cpp" #include "radio/src/gui/9X/view_text.cpp" #include "radio/src/lcd_common.cpp" #include "radio/src/lcd_default.cpp" @@ -129,7 +129,7 @@ namespace Open9xSky9x { #include "radio/src/targets/simu/simpgmspace.cpp" #include "radio/src/templates.cpp" #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/9X/fonts.cpp" #include "radio/src/telemetry/telemetry.cpp" #include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky_sport.cpp" diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp index c4c784b1a..e11b1f307 100644 --- a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp @@ -99,8 +99,8 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/navigation.cpp" #include "radio/src/gui/Taranis/popups.cpp" #include "radio/src/gui/Taranis/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/Taranis/menus.cpp" +#include "radio/src/gui/Taranis/menu_model.cpp" #include "radio/src/gui/Taranis/menu_model_select.cpp" #include "radio/src/gui/Taranis/menu_model_setup.cpp" #include "radio/src/gui/Taranis/menu_model_heli.cpp" @@ -113,7 +113,7 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/menu_model_gvars.cpp" #include "radio/src/gui/Taranis/menu_model_limits.cpp" #include "radio/src/gui/Taranis/menu_model_telemetry.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/Taranis/menu_general.cpp" #include "radio/src/gui/Taranis/menu_general_setup.cpp" #include "radio/src/gui/Taranis/menu_general_sdmanager.cpp" #include "radio/src/gui/Taranis/menu_general_trainer.cpp" @@ -124,10 +124,10 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/menu_general_calib.cpp" #include "radio/src/gui/Taranis/view_main.cpp" #include "radio/src/gui/Taranis/view_statistics.cpp" -#include "radio/src/gui/view_channels.cpp" +#include "radio/src/gui/Taranis/view_channels.cpp" #include "radio/src/gui/Taranis/view_telemetry.cpp" #include "radio/src/gui/Taranis/view_text.cpp" -#include "radio/src/gui/view_about.cpp" +#include "radio/src/gui/Taranis/view_about.cpp" #include "radio/src/lcd_common.cpp" #include "radio/src/lcd_taranis.cpp" #include "radio/src/logs.cpp" @@ -143,7 +143,7 @@ inline int geteepromsize() { #include "radio/src/targets/simu/simpgmspace.cpp" #define SDCARD #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/Taranis/fonts.cpp" #include "radio/src/telemetry/telemetry.cpp" #include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky_sport.cpp" diff --git a/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp index d1942e1c3..9bb73bf1f 100755 --- a/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisX9ESimulator.cpp @@ -101,8 +101,8 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/navigation.cpp" #include "radio/src/gui/Taranis/popups.cpp" #include "radio/src/gui/Taranis/helpers.cpp" -#include "radio/src/gui/menus.cpp" -#include "radio/src/gui/menu_model.cpp" +#include "radio/src/gui/Taranis/menus.cpp" +#include "radio/src/gui/Taranis/menu_model.cpp" #include "radio/src/gui/Taranis/menu_model_select.cpp" #include "radio/src/gui/Taranis/menu_model_setup.cpp" #include "radio/src/gui/Taranis/menu_model_heli.cpp" @@ -115,7 +115,7 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/menu_model_gvars.cpp" #include "radio/src/gui/Taranis/menu_model_limits.cpp" #include "radio/src/gui/Taranis/menu_model_telemetry.cpp" -#include "radio/src/gui/menu_general.cpp" +#include "radio/src/gui/Taranis/menu_general.cpp" #include "radio/src/gui/Taranis/menu_general_setup.cpp" #include "radio/src/gui/Taranis/menu_general_sdmanager.cpp" #include "radio/src/gui/Taranis/menu_general_trainer.cpp" @@ -126,10 +126,10 @@ inline int geteepromsize() { #include "radio/src/gui/Taranis/menu_general_calib.cpp" #include "radio/src/gui/Taranis/view_main.cpp" #include "radio/src/gui/Taranis/view_statistics.cpp" -#include "radio/src/gui/view_channels.cpp" +#include "radio/src/gui/Taranis/view_channels.cpp" #include "radio/src/gui/Taranis/view_telemetry.cpp" #include "radio/src/gui/Taranis/view_text.cpp" -#include "radio/src/gui/view_about.cpp" +#include "radio/src/gui/Taranis/view_about.cpp" #include "radio/src/lcd_common.cpp" #include "radio/src/lcd_taranis.cpp" #include "radio/src/logs.cpp" @@ -145,7 +145,7 @@ inline int geteepromsize() { #include "radio/src/targets/simu/simpgmspace.cpp" #define SDCARD #include "radio/src/translations.cpp" -#include "radio/src/fonts.cpp" +#include "radio/src/gui/Taranis/fonts.cpp" #include "radio/src/telemetry/telemetry.cpp" #include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky_sport.cpp" diff --git a/radio/src/Makefile b/radio/src/Makefile index 2bac1f46f..da00096f1 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -365,8 +365,8 @@ M128_VARIANT = +32768 M2561_VARIANT = +16384 EEPROM_VARIANT = 0 -GUIMODELSRC = gui/menu_model.cpp gui/$(GUIDIRECTORY)/menu_model_select.cpp gui/$(GUIDIRECTORY)/menu_model_setup.cpp gui/$(GUIDIRECTORY)/menu_model_inputs_mixes.cpp gui/$(GUIDIRECTORY)/menu_model_limits.cpp gui/$(GUIDIRECTORY)/menu_model_logical_switches.cpp gui/$(GUIDIRECTORY)/menu_model_custom_functions.cpp gui/$(GUIDIRECTORY)/menu_model_telemetry.cpp -GUIGENERALSRC = gui/menu_general.cpp gui/$(GUIDIRECTORY)/menu_general_setup.cpp gui/$(GUIDIRECTORY)/menu_general_trainer.cpp gui/$(GUIDIRECTORY)/menu_general_version.cpp gui/$(GUIDIRECTORY)/menu_general_calib.cpp +GUIMODELSRC = gui/$(GUIDIRECTORY)/menu_model.cpp gui/$(GUIDIRECTORY)/menu_model_select.cpp gui/$(GUIDIRECTORY)/menu_model_setup.cpp gui/$(GUIDIRECTORY)/menu_model_inputs_mixes.cpp gui/$(GUIDIRECTORY)/menu_model_limits.cpp gui/$(GUIDIRECTORY)/menu_model_logical_switches.cpp gui/$(GUIDIRECTORY)/menu_model_custom_functions.cpp gui/$(GUIDIRECTORY)/menu_model_telemetry.cpp +GUIGENERALSRC = gui/$(GUIDIRECTORY)/menu_general.cpp gui/$(GUIDIRECTORY)/menu_general_setup.cpp gui/$(GUIDIRECTORY)/menu_general_trainer.cpp gui/$(GUIDIRECTORY)/menu_general_version.cpp gui/$(GUIDIRECTORY)/menu_general_calib.cpp BITMAPS = bitmaps/sticks.lbm @@ -727,7 +727,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO)) EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp LCDSRC = lcd_common.cpp lcd_default.cpp PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp pulses/dsm2_arm.cpp - CPPSRC += tasks_arm.cpp audio_arm.cpp haptic.cpp gui/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp telemetry/telemetry.cpp + CPPSRC += tasks_arm.cpp audio_arm.cpp haptic.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp telemetry/telemetry.cpp CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/second_serial_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp CPPSRC += loadboot.cpp debug.cpp BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm @@ -835,7 +835,7 @@ ifeq ($(PCB), TARANIS) PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp CPPSRC += tasks_arm.cpp audio_arm.cpp sbus.cpp telemetry/telemetry.cpp CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/uart3_driver.cpp targets/taranis/telemetry_driver.cpp - CPPSRC += bmp.cpp gui/view_channels.cpp gui/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp loadboot.cpp debug.cpp + CPPSRC += bmp.cpp gui/$(GUIDIRECTORY)/view_channels.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp loadboot.cpp debug.cpp SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c @@ -949,9 +949,9 @@ else TTS_SRC = $(shell sh -c "if test -f $(STD_TTS_SRC); then echo $(STD_TTS_SRC); else echo translations/tts_en.cpp; fi") endif -GUISRC = gui/$(GUIDIRECTORY)/helpers.cpp gui/$(GUIDIRECTORY)/navigation.cpp gui/$(GUIDIRECTORY)/popups.cpp gui/$(GUIDIRECTORY)/widgets.cpp gui/menus.cpp $(GUIMODELSRC) $(GUIGENERALSRC) gui/$(GUIDIRECTORY)/view_main.cpp gui/$(GUIDIRECTORY)/view_statistics.cpp +GUISRC = gui/$(GUIDIRECTORY)/helpers.cpp gui/$(GUIDIRECTORY)/navigation.cpp gui/$(GUIDIRECTORY)/popups.cpp gui/$(GUIDIRECTORY)/widgets.cpp gui/$(GUIDIRECTORY)/menus.cpp $(GUIMODELSRC) $(GUIGENERALSRC) gui/$(GUIDIRECTORY)/view_main.cpp gui/$(GUIDIRECTORY)/view_statistics.cpp -CPPSRC += opentx.cpp functions.cpp strhelpers.cpp $(PULSESSRC) switches.cpp curves.cpp mixer.cpp stamp.cpp $(GUISRC) $(EEPROMSRC) $(LCDSRC) keys.cpp maths.cpp translations.cpp fonts.cpp $(TTS_SRC) +CPPSRC += opentx.cpp functions.cpp strhelpers.cpp $(PULSESSRC) switches.cpp curves.cpp mixer.cpp stamp.cpp $(GUISRC) $(EEPROMSRC) $(LCDSRC) keys.cpp maths.cpp translations.cpp gui/$(GUIDIRECTORY)/fonts.cpp $(TTS_SRC) # Debugging format. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. @@ -1116,7 +1116,7 @@ endif ifeq ($(EXT), MAVLINK) CPPDEFS += -DMAVLINK - CPPSRC += telemetry/mavlink.cpp gui/view_mavlink.cpp serial.cpp + CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp serial.cpp EEPROM_VARIANT += ${MAVLINK_VARIANT} endif diff --git a/radio/src/fonts.cpp b/radio/src/gui/9X/fonts.cpp similarity index 88% rename from radio/src/fonts.cpp rename to radio/src/gui/9X/fonts.cpp index 7134b170e..1a06b56f5 100644 --- a/radio/src/fonts.cpp +++ b/radio/src/gui/9X/fonts.cpp @@ -34,13 +34,8 @@ * */ -#include "opentx.h" +#include "../../opentx.h" -#if defined(COLORLCD) -const pm_uchar font_5x7[] PROGMEM = { -#include "fonts/font_stdsize.lbm" -}; -#else const pm_uchar font_5x7[] PROGMEM = { #if defined (CPUARM) #include "font_05x07.lbm" @@ -67,7 +62,6 @@ const pm_uchar font_5x7[] PROGMEM = { #include "font_se_05x07.lbm" #endif }; -#endif #if defined(BOLD_FONT) && (!defined(CPUM64) || defined(EXTSTD)) const pm_uchar font_5x7_B[] PROGMEM = { @@ -76,11 +70,6 @@ const pm_uchar font_5x7_B[] PROGMEM = { #endif #if !defined(BOOT) -#if defined(COLORLCD) -const pm_uchar font_10x14[] PROGMEM = { -#include "fonts/font_dblsize.lbm" -}; -#else const pm_uchar font_10x14[] PROGMEM = { #include "font_10x14_compressed.lbm" #if defined(CPUARM) @@ -106,13 +95,11 @@ const pm_uchar font_10x14[] PROGMEM = { #endif }; #endif -#endif #if defined(CPUARM) && !defined(BOOT) const pm_uchar font_3x5[] PROGMEM = { #include "font_03x05.lbm" }; - const pm_uchar font_4x6[] PROGMEM = { #include "font_04x06.lbm" #if defined(TRANSLATIONS_DE) @@ -136,11 +123,6 @@ const pm_uchar font_4x6[] PROGMEM = { #endif }; -#if defined(COLORLCD) -const pm_uchar font_8x10[] PROGMEM = { -#include "fonts/font_midsize.lbm" -}; -#else const pm_uchar font_8x10[] PROGMEM = { #include "font_08x10.lbm" #if defined(TRANSLATIONS_DE) @@ -163,7 +145,6 @@ const pm_uchar font_8x10[] PROGMEM = { #include "font_se_08x10.lbm" #endif }; -#endif const pm_uchar font_22x38_num[] PROGMEM = { #include "font_22x38_num.lbm" @@ -181,5 +162,4 @@ const pm_uchar font_10x14_extra[] PROGMEM = { #include "font_10x14_extra.lbm" }; -#endif - +#endif // defined(CPUARM) && !defined(BOOT) diff --git a/radio/src/gui/9X/gui.h b/radio/src/gui/9X/gui.h index 8335e1ec6..3d57dbe8e 100755 --- a/radio/src/gui/9X/gui.h +++ b/radio/src/gui/9X/gui.h @@ -34,6 +34,8 @@ * */ +#include "menus.h" + #define NUM_BODY_LINES LCD_LINES-1 #define MENU_TITLE_HEIGHT FH #define MENU_NAVIG_HEIGHT 0 diff --git a/radio/src/gui/menu_general.cpp b/radio/src/gui/9X/menu_general.cpp old mode 100644 new mode 100755 similarity index 95% rename from radio/src/gui/menu_general.cpp rename to radio/src/gui/9X/menu_general.cpp index b0573930c..b2e3e679d --- a/radio/src/gui/menu_general.cpp +++ b/radio/src/gui/9X/menu_general.cpp @@ -34,7 +34,7 @@ * */ -#include "../opentx.h" +#include "../../opentx.h" #if defined(CPUARM) extern LP_CONST LanguagePack czLanguagePack; diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/9X/menu_model.cpp old mode 100644 new mode 100755 similarity index 79% rename from radio/src/gui/menu_model.cpp rename to radio/src/gui/9X/menu_model.cpp index e9179736d..726ff4e20 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/9X/menu_model.cpp @@ -33,14 +33,16 @@ * */ -#include "../opentx.h" -#ifdef MAVLINK -#include "gui/view_mavlink.h" +#include "../../opentx.h" + +#if defined(MAVLINK) +#include "view_mavlink.h" #endif -#define WCHART 32 +// TODO elsewhere! +#define WCHART (LCD_H/2) #define X0 (LCD_W-WCHART-2) -#define Y0 32 +#define Y0 (LCD_H/2) enum EnumTabModel { e_ModelSelect, @@ -51,14 +53,8 @@ enum EnumTabModel { e_MixAll, e_Limits, CASE_CURVES(e_CurvesAll) -#if LCD_W >= 212 - CASE_GVARS(e_GVars) -#endif e_LogicalSwitches, e_CustomFunctions, -#if defined(LUA_MODEL_SCRIPTS) - e_CustomScripts, -#endif CASE_FRSKY(e_Telemetry) CASE_MAVLINK(e_MavSetup) CASE_TEMPLATES(e_Templates) @@ -76,7 +72,6 @@ void menuModelCurveOne(uint8_t event); void menuModelGVars(uint8_t event); void menuModelLogicalSwitches(uint8_t event); void menuModelCustomFunctions(uint8_t event); -void menuModelCustomScripts(uint8_t event); void menuModelTelemetry(uint8_t event); void menuModelTemplates(uint8_t event); void menuModelExpoOne(uint8_t event); @@ -89,30 +84,12 @@ extern uint8_t s_curveChan; #define FlightModesType uint8_t #endif -#if defined(PCBTARANIS) - void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr); +#if LCD_W >= 212 + #define MIXES_2ND_COLUMN (18*FW) +#else + #define MIXES_2ND_COLUMN (12*FW) #endif -#if MENU_COLUMNS < 2 - #if LCD_W >= 212 - #define MIXES_2ND_COLUMN (18*FW) - #else - #define MIXES_2ND_COLUMN (12*FW) - #endif -#else - #define MIXES_2ND_COLUMN (9*FW) -#endif - -#if MENU_COLUMNS > 1 -uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) -{ - lcd_puts(x, y, str); - lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); - if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); - return delay; -} -#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay) -#else uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) { lcd_putsLeft(y, str); @@ -121,7 +98,6 @@ uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, cons return delay; } #define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay) -#endif const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = { menuModelSelect, @@ -132,14 +108,8 @@ const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = { menuModelMixAll, menuModelLimits, CASE_CURVES(menuModelCurvesAll) -#if LCD_W >= 212 && defined(GVARS) && defined(FLIGHT_MODES) - CASE_GVARS(menuModelGVars) -#endif menuModelLogicalSwitches, menuModelCustomFunctions, -#if defined(LUA_MODEL_SCRIPTS) - menuModelCustomScripts, -#endif CASE_FRSKY(menuModelTelemetry) CASE_MAVLINK(menuTelemetryMavlinkSetup) CASE_TEMPLATES(menuModelTemplates) @@ -187,7 +157,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin } switch (event) { -#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS) +#if defined(ROTARY_ENCODER_NAVIGATION) case EVT_ROTARY_BREAK: if (s_editMode == EDIT_MODIFY_FIELD) { s_editMode = EDIT_MODIFY_STRING; @@ -200,16 +170,14 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin break; #endif -#if !defined(PCBTARANIS) case EVT_KEY_BREAK(KEY_LEFT): if (cur>0) cur--; break; case EVT_KEY_BREAK(KEY_RIGHT): if (cur=-26 && v<=26) { v = -v; // toggle case if (event==EVT_KEY_LONG(KEY_LEFT)) @@ -233,11 +199,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin if (c != v) { name[cur] = v; -#if defined(PCBTARANIS) - eeDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL); -#else eeDirty(EE_MODEL); -#endif } lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH); diff --git a/radio/src/gui/menus.cpp b/radio/src/gui/9X/menus.cpp old mode 100644 new mode 100755 similarity index 98% rename from radio/src/gui/menus.cpp rename to radio/src/gui/9X/menus.cpp index e119c7e3a..60435cf5f --- a/radio/src/gui/menus.cpp +++ b/radio/src/gui/9X/menus.cpp @@ -34,7 +34,7 @@ * */ -#include "../opentx.h" +#include "../../opentx.h" MenuFuncP g_menuStack[5]; uint8_t menuEvent = 0; diff --git a/radio/src/gui/menus.h b/radio/src/gui/9X/menus.h old mode 100644 new mode 100755 similarity index 76% rename from radio/src/gui/menus.h rename to radio/src/gui/9X/menus.h index 412eb5b8c..d9cfe1779 --- a/radio/src/gui/menus.h +++ b/radio/src/gui/9X/menus.h @@ -39,22 +39,10 @@ #define NO_HI_LEN 25 -#if LCD_W >= 212 - #if defined(TRANSLATIONS_FR) - #define MENU_COLUMNS 1 - #define COLUMN_X 0 - #else - #define MENU_COLUMNS 2 - #endif - #define MENUS_SCROLLBAR_WIDTH 2 - #define MENU_COLUMN2_X (8 + LCD_W / 2) - #define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str) -#else - #define MENUS_SCROLLBAR_WIDTH 0 - #define MENU_COLUMNS 1 - #define COLUMN_X 0 - #define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str) -#endif +#define MENUS_SCROLLBAR_WIDTH 0 +#define MENU_COLUMNS 1 +#define COLUMN_X 0 +#define lcd_putsColumnLeft(x, y, str) lcd_putsLeft(y, str) // Menus related stuff ... #if defined(SDCARD) @@ -63,13 +51,8 @@ typedef uint8_t vertpos_t; #endif -#if defined(PCBTARANIS) - typedef uint8_t & check_event_t; - #define horzpos_t int8_t -#else - typedef uint8_t check_event_t; - #define horzpos_t uint8_t -#endif +typedef uint8_t check_event_t; +#define horzpos_t uint8_t #if defined(CPUARM) extern tmr10ms_t menuEntryTime; @@ -87,6 +70,8 @@ typedef void (*MenuFuncP)(uint8_t event); typedef void (*MenuFuncP_PROGMEM)(uint8_t event); extern const MenuFuncP_PROGMEM menuTabModel[]; extern const MenuFuncP_PROGMEM menuTabGeneral[]; +extern const MenuFuncP_PROGMEM menuTabFPV[]; +extern const MenuFuncP_PROGMEM menuTabTelemetry[]; extern MenuFuncP g_menuStack[5]; extern uint8_t g_menuPos[4]; @@ -137,11 +122,6 @@ void menuTraceBuffer(uint8_t event); #define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) #endif -#if defined(PCBTARANIS) -void menuMainViewChannelsMonitor(uint8_t event); -void menuChannelsView(uint8_t event); -#endif - #if defined(NAVIGATION_POT1) extern int16_t p1valdiff; #else @@ -210,19 +190,19 @@ extern const CheckIncDecStops &stopsSwitch; (val), (val+1) int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100); #else -int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0); + int16_t checkIncDec(uint8_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0); #endif int8_t checkIncDecMovedSwitch(int8_t val); #if defined(CPUM64) -int8_t checkIncDecModel(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); -int8_t checkIncDecModelZero(uint8_t event, int8_t i_val, int8_t i_max); -int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); + int8_t checkIncDecModel(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); + int8_t checkIncDecModelZero(uint8_t event, int8_t i_val, int8_t i_max); + int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); #else -#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL) -#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL) -#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL) + #define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL) + #define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL) + #define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL) #endif #define CHECK_INCDEC_MODELVAR(event, var, min, max) \ @@ -288,21 +268,10 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); #define CHECK_INCDEC_GENVAR(event, var, min, max) \ var = checkIncDecGen(event, var, min, max) -#if defined(PCBTARANIS) - #define NAVIGATION_LINE_BY_LINE 0x40 - #define CURSOR_ON_LINE() (m_posHorz<0) -#else - #define NAVIGATION_LINE_BY_LINE 0 - #define CURSOR_ON_LINE() (0) -#endif - -#if defined(PCBTARANIS) - #define CHECK_FLAG_NO_SCREEN_INDEX 1 - void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0); -#else - void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow); -#endif +#define NAVIGATION_LINE_BY_LINE 0 +#define CURSOR_ON_LINE() (0) +void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow); void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow); void check_submenu_simple(check_event_t event, uint8_t maxrow); @@ -381,7 +350,7 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t #endif #define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0) #else - int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); + int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event); #define displayGVar(x, y, v, min, max) lcd_outdez8(x, y, v) #endif @@ -397,21 +366,12 @@ extern uint8_t s_warning_info_len; extern uint8_t s_warning_result; extern uint8_t s_warning_type; -#if LCD_W >= 212 - #define MENU_X 30 - #define MENU_Y 16 - #define WARNING_LINE_LEN 32 - #define WARNING_LINE_X 16 - #define WARNING_LINE_Y 3*FH -#else - #define MENU_X 10 - #define MENU_Y 16 - #define WARNING_LINE_LEN 20 - #define WARNING_LINE_X 16 - #define WARNING_LINE_Y 3*FH -#endif - +#define MENU_X 10 +#define MENU_Y 16 #define MENU_W LCD_W-(2*MENU_X) +#define WARNING_LINE_LEN 20 +#define WARNING_LINE_X 16 +#define WARNING_LINE_Y 3*FH void displayBox(); void displayPopup(const pm_char * pstr); @@ -449,11 +409,7 @@ void displayWarning(uint8_t event); #else #define MENU_ADD_SD_ITEM(s) #endif - #if LCD_W >= 212 - #define MENU_LINE_LENGTH (LEN_MODEL_NAME+12) - #else - #define MENU_LINE_LENGTH (LEN_MODEL_NAME+1) - #endif + #define MENU_LINE_LENGTH (LEN_MODEL_NAME+1) extern const char *s_menu[MENU_MAX_LINES]; extern uint16_t s_menu_count; extern uint8_t s_menu_flags; @@ -479,41 +435,18 @@ void displayWarning(uint8_t event); void pushModelNotes(); #endif -#if defined(PCBTARANIS) - void menuChannelsView(uint8_t event); -#endif - #define LABEL(...) (uint8_t)-1 -#if defined(PCBTARANIS) - #define KEY_MOVE_UP KEY_PLUS - #define KEY_MOVE_DOWN KEY_MINUS -#if defined(REV9E) - #define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_MINUS) - #define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_PLUS) -#else - #define CURSOR_MOVED_LEFT(event) (EVT_KEY_MASK(event) == KEY_PLUS) - #define CURSOR_MOVED_RIGHT(event) (EVT_KEY_MASK(event) == KEY_MINUS) -#endif - #define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_LEFT - #define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_RIGHT - #define IS_ROTARY_MOVE_RIGHT IS_ROTARY_LEFT - #define IS_ROTARY_MOVE_LEFT IS_ROTARY_RIGHT -#else - #define KEY_MOVE_UP KEY_UP - #define KEY_MOVE_DOWN KEY_DOWN - #define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT) - #define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT) - #define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_RIGHT - #define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_LEFT - #define IS_ROTARY_MOVE_RIGHT IS_ROTARY_RIGHT - #define IS_ROTARY_MOVE_LEFT IS_ROTARY_LEFT -#endif +#define KEY_MOVE_UP KEY_UP +#define KEY_MOVE_DOWN KEY_DOWN +#define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT) +#define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT) +#define CASE_EVT_ROTARY_MOVE_RIGHT CASE_EVT_ROTARY_RIGHT +#define CASE_EVT_ROTARY_MOVE_LEFT CASE_EVT_ROTARY_LEFT +#define IS_ROTARY_MOVE_RIGHT IS_ROTARY_RIGHT +#define IS_ROTARY_MOVE_LEFT IS_ROTARY_LEFT -#if defined(PCBTARANIS) - #define REPEAT_LAST_CURSOR_MOVE() { if (CURSOR_MOVED_LEFT(event) || CURSOR_MOVED_RIGHT(event)) putEvent(event); else m_posHorz = 0; } - #define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE() -#elif defined(ROTARY_ENCODER_NAVIGATION) +#if defined(ROTARY_ENCODER_NAVIGATION) void repeatLastCursorMove(uint8_t event); #define REPEAT_LAST_CURSOR_MOVE() { if (EVT_KEY_MASK(event) >= 0x0e) putEvent(event); else repeatLastCursorMove(event); } #define MOVE_CURSOR_FROM_HERE() if (m_posHorz > 0) REPEAT_LAST_CURSOR_MOVE() @@ -523,15 +456,9 @@ void displayWarning(uint8_t event); #define MOVE_CURSOR_FROM_HERE() REPEAT_LAST_CURSOR_MOVE() #endif -#if defined(PCBTARANIS) - #define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? (MAXCOL((uint16_t)2) >= HIDDEN_ROW ? 3 : 2) : 1) : 0) - #define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0) - #define EDIT_MODE_INIT 0 // TODO enum -#else - #define POS_VERT_INIT 0 - #define POS_HORZ_INIT(posVert) 0 - #define EDIT_MODE_INIT -1 -#endif +#define POS_VERT_INIT 0 +#define POS_HORZ_INIT(posVert) 0 +#define EDIT_MODE_INIT -1 typedef int16_t (*FnFuncP) (int16_t x); void DrawFunction(FnFuncP fn, uint8_t offset=0); diff --git a/radio/src/gui/view_about.cpp b/radio/src/gui/9X/view_about.cpp old mode 100644 new mode 100755 similarity index 85% rename from radio/src/gui/view_about.cpp rename to radio/src/gui/9X/view_about.cpp index c994476b8..67b0254f2 --- a/radio/src/gui/view_about.cpp +++ b/radio/src/gui/9X/view_about.cpp @@ -34,18 +34,11 @@ * */ -#include "../opentx.h" +#include "../../opentx.h" -#if defined(COLORLCD) -#elif defined(PCBTARANIS) - const pm_uchar about_bmp[] PROGMEM = { - #include "../bitmaps/Taranis/about.lbm" - }; -#else - const pm_uchar about_bmp[] PROGMEM = { - #include "../bitmaps/9X/about.lbm" - }; -#endif +const pm_uchar about_bmp[] PROGMEM = { +#include "../../bitmaps/9X/about.lbm" +}; enum AboutScreens { ABOUT_OPENTX, @@ -62,13 +55,8 @@ enum AboutScreens { ABOUT_COUNT, }; -#if defined(PCBTARANIS) - #define ABOUT_X 62 - #define ABOUT_INDENT 6 -#else - #define ABOUT_X 2 - #define ABOUT_INDENT 4 -#endif +#define ABOUT_X 2 +#define ABOUT_INDENT 4 void menuAboutView(uint8_t event) { @@ -94,20 +82,10 @@ void menuAboutView(uint8_t event) break; } -#if defined(COLORLCD) - LcdFlags att = GREY(max(0, 15-greyIndex/2)); -#elif defined(PCBTARANIS) - lcd_bmp(0, 0, about_bmp); - lcd_putsAtt(64, 0, STR_ABOUTUS, DBLSIZE); - lcd_hline(ABOUT_X, 18, 120); - lcd_hline(ABOUT_X, 19, 130, GREY_DEFAULT); - LcdFlags att = GREY(max(0, 15-greyIndex/2)); -#else lcd_putsAtt(17, 0, STR_ABOUTUS, DBLSIZE|INVERS); lcd_hline(17, 16, LCD_W-17); lcd_img(8, 0, about_bmp, 0); LcdFlags att = 0; -#endif uint8_t screenDuration = 150; diff --git a/radio/src/gui/view_mavlink.cpp b/radio/src/gui/9X/view_mavlink.cpp old mode 100644 new mode 100755 similarity index 99% rename from radio/src/gui/view_mavlink.cpp rename to radio/src/gui/9X/view_mavlink.cpp index d56302912..a5ece6f37 --- a/radio/src/gui/view_mavlink.cpp +++ b/radio/src/gui/9X/view_mavlink.cpp @@ -41,7 +41,7 @@ * Contains the menu specific code for Mavlink support. */ -#include "gui/view_mavlink.h" +#include "view_mavlink.h" // Globals declaration diff --git a/radio/src/gui/view_mavlink.h b/radio/src/gui/9X/view_mavlink.h old mode 100644 new mode 100755 similarity index 100% rename from radio/src/gui/view_mavlink.h rename to radio/src/gui/9X/view_mavlink.h diff --git a/radio/src/gui/Taranis/fonts.cpp b/radio/src/gui/Taranis/fonts.cpp new file mode 100755 index 000000000..0d9cc55d8 --- /dev/null +++ b/radio/src/gui/Taranis/fonts.cpp @@ -0,0 +1,158 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../../opentx.h" + +const pm_uchar font_5x7[] PROGMEM = { +#include "font_05x07.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_05x07.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_05x07.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_05x07.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_05x07.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_05x07.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_05x07.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_05x07.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_05x07.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_05x07.lbm" +#endif +}; + +#if defined(BOLD_FONT) +const pm_uchar font_5x7_B[] PROGMEM = { +#include "font_05x07_B_compressed.lbm" +}; +#endif + +#if !defined(BOOT) +const pm_uchar font_10x14[] PROGMEM = { +#include "font_10x14_compressed.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_10x14.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_10x14.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_10x14.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_10x14.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_10x14.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_10x14.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_10x14.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_10x14.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_10x14.lbm" +#endif +}; + +const pm_uchar font_3x5[] PROGMEM = { +#include "font_03x05.lbm" +}; + +const pm_uchar font_4x6[] PROGMEM = { +#include "font_04x06.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_04x06.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_04x06.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_04x06.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_04x06.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_04x06.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_04x06.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_04x06.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_04x06.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_04x06.lbm" +#endif +}; + +const pm_uchar font_8x10[] PROGMEM = { +#include "font_08x10.lbm" +#if defined(TRANSLATIONS_DE) +#include "font_de_08x10.lbm" +#elif defined(TRANSLATIONS_CZ) +#include "font_cz_08x10.lbm" +#elif defined(TRANSLATIONS_ES) +#include "font_es_08x10.lbm" +#elif defined(TRANSLATIONS_FI) +#include "font_fi_08x10.lbm" +#elif defined(TRANSLATIONS_FR) +#include "font_fr_08x10.lbm" +#elif defined(TRANSLATIONS_IT) +#include "font_it_08x10.lbm" +#elif defined(TRANSLATIONS_PL) +#include "font_pl_08x10.lbm" +#elif defined(TRANSLATIONS_PT) +#include "font_pt_08x10.lbm" +#elif defined(TRANSLATIONS_SE) +#include "font_se_08x10.lbm" +#endif +}; + +const pm_uchar font_22x38_num[] PROGMEM = { +#include "font_22x38_num.lbm" +}; + +const pm_uchar font_4x6_extra[] PROGMEM = { +#include "font_04x06_extra.lbm" +}; + +const pm_uchar font_5x7_extra[] PROGMEM = { +#include "font_05x07_extra.lbm" +}; + +const pm_uchar font_10x14_extra[] PROGMEM = { +#include "font_10x14_extra.lbm" +}; + +#endif // !defined(BOOT) diff --git a/radio/src/gui/Taranis/gui.h b/radio/src/gui/Taranis/gui.h index 8bf89da73..6f8fd0ffc 100755 --- a/radio/src/gui/Taranis/gui.h +++ b/radio/src/gui/Taranis/gui.h @@ -34,6 +34,8 @@ * */ +#include "menus.h" + #define DEFAULT_SCROLLBAR_X (LCD_W-1) #define NUM_BODY_LINES (LCD_LINES-1) #define MENU_TITLE_HEIGHT FH diff --git a/radio/src/gui/Taranis/menu_general.cpp b/radio/src/gui/Taranis/menu_general.cpp new file mode 100755 index 000000000..666e8a8be --- /dev/null +++ b/radio/src/gui/Taranis/menu_general.cpp @@ -0,0 +1,105 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../../opentx.h" + +extern LP_CONST LanguagePack czLanguagePack; +extern LP_CONST LanguagePack enLanguagePack; +extern LP_CONST LanguagePack esLanguagePack; +extern LP_CONST LanguagePack frLanguagePack; +extern LP_CONST LanguagePack deLanguagePack; +extern LP_CONST LanguagePack itLanguagePack; +extern LP_CONST LanguagePack plLanguagePack; +extern LP_CONST LanguagePack ptLanguagePack; +extern LP_CONST LanguagePack skLanguagePack; +extern LP_CONST LanguagePack seLanguagePack; +extern LP_CONST LanguagePack huLanguagePack; + +const LanguagePack * LP_CONST languagePacks[] = { + // alphabetical order + &czLanguagePack, + &deLanguagePack, + &enLanguagePack, + &esLanguagePack, + &frLanguagePack, + &huLanguagePack, + &itLanguagePack, + &plLanguagePack, + &ptLanguagePack, + &seLanguagePack, + &skLanguagePack, + NULL +}; + +void menuGeneralSetup(uint8_t event); +void menuGeneralSdManager(uint8_t event); +void menuGeneralCustomFunctions(uint8_t event); +void menuGeneralTrainer(uint8_t event); +void menuGeneralVersion(uint8_t event); +void menuGeneralDiagKeys(uint8_t event); +void menuGeneralDiagAna(uint8_t event); +void menuGeneralHardware(uint8_t event); +void menuGeneralCalib(uint8_t event); + +enum EnumTabDiag { + e_Setup, + e_Sd, + e_GeneralCustomFunctions, + e_Trainer, + e_Vers, + e_Keys, + e_Ana, + e_Hardware, + e_Calib +}; + +const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = { + menuGeneralSetup, + menuGeneralSdManager, + menuGeneralCustomFunctions, + menuGeneralTrainer, + menuGeneralVersion, + menuGeneralDiagKeys, + menuGeneralDiagAna, + menuGeneralHardware, + menuGeneralCalib +}; + +void menuGeneralCustomFunctions(uint8_t event) +{ + MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/}); + return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext); +} diff --git a/radio/src/gui/Taranis/menu_general_setup.cpp b/radio/src/gui/Taranis/menu_general_setup.cpp index 3ce1c9844..acdf7f69f 100755 --- a/radio/src/gui/Taranis/menu_general_setup.cpp +++ b/radio/src/gui/Taranis/menu_general_setup.cpp @@ -145,11 +145,11 @@ void menuGeneralSetup(uint8_t event) switch (j) { case 0: lcd_outdezAtt(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0); + if (rowattr && s_editMode>0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0); break; case 1: lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, t.tm_mon+1, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0); + if (rowattr && s_editMode>0) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0); break; case 2: { @@ -158,7 +158,7 @@ void menuGeneralSetup(uint8_t event) static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; dlim += pgm_read_byte(&dmon[t.tm_mon]); lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); + if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); break; } } @@ -177,15 +177,15 @@ void menuGeneralSetup(uint8_t event) switch (j) { case 0: lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0); + if (rowattr && s_editMode>0) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0); break; case 1: lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN+3*FWNUM, y, t.tm_min, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0); + if (rowattr && s_editMode>0) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0); break; case 2: lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN+6*FWNUM, y, t.tm_sec, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0); + if (rowattr && s_editMode>0) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0); break; } } diff --git a/radio/src/gui/Taranis/menu_model.cpp b/radio/src/gui/Taranis/menu_model.cpp new file mode 100755 index 000000000..627eeaf27 --- /dev/null +++ b/radio/src/gui/Taranis/menu_model.cpp @@ -0,0 +1,211 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../../opentx.h" + +// TODO elsewhere! +#define WCHART (LCD_H/2) +#define X0 (LCD_W-WCHART-2) +#define Y0 (LCD_H/2) + +enum EnumTabModel { + e_ModelSelect, + e_ModelSetup, + CASE_HELI(e_Heli) + CASE_FLIGHT_MODES(e_FlightModesAll) + e_InputsAll, + e_MixAll, + e_Limits, + CASE_CURVES(e_CurvesAll) + CASE_GVARS(e_GVars) + e_LogicalSwitches, + e_CustomFunctions, +#if defined(LUA_MODEL_SCRIPTS) + e_CustomScripts, +#endif + CASE_FRSKY(e_Telemetry) + CASE_MAVLINK(e_MavSetup) + CASE_TEMPLATES(e_Templates) +}; + +void menuModelSelect(uint8_t event); +void menuModelSetup(uint8_t event); +void menuModelHeli(uint8_t event); +void menuModelFlightModesAll(uint8_t event); +void menuModelExposAll(uint8_t event); +void menuModelMixAll(uint8_t event); +void menuModelLimits(uint8_t event); +void menuModelCurvesAll(uint8_t event); +void menuModelCurveOne(uint8_t event); +void menuModelGVars(uint8_t event); +void menuModelLogicalSwitches(uint8_t event); +void menuModelCustomFunctions(uint8_t event); +void menuModelCustomScripts(uint8_t event); +void menuModelTelemetry(uint8_t event); +void menuModelExpoOne(uint8_t event); + +extern uint8_t s_curveChan; + +#define FlightModesType uint16_t + +void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, uint8_t attr); + +#if MENU_COLUMNS < 2 + #define MIXES_2ND_COLUMN (18*FW) +#else + #define MIXES_2ND_COLUMN (9*FW) +#endif + +#if MENU_COLUMNS > 1 +uint8_t editDelay(const coord_t x, const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) +{ + lcd_puts(x, y, str); + lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); + if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); + return delay; +} +#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay) +#else +uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, const pm_char *str, uint8_t delay) +{ + lcd_putsLeft(y, str); + lcd_outdezAtt(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT); + if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX); + return delay; +} +#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay) +#endif + +const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = { + menuModelSelect, + menuModelSetup, + CASE_HELI(menuModelHeli) + CASE_FLIGHT_MODES(menuModelFlightModesAll) + menuModelExposAll, + menuModelMixAll, + menuModelLimits, + CASE_CURVES(menuModelCurvesAll) +#if defined(GVARS) && defined(FLIGHT_MODES) + CASE_GVARS(menuModelGVars) +#endif + menuModelLogicalSwitches, + menuModelCustomFunctions, +#if defined(LUA_MODEL_SCRIPTS) + menuModelCustomScripts, +#endif + CASE_FRSKY(menuModelTelemetry) + CASE_MAVLINK(menuTelemetryMavlinkSetup) + CASE_TEMPLATES(menuModelTemplates) +}; + +#define COPY_MODE 1 +#define MOVE_MODE 2 +static uint8_t s_copyMode = 0; +static int8_t s_copySrcRow; +static int8_t s_copyTgtOfs; + +static uint8_t editNameCursorPos = 0; + +void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active) +{ + uint8_t mode = 0; + if (active) { + if (s_editMode <= 0) + mode = INVERS + FIXEDWIDTH; + else + mode = FIXEDWIDTH; + } + + lcd_putsnAtt(x, y, name, size, ZCHAR | mode); + + if (active) { + uint8_t cur = editNameCursorPos; + if (s_editMode > 0) { + int8_t c = name[cur]; + int8_t v = c; + + if (IS_ROTARY_RIGHT(event) || IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP) + || event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP)) { + v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0); + if (c <= 0) v = -v; + } + + switch (event) { + case EVT_ROTARY_BREAK: + if (s_editMode == EDIT_MODIFY_FIELD) { + s_editMode = EDIT_MODIFY_STRING; + cur = 0; + } + else if (cur=-26 && v<=26) { + v = -v; // toggle case + if (event==EVT_KEY_LONG(KEY_LEFT)) + killEvents(KEY_LEFT); + } + break; + } + + if (c != v) { + name[cur] = v; + eeDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL); + } + + lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH); + } + else { + cur = 0; + } + editNameCursorPos = cur; + } +} + +void editSingleName(coord_t x, coord_t y, const pm_char *label, char *name, uint8_t size, uint8_t event, uint8_t active) +{ + lcd_putsLeft(y, label); + editName(x, y, name, size, event, active); +} + +static uint8_t s_currIdx; diff --git a/radio/src/gui/Taranis/menu_model_custom_functions.cpp b/radio/src/gui/Taranis/menu_model_custom_functions.cpp index b40aed294..9dd5d7bae 100644 --- a/radio/src/gui/Taranis/menu_model_custom_functions.cpp +++ b/radio/src/gui/Taranis/menu_model_custom_functions.cpp @@ -146,7 +146,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu uint8_t func = CFN_FUNC(cfn); for (uint8_t j=0; j<5; j++) { uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0); - uint8_t active = (attr && (s_editMode>0 || p1valdiff)); + uint8_t active = (attr && s_editMode>0); switch (j) { case 0: putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext.activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0)); diff --git a/radio/src/gui/Taranis/menu_model_flightmodes.cpp b/radio/src/gui/Taranis/menu_model_flightmodes.cpp index 5ed29a1f5..a17603a5c 100755 --- a/radio/src/gui/Taranis/menu_model_flightmodes.cpp +++ b/radio/src/gui/Taranis/menu_model_flightmodes.cpp @@ -113,7 +113,7 @@ void menuModelFlightModesAll(uint8_t event) for (uint8_t j=0; j0) ? BLINK|INVERS : INVERS) : 0); - uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ; + uint8_t active = (attr && s_editMode>0) ; switch (j) { case ITEM_FLIGHT_MODES_NAME: editName(4*FW-1, y, p->name, sizeof(p->name), event, attr); diff --git a/radio/src/gui/Taranis/menu_model_gvars.cpp b/radio/src/gui/Taranis/menu_model_gvars.cpp index b3c8a1c1e..4e48e5fd3 100755 --- a/radio/src/gui/Taranis/menu_model_gvars.cpp +++ b/radio/src/gui/Taranis/menu_model_gvars.cpp @@ -131,7 +131,7 @@ void menuModelGVars(uint8_t event) v = (v > GVAR_MAX ? 0 : GVAR_MAX+1); eeDirty(EE_MODEL); } - else if (s_editMode>0 || p1valdiff) { + else if (s_editMode>0) { v = checkIncDec(event, v, vmin, vmax, EE_MODEL); } } diff --git a/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp b/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp index 685773401..95d39e819 100644 --- a/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp +++ b/radio/src/gui/Taranis/menu_model_inputs_mixes.cpp @@ -60,7 +60,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes } if (attr) { - if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) { + if (s_editMode && event==EVT_KEY_BREAK(KEY_ENTER)) { s_editMode = 0; value ^= (1<0) ? BLINK|INVERS : INVERS) : 0); - uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ; + uint8_t active = (attr && s_editMode>0) ; if (active) STICK_SCROLL_DISABLE(); switch(j) { diff --git a/radio/src/gui/Taranis/menu_model_logical_switches.cpp b/radio/src/gui/Taranis/menu_model_logical_switches.cpp index 38124c3dc..e66644e5d 100755 --- a/radio/src/gui/Taranis/menu_model_logical_switches.cpp +++ b/radio/src/gui/Taranis/menu_model_logical_switches.cpp @@ -234,7 +234,7 @@ void menuModelLogicalSwitches(uint8_t event) REPEAT_LAST_CURSOR_MOVE(); } - if ((s_editMode>0 || p1valdiff) && attr) { + if (s_editMode>0 && attr) { switch (horz) { case LS_FIELD_FUNCTION: { diff --git a/radio/src/gui/Taranis/menu_model_setup.cpp b/radio/src/gui/Taranis/menu_model_setup.cpp index 68a6cb894..e06142645 100644 --- a/radio/src/gui/Taranis/menu_model_setup.cpp +++ b/radio/src/gui/Taranis/menu_model_setup.cpp @@ -201,7 +201,7 @@ void menuModelSetup(uint8_t event) putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0); putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0); if (attr && m_posHorz < 0) drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1); - if (attr && (editMode>0 || p1valdiff)) { + if (attr && editMode>0) { div_t qr = div(timer->start, 60); switch (m_posHorz) { case 0: @@ -463,7 +463,7 @@ void menuModelSetup(uint8_t event) lcd_putsiAtt(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<0 || p1valdiff)) { + if (attr && editMode>0) { switch (m_posHorz) { case 0: g_model.externalModule = checkIncDec(event, g_model.externalModule, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable); @@ -552,7 +552,7 @@ void menuModelSetup(uint8_t event) lcd_outdezAtt(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (m_posHorz==0 ? attr : 0)); lcd_putc(lcdLastPos, y, '-'); lcd_outdezAtt(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (m_posHorz==1 ? attr : 0)); - if (attr && (editMode>0 || p1valdiff)) { + if (attr && editMode>0) { switch (m_posHorz) { case 0: CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount); @@ -583,7 +583,7 @@ void menuModelSetup(uint8_t event) lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0); lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0); - if (attr && (editMode>0 || p1valdiff)) { + if (attr && editMode>0) { switch (m_posHorz) { case 0: CHECK_INCDEC_MODELVAR(event, moduleData.ppmFrameLength, -20, 35); @@ -611,7 +611,7 @@ void menuModelSetup(uint8_t event) if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx)) { if (xOffsetBind) lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId, (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2); if (attr && l_posHorz==0) { - if (editMode>0 || p1valdiff) { + if (editMode>0) { CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId, IS_MODULE_DSM2(moduleIdx) ? 20 : 63); if (checkIncDec_Ret) { modelHeaders[g_eeGeneral.currModel].modelId = g_model.header.modelId; @@ -650,7 +650,7 @@ void menuModelSetup(uint8_t event) if (moduleData.failsafeMode != FAILSAFE_CUSTOM) m_posHorz = 0; if (m_posHorz==0) { - if (editMode>0 || p1valdiff) { + if (editMode>0) { CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.failsafeMode, FAILSAFE_LAST); if (checkIncDec_Ret) SEND_FAILSAFE_NOW(moduleIdx); } diff --git a/radio/src/gui/Taranis/menu_model_telemetry.cpp b/radio/src/gui/Taranis/menu_model_telemetry.cpp index c5aad2c9c..dbacaa0b5 100644 --- a/radio/src/gui/Taranis/menu_model_telemetry.cpp +++ b/radio/src/gui/Taranis/menu_model_telemetry.cpp @@ -516,7 +516,7 @@ void menuModelTelemetry(uint8_t event) uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1; lcd_putsLeft(y, (alarm==0 ? STR_LOWALARM : STR_CRITICALALARM)); lcd_outdezNAtt(TELEM_COL2, y, getRssiAlarmValue(alarm), LEFT|attr, 3); - if (attr && (s_editMode>0 || p1valdiff)) { + if (attr && s_editMode>0) { CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30); } break; @@ -541,7 +541,7 @@ void menuModelTelemetry(uint8_t event) lcd_outdezAtt(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1); lcd_outdezAtt(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1); lcd_outdezAtt(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0)); - if (attr && (s_editMode>0 || p1valdiff)) { + if (attr && s_editMode>0) { switch (m_posHorz) { case 0: CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7); @@ -669,7 +669,7 @@ void menuModelTelemetry(uint8_t event) else if (attr) { MOVE_CURSOR_FROM_HERE(); } - if (attr && (s_editMode>0 || p1valdiff)) { + if (attr && s_editMode>0) { switch (m_posHorz) { case 0: bar.source = CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, barSource, MIXSRC_LAST_TELEM, isSourceAvailable); @@ -695,7 +695,7 @@ void menuModelTelemetry(uint8_t event) source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c]; uint8_t pos[] = {TELEM_COL1, TELEM_COL2, TELEM_COL3}; putsMixerSource(pos[c], y, value, cellAttr); - if (cellAttr && (s_editMode>0 || p1valdiff)) { + if (cellAttr && s_editMode>0) { CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, MIXSRC_LAST_TELEM, isSourceAvailable); } } diff --git a/radio/src/gui/Taranis/menus.cpp b/radio/src/gui/Taranis/menus.cpp new file mode 100755 index 000000000..2f5e0c059 --- /dev/null +++ b/radio/src/gui/Taranis/menus.cpp @@ -0,0 +1,85 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../../opentx.h" + +MenuFuncP g_menuStack[5]; +uint8_t menuEvent = 0; +uint8_t g_menuPos[4]; +uint8_t g_menuStackPtr = 0; + +void popMenu() +{ + assert(g_menuStackPtr>0); + g_menuStackPtr = g_menuStackPtr-1; + menuEvent = EVT_ENTRY_UP; +} + +void chainMenu(MenuFuncP newMenu) +{ + g_menuStack[g_menuStackPtr] = newMenu; + menuEvent = EVT_ENTRY; +} + +void pushMenu(MenuFuncP newMenu) +{ + killEvents(KEY_ENTER); + + if (g_menuStackPtr == 0) { + if (newMenu == menuGeneralSetup) + g_menuPos[0] = 1; + if (newMenu == menuModelSelect) + g_menuPos[0] = 0; + } + else { + g_menuPos[g_menuStackPtr] = m_posVert; + } + + g_menuStackPtr++; + + assert(g_menuStackPtr < DIM(g_menuStack)); + + g_menuStack[g_menuStackPtr] = newMenu; + menuEvent = EVT_ENTRY; +} + +void pushModelNotes() +{ + char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/"; + char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel); + strcpy(buf, TEXT_EXT); + pushMenuTextView(filename); +} diff --git a/radio/src/gui/Taranis/menus.h b/radio/src/gui/Taranis/menus.h new file mode 100755 index 000000000..38240260e --- /dev/null +++ b/radio/src/gui/Taranis/menus.h @@ -0,0 +1,378 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _MENUS_H_ +#define _MENUS_H_ + +#define NO_HI_LEN 25 + +#if defined(TRANSLATIONS_FR) + #define MENU_COLUMNS 1 + #define COLUMN_X 0 +#else + #define MENU_COLUMNS 2 +#endif + +#define MENUS_SCROLLBAR_WIDTH 2 +#define MENU_COLUMN2_X (8 + LCD_W / 2) +#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH)) ? MENU_COLUMN2_X : 0, y, str) + +// Menus related stuff ... +typedef uint16_t vertpos_t; + +typedef uint8_t & check_event_t; +#define horzpos_t int8_t + +extern tmr10ms_t menuEntryTime; + +extern vertpos_t m_posVert; +extern horzpos_t m_posHorz; +extern vertpos_t s_pgOfs; +extern uint8_t s_noHi; +extern uint8_t calibrationState; + +void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr); + +typedef void (*MenuFuncP)(uint8_t event); +typedef void (*MenuFuncP_PROGMEM)(uint8_t event); +extern const MenuFuncP_PROGMEM menuTabModel[]; +extern const MenuFuncP_PROGMEM menuTabGeneral[]; +extern const MenuFuncP_PROGMEM menuTabFPV[]; +extern const MenuFuncP_PROGMEM menuTabTelemetry[]; + +extern MenuFuncP g_menuStack[5]; +extern uint8_t g_menuPos[4]; +extern uint8_t g_menuStackPtr; +extern uint8_t menuEvent; + +/// goto given Menu, but substitute current menu in menuStack +void chainMenu(MenuFuncP newMenu); +/// goto given Menu, store current menu in menuStack +void pushMenu(MenuFuncP newMenu); +/// return to last menu in menustack +void popMenu(); +///deliver address of last menu which was popped from +inline MenuFuncP lastPopMenu() +{ + return g_menuStack[g_menuStackPtr+1]; +} + +void drawPotsBars(); +void doMainScreenGraphics(); +void menuFirstCalib(uint8_t event); + +void onMainViewMenu(const char *result); +void menuMainView(uint8_t event); +void menuGeneralDiagAna(uint8_t event); +#if defined(FRSKY) +void menuTelemetryFrsky(uint8_t event); +#endif +void menuGeneralSetup(uint8_t event); +void menuGeneralCalib(uint8_t event); +void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext); + +void menuModelSelect(uint8_t event); +void menuModelCustomFunctions(uint8_t event); +void menuStatisticsView(uint8_t event); +void menuStatisticsDebug(uint8_t event); +void menuAboutView(uint8_t event); +#if defined(DEBUG_TRACE_BUFFER) +void menuTraceBuffer(uint8_t event); +#endif + +void displaySlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr); + +void menuMainViewChannelsMonitor(uint8_t event); +void menuChannelsView(uint8_t event); + +extern int8_t checkIncDec_Ret; // global helper vars + +#define EDIT_SELECT_MENU -1 +#define EDIT_SELECT_FIELD 0 +#define EDIT_MODIFY_FIELD 1 +#define EDIT_MODIFY_STRING 2 +extern int8_t s_editMode; // global editmode + +// checkIncDec flags +#define EE_GENERAL 0x01 +#define EE_MODEL 0x02 +#define NO_INCDEC_MARKS 0x04 +#define INCDEC_SWITCH 0x08 +#define INCDEC_SOURCE 0x10 +#define INCDEC_REP10 0x40 +#define NO_DBLKEYS 0x80 + +// mawrow special values +#define TITLE_ROW ((uint8_t)-1) +#define HIDDEN_ROW ((uint8_t)-2) + +typedef bool (*IsValueAvailable)(int); +struct CheckIncDecStops { + const int count; + const int stops[]; + int min() const + { + return stops[0]; + } + int max() const + { + return stops[count-1]; + } + bool contains(int value) const + { + for (int i=0; i 0) REPEAT_LAST_CURSOR_MOVE() + +#define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)1) >= HIDDEN_ROW ? (MAXCOL((uint16_t)2) >= HIDDEN_ROW ? 3 : 2) : 1) : 0) +#define POS_HORZ_INIT(posVert) ((COLATTR(posVert) & NAVIGATION_LINE_BY_LINE) ? -1 : 0) +#define EDIT_MODE_INIT 0 // TODO enum + +typedef int16_t (*FnFuncP) (int16_t x); +void DrawFunction(FnFuncP fn, uint8_t offset=0); + +#endif // _MENUS_H_ diff --git a/radio/src/gui/Taranis/navigation.cpp b/radio/src/gui/Taranis/navigation.cpp index 870c39fc3..d71dad190 100755 --- a/radio/src/gui/Taranis/navigation.cpp +++ b/radio/src/gui/Taranis/navigation.cpp @@ -238,8 +238,6 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t uint8_t maxcol = MAXCOL(l_posVert); - if (p2valdiff || 0 || p1valdiff) backlightOn(); // on keypress turn the light on - if (menuTab) { int8_t cc = curr; switch (event) { @@ -286,17 +284,6 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t DISPLAY_PROGRESS_BAR(menuTab ? lcdLastPos-2*FW-((curr+1)/10*FWNUM)-2 : 20*FW+1); - if (s_editMode<=0) { - if (0) { - l_posVert = limit((int8_t)0, (int8_t)(l_posVert - 0), (int8_t)maxrow); - l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert)); - } - - if (p2valdiff && l_posVert>0) { - l_posHorz = limit((int8_t)0, (int8_t)((uint8_t)l_posHorz - p2valdiff), (int8_t)maxcol); - } - } - switch(event) { case EVT_ENTRY: diff --git a/radio/src/gui/Taranis/view_about.cpp b/radio/src/gui/Taranis/view_about.cpp new file mode 100755 index 000000000..9e544b184 --- /dev/null +++ b/radio/src/gui/Taranis/view_about.cpp @@ -0,0 +1,159 @@ +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../../opentx.h" + +enum AboutScreens { + ABOUT_OPENTX, + ABOUT_BERTRAND, + ABOUT_ANDRE, + ABOUT_MIKE, + ABOUT_KJELL, + ABOUT_MARTIN, + ABOUT_ROMOLO, + ABOUT_ROB, + ABOUT_HARDWARE, + ABOUT_PARENTS, + ABOUT_END, + ABOUT_COUNT, +}; + +#define ABOUT_X 62 +#define ABOUT_INDENT 6 + +void menuAboutView(uint8_t event) +{ + static uint8_t screenIndex; + static uint8_t greyIndex; + + switch(event) + { + case EVT_ENTRY: + screenIndex = 0; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_DOWN): + screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_UP): + screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS; + greyIndex = 0; + break; + case EVT_KEY_FIRST(KEY_EXIT): + chainMenu(menuMainView); + break; + } + + LcdFlags att = GREY(max(0, 15-greyIndex/2)); + + uint8_t screenDuration = 150; + + switch (screenIndex) { + case ABOUT_OPENTX: + case ABOUT_END: + lcd_putsAtt(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE); + lcd_putsAtt(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE); + lcd_putsAtt(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE); + lcd_putsAtt(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE); + lcd_putsAtt(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE); + screenDuration = 255; + break; + + case ABOUT_BERTRAND: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE); + break; + + case ABOUT_ANDRE: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE); + break; + + case ABOUT_MIKE: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_MIKE_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_MIKE_4, att|SMLSIZE); + break; + + case ABOUT_KJELL: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_KJELL_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_KJELL_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_KJELL_3, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_KJELL_4, att|SMLSIZE); + break; + + case ABOUT_MARTIN: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE); + break; + + case ABOUT_ROMOLO: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE); + break; + + case ABOUT_ROB: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ROB_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE); + break; + + case ABOUT_HARDWARE: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE); + break; + + case ABOUT_PARENTS: + lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE); + lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE); + screenDuration = 255; + break; + } + + if (++greyIndex == screenDuration) { + greyIndex = 0; + if (++screenIndex == ABOUT_COUNT) { + chainMenu(menuMainView); + } + } +} diff --git a/radio/src/gui/view_channels.cpp b/radio/src/gui/Taranis/view_channels.cpp old mode 100644 new mode 100755 similarity index 95% rename from radio/src/gui/view_channels.cpp rename to radio/src/gui/Taranis/view_channels.cpp index 758ca4891..ef45fdb86 --- a/radio/src/gui/view_channels.cpp +++ b/radio/src/gui/Taranis/view_channels.cpp @@ -34,7 +34,7 @@ * */ -#include "../opentx.h" +#include "../../opentx.h" void menuChannelsView(uint8_t event) { @@ -59,9 +59,7 @@ void menuChannelsView(uint8_t event) else ch = 0; -#if !defined(COLORLCD) lcd_putsCenter(0*FH, CHANNELS_MONITOR); -#endif lcd_invert_line(0); diff --git a/radio/src/gui/menu_general_calib.cpp b/radio/src/gui/menu_general_calib.cpp deleted file mode 100755 index 82aa257be..000000000 --- a/radio/src/gui/menu_general_calib.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#define XPOT_DELTA 10 -#define XPOT_DELAY 10 /* cycles */ - -void menuCommonCalib(uint8_t event) -{ - for (uint8_t i=0; i= POT1 && i <= POT_LAST) { - if (IS_POT_WITHOUT_DETENT(i)) { - reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2; - } -#if defined(PCBTARANIS) - uint8_t idx = i - POT1; - int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount; - if (IS_POT_MULTIPOS(i) && count <= XPOTS_MULTIPOS_COUNT) { - if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 0 || vt < reusableBuffer.calib.xpotsCalib[idx].lastPosition - XPOT_DELTA || vt > reusableBuffer.calib.xpotsCalib[idx].lastPosition + XPOT_DELTA) { - reusableBuffer.calib.xpotsCalib[idx].lastPosition = vt; - reusableBuffer.calib.xpotsCalib[idx].lastCount = 1; - } - else { - if (reusableBuffer.calib.xpotsCalib[idx].lastCount < 255) reusableBuffer.calib.xpotsCalib[idx].lastCount++; - } - if (reusableBuffer.calib.xpotsCalib[idx].lastCount == XPOT_DELAY) { - int16_t position = reusableBuffer.calib.xpotsCalib[idx].lastPosition; - bool found = false; - for (int j=0; j= step-XPOT_DELTA && position <= step+XPOT_DELTA) { - found = true; - break; - } - } - if (!found) { - if (count < XPOTS_MULTIPOS_COUNT) { - reusableBuffer.calib.xpotsCalib[idx].steps[count] = position; - } - reusableBuffer.calib.xpotsCalib[idx].stepsCount += 1; - } - } - } -#endif - } - } - - calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating - - switch (event) - { - case EVT_ENTRY: - reusableBuffer.calib.state = 0; - break; - - case EVT_KEY_BREAK(KEY_ENTER): - reusableBuffer.calib.state++; - break; - } - - switch (reusableBuffer.calib.state) { - case 0: - // START CALIBRATION - if (!READ_ONLY()) { - lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUTOSTART); - } - break; - - case 1: - // SET MIDPOINT - lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+FH, STR_SETMIDPOINT, INVERS); - lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUWHENDONE); - - for (uint8_t i=0; i 50) { - g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i]; - int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i]; - g_eeGeneral.calib[i].spanNeg = v - v/STICK_TOLERANCE; - v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i]; - g_eeGeneral.calib[i].spanPos = v - v/STICK_TOLERANCE; - } - } - break; - - case 3: -#if defined(PCBTARANIS) - for (uint8_t i=POT1; i<=POT_LAST; i++) { - int idx = i - POT1; - int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount; - if (IS_POT_MULTIPOS(i)) { - if (count > 1 && count <= XPOTS_MULTIPOS_COUNT) { - for (int j=0; jcount = count - 1; - for (int j=0; jcount; j++) { - calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5; - } - } - else { - g_eeGeneral.potsType &= ~(0x03<<(2*idx)); - } - } - } -#endif - g_eeGeneral.chkSum = evalChkSum(); - eeDirty(EE_GENERAL); - reusableBuffer.calib.state = 4; - break; - - default: - reusableBuffer.calib.state = 0; - break; - } - - doMainScreenGraphics(); - -#if defined(PCBTARANIS) - drawPotsBars(); - for (int i=POT1; i<=POT_LAST; i++) { - uint8_t steps = 0; - if (reusableBuffer.calib.state == 2) { - steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount; - } - else if (IS_POT_MULTIPOS(i)) { - StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i]; - steps = calib->count + 1; - } - if (steps > 0 && steps <= XPOTS_MULTIPOS_COUNT) { - lcd_outdezAtt(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE); - } - } -#endif -} - -void menuGeneralCalib(uint8_t event) -{ - check_simple(event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0); - - if (menuEvent) { - calibrationState = 0; - } - - TITLE(STR_MENUCALIBRATION); - menuCommonCalib(READ_ONLY() ? 0 : event); -} - -void menuFirstCalib(uint8_t event) -{ - if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == 4) { - calibrationState = 0; - chainMenu(menuMainView); - } - else { - lcd_putsCenter(0*FH, MENUCALIBRATION); - lcd_invert_line(0); - menuCommonCalib(event); - } -} diff --git a/radio/src/gui/menu_general_diaganas.cpp b/radio/src/gui/menu_general_diaganas.cpp deleted file mode 100755 index 8bc1aabbe..000000000 --- a/radio/src/gui/menu_general_diaganas.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -void menuGeneralDiagAna(uint8_t event) -{ -#if defined(PCBSKY9X) && !defined(REVA) - #define ANAS_ITEMS_COUNT 4 -#elif defined(PCBSKY9X) - #define ANAS_ITEMS_COUNT 3 -#else - #define ANAS_ITEMS_COUNT 2 -#endif - - SIMPLE_MENU(STR_MENUANA, menuTabGeneral, e_Ana, ANAS_ITEMS_COUNT); - - STICK_SCROLL_DISABLE(); - - for (uint8_t i=0; i 9 - coord_t y = MENU_TITLE_HEIGHT + 1 + (i/3)*FH; - const uint8_t x_coord[] = {0, 70, 154}; - uint8_t x = x_coord[i%3]; - lcd_outdezNAtt(x, y, i+1, LEADING0|LEFT, 2); - lcd_putc(x+2*FW-2, y, ':'); -#else - coord_t y = MENU_TITLE_HEIGHT + 1 + (i/2)*FH; - uint8_t x = i&1 ? 64+5 : 0; - putsStrIdx(x, y, PSTR("A"), i+1); - lcd_putc(lcdNextPos, y, ':'); -#endif - lcd_outhex4(x+3*FW-1, y, anaIn(i)); - lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256); - } - -#if !defined(CPUARM) - // Display raw BandGap result (debug) - lcd_puts(64+5, MENU_TITLE_HEIGHT+1+3*FH, STR_BG); - lcd_outdezAtt(64+5+6*FW-3, 1+4*FH, BandGap, 0); -#endif - -#if defined(PCBTARANIS) - lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_BATT_CALIB); - static int32_t adcBatt; - adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; - uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE; - batCalV >>= 11; - batCalV += 2; // because of the diode - putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+5*FH, batCalV, (m_posVert==1 ? INVERS : 0)); -#elif defined(PCBSKY9X) - lcd_putsLeft(MENU_TITLE_HEIGHT+1+4*FH, STR_BATT_CALIB); - static int32_t adcBatt; - adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; - uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128) * 4191; - batCalV /= 55296; - putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_TITLE_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0)); -#elif defined(PCBGRUVIN9X) - lcd_putsLeft(6*FH-2, STR_BATT_CALIB); - // Gruvin wants 2 decimal places and instant update of volts calib field when button pressed - static uint16_t adcBatt; - adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P) - uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap; - lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0)); -#else - lcd_putsLeft(6*FH-2, STR_BATT_CALIB); - putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0)); -#endif - if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127); - -#if defined(PCBSKY9X) && !defined(REVA) - lcd_putsLeft(6*FH+1, STR_CURRENT_CALIB); - putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ; - if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.currentCalib, -49, 49); -#endif - -#if defined(PCBSKY9X) - lcd_putsLeft(7*FH+1, STR_TEMP_CALIB); - putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 7*FH+1, getTemperature(), UNIT_TEMPERATURE, (m_posVert==3 ? INVERS : 0)) ; - if (m_posVert==3) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100); -#endif -} diff --git a/radio/src/gui/menu_general_diagkeys.cpp b/radio/src/gui/menu_general_diagkeys.cpp deleted file mode 100755 index 2e6783f1a..000000000 --- a/radio/src/gui/menu_general_diagkeys.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -void displayKeyState(uint8_t x, uint8_t y, EnumKeys key) -{ - uint8_t t = switchState(key); - lcd_putcAtt(x, y, t+'0', t ? INVERS : 0); -} - -void menuGeneralDiagKeys(uint8_t event) -{ - SIMPLE_MENU(STR_MENUDIAG, menuTabGeneral, e_Keys, 1); - - lcd_puts(14*FW, MENU_TITLE_HEIGHT+2*FH, STR_VTRIM); - - for(uint8_t i=0; i<9; i++) { - coord_t y; - - if (i<8) { - y = MENU_TITLE_HEIGHT + FH*3 + FH*(i/2); - if (i&1) lcd_img(14*FW, y, sticks, i/2, 0); - displayKeyState(i&1? 20*FW : 18*FW, y, (EnumKeys)(TRM_BASE+i)); - } - - if (i<6) { - y = i*FH+MENU_TITLE_HEIGHT+FH; - lcd_putsiAtt(0, y, STR_VKEYS, (5-i), 0); - displayKeyState(5*FW+2, y, (EnumKeys)(KEY_MENU+(5-i))); - } - -#if !defined(PCBTARANIS) - if (i != SW_ID0-SW_BASE) { - y = MENU_TITLE_HEIGHT+i*FH-2*FH; - putsSwitches(8*FW, y, i+1, 0); //ohne off,on - displayKeyState(11*FW+2, y, (EnumKeys)(SW_BASE+i)); - } -#endif - } - -#if defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION) - for(uint8_t i=0; i - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#if defined(PCBTARANIS) -enum menuGeneralHwItems { - ITEM_SETUP_HW_LABEL_STICKS, - ITEM_SETUP_HW_STICK1, - ITEM_SETUP_HW_STICK2, - ITEM_SETUP_HW_STICK3, - ITEM_SETUP_HW_STICK4, - ITEM_SETUP_HW_LABEL_POTS, - ITEM_SETUP_HW_POT1, - ITEM_SETUP_HW_POT2, - CASE_REVPLUS(ITEM_SETUP_HW_POT3) - CASE_REV9E(ITEM_SETUP_HW_POT4) - ITEM_SETUP_HW_LS, - ITEM_SETUP_HW_RS, - CASE_REV9E(ITEM_SETUP_HW_LS2) - CASE_REV9E(ITEM_SETUP_HW_RS2) - ITEM_SETUP_HW_LABEL_SWITCHES, - ITEM_SETUP_HW_SA, - ITEM_SETUP_HW_SB, - ITEM_SETUP_HW_SC, - ITEM_SETUP_HW_SD, - ITEM_SETUP_HW_SE, - ITEM_SETUP_HW_SF, - ITEM_SETUP_HW_SG, - ITEM_SETUP_HW_SH, - ITEM_SETUP_HW_SI, - ITEM_SETUP_HW_SJ, - ITEM_SETUP_HW_SK, - ITEM_SETUP_HW_SL, - ITEM_SETUP_HW_SM, - ITEM_SETUP_HW_SN, - CASE_REV9E(ITEM_SETUP_HW_SO) - CASE_REV9E(ITEM_SETUP_HW_SP) - CASE_REV9E(ITEM_SETUP_HW_SQ) - CASE_REV9E(ITEM_SETUP_HW_SR) - ITEM_SETUP_HW_UART3_MODE, - ITEM_SETUP_HW_MAX -}; - -#define HW_SETTINGS_COLUMN 15*FW - -#if defined(REVPLUS) - #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0 -#else - #define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0 -#endif - -#if defined(REV9E) - #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1 -#else - #define SWITCH_ROWS(x) uint8_t(IS_2x2POS(x) ? 0 : HIDDEN_ROW) - #define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, SWITCH_ROWS(0), SWITCH_ROWS(1), SWITCH_ROWS(2), SWITCH_ROWS(3), SWITCH_ROWS(4), SWITCH_ROWS(6) -#endif - -void menuGeneralHardware(uint8_t event) -{ - MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0}); - - uint8_t sub = m_posVert - 1; - - for (uint8_t i=0; i0) ? BLINK|INVERS : INVERS) : 0); - switch (k) { - case ITEM_SETUP_HW_LABEL_STICKS: - lcd_putsLeft(y, "Sticks"); - break; - case ITEM_SETUP_HW_STICK1: - case ITEM_SETUP_HW_STICK2: - case ITEM_SETUP_HW_STICK3: - case ITEM_SETUP_HW_STICK4: - case ITEM_SETUP_HW_LS: - case ITEM_SETUP_HW_RS: -#if defined(REV9E) - case ITEM_SETUP_HW_LS2: - case ITEM_SETUP_HW_RS2: -#endif - { - int idx = (k<=ITEM_SETUP_HW_STICK4 ? k-ITEM_SETUP_HW_STICK1 : k-ITEM_SETUP_HW_LS+7); - lcd_putsiAtt(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0); - if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr) - editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr); - else - lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); - break; - } - case ITEM_SETUP_HW_LABEL_POTS: - lcd_putsLeft(y, "Pots"); - break; - case ITEM_SETUP_HW_POT1: - case ITEM_SETUP_HW_POT2: -#if defined(REVPLUS) - case ITEM_SETUP_HW_POT3: -#endif -#if defined(REV9E) - case ITEM_SETUP_HW_POT4: -#endif - { - int idx = k - ITEM_SETUP_HW_POT1; - uint8_t shift = (2*idx); - uint8_t mask = (0x03 << shift); - lcd_putsiAtt(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, m_posHorz < 0 ? attr : 0); - if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && m_posHorz == 0)) - editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && m_posHorz == 0); - else - lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); - - uint8_t potType = (g_eeGeneral.potsType & mask) >> shift; - if (potType == POT_TYPE_NONE && k <= ITEM_SETUP_HW_POT2) - potType = POT_TYPE_DETENT; - potType = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", STR_POTTYPES, potType, 0, POT_TYPE_MAX, m_posHorz == 1 ? attr : 0, event); - if (potType == POT_TYPE_DETENT && k <= ITEM_SETUP_HW_POT2) - potType = POT_TYPE_NONE; - g_eeGeneral.potsType &= ~mask; - g_eeGeneral.potsType |= (potType << shift); - break; - } - case ITEM_SETUP_HW_LABEL_SWITCHES: - lcd_putsLeft(y, "Switches"); - break; - case ITEM_SETUP_HW_SA: - case ITEM_SETUP_HW_SB: - case ITEM_SETUP_HW_SC: - case ITEM_SETUP_HW_SD: - case ITEM_SETUP_HW_SE: - case ITEM_SETUP_HW_SF: - case ITEM_SETUP_HW_SG: - case ITEM_SETUP_HW_SH: - case ITEM_SETUP_HW_SI: - case ITEM_SETUP_HW_SJ: - case ITEM_SETUP_HW_SK: - case ITEM_SETUP_HW_SL: - case ITEM_SETUP_HW_SM: - case ITEM_SETUP_HW_SN: -#if defined(REV9E) - case ITEM_SETUP_HW_SO: - case ITEM_SETUP_HW_SP: - case ITEM_SETUP_HW_SQ: - case ITEM_SETUP_HW_SR: -#endif - { - int index = k-ITEM_SETUP_HW_SA; - char label[] = INDENT "S*"; - label[2] = 'A' + index; - int config = SWITCH_CONFIG(index); - lcd_putsAtt(0, y, label, m_posHorz < 0 ? attr : 0); - if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && m_posHorz == 0)) - editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, m_posHorz == 0 ? attr : 0); - else - lcd_putsiAtt(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0); -#if defined(REV9E) - config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", "\007None\0 DefaultToggle\0""2POS\0 3POS\0", config, SWITCH_NONE, SWITCH_3POS, m_posHorz == 1 ? attr : 0, event); - if (attr && checkIncDec_Ret) { - uint32_t mask = 0x0f << (4*index); - TRACE("avant %x", g_eeGeneral.switchConfig); - g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((uint32_t(config)&0xf) << (4*index)); - TRACE("apres %x", g_eeGeneral.switchConfig); - } -#else - if (k <= ITEM_SETUP_HW_SH) { - config = selectMenuItem(HW_SETTINGS_COLUMN+5*FW, y, "", "\007DefaultToggle\0""2POS\0 3POS\0 2x2POS\0", config, SWITCH_NONE, SWITCH_2x2POS, m_posHorz == 1 ? attr : 0, event); - if (attr && checkIncDec_Ret) { - uint32_t mask = 0x0f << (4*index); - g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | (((uint32_t)(config)&0xf) << (4*index)); - } - } -#endif - break; - } - case ITEM_SETUP_HW_UART3_MODE: - g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event); - if (attr && checkIncDec_Ret) { - uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL()); - } - break; - } - } -} - -#elif defined(PCBSKY9X) - -enum menuGeneralHwItems { - ITEM_SETUP_HW_OPTREX_DISPLAY, - ITEM_SETUP_HW_STICKS_GAINS_LABELS, - ITEM_SETUP_HW_STICK_LV_GAIN, - ITEM_SETUP_HW_STICK_LH_GAIN, - ITEM_SETUP_HW_STICK_RV_GAIN, - ITEM_SETUP_HW_STICK_RH_GAIN, - IF_ROTARY_ENCODERS(ITEM_SETUP_HW_ROTARY_ENCODER) - CASE_BLUETOOTH(ITEM_SETUP_HW_BT_BAUDRATE) - ITEM_SETUP_HW_MAX -}; - -#define GENERAL_HW_PARAM_OFS (2+(15*FW)) -void menuGeneralHardware(uint8_t event) -{ - MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX+1, {0, 0, (uint8_t)-1, 0, 0, 0, IF_ROTARY_ENCODERS(0) CASE_BLUETOOTH(0)}); - - uint8_t sub = m_posVert - 1; - - for (uint8_t i=0; i0) ? BLINK|INVERS : INVERS); - uint8_t attr = (sub == k ? blink : 0); - - switch(k) { - case ITEM_SETUP_HW_OPTREX_DISPLAY: - g_eeGeneral.optrexDisplay = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_LCD, STR_VLCD, g_eeGeneral.optrexDisplay, 0, 1, attr, event); - break; - - case ITEM_SETUP_HW_STICKS_GAINS_LABELS: - lcd_putsLeft(y, PSTR("Sticks")); - break; - - case ITEM_SETUP_HW_STICK_LV_GAIN: - case ITEM_SETUP_HW_STICK_LH_GAIN: - case ITEM_SETUP_HW_STICK_RV_GAIN: - case ITEM_SETUP_HW_STICK_RH_GAIN: - { - lcd_putsiAtt(INDENT_WIDTH, y, PSTR("\002LVLHRVRH"), k-ITEM_SETUP_HW_STICK_LV_GAIN, 0); - lcd_puts(INDENT_WIDTH+3*FW, y, PSTR("Gain")); - uint8_t mask = (1<<(k-ITEM_SETUP_HW_STICK_LV_GAIN)); - uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0); - lcd_putcAtt(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr); - if (attr) { - CHECK_INCDEC_GENVAR(event, val, 0, 1); - if (checkIncDec_Ret) { - g_eeGeneral.sticksGain ^= mask; - setSticksGain(g_eeGeneral.sticksGain); - } - } - break; - } - -#if defined(ROTARY_ENCODERS) - case ITEM_SETUP_HW_ROTARY_ENCODER: - g_eeGeneral.rotarySteps = selectMenuItem(GENERAL_HW_PARAM_OFS, y, PSTR("Rotary Encoder"), PSTR("\0062steps4steps"), g_eeGeneral.rotarySteps, 0, 1, attr, event); - break; -#endif - -#if defined(BLUETOOTH) - case ITEM_SETUP_HW_BT_BAUDRATE: - g_eeGeneral.btBaudrate = selectMenuItem(GENERAL_HW_PARAM_OFS, y, STR_BAUDRATE, PSTR("\005115k 9600 19200"), g_eeGeneral.btBaudrate, 0, 2, attr, event); - if (attr && checkIncDec_Ret) { - btInit(); - } - break; -#endif - - } - } -} -#endif diff --git a/radio/src/gui/menu_general_sdmanager.cpp b/radio/src/gui/menu_general_sdmanager.cpp deleted file mode 100755 index 17d4d998b..000000000 --- a/radio/src/gui/menu_general_sdmanager.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -void menuGeneralSdManagerInfo(uint8_t event) -{ - SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1); - - lcd_putsLeft(2*FH, STR_SD_TYPE); - lcd_puts(10*FW, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD); - - lcd_putsLeft(3*FH, STR_SD_SIZE); - lcd_outdezAtt(10*FW, 3*FH, SD_GET_SIZE_MB(), LEFT); - lcd_putc(lcdLastPos, 3*FH, 'M'); - - lcd_putsLeft(4*FH, STR_SD_SECTORS); - lcd_outdezAtt(10*FW, 4*FH, SD_GET_BLOCKNR()/1000, LEFT); - lcd_putc(lcdLastPos, 4*FH, 'k'); - - lcd_putsLeft(5*FH, STR_SD_SPEED); - lcd_outdezAtt(10*FW, 5*FH, SD_GET_SPEED()/1000, LEFT); - lcd_puts(lcdLastPos, 5*FH, "kb/s"); -} - -inline bool isFilenameGreater(bool isfile, const char * fn, const char * line) -{ - return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) > 0); -} - -inline bool isFilenameLower(bool isfile, const char * fn, const char * line) -{ - return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0); -} - -#if defined(PCBTARANIS) -void flashBootloader(const char * filename) -{ - FIL file; - f_open(&file, filename, FA_READ); - uint8_t buffer[1024]; - UINT count; - - lcd_clear(); - lcd_putsLeft(4*FH, STR_WRITING); - lcd_rect(3, 6*FH+4, 204, 7); - lcdRefresh(); - - static uint8_t unlocked = 0; - if (!unlocked) { - unlocked = 1; - unlockFlash(); - } - - for (int i=0; i 0) - s_editMode = 0; - - switch(_event) { - case EVT_ENTRY: - f_chdir(ROOT_PATH); - reusableBuffer.sdmanager.offset = 65535; - break; - -#if defined(PCBTARANIS) - case EVT_KEY_LONG(KEY_MENU): - if (!READ_ONLY()) { - killEvents(_event); - // MENU_ADD_ITEM(STR_SD_INFO); TODO: Implement - MENU_ADD_ITEM(STR_SD_FORMAT); - menuHandler = onSdManagerMenu; - } - break; -#endif - -#if defined(PCBTARANIS) - case EVT_KEY_BREAK(KEY_ENTER): -#else - CASE_EVT_ROTARY_BREAK - case EVT_KEY_FIRST(KEY_RIGHT): - case EVT_KEY_FIRST(KEY_ENTER): -#endif - { - if (m_posVert > 0) { - vertpos_t index = m_posVert-1-s_pgOfs; - if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) { - f_chdir(reusableBuffer.sdmanager.lines[index]); - s_pgOfs = 0; - m_posVert = 1; - reusableBuffer.sdmanager.offset = 65535; - killEvents(_event); - break; - } - } - if (!IS_ROTARY_BREAK(_event) || m_posVert==0) - break; - // no break; - } - - case EVT_KEY_LONG(KEY_ENTER): - killEvents(_event); -#if !defined(PCBTARANIS) - if (m_posVert == 0) { - MENU_ADD_ITEM(STR_SD_INFO); - MENU_ADD_ITEM(STR_SD_FORMAT); - } - else -#endif - { -#if defined(CPUARM) - uint8_t index = m_posVert-1-s_pgOfs; - // TODO duplicated code for finding extension - char * ext = reusableBuffer.sdmanager.lines[index]; - int len = strlen(ext) - 4; - ext += len; - /* TODO if (!strcasecmp(ext, MODELS_EXT)) { - s_menu[s_menu_count++] = STR_LOAD_FILE; - } - else */ if (!strcasecmp(ext, SOUNDS_EXT)) { - MENU_ADD_ITEM(STR_PLAY_FILE); - } -#endif -#if defined(PCBTARANIS) - else if (!strcasecmp(ext, BITMAPS_EXT) && !READ_ONLY() && len <= (int)sizeof(g_model.header.bitmap)) { - MENU_ADD_ITEM(STR_ASSIGN_BITMAP); - } - else if (!strcasecmp(ext, TEXT_EXT)) { - MENU_ADD_ITEM(STR_VIEW_TEXT); - } - else if (!strcasecmp(ext, FIRMWARE_EXT) && !READ_ONLY()) { - MENU_ADD_ITEM(STR_FLASH_BOOTLOADER); - } -#endif -#if defined(LUA) - else if (!strcasecmp(ext, SCRIPTS_EXT)) { - MENU_ADD_ITEM(STR_EXECUTE_FILE); - } -#endif - if (!READ_ONLY()) { - MENU_ADD_ITEM(STR_DELETE_FILE); - // MENU_ADD_ITEM(STR_RENAME_FILE); TODO: Implement - // MENU_ADD_ITEM(STR_COPY_FILE); TODO: Implement - } - } - menuHandler = onSdManagerMenu; - break; - } - - if (reusableBuffer.sdmanager.offset != s_pgOfs) { - if (s_pgOfs == 0) { - reusableBuffer.sdmanager.offset = 0; - memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines)); - } - else if (s_pgOfs == reusableBuffer.sdmanager.count-7) { - reusableBuffer.sdmanager.offset = s_pgOfs; - memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines)); - } - else if (s_pgOfs > reusableBuffer.sdmanager.offset) { - memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], 6*sizeof(reusableBuffer.sdmanager.lines[0])); - memset(reusableBuffer.sdmanager.lines[6], 0xff, SD_SCREEN_FILE_LENGTH); - reusableBuffer.sdmanager.lines[6][SD_SCREEN_FILE_LENGTH+1] = 1; - } - else { - memmove(reusableBuffer.sdmanager.lines[1], reusableBuffer.sdmanager.lines[0], 6*sizeof(reusableBuffer.sdmanager.lines[0])); - memset(reusableBuffer.sdmanager.lines[0], 0, sizeof(reusableBuffer.sdmanager.lines[0])); - } - - reusableBuffer.sdmanager.count = 0; - - FRESULT res = f_opendir(&dir, "."); /* Open the directory */ - if (res == FR_OK) { - for (;;) { - res = f_readdir(&dir, &fno); /* Read a directory item */ - if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */ - if (fno.fname[0] == '.' && fno.fname[1] == '\0') continue; /* Ignore dot entry */ -#if _USE_LFN - fn = *fno.lfname ? fno.lfname : fno.fname; -#else - fn = fno.fname; -#endif - if (strlen(fn) > SD_SCREEN_FILE_LENGTH) continue; - - reusableBuffer.sdmanager.count++; - - bool isfile = !(fno.fattrib & AM_DIR); - - if (s_pgOfs == 0) { - for (uint8_t i=0; i=0; i--) { - char *line = reusableBuffer.sdmanager.lines[i]; - if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) { - if (i > 0) memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], sizeof(reusableBuffer.sdmanager.lines[0]) * i); - memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[i])); - strcpy(line, fn); - line[SD_SCREEN_FILE_LENGTH+1] = isfile; - break; - } - } - } - else if (s_pgOfs > reusableBuffer.sdmanager.offset) { - if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[5]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[6])) { - memset(reusableBuffer.sdmanager.lines[6], 0, sizeof(reusableBuffer.sdmanager.lines[0])); - strcpy(reusableBuffer.sdmanager.lines[6], fn); - reusableBuffer.sdmanager.lines[6][SD_SCREEN_FILE_LENGTH+1] = isfile; - } - } - else { - if (isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[1]) && isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[0])) { - memset(reusableBuffer.sdmanager.lines[0], 0, sizeof(reusableBuffer.sdmanager.lines[0])); - strcpy(reusableBuffer.sdmanager.lines[0], fn); - reusableBuffer.sdmanager.lines[0][SD_SCREEN_FILE_LENGTH+1] = isfile; - } - } - } - } - } - - reusableBuffer.sdmanager.offset = s_pgOfs; - - for (uint8_t i=0; i 0) { - char * ext = reusableBuffer.sdmanager.lines[index]; - ext += strlen(ext) - 4; - if (!strcasecmp(ext, BITMAPS_EXT)) { - if (sdBitmapIdx != m_posVert) { - sdBitmapIdx = m_posVert; - uint8_t *dest = sdBitmap; - if (bmpLoad(dest, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) { - memcpy(sdBitmap, logo_taranis, MODEL_BITMAP_SIZE); - } - } - lcd_bmp(22*FW+2, 2*FH+FH/2, sdBitmap); - } - } -#endif -} diff --git a/radio/src/gui/menu_general_setup.cpp b/radio/src/gui/menu_general_setup.cpp deleted file mode 100755 index eae7587c7..000000000 --- a/radio/src/gui/menu_general_setup.cpp +++ /dev/null @@ -1,620 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#if LCD_W >= 212 - #define RADIO_SETUP_2ND_COLUMN (LCD_W-10*FW-MENUS_SCROLLBAR_WIDTH) - #define RADIO_SETUP_DATE_COLUMN RADIO_SETUP_2ND_COLUMN + 4*FWNUM - #define RADIO_SETUP_TIME_COLUMN RADIO_SETUP_2ND_COLUMN + 2*FWNUM -#else - #define RADIO_SETUP_2ND_COLUMN (LCD_W-6*FW-3-MENUS_SCROLLBAR_WIDTH) - #define RADIO_SETUP_TIME_COLUMN (FW*15+9) - #define RADIO_SETUP_DATE_COLUMN (FW*15+7) -#endif - -#if !defined(CPUM64) - #define SLIDER_5POS(y, value, label, event, attr) { \ - int8_t tmp = value; \ - displaySlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \ - value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ - } -#elif defined(GRAPHICS) - #define SLIDER_5POS(y, value, label, event, attr) { \ - int8_t tmp = value; \ - display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \ - value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ - } -#else - #define SLIDER_5POS(y, value, label, event, attr) value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event) -#endif - -#if defined(SPLASH) && !defined(FSPLASH) - #define CASE_SPLASH_PARAM(x) x, -#else - #define CASE_SPLASH_PARAM(x) -#endif - -enum menuGeneralSetupItems { - CASE_RTCLOCK(ITEM_SETUP_DATE) - CASE_RTCLOCK(ITEM_SETUP_TIME) - CASE_BATTGRAPH(ITEM_SETUP_BATT_RANGE) - ITEM_SETUP_SOUND_LABEL, - CASE_AUDIO(ITEM_SETUP_BEEP_MODE) - CASE_BUZZER(ITEM_SETUP_BUZZER_MODE) - CASE_VOICE(ITEM_SETUP_SPEAKER_VOLUME) - CASE_CPUARM(ITEM_SETUP_BEEP_VOLUME) - ITEM_SETUP_BEEP_LENGTH, - CASE_AUDIO(ITEM_SETUP_SPEAKER_PITCH) - CASE_CPUARM(ITEM_SETUP_WAV_VOLUME) - CASE_CPUARM(ITEM_SETUP_BACKGROUND_VOLUME) - CASE_VARIO_CPUARM(ITEM_SETUP_VARIO_LABEL) - CASE_VARIO_CPUARM(ITEM_SETUP_VARIO_VOLUME) - CASE_VARIO_CPUARM(ITEM_SETUP_VARIO_PITCH) - CASE_VARIO_CPUARM(ITEM_SETUP_VARIO_RANGE) - CASE_VARIO_CPUARM(ITEM_SETUP_VARIO_REPEAT) - CASE_HAPTIC(ITEM_SETUP_HAPTIC_LABEL) - CASE_HAPTIC(ITEM_SETUP_HAPTIC_MODE) - CASE_HAPTIC(ITEM_SETUP_HAPTIC_LENGTH) - CASE_HAPTIC(ITEM_SETUP_HAPTIC_STRENGTH) - ITEM_SETUP_CONTRAST, - ITEM_SETUP_ALARMS_LABEL, - ITEM_SETUP_BATTERY_WARNING, - CASE_PCBSKY9X(ITEM_SETUP_CAPACITY_WARNING) - CASE_PCBSKY9X(ITEM_SETUP_TEMPERATURE_WARNING) - ITEM_SETUP_INACTIVITY_ALARM, - ITEM_SETUP_MEMORY_WARNING, - ITEM_SETUP_ALARM_WARNING, - IF_ROTARY_ENCODERS(ITEM_SETUP_RE_NAVIGATION) - ITEM_SETUP_BACKLIGHT_LABEL, - ITEM_SETUP_BACKLIGHT_MODE, - ITEM_SETUP_BACKLIGHT_DELAY, - CASE_CPUARM(ITEM_SETUP_BRIGHTNESS) - CASE_REVPLUS(ITEM_SETUP_BACKLIGHT_COLOR) - CASE_PWM_BACKLIGHT(ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF) - CASE_PWM_BACKLIGHT(ITEM_SETUP_BACKLIGHT_BRIGHTNESS_ON) - ITEM_SETUP_FLASH_BEEP, - CASE_SPLASH_PARAM(ITEM_SETUP_DISABLE_SPLASH) - CASE_GPS(ITEM_SETUP_TIMEZONE) - CASE_GPS(ITEM_SETUP_GPSFORMAT) - CASE_PXX(ITEM_SETUP_COUNTRYCODE) - CASE_CPUARM(ITEM_SETUP_LANGUAGE) - CASE_CPUARM(ITEM_SETUP_IMPERIAL) - IF_FAI_CHOICE(ITEM_SETUP_FAI) - CASE_MAVLINK(ITEM_MAVLINK_BAUD) - CASE_CPUARM(ITEM_SETUP_SWITCHES_DELAY) - ITEM_SETUP_RX_CHANNEL_ORD, - ITEM_SETUP_STICK_MODE_LABELS, - ITEM_SETUP_STICK_MODE, - ITEM_SETUP_MAX -}; - -#if defined(FRSKY_STICKS) - #define COL_TX_MODE 0 -#else - #define COL_TX_MODE LABEL(TX_MODE) -#endif - -void menuGeneralSetup(uint8_t event) -{ -#if defined(RTCLOCK) - struct gtm t; - gettime(&t); - - if ((m_posVert==ITEM_SETUP_DATE+1 || m_posVert==ITEM_SETUP_TIME+1) && - (s_editMode>0) && - (event==EVT_KEY_FIRST(KEY_ENTER) || event==EVT_KEY_FIRST(KEY_EXIT) || IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event))) { - // set the date and time into RTC chip - rtcSetTime(&t); - } -#endif - -#if defined(FAI_CHOICE) - if (s_warning_result) { - s_warning_result = 0; - g_eeGeneral.fai = true; - eeDirty(EE_GENERAL); - } -#endif - - MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX+1, {0, CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) CASE_BUZZER(0) CASE_VOICE(0) CASE_CPUARM(0) CASE_CPUARM(0) CASE_CPUARM(0) 0, CASE_AUDIO(0) CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_PCBSKY9X(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_CPUARM(0) CASE_REVPLUS(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) CASE_CPUARM(0) CASE_CPUARM(0) IF_FAI_CHOICE(0) CASE_MAVLINK(0) CASE_CPUARM(0) 0, COL_TX_MODE, CASE_PCBTARANIS(0) 1/*to force edit mode*/}); - - uint8_t sub = m_posVert - 1; - - for (uint8_t i=0; i0) ? BLINK|INVERS : INVERS); - uint8_t attr = (sub == k ? blink : 0); - - switch(k) { -#if defined(RTCLOCK) - case ITEM_SETUP_DATE: - lcd_putsLeft(y, STR_DATE); - lcd_putc(RADIO_SETUP_DATE_COLUMN, y, '-'); lcd_putc(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-'); - for (uint8_t j=0; j<3; j++) { - uint8_t rowattr = (m_posHorz==j ? attr : 0); - switch (j) { - case 0: - lcd_outdezAtt(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0); - break; - case 1: - lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, t.tm_mon+1, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0); - break; - case 2: - { - int16_t year = 1900 + t.tm_year; - int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0); - static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - dlim += pgm_read_byte(&dmon[t.tm_mon]); - lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0); - break; - } - } - } -#if defined(PCBTARANIS) - if (attr && m_posHorz < 0) drawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); -#endif - if (attr && checkIncDec_Ret) { - g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated - } - break; - - case ITEM_SETUP_TIME: - lcd_putsLeft(y, STR_TIME); - lcd_putc(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcd_putc(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':'); - for (uint8_t j=0; j<3; j++) { - uint8_t rowattr = (m_posHorz==j ? attr : 0); - switch (j) { - case 0: - lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0); - break; - case 1: - lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN+3*FWNUM, y, t.tm_min, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0); - break; - case 2: - lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN+6*FWNUM, y, t.tm_sec, rowattr|LEADING0, 2); - if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0); - break; - } - } -#if defined(PCBTARANIS) - if (attr && m_posHorz < 0) drawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); -#endif - if (attr && checkIncDec_Ret) - g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated - break; -#endif - -#if defined(BATTGRAPH) || defined(PCBTARANIS) - case ITEM_SETUP_BATT_RANGE: - lcd_putsLeft(y, STR_BATTERY_RANGE); - putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT); - lcd_putc(lcdLastPos, y, '-'); - putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT); -#if defined(PCBTARANIS) - if (attr && m_posHorz < 0) drawFilledRect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); -#endif - if (attr && s_editMode>0) { - if (m_posHorz==0) - CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMin, -50, g_eeGeneral.vBatMax+29); // min=4.0V - else - CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatMax, g_eeGeneral.vBatMin-29, +40); // max=16.0V - } - break; -#endif - - case ITEM_SETUP_SOUND_LABEL: - lcd_putsLeft(y, STR_SOUND_LABEL); - break; - -#if defined(AUDIO) - case ITEM_SETUP_BEEP_MODE: - g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); -#if defined(FRSKY) - if (attr && checkIncDec_Ret) frskySendAlarms(); -#endif - break; - -#if defined(BUZZER) - case ITEM_SETUP_BUZZER_MODE: - g_eeGeneral.buzzerMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_BUZZER, STR_VBEEPMODE, g_eeGeneral.buzzerMode, -2, 1, attr, event); -#if defined(FRSKY) - if (attr && checkIncDec_Ret) frskySendAlarms(); -#endif - break; -#endif -#else - case ITEM_SETUP_BUZZER_MODE: - g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event); -#if defined(FRSKY) - if (attr && checkIncDec_Ret) frskySendAlarms(); -#endif - break; -#endif - -#if defined(VOICE) - case ITEM_SETUP_SPEAKER_VOLUME: - { - lcd_putsLeft(y, STR_SPEAKER_VOLUME); - uint8_t b = g_eeGeneral.speakerVolume+VOLUME_LEVEL_DEF; - displaySlider(RADIO_SETUP_2ND_COLUMN, y, b, VOLUME_LEVEL_MAX, attr); - if (attr) { - CHECK_INCDEC_GENVAR(event, b, 0, VOLUME_LEVEL_MAX); - if (checkIncDec_Ret) { - g_eeGeneral.speakerVolume = (int8_t)b-VOLUME_LEVEL_DEF; -#if !defined(CPUARM) - setVolume(b); -#endif - } - } - break; - } -#endif - -#if defined(CPUARM) - case ITEM_SETUP_BEEP_VOLUME: - SLIDER_5POS(y, g_eeGeneral.beepVolume, STR_BEEP_VOLUME, event, attr); - break; - case ITEM_SETUP_WAV_VOLUME: - SLIDER_5POS(y, g_eeGeneral.wavVolume, STR_WAV_VOLUME, event, attr); - break; - case ITEM_SETUP_BACKGROUND_VOLUME: - SLIDER_5POS(y, g_eeGeneral.backgroundVolume, STR_BG_VOLUME, event, attr); - break; -#endif - - case ITEM_SETUP_BEEP_LENGTH: - SLIDER_5POS(y, g_eeGeneral.beepLength, STR_BEEP_LENGTH, event, attr); - break; - -#if defined(AUDIO) - case ITEM_SETUP_SPEAKER_PITCH: - lcd_putsLeft( y, STR_SPKRPITCH); -#if defined(CPUARM) - lcd_putcAtt(RADIO_SETUP_2ND_COLUMN, y, '+', attr); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT); - lcd_putsAtt(lcdLastPos, y, "Hz", attr); -#else - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.speakerPitch, attr|LEFT); -#endif - if (attr) { - CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 20); - } - break; -#endif - -#if defined(CPUARM) && defined(VARIO) - case ITEM_SETUP_VARIO_LABEL: - lcd_putsLeft(y, STR_VARIO); - break; - case ITEM_SETUP_VARIO_VOLUME: - SLIDER_5POS(y, g_eeGeneral.varioVolume, TR_SPEAKER_VOLUME, event, attr); - break; - case ITEM_SETUP_VARIO_PITCH: - lcd_putsLeft(y, STR_PITCH_AT_ZERO); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT); - lcd_putsAtt(lcdLastPos, y, "Hz", attr); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40); - break; - case ITEM_SETUP_VARIO_RANGE: - lcd_putsLeft(y, STR_PITCH_AT_MAX); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT); - lcd_putsAtt(lcdLastPos, y, "Hz", attr); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80); - break; - case ITEM_SETUP_VARIO_REPEAT: - lcd_putsLeft(y, STR_REPEAT_AT_ZERO); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT); - lcd_putsAtt(lcdLastPos, y, STR_MS, attr); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50); - break; -#endif - -#if defined(HAPTIC) - case ITEM_SETUP_HAPTIC_LABEL: - lcd_putsLeft(y, STR_HAPTIC_LABEL); - break; - - case ITEM_SETUP_HAPTIC_MODE: - g_eeGeneral.hapticMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBEEPMODE, g_eeGeneral.hapticMode, -2, 1, attr, event); - break; - - case ITEM_SETUP_HAPTIC_LENGTH: - SLIDER_5POS(y, g_eeGeneral.hapticLength, STR_LENGTH, event, attr); - break; - - case ITEM_SETUP_HAPTIC_STRENGTH: - SLIDER_5POS(y, g_eeGeneral.hapticStrength, STR_HAPTICSTRENGTH, event, attr); - break; -#endif - - case ITEM_SETUP_CONTRAST: - lcd_putsLeft(y, STR_CONTRAST); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT); - if (attr) { - CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX); - lcdSetContrast(); - } - break; - - case ITEM_SETUP_ALARMS_LABEL: - lcd_putsLeft(y, STR_ALARMS_LABEL); - break; - - case ITEM_SETUP_BATTERY_WARNING: - lcd_putsLeft(y, STR_BATTERYWARNING); - putsVolts(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.vBatWarn, attr|LEFT); - if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V - break; - - case ITEM_SETUP_MEMORY_WARNING: - { - uint8_t b = 1-g_eeGeneral.disableMemoryWarning; - g_eeGeneral.disableMemoryWarning = 1 - onoffMenuItem(b, RADIO_SETUP_2ND_COLUMN, y, STR_MEMORYWARNING, attr, event); - break; - } - - case ITEM_SETUP_ALARM_WARNING: - { - uint8_t b = 1-g_eeGeneral.disableAlarmWarning; - g_eeGeneral.disableAlarmWarning = 1 - onoffMenuItem(b, RADIO_SETUP_2ND_COLUMN, y, STR_ALARMWARNING, attr, event); - break; - } - -#if defined(PCBSKY9X) - case ITEM_SETUP_CAPACITY_WARNING: - lcd_putsLeft(y, STR_CAPAWARNING); - putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ; - if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.mAhWarn, 0, 100); - break; -#endif - -#if defined(PCBSKY9X) - case ITEM_SETUP_TEMPERATURE_WARNING: - lcd_putsLeft(y, STR_TEMPWARNING); - putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.temperatureWarn, UNIT_TEMPERATURE, attr|LEFT) ; - if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, 0, 120); // 0 means no alarm - break; -#endif - - case ITEM_SETUP_INACTIVITY_ALARM: - lcd_putsLeft( y,STR_INACTIVITYALARM); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT); - lcd_putc(lcdLastPos, y, 'm'); - if(attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes - break; - -#if ROTARY_ENCODERS > 0 - case ITEM_SETUP_RE_NAVIGATION: - g_eeGeneral.reNavigation = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_RENAVIG, STR_VRENAVIG, g_eeGeneral.reNavigation, 0, NUM_ROTARY_ENCODERS, attr, event); - if (attr && checkIncDec_Ret) { - g_rotenc[NAVIGATION_RE_IDX()] = 0; - } - break; -#endif - - case ITEM_SETUP_BACKLIGHT_LABEL: - lcd_putsLeft(y, STR_BACKLIGHT_LABEL); - break; - - case ITEM_SETUP_BACKLIGHT_MODE: - g_eeGeneral.backlightMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MODE, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event); - break; - - case ITEM_SETUP_FLASH_BEEP: - g_eeGeneral.alarmsFlash = onoffMenuItem(g_eeGeneral.alarmsFlash, RADIO_SETUP_2ND_COLUMN, y, STR_ALARM, attr, event ) ; - break; - - case ITEM_SETUP_BACKLIGHT_DELAY: - lcd_putsLeft(y, STR_BLDELAY); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT); - lcd_putc(lcdLastPos, y, 's'); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5); - break; - -#if defined(CPUARM) - case ITEM_SETUP_BRIGHTNESS: - lcd_putsLeft(y, STR_BRIGHTNESS); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ; - if (attr) { - uint8_t b = 100 - g_eeGeneral.backlightBright; - CHECK_INCDEC_GENVAR(event, b, 0, 100); - g_eeGeneral.backlightBright = 100 - b; - } - break; -#endif - -#if defined(PCBTARANIS) && defined(REVPLUS) - case ITEM_SETUP_BACKLIGHT_COLOR: - lcd_putsLeft(y, STR_BLCOLOR); - displaySlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr); - if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS); - break; -#endif - -#if defined(PWM_BACKLIGHT) - case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF: - lcd_putsLeft(y, STR_BLOFFBRIGHTNESS); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.blOffBright, attr|LEFT); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.blOffBright, 0, 15); - break; - - case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_ON: - lcd_putsLeft(y, STR_BLONBRIGHTNESS); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, 15-g_eeGeneral.blOnBright, attr|LEFT); - if (attr) g_eeGeneral.blOnBright = 15 - checkIncDecGen(event, 15-g_eeGeneral.blOnBright, 0, 15); - break; -#endif - -#if defined(SPLASH) && !defined(FSPLASH) - case ITEM_SETUP_DISABLE_SPLASH: - { -#if defined(PCBTARANIS) - lcd_putsLeft(y, STR_SPLASHSCREEN); - if (SPLASH_NEEDED()) { - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT); - lcd_putc(lcdLastPos, y, 's'); - } - else { - lcd_putsiAtt(RADIO_SETUP_2ND_COLUMN, y, STR_MMMINV, 0, attr); // TODO define - } - if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4); -#else - uint8_t b = 1-g_eeGeneral.splashMode; - g_eeGeneral.splashMode = 1 - onoffMenuItem(b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event); -#endif - break; - } -#endif - -#if defined(FRSKY) && defined(FRSKY_HUB) && defined(GPS) - case ITEM_SETUP_TIMEZONE: - lcd_putsLeft(y, STR_TIMEZONE); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12); - break; - - case ITEM_SETUP_GPSFORMAT: - g_eeGeneral.gpsFormat = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event); - break; -#endif - -#if defined(PXX) - case ITEM_SETUP_COUNTRYCODE: - g_eeGeneral.countryCode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODE, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event); - break; -#endif - -#if defined(CPUARM) - case ITEM_SETUP_LANGUAGE: - lcd_putsLeft(y, STR_VOICELANG); - lcd_putsAtt(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr); - if (attr) { - currentLanguagePackIdx = checkIncDec(event, currentLanguagePackIdx, 0, DIM(languagePacks)-2, EE_GENERAL); - if (checkIncDec_Ret) { - currentLanguagePack = languagePacks[currentLanguagePackIdx]; - strncpy(g_eeGeneral.ttsLanguage, currentLanguagePack->id, 2); - } - } - break; - - case ITEM_SETUP_IMPERIAL: - g_eeGeneral.imperial = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event); - break; -#endif - -#if defined(FAI_CHOICE) - case ITEM_SETUP_FAI: - onoffMenuItem(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, PSTR("FAI Mode"), attr, event); - if (attr && checkIncDec_Ret) { - if (g_eeGeneral.fai) - POPUP_WARNING(PSTR("FAI\001mode blocked!")); - else - POPUP_CONFIRMATION(PSTR("FAI mode?")); - } - break; -#endif - -#if defined(MAVLINK) - case ITEM_MAVLINK_BAUD: - g_eeGeneral.mavbaud = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_MAVLINK_BAUD_LABEL, STR_MAVLINK_BAUDS, g_eeGeneral.mavbaud, 0, 7, attr, event); - break; -#endif - -#if defined(CPUARM) - case ITEM_SETUP_SWITCHES_DELAY: - lcd_putsLeft(y, STR_SWITCHES_DELAY); - lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT); - lcd_putsAtt(lcdLastPos, y, STR_MS, attr); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, +15); - break; -#endif - - case ITEM_SETUP_RX_CHANNEL_ORD: - lcd_putsLeft(y, STR_RXCHANNELORD); // RAET->AETR - for (uint8_t i=1; i<=4; i++) { - putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr); - } - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23); - break; - - case ITEM_SETUP_STICK_MODE_LABELS: - lcd_putsLeft(y, NO_INDENT(STR_MODE)); - for (uint8_t i=0; i<4; i++) { - lcd_img((6+4*i)*FW, y, sticks, i, 0); -#if defined(FRSKY_STICKS) - if (g_eeGeneral.stickReverse & (1<0) { - CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3); - } - else if (stickMode != g_eeGeneral.stickMode) { - pausePulses(); - stickMode = g_eeGeneral.stickMode; - checkTHR(); - resumePulses(); - clearKeyEvents(); - } -#if defined(ROTARY_ENCODER_NAVIGATION) - MOVE_CURSOR_FROM_HERE(); -#endif - break; - } - } -} diff --git a/radio/src/gui/menu_general_trainer.cpp b/radio/src/gui/menu_general_trainer.cpp deleted file mode 100755 index eb1d9ada4..000000000 --- a/radio/src/gui/menu_general_trainer.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#if LCD_W >= 212 - #define TRAINER_CALIB_POS 12 -#else - #define TRAINER_CALIB_POS 8 -#endif - -void menuGeneralTrainer(uint8_t event) -{ - uint8_t y; - bool slave = SLAVE_MODE(); - - MENU(STR_MENUTRAINER, menuTabGeneral, e_Trainer, (slave ? 1 : 7), {0, 2, 2, 2, 2, 0/*, 0*/}); - - if (slave) { - lcd_puts(7*FW, 4*FH, STR_SLAVE); - } - else { - uint8_t attr; - uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS); - - lcd_puts(3*FW, MENU_TITLE_HEIGHT+1, STR_MODESRC); - - y = MENU_TITLE_HEIGHT + 1 + FH; - - for (uint8_t i=1; i<=NUM_STICKS; i++) { - uint8_t chan = channel_order(i); - volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1]; - - putsMixerSource(0, y, MIXSRC_Rud-1+chan, (m_posVert==i && CURSOR_ON_LINE()) ? INVERS : 0); - - for (uint8_t j=0; j<3; j++) { - - attr = ((m_posVert==i && m_posHorz==j) ? blink : 0); - - switch(j) { - case 0: - lcd_putsiAtt(4*FW, y, STR_TRNMODE, td->mode, attr); - if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->mode, 0, 2); - break; - - case 1: - lcd_outdezAtt(11*FW, y, td->studWeight, attr); - if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->studWeight, -125, 125); - break; - - case 2: - lcd_putsiAtt(12*FW, y, STR_TRNCHN, td->srcChn, attr); - if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->srcChn, 0, 3); - break; - } - } - y += FH; - } - - attr = (m_posVert==5) ? blink : 0; - lcd_putsLeft(MENU_TITLE_HEIGHT+1+5*FH, STR_MULTIPLIER); - lcd_outdezAtt(LEN_MULTIPLIER*FW+3*FW, MENU_TITLE_HEIGHT+1+5*FH, g_eeGeneral.PPM_Multiplier+10, attr|PREC1); - if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40); - - attr = (m_posVert==6) ? INVERS : 0; - if (attr) s_editMode = 0; - lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+1+6*FH, STR_CAL, attr); - for (uint8_t i=0; i<4; i++) { - uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2; -#if defined (PPM_UNIT_PERCENT_PREC1) - lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1); -#else - lcd_outdezAtt(x, MENU_TITLE_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0); -#endif - } - - if (attr) { - if (event==EVT_KEY_LONG(KEY_ENTER)){ - memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib)); - eeDirty(EE_GENERAL); - AUDIO_WARNING1(); - } - } - } -} diff --git a/radio/src/gui/menu_general_version.cpp b/radio/src/gui/menu_general_version.cpp deleted file mode 100755 index efdff1f94..000000000 --- a/radio/src/gui/menu_general_version.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#if defined(PCBTARANIS) -void backupEeprom() -{ - char filename[60]; - uint8_t buffer[1024]; - FIL file; - - lcd_clear(); - lcd_putsLeft(4*FH, STR_WRITING); - lcd_rect(3, 6*FH+4, 204, 7); - lcdRefresh(); - - //reset unexpectedShutdown to prevent warning when user restores EEPROM backup - g_eeGeneral.unexpectedShutdown = 0; - eeDirty(EE_GENERAL); - eeCheck(true); - - // create the directory if needed... - DIR folder; - FRESULT result = f_opendir(&folder, EEPROMS_PATH); - if (result != FR_OK) { - if (result == FR_NO_PATH) - result = f_mkdir(EEPROMS_PATH); - if (result != FR_OK) { - POPUP_WARNING(SDCARD_ERROR(result)); - return; - } - } - - // prepare the filename... - char * tmp = strAppend(filename, EEPROMS_PATH "/eeprom"); - tmp = strAppendDate(tmp, true); - strAppend(tmp, EEPROM_EXT); - - // open the file for writing... - f_open(&file, filename, FA_WRITE | FA_CREATE_ALWAYS); - - for (int i=0; i - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -void menuStatisticsView(uint8_t event) -{ - TITLE(STR_MENUSTAT); - - switch(event) - { - case EVT_KEY_FIRST(KEY_UP): - chainMenu(menuStatisticsDebug); - break; - -#if defined(CPUARM) - case EVT_KEY_LONG(KEY_MENU): - g_eeGeneral.globalTimer = 0; - eeDirty(EE_GENERAL); - sessionTimer = 0; - break; -#endif - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - - lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP); - putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); - - putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); - - putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0); - -#if defined(CPUARM) - putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); -#endif - -#if defined(THRTRACE) - coord_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0); - const coord_t x = 5; - const coord_t y = 60; - lcd_hline(x-3, y, MAXTRACE+3+3); - lcd_vline(x, y-32, 32+3); - - for (coord_t i=0; i=MAXTRACE) traceRd = 0; - if (traceRd==s_traceWr) break; - } -#endif -} - -#if defined(PCBTARANIS) - #define MENU_DEBUG_COL1_OFS (11*FW-2) - #define MENU_DEBUG_Y_MIXMAX (2*FH-3) - #define MENU_DEBUG_Y_LUA (3*FH-2) - #define MENU_DEBUG_Y_FREE_RAM (4*FH-1) - #define MENU_DEBUG_Y_STACK (5*FH) - #define MENU_DEBUG_Y_RTOS (6*FH) -#elif defined(PCBSKY9X) - #define MENU_DEBUG_COL1_OFS (11*FW-3) - #define MENU_DEBUG_COL2_OFS (17*FW) - #define MENU_DEBUG_Y_CURRENT (1*FH) - #define MENU_DEBUG_Y_MAH (2*FH) - #define MENU_DEBUG_Y_CPU_TEMP (3*FH) - #define MENU_DEBUG_Y_COPROC (4*FH) - #define MENU_DEBUG_Y_MIXMAX (5*FH) - #define MENU_DEBUG_Y_RTOS (6*FH) -#else - #define MENU_DEBUG_COL1_OFS (14*FW) -#endif - -void menuStatisticsDebug(uint8_t event) -{ - TITLE(STR_MENUDEBUG); - - switch(event) - { -#if defined(CPUARM) - case EVT_KEY_LONG(KEY_ENTER): - g_eeGeneral.mAhUsed = 0; - g_eeGeneral.globalTimer = 0; - eeDirty(EE_GENERAL); -#if defined(PCBSKY9X) - Current_used = 0; -#endif - sessionTimer = 0; - killEvents(event); - AUDIO_KEYPAD_UP(); - break; -#endif - case EVT_KEY_FIRST(KEY_ENTER): -#if !defined(CPUARM) - g_tmr1Latency_min = 0xff; - g_tmr1Latency_max = 0; -#endif -#if defined(LUA) - maxLuaInterval = 0; - maxLuaDuration = 0; -#endif - maxMixerDuration = 0; - AUDIO_KEYPAD_UP(); - break; - -#if defined(DEBUG_TRACE_BUFFER) - case EVT_KEY_FIRST(KEY_UP): - pushMenu(menuTraceBuffer); - return; -#endif - - case EVT_KEY_FIRST(KEY_DOWN): - chainMenu(menuStatisticsView); - break; - case EVT_KEY_FIRST(KEY_EXIT): - chainMenu(menuMainView); - break; - } - -#if defined(PCBSKY9X) - if ((ResetReason&RSTC_SR_RSTTYP) == (2<<8)) { - lcd_puts(LCD_W-8*FW, 0*FH, "WATCHDOG"); - } - else if (unexpectedShutdown) { - lcd_puts(LCD_W-13*FW, 0*FH, "UNEXP.SHTDOWN"); - } -#endif - -#if defined(PCBSKY9X) && !defined(REVA) - // current - lcd_putsLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT); - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT); - uint32_t current_scale = 488 + g_eeGeneral.currentCalib; - lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>'); - putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT); - // consumption - lcd_putsLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH); - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); -#endif - -#if defined(PCBSKY9X) - lcd_putsLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP); - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT); - lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>'); - putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT); -#endif - -#if defined(COPROCESSOR) - lcd_putsLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP); - - if (Coproc_read==0) { - lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS); - } - else if (Coproc_read==0x81) { - lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Inst.TinyApp"),INVERS); - } - else if (Coproc_read<3) { - lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Upgr.TinyApp"),INVERS); - } - else { - putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT); - putsValueWithUnit(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_COPROC, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT); - } -#endif - -#if defined(PCBTARANIS) && !defined(SIMU) - lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem"); - lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT); - lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b"); -#endif - -#if defined(LUA) - lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts"); - lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT); - lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT); -#endif - -#if defined(CPUARM) - lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS); - lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT); - lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms"); -#endif - -#if 0 - lcd_putsLeft(MENU_DEBUG_Y_STACK, STR_FREESTACKMINB); - lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_STACK, stack_free(255), UNSIGN|LEFT); - lcd_puts(lcdLastPos, MENU_DEBUG_Y_STACK, "b"); -#endif - -#if defined(PCBTARANIS) - lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); - lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Main]", SMLSIZE); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT); - lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Mix]", SMLSIZE); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT); - lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Audio]", SMLSIZE); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT); -#endif - -#if defined(PCBSKY9X) - lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB); - lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT); - lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT); - lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/"); - lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT); -#endif - -#if !defined(CPUARM) - lcd_putsLeft(1*FH, STR_TMR1LATMAXUS); - lcd_outdez8(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 ); - lcd_putsLeft(2*FH, STR_TMR1LATMINUS); - lcd_outdez8(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 ); - lcd_putsLeft(3*FH, STR_TMR1JITTERUS); - lcd_outdez8(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 ); - lcd_putsLeft(4*FH, STR_TMIXMAXMS); - lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2); - lcd_putsLeft(5*FH, STR_FREESTACKMINB); - lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ; -#endif - - lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET); - lcd_status_line(); -} - - -#if defined(DEBUG_TRACE_BUFFER) -#include "stamp-opentx.h" - -void menuTraceBuffer(uint8_t event) -{ - switch(event) - { - case EVT_KEY_LONG(KEY_ENTER): - dumpTraceBuffer(); - killEvents(event); - break; - } - - SIMPLE_SUBMENU("Trace Buffer " VERS_STR, TRACE_BUFFER_LEN); - /* RTC time */ - struct gtm t; - gettime(&t); - putsTime(LCD_W+1, 0, t, TIMEBLINK); - - uint8_t y = 0; - uint8_t k = 0; - int8_t sub = m_posVert; - - lcd_putc(0, FH, '#'); - lcd_puts(4*FW, FH, "Time"); - lcd_puts(14*FW, FH, "Event"); - lcd_puts(20*FW, FH, "Data"); - - for (uint8_t i=0; itime % SECS_PER_DAY; - putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT); - //event - lcd_outdezNAtt(14*FW, y, te->event, LEADING0|LEFT, 3); - //data - lcd_putsn (20*FW, y, "0x", 2); - lcd_outhex4(22*FW-2, y, (uint16_t)(te->data >> 16)); - lcd_outhex4(25*FW, y, (uint16_t)(te->data & 0xFFFF)); - } - - } - - -} -#endif //#if defined(DEBUG_TRACE_BUFFER) diff --git a/radio/src/gui/view_telemetry.cpp b/radio/src/gui/view_telemetry.cpp deleted file mode 100644 index 32a175b50..000000000 --- a/radio/src/gui/view_telemetry.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#define STATUS_BAR_Y (7*FH+1) -#if LCD_W >= 212 - #define TELEM_2ND_COLUMN (11*FW) -#else - #define TELEM_2ND_COLUMN (10*FW) -#endif - -#if defined(FRSKY_HUB) && defined(GAUGES) -bar_threshold_t barsThresholds[THLD_MAX]; -#endif - -uint8_t s_frsky_view = 0; - -#if LCD_W >= 212 - #define BAR_LEFT 26 - #define BAR_WIDTH 157 -#else - #define BAR_LEFT 25 - #define BAR_WIDTH 100 -#endif - -#if defined(PCBTARANIS) -void displayRssiLine() -{ - if (TELEMETRY_STREAMING()) { - lcd_hline(0, 55, 212, 0); // separator - uint8_t rssi = min((uint8_t)99, TELEMETRY_RSSI()); - lcd_putsn(0, STATUS_BAR_Y, STR_RX, 2); lcd_outdezNAtt(4*FW, STATUS_BAR_Y, rssi, LEADING0, 2); - lcd_rect(BAR_LEFT, 57, 78, 7); - drawFilledRect(BAR_LEFT+1, 58, 19*rssi/25, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID); - } - else { - lcd_putsAtt(7*FW, STATUS_BAR_Y, STR_NODATA, BLINK); - lcd_status_line(); - } -} -#else -void displayRssiLine() -{ - if (TELEMETRY_STREAMING()) { - lcd_hline(0, 55, 128, 0); // separator - uint8_t rssi; -#if !defined(CPUARM) - rssi = min((uint8_t)99, frskyData.rssi[1].value); - lcd_putsLeft(STATUS_BAR_Y, STR_TX); lcd_outdezNAtt(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2); - lcd_rect(BAR_LEFT+1, 57, 38, 7); - drawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID); -#endif - rssi = min((uint8_t)99, TELEMETRY_RSSI()); - lcd_puts(104, STATUS_BAR_Y, STR_RX); lcd_outdezNAtt(105+4*FW, STATUS_BAR_Y, rssi, LEADING0, 2); - lcd_rect(65, 57, 38, 7); - uint8_t v = 4*rssi/11; - drawFilledRect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID); - } - else { - lcd_putsAtt(7*FW, STATUS_BAR_Y, STR_NODATA, BLINK); - lcd_status_line(); - } -} -#endif - -#if defined(FRSKY) && defined(FRSKY_HUB) && defined(GPS) && !defined(CPUARM) -void displayGpsTime() -{ - uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK); - lcd_outdezNAtt(CENTER_OFS+6*FW+7, STATUS_BAR_Y, frskyData.hub.hour, att, 2); - lcd_putcAtt(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att); - lcd_outdezNAtt(CENTER_OFS+9*FW+2, STATUS_BAR_Y, frskyData.hub.min, att, 2); - lcd_putcAtt(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att); - lcd_outdezNAtt(CENTER_OFS+12*FW-3, STATUS_BAR_Y, frskyData.hub.sec, att, 2); - lcd_status_line(); -} - -void displayGpsCoord(uint8_t y, char direction, int16_t bp, int16_t ap) -{ - if (frskyData.hub.gpsFix >= 0) { - if (!direction) direction = '-'; - lcd_outdezAtt(TELEM_2ND_COLUMN, y, bp / 100, LEFT); // ddd before '.' - lcd_putc(lcdLastPos, y, '@'); - uint8_t mn = bp % 100; // TODO div_t - if (g_eeGeneral.gpsFormat == 0) { - lcd_putc(lcdLastPos+FWNUM, y, direction); - lcd_outdezNAtt(lcdLastPos+FW+FW+1, y, mn, LEFT|LEADING0, 2); // mm before '.' - lcd_vline(lcdLastPos, y, 2); - uint16_t ss = ap * 6; - lcd_outdezAtt(lcdLastPos+3, y, ss / 1000, LEFT); // '' - lcd_plot(lcdLastPos, y+FH-2, 0); // small decimal point - lcd_outdezAtt(lcdLastPos+2, y, ss % 1000, LEFT); // '' - lcd_vline(lcdLastPos, y, 2); - lcd_vline(lcdLastPos+2, y, 2); - } - else { - lcd_outdezNAtt(lcdLastPos+FW, y, mn, LEFT|LEADING0, 2); // mm before '.' - lcd_plot(lcdLastPos, y+FH-2, 0); // small decimal point - lcd_outdezNAtt(lcdLastPos+2, y, ap, LEFT|UNSIGN|LEADING0, 4); // after '.' - lcd_putc(lcdLastPos+1, y, direction); - } - } - else { - // no fix - lcd_puts(TELEM_2ND_COLUMN, y, STR_VCSWFUNC+1/*----*/); - } -} -#elif !defined(CPUARM) -#define displayGpsTime() -#define displayGpsCoord(...) -#endif - -NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm) -{ - return (45 - 3*alarm + g_model.frsky.rssiAlarms[alarm].value); -} - -#if !defined(CPUARM) -void displayVoltageScreenLine(uint8_t y, uint8_t index) -{ - putsStrIdx(0, y, STR_A, index+1, 0); - if (TELEMETRY_STREAMING()) { - putsTelemetryChannelValue(3*FW+6*FW+4, y-FH, index+TELEM_A1-1, frskyData.analog[index].value, DBLSIZE); - lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannelValue(17*FW, y-FH, index+TELEM_A1-1, frskyData.analog[index].min, NO_UNIT); - lcd_putc(12*FW, y, '>'); putsTelemetryChannelValue(17*FW, y, index+TELEM_A1-1, frskyData.analog[index].max, NO_UNIT); - } -} -#endif - -uint8_t barCoord(int16_t value, int16_t min, int16_t max) -{ -#if defined(CPUARM) - if (value <= min) - return 0; - else if (value >= max) - return BAR_WIDTH-1; - else - return ((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min); -#else - return limit((uint8_t)0, (uint8_t)(((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min)), (uint8_t)BAR_WIDTH); -#endif -} - -#if !defined(CPUARM) -void displayVoltagesScreen() -{ - // Volts / Amps / Watts / mAh - uint8_t analog = 0; - lcd_putsiAtt(0, 2*FH, STR_AMPSRC, g_model.frsky.voltsSource+1, 0); - switch (g_model.frsky.voltsSource) { - case FRSKY_VOLTS_SOURCE_A1: - case FRSKY_VOLTS_SOURCE_A2: - displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource); - analog = 1+g_model.frsky.voltsSource; - break; -#if defined(FRSKY_HUB) - case FRSKY_VOLTS_SOURCE_FAS: - putsTelemetryChannelValue(3*FW+6*FW+4, FH, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE); - break; - case FRSKY_VOLTS_SOURCE_CELLS: - putsTelemetryChannelValue(3*FW+6*FW+4, FH, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE); - break; -#endif - } - - if (g_model.frsky.currentSource) { - lcd_putsiAtt(0, 4*FH, STR_AMPSRC, g_model.frsky.currentSource, 0); - switch(g_model.frsky.currentSource) { - case FRSKY_CURRENT_SOURCE_A1: - case FRSKY_CURRENT_SOURCE_A2: - displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1); - break; -#if defined(FRSKY_HUB) - case FRSKY_CURRENT_SOURCE_FAS: - putsTelemetryChannelValue(3*FW+6*FW+4, 3*FH, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE); - break; -#endif - } - - putsTelemetryChannelValue(4, 5*FH, TELEM_POWER-1, frskyData.hub.power, LEFT|DBLSIZE); - putsTelemetryChannelValue(3*FW+4+4*FW+6*FW+FW, 5*FH, TELEM_CONSUMPTION-1, frskyData.hub.currentConsumption, DBLSIZE); - } - else { - displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0); - if (analog == 0) displayVoltageScreenLine(6*FH, 1); - } - -#if defined(FRSKY_HUB) - // Cells voltage - if (frskyData.hub.cellsCount > 0) { - uint8_t y = 1*FH; - for (uint8_t k=0; k=0; i--) { - FrSkyBarData & bar = screen.bars[i]; - source_t source = bar.source; -#if defined(CPUARM) - getvalue_t barMin = bar.barMin; - getvalue_t barMax = bar.barMax; -#else - getvalue_t barMin = convertBarTelemValue(source, bar.barMin); - getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax); -#endif - if (source && barMax > barMin) { - uint8_t y = barHeight+6+i*(barHeight+6); -#if defined(CPUARM) - putsMixerSource(0, y+barHeight-5, source, 0); -#else - lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0); -#endif - lcd_rect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2); -#if defined(CPUARM) - getvalue_t value = getValue(source); -#else - getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-1); -#endif -#if defined(PCBTARANIS) - putsChannel(BAR_LEFT+2+BAR_WIDTH, y+barHeight-5, source, LEFT); -#endif - - uint8_t thresholdX = 0; - -#if !defined(CPUARM) - getvalue_t threshold = 0; - if (source <= TELEM_TIMER_MAX) - threshold = 0; - else if (source <= TELEM_RSSI_RX) - threshold = getRssiAlarmValue(source-TELEM_RSSI_TX); - else if (source <= TELEM_A2) - threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0]; -#if defined(FRSKY_HUB) - else { -#if defined(GAUGES) - threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]); -#endif - } -#endif - - if (threshold) { - thresholdX = barCoord(threshold, barMin, barMax); - if (thresholdX == 100) - thresholdX = 0; - } -#endif - - uint8_t width = barCoord(value, barMin, barMax); - -#if defined(CPUARM) - uint8_t barShade = SOLID; -#else - // reversed barshade for T1/T2 - uint8_t barShade = ((threshold > value) ? DOTTED : SOLID); - if (source == TELEM_T1 || source == TELEM_T2) { - barShade = -barShade; - } -#endif - - drawFilledRect(BAR_LEFT+1, y+1, width, barHeight, barShade); - - for (uint8_t j=24; j<99; j+=25) { - if (j>thresholdX || j>width) { - lcd_vline(j*BAR_WIDTH/100+BAR_LEFT+1, y+1, barHeight); - } - } - - if (thresholdX) { - lcd_vlineStip(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED); - lcd_hline(BAR_LEFT+thresholdX, y-2, 3); - } - } - else { - barHeight += 2; - } - } - displayRssiLine(); - return barHeight < 13; -} - -#if defined(CPUARM) -bool displayNumbersTelemetryScreen(FrSkyScreenData & screen) -{ - // Custom Screen with numbers - uint8_t fields_count = 0; - for (uint8_t i=0; i<4; i++) { - for (uint8_t j=0; j 0) { - fields_count++; - } - if (i==3) { -#if LCD_W >= 212 - lcd_vline(69, 8, 48); - lcd_vline(141, 8, 48); -#else - lcd_vline(63, 8, 48); -#endif - - if (!TELEMETRY_STREAMING()) { - displayRssiLine(); - return fields_count; - } - } - if (field) { - LcdFlags att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT); -#if LCD_W >= 212 - coord_t pos[] = {0, 71, 143, 214}; -#else - coord_t pos[] = {0, 65, 130}; -#endif - - if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER && i!=3) { - // there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead - putsStrIdx(pos[j], 1+FH+2*FH*i, "T", field-MIXSRC_FIRST_TIMER+1, 0); - } - else if (field >= MIXSRC_FIRST_TELEM && isGPSSensor(1+(field-MIXSRC_FIRST_TELEM)/3) && telemetryItems[(field-MIXSRC_FIRST_TELEM)/3].isAvailable()) { - // we don't display GPS name, no space for it - } - else { - putsMixerSource(pos[j], 1+FH+2*FH*i, field, 0); - } - - if (field >= MIXSRC_FIRST_TELEM) { - TelemetryItem & telemetryItem = telemetryItems[(field-MIXSRC_FIRST_TELEM)/3]; // TODO macro to convert a source to a telemetry index - if (!telemetryItem.isAvailable()) { - continue; - } - else if (telemetryItem.isOld()) { - att |= INVERS|BLINK; - } - } - - putsChannel(pos[j+1]-2, (i==3 ? 1+FH+2*FH*i:FH+2*FH*i), field, att); - - } - } - } - lcd_status_line(); - return fields_count; -} -#else -bool displayNumbersTelemetryScreen(FrSkyScreenData & screen) -{ - // Custom Screen with numbers - uint8_t fields_count = 0; - for (uint8_t i=0; i<4; i++) { - for (uint8_t j=0; j 0) { - fields_count++; - } - if (i==3) { -#if LCD_W >= 212 - lcd_vline(69, 8, 48); - lcd_vline(141, 8, 48); -#else - lcd_vline(63, 8, 48); -#endif - if (TELEMETRY_STREAMING()) { -#if defined(FRSKY_HUB) - if (field == TELEM_ACC) { - lcd_putsLeft(STATUS_BAR_Y, STR_ACCEL); - lcd_outdezNAtt(4*FW, STATUS_BAR_Y, frskyData.hub.accelX, LEFT|PREC2); - lcd_outdezNAtt(10*FW, STATUS_BAR_Y, frskyData.hub.accelY, LEFT|PREC2); - lcd_outdezNAtt(16*FW, STATUS_BAR_Y, frskyData.hub.accelZ, LEFT|PREC2); - break; - } -#if defined(GPS) - else if (field == TELEM_GPS_TIME) { - displayGpsTime(); - break; - } -#endif -#endif - } - else { - displayRssiLine(); - return fields_count; - } - } - if (field) { - getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-1); - uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT); -#if LCD_W >= 212 - coord_t pos[] = {0, 71, 143, 214}; -#else - coord_t pos[] = {0, 65, 130}; -#endif - putsTelemetryChannelValue(pos[j+1]-2, FH+2*FH*i, field-1, value, att); - - if (field >= TELEM_TIMER1 && field <= TELEM_TIMER_MAX && i!=3) { - // there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead - field = field-TELEM_TIMER1+TELEM_T1; - } - - lcd_putsiAtt(pos[j], 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0); - } - } - } - lcd_status_line(); - return fields_count; -} -#endif - -#if defined(CPUARM) -bool displayCustomTelemetryScreen(uint8_t index) -{ - FrSkyScreenData & screen = g_model.frsky.screens[index]; - -#if defined(GAUGES) - if (IS_BARS_SCREEN(s_frsky_view)) { - return displayGaugesTelemetryScreen(screen); - } -#endif - - displayNumbersTelemetryScreen(screen); - - return true; -} -#else -bool displayCustomTelemetryScreen(uint8_t index) -{ - FrSkyScreenData & screen = g_model.frsky.screens[index]; - -#if defined(GAUGES) - if (IS_BARS_SCREEN(s_frsky_view)) { - return displayGaugesTelemetryScreen(screen); - } -#endif - - return displayNumbersTelemetryScreen(screen); -} -#endif - -bool displayTelemetryScreen() -{ -#if defined(LUA) - if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_SCRIPT) { - return true; - } -#endif - -#if defined(CPUARM) - if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_NONE) { - return false; - } -#endif - - lcdDrawTelemetryTopBar(); - - if (s_frsky_view < MAX_TELEMETRY_SCREENS) { - return displayCustomTelemetryScreen(s_frsky_view); - } - -#if !defined(CPUARM) - if (s_frsky_view == TELEMETRY_VOLTAGES_SCREEN) { - displayVoltagesScreen(); - } -#endif - -#if !defined(CPUARM) && defined(FRSKY_HUB) - else { - displayAfterFlightScreen(); - } -#endif - - return true; -} - -#if defined(CPUARM) -enum NavigationDirection { - none, - up, - down -}; -#define decrTelemetryScreen() direction = up -#define incrTelemetryScreen() direction = down -#else -void decrTelemetryScreen() -{ - if (s_frsky_view-- == 0) - s_frsky_view = TELEMETRY_VIEW_MAX; -} -void incrTelemetryScreen() -{ - if (s_frsky_view++ == TELEMETRY_VIEW_MAX) - s_frsky_view = 0; -} -#endif - -void menuTelemetryFrsky(uint8_t event) -{ -#if defined(CPUARM) - enum NavigationDirection direction = none; -#endif - - switch (event) { - case EVT_KEY_FIRST(KEY_EXIT): - killEvents(event); - chainMenu(menuMainView); - break; - -#if defined(PCBTARANIS) - case EVT_KEY_LONG(KEY_PAGE): - killEvents(event); - // no break; -#endif - case EVT_KEY_FIRST(KEY_UP): - decrTelemetryScreen(); - break; - -#if defined(PCBTARANIS) - case EVT_KEY_BREAK(KEY_PAGE): -#endif - case EVT_KEY_FIRST(KEY_DOWN): - incrTelemetryScreen(); - break; - -#if defined(PCBTARANIS) - case EVT_KEY_LONG(KEY_ENTER): - killEvents(event); - MENU_ADD_ITEM(STR_RESET_TELEMETRY); - MENU_ADD_ITEM(STR_RESET_FLIGHT); - menuHandler = onMainViewMenu; - break; -#else - case EVT_KEY_FIRST(KEY_ENTER): - telemetryReset(); - break; -#endif - } - -#if defined(CPUARM) - for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) { - if (direction == up) { - if (s_frsky_view-- == 0) - s_frsky_view = TELEMETRY_VIEW_MAX; - } - else if (direction == down) { - if (s_frsky_view++ == TELEMETRY_VIEW_MAX) - s_frsky_view = 0; - } - else { - direction = down; - } - if (displayTelemetryScreen()) { - return; - } - } - - lcdDrawTelemetryTopBar(); - lcd_puts(8*FW, 3*FH, "No Telemetry Screens"); - displayRssiLine(); -#else - if (!displayTelemetryScreen()) { - putEvent(event == EVT_KEY_FIRST(KEY_UP) ? event : EVT_KEY_FIRST(KEY_DOWN)); - } -#endif -} - diff --git a/radio/src/gui/view_text.cpp b/radio/src/gui/view_text.cpp deleted file mode 100644 index 390754fb5..000000000 --- a/radio/src/gui/view_text.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../opentx.h" - -#define TEXT_FILENAME_MAXLEN 40 -#define TEXT_FILE_MAXSIZE 2048 - -char s_text_file[TEXT_FILENAME_MAXLEN]; -char s_text_screen[LCD_LINES-1][LCD_COLS+1]; - -void readTextFile(int & lines_count) -{ - FIL file; - int result; - char c; - unsigned int sz; - int line_length = 0; - int escape = 0; - char escape_chars[2]; - int current_line = 0; - - memset(s_text_screen, 0, sizeof(s_text_screen)); - - result = f_open(&file, s_text_file, FA_OPEN_EXISTING | FA_READ); - if (result == FR_OK) { - for (int i=0; i=s_pgOfs && current_line-s_pgOfs0 && escape<3) { - escape_chars[escape-1] = c; - if (escape == 2 && !strncmp(escape_chars, "up", 2)) { - c = '\300'; - escape = 0; - } - else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) { - c = '\301'; - escape = 0; - } - else { - escape++; - continue; - } - } - else if (c=='~') { - c = 'z'+1; - } - else if (c=='\t') { - c = 0x1D; //tab - } - escape = 0; - s_text_screen[current_line-s_pgOfs][line_length++] = c; - } - } - if (c != '\n') { - current_line += 1; - } - f_close(&file); - } - - if (lines_count == 0) { - lines_count = current_line; - } -} - -void menuTextView(uint8_t event) -{ - static int lines_count; - - switch (event) { - case EVT_ENTRY: - s_pgOfs = 0; - lines_count = 0; - readTextFile(lines_count); - break; - - case EVT_KEY_FIRST(KEY_UP): - if (s_pgOfs == 0) - break; - else - s_pgOfs--; - // no break; - - case EVT_KEY_FIRST(KEY_DOWN): - // if (event == EVT_KEY_BREAK(KEY_DOWN)) { - if (s_pgOfs+LCD_LINES-1 >= lines_count) - break; - else - ++s_pgOfs; - // } - readTextFile(lines_count); - break; - - case EVT_KEY_BREAK(KEY_EXIT): - popMenu(); - break; - } - - for (int i=0; i LCD_LINES-1) { - displayScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1); - } -} - -void pushMenuTextView(const char *filename) -{ - if (strlen(filename) < TEXT_FILENAME_MAXLEN) { - strcpy(s_text_file, filename); - pushMenu(menuTextView); - } -} diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 5491973ed..da6ea121b 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -59,8 +59,6 @@ const pm_uchar * const splash_lbm = splashdata+4; }; #endif -#include "gui/menus.h" - EEGeneral g_eeGeneral; ModelData g_model; diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 3639b842e..e46241012 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -1346,7 +1346,6 @@ void evalFunctions(); #endif #include "gui/gui.h" -#include "gui/menus.h" #if defined(CPUARM) #include "telemetry/telemetry.h"