mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
Files movement continued (GUI finished). I will do the same for LCD
functions where we have too many ifdef
This commit is contained in:
parent
35207ce6f6
commit
64d4219bfb
47 changed files with 1221 additions and 3403 deletions
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
|
@ -34,6 +34,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "menus.h"
|
||||
|
||||
#define NUM_BODY_LINES LCD_LINES-1
|
||||
#define MENU_TITLE_HEIGHT FH
|
||||
#define MENU_NAVIG_HEIGHT 0
|
||||
|
|
2
radio/src/gui/menu_general.cpp → radio/src/gui/9X/menu_general.cpp
Normal file → Executable file
2
radio/src/gui/menu_general.cpp → radio/src/gui/9X/menu_general.cpp
Normal file → Executable file
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "../opentx.h"
|
||||
#include "../../opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern LP_CONST LanguagePack czLanguagePack;
|
60
radio/src/gui/menu_model.cpp → radio/src/gui/9X/menu_model.cpp
Normal file → Executable file
60
radio/src/gui/menu_model.cpp → radio/src/gui/9X/menu_model.cpp
Normal file → Executable file
|
@ -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);
|
||||
#endif
|
||||
|
||||
#if MENU_COLUMNS < 2
|
||||
#if LCD_W >= 212
|
||||
#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)
|
||||
#define MIXES_2ND_COLUMN (12*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<size-1) cur++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS)
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_LONG:
|
||||
if (v==0) {
|
||||
s_editMode = 0;
|
||||
|
@ -219,10 +187,8 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
|||
// no break
|
||||
#endif
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
#endif
|
||||
if (v>=-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);
|
2
radio/src/gui/menus.cpp → radio/src/gui/9X/menus.cpp
Normal file → Executable file
2
radio/src/gui/menus.cpp → radio/src/gui/9X/menus.cpp
Normal file → Executable file
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "../opentx.h"
|
||||
#include "../../opentx.h"
|
||||
|
||||
MenuFuncP g_menuStack[5];
|
||||
uint8_t menuEvent = 0;
|
143
radio/src/gui/menus.h → radio/src/gui/9X/menus.h
Normal file → Executable file
143
radio/src/gui/menus.h → radio/src/gui/9X/menus.h
Normal file → Executable file
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
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);
|
34
radio/src/gui/view_about.cpp → radio/src/gui/9X/view_about.cpp
Normal file → Executable file
34
radio/src/gui/view_about.cpp → radio/src/gui/9X/view_about.cpp
Normal file → Executable file
|
@ -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;
|
||||
|
2
radio/src/gui/view_mavlink.cpp → radio/src/gui/9X/view_mavlink.cpp
Normal file → Executable file
2
radio/src/gui/view_mavlink.cpp → radio/src/gui/9X/view_mavlink.cpp
Normal file → Executable file
|
@ -41,7 +41,7 @@
|
|||
* Contains the menu specific code for Mavlink support.
|
||||
*/
|
||||
|
||||
#include "gui/view_mavlink.h"
|
||||
#include "view_mavlink.h"
|
||||
|
||||
// Globals declaration
|
||||
|
0
radio/src/gui/view_mavlink.h → radio/src/gui/9X/view_mavlink.h
Normal file → Executable file
0
radio/src/gui/view_mavlink.h → radio/src/gui/9X/view_mavlink.h
Normal file → Executable file
158
radio/src/gui/Taranis/fonts.cpp
Executable file
158
radio/src/gui/Taranis/fonts.cpp
Executable file
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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)
|
|
@ -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
|
||||
|
|
105
radio/src/gui/Taranis/menu_general.cpp
Executable file
105
radio/src/gui/Taranis/menu_general.cpp
Executable file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
211
radio/src/gui/Taranis/menu_model.cpp
Executable file
211
radio/src/gui/Taranis/menu_model.cpp
Executable file
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - 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<size-1)
|
||||
cur++;
|
||||
else
|
||||
s_editMode = 0;
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LONG:
|
||||
if (v==0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
if (v>=-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;
|
|
@ -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));
|
||||
|
|
|
@ -113,7 +113,7 @@ void menuModelFlightModesAll(uint8_t event)
|
|||
|
||||
for (uint8_t j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && 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 ITEM_FLIGHT_MODES_NAME:
|
||||
editName(4*FW-1, y, p->name, sizeof(p->name), event, attr);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<<posHorz);
|
||||
eeDirty(EE_MODEL);
|
||||
|
|
|
@ -179,7 +179,7 @@ void menuModelLimits(uint8_t event)
|
|||
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; 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) ;
|
||||
if (active) STICK_SCROLL_DISABLE();
|
||||
switch(j)
|
||||
{
|
||||
|
|
|
@ -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:
|
||||
{
|
||||
|
|
|
@ -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<<i)) || (attr && CURSOR_ON_LINE())) ? INVERS : 0 ) );
|
||||
}
|
||||
if (attr && CURSOR_ON_CELL) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
|
@ -510,7 +510,7 @@ void menuModelSetup(uint8_t event)
|
|||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
if (attr && (editMode>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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
85
radio/src/gui/Taranis/menus.cpp
Executable file
85
radio/src/gui/Taranis/menus.cpp
Executable file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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);
|
||||
}
|
378
radio/src/gui/Taranis/menus.h
Executable file
378
radio/src/gui/Taranis/menus.h
Executable file
|
@ -0,0 +1,378 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<count; ++i) {
|
||||
int stop = stops[i];
|
||||
if (value == stop)
|
||||
return true;
|
||||
else if (value < stop)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
extern const CheckIncDecStops &stops100;
|
||||
extern const CheckIncDecStops &stops1000;
|
||||
extern const CheckIncDecStops &stopsSwitch;
|
||||
|
||||
#define INIT_STOPS(var, ...) \
|
||||
const int _ ## var[] = { __VA_ARGS__ }; \
|
||||
const CheckIncDecStops &var = (const CheckIncDecStops&)_ ## var;
|
||||
#define CATEGORY_END(val) \
|
||||
(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);
|
||||
int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#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 CHECK_INCDEC_MODELVAR(event, var, min, max) \
|
||||
var = checkIncDecModel(event, var, min, max)
|
||||
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO(event, var, max) \
|
||||
var = checkIncDecModelZero(event, var, max)
|
||||
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL, check)
|
||||
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
|
||||
bool isThrottleSourceAvailable(int source);
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch);
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch);
|
||||
bool isSwitchAvailableInMixes(int swtch);
|
||||
bool isSwitchAvailableInTimers(int swtch);
|
||||
bool isModuleAvailable(int module);
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
|
||||
|
||||
bool isInputAvailable(int input);
|
||||
bool isSourceAvailable(int source);
|
||||
bool isSourceAvailableInCustomSwitches(int source);
|
||||
bool isInputSourceAvailable(int source);
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
|
||||
|
||||
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
|
||||
var = checkIncDecGen(event, var, min, max)
|
||||
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
|
||||
#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);
|
||||
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);
|
||||
|
||||
void title(const pm_char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
#define MENU_CHECK(tab, menu, lines_count) \
|
||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1)
|
||||
|
||||
#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \
|
||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1, flags)
|
||||
|
||||
#define MENU(title, tab, menu, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
MENU_CHECK(tab, menu, lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
MENU_CHECK_FLAGS(tab, menu, flags, lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
||||
|
||||
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
||||
SIMPLE_MENU_NOTITLE(tab, menu, lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
||||
}
|
||||
|
||||
#define SUBMENU(title, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
||||
TITLE(title)
|
||||
|
||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||
check_submenu_simple(event, (lines_count)-1);
|
||||
|
||||
#define SIMPLE_SUBMENU(title, lines_count) \
|
||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
typedef int select_menu_value_t;
|
||||
|
||||
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
|
||||
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
|
||||
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event);
|
||||
|
||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = onoffMenuItem(value, x, y, label, attr, event)
|
||||
|
||||
#if defined(GVARS)
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) gvarMenuItem(x, y, v, min, max, lcdattr, editflags, event)
|
||||
#else
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, lcdattr, editflags, event) gvarMenuItem(x, y, v, min, max, lcdattr, event)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event);
|
||||
#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);
|
||||
#define displayGVar(x, y, v, min, max) lcd_outdez8(x, y, v)
|
||||
#endif
|
||||
|
||||
void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uint8_t active);
|
||||
|
||||
#define WARNING_TYPE_ASTERISK 0
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const pm_char * s_warning;
|
||||
extern const pm_char * s_warning_info;
|
||||
extern uint8_t s_warning_info_len;
|
||||
extern uint8_t s_warning_result;
|
||||
extern uint8_t s_warning_type;
|
||||
|
||||
#define MENU_X 30
|
||||
#define MENU_Y 16
|
||||
#define MENU_W LCD_W-(2*MENU_X)
|
||||
#define WARNING_LINE_LEN 32
|
||||
#define WARNING_LINE_X 16
|
||||
#define WARNING_LINE_Y 3*FH
|
||||
|
||||
void displayBox();
|
||||
void displayPopup(const pm_char * pstr);
|
||||
void displayWarning(uint8_t event);
|
||||
|
||||
extern void (*popupFunc)(uint8_t event);
|
||||
extern int16_t s_warning_input_value;
|
||||
extern int16_t s_warning_input_min;
|
||||
extern int16_t s_warning_input_max;
|
||||
extern uint8_t s_warning_info_flags;
|
||||
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (s_warning = s, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_CONFIRMATION(s) (s_warning = s, s_warning_type = WARNING_TYPE_CONFIRM, s_warning_info = 0, popupFunc = displayWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (s_warning = s, s_warning_type = WARNING_TYPE_INPUT, popupFunc = func, s_warning_input_value = start, s_warning_input_min = min, s_warning_input_max = max)
|
||||
#define WARNING_INFO_FLAGS s_warning_info_flags
|
||||
#define SET_WARNING_INFO(info, len, flags) (s_warning_info = info, s_warning_info_len = len, s_warning_info_flags = flags)
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define MENU_ADD_ITEM(s) s_menu[s_menu_count++] = s
|
||||
#define MENU_MAX_LINES 6
|
||||
#define MENU_ADD_SD_ITEM(s) MENU_ADD_ITEM(s)
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
extern const char *s_menu[MENU_MAX_LINES];
|
||||
extern uint16_t s_menu_count;
|
||||
extern uint8_t s_menu_flags;
|
||||
extern uint16_t s_menu_offset;
|
||||
const char * displayMenu(uint8_t event);
|
||||
extern void (*menuHandler)(const char *result);
|
||||
|
||||
#define STATUS_LINE_LENGTH 32
|
||||
extern char statusLineMsg[STATUS_LINE_LENGTH];
|
||||
void showStatusLine();
|
||||
void drawStatusLine();
|
||||
|
||||
void pushMenuTextView(const char *filename);
|
||||
bool modelHasNotes();
|
||||
void pushModelNotes();
|
||||
|
||||
void menuChannelsView(uint8_t event);
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
#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
|
||||
|
||||
#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()
|
||||
|
||||
#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_
|
|
@ -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:
|
||||
|
|
159
radio/src/gui/Taranis/view_about.cpp
Executable file
159
radio/src/gui/Taranis/view_about.cpp
Executable file
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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);
|
||||
}
|
||||
}
|
||||
}
|
4
radio/src/gui/view_channels.cpp → radio/src/gui/Taranis/view_channels.cpp
Normal file → Executable file
4
radio/src/gui/view_channels.cpp → radio/src/gui/Taranis/view_channels.cpp
Normal file → Executable file
|
@ -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);
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
||||
int16_t vt = anaIn(i);
|
||||
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
|
||||
reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]);
|
||||
if (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<count; j++) {
|
||||
int16_t step = reusableBuffer.calib.xpotsCalib[idx].steps[j];
|
||||
if (position >= 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<NUM_STICKS+NUM_POTS; i++) {
|
||||
reusableBuffer.calib.loVals[i] = 15000;
|
||||
reusableBuffer.calib.hiVals[i] = -15000;
|
||||
reusableBuffer.calib.midVals[i] = anaIn(i);
|
||||
#if defined(PCBTARANIS)
|
||||
if (i<NUM_XPOTS) {
|
||||
reusableBuffer.calib.xpotsCalib[i].stepsCount = 0;
|
||||
reusableBuffer.calib.xpotsCalib[i].lastCount = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// MOVE STICKS/POTS
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcd_putsAtt(0*FW, MENU_TITLE_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcd_putsLeft(MENU_TITLE_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[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; j<count; j++) {
|
||||
for (int k=j+1; k<count; k++) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
|
||||
swap(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
calib->count = count - 1;
|
||||
for (int j=0; j<calib->count; 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);
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<NUM_STICKS+NUM_POTS; i++) {
|
||||
#if (NUM_STICKS+NUM_POTS) > 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
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<DIM(g_rotenc); i++) {
|
||||
coord_t y = MENU_TITLE_HEIGHT /* ??? + 1 ??? */ + i*FH;
|
||||
lcd_putsiAtt(14*FW, y, STR_VRENCODERS, i, 0);
|
||||
lcd_outdezNAtt(18*FW, y, g_rotenc[i], LEFT|(switchState((EnumKeys)(BTN_REa+i)) ? INVERS : 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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; i<LCD_LINES-1; ++i) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + s_pgOfs;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+1] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
uint8_t attr = (sub == k ? ((s_editMode>0) ? 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; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t blink = ((s_editMode>0) ? 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
|
|
@ -1,422 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<BOOTLOADER_SIZE; i+=1024) {
|
||||
watchdogSetTimeout(100/*1s*/);
|
||||
if (f_read(&file, buffer, 1024, &count) != FR_OK || count != 1024) {
|
||||
POPUP_WARNING(STR_SDCARD_ERROR);
|
||||
break;
|
||||
}
|
||||
if (i==0 && !isBootloaderStart((uint32_t *)buffer)) {
|
||||
POPUP_WARNING(STR_INCOMPATIBLE);
|
||||
break;
|
||||
}
|
||||
for (int j=0; j<1024; j+=FLASH_PAGESIZE) {
|
||||
writeFlash(CONVERT_UINT_PTR(FIRMWARE_ADDRESS+i+j), (uint32_t *)(buffer+j));
|
||||
lcd_hline(5, 6*FH+6, (200*i)/BOOTLOADER_SIZE, FORCE);
|
||||
lcd_hline(5, 6*FH+7, (200*i)/BOOTLOADER_SIZE, FORCE);
|
||||
lcd_hline(5, 6*FH+8, (200*i)/BOOTLOADER_SIZE, FORCE);
|
||||
lcdRefresh();
|
||||
SIMU_SLEEP(30/*ms*/);
|
||||
}
|
||||
}
|
||||
|
||||
if (unlocked) {
|
||||
lockFlash();
|
||||
unlocked = 0;
|
||||
}
|
||||
|
||||
f_close(&file);
|
||||
}
|
||||
#endif
|
||||
|
||||
void onSdManagerMenu(const char *result)
|
||||
{
|
||||
TCHAR lfn[_MAX_LFN+1];
|
||||
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
if (result == STR_SD_INFO) {
|
||||
pushMenu(menuGeneralSdManagerInfo);
|
||||
}
|
||||
else if (result == STR_SD_FORMAT) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
|
||||
}
|
||||
else if (result == STR_DELETE_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat_P(lfn, PSTR("/"));
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
f_unlink(lfn);
|
||||
strncpy(statusLineMsg, reusableBuffer.sdmanager.lines[index], 13);
|
||||
strcpy_P(statusLineMsg+min((uint8_t)strlen(statusLineMsg), (uint8_t)13), STR_REMOVED);
|
||||
showStatusLine();
|
||||
if ((uint16_t)m_posVert == reusableBuffer.sdmanager.count) m_posVert--;
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs-1;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
/* TODO else if (result == STR_LOAD_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
POPUP_WARNING(eeLoadModelSD(lfn));
|
||||
} */
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
audioQueue.stopAll();
|
||||
audioQueue.playFile(lfn, 0, ID_PLAY_FROM_SD_MANAGER);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
else if (result == STR_ASSIGN_BITMAP) {
|
||||
strAppendFilename(g_model.header.bitmap, reusableBuffer.sdmanager.lines[index], sizeof(g_model.header.bitmap));
|
||||
LOAD_MODEL_BITMAP();
|
||||
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
else if (result == STR_VIEW_TEXT) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
pushMenuTextView(lfn);
|
||||
}
|
||||
else if (result == STR_FLASH_BOOTLOADER) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
flashBootloader(lfn);
|
||||
}
|
||||
#endif
|
||||
#if defined(LUA)
|
||||
else if (result == STR_EXECUTE_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
luaExec(lfn);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void menuGeneralSdManager(uint8_t _event)
|
||||
{
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
#if defined(SDCARD)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
displayPopup(STR_FORMATTING);
|
||||
closeLogs();
|
||||
#if defined(PCBSKY9X)
|
||||
Card_state = SD_ST_DATA;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
audioQueue.stopSD();
|
||||
#endif
|
||||
if (f_mkfs(0, 1, 0) == FR_OK) {
|
||||
f_chdir("/");
|
||||
reusableBuffer.sdmanager.offset = -1;
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_SDCARD_ERROR);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t event = ((READ_ONLY() && EVT_KEY_MASK(_event) == KEY_ENTER) ? 0 : _event);
|
||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, 1+reusableBuffer.sdmanager.count);
|
||||
|
||||
if (s_editMode > 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<LCD_LINES-1; i++) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
if (i < 6) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (6-i));
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[i]));
|
||||
strcpy(line, fn);
|
||||
line[SD_SCREEN_FILE_LENGTH+1] = isfile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.sdmanager.offset == s_pgOfs) {
|
||||
for (int8_t i=6; 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<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
lcdNextPos = 0;
|
||||
uint8_t attr = (m_posVert-1-s_pgOfs == i ? BSS|INVERS : BSS);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
|
||||
lcd_putsAtt(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdNextPos, y, ']', attr); }
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
static vertpos_t sdBitmapIdx = 0xFFFF;
|
||||
static uint8_t sdBitmap[MODEL_BITMAP_SIZE];
|
||||
vertpos_t index = m_posVert-1-s_pgOfs;
|
||||
if (m_posVert > 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
|
||||
}
|
|
@ -1,620 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_TITLE_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+s_pgOfs;
|
||||
uint8_t blink = ((s_editMode>0) ? 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<<i)) {
|
||||
drawFilledRect((6+4*i)*FW, y, 3*FW, FH-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(FRSKY_STICKS)
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickReverse, 0, 15);
|
||||
lcd_rect(6*FW-1, y-1, 15*FW+2, 9);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
||||
}
|
||||
if (attr && s_editMode>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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<EESIZE; i+=1024) {
|
||||
UINT count;
|
||||
eeprom_read_block(buffer, i, 1024);
|
||||
f_write(&file, buffer, 1024, &count);
|
||||
lcd_hline(5, 6*FH+6, (200*i)/EESIZE, FORCE);
|
||||
lcd_hline(5, 6*FH+7, (200*i)/EESIZE, FORCE);
|
||||
lcd_hline(5, 6*FH+8, (200*i)/EESIZE, FORCE);
|
||||
lcdRefresh();
|
||||
SIMU_SLEEP(100/*ms*/);
|
||||
}
|
||||
|
||||
f_close(&file);
|
||||
|
||||
//set back unexpectedShutdown
|
||||
g_eeGeneral.unexpectedShutdown = 1;
|
||||
eeDirty(EE_GENERAL);
|
||||
eeCheck(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuGeneralVersion(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1);
|
||||
|
||||
lcd_putsLeft(MENU_TITLE_HEIGHT+FH, vers_stamp);
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
if (Coproc_valid == 1) {
|
||||
lcd_putsLeft(6*FH, PSTR("CoPr:"));
|
||||
lcd_outdez8(10*FW, 6*FH, Coproc_read);
|
||||
}
|
||||
else {
|
||||
lcd_putsLeft(6*FH, PSTR("CoPr: ---"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsLeft(MENU_TITLE_HEIGHT+6*FH, STR_EEBACKUP);
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
backupEeprom();
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,320 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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; i+=6) {
|
||||
lcd_vline(x+i+6, y-1, 3);
|
||||
}
|
||||
for (coord_t i=1; i<=MAXTRACE; i++) {
|
||||
lcd_vline(x+i, y-s_traceBuf[traceRd], s_traceBuf[traceRd]);
|
||||
traceRd++;
|
||||
if (traceRd>=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; i<LCD_LINES-2; i++) {
|
||||
y = 1 + (i+2)*FH;
|
||||
k = i+s_pgOfs;
|
||||
|
||||
//item
|
||||
lcd_outdezAtt(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
|
||||
const struct TraceElement * te = getTraceElement(k);
|
||||
if (te) {
|
||||
//time
|
||||
putstime_t tme = te->time % 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)
|
|
@ -1,634 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<frskyData.hub.cellsCount && k<6; k++) {
|
||||
#if defined(GAUGES)
|
||||
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
|
||||
#else
|
||||
uint8_t attr = PREC2;
|
||||
#endif
|
||||
lcd_outdezNAtt(LCD_W, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
|
||||
y += 1*FH;
|
||||
}
|
||||
lcd_vline(LCD_W-3*FW-2, 8, 47);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
void displayAfterFlightScreen()
|
||||
{
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_GPS_AVAILABLE()) {
|
||||
// Latitude
|
||||
lcd_putsLeft(line, STR_LATITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLatitudeNS, frskyData.hub.gpsLatitude_bp, frskyData.hub.gpsLatitude_ap);
|
||||
// Longitude
|
||||
line+=1*FH+1;
|
||||
lcd_putsLeft(line, STR_LONGITUDE);
|
||||
displayGpsCoord(line, frskyData.hub.gpsLongitudeEW, frskyData.hub.gpsLongitude_bp, frskyData.hub.gpsLongitude_ap);
|
||||
displayGpsTime();
|
||||
line+=1*FH+1;
|
||||
}
|
||||
// Rssi
|
||||
lcd_putsLeft(line, STR_MINRSSI);
|
||||
lcd_puts(TELEM_2ND_COLUMN, line, STR_TX);
|
||||
lcd_outdezNAtt(TELEM_2ND_COLUMN+3*FW, line, frskyData.rssi[1].min, LEFT|LEADING0, 2);
|
||||
lcd_puts(TELEM_2ND_COLUMN+6*FW, line, STR_RX);
|
||||
lcd_outdezNAtt(TELEM_2ND_COLUMN+9*FW, line, frskyData.rssi[0].min, LEFT|LEADING0, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with gauges
|
||||
uint8_t barHeight = 5;
|
||||
for (int8_t i=3; i>=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<NUM_LINE_ITEMS; j++) {
|
||||
source_t field = screen.lines[i].sources[j];
|
||||
if (field > 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<NUM_LINE_ITEMS; j++) {
|
||||
uint8_t field = screen.lines[i].sources[j];
|
||||
if (field > 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
|
||||
}
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - 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<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-s_pgOfs<LCD_LINES-1); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
if (c=='\\' && escape==0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
}
|
||||
else if (c!='\\' && escape>0 && 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; i++) {
|
||||
lcd_putsAtt(0, i*FH+FH+1, s_text_screen[i], FIXEDWIDTH);
|
||||
}
|
||||
|
||||
char *title = s_text_file;
|
||||
#if defined(SIMU)
|
||||
if (!strncmp(title, "./", 2)) title += 2;
|
||||
#else
|
||||
// TODO?
|
||||
#endif
|
||||
lcd_puts(LCD_W/2-strlen(title)*FW/2, 0, title);
|
||||
lcd_invert_line(0);
|
||||
|
||||
if (lines_count > 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);
|
||||
}
|
||||
}
|
|
@ -59,8 +59,6 @@ const pm_uchar * const splash_lbm = splashdata+4;
|
|||
};
|
||||
#endif
|
||||
|
||||
#include "gui/menus.h"
|
||||
|
||||
EEGeneral g_eeGeneral;
|
||||
ModelData g_model;
|
||||
|
||||
|
|
|
@ -1346,7 +1346,6 @@ void evalFunctions();
|
|||
#endif
|
||||
|
||||
#include "gui/gui.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "telemetry/telemetry.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue