Merge branch 'master' of https://github.com/tmrttmrt/opentx into tmrttmrt/Fixes#2750__Mega2560_ST7920_mixer_freq_too_slow

This commit is contained in:
Tomaz Mertelj
2015-09-30 22:09:16 +02:00
313 changed files with 24053 additions and 48662 deletions
+66 -6
View File
@@ -1,21 +1,81 @@
<h2>Version 2.1.2 / <set date></h2>
<h2>Version 2.1.4 / <set date></h2>
[AVR boards]
<ul>
<li>Fixed several problems with automatic playing of Physical and Logical Switches changes (eg LS15-on.wav, SG-mid.wav) (<a href=https://github.com/opentx/opentx/issues/2855>#2855</a>)</li>
<li>Sorce selector did not work in Telemetry screen for Bars (<a href=https://github.com/opentx/opentx/issues/2843>#2843</a>)</li>
</ul>
<h2>Version 2.1.3 / 2015-09-09</h2>
[ARM boards]
<ul>
<li>Fix shift in automatic switch sounds (<a href=https://github.com/opentx/opentx/issues/2855>#2855</a>)</li>
</ul>
[Taranis]
<ul>
<li>Fix broken popup menu on some special functions (<a href=https://github.com/opentx/opentx/issues/2851>#2851</a>)</li>
</ul>
[AVR boards]
<ul>
<li>Fix timers not working (<a href=https://github.com/opentx/opentx/issues/2848>#2848</a>)</li>
</ul>
<h2>Version 2.1.2 / 2015-09-07</h2><br>
<b>PLEASE NOTE the following important information:</b>
<ul>
<li>FrSky Taranis X9E users are highly advised to upgrade firmware (including bootloader!) to this version or its equivalent when provided by FrSky due to the risk of shutdown upon software error that was present in previous versions.</li>
<li>Telemetry sensors are no longer continuously detected, it is now necessary to go to the telemetry setup page and select the "Discover new sensors" menu item. This prevents creation of non-existing sensors in case if transmission errors, and allows deleting sensors that are received but considered uninteresting.</li>
<li>A bug was found in the "Throttle source" setting, fixing it might have changed your selection. If your throttle-based timers don't work check this first and set it back to the correct setting if needed.</li>
</ul>
[ARM Boards]
<ul>
<li>Fixed several issues with D series altimeter/vario (negative values, hi/lo precision vario) (<a href=https://github.com/opentx/opentx/issues/2685>#2685</a>)</li>
<li>Auto-offset for Frsky variometer on per default (<a href=https://github.com/opentx/opentx/issues/2693>#2693</a>)</li>
<li>9XE top LDC fixes: added TX battery blinking on battery warning, fixed display problem when battery voltage lower than batlow value. (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>Auto-offset for Frsky variometer on by default (<a href=https://github.com/opentx/opentx/issues/2693>#2693</a>)</li>
<li>Timers range extended (it was limited to around 9 hours before) (<a href=https://github.com/opentx/opentx/issues/2702>#2702</a>)</li>
<li>Fixed: Playing two background sounds at once causes sound to stop (<a href=https://github.com/opentx/opentx/issues/2704>#2704</a>)</li>
<li>Several fixes to the SD card manager menu (<a href=https://github.com/opentx/opentx/issues/2623>#2623</a>)</li>
<li>Fixed the difference between top and main LCD TX battery bars on 9Xe (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>Several Lua getValue() fields were not exported correctly (tx-voltage, clock and timers1-3)</li>
<li>Several Lua getValue() fields were not exported correctly (tx-voltage, clock and timers 1-3)</li>
<li>Fixed: Edge Logical Switch could trigger right after the model was loaded or the radio turned on (<a href=https://github.com/opentx/opentx/issues/2728>#2728</a>)</li>
<li>Fixed: output channel jitter if trim was used (<a href=https://github.com/opentx/opentx/issues/2774>#2774</a>)</li>
<li>Fixed: Logical switches based on telemetry sensors above number 20 were not working (<a href=https://github.com/opentx/opentx/issues/2787>#2787</a>)</li>
<li>Added menu option to delete all detected/configured telemetry sensors (<a href=https://github.com/opentx/opentx/issues/2730>#2730</a>)</li>
<li>Improved "Adjust GVAR" SF source selection with popup (<a href=https://github.com/opentx/opentx/issues/2418>#2418</a>)</li>
<li>Improved mixer screen layout (<a href=https://github.com/opentx/opentx/issues/2785>#2785</a>)</li>
<li>Added support for the AR9X replacement board (prototype) for the Turnigy 9X radio, info <a href=http://www.rcgroups.com/forums/showthread.php?t=2479552>here</a></li>
<li>Added a virtual serial port over USB and a command line interface (via option, replacing joystick) (<a href=https://github.com/opentx/opentx/issues/2595>#2595</a>)</li>
</ul>
[Sky9x / 9XR-PRO]
[X9E]
<ul>
<li>Unwanted radio turning off on watchdog reset fixed (<a href=https://github.com/opentx/opentx/issues/2681>#2681</a>, <a href=https://github.com/opentx/opentx/issues/2790>#2790</a>)</li>
<li>Added code to help mitigate the issue of RTC loosing its time when radio was turned off (<a href=https://github.com/opentx/opentx/issues/2626>#2626</a>)</li>
<li>X9E top LCD fixes: added TX battery blinking on battery warning, fixed display problem when battery voltage lower than batlow value. (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>Fixed the difference between top and main LCD TX battery bars on X9E (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
</ul>
[Sky9x / 9XR-PRO / AR9X]
<ul>
<li>Sound was unintelligible (<a href=https://github.com/opentx/opentx/issues/2665>#2665</a>)</li>
<li>PXX and Smart Port telemetry weren't enabled</li>
</ul>
[MEGA2560]
<ul>
<li>Audio was not working (<a href=https://github.com/opentx/opentx/issues/2825>#2825</a>)</li>
</ul>
[All]
<ul>
<li>Various texts and translations corrections</li>
<li>Various small bug-fixes</li>
</ul>
+85 -31
View File
@@ -50,7 +50,7 @@ DELAY = 5
#----------- BUILD OPTIONS ---------------------------
# PCB version
# Values: 9X, 9X128, 9X2561, 9XR, 9XR128, 9XR2561, GRUVIN9X, MEGA2560, SKY9X, 9XRPRO, TARANIS
# Values: 9X, 9X128, 9X2561, 9XR, 9XR128, 9XR2561, GRUVIN9X, MEGA2560, SKY9X, 9XRPRO, AR9X, TARANIS
# Old values STD and STD128 are mapped to 9X and 9X128 for compatibility
PCB = 9X
@@ -214,6 +214,11 @@ VARIO = YES
# default = YES (means enabled when available)
RTCLOCK = YES
# Hardware volume
# Values = YES, NO
# default = YES (AR9X board doesn't have a hardware volume control as delivered but it can be fitted optionally)
HARDWARE_VOLUME = YES
# BLUETOOTH
# Values = YES, NO
BLUETOOTH = NO
@@ -268,6 +273,10 @@ SHUTDOWN_CONFIRMATION = NO
# Values = YES, NO
DEBUG = NO
# Activate Command Line Interpreter
# Values = NO, YES
CLI = NO
# Activate writing of SPORT telemetry received data to sport.log file
# Values = YES, NO
SPORT_FILE_LOG = NO
@@ -301,9 +310,10 @@ LUA = NO
MENUS_LOCK = NO
# USB options in the main image
# Values = JOYSTICK, MASSSTORAGE
# Values = JOYSTICK, MASSSTORAGE, SERIAL
# JOYSTICK: The TX will appear as a joystick
# MASSSTORAGE: The TX will appear as a drive
# SERIAL: The TX will appear as a serial port
USB = JOYSTICK
# Mixers monitor view added to Channels monitor one
@@ -361,6 +371,14 @@ SIMU_DISKIO = NO
# Values = NO, YES
SIMU_AUDIO = NO
# Enable Watchdog test (DANGEROUS)
# Values = NO, YES
WATCHDOG_TEST = NO
# Treat compiler warnings as errors
# Values = NO, YES
WARNINGS_AS_ERRORS = NO
#------- END BUILD OPTIONS ---------------------------
# Define programs and commands.
@@ -377,7 +395,7 @@ IMG2LBM = -$(PYTHON) ../util/img2lbm.py
BIN2LBM = -$(PYTHON) ../util/bin2lbm.py
FONT2PNG = -$(PYTHON) ../util/font2png.py
TRANSLATE = -$(PYTHON) ../util/translate.py
VERSION = 2.1.2$(OPENTX_VERSION_SUFFIX)
VERSION = 2.1.4$(OPENTX_VERSION_SUFFIX)
THIRDPARTY = thirdparty
COOSDIR = $(THIRDPARTY)/CoOS
@@ -391,7 +409,7 @@ LUADEP =
DEBUG_TRACE_BUFFER = NO
# MCU name
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO TARANIS))
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO AR9X TARANIS))
$(error Sorry, the PCB $(PCB) is not supported yet in OpenTX)
endif
@@ -746,16 +764,22 @@ ifeq ($(PCB), MEGA2560)
CPPDEFS += -DROTARY_ENCODERS=${ROTARY_ENCODERS}
endif
ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
# 9x/9XR radio with a sky9x replacement board
GUIDIRECTORY = 9X
ARCH = ARM
LCDSIZE = 128
CPPDEFS = -Dat91sam3s4
ifeq ($(PCB), 9XRPRO)
CPPDEFS = -Dat91sam3s8
FLAVOUR = 9xrpro
CPPDEFS += -DREVX
LDSCRIPT = targets/sky9x/sam3s8c_flash.ld
else ifeq ($(PCB), AR9X)
CPPDEFS = -Dat91sam3s8
FLAVOUR = ar9x
CPPDEFS += -DAR9X
LDSCRIPT = targets/sky9x/sam3s8c_flash.ld
else ifeq ($(PCBREV), REVA)
FLAVOUR = sky9x
CPPDEFS += -DREVA
@@ -778,7 +802,8 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
SDCARD = YES
BUZZER = NO
THR_TRACE = YES
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DDSM2 -DDSM2_PPM
EXT = FRSKY_SPORT
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DDSM2 -DDSM2_PPM -DPXX
ifeq ($(PCB), SKY9X)
CPPDEFS += -DROTARY_ENCODERS=1
CPPSRC += targets/sky9x/rotenc_driver.cpp
@@ -799,7 +824,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.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/$(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 += targets/sky9x/telemetry_driver.cpp targets/sky9x/serial2_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
ifeq ($(SDCARD), YES)
@@ -824,6 +849,9 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
ifeq ($(DEBUG), YES)
SRC += syscalls.c
endif
ifeq ($(HARDWARE_VOLUME), NO)
CPPDEFS += -DNO_HARDWARE_VOLUME
endif
endif
ifeq ($(PCB), TARANIS)
@@ -913,17 +941,20 @@ ifeq ($(PCB), TARANIS)
LDSCRIPT = targets/taranis/stm32f2_flash.ld
endif
STM32USBPATH = $(THIRDPARTY)/STM32_USB-Host-Device_Lib_V2.1.0/Libraries
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_hardware.cpp
BOARDSRC = main_arm.cpp targets/taranis/board_taranis.cpp
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c serial.cpp
SRC += $(COOSDIR)/kernel/core.c $(COOSDIR)/kernel/hook.c $(COOSDIR)/kernel/task.c $(COOSDIR)/kernel/event.c $(COOSDIR)/kernel/time.c $(COOSDIR)/kernel/timer.c $(COOSDIR)/kernel/flag.c $(COOSDIR)/kernel/mutex.c $(COOSDIR)/kernel/serviceReq.c $(COOSDIR)/portable/GCC/port.c $(COOSDIR)/portable/arch.c
SRC += targets/taranis/pwr_driver.c targets/taranis/usb_driver.c
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp eeprom_conversions.cpp
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 += 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/serial2_driver.cpp targets/taranis/telemetry_driver.cpp
CPPSRC += bmp.cpp gui/$(GUIDIRECTORY)/view_channels.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp debug.cpp
CPPSRC += loadboot.cpp
ifeq ($(PCBREV), REV9E)
@@ -966,6 +997,10 @@ ifeq ($(PCB), TARANIS)
ifeq ($(USB), JOYSTICK)
CPPDEFS += -DUSB_JOYSTICK
SRC += targets/taranis/usbd_hid_joystick.c
else ifeq ($(USB), SERIAL)
CPPDEFS += -DUSB_SERIAL
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
EXTRABOARDSRC += targets/taranis/usbd_cdc.cpp
else
CPPDEFS += -DUSB_MASS_STORAGE
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
@@ -1021,6 +1056,9 @@ ifeq ($(PCB), TARANIS)
ifeq ($(MIXERS_MONITOR), YES)
CPPDEFS += -DMIXERS_MONITOR
endif
ifeq ($(WATCHDOG_TEST), YES)
CPPDEFS += -DWATCHDOG_TEST
endif
endif
CC = $(TRGT)gcc
@@ -1046,7 +1084,7 @@ FORMAT = ihex
TARGET = opentx
# List C++ source files here. (C dependencies are automatically generated.)
ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO TARANIS))
ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X TARANIS))
TTS_SRC = translations/tts_cz.cpp translations/tts_de.cpp translations/tts_en.cpp translations/tts_es.cpp translations/tts_fr.cpp translations/tts_it.cpp translations/tts_nl.cpp translations/tts_pt.cpp translations/tts_sk.cpp translations/tts_se.cpp translations/tts_pl.cpp translations/tts_hu.cpp
else
STD_TTS_SRC = translations/tts_$(shell sh -c "echo $(TTS) | tr '[:upper:]' '[:lower:]'").cpp
@@ -1238,10 +1276,10 @@ ifeq ($(EXT), JETI)
endif
ifeq ($(EXT), MAVLINK)
CPPDEFS += -DMAVLINK
INCDIRS += thirdparty
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp serial.cpp
EEPROM_VARIANT += ${MAVLINK_VARIANT}
CPPDEFS += -DMAVLINK
INCDIRS += thirdparty targets/common_avr/
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp targets/common_avr/serial_driver.cpp
EEPROM_VARIANT += ${MAVLINK_VARIANT}
endif
ifeq ($(EXT), TELEMETREZ)
@@ -1250,13 +1288,18 @@ endif
ifeq ($(EXT), $(filter $(EXT), FRSKY FRSKY_SPORT TELEMETREZ))
CPPDEFS += -DFRSKY
ifeq ($(EXT), FRSKY_SPORT)
CPPSRC += telemetry/frsky.cpp telemetry/frsky_sport.cpp telemetry/frsky_d.cpp
CPPDEFS += -DFRSKY_SPORT
ifeq ($(ARCH), ARM)
CPPSRC += telemetry/frsky.cpp telemetry/frsky_d_arm.cpp
else
CPPSRC += telemetry/frsky.cpp telemetry/frsky_d.cpp
endif
ifeq ($(EXT), FRSKY_SPORT)
CPPSRC += telemetry/frsky_sport.cpp
CPPDEFS += -DFRSKY_SPORT
endif
CPPSRC += gui/$(GUIDIRECTORY)/view_telemetry.cpp
ifeq ($(FRSKY_HUB), YES)
@@ -1282,8 +1325,15 @@ ifeq ($(EXT), $(filter $(EXT), FRSKY FRSKY_SPORT TELEMETREZ))
EEPROM_VARIANT += ${FRSKY_VARIANT}
endif
ifeq ($(DEBUG), YES)
ifeq ($(SIMU), YES)
CPPDEFS += -DDEBUG
CPPSRC += dump.cpp
else ifeq ($(CLI), YES)
CPPDEFS += -DCLI -DDEBUG
CPPSRC += cli.cpp dump.cpp
else ifeq ($(DEBUG), YES)
CPPDEFS += -DDEBUG
CPPSRC += dump.cpp
endif
ifeq ($(EEPROM_PROGRESS_BAR), YES)
@@ -1381,6 +1431,10 @@ CPPFLAGS += -Wno-strict-aliasing
CPPFLAGS += -Wformat -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wtype-limits
INCFLAGS = $(patsubst %,-I%,$(INCDIRS))
ifeq ($(WARNINGS_AS_ERRORS), YES)
CPPFLAGS += -Werror
endif
MATH_LIB = -lm
#---------------- Linker Options ----------------
@@ -1435,7 +1489,7 @@ all: begin gccversion sizebefore build sizeafter end
# Change the build target to build a HEX file or a library.
ifeq ($(ARCH), AVR)
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
else ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO TARANIS))
else ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X TARANIS))
build: stamp_header tra lbm bootloader.lbm $(LUADEP) allsrc.cpp elf remallsrc bin
else
build: stamp_header tra lbm allsrc.cpp elf remallsrc bin
@@ -1447,8 +1501,8 @@ bootloader.lbm: targets/taranis/bootloader/bootloader_ramBoot.bin
$(BIN2LBM) $^ $@
.PHONY targets/taranis/bootloader/bootloader_ramBoot.bin:
@echo "Building bootloader..."
$(MAKE) -C targets/taranis/bootloader PCB=$(PCB) PCBREV=$(PCBREV) NANO=$(NANO)
else ifeq ($(PCB), 9XRPRO)
$(MAKE) -C targets/taranis/bootloader PCB=$(PCB) PCBREV=$(PCBREV) NANO=$(NANO) WARNINGS_AS_ERRORS=$(WARNINGS_AS_ERRORS)
else ifeq ($(PCB), $(filter $(PCB), 9XRPRO AR9X))
bootloader.lbm:
@echo "Fetching Mike's bootloader..."
wget http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash8.lbm
@@ -1787,15 +1841,16 @@ endif
#### GOOGLE TESTS
GTEST_DIR = ../gtest-1.6.0
GTEST_INCDIR = /usr/include/gtest
GTEST_SRCDIR = /usr/src/gtest/
# Where to find user code.
USER_DIR = ./
# All Google Test headers. Usually you shouldn't change this
# definition.
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
$(GTEST_DIR)/include/gtest/internal/*.h
GTEST_HEADERS = $(GTEST_INCDIR)/*.h \
$(GTEST_INCDIR)/internal/*.h
# House-keeping build targets.
@@ -1803,15 +1858,14 @@ GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
# Usually you shouldn't tweak such internal variables, indicated by a
# trailing _.
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
GTEST_SRCS = $(GTEST_SRCDIR)/src/*.cc $(GTEST_HEADERS)
# For simplicity and to avoid depending on Google Test's
# implementation details, the dependencies specified below are
# conservative and not optimized. This is fine as Google Test
# compiles fast and for ordinary users its source rarely changes.
gtest-all.o : $(GTEST_SRCS_)
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) -I$(GTEST_DIR)/include -c \
$(GTEST_DIR)/src/gtest-all.cc
gtest-all.o : $(GTEST_SRCS)
$(CXX) $(CPPFLAGS) -I$(GTEST_SRCDIR) -I$(GTEST_INCDIR) -c $(GTEST_SRCDIR)/src/gtest-all.cc
# Builds a sample test. A test should link with either gtest.a or
# gtest_main.a, depending on whether it defines its own main()
@@ -1821,5 +1875,5 @@ gtest-all.o : $(GTEST_SRCS_)
GTEST_TESTS_SRCS = $(shell find tests/ -type f -name '*.cpp')
gtests: allsimusrc.cpp $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp *.h tests/gtests.h gtest-all.o
g++ -std=gnu++0x $(CPPFLAGS) $(SIMUCPPFLAGS) allsimusrc.cpp $(LUASRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp -I$(GTEST_DIR) ${INCFLAGS} -I$(GTEST_DIR)/include -I/usr/include/qt4 -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest-all.o -fexceptions
g++ -std=gnu++0x $(CPPFLAGS) $(SIMUCPPFLAGS) allsimusrc.cpp $(LUASRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp ${INCFLAGS} -I$(GTEST_INCDIR) -I/usr/include/qt4 -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest-all.o -fexceptions
+43 -25
View File
@@ -213,10 +213,10 @@ uint32_t sdAvailablePhaseAudioFiles = 0;
uint64_t sdAvailableSwitchAudioFiles = 0;
uint64_t sdAvailableLogicalSwitchAudioFiles = 0;
#define MASK_SYSTEM_AUDIO_FILE(index) ((uint64_t)1 << index)
#define MASK_PHASE_AUDIO_FILE(index, event) ((uint32_t)1 << (2*index+event))
#define MASK_SWITCH_AUDIO_FILE(index) ((uint64_t)1 << index)
#define MASK_LOGICAL_SWITCH_AUDIO_FILE(index, event) ((uint64_t)1 << (2*index+event))
#define MASK_SYSTEM_AUDIO_FILE(index) ((uint64_t)1 << (index))
#define MASK_PHASE_AUDIO_FILE(index, event) ((uint32_t)1 << (2*(index)+(event)))
#define MASK_SWITCH_AUDIO_FILE(index) ((uint64_t)1 << (index))
#define MASK_LOGICAL_SWITCH_AUDIO_FILE(index, event) ((uint64_t)1 << (2*(index)+(event)))
char * getAudioPath(char * path)
{
@@ -302,37 +302,55 @@ void getPhaseAudioFile(char * filename, int index, unsigned int event)
strcat(tmp, SOUNDS_EXT);
}
void getSwitchAudioFile(char * filename, int index)
void getSwitchAudioFile(char * filename, swsrc_t index)
{
char * str = getModelAudioPath(filename);
int len = STR_VSWITCHES[0];
strncpy(str, &STR_VSWITCHES[1+len*(index+1)], len);
str += len-1;
if (*str == '\300') {
strcpy(str, "-up");
str += 3;
}
else if (*str == '-') {
strcpy(str, "-mid");
str += 4;
}
else if (*str == '\301') {
strcpy(str, "-down");
str += 5;
#if defined(PCBTARANIS)
if (index <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(index);
*str++ = 'S';
*str++ = 'A' + swinfo.quot;
const char * positions[] = { "-up", "-mid", "-down" };
strcpy(str, positions[swinfo.rem]);
}
else {
*(str+1) = 0;
div_t swinfo = div(index - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
*str++ = 'S';
*str++ = '1' + swinfo.quot;
*str++ = '1' + swinfo.rem;
*str = '\0';
}
#else
int len = STR_VSWITCHES[0];
strncpy(str, &STR_VSWITCHES[1+(len*index)], len);
str += len;
*str = '\0';
#endif
strcat(str, SOUNDS_EXT);
}
void getLogicalSwitchAudioFile(char * filename, int index, unsigned int event)
{
char * str = getModelAudioPath(filename);
#if defined(PCBTARANIS)
*str++ = 'L';
if (index >= 9) {
div_t qr = div(index+1, 10);
*str++ = '0' + qr.quot;
*str++ = '0' + qr.rem;
}
else {
*str++ = '1' + index;
}
#else
int len = STR_VSWITCHES[0];
strncpy(str, &STR_VSWITCHES[1+len*(index+SWSRC_FIRST_LOGICAL_SWITCH)], len);
str[len] = '\0';
strcat(str, suffixes[event]);
str += len;
#endif
strcpy(str, suffixes[event]);
strcat(str, SOUNDS_EXT);
}
@@ -381,11 +399,11 @@ void referenceModelAudioFiles()
}
// Switches Audio Files <switchname>-[up|mid|down].wav
for (int i=0; i<SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
for (int i=SWSRC_FIRST_SWITCH; i<=SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
getSwitchAudioFile(path, i);
// TRACE("referenceModelAudioFiles(): searching for %s in %s", filename, fn);
if (!strcasecmp(filename, fn)) {
sdAvailableSwitchAudioFiles |= MASK_SWITCH_AUDIO_FILE(i);
sdAvailableSwitchAudioFiles |= MASK_SWITCH_AUDIO_FILE(i-SWSRC_FIRST_SWITCH);
found = true;
TRACE("\tfound: %s", filename);
}
@@ -431,7 +449,7 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
}
else if (category == SWITCH_AUDIO_CATEGORY) {
if (sdAvailableSwitchAudioFiles & MASK_SWITCH_AUDIO_FILE(index)) {
getSwitchAudioFile(filename, index);
getSwitchAudioFile(filename, SWSRC_FIRST_SWITCH+index);
return true;
}
}
+7
View File
@@ -306,8 +306,15 @@ void audioStart();
#define AUDIO_ERROR() AUDIO_BUZZER(audioEvent(AU_ERROR), beep(4))
#define AUDIO_TIMER_30() AUDIO_BUZZER(audioEvent(AU_TIMER_30), { beepAgain=2; beep(2); })
#define AUDIO_TIMER_20() AUDIO_BUZZER(audioEvent(AU_TIMER_20), { beepAgain=1; beep(2); })
#if defined(HAPTIC)
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_LT10); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_00); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
#else
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
#endif
#define AUDIO_INACTIVITY() AUDIO_BUZZER(audioEvent(AU_INACTIVITY), beep(3))
#define AUDIO_MIX_WARNING(x) AUDIO_BUZZER(audioEvent(AU_MIX_WARNING_1+x-1), beep(1))
#define AUDIO_POT_MIDDLE(x) AUDIO_BUZZER(audioEvent(AU_STICK1_MIDDLE+x), beep(2))
+2 -2
View File
@@ -62,7 +62,7 @@ void audioQueue::heartbeat()
else {
#if defined(CPUM2560)
if (toneFreq) {
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
OCR4A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
speakerOn();
}
#endif
@@ -88,7 +88,7 @@ void audioQueue::heartbeat()
if (tone2TimeLeft > 0) {
#if defined(CPUM2560)
if (tone2Freq) {
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
OCR4A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
speakerOn();
}
#else
+8 -8
View File
@@ -39,11 +39,11 @@ void * bin_realloc(void * ptr, size_t size)
// if it fits in current slot, return it
// TODO if new size is smaller, try to relocate in smaller slot
if ( slots1.can_fit(ptr, size) ) {
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size); FLUSH();
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size);
return ptr;
}
if ( slots2.can_fit(ptr, size) ) {
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size); FLUSH();
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size);
return ptr;
}
@@ -51,10 +51,10 @@ void * bin_realloc(void * ptr, size_t size)
void * res = bin_malloc(size);
if (res == 0) {
// we don't have the space, use libc malloc
// TRACE("bin_malloc [%lu] FAILURE", size); FLUSH();
// TRACE("bin_malloc [%lu] FAILURE", size);
res = malloc(size);
if (res == 0) {
TRACE("libc malloc [%lu] FAILURE", size); FLUSH();
TRACE("libc malloc [%lu] FAILURE", size);
return 0;
}
}
@@ -73,7 +73,7 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
if (ptr) { // avoid a bunch of NULL pointer free calls
if (!bin_free(ptr)) {
// not our range, use libc allocator
// TRACE("libc free %p", ptr); FLUSH();
// TRACE("libc free %p", ptr);
free(ptr);
}
}
@@ -89,18 +89,18 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
}
if ( SimulateMallocFailure > 0) {
// simulate one malloc failure
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize); FLUSH();
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize);
return 0;
}
#endif // #if defined(DEBUG)
// try our allocator, if it fails use libc allocator
void * res = bin_realloc(ptr, nsize);
if (res && ptr) {
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
}
if (res == 0) {
res = realloc(ptr, nsize);
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
// if (res == 0 ){
// TRACE("realloc FAILURE %lu", nsize);
// dumpFreeMemory();
+5 -5
View File
@@ -20,7 +20,7 @@ public:
if (ptr == Bins[n].data) {
Bins[n].Used = false;
--NoUsedBins;
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n); FLUSH();
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n);
return true;
}
}
@@ -31,22 +31,22 @@ public:
}
void * malloc(size_t size) {
if (size > SIZE_SLOT) {
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size);
return 0;
}
if (NoUsedBins >= NUM_BINS) {
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size);
return 0;
}
for (size_t n = 0; n < NUM_BINS; ++n) {
if (!Bins[n].Used) {
Bins[n].Used = true;
++NoUsedBins;
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size); FLUSH();
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size);
return Bins[n].data;
}
}
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size);
return 0;
}
size_t size(void * ptr) {
Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File
Executable → Regular
View File
View File
View File

Before

Width:  |  Height:  |  Size: 740 B

After

Width:  |  Height:  |  Size: 740 B

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

View File

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Executable → Regular
View File
+353
View File
@@ -0,0 +1,353 @@
/*
* 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"
#include <ctype.h>
#define CLI_COMMAND_MAX_ARGS 8
#define CLI_COMMAND_MAX_LEN 256
OS_TID cliTaskId;
TaskStack<CLI_STACK_SIZE> cliStack;
Fifo<256> cliRxFifo;
uint8_t cliTracesEnabled = false;
typedef int (* CliFunction) (const char ** args);
struct CliCommand
{
const char * name;
CliFunction func;
const char * args;
};
struct MemArea
{
const char * name;
void * start;
int size;
};
void cliPrompt()
{
serialPutc('>');
}
int toInt(const char ** argv, int index, int * val)
{
if (*argv[index] == '\0') {
return 0;
}
else {
int base = 10;
const char * s = argv[index];
if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') {
base = 16;
s = &argv[index][2];
}
char * endptr = NULL;
*val = strtol(s, &endptr, base);
if (*endptr == '\0')
return 1;
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[index]);
return -1;
}
}
}
int cliBeep(const char ** argv)
{
int freq = BEEP_DEFAULT_FREQ;
int duration = 100;
if (toInt(argv, 1, &freq) >= 0 && toInt(argv, 2, &duration) >= 0) {
audioQueue.playTone(freq, duration, 20, PLAY_NOW);
}
return 0;
}
int cliPlay(const char ** argv)
{
audioQueue.playFile(argv[1], PLAY_NOW);
return 0;
}
int cliLs(const char ** argv)
{
FILINFO fno;
DIR dir;
char *fn; /* This function is assuming non-Unicode cfg. */
#if _USE_LFN
TCHAR lfn[_MAX_LFN + 1];
fno.lfname = lfn;
fno.lfsize = sizeof(lfn);
#endif
FRESULT res = f_opendir(&dir, argv[1]); /* 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 _USE_LFN
fn = *fno.lfname ? fno.lfname : fno.fname;
#else
fn = fno.fname;
#endif
serialPrint(fn);
}
}
else {
serialPrint("%s: Invalid directory \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliTrace(const char ** argv)
{
if (!strcmp(argv[1], "on")) {
cliTracesEnabled = true;
}
else if (!strcmp(argv[1], "off")) {
cliTracesEnabled = false;
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliStackInfo(const char ** argv)
{
int tid = 0;
if (toInt(argv, 1, &tid) > 0) {
int available = 0;
int total = 0;
switch(tid) {
case MENU_TASK_INDEX:
total = menusStack.size();
available = menusStack.available();
break;
case MIXER_TASK_INDEX:
total = mixerStack.size();
available = mixerStack.available();
break;
case AUDIO_TASK_INDEX:
total = audioStack.size();
available = audioStack.available();
break;
case CLI_TASK_INDEX:
total = cliStack.size();
available = cliStack.available();
break;
case MAIN_TASK_INDEX:
total = stackAvailable();
available = stackSize();
break;
default:
break;
}
serialPrint("%d available (%d total)", available, total);
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliVolume(const char ** argv)
{
int level = 0;
if (toInt(argv, 1, &level) > 0) {
setVolume(level);
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
const MemArea memAreas[] = {
{ "RCC", RCC, sizeof(RCC_TypeDef) },
{ "GPIOA", GPIOA, sizeof(GPIO_TypeDef) },
{ "GPIOB", GPIOB, sizeof(GPIO_TypeDef) },
{ "GPIOC", GPIOC, sizeof(GPIO_TypeDef) },
{ "GPIOD", GPIOD, sizeof(GPIO_TypeDef) },
{ "GPIOE", GPIOE, sizeof(GPIO_TypeDef) },
{ "GPIOF", GPIOF, sizeof(GPIO_TypeDef) },
{ "GPIOG", GPIOG, sizeof(GPIO_TypeDef) },
{ "USART1", USART1, sizeof(USART_TypeDef) },
{ "USART3", USART3, sizeof(USART_TypeDef) },
{ NULL, NULL, 0 },
};
int cliDisplay(const char ** argv)
{
int address = 0;
for (const MemArea * area = memAreas; area->name != NULL; area++) {
if (!strcmp(area->name, argv[1])) {
dump((uint8_t *)area->start, area->size);
return 0;
}
}
if (!strcmp(argv[1], "adc")) {
for (int i=0; i<NUMBER_ANALOG; i++) {
serialPrint("adc[%d] = %04X", i, Analog_values[i]);
}
}
else if (!strcmp(argv[1], "outputs")) {
for (int i=0; i<NUM_CHNOUT; i++) {
serialPrint("outputs[%d] = %04X", i, channelOutputs[i]);
}
}
else if (toInt(argv, 1, &address) > 0) {
int size = 256;
if (toInt(argv, 2, &size) >= 0) {
dump((uint8_t *)address, size);
}
}
return 0;
}
int cliHelp(const char ** argv);
const CliCommand cliCommands[] = {
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
{ "ls", cliLs, "<directory>" },
{ "play", cliPlay, "<filename>" },
{ "print", cliDisplay, "<address> [<size>] | <what>" },
{ "stackinfo", cliStackInfo, "<tid>" },
{ "trace", cliTrace, "on | off" },
{ "volume", cliVolume, "<level>" },
{ "help", cliHelp, "[<command>]" },
{ NULL, NULL, NULL } /* sentinel */
};
int cliHelp(const char ** argv)
{
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
if (argv[1][0] == '\0' || !strcmp(command->name, argv[0])) {
serialPrint("%s %s", command->name, command->args);
if (argv[1][0] != '\0') {
return 0;
}
}
}
if (argv[1][0] != '\0') {
serialPrint("Invalid command \"%s\"", argv[0]);
}
return -1;
}
int cliExecCommand(const char ** argv)
{
if (argv[0][0] == '\0')
return 0;
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
if (!strcmp(command->name, argv[0])) {
return command->func(argv);
}
}
serialPrint("Invalid command \"%s\"", argv[0]);
return -1;
}
int cliExecLine(char * line)
{
int len = strlen(line);
const char * argv[CLI_COMMAND_MAX_ARGS];
memset(argv, 0, sizeof(argv));
int argc = 1;
argv[0] = line;
for (int i=0; i<len; i++) {
if (line[i] == ' ') {
line[i] = '\0';
if (argc < CLI_COMMAND_MAX_ARGS) {
argv[argc++] = &line[i+1];
}
}
}
return cliExecCommand(argv);
}
void cliTask(void * pdata)
{
char line[CLI_COMMAND_MAX_LEN+1];
int pos = 0;
cliPrompt();
for (;;) {
uint8_t c;
while (!cliRxFifo.pop(c)) {
CoTickDelay(10); // 20ms
}
if (c == 12) {
// clear screen
serialPrint("\033[2J\033[1;1H");
cliPrompt();
}
else if (c == 127) {
// backspace
if (pos) {
line[--pos] = '\0';
serialPutc(c);
}
}
else if (c == '\r' || c == '\n') {
// enter
serialCrlf();
line[pos] = '\0';
cliExecLine(line);
pos = 0;
cliPrompt();
}
else if (isascii(c) && pos < CLI_COMMAND_MAX_LEN) {
line[pos++] = c;
serialPutc(c);
}
}
}
void cliStart()
{
cliTaskId = CoCreateTaskEx(cliTask, NULL, 10, &cliStack.stack[CLI_STACK_SIZE-1], CLI_STACK_SIZE, 1, false);
}
+54
View File
@@ -0,0 +1,54 @@
/*
* 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 _CLI_H_
#define _CLI_H_
#include "serial.h"
extern uint8_t cliTracesEnabled;
#ifdef __cplusplus
#include "fifo.h"
extern Fifo<256> cliRxFifo;
#include "tasks_arm.h"
#define CLI_STACK_SIZE 1000
extern TaskStack<CLI_STACK_SIZE> cliStack;
#endif
void cliStart();
#endif // _CLI_H_
+6 -199
View File
@@ -34,225 +34,34 @@
*
*/
extern "C" {
#include <stdio.h>
#include <stdarg.h>
}
#include "opentx.h"
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#include <stdarg.h>
#if defined(SIMU)
traceCallbackFunc traceCallback = 0;
#endif
#if defined(SIMU)
#define PRINTF_BUFFER_SIZE 1024
#else
#define PRINTF_BUFFER_SIZE 256
#endif
// Outputs a string to the UART
void debugPuts(const char *format, ...)
#define PRINTF_BUFFER_SIZE 1024
void debugPrintf(const char * format, ...)
{
va_list arglist;
char tmp[PRINTF_BUFFER_SIZE];
va_start(arglist, format);
vsnprintf(tmp, PRINTF_BUFFER_SIZE, format, arglist);
va_end(arglist);
#if defined(SIMU)
fputs(tmp, stdout);
fflush(stdout);
if (traceCallback) {
traceCallback(tmp);
}
#else
const char *t = tmp;
while (*t) {
debugPutc(*t++);
}
}
#endif
}
void dump(unsigned char *data, unsigned int size)
{
debugPuts("DUMP %d bytes ...\n\r", size);
unsigned int i = 0, j=0;
while (i*32+j < size) {
debugPuts("%.2X ", data[i*32+j]);
j++;
if (j==32) {
i++; j=0;
debugPuts("\n\r");
}
}
debugPuts("\n\r");
}
#if !defined(SIMU)
uint32_t Mem_address ;
uint32_t Next_mem_address ;
uint32_t Memaddmode ;
Fifo<512> debugRxFifo;
void crlf()
{
debugPutc( 13 ) ;
debugPutc( 10 ) ;
}
// Send a single 4 bit value to the RS232 port as a hex digit
void hex_digit_send( unsigned char c )
{
c &= 0x0F ;
if ( c > 9 )
{
c += 7 ;
}
c += '0' ;
debugPutc( c ) ;
}
// Send the 8 bit value to the RS232 port as 2 hex digits
void p2hex( unsigned char c )
{
// asm("swap %c") ;
hex_digit_send( c >> 4 ) ;
// asm("swap %c") ;
hex_digit_send( c ) ;
}
// Send the 16 bit value to the RS232 port as 4 hex digits
void p4hex( uint16_t value )
{
p2hex( value >> 8 ) ;
p2hex( value ) ;
}
// Send the 32 bit value to the RS232 port as 8 hex digits
void p8hex( uint32_t value )
{
p4hex( value >> 16 ) ;
p4hex( value ) ;
}
static void dispw_256( register uint32_t address, register uint32_t lines )
{
register uint32_t i ;
register uint32_t j ;
address &= 0xFFFFFFFC ;
for ( i = 0 ; i < lines ; i += 1 )
{
p8hex( address ) ;
for ( j = 0 ; j < 4 ; j += 1 )
{
debugPutc(' ') ;
p8hex( *( (uint32_t *)address ) ) ;
address += 4 ;
}
crlf() ;
}
}
extern Fifo<512> uart3TxFifo;
void debugFlush()
{
uart3TxFifo.flush();
}
void debugTask(void* pdata)
{
uint8_t rxchar ;
TRACE("DEBUG Task started");
crlf() ;
dispw_256( (uint32_t)USART3, 4 ) ;
for (;;) {
while ( (USART3->SR & USART_SR_RXNE) == 0 )
CoTickDelay(5); // 10ms
rxchar = USART3->DR;
if ( Memaddmode )
{
if ( ( rxchar >= 'a' ) && ( rxchar <= 'f' ) )
{
rxchar -= 0x20; // toupper!
}
if ( ( ( rxchar >= '0' ) && ( rxchar <= '9' ) ) || ( ( rxchar >= 'A' ) && ( rxchar <= 'F' ) ) )
{
debugPutc( rxchar );
rxchar -= '0';
if ( rxchar > 9 )
{
rxchar -= 7;
}
Mem_address <<= 4;
Mem_address |= rxchar;
}
else if ( rxchar == 13 )
{
crlf();
if ( Mem_address == 0 )
{
Mem_address = Next_mem_address;
}
dispw_256( Mem_address, 4 );
Next_mem_address = Mem_address + 64;
Memaddmode = 0;
}
else if ( rxchar == 8 )
{
debugPutc( rxchar );
debugPutc( rxchar );
debugPutc( rxchar );
Mem_address >>= 4;
}
else if ( rxchar == 27 )
{
crlf();
Memaddmode = 0;
}
}
if ( rxchar == '?' )
{
Memaddmode = 1;
Mem_address = 0;
debugPutc( '>' );
}
if ( rxchar == 'm' )
{
crlf();
p8hex( (uint32_t) &g_model.moduleData[0] );
debugPutc( ' ' );
p8hex( (uint32_t) &g_model.moduleData[1] );
crlf();
}
}
}
#endif // #if !defined(SIMU)
#endif // #if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#if defined(DEBUG_TRACE_BUFFER)
static struct TraceElement traceBuffer[TRACE_BUFFER_LEN];
static uint8_t traceBufferPos;
extern Fifo<512> uart3TxFifo;
gtime_t filltm(gtime_t *t, struct gtm *tp);
void trace_event(enum TraceEvent event, uint32_t data)
@@ -298,13 +107,11 @@ void dumpTraceBuffer()
TRACE(" %03d 0x%08x", traceBuffer[n].event, traceBuffer[n].data);
if (traceBuffer[n].time == 0 && traceBuffer[n].time_ms == 0) break;
if ((n % 5) == 0) {
while (!uart3TxFifo.empty()) {
while (!serial2TxFifo.empty()) {
CoTickDelay(1);
}
}
}
TRACE("End of Trace Buffer dump");
}
#endif
+26 -42
View File
@@ -39,58 +39,42 @@
#include <inttypes.h>
#include "rtc.h"
#include "dump.h"
#if defined(CLI)
#include "cli.h"
#endif
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
uint8_t serial2TracesEnabled();
#if defined(__cplusplus)
}
#endif
#if defined(SIMU)
typedef void (*traceCallbackFunc)(const char * text);
extern traceCallbackFunc traceCallback;
void debugPrintf(const char * format, ...);
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
#elif defined(DEBUG) && defined(CLI)
#define debugPrintf(...) do { if (serial2TracesEnabled() && cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
#elif defined(DEBUG) && defined(CPUARM)
#define debugPrintf(...) do { if (serial2TracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
#else
#define debugPrintf(...)
#endif
void debugPuts(const char *string, ...);
void dump(unsigned char *data, unsigned int size);
void debugFlush();
#ifdef __cplusplus
}
#endif
#define TRACE(...) do { debugPuts(__VA_ARGS__); debugPuts("\r\n"); } while(0)
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
#define DUMP(data, size) dump(data, size)
#define TRACE_DEBUG(...) debugPuts("-D- " __VA_ARGS__)
#define TRACE_DEBUG_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_INFO(...) debugPuts("-I- " __VA_ARGS__)
#define TRACE_INFO_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_WARNING(...) debugPuts("-W- " __VA_ARGS__)
#define TRACE_WARNING_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_ERROR(...) debugPuts("-E- " __VA_ARGS__)
#if !defined(SIMU)
#define FLUSH() debugFlush();
void debugTask(void* pdata);
#else
#define FLUSH()
#endif
#else
#define TRACE(...) { }
#define DUMP(...) { }
#define TRACE_DEBUG(...) { }
#define TRACE_DEBUG_WP(...) { }
#define TRACE_INFO(...) { }
#define TRACE_INFO_WP(...) { }
#define TRACE_WARNING(...) { }
#define TRACE_WARNING_WP(...) { }
#define TRACE_ERROR(...) { }
#define FLUSH()
#endif
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
#define TRACE_DEBUG_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_INFO(...) debugPrintf("-I- " __VA_ARGS__)
#define TRACE_INFO_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_WARNING(...) debugPrintf("-W- " __VA_ARGS__)
#define TRACE_WARNING_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_ERROR(...) debugPrintf("-E- " __VA_ARGS__)
#if defined(DEBUG_TRACE_BUFFER)
+38
View File
@@ -0,0 +1,38 @@
#include "opentx.h"
#if defined(SIMU)
#define dumpPrintf(...) debugPrintf(__VA_ARGS__)
#else
#define dumpPrintf(...) serialPrintf(__VA_ARGS__)
#endif
uint8_t dumpPosition;
void dumpStart(unsigned int size)
{
dumpPrintf("DUMP %d bytes ...\n\r", size);
dumpPosition = 0;
}
void dumpBody(const uint8_t *data, unsigned int size)
{
for (unsigned int i=0; i<size; i++) {
dumpPrintf("%.2X ", data[i]);
dumpPosition++;
if ((dumpPosition & (32-1)) == 0) {
dumpPrintf("\r\n");
}
}
}
void dumpEnd()
{
dumpPrintf("\r\n");
}
void dump(const uint8_t *data, unsigned int size)
{
dumpStart(size);
dumpBody(data, size);
dumpEnd();
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef _DUMP_H_
#define _DUMP_H_
#if defined(DEBUG) || defined(CLI)
void dumpStart(unsigned int size);
void dumpBody(const uint8_t * data, unsigned int size);
void dumpEnd();
void dump(const uint8_t * data, unsigned int size);
#else
#define dump(data, size)
#endif
#endif // _DUMP_H_
+3 -3
View File
@@ -626,7 +626,7 @@ PACK(typedef struct {
int8_t currModel;
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t backlightMode;
TrainerData trainer;
uint8_t view; // index of view in main screen
@@ -659,7 +659,7 @@ PACK(typedef struct {
int8_t vBatMin;
int8_t vBatMax;
uint8_t backlightBright;
int8_t currentCalib;
int8_t txCurrentCalibration;
int8_t temperatureWarn;
uint8_t mAhWarn;
uint16_t mAhUsed;
@@ -908,7 +908,7 @@ void ConvertModel_216_to_217(ModelData &model)
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
timer.mode = TMRMODE_COUNT + ConvertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else
timer.mode = oldModel.timers[i].mode;
timer.mode = ConvertSwitch_216_to_217(oldModel.timers[i].mode);
timer.start = oldModel.timers[i].start;
timer.countdownBeep = oldModel.timers[i].countdownBeep;
timer.minuteBeep = oldModel.timers[i].minuteBeep;
+11
View File
@@ -370,6 +370,17 @@ void eeLoadModel(uint8_t id)
restoreTimers();
#if defined(CPUARM)
for (int i=0; i<MAX_SENSORS; i++) {
TelemetrySensor & sensor = g_model.telemetrySensors[i];
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent) {
telemetryItems[i].value = sensor.persistentValue;
}
}
#endif
LOAD_MODEL_CURVES();
resumeMixerCalculations();
// TODO pulses should be started after mixer calculations ...
+9 -4
View File
@@ -56,7 +56,7 @@ class Fifo
}
bool pop(uint8_t & byte) {
if (empty()) {
if (isEmpty()) {
return false;
}
else {
@@ -66,12 +66,17 @@ class Fifo
}
}
bool empty() {
bool isEmpty() {
return (ridx == widx);
}
bool isFull() {
uint32_t next = (widx+1) & (N-1);
return (next == ridx);
}
void flush() {
while (!empty()) {};
while (!isEmpty()) {};
}
protected:
@@ -80,4 +85,4 @@ class Fifo
volatile uint32_t ridx;
};
#endif
#endif // _FIFO_H_
+2 -2
View File
@@ -284,10 +284,10 @@ void evalFunctions()
#endif
for (uint8_t i=0; i<NUM_CFN; i++) {
const CustomFunctionData *cfn = &functions[i];
const CustomFunctionData * cfn = &functions[i];
int8_t swtch = CFN_SWITCH(cfn);
if (swtch) {
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
#if defined(CPUARM)
bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0);
Executable → Regular
View File
Executable → Regular
+3 -3
View File
@@ -140,7 +140,7 @@ enum SwitchContext
bool isSwitchAvailable(int swtch, SwitchContext context)
{
if (swtch < 0) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
@@ -156,7 +156,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
@@ -238,7 +238,7 @@ bool isAssignableFunctionAvailable(int function)
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_PLAY_DIFF:
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
Executable → Regular
View File
Executable → Regular
View File
View File
View File
+17 -9
View File
@@ -38,7 +38,7 @@
void menuGeneralDiagAna(uint8_t event)
{
#if defined(PCBSKY9X) && !defined(REVA)
#if defined(TX_CAPACITY_MEASUREMENT)
#define ANAS_ITEMS_COUNT 4
#elif defined(PCBSKY9X)
#define ANAS_ITEMS_COUNT 3
@@ -77,7 +77,7 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(MENU_HEADER_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;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
batCalV /= 55296;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#elif defined(PCBGRUVIN9X)
@@ -85,23 +85,31 @@ void menuGeneralDiagAna(uint8_t event)
// 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;
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/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 (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
#if defined(PCBSKY9X) && !defined(REVA)
#if defined(TX_CAPACITY_MEASUREMENT)
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);
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -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);
#if defined(TX_CAPACITY_MEASUREMENT)
#define TEMP_CALIB_POS 7*FH+1
#define TEMP_CALIB_MENU_POS 3
#else
#define TEMP_CALIB_POS 6*FH+1
#define TEMP_CALIB_MENU_POS 2
#endif
lcd_putsLeft(TEMP_CALIB_POS, STR_TEMP_CALIB);
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (m_posVert==TEMP_CALIB_MENU_POS ? INVERS : 0)) ;
if (m_posVert==TEMP_CALIB_MENU_POS) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
#endif
}
View File
View File
View File
+3 -3
View File
@@ -97,7 +97,7 @@ enum menuGeneralSetupItems {
ITEM_SETUP_CONTRAST,
ITEM_SETUP_ALARMS_LABEL,
ITEM_SETUP_BATTERY_WARNING,
CASE_PCBSKY9X(ITEM_SETUP_CAPACITY_WARNING)
CASE_CAPACITY(ITEM_SETUP_CAPACITY_WARNING)
CASE_PCBSKY9X(ITEM_SETUP_TEMPERATURE_WARNING)
ITEM_SETUP_INACTIVITY_ALARM,
ITEM_SETUP_MEMORY_WARNING,
@@ -153,7 +153,7 @@ void menuGeneralSetup(uint8_t event)
}
#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_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, 1/*to force edit mode*/});
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_CAPACITY(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, CASE_CPUARM(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, 1/*to force edit mode*/});
uint8_t sub = m_posVert - 1;
@@ -394,7 +394,7 @@ void menuGeneralSetup(uint8_t event)
break;
}
#if defined(PCBSKY9X)
#if defined(TX_CAPACITY_MEASUREMENT)
case ITEM_SETUP_CAPACITY_WARNING:
lcd_putsLeft(y, STR_CAPAWARNING);
putsValueWithUnit(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.mAhWarn*50, UNIT_MAH, attr|LEFT) ;
View File
View File
Executable → Regular
View File
View File
@@ -140,8 +140,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, v1_val+1, LEFT|attr);
v1_max = 99;
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr);
v1_min = -128;
v1_max = 122;
}
else {
v1_val = (uint8_t)cs->v1;
@@ -163,8 +164,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
v2_max = 99;
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr);
v2_min = -128;
v2_max = 122;
}
else if (cstate == LS_FAMILY_EDGE) {
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, m_posHorz==0 ? attr : 0, m_posHorz==1 ? attr : 0);
@@ -286,8 +288,8 @@ void menuModelLogicalSwitches(uint8_t event)
putsEdgeDelayParam(CSW_3RD_COLUMN, y, cs, 0, 0);
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
lcd_outdezAtt(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1);
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1);
}
else {
uint8_t v1 = cs->v1;
+8 -8
View File
@@ -79,7 +79,7 @@ enum menuModelSetupItems {
ITEM_MODEL_EXTERNAL_MODULE_OUTPUT_TYPE,
#endif
ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE,
#if defined(PCBSKY9X) && !defined(REVA) && !defined(REVX)
#if defined(PCBSKY9X) && !defined(REVA)
ITEM_MODEL_EXTRA_MODULE_LABEL,
ITEM_MODEL_EXTRA_MODULE_CHANNELS,
ITEM_MODEL_EXTRA_MODULE_BIND,
@@ -102,7 +102,7 @@ enum menuModelSetupItems {
#define MODEL_SETUP_RANGE_OFS 4*FW+3
#define MODEL_SETUP_SET_FAILSAFE_OFS 7*FW-2
#if defined(PCBSKY9X) && !defined(REVA) && !defined(REVX)
#if defined(PCBSKY9X) && !defined(REVA)
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_EXTRA_MODULE_LABEL ? EXTRA_MODULE : EXTERNAL_MODULE)
#else
#define CURRENT_MODULE_EDITED(k) (EXTERNAL_MODULE)
@@ -116,7 +116,7 @@ void menuModelSetup(uint8_t event)
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
#define EXTERNAL_MODULE_CHANNELS_ROWS() IF_EXTERNAL_MODULE_ON(IS_MODULE_DSM2(EXTERNAL_MODULE) ? (uint8_t)0 : (uint8_t)1)
#define EXTERNAL_MODULE_SETTINGS_ROWS() (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW
#if defined(PCBSKY9X) && defined(REVX)
#if defined(PCBSKY9X) && !defined(REVX)
#define OUTPUT_TYPE_ROWS() (IS_MODULE_PPM(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW) ,
#else
#define OUTPUT_TYPE_ROWS()
@@ -128,7 +128,7 @@ void menuModelSetup(uint8_t event)
#define MODEL_SETUP_MAX_LINES (1+ITEM_MODEL_SETUP_MAX)
#define POT_WARN_ITEMS() ((g_model.nPotsToWarn >> 6) ? (uint8_t)NUM_POTS : (uint8_t)0)
#define TIMER_ROWS 2, 0, CASE_PERSISTENT_TIMERS(0) 0, 0
#if (defined(PCBSKY9X) && !defined(REVA) && !defined(REVX))
#if (defined(PCBSKY9X) && !defined(REVA))
#define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2,
#else
#define EXTRA_MODULE_ROWS
@@ -256,7 +256,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
{
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, 0, 2, attr, event);
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
}
@@ -485,7 +485,7 @@ void menuModelSetup(uint8_t event)
break;
#endif
#if defined(PCBSKY9X) && !defined(REVX)
#if defined(PCBSKY9X)
case ITEM_MODEL_EXTRA_MODULE_LABEL:
lcd_putsLeft(y, "RF Port 2 (PPM)");
break;
@@ -530,7 +530,7 @@ void menuModelSetup(uint8_t event)
break;
#endif
#if defined(PCBSKY9X) && !defined(REVX)
#if defined(PCBSKY9X)
case ITEM_MODEL_EXTRA_MODULE_CHANNELS:
#endif
#if defined(CPUARM)
@@ -562,7 +562,7 @@ void menuModelSetup(uint8_t event)
}
#endif
#if defined(PCBSKY9X) && !defined(REVX)
#if defined(PCBSKY9X)
case ITEM_MODEL_EXTRA_MODULE_BIND:
#endif
#if defined(CPUARM)
+71 -37
View File
@@ -86,8 +86,10 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_SENSOR30,
ITEM_TELEMETRY_SENSOR31,
ITEM_TELEMETRY_SENSOR32,
ITEM_TELEMETRY_NEWSENSOR,
ITEM_TELEMETRY_IGNORE_SENSORID,
ITEM_TELEMETRY_DISCOVER_SENSORS,
ITEM_TELEMETRY_NEW_SENSOR,
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
#endif
#if !defined(CPUARM)
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
@@ -132,30 +134,30 @@ enum menuModelTelemetryItems {
};
#if defined(FRSKY)
#define TELEM_COL1 INDENT_WIDTH
#define TELEM_COL1 INDENT_WIDTH
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
#define TELEM_COL2 (9*FW)
#define TELEM_COL2 (9*FW)
#else
#define TELEM_COL2 (8*FW)
#define TELEM_COL2 (8*FW)
#endif
#define TELEM_BARS_COLMIN (56-3*FW)
#define TELEM_BARS_COLMAX (14*FW-3)
#define TELEM_SCRTYPE_COL TELEM_COL2
#define TELEM_BARS_COLMIN (56-3*FW)
#define TELEM_BARS_COLMAX (14*FW-3)
#define TELEM_SCRTYPE_COL TELEM_COL2
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#if defined(CPUARM)
#define CHANNELS_ROWS
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
#else
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
#define SENSORS_ROWS
#endif
#if defined(FAS_OFFSET) || !defined(CPUM64)
#define IF_FAS_OFFSET(x) x,
#define IF_FAS_OFFSET(x) x,
#else
#define IF_FAS_OFFSET(x)
#endif
@@ -163,38 +165,38 @@ enum menuModelTelemetryItems {
#if defined(CPUARM)
#define USRDATA_ROWS
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
#else
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
#endif
#define RSSI_ROWS LABEL(RSSI), 1, 1,
#define RSSI_ROWS LABEL(RSSI), 1, 1,
#if defined(CPUARM) || defined(GAUGES)
#define SCREEN_TYPE_ROWS 0
#define SCREEN_TYPE_ROWS 0
#else
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
#endif
#if defined(PCBSTD)
#define VARIO_RANGE_ROWS 1
#define VARIO_RANGE_ROWS 1
#else
#define VARIO_RANGE_ROWS 3
#define VARIO_RANGE_ROWS 3
#endif
#if defined(CPUARM)
#define TELEMETRY_TYPE_ROWS 0,
#define TELEMETRY_TYPE_ROWS 0,
#else
#define TELEMETRY_TYPE_ROWS
#endif
#if defined(CPUARM)
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#else
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
#define TELEMETRY_CURRENT_EDIT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
#define TELEMETRY_CURRENT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
#endif
#if defined(CPUARM)
@@ -497,7 +499,7 @@ void onSensorMenu(const char *result)
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
m_posVert += 1;
else
m_posVert = 1+ITEM_TELEMETRY_NEWSENSOR;
m_posVert = 1+ITEM_TELEMETRY_NEW_SENSOR;
}
else if (result == STR_COPY) {
int newIndex = availableTelemetryIndex();
@@ -521,6 +523,15 @@ void onSensorMenu(const char *result)
void menuModelTelemetry(uint8_t event)
{
#if defined(CPUARM)
if (s_warning_result) {
s_warning_result = 0;
for (int i=0; i<MAX_SENSORS; i++) {
delTelemetryIndex(i);
}
}
#endif
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
uint8_t sub = m_posVert - 1;
@@ -549,7 +560,7 @@ void menuModelTelemetry(uint8_t event)
uint8_t attr = (sub == k ? blink : 0);
#if !defined(CPUARM)
uint8_t ch = TELEMETRY_CURRENT_EDIT_CHANNEL(k);
uint8_t ch = TELEMETRY_CURRENT_CHANNEL(k);
FrSkyChannelData & channel = g_model.frsky.channels[ch];
uint8_t dest = TELEM_A1-1+ch;
#endif
@@ -561,7 +572,7 @@ void menuModelTelemetry(uint8_t event)
lcd_putcAtt(lcdLastPos, y, ':', attr);
lcd_putsnAtt(3*FW, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
if (telemetryItems[index].isFresh()) {
lcd_putc(10*FW, y, '*');
lcd_putc(16*FW, y, '*');
}
TelemetryItem & telemetryItem = telemetryItems[index];
if (telemetryItem.isAvailable()) {
@@ -604,7 +615,15 @@ void menuModelTelemetry(uint8_t event)
lcd_putsLeft(y, STR_TELEMETRY_SENSORS);
break;
case ITEM_TELEMETRY_NEWSENSOR:
case ITEM_TELEMETRY_DISCOVER_SENSORS:
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
allowNewSensors = !allowNewSensors;
}
break;
case ITEM_TELEMETRY_NEW_SENSOR:
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
@@ -618,9 +637,18 @@ void menuModelTelemetry(uint8_t event)
}
}
break;
case ITEM_TELEMETRY_IGNORE_SENSORID:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
s_editMode = 0;
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(KEY_ENTER);
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
}
break;
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
break;
#endif
@@ -830,7 +858,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_SCREEN_LABEL3:
case ITEM_TELEMETRY_SCREEN_LABEL4:
{
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
@@ -900,8 +928,14 @@ void menuModelTelemetry(uint8_t event)
#if defined(CPUARM)
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
if (barSource) {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
if (barSource <= MIXSRC_LAST_CH) {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
}
else {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
}
}
#else
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+60 -34
View File
@@ -81,7 +81,7 @@ INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITC
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags, IsValueAvailable isValueAvailable, const CheckIncDecStops &stops)
{
int16_t newval = val;
int newval = val;
#if defined(DBLKEYS)
uint8_t in = KEYS_PRESSED();
@@ -628,44 +628,70 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
break;
}
uint8_t maxLines = menuTab ? LCD_LINES-1 : LCD_LINES-2;
#if defined(CPUARM)
int linesCount = maxrow;
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
s_pgOfs = 0;
if (horTab) {
linesCount = 0;
for (int i=0; i<maxrow; i++) {
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
linesCount++;
}
}
}
}
else if (horTab) {
if (maxrow > maxLines) {
while (1) {
vertpos_t firstLine = 0;
for (int numLines=0; firstLine<maxrow && numLines<s_pgOfs; firstLine++) {
if (firstLine>=horTabMax || horTab[firstLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert <= firstLine) {
s_pgOfs--;
}
else {
vertpos_t lastLine = firstLine;
for (int numLines=0; lastLine<maxrow && numLines<maxLines; lastLine++) {
if (lastLine>=horTabMax || horTab[lastLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert > lastLine) {
s_pgOfs++;
}
else {
linesCount = s_pgOfs + maxLines;
for (int i=lastLine; i<maxrow; i++) {
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
linesCount++;
}
}
break;
}
}
}
}
}
#else
if (l_posVert<1) {
s_pgOfs=0;
}
else if (menuTab && horTab) {
vertpos_t realPosVert = l_posVert;
vertpos_t realPgOfs = s_pgOfs;
vertpos_t realMaxrow = maxrow;
for (vertpos_t i=1; i<=maxrow; i++) {
if (MAXCOL(i) == HIDDEN_ROW) {
realMaxrow--;
if (i < l_posVert)
realPosVert--;
if (i < s_pgOfs)
realPgOfs--;
}
}
if (realPosVert>(LCD_LINES-1)+realPgOfs) realPgOfs = realPosVert-(LCD_LINES-1);
else if (realPosVert<1+realPgOfs) realPgOfs = realPosVert-1;
s_pgOfs = realPgOfs;
for (vertpos_t i=1; i<=realPgOfs; i++) {
if (MAXCOL(i) == HIDDEN_ROW) {
s_pgOfs++;
}
}
maxrow = realMaxrow;
}
else {
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
}
#else
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert<1) s_pgOfs=0;
else if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
#endif
else {
if (l_posVert>maxLines+s_pgOfs) {
s_pgOfs = l_posVert-maxLines;
}
else if (l_posVert<=s_pgOfs) {
s_pgOfs = l_posVert-1;
}
}
m_posVert = l_posVert;
m_posHorz = l_posHorz;
#if !defined(CPUM64)
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+6 -6
View File
@@ -223,14 +223,14 @@ void displayBattVoltage()
#if defined(PCBSKY9X)
void displayVoltageOrAlarm()
{
if (IS_TXBATT_WARNING()) {
displayBattVoltage();
}
else if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
putsValueWithUnit(6*FW-1, 2*FH, getTemperature(), UNIT_TEMPERATURE, BLINK|INVERS|DBLSIZE);
}
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.txCurrentCalibration)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.txCurrentCalibration)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
}
else {
displayBattVoltage();
}
}
#else
View File
Executable → Regular
+1 -1
View File
@@ -46,7 +46,7 @@
#include "opentx.h"
#include "telemetry/mavlink.h"
#include "gui/9X/menus.h"
#include "serial.h"
#include "targets/common_avr/serial_driver.h"
#define APSIZE (BSS | DBLSIZE)
+6 -6
View File
@@ -151,11 +151,11 @@ void menuStatisticsDebug(uint8_t event)
}
#endif
#if defined(PCBSKY9X) && !defined(REVA)
#if defined(TX_CAPACITY_MEASUREMENT)
// 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;
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration;
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
@@ -196,11 +196,11 @@ void menuStatisticsDebug(uint8_t event)
#if defined(CPUARM)
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, stack_free(0), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(1), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(2), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE);
#endif
#if !defined(CPUARM)
@@ -213,7 +213,7 @@ void menuStatisticsDebug(uint8_t event)
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) ;
lcd_outdezAtt(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
#endif
lcd_puts(4*FW, 7*FH+1, STR_MENUTORESET);
+4
View File
@@ -246,6 +246,10 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
#if defined(CPUARM)
getvalue_t barMin = bar.barMin;
getvalue_t barMax = bar.barMax;
if (source <= MIXSRC_LAST_CH) {
barMin = calc100toRESX(barMin);
barMax = calc100toRESX(barMax);
}
#else
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+4 -4
View File
@@ -203,7 +203,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
@@ -245,7 +245,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
@@ -304,7 +304,7 @@ bool isSwitchAvailableInTimers(int swtch)
bool isThrottleSourceAvailable(int source)
{
if (source == THROTTLE_SOURCE_S3 && !IS_POT_AVAILABLE(POT3))
if (source >= THROTTLE_SOURCE_FIRST_POT && source < THROTTLE_SOURCE_FIRST_POT+NUM_POTS && !IS_POT_AVAILABLE(POT1+source-THROTTLE_SOURCE_FIRST_POT))
return false;
else
return true;
@@ -337,7 +337,7 @@ bool isAssignableFunctionAvailable(int function)
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_PLAY_DIFF:
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
Executable → Regular
+45 -19
View File
@@ -45,6 +45,11 @@
display_t displayBuf[DISPLAY_BUF_SIZE] __DMA;
#endif
inline bool lcdIsPointOutside(coord_t x, coord_t y)
{
return (x<0 || x>=LCD_W || y<0 || y>=LCD_H);
}
void lcd_clear()
{
memset(displayBuf, 0, DISPLAY_BUFER_SIZE);
@@ -476,6 +481,8 @@ void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
#if !defined(BOOT)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
{
if (lcdIsPointOutside(x1, y1) || lcdIsPointOutside(x2, y2)) return;
int dx = x2-x1; /* the horizontal distance of the line */
int dy = y2-y1; /* the vertical distance of the line */
int dxabs = abs(dx);
@@ -674,7 +681,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else
lcd_putsiAtt(x, y, STR_VSRCRAW, idx+1, att);
}
else if (idx >= MIXSRC_FIRST_SWITCH && idx < MIXSRC_FIRST_LOGICAL_SWITCH) {
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
idx = idx-MIXSRC_FIRST_SWITCH;
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
lcd_putcAtt(x, y, '\312', att); //switch symbol
@@ -692,13 +699,13 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_CH) {
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
lcd_putcAtt(lcdLastPos, y, ' ', att);
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
lcd_putcAtt(lcdLastPos, y, ' ', att|SMLSIZE);
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
}
}
else if (idx <= MIXSRC_LAST_GVAR)
else if (idx <= MIXSRC_LAST_GVAR) {
putsStrIdx(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
}
else if (idx < MIXSRC_FIRST_TELEM) {
lcd_putsiAtt(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-NUM_LOGICAL_SWITCH-NUM_TRAINER-NUM_CHNOUT-MAX_GVARS, att);
}
@@ -727,29 +734,48 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
}
}
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
{
if (idx == SWSRC_OFF)
if (idx == SWSRC_NONE) {
return lcd_putsiAtt(x, y, STR_VSWITCHES, 0, att);
}
else if (idx == SWSRC_OFF) {
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
}
if (idx < 0) {
lcd_putcAtt(x-2, y, '!', att);
idx = -idx;
}
#if defined(FLIGHT_MODES)
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
return putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
}
#endif
if (idx >= SWSRC_FIRST_SWITCH && idx <= SWSRC_LAST_SWITCH) {
if (idx <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(idx);
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);
char c = "\300-\301"[swinfo.rem];
lcd_putcAtt(lcdNextPos, y, c, att);
return;
}
else {
lcd_putcAtt(x, y, 'S', att);
lcd_putcAtt(lcdNextPos, y, 'A'+swinfo.quot, att);
}
char c = "\300-\301"[swinfo.rem];
lcd_putcAtt(lcdNextPos, y, c, att);
}
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
putsStrIdx(x, y, "S", swinfo.quot*10+swinfo.rem+11, att);
}
else if (idx <= SWSRC_LAST_TRIM) {
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_FIRST_TRIM+1, att);
}
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
putsStrIdx(x, y, "L", idx-SWSRC_FIRST_LOGICAL_SWITCH+1, att);
}
else if (idx <= SWSRC_ONE) {
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
}
else {
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
}
return lcd_putsiAtt(x, y, STR_VSWITCHES, idx, att);
}
#if defined(FLIGHT_MODES)
@@ -803,7 +829,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
putsStrIdx(x, y, STR_CV, idx, att);
}
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att)
{
if (mode >= 0) {
if (mode < TMRMODE_COUNT)
@@ -1010,7 +1036,7 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
if (x<0 || x>=LCD_W || y<0 || y>=LCD_H) return;
if (lcdIsPointOutside(x, y)) return;
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
lcd_mask(p, mask, att);
Executable → Regular
+2 -2
View File
@@ -167,7 +167,7 @@ void lcd_outdez8(coord_t x, coord_t y, int8_t val);
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
void putsSwitches(coord_t x, coord_t y, int32_t swtch, LcdFlags att=0);
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att=0);
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
@@ -175,7 +175,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att);
#endif
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att=0);
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
View File
View File
+2 -2
View File
@@ -62,9 +62,9 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(MENU_HEADER_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;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.txVoltageCalibration)/128) * BATT_SCALE;
batCalV >>= 11;
batCalV += 2; // because of the diode
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+5*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
}
View File
+2 -2
View File
@@ -219,9 +219,9 @@ void menuGeneralHardware(uint8_t event)
break;
#endif
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);
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
if (attr && checkIncDec_Ret) {
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
}
break;
}
View File
-16
View File
@@ -337,22 +337,6 @@ void menuGeneralSetup(uint8_t 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);
View File
View File
View File
@@ -121,6 +121,35 @@ void onCustomFunctionsMenu(const char *result)
}
}
void onAdjustGvarSourceLongEnterPress(const char * result)
{
CustomFunctionData * cfn = &g_model.customFn[m_posVert];
if (result == STR_CONSTANT) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_MIXSOURCE) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_GLOBALVAR) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else {
onSourceLongEnterPress(result);
}
}
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
int sub = m_posVert;
@@ -231,7 +260,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
TelemetrySensor * sensor = & g_model.telemetrySensors[param-FUNC_RESET_PARAM_FIRST_TELEM];
lcd_putsnAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, sensor->label, TELEM_LABEL_LEN, attr|ZCHAR);
}
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction);
if (active) INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction);
}
#if defined(OVERRIDE_CHANNEL_FUNCTION)
else if (func == FUNC_OVERRIDE_CHANNEL) {
@@ -287,15 +316,19 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
else if (func == FUNC_PLAY_VALUE) {
val_max = MIXSRC_LAST_TELEM;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
}
}
#endif
else if (func == FUNC_VOLUME) {
val_max = MIXSRC_LAST_CH;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
}
else if (func == FUNC_LOGS) {
if (val_displayed) {
@@ -309,7 +342,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
#if defined(REVPLUS)
else if (func == FUNC_BACKLIGHT) {
displaySlider(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, CFN_PARAM(cfn), 100, attr);
INCDEC_SET_FLAG(eeFlags | NO_INCDEC_MARKS);
if (active) INCDEC_SET_FLAG(eeFlags | NO_INCDEC_MARKS);
val_min = 0;
val_max = 100;
}
@@ -325,36 +358,49 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
// TODO later, we have a conflict on [Enter Long] here ...
// INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
break;
case FUNC_ADJUST_GVAR_GVAR:
val_max = MAX_GVARS-1;
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if 0 // TODO 2.2.X
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-=", attr);
else
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+=", attr);
lcd_outdezAtt(lcdNextPos, y, abs(val_displayed), attr|LEFT);
#endif
val_max = 1;
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
break;
}
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
s_editMode = !s_editMode;
active = true;
CFN_GVAR_MODE(cfn) += 1;
CFN_GVAR_MODE(cfn) &= 0x03;
val_displayed = 0;
}
}
#endif
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();
}
if (active) {
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
if (func == FUNC_ADJUST_GVAR && attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
MENU_ADD_ITEM(STR_CONSTANT);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
MENU_ADD_ITEM(STR_MIXSOURCE);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
MENU_ADD_ITEM(STR_GLOBALVAR);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
MENU_ADD_ITEM(STR_INCDEC);
menuHandler = onAdjustGvarSourceLongEnterPress;
s_editMode = EDIT_MODIFY_FIELD;
}
}
break;
}
View File
View File
View File
View File
@@ -88,7 +88,7 @@ void DrawFunction(FnFuncP fn, uint8_t offset)
coord_t prev_yv = (coord_t)-1;
for (int8_t xv=-WCHART; xv<=WCHART; xv++) {
for (int xv=-WCHART; xv<=WCHART; xv++) {
coord_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
if (prev_yv != (coord_t)-1) {
if (abs((int8_t)yv-prev_yv) <= 1) {
@@ -108,7 +108,7 @@ uint8_t getExpoMixCount(uint8_t expo)
uint8_t count = 0;
uint8_t ch ;
for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
for (int i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
ch = (expo ? EXPO_VALID(expoAddress(i)) : mixAddress(i)->srcRaw);
if (ch != 0) {
count++;
@@ -652,7 +652,7 @@ void displayHeaderChannelName(uint8_t ch)
{
uint8_t len = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
if (len) {
lcd_putsnAtt(70, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
lcd_putsnAtt(80, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
}
}
@@ -837,14 +837,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
// Value
uint8_t index = expoAddress(s_currIdx)->chn;
if (!s_currCh) {
lcd_outdezAtt(120, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
lcd_outdezAtt(127, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
}
SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, s_maxLines);
// Gauge
if (!s_currCh) {
drawGauge(120, 1, 58, 6, anas[index], 1024);
drawGauge(127, 1, 58, 6, anas[index], 1024);
}
}
else {
@@ -855,14 +855,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
uint8_t index = mixAddress(s_currIdx)->destCh;
if (!s_currCh) {
displayHeaderChannelName(index);
lcd_outdezAtt(120, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
lcd_outdezAtt(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
}
SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, s_maxLines);
// Gauge
if (!s_currCh) {
drawGauge(120, 1, 58, 6, ex_chans[index], 1024);
drawGauge(127, 1, 58, 6, ex_chans[index], 1024);
}
}
View File
View File
+23 -8
View File
@@ -59,6 +59,9 @@ enum menuModelSetupItems {
ITEM_MODEL_TIMER3_PERSISTENT,
ITEM_MODEL_TIMER3_MINUTE_BEEP,
ITEM_MODEL_TIMER3_COUNTDOWN_BEEP,
#endif
#if defined(REV9E)
ITEM_MODEL_TOP_LCD_TIMER,
#endif
ITEM_MODEL_EXTENDED_LIMITS,
ITEM_MODEL_EXTENDED_TRIMS,
@@ -142,15 +145,15 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
switch (m_posHorz) {
case 0:
{
int8_t timerMode = timer->mode;
swsrc_t timerMode = timer->mode;
if (timerMode < 0) timerMode -= TMRMODE_COUNT-1;
CHECK_INCDEC_MODELVAR_CHECK(event, timerMode, -TMRMODE_COUNT-SWSRC_LAST+1, TMRMODE_COUNT+SWSRC_LAST-1, isSwitchAvailableInTimers);
if (timerMode < 0) timerMode += TMRMODE_COUNT-1;
timer->mode = timerMode;
#if defined(AUTOSWITCH)
if (s_editMode>0) {
int8_t val = timer->mode - (TMRMODE_COUNT-1);
int8_t switchVal = checkIncDecMovedSwitch(val);
swsrc_t val = timer->mode - (TMRMODE_COUNT-1);
swsrc_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) {
timer->mode = switchVal + (TMRMODE_COUNT-1);
eeDirty(EE_MODEL);
@@ -224,9 +227,11 @@ int getSwitchWarningsCount()
#if defined(REV9E)
#define SW_WARN_ITEMS() uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), uint8_t(getSwitchWarningsCount() > 8 ? TITLE_ROW : HIDDEN_ROW), uint8_t(getSwitchWarningsCount() > 16 ? TITLE_ROW : HIDDEN_ROW)
#define POT_WARN_ITEMS() uint8_t(g_model.potsWarnMode ? NAVIGATION_LINE_BY_LINE|NUM_POTS : 0), uint8_t(g_model.potsWarnMode ? TITLE_ROW : HIDDEN_ROW)
#define TOPLCD_ROWS 0,
#else
#define SW_WARN_ITEMS() uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount())
#define POT_WARN_ITEMS() uint8_t(g_model.potsWarnMode ? NAVIGATION_LINE_BY_LINE|NUM_POTS : 0)
#define TOPLCD_ROWS
#endif
void menuModelSetup(uint8_t event)
@@ -234,7 +239,7 @@ void menuModelSetup(uint8_t event)
horzpos_t l_posHorz = m_posHorz;
bool CURSOR_ON_CELL = (m_posHorz >= 0);
#if defined(TARANIS_INTERNAL_PPM)
MENU_TAB({ 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
MENU_TAB({ 0, 0, TIMERS_ROWS, TOPLCD_ROWS 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0,
LABEL(InternalModule),
INTERNAL_MODULE_MODE_ROWS,
@@ -248,7 +253,7 @@ void menuModelSetup(uint8_t event)
IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)),
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#else
MENU_TAB({ 0, 0, TIMERS_ROWS, 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
MENU_TAB({ 0, 0, TIMERS_ROWS, TOPLCD_ROWS 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), 0,
LABEL(InternalModule),
INTERNAL_MODULE_MODE_ROWS,
@@ -321,7 +326,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, 0, 2, attr, event);
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER1_PERSISTENT:
@@ -342,7 +347,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, 0, 2, attr, event);
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER2_PERSISTENT:
@@ -364,7 +369,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, 0, 2, attr, event);
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER3_PERSISTENT:
@@ -372,6 +377,16 @@ void menuModelSetup(uint8_t event)
break;
#endif
#if defined(REV9E)
case ITEM_MODEL_TOP_LCD_TIMER:
lcd_putsLeft(y, STR_TOPLCDTIMER);
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_TIMER, g_model.topLcdTimer+1, attr);
if (attr) {
g_model.topLcdTimer = checkIncDec(event, g_model.topLcdTimer, 0, TIMERS-1, EE_MODEL);
}
break;
#endif
case ITEM_MODEL_EXTENDED_LIMITS:
ON_OFF_MENU_ITEM(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
break;
+59 -51
View File
@@ -73,8 +73,10 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_SENSOR30,
ITEM_TELEMETRY_SENSOR31,
ITEM_TELEMETRY_SENSOR32,
ITEM_TELEMETRY_NEWSENSOR,
ITEM_TELEMETRY_IGNORE_SENSORID,
ITEM_TELEMETRY_DISCOVER_SENSORS,
ITEM_TELEMETRY_NEW_SENSOR,
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
#if defined(VARIO)
ITEM_TELEMETRY_VARIO_LABEL,
ITEM_TELEMETRY_VARIO_SOURCE,
@@ -84,9 +86,6 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_TOP_BAR_LABEL,
ITEM_TELEMETRY_TOP_BAR_VOLTAGE,
ITEM_TELEMETRY_TOP_BAR_ALTITUDE,
#if defined(REV9E)
ITEM_TELEMETRY_TOP_LCD_TIMER,
#endif
ITEM_TELEMETRY_SCREEN_LABEL1,
ITEM_TELEMETRY_SCREEN_LINE1,
ITEM_TELEMETRY_SCREEN_LINE2,
@@ -110,39 +109,39 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_MAX
};
#define TELEM_COL1 (1*FW)
#define TELEM_COL2 (16*FW)
#define TELEM_COL3 (28*FW)
#define TELEM_BARS_COLMIN TELEM_COL2
#define TELEM_BARS_COLMAX TELEM_COL3
#define TELEM_SCRTYPE_COL TELEM_COL2
#define TELEM_COL1 (1*FW)
#define TELEM_COL2 (16*FW)
#define TELEM_COL3 (28*FW)
#define TELEM_BARS_COLMIN TELEM_COL2
#define TELEM_BARS_COLMAX TELEM_COL3
#define TELEM_SCRTYPE_COL TELEM_COL2
#define IF_FAS_OFFSET(x) x,
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define IF_FAS_OFFSET(x) x,
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
#if defined(VARIO)
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
#else
#define VARIO_ROWS
#endif
#define RSSI_ROWS LABEL(RSSI), 0, 0,
#define RSSI_ROWS LABEL(RSSI), 0, 0,
#if defined(LUA)
#define SCREEN_TYPE_ROWS 1
#define SCREEN_TYPE_ROWS 1
#else
#define SCREEN_TYPE_ROWS 0
#define SCREEN_TYPE_ROWS 0
#endif
#define VARIO_RANGE_ROWS 3
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
#define VARIO_RANGE_ROWS 3
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
#if defined(LUA)
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
#else
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#endif
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
enum SensorFields {
SENSOR_FIELD_NAME,
@@ -344,7 +343,7 @@ void menuModelSensor(uint8_t event)
lcd_putsLeft(y, STR_CURRENTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCurrentSensor);
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldAvailable);
}
break;
}
@@ -467,7 +466,7 @@ void onSensorMenu(const char *result)
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
m_posVert += 1;
else
m_posVert = ITEM_TELEMETRY_NEWSENSOR;
m_posVert = ITEM_TELEMETRY_NEW_SENSOR;
}
else if (result == STR_COPY) {
int newIndex = availableTelemetryIndex();
@@ -492,7 +491,7 @@ void onSensorMenu(const char *result)
void onTelemetryScriptFileSelectionMenu(const char *result)
{
int sub = m_posVert;
int screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
int screenIndex = TELEMETRY_CURRENT_SCREEN(sub);
if (result == STR_UPDATE_LIST) {
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
@@ -509,15 +508,16 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
}
#endif
#if defined(REV9E)
#define TOPLCD_ROWS 0,
#else
#define TOPLCD_ROWS
#endif
void menuModelTelemetry(uint8_t event)
{
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TOPLCD_ROWS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
if (s_warning_result) {
s_warning_result = 0;
for (int i=0; i<MAX_SENSORS; i++) {
delTelemetryIndex(i);
}
}
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
int sub = m_posVert;
@@ -574,7 +574,7 @@ void menuModelTelemetry(uint8_t event)
switch (k) {
case ITEM_TELEMETRY_PROTOCOL_TYPE:
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.uart3Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.serial2Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
break;
case ITEM_TELEMETRY_SENSORS_LABEL:
@@ -585,7 +585,15 @@ void menuModelTelemetry(uint8_t event)
}
break;
case ITEM_TELEMETRY_NEWSENSOR:
case ITEM_TELEMETRY_DISCOVER_SENSORS:
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
allowNewSensors = !allowNewSensors;
}
break;
case ITEM_TELEMETRY_NEW_SENSOR:
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
@@ -600,8 +608,18 @@ void menuModelTelemetry(uint8_t event)
}
break;
case ITEM_TELEMETRY_IGNORE_SENSORID:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
if (attr)
s_editMode = 0;
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(KEY_ENTER);
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
}
break;
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
break;
case ITEM_TELEMETRY_RSSI_LABEL:
@@ -690,22 +708,12 @@ void menuModelTelemetry(uint8_t event)
}
break;
#if defined(REV9E)
case ITEM_TELEMETRY_TOP_LCD_TIMER:
lcd_putsLeft(y, STR_TOPLCDTIMER);
putsStrIdx(TELEM_COL2, y, STR_TIMER, g_model.topLcdTimer+1, attr);
if (attr) {
g_model.topLcdTimer = checkIncDec(event, g_model.topLcdTimer, 0, MAX_TIMERS-1, EE_MODEL);
}
break;
#endif
case ITEM_TELEMETRY_SCREEN_LABEL1:
case ITEM_TELEMETRY_SCREEN_LABEL2:
case ITEM_TELEMETRY_SCREEN_LABEL3:
case ITEM_TELEMETRY_SCREEN_LABEL4:
{
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
@@ -800,7 +808,7 @@ void menuModelTelemetry(uint8_t event)
if (attr && s_editMode>0) {
switch (m_posHorz) {
case 0:
bar.source = CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, barSource, MIXSRC_LAST_TELEM, isSourceAvailable);
bar.source = checkIncDec(event, barSource, 0, MIXSRC_LAST_TELEM, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable);
if (checkIncDec_Ret) {
if (barSource <= MIXSRC_LAST_CH) {
bar.barMin = -100;
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -176,7 +176,7 @@ 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);
int8_t checkIncDecMovedSwitch(int8_t val);
swsrc_t checkIncDecMovedSwitch(swsrc_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)
+2 -2
View File
@@ -45,10 +45,10 @@ uint8_t calibrationState;
int checkIncDecSelection = 0;
#if defined(AUTOSWITCH)
int8_t checkIncDecMovedSwitch(int8_t val)
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
{
if (s_editMode>0) {
int8_t swtch = getMovedSwitch();
swsrc_t swtch = getMovedSwitch();
if (swtch) {
div_t info = switchInfo(swtch);
if (IS_TOGGLE(info.quot)) {
Executable → Regular
View File
Executable → Regular
View File
View File
View File
View File
+39 -6
View File
@@ -98,13 +98,28 @@ void menuStatisticsView(uint8_t event)
#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_USB (5*FH)
#define MENU_DEBUG_Y_RTOS (6*FH)
#if defined(USB_SERIAL)
extern uint16_t usbWraps;
extern uint16_t charsWritten;
extern "C" volatile uint32_t APP_Rx_ptr_in;
#endif
void menuStatisticsDebug(uint8_t event)
{
TITLE(STR_MENUDEBUG);
#if defined(WATCHDOG_TEST)
if (s_warning_result) {
s_warning_result = 0;
// do a user requested watchdog test
TRACE("Performing watchdog test");
pausePulses();
}
#endif
switch(event)
{
case EVT_KEY_LONG(KEY_ENTER):
@@ -136,10 +151,19 @@ void menuStatisticsDebug(uint8_t event)
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
#if defined(WATCHDOG_TEST)
case EVT_KEY_LONG(KEY_MENU):
{
POPUP_CONFIRMATION("Test the watchdog?");
const char * w = "The radio will reset!";
SET_WARNING_INFO(w, strlen(w), 0);
}
break;
#endif
}
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
#if defined(LUA)
@@ -154,15 +178,24 @@ void menuStatisticsDebug(uint8_t event)
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
#if defined(USB_SERIAL)
lcd_putsLeft(MENU_DEBUG_Y_USB, "Usb");
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_USB, charsWritten, LEFT);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " ");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, APP_Rx_ptr_in, LEFT);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_USB, " ");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_USB, usbWraps, LEFT);
#endif
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[M]", SMLSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT);
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[X]", SMLSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT);
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT);
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(255), UNSIGN|LEFT);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stackAvailable(), UNSIGN|LEFT);
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
lcd_status_line();
+13 -1
View File
@@ -186,7 +186,19 @@ bool displayTelemetryScreen()
{
#if defined(LUA)
if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_SCRIPT) {
return true;
uint8_t state = isTelemetryScriptAvailable(s_frsky_view);
switch (state) {
case SCRIPT_OK:
return true; // contents will be drawed by Lua Task
case SCRIPT_NOFILE:
return false; // requested lua telemetry screen not available
case SCRIPT_SYNTAX_ERROR:
case SCRIPT_PANIC:
case SCRIPT_KILLED:
luaError(state, false);
return true;
}
return false;
}
#endif
View File
View File
Executable → Regular
View File
-13
View File
@@ -128,19 +128,6 @@ enum EnumKeys {
SW_SR0,
SW_SR1,
SW_SR2,
#else
SW_SI0,
SW_SI2,
SW_SJ0,
SW_SJ2,
SW_SK0,
SW_SK2,
SW_SL0,
SW_SL2,
SW_SM0,
SW_SM2,
SW_SN0,
SW_SN2,
#endif
#else
SW_ID0=SW_BASE,
+40 -12
View File
@@ -89,27 +89,55 @@ const uint8_t BootCode[] = {
__attribute__ ((section(".bootrodata"), used))
void _bootStart()
{
// turn soft power ON now
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // Enable portD clock
GPIOD->BSRRL = 1;
GPIOD->MODER = (GPIOD->MODER & 0xFFFFFFFC) | 1;
#if defined(REV9E)
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable portC clock
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOGEN; // Enable portG clock
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOGEN | RCC_AHB1ENR_GPIODEN;
#else
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable portC clock
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOEEN; // Enable portE clock
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIOEEN | RCC_AHB1ENR_GPIODEN;
#endif
// these two NOPs are needed (see STM32F errata sheet) before the peripheral
// register can be written after the peripheral clock was enabled
__ASM volatile ("nop");
__ASM volatile ("nop");
// Turn soft power ON now, but only if we got started because of the watchdog
// or software reset. If the radio was started by user pressing the power button
// then that button is providing power and we don't need to enable it here.
//
// If we were to turn it on here indiscriminately, then the radio can go into the
// power on/off loop after being powered off by the user. (issue #2790)
if (WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
GPIOD->BSRRL = 1; // set PWR_GPIO_PIN_ON pin to 1
GPIOD->MODER = (GPIOD->MODER & 0xFFFFFFFC) | 1; // General purpose output mode
}
// TRIMS_GPIO_PIN_LHR is on PG0 on 9XE and on PE3 on Taranis
// TRIMS_GPIO_PIN_RHL is on PC1 on all versions
// turn on pull-ups on trim keys
GPIOC->PUPDR = 0x00000004;
#if defined(REV9E)
GPIOG->PUPDR = 0x00000001;
#else
GPIOE->PUPDR = 0x00000040;
uint32_t i;
for (i = 0; i < 50000; i += 1) {
#endif
// wait for inputs to stabilize
for (uint32_t i = 0; i < 50000; i += 1) {
bwdt_reset();
}
// now the second part of power on sequence
// If we got here and the radio was not started by the watchdog/software reset,
// then we must have a power button pressed. If not then we are in power on/off loop
// and to terminate it, just wait here without turning on PWR pin. The power supply will
// eventually exhaust and the radio will turn off.
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
// wait here until the power key is pressed
while (GPIOD->IDR & PWR_GPIO_PIN_SWITCH) {
bwdt_reset();
}
}
if (!(TRIMS_GPIO_REG_LHR & TRIMS_GPIO_PIN_LHR) && !(TRIMS_GPIO_REG_RHL & TRIMS_GPIO_PIN_RHL)) {
// Bootloader needed
const uint8_t *src;

Some files were not shown because too many files have changed in this diff Show More