1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 12:55:12 +03:00

[Horus] SD Storage started. UI continued.

+ Some boyscout work on LCD functions
This commit is contained in:
Bertrand Songis 2015-10-22 07:09:53 +02:00
parent d353f3c388
commit c8f77fceec
270 changed files with 2403 additions and 2474 deletions

View file

@ -36,7 +36,6 @@ eepromFatHeader(NULL)
#define EEPROM_BLOCK_SIZE (4*1024)
#define EEPROM_MARK 0x84697771 /* thanks ;) */
#define EEPROM_ZONE_SIZE (8*1024)
#define EEPROM_BUFFER_SIZE 256
#define EEPROM_FAT_SIZE 128
#define EEPROM_MAX_ZONES (EEPROM_SIZE / EEPROM_ZONE_SIZE)
#define EEPROM_MAX_FILES (EEPROM_MAX_ZONES - 1)

View file

@ -118,63 +118,63 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# 9X with ATmega64
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# 9XR with ATmega64
target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9xr${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# 9X with ATmega128
target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM_RLC ${COMMON_DEFINITIONS})
target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9x128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# 9XR with ATmega128
target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM_RLC ${COMMON_DEFINITIONS})
target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x)
target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9xr128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Gruvin9x
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/gruvin9x)
target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Gruvin9x)
target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Mega2560
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/mega2560)
target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS})
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Mega2560)
target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS})
target_link_libraries(opentx-mega2560${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Sky9x
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-sky9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# 9XR-PRO
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# AR9X
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Sky9x)
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Taranis standard
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-taranis${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Taranis Plus
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Taranis X9E
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/Taranis)
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
add_custom_target(opentx-simulators

View file

@ -97,15 +97,18 @@ namespace NAMESPACE {
#include "radio/src/pulses/pulses_avr.cpp"
#endif
#include "radio/src/eeprom_common.cpp"
#if defined(EEPROM_RLC)
#include "radio/src/eeprom_rlc.cpp"
#else
#include "radio/src/eeprom_raw.cpp"
#include "radio/src/storage/eeprom_common.cpp"
#include "radio/src/storage/eeprom_rlc.cpp"
#elif defined(EEPROM)
#include "radio/src/storage/eeprom_common.cpp"
#include "radio/src/storage/eeprom_raw.cpp"
#elif defined(SDCARD)
#include "radio/src/storage/sdcard_raw.cpp"
#endif
#if defined(PCBTARANIS) || defined(PCBSKY9X)
#include "radio/src/eeprom_conversions.cpp"
#include "radio/src/storage/eeprom_conversions.cpp"
#endif
#include "radio/src/opentx.cpp"
@ -222,37 +225,37 @@ namespace NAMESPACE {
#endif
#if defined(PCBTARANIS)
#include "radio/src/targets/taranis/board_taranis.cpp"
#include "radio/src/targets/taranis/keys_driver.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/targets/taranis/telemetry_driver.cpp"
#include "radio/src/targets/taranis/haptic_driver.cpp"
#include "radio/src/targets/Taranis/board_taranis.cpp"
#include "radio/src/targets/Taranis/keys_driver.cpp"
#include "radio/src/targets/Taranis/audio_driver.cpp"
#include "radio/src/targets/Taranis/telemetry_driver.cpp"
#include "radio/src/targets/Taranis/haptic_driver.cpp"
#if defined(REV9E)
#include "radio/src/targets/taranis/top_lcd_driver.cpp"
#include "radio/src/targets/Taranis/top_lcd_driver.cpp"
#endif
#include "radio/src/targets/taranis/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/taranis/trainer_driver.cpp"
#include "radio/src/targets/taranis/serial2_driver.cpp"
#include "radio/src/targets/Taranis/pulses_driver.cpp"
#include "radio/src/targets/Taranis/rtc_driver.cpp"
#include "radio/src/targets/Taranis/trainer_driver.cpp"
#include "radio/src/targets/Taranis/serial2_driver.cpp"
#elif defined(PCBSKY9X)
#include "radio/src/targets/sky9x/board_sky9x.cpp"
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
#include "radio/src/targets/sky9x/pwr_driver.cpp"
#include "radio/src/targets/sky9x/eeprom_driver.cpp"
#include "radio/src/targets/sky9x/keys_driver.cpp"
#include "radio/src/targets/sky9x/audio_driver.cpp"
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
#include "radio/src/targets/sky9x/coproc_driver.cpp"
#include "radio/src/targets/sky9x/haptic_driver.cpp"
#include "radio/src/targets/sky9x/serial2_driver.cpp"
#include "radio/src/targets/sky9x/pulses_driver.cpp"
#include "radio/src/targets/Sky9x/board_sky9x.cpp"
#include "radio/src/targets/Sky9x/telemetry_driver.cpp"
#include "radio/src/targets/Sky9x/pwr_driver.cpp"
#include "radio/src/targets/Sky9x/eeprom_driver.cpp"
#include "radio/src/targets/Sky9x/keys_driver.cpp"
#include "radio/src/targets/Sky9x/audio_driver.cpp"
#include "radio/src/targets/Sky9x/sdcard_driver.cpp"
#include "radio/src/targets/Sky9x/coproc_driver.cpp"
#include "radio/src/targets/Sky9x/haptic_driver.cpp"
#include "radio/src/targets/Sky9x/serial2_driver.cpp"
#include "radio/src/targets/Sky9x/pulses_driver.cpp"
#elif defined(PCBGRUVIN9X)
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
#include "radio/src/targets/gruvin9x/somo14d.cpp"
#include "radio/src/targets/Gruvin9x/board_gruvin9x.cpp"
#include "radio/src/targets/Gruvin9x/somo14d.cpp"
#elif defined(PCBMEGA2560)
#include "radio/src/targets/mega2560/board_mega2560.cpp"
#include "radio/src/targets/Mega2560/board_mega2560.cpp"
#else
#include "radio/src/targets/stock/board_stock.cpp"
#include "../../../../../radio/src/targets/9x/board_stock.cpp"
#endif
#include "radio/src/keys.cpp"
@ -458,9 +461,9 @@ void OpenTxSimulator::wheelEvent(int steps)
{
#if defined(REV9E)
if (steps == 255)
x9de_rotenc -= 2;
rotencValue -= 2;
else
x9de_rotenc += 2;
rotencValue += 2;
#elif defined(PCBSKY9X) && !defined(REVX)
g_rotenc[0] += steps*4;
#elif defined(PCBGRUVIN9X)

View file

@ -19,6 +19,7 @@
/allsimusrc.cpp
/BMP
/traces
/RADIO
/MODELS
/FIRMWARES
/EEPROMS
@ -27,4 +28,5 @@
/gtests.d
/lua_exports*
/lua_fields*
.directory

View file

@ -438,14 +438,14 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
OPT = s
SDCARD = NO
THR_TRACE = NO
INCDIRS += targets/stock
INCDIRS += targets/9x
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM64 -DEEPROM -DEEPROM_RLC -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
BOARDSRC = main_avr.cpp targets/9x/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/common_avr/telemetry_driver.cpp
ifeq ($(GUI), YES)
EXTRABOARDSRC += targets/stock/lcd_driver.cpp
EXTRABOARDSRC += targets/9x/lcd_driver.cpp
endif
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
@ -482,7 +482,7 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
ifeq ($(VOICE), YES)
CPPDEFS += -DVOICE
CPPSRC += targets/stock/voice.cpp
CPPSRC += targets/9x/voice.cpp
endif
ifeq ($(PWM_BACKLIGHT), YES)
@ -521,10 +521,10 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
THR_TRACE = NO
EEPROM_VARIANT += ${M128_VARIANT}
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM -DEEPROM_RLC -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
INCDIRS += targets/stock
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
INCDIRS += targets/9x
BOARDSRC = main_avr.cpp targets/9x/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/9x/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
@ -561,7 +561,7 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
ifeq ($(VOICE), YES)
CPPDEFS += -DVOICE
CPPSRC += targets/stock/voice.cpp
CPPSRC += targets/9x/voice.cpp
endif
ifeq ($(PWM_BACKLIGHT), YES)
@ -596,10 +596,10 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
THR_TRACE = YES
EEPROM_VARIANT += ${M2561_VARIANT}
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM2561 -DEEPROM -DEEPROM_RLC -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
INCDIRS += targets/stock
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
INCDIRS += targets/9x
BOARDSRC = main_avr.cpp targets/9x/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/9x/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
@ -628,7 +628,7 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
ifeq ($(VOICE), YES)
CPPDEFS += -DVOICE
CPPSRC += targets/stock/voice.cpp
CPPSRC += targets/9x/voice.cpp
endif
ifeq ($(PWM_BACKLIGHT), YES)
@ -669,10 +669,10 @@ ifeq ($(PCB), GRUVIN9X)
SDCARD = NO
BUZZER = NO
THR_TRACE = YES
INCDIRS += targets/gruvin9x targets/stock $(FATFSDIR) $(FATFSDIR)/option
BOARDSRC = main_avr.cpp targets/gruvin9x/board_gruvin9x.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
INCDIRS += targets/Gruvin9x targets/9x $(FATFSDIR) $(FATFSDIR)/option
BOARDSRC = main_avr.cpp targets/Gruvin9x/board_gruvin9x.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/9x/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += audio_avr.cpp haptic.cpp debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
@ -680,9 +680,9 @@ ifeq ($(PCB), GRUVIN9X)
ifeq ($(SDCARD), YES)
CPPDEFS += -DRTCLOCK -DSDCARD
CPPSRC += rtc.cpp sdcard.cpp logs.cpp targets/gruvin9x/rtc_driver.cpp
CPPSRC += rtc.cpp sdcard.cpp logs.cpp targets/Gruvin9x/rtc_driver.cpp
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/gruvin9x/diskio.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Gruvin9x/diskio.cpp
endif
ifeq ($(BUZZER), YES)
@ -692,7 +692,7 @@ ifeq ($(PCB), GRUVIN9X)
ifeq ($(VOICE), YES)
CPPDEFS += -DVOICE
CPPSRC += targets/gruvin9x/somo14d.cpp
CPPSRC += targets/Gruvin9x/somo14d.cpp
endif
# Enable extra rotary encoders (Gruvin9x board only)
@ -715,25 +715,25 @@ ifeq ($(PCB), MEGA2560)
BUZZER = YES
THR_TRACE = YES
PWRMANAGE = NO
INCDIRS += targets/mega2560 targets/stock $(FATFSDIR) $(FATFSDIR)/option
BOARDSRC = main_avr.cpp targets/mega2560/board_mega2560.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
INCDIRS += targets/Mega2560 targets/9x $(FATFSDIR) $(FATFSDIR)/option
BOARDSRC = main_avr.cpp targets/Mega2560/board_mega2560.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += audio_avr.cpp debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/9x/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
ifeq ($(PWRMANAGE), YES)
CPPDEFS += -DPWRMANAGE
endif
ifeq ($(SDCARD), YES)
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/gruvin9x/diskio.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Gruvin9x/diskio.cpp
CPPDEFS += -DSDCARD -DRTCLOCK
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp
CPPSRC += rtc.cpp sdcard.cpp logs.cpp targets/gruvin9x/rtc_driver.cpp
CPPSRC += rtc.cpp sdcard.cpp logs.cpp targets/Gruvin9x/rtc_driver.cpp
endif
ifeq ($(AUDIO), YES)
@ -751,7 +751,7 @@ ifeq ($(PCB), MEGA2560)
ifeq ($(VOICE), YES)
CPPDEFS += -DVOICE
CPPSRC += targets/gruvin9x/somo14d.cpp
CPPSRC += targets/Gruvin9x/somo14d.cpp
endif
ifeq ($(HAPTIC), YES)
@ -774,27 +774,27 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
CPPDEFS = -Dat91sam3s8
FLAVOUR = 9xrpro
CPPDEFS += -DREVX
LDSCRIPT = targets/sky9x/sam3s8c_flash.ld
LDSCRIPT = targets/Sky9x/sam3s8c_flash.ld
else ifeq ($(PCB), AR9X)
CPPDEFS = -Dat91sam3s8
FLAVOUR = ar9x
CPPDEFS += -DAR9X
LDSCRIPT = targets/sky9x/sam3s8c_flash.ld
LDSCRIPT = targets/Sky9x/sam3s8c_flash.ld
else ifeq ($(PCBREV), REVA)
FLAVOUR = sky9x
CPPDEFS += -DREVA
LDSCRIPT = targets/sky9x/sam3s2c_flash.ld
CPPSRC += targets/sky9x/coproc_driver.cpp
LDSCRIPT = targets/Sky9x/sam3s2c_flash.ld
CPPSRC += targets/Sky9x/coproc_driver.cpp
else ifeq ($(PCBREV), REVB)
FLAVOUR = sky9x
CPPDEFS += -DREVB -DCOPROCESSOR
LDSCRIPT = targets/sky9x/sam3s4c_flash.ld
CPPSRC += targets/sky9x/coproc_driver.cpp
LDSCRIPT = targets/Sky9x/sam3s4c_flash.ld
CPPSRC += targets/Sky9x/coproc_driver.cpp
else
FLAVOUR = sky9x
CPPDEFS += -DREVC -DCOPROCESSOR
LDSCRIPT = targets/sky9x/sam3s4c_flash.ld
CPPSRC += targets/sky9x/coproc_driver.cpp
LDSCRIPT = targets/Sky9x/sam3s4c_flash.ld
CPPSRC += targets/Sky9x/coproc_driver.cpp
endif
TRGT = arm-none-eabi-
MCU = cortex-m3
@ -806,25 +806,25 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DDSM2 -DDSM2_PPM -DPXX
ifeq ($(PCB), SKY9X)
CPPDEFS += -DROTARY_ENCODERS=1
CPPSRC += targets/sky9x/rotenc_driver.cpp
CPPSRC += targets/Sky9x/rotenc_driver.cpp
endif
ifeq ($(SPORT_FILE_LOG), YES)
CPPDEFS += -DSPORT_FILE_LOG
endif
INCDIRS += targets/sky9x $(COOSDIR) $(COOSDIR)/kernel $(COOSDIR)/portable
INCDIRS += targets/Sky9x $(COOSDIR) $(COOSDIR)/kernel $(COOSDIR)/portable
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_hardware.cpp gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp
BOARDSRC = main_arm.cpp targets/sky9x/board_sky9x.cpp
EXTRABOARDSRC = targets/sky9x/lcd_driver.cpp
SRC += targets/sky9x/core_cm3.c targets/sky9x/board_lowlevel.c targets/sky9x/crt.c targets/sky9x/vectors_sam3s.c
BOARDSRC = main_arm.cpp targets/Sky9x/board_sky9x.cpp
EXTRABOARDSRC = targets/Sky9x/lcd_driver.cpp
SRC += targets/Sky9x/core_cm3.c targets/Sky9x/board_lowlevel.c targets/Sky9x/crt.c targets/Sky9x/vectors_sam3s.c
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/sky9x/usb/device/core/USBD_UDP.c targets/sky9x/usb/device/core/USBDDriver.c
SRC += targets/sky9x/usb/device/massstorage/MSDDriver.c targets/sky9x/usb/device/massstorage/MSDDStateMachine.c targets/sky9x/usb/device/massstorage/MSDLun.c targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c targets/sky9x/usb/device/massstorage/SBCMethods.c
SRC += targets/sky9x/usb/common/core/USBEndpointDescriptor.c targets/sky9x/usb/common/core/USBGenericRequest.c targets/sky9x/usb/common/core/USBFeatureRequest.c targets/sky9x/usb/common/core/USBInterfaceRequest.c targets/sky9x/usb/common/core/USBGetDescriptorRequest.c targets/sky9x/usb/common/core/USBSetAddressRequest.c targets/sky9x/usb/common/core/USBSetConfigurationRequest.c targets/sky9x/usb/common/core/USBConfigurationDescriptor.c targets/sky9x/usb/common/core/USBGenericDescriptor.c
SRC += targets/sky9x/MEDSdcard.c
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp
SRC += targets/Sky9x/usb/device/core/USBD_UDP.c targets/Sky9x/usb/device/core/USBDDriver.c
SRC += targets/Sky9x/usb/device/massstorage/MSDDriver.c targets/Sky9x/usb/device/massstorage/MSDDStateMachine.c targets/Sky9x/usb/device/massstorage/MSDLun.c targets/Sky9x/usb/device/massstorage/MSDDriverDescriptors.c targets/Sky9x/usb/device/massstorage/SBCMethods.c
SRC += targets/Sky9x/usb/common/core/USBEndpointDescriptor.c targets/Sky9x/usb/common/core/USBGenericRequest.c targets/Sky9x/usb/common/core/USBFeatureRequest.c targets/Sky9x/usb/common/core/USBInterfaceRequest.c targets/Sky9x/usb/common/core/USBGetDescriptorRequest.c targets/Sky9x/usb/common/core/USBSetAddressRequest.c targets/Sky9x/usb/common/core/USBSetConfigurationRequest.c targets/Sky9x/usb/common/core/USBConfigurationDescriptor.c targets/Sky9x/usb/common/core/USBGenericDescriptor.c
SRC += targets/Sky9x/MEDSdcard.c
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_raw.cpp storage/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/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 += 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)
@ -832,7 +832,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
INCDIRS += $(FATFSDIR) $(FATFSDIR)/option
CPPSRC += sdcard.cpp logs.cpp
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/sky9x/diskio.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Sky9x/diskio.cpp
endif
ifeq ($(BUZZER), YES)
CPPDEFS += -DBUZZER
@ -840,11 +840,11 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
endif
ifeq ($(RTCLOCK), YES)
CPPDEFS += -DRTCLOCK
CPPSRC += rtc.cpp targets/sky9x/rtc_driver.cpp
CPPSRC += rtc.cpp targets/Sky9x/rtc_driver.cpp
endif
ifeq ($(BLUETOOTH), YES)
CPPDEFS += -DBLUETOOTH
CPPSRC += targets/sky9x/bluetooth.cpp
CPPSRC += targets/Sky9x/bluetooth.cpp
endif
ifeq ($(DEBUG), YES)
SRC += syscalls.c
@ -867,7 +867,7 @@ ifeq ($(PCB), TARANIS)
CPPDEFS += -DLCD_DUAL_BUFFER
endif
HAPTIC = YES
EXTRABOARDSRC += targets/taranis/bluetooth_driver.cpp
EXTRABOARDSRC += targets/Taranis/bluetooth_driver.cpp
else ifeq ($(PCBREV), REVPLUS)
MCU = cortex-m3
FLAVOUR = taranis-plus
@ -927,18 +927,18 @@ ifeq ($(PCB), TARANIS)
PPM_CENTER_ADJUSTABLE = YES
DSM2 = PPM
CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DEEPROM -DEEPROM_RLC -DAUDIO -DPXX
INCDIRS += targets/taranis $(THIRDPARTY) $(COOSDIR) $(COOSDIR)/kernel $(COOSDIR)/portable
INCDIRS += targets/Taranis $(THIRDPARTY) $(COOSDIR) $(COOSDIR)/kernel $(COOSDIR)/portable
CPPDEFS += -DHSE_VALUE=12000000
ifeq ($(PCBREV), REV9E)
STM32LIBPATH = $(THIRDPARTY)/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries
CPPDEFS += -DSTM32F4 -DSTM32F40_41xxx -DEEPROM_VARIANT=32768
INCDIRS += $(STM32LIBPATH)/CMSIS/Device/ST/STM32F4xx/Include $(STM32LIBPATH)/CMSIS/Include $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/inc
LDSCRIPT = targets/taranis/stm32f4_flash.ld
LDSCRIPT = targets/Taranis/stm32f4_flash.ld
else
STM32LIBPATH= $(THIRDPARTY)/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries
CPPDEFS += -DEEPROM_VARIANT=0
INCDIRS += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/inc $(STM32LIBPATH)/CMSIS/Device/ST/STM32F2xx/Include $(STM32LIBPATH)/CMSIS/include
LDSCRIPT = targets/taranis/stm32f2_flash.ld
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
@ -947,19 +947,19 @@ ifeq ($(PCB), TARANIS)
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 serial.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 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
SRC += targets/Taranis/pwr_driver.c targets/Taranis/usb_driver.c
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_rlc.cpp storage/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/serial2_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)
CPPSRC += targets/taranis/top_lcd_driver.cpp
SRC += targets/taranis/system_stm32f4xx.c
CPPSRC += targets/Taranis/top_lcd_driver.cpp
SRC += targets/Taranis/system_stm32f4xx.c
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/misc.c
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.c
@ -972,7 +972,7 @@ ifeq ($(PCB), TARANIS)
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c
SRC += $(STM32LIBPATH)/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_stm32f40_41xxx.s
else
SRC += targets/taranis/system_stm32f2xx.c
SRC += targets/Taranis/system_stm32f2xx.c
SRC += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/src/misc.c
SRC += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c
SRC += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_dbgmcu.c
@ -985,29 +985,29 @@ ifeq ($(PCB), TARANIS)
SRC += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c
SRC += $(STM32LIBPATH)/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
endif
SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c
SRC += targets/Taranis/usb_bsp.c targets/Taranis/usbd_desc.c
SRC += $(STM32USBPATH)/STM32_USB_OTG_Driver/src/usb_core.c
SRC += $(STM32USBPATH)/STM32_USB_OTG_Driver/src/usb_dcd.c
SRC += $(STM32USBPATH)/STM32_USB_OTG_Driver/src/usb_dcd_int.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Core/src/usbd_core.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Core/src/usbd_ioreq.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Core/src/usbd_req.c
EXTRABOARDSRC += targets/taranis/usbd_usr.cpp
EXTRABOARDSRC += targets/Taranis/usbd_usr.cpp
SRC += syscalls.c
ifeq ($(USB), JOYSTICK)
CPPDEFS += -DUSB_JOYSTICK
SRC += targets/taranis/usbd_hid_joystick.c
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
EXTRABOARDSRC += targets/Taranis/usbd_cdc.cpp
else
CPPDEFS += -DUSB_MASS_STORAGE
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
EXTRABOARDSRC += targets/taranis/usbd_storage_msd.cpp
EXTRABOARDSRC += targets/Taranis/usbd_storage_msd.cpp
endif
ifeq ($(NANO), YES)
# use newlib-nano for linking
@ -1035,8 +1035,8 @@ ifeq ($(PCB), TARANIS)
CPPSRC += bin_allocator.cpp
endif
endif
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/taranis/diskio.cpp
CPPSRC += sdcard.cpp logs.cpp rtc.cpp targets/taranis/rtc_driver.cpp
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Taranis/diskio.cpp
CPPSRC += sdcard.cpp logs.cpp rtc.cpp targets/Taranis/rtc_driver.cpp
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp
CPPDEFS += -DSDCARD -DVOICE -DRTCLOCK
INCDIRS += $(FATFSDIR) $(FATFSDIR)/option
@ -1046,12 +1046,12 @@ ifeq ($(PCB), TARANIS)
ifeq ($(HUBSAN), YES)
CPPDEFS += -DHUBSAN
CPPSRC += pulses/hubsan.cpp
CPPSRC += targets/taranis/a7105_driver.cpp
CPPSRC += targets/Taranis/a7105_driver.cpp
endif
ifeq ($(HAPTIC), YES)
CPPDEFS += -DHAPTIC
CPPSRC += haptic.cpp
CPPSRC += targets/taranis/haptic_driver.cpp
CPPSRC += targets/Taranis/haptic_driver.cpp
endif
ifeq ($(MIXERS_MONITOR), YES)
CPPDEFS += -DMIXERS_MONITOR
@ -1097,10 +1097,10 @@ ifeq ($(PCB), FLAMENCO)
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
BOARDSRC = main_arm.cpp targets/Flamenco/board_flamenco.cpp
EXTRABOARDSRC += targets/Flamenco/lcd_driver.cpp targets/Flamenco/delays.c targets/Flamenco/i2c_driver.cpp targets/taranis/configure_pins.cpp serial.cpp # targets/taranis/flash_driver.cpp
EXTRABOARDSRC += targets/Flamenco/lcd_driver.cpp targets/Flamenco/delays.c targets/Flamenco/i2c_driver.cpp targets/Taranis/configure_pins.cpp serial.cpp # targets/Taranis/flash_driver.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/Flamenco/pwr_driver.c targets/Flamenco/usb_driver.c
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp
EEPROMSRC = storage/storage_common.cpp storage/eeprom_common.cpp storage/eeprom_raw.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/Flamenco/tw8823_driver.cpp targets/Flamenco/pulses_driver.cpp targets/Flamenco/keys_driver.cpp targets/Flamenco/adc_driver.cpp targets/Flamenco/eeprom_driver.cpp targets/Flamenco/trainer_driver.cpp targets/Flamenco/audio_driver.cpp targets/Flamenco/serial2_driver.cpp targets/Flamenco/telemetry_driver.cpp
@ -1157,7 +1157,7 @@ ifeq ($(PCB), FLAMENCO)
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Flamenco/diskio.cpp
CPPDEFS += -DSDCARD -DVOICE -DRTCLOCK
CPPSRC += sdcard.cpp rtc.cpp logs.cpp targets/taranis/rtc_driver.cpp
CPPSRC += sdcard.cpp rtc.cpp logs.cpp targets/Taranis/rtc_driver.cpp
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp
INCDIRS += $(FATFSDIR) $(FATFSDIR)/option
@ -1219,7 +1219,7 @@ ifeq ($(PCB), HORUS)
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
BOARDSRC = main_arm.cpp targets/Horus/board_horus.cpp targets/Horus/led_driver.cpp
EXTRABOARDSRC += targets/Horus/lcd_driver.cpp targets/Horus/delays.c targets/Horus/i2c_driver.cpp targets/taranis/configure_pins.cpp serial.cpp # targets/taranis/flash_driver.cpp
EXTRABOARDSRC += targets/Horus/lcd_driver.cpp targets/Horus/delays.c targets/Horus/i2c_driver.cpp targets/Taranis/configure_pins.cpp serial.cpp # targets/Taranis/flash_driver.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/Horus/pwr_driver.c targets/Horus/usb_driver.c targets/Horus/sdram_driver.c
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp
@ -1227,6 +1227,7 @@ ifeq ($(PCB), HORUS)
CPPSRC += targets/Horus/pulses_driver.cpp targets/Horus/keys_driver.cpp targets/Horus/adc_driver.cpp targets/Horus/trainer_driver.cpp targets/Horus/audio_driver.cpp targets/Horus/serial2_driver.cpp targets/Horus/telemetry_driver.cpp
CPPSRC += gui/$(GUIDIRECTORY)/bitmaps.cpp gui/$(GUIDIRECTORY)/view_channels.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp debug.cpp
SRC += targets/Horus/system_stm32f4xx.c
CPPSRC += storage/storage_common.cpp storage/sdcard_raw.cpp
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/misc.c
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.c
SRC += $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.c
@ -1286,7 +1287,7 @@ ifeq ($(PCB), HORUS)
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/Horus/diskio.cpp
CPPDEFS += -DSDCARD -DVOICE -DRTCLOCK
CPPSRC += sdcard.cpp rtc.cpp logs.cpp targets/taranis/rtc_driver.cpp
CPPSRC += sdcard.cpp rtc.cpp logs.cpp targets/Taranis/rtc_driver.cpp
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_sdmanager.cpp
INCDIRS += $(FATFSDIR) $(FATFSDIR)/option
@ -1332,6 +1333,9 @@ endif
ifeq ($(GUI), YES)
GUISRC = gui/$(GUIDIRECTORY)/helpers.cpp gui/$(GUIDIRECTORY)/navigation.cpp gui/$(GUIDIRECTORY)/popups.cpp gui/$(GUIDIRECTORY)/widgets.cpp gui/$(GUIDIRECTORY)/menus.cpp $(GUIMODELSRC) $(GUIGENERALSRC) gui/$(GUIDIRECTORY)/view_main.cpp gui/$(GUIDIRECTORY)/view_statistics.cpp
ifeq ($(ARCH), ARM)
GUISRC += gui/gui_helpers.cpp
endif
CPPDEFS += -DGUI
endif
@ -1736,11 +1740,11 @@ endif
# build bootloader
ifeq ($(PCB), $(filter $(PCB), TARANIS))
bootloader.lbm: targets/taranis/bootloader/bootloader_ramBoot.bin
bootloader.lbm: targets/Taranis/bootloader/bootloader_ramBoot.bin
$(BIN2LBM) $^ $@
.PHONY targets/taranis/bootloader/bootloader_ramBoot.bin:
.PHONY targets/Taranis/bootloader/bootloader_ramBoot.bin:
@echo "Building bootloader..."
$(MAKE) -C targets/taranis/bootloader PCB=$(PCB) PCBREV=$(PCBREV) NANO=$(NANO) WARNINGS_AS_ERRORS=$(WARNINGS_AS_ERRORS)
$(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..."
@ -1836,9 +1840,10 @@ ifeq ($(PCB), $(filter $(PCB), HORUS))
TINSIZE = 9
SMLSIZE = 13
STDSIZE = 16
MIDSIZE = 16
DBLSIZE = 20
XXLSIZE = 38
MIDSIZE = 24
DBLSIZE = 32
DBLBOLD = True
XXLSIZE = 48
MASKFORMAT = 8bits
else
FONTNAME = Roboto
@ -1847,6 +1852,7 @@ else
STDSIZE = 8
MIDSIZE = 11
DBLSIZE = 14
DBLBOLD = False
XXLSIZE = 38
MASKFORMAT = 4bits
endif
@ -1858,22 +1864,22 @@ fonts/font_%size.lbm: fonts/font_%size.png
$(IMG2LBM) $^ $@ $(LCDSIZE) $(MASKFORMAT)
fonts/font_tinsize.png:
$(FONT2PNG) $(FONTNAME) $(TINSIZE) fonts/font_tinsize
$(FONT2PNG) $(FONTNAME) $(TINSIZE) False fonts/font_tinsize
fonts/font_smlsize.png:
$(FONT2PNG) $(FONTNAME) $(SMLSIZE) fonts/font_smlsize
$(FONT2PNG) $(FONTNAME) $(SMLSIZE) False fonts/font_smlsize
fonts/font_stdsize.png:
$(FONT2PNG) $(FONTNAME) $(STDSIZE) fonts/font_stdsize
$(FONT2PNG) $(FONTNAME) $(STDSIZE) False fonts/font_stdsize
fonts/font_midsize.png:
$(FONT2PNG) $(FONTNAME) $(MIDSIZE) fonts/font_midsize
$(FONT2PNG) $(FONTNAME) $(MIDSIZE) False fonts/font_midsize
fonts/font_dblsize.png:
$(FONT2PNG) $(FONTNAME) $(DBLSIZE) fonts/font_dblsize
$(FONT2PNG) $(FONTNAME) $(DBLSIZE) $(DBLBOLD) fonts/font_dblsize
fonts/font_xxlsize.png:
$(FONT2PNG) $(FONTNAME) $(XXLSIZE) fonts/font_xxlsize
$(FONT2PNG) $(FONTNAME) $(XXLSIZE) False fonts/font_xxlsize
fonts/%.lbm: fonts/%.png
$(IMG2LBM) $^ $@ $(LCDSIZE)
@ -2090,7 +2096,7 @@ clean_list :
$(REMOVE) fonts/font_*
$(REMOVE) fonts/*/*.lbm
$(REMOVE) lua_exports* lua_fields.txt
$(MAKE) -C targets/taranis/bootloader clean
$(MAKE) -C targets/Taranis/bootloader clean
#### Install

View file

@ -290,7 +290,7 @@ char * getModelAudioPath(char * path)
{
strcpy(path, SOUNDS_PATH "/");
strncpy(path+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
char * result = strcat_modelname(path+sizeof(SOUNDS_PATH), g_eeGeneral.currModel);
char * result = strcat_currentmodelname(path+sizeof(SOUNDS_PATH));
*result++ = '/';
*result = '\0';
return result;

View file

@ -228,23 +228,19 @@ const char *writeScreenshot()
FIL bmpFile;
UINT written;
char filename[42]; // /SCREENSHOTS/screen-2013-01-01-123540.bmp
DIR folder;
// check and create folder here
strcpy_P(filename, SCREENSHOTS_PATH);
FRESULT result = f_opendir(&folder, filename);
if (result != FR_OK) {
if (result == FR_NO_PATH)
result = f_mkdir(filename);
if (result != FR_OK)
return SDCARD_ERROR(result);
const char * error = sdCheckAndCreateDirectory(filename);
if (error) {
return error;
}
char *tmp = strAppend(&filename[sizeof(SCREENSHOTS_PATH)-1], "/screen");
tmp = strAppendDate(tmp, true);
strcpy(tmp, BITMAPS_EXT);
result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE);
FRESULT result = f_open(&bmpFile, filename, FA_CREATE_ALWAYS | FA_WRITE);
if (result != FR_OK) {
return SDCARD_ERROR(result);
}

View file

@ -269,7 +269,9 @@ int cliDisplay(const char ** argv)
name[len] = '\0';
serialPrint("[%s] = %s", name, switchState(EnumKeys(i)) ? "on" : "off");
}
#if defined(ROTARY_ENCODER_NAVIGATION)
serialPrint("[Enc.] = %d", rotencValue / 2);
#endif
for (int i=TRM_BASE; i<=TRM_LAST; i++) {
serialPrint("[Trim%d] = %s", i-TRM_BASE, switchState(EnumKeys(i)) ? "on" : "off");
}

View file

@ -43,234 +43,3 @@ uint8_t switchToMix(uint8_t source)
else
return MIXSRC_FIRST_SWITCH - 3 + source;
}
#if defined(CPUARM)
bool isSourceAvailable(int source)
{
#if !defined(HELI)
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
return false;
#endif
if (source>=MIXSRC_CH1 && source<=MIXSRC_LAST_CH) {
uint8_t destCh = source-MIXSRC_CH1;
for (uint8_t i = 0; i < MAX_MIXERS; i++) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return false;
if (md->destCh==destCh) return true;
}
return false;
}
if (source>=MIXSRC_SW1 && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
LogicalSwitchData * cs = lswAddress(source-MIXSRC_SW1);
return (cs->func != LS_FUNC_NONE);
}
#if !defined(GVARS)
if (source>=MIXSRC_GVAR1 && source<=MIXSRC_LAST_GVAR)
return false;
#endif
if (source>=MIXSRC_RESERVE1 && source<=MIXSRC_RESERVE5)
return false;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
if (qr.rem == 0)
return isTelemetryFieldAvailable(qr.quot);
else
return isTelemetryFieldComparisonAvailable(qr.quot);
}
return true;
}
bool isSourceAvailableInGlobalFunctions(int source)
{
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
return false;
}
return isSourceAvailable(source);
}
bool isSourceAvailableInCustomSwitches(int source)
{
bool result = isSourceAvailable(source);
#if defined(FRSKY)
if (result && source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
result = isTelemetryFieldComparisonAvailable(qr.quot);
}
#endif
return result;
}
bool isInputSourceAvailable(int source)
{
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
return true;
if (source>=MIXSRC_TrimRud && source<MIXSRC_SW1)
return true;
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
return true;
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
return true;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM)
return isTelemetryFieldAvailable(source-MIXSRC_FIRST_TELEM);
return false;
}
enum SwitchContext
{
LogicalSwitchesContext,
ModelCustomFunctionsContext,
GeneralCustomFunctionsContext,
TimersContext,
MixesContext
};
bool isSwitchAvailable(int swtch, SwitchContext context)
{
if (swtch < 0) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
}
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
if (context == GeneralCustomFunctionsContext) {
return false;
}
else if (context != LogicalSwitchesContext) {
LogicalSwitchData * cs = lswAddress(swtch-SWSRC_FIRST_LOGICAL_SWITCH);
return (cs->func != LS_FUNC_NONE);
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
if (context == MixesContext || context == GeneralCustomFunctionsContext) {
return false;
}
else {
swtch -= SWSRC_FIRST_FLIGHT_MODE;
if (swtch == 0) {
return true;
}
FlightModeData * fm = flightModeAddress(swtch);
return (fm->swtch != SWSRC_NONE);
}
}
return true;
}
bool isSwitchAvailableInLogicalSwitches(int swtch)
{
return isSwitchAvailable(swtch, LogicalSwitchesContext);
}
bool isSwitchAvailableInCustomFunctions(int swtch)
{
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
else
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
}
bool isSwitchAvailableInMixes(int swtch)
{
return isSwitchAvailable(swtch, MixesContext);
}
bool isSwitchAvailableInTimers(int swtch)
{
if (swtch >= 0) {
if (swtch < TMRMODE_COUNT)
return true;
else
swtch -= TMRMODE_COUNT-1;
}
else {
if (swtch > -TMRMODE_COUNT)
return false;
else
swtch += TMRMODE_COUNT-1;
}
return isSwitchAvailable(swtch, TimersContext);
}
bool isLogicalSwitchFunctionAvailable(int function)
{
return function != LS_FUNC_RANGE;
}
bool isAssignableFunctionAvailable(int function)
{
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
switch (function) {
case FUNC_OVERRIDE_CHANNEL:
#if defined(OVERRIDE_CHANNEL_FUNCTION)
return modelFunctions;
#else
return false;
#endif
case FUNC_ADJUST_GVAR:
#if defined(GVARS)
return modelFunctions;
#else
return false;
#endif
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
#endif
case FUNC_PLAY_SCRIPT:
case FUNC_RESERVE5:
return false;
default:
return true;
}
}
bool isModuleAvailable(int module)
{
if (module == MODULE_TYPE_NONE)
return false;
#if !defined(PXX)
if (module == MODULE_TYPE_XJT)
return false;
#endif
return true;
}
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
strcpy(buf, TEXT_EXT);
return isFileAvailable(filename);
}
#endif

View file

@ -36,7 +36,7 @@
#include "opentx.h"
display_t displayBuf[DISPLAY_BUF_SIZE];
display_t displayBuf[DISPLAY_BUFFER_SIZE];
void lcd_clear()
{
@ -132,7 +132,7 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
}
}
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
{
const pm_uchar * q;
@ -205,7 +205,7 @@ void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcd_putc(coord_t x, coord_t y, const unsigned char c)
{
lcd_putcAtt(x, y, c, 0);
lcdDrawChar(x, y, c, 0);
}
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags flags)
@ -240,7 +240,7 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
break;
}
else if (c >= 0x20) {
lcd_putcAtt(x, y, c, flags);
lcdDrawChar(x, y, c, flags);
x = lcdNextPos;
}
else if (c == 0x1F) { //X-coord prefix
@ -317,7 +317,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
x -= FWNUM;
char c = val & 0xf;
c = c>9 ? c+'A'-10 : c+'0';
lcd_putcAtt(x, y, c, flags|(c>='A' ? CONDENSED : 0));
lcdDrawChar(x, y, c, flags|(c>='A' ? CONDENSED : 0));
val >>= 4;
}
}
@ -329,7 +329,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint16_t val)
x -= FWNUM;
char c = val & 0xf;
c = c>9 ? c+'A'-10 : c+'0';
lcd_putcAtt(x, y, c, c>='A' ? CONDENSED : 0);
lcdDrawChar(x, y, c, c>='A' ? CONDENSED : 0);
val >>= 4;
}
}
@ -430,7 +430,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
if (c=='1' && i==len && xn>x+10) { x+=1; }
if ((lcduint_t)val >= 1000) { x+=FWNUM; f &= ~DBLSIZE; }
}
lcd_putcAtt(x, y, c, f);
lcdDrawChar(x, y, c, f);
if (mode == i) {
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
if (dblsize) {
@ -449,7 +449,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (xxlsize) {
x -= 17;
lcd_putcAtt(x+2, y, '.', f);
lcdDrawChar(x+2, y, '.', f);
}
else if (midsize) {
x -= 3;
@ -472,7 +472,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else {
x -= 2;
lcd_putcAtt(x, y, '.', f);
lcdDrawChar(x, y, '.', f);
}
}
if (dblsize && (lcduint_t)val >= 1000 && (lcduint_t)val < 10000) x-=2;
@ -497,17 +497,17 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
drawFilledRect(xn, y+2*FH-3, ln, 2);
}
}
if (neg) lcd_putcAtt(x, y, '-', flags);
if (neg) lcdDrawChar(x, y, '-', flags);
}
#endif
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
{
lcd_hlineStip(x, y, w, 0xff, att);
lcdDrawHorizontalLine(x, y, w, 0xff, att);
}
#if defined(CPUARM) && !defined(BOOT)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
{
int dx = x2-x1; /* the horizontal distance of the line */
int dy = y2-y1; /* the vertical distance of the line */
@ -553,16 +553,16 @@ void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFl
void lcd_vline(coord_t x, scoord_t y, scoord_t h)
{
lcd_vlineStip(x, y, h, SOLID);
lcdDrawVerticalLine(x, y, h, SOLID);
}
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
lcd_vlineStip(x, y, h, pat);
lcd_vlineStip(x+w-1, y, h, pat);
lcdDrawVerticalLine(x, y, h, pat);
lcdDrawVerticalLine(x+w-1, y, h, pat);
if (~att & ROUND) { x+=1; w-=2; }
lcd_hlineStip(x, y+h-1, w, pat);
lcd_hlineStip(x, y, w, pat);
lcdDrawHorizontalLine(x, y+h-1, w, pat);
lcdDrawHorizontalLine(x, y, w, pat);
}
#if !defined(BOOT)
@ -570,15 +570,15 @@ void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, Lc
{
#if defined(CPUM64)
for (scoord_t i=y; i<y+h; i++) {
lcd_hlineStip(x, i, w, pat, att);
lcdDrawHorizontalLine(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
#else
for (scoord_t i=y; i<y+h; i++) {
if ((att&ROUND) && (i==y || i==y+h-1))
lcd_hlineStip(x+1, i, w-2, pat, att);
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
else
lcd_hlineStip(x, i, w, pat, att);
lcdDrawHorizontalLine(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
#endif
@ -617,7 +617,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
}
if (tme < 0) {
lcd_putcAtt(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
tme = -tme;
}
@ -635,10 +635,10 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
lcd_outdezNAtt(x, y, qr.quot, att|LEADING0|LEFT, 2);
#if defined(CPUARM) && defined(RTCLOCK)
if (att&TIMEBLINK)
lcd_putcAtt(lcdLastPos, y, separator, BLINK);
lcdDrawChar(lcdLastPos, y, separator, BLINK);
else
#endif
lcd_putcAtt(lcdLastPos, y, separator, att&att2);
lcdDrawChar(lcdLastPos, y, separator, att&att2);
lcd_outdezNAtt(lcdNextPos, y, qr.rem, att2|LEADING0|LEFT, 2);
}
@ -646,7 +646,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
{
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'V', att);
if (~att & NO_UNIT) lcdDrawChar(lcdLastPos, y, 'V', att);
}
void putsVBat(coord_t x, coord_t y, LcdFlags att)
@ -685,7 +685,7 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
lcd_putsnAtt(x, y, g_model.telemetrySensors[qr.quot].label, ZLEN(g_model.telemetrySensors[qr.quot].label), ZCHAR|att);
if (qr.rem) lcd_putcAtt(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
if (qr.rem) lcdDrawChar(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
}
#else
else
@ -715,7 +715,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
if (idx == SWSRC_OFF)
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
if (idx < 0) {
lcd_putcAtt(x-2, y, '!', att);
lcdDrawChar(x-2, y, '!', att);
idx = -idx;
}
#if defined(CPUARM) && defined(FLIGHT_MODES)
@ -730,7 +730,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
if (idx < 0) { lcd_putcAtt(x-2, y, '!', att); idx = -idx; }
if (idx < 0) { lcdDrawChar(x-2, y, '!', att); idx = -idx; }
if (att & CONDENSED)
lcd_outdezNAtt(x+FW*1, y, idx-1, (att & ~CONDENSED), 1);
else
@ -741,7 +741,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx < 0) {
lcd_putcAtt(x-3, y, '!', att);
lcdDrawChar(x-3, y, '!', att);
idx = -idx+CURVE_BASE-1;
}
if (idx < CURVE_BASE)
@ -768,7 +768,7 @@ void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
if (v > TRIM_EXTENDED_MAX) {
uint8_t p = v - TRIM_EXTENDED_MAX - 1;
if (p >= phase) p++;
lcd_putcAtt(x, y, '0'+p, att);
lcdDrawChar(x, y, '0'+p, att);
}
else {
putsChnLetter(x, y, idx+1, att);
@ -783,10 +783,10 @@ void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, Lcd
if (v > ROTARY_ENCODER_MAX) {
uint8_t p = v - ROTARY_ENCODER_MAX - 1;
if (p >= phase) p++;
lcd_putcAtt(x, y, '0'+p, att);
lcdDrawChar(x, y, '0'+p, att);
}
else {
lcd_putcAtt(x, y, 'a'+idx, att);
lcdDrawChar(x, y, 'a'+idx, att);
}
}
#endif
@ -816,7 +816,7 @@ void displayGpsCoord(coord_t x, coord_t y, char direction, int16_t bp, int16_t a
{
if (!direction) direction = '-';
lcd_outdezAtt(x, y, bp / 100, att); // ddd before '.'
lcd_putcAtt(lcdLastPos, y, '@', att);
lcdDrawChar(lcdLastPos, y, '@', att);
uint8_t mn = bp % 100; // TODO div_t
if (g_eeGeneral.gpsFormat == 0) {
lcd_outdezNAtt(lcdNextPos, y, mn, att|LEFT|LEADING0, 2); // mm before '.'
@ -845,22 +845,22 @@ void displayDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags a
x -= 42;
att &= ~0x0F00; // TODO constant
lcd_outdezNAtt(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezNAtt(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezAtt(lcdNextPos-1, y, telemetryItem.datetime.year, att|LEFT);
y += FH;
lcd_outdezNAtt(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
}
else {
lcd_outdezNAtt(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
}
}
@ -1110,7 +1110,7 @@ void lcdSetContrast()
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
#if !defined(CPUARM)
void lcd_putcAtt(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
void lcdDrawChar(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
{
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
const pm_uchar *q = &font_5x7[(c-0x20)*5];
@ -1280,7 +1280,7 @@ void lcd_plot(coord_t x, coord_t y, LcdFlags att)
lcd_mask(p, BITMASK(y%8), att);
}
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
@ -1300,7 +1300,7 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
}
#if defined(CPUM64)
void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
{
if (x >= LCD_W) return;
if (h<0) { y+=h; h=-h; }
@ -1333,7 +1333,7 @@ void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
}
#else
// allows the att parameter...
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
#if defined(CPUARM)

View file

@ -135,17 +135,16 @@
#endif
#define display_t uint8_t
#define DISPLAY_BUF_SIZE (LCD_W*((LCD_H+7)/8))
#define DISPLAY_BUFFER_SIZE (LCD_W*((LCD_H+7)/8))
extern display_t displayBuf[DISPLAY_BUF_SIZE];
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
#define lcdRefreshWait()
extern coord_t lcdLastPos;
extern coord_t lcdNextPos;
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_BUF_SIZE)
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
#if defined(PCBSTD) && defined(VOICE)
@ -164,10 +163,10 @@ typedef const char pm_char;
#endif
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags mode);
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags);
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags flags);
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags);
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags flags);
void lcd_puts(coord_t x, coord_t y, const pm_char * s);
void lcd_putsn(coord_t x, coord_t y, const pm_char * s, unsigned char len);
void lcd_putsLeft(coord_t y, const pm_char * s);
@ -227,24 +226,24 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void lcd_plot(coord_t x, coord_t y, LcdFlags att=0);
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att=0);
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(coord_t x, scoord_t y, scoord_t h);
#if defined(CPUM64)
void lcd_vlineStip(coord_t x, scoord_t y, int8_t h, uint8_t pat);
void lcdDrawVerticalLine(coord_t x, scoord_t y, int8_t h, uint8_t pat);
#else
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
#endif
#if defined(CPUARM)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#endif
void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_invert_line(int8_t line);
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcdDrawRect(x, y, w, w, SOLID, att); }
void lcdDrawTelemetryTopBar();
@ -271,7 +270,7 @@ void lcdRefresh();
#if defined(SIMU)
extern bool lcd_refresh;
extern display_t lcd_buf[DISPLAY_BUF_SIZE];
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
#endif
char *strAppend(char * dest, const char * source, int len=0);

View file

@ -104,7 +104,7 @@ void menuCommonCalib(uint8_t event)
case 3:
g_eeGeneral.chkSum = evalChkSum();
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
reusableBuffer.calib.state = 4;
break;

View file

@ -39,7 +39,7 @@
void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
{
uint8_t t = switchState(key);
lcd_putcAtt(x, y, t+'0', t ? INVERS : 0);
lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
}
void menuGeneralDiagKeys(uint8_t event)

View file

@ -79,7 +79,7 @@ void menuGeneralHardware(uint8_t event)
lcd_puts(INDENT_WIDTH+3*FW, y, PSTR("Gain"));
uint8_t mask = (1<<(k-ITEM_SETUP_HW_STICK_LV_GAIN));
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
lcd_putcAtt(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr);
lcdDrawChar(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr);
if (attr) {
CHECK_INCDEC_GENVAR(event, val, 0, 1);
if (checkIncDec_Ret) {

View file

@ -291,9 +291,9 @@ void menuGeneralSdManager(uint8_t _event)
lcdNextPos = 0;
uint8_t attr = (m_posVert-1-s_pgOfs == i ? BSS|INVERS : BSS);
if (reusableBuffer.sdmanager.lines[i][0]) {
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcdDrawChar(0, y, '[', attr); }
lcd_putsAtt(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdNextPos, y, ']', attr); }
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcdDrawChar(lcdNextPos, y, ']', attr); }
}
}
}

View file

@ -149,7 +149,7 @@ void menuGeneralSetup(uint8_t event)
if (s_warning_result) {
s_warning_result = 0;
g_eeGeneral.fai = true;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
#endif
@ -304,7 +304,7 @@ void menuGeneralSetup(uint8_t event)
case ITEM_SETUP_SPEAKER_PITCH:
lcd_putsLeft( y, STR_SPKRPITCH);
#if defined(CPUARM)
lcd_putcAtt(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
lcd_putsAtt(lcdLastPos, y, "Hz", attr);
#else
@ -565,13 +565,13 @@ void menuGeneralSetup(uint8_t event)
if (attr) {
s_editMode = 0;
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickReverse, 0, 15);
lcd_rect(6*FW-1, y-1, 15*FW+2, 9);
lcdDrawRect(6*FW-1, y-1, 15*FW+2, 9);
}
#endif
break;
case ITEM_SETUP_STICK_MODE:
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
lcdDrawChar(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
for (uint8_t i=0; i<4; i++) {
putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
}

View file

@ -106,7 +106,7 @@ void menuGeneralTrainer(uint8_t event)
if (attr) {
if (event==EVT_KEY_LONG(KEY_ENTER)){
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
AUDIO_WARNING1();
}
}

View file

@ -199,10 +199,10 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
if (c != v) {
name[cur] = v;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
lcdDrawChar(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
}
else {
cur = 0;

View file

@ -98,7 +98,7 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0)
for (uint8_t i=0; i<custom-2; i++)
crv[custom+i] = -100 + ((200 * (i+1) + custom/2) / (custom-1)) ;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
return true;
}
@ -129,7 +129,7 @@ void menuModelCurveOne(uint8_t event)
m_posHorz = -4;
for (uint8_t i=0; i<crv.points; i++)
crv.crv[i] = (i-(crv.points/2)) * int8_t(m_posHorz) * 50 / (crv.points-1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
killEvents(event);
}
break;
@ -207,7 +207,7 @@ void menuModelCurveOne(uint8_t event)
if (crv.custom && i>0 && i<crv.points-1) x = crv.crv[crv.points+i-1];
lcd_puts(7, 2*FH, PSTR("x=")); lcd_outdezAtt(7+2*FW, 2*FH, x, LEFT);
lcd_puts(7, 3*FH, PSTR("y=")); lcd_outdezAtt(7+2*FW, 3*FH, crv.crv[i], LEFT);
lcd_rect(3, 1*FH+4, 7*FW-2, 3*FH-2);
lcdDrawRect(3, 1*FH+4, 7*FW-2, 3*FH-2);
if (p1valdiff || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP))
CHECK_INCDEC_MODELVAR(event, crv.crv[i], -100, 100); // edit Y on up/down

View file

@ -72,7 +72,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
s_menu_flags = 0;
}
@ -80,7 +80,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
else {
// The user choosed a file in the list
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
}
#endif
@ -244,7 +244,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
menuHandler = onCustomFunctionsFileSelectionMenu;
}
else {
@ -287,7 +287,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
#endif
}
else if (func == FUNC_PLAY_BOTH) {
lcd_putcAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
lcdDrawChar(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr);
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT);
}
@ -365,7 +365,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
}
else if (HAS_REPEAT_PARAM(func)) {
if (CFN_PLAY_REPEAT(cfn) == 0) {
lcd_putcAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
lcdDrawChar(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
}
#if defined(CPUARM)
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {

View file

@ -55,7 +55,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
if (expoMenu && ((attr && p < posHorz-4) || (x > EXPO_ONE_2ND_COLUMN-FW)))
continue;
#endif
lcd_putcAtt(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
lcdDrawChar(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
x += FW;
}
@ -63,7 +63,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) {
s_editMode = 0;
value ^= (1<<posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -84,8 +84,8 @@ int16_t expoFn(int16_t x)
void DrawFunction(FnFuncP fn, uint8_t offset)
{
lcd_vlineStip(X0-offset, 0, LCD_H, 0xee);
lcd_hlineStip(X0-WCHART-offset, Y0, WCHART*2, 0xee);
lcdDrawVerticalLine(X0-offset, 0, LCD_H, 0xee);
lcdDrawHorizontalLine(X0-WCHART-offset, Y0, WCHART*2, 0xee);
coord_t prev_yv = (coord_t)-1;
@ -143,7 +143,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
// TODO avoid this global s_currCh on ARM boards ...
@ -168,7 +168,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
mix->weight = 100;
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void copyExpoMix(uint8_t expo, uint8_t idx)
@ -183,7 +183,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void memswap(void *a, void *b, uint8_t size)
@ -435,8 +435,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
barMin = -101;
if (barMax > 101)
barMax = 101;
lcd_hlineStip(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcd_hlineStip(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
lcdDrawHorizontalLine(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcdDrawHorizontalLine(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
lcd_vline(x-2, y+1, GAUGE_HEIGHT-1);
lcd_vline(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
if (barMin <= barMax) {
@ -784,7 +784,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
s_copyTgtOfs += (s_copyTgtOfs < 0 ? +1 : -1);
} while (s_copyTgtOfs != 0);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
m_posVert = s_copySrcRow;
s_copyTgtOfs = 0;
@ -890,7 +890,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
else {
// only swap the mix with its neighbor
if (!swapExpoMix(expo, s_currIdx, IS_ROTARY_UP(event) || key==KEY_MOVE_UP)) break;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
s_copyTgtOfs = next_ofs;
@ -924,7 +924,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
do {
if (s_copyMode) {
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < 8 && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
lcd_rect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
lcdDrawRect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
cur++; y+=FH;
}
if (s_currIdx == i) {
@ -963,7 +963,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (s_copyMode) {
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
/* draw a border around the raw on selection mode (copy/move) */
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
}
if (cur == sub) {
/* invert the raw when it's the current one */
@ -974,7 +974,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < LCD_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
cur++; y+=FH;
}
}
@ -995,7 +995,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
putsChn(0, y, ch, attr); // show CHx
}
if (s_copyMode == MOVE_MODE && s_copySrcCh == ch) {
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
}
}
cur++; y+=FH;

View file

@ -125,7 +125,7 @@ void menuModelLimits(uint8_t event)
s_warning_result = 0;
LimitData *ld = limitAddress(sub);
ld->revert = !ld->revert;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
@ -209,7 +209,7 @@ void menuModelLimits(uint8_t event)
{
uint8_t revert = ld->revert;
#if defined(PPM_CENTER_ADJUSTABLE)
lcd_putcAtt(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
lcdDrawChar(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
#else
lcd_putsiAtt(LIMITS_REVERT_POS, y, STR_MMMINV, revert, attr);
#endif
@ -237,9 +237,9 @@ void menuModelLimits(uint8_t event)
#if defined(PPM_LIMITS_SYMETRICAL)
case ITEM_LIMITS_SYMETRICAL:
#if defined(CPUARM)
lcd_putcAtt(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
#else
lcd_putcAtt(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '^', attr);
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '^', attr);
#endif
if (active) {
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);

View file

@ -196,7 +196,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
if (cs->v2 < v2_min || cs->v2 > v2_max) {
cs->v2 = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
else
@ -419,7 +419,7 @@ void menuModelLogicalSwitches(uint8_t event)
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
if (cs->v2 < v2_min || cs->v2 > v2_max) {
cs->v2 = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#else
if (cstate == LS_FAMILY_OFS) {
@ -432,7 +432,7 @@ void menuModelLogicalSwitches(uint8_t event)
}
if (cs->v2 > v2_max) {
cs->v2 = v2_max;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
}

View file

@ -58,11 +58,11 @@ void onModelSelectMenu(const char *result)
}
#if defined(SDCARD)
else if (result == STR_BACKUP_MODEL) {
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
POPUP_WARNING(eeBackupModel(sub));
}
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
if (!listSdFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
POPUP_WARNING(STR_NO_MODELS_ON_SD);
s_menu_flags = 0;
}
@ -132,7 +132,7 @@ void menuModelSelect(uint8_t event)
if (sub >= LCD_LINES-1) s_pgOfs = sub-LCD_LINES+2;
s_copyMode = 0;
s_editMode = EDIT_MODE_INIT;
eeCheck(true);
storageCheck(true);
break;
case EVT_KEY_LONG(KEY_EXIT):
@ -200,7 +200,7 @@ void menuModelSelect(uint8_t event)
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
displayPopup(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
@ -223,7 +223,7 @@ void menuModelSelect(uint8_t event)
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
s_copyMode = 0;
@ -370,7 +370,7 @@ void menuModelSelect(uint8_t event)
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
drawFilledRect(9, y, MODELSEL_W-1-9, 7);
lcd_rect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
}
}
}

View file

@ -213,7 +213,7 @@ void menuModelSetup(uint8_t event)
int8_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) {
timer->mode = switchVal + (TMRMODE_COUNT-1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
#endif
@ -335,7 +335,7 @@ void menuModelSetup(uint8_t event)
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
}
}
@ -400,11 +400,11 @@ void menuModelSetup(uint8_t event)
case EVT_KEY_BREAK(KEY_ENTER):
#if defined(CPUM64)
g_model.switchWarningEnable ^= (1 << m_posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
#else
if (m_posHorz < NUM_SWITCHES-1) {
g_model.switchWarningEnable ^= (1 << m_posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
break;
@ -414,14 +414,14 @@ void menuModelSetup(uint8_t event)
getMovedSwitch();
g_model.switchWarningState = switches_states;
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
#else
if (m_posHorz == NUM_SWITCHES-1) {
s_noHi = NO_HI_LEN;
getMovedSwitch();
g_model.switchWarningState = switches_states;
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
killEvents(event);
@ -451,7 +451,7 @@ void menuModelSetup(uint8_t event)
if (swactive)
attr |= INVERS;
}
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
#if !defined(CPUM64)
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (m_posHorz == NUM_SWITCHES-1 && !s_noHi) ? line : 0);
#endif
@ -471,7 +471,7 @@ void menuModelSetup(uint8_t event)
if (READ_ONLY_UNLOCKED()) {
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
}
@ -576,7 +576,7 @@ void menuModelSetup(uint8_t event)
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
switch (m_posHorz) {
@ -729,7 +729,7 @@ void menuModelSetup(uint8_t event)
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.moduleData[1].ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0);
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
switch (m_posHorz) {
case 0:
@ -754,7 +754,7 @@ void menuModelSetup(uint8_t event)
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
switch (m_posHorz) {
case 0:
@ -821,7 +821,7 @@ void menuModelFailsafe(uint8_t event)
if (event == EVT_KEY_LONG(KEY_ENTER) && s_editMode) {
s_noHi = NO_HI_LEN;
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
}
@ -876,7 +876,7 @@ void menuModelFailsafe(uint8_t event)
#endif
// Gauge
lcd_rect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
coord_t x0 = (val>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-len;

View file

@ -409,7 +409,7 @@ void menuModelSensor(uint8_t event)
lcd_putsLeft(y, STR_RATIO);
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 0, 30000);
if (sensor->custom.ratio == 0)
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
else
lcd_outdezAtt(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
break;
@ -452,7 +452,7 @@ void menuModelSensor(uint8_t event)
source = checkIncDec(event, source, -MAX_SENSORS, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
}
if (source < 0) {
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
putsMixerSource(lcdNextPos, y, MIXSRC_FIRST_TELEM+3*(-1-source), attr);
}
else {
@ -511,7 +511,7 @@ void onSensorMenu(const char *result)
TelemetryItem & sourceItem = telemetryItems[index];
TelemetryItem & newItem = telemetryItems[newIndex];
newItem = sourceItem;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else {
POPUP_WARNING(STR_TELEMETRYFULL);
@ -569,7 +569,7 @@ void menuModelTelemetry(uint8_t event)
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
int index = k-ITEM_TELEMETRY_SENSOR1;
lcd_outdezAtt(INDENT_WIDTH, y, index+1, LEFT|attr);
lcd_putcAtt(lcdLastPos, y, ':', attr);
lcdDrawChar(lcdLastPos, y, ':', attr);
lcd_putsnAtt(3*FW, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
if (telemetryItems[index].isFresh()) {
lcd_putc(16*FW, y, '*');

View file

@ -156,7 +156,6 @@ extern int8_t s_editMode; // global editmode
#define HIDDEN_ROW ((uint8_t)-2)
#if defined(CPUARM)
typedef bool (*IsValueAvailable)(int);
struct CheckIncDecStops {
const int count;
const int stops[];
@ -224,13 +223,6 @@ int8_t checkIncDecMovedSwitch(int8_t val);
#endif
#if defined(CPUARM)
bool isLogicalSwitchFunctionAvailable(int function);
bool isAssignableFunctionAvailable(int function);
bool isSwitchAvailableInLogicalSwitches(int swtch);
bool isSwitchAvailableInCustomFunctions(int swtch);
bool isSwitchAvailableInMixes(int swtch);
bool isSwitchAvailableInTimers(int swtch);
bool isModuleAvailable(int module);
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
@ -251,11 +243,6 @@ int8_t checkIncDecMovedSwitch(int8_t val);
#endif
#if defined(CPUARM)
bool isInputAvailable(int input);
bool isSourceAvailable(int source);
bool isSourceAvailableInGlobalFunctions(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isInputSourceAvailable(int source);
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
#elif defined(AUTOSOURCE)

View file

@ -205,7 +205,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
else
AUDIO_KEYPAD_DOWN();
}
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
}
else {
@ -306,7 +306,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
else
AUDIO_KEYPAD_DOWN();
}
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
}
else {

View file

@ -52,7 +52,7 @@ int16_t s_warning_input_max;
void displayBox()
{
drawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
lcd_rect(10, 16, LCD_W-20, 40);
lcdDrawRect(10, 16, LCD_W-20, 40);
#if defined(CPUARM)
lcd_putsn(WARNING_LINE_X, WARNING_LINE_Y, s_warning, WARNING_LINE_LEN);
#else
@ -152,7 +152,7 @@ const char * displayMenu(uint8_t event)
uint8_t display_count = min<uint8_t>(s_menu_count, MENU_MAX_LINES);
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
drawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
lcd_rect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
for (uint8_t i=0; i<display_count; i++) {
lcd_putsAtt(MENU_X+6, i*(FH+1) + y + 2, s_menu[i], s_menu_flags);

View file

@ -325,7 +325,7 @@ void menuMainView(uint8_t event)
#else
g_eeGeneral.view ^= ALTERNATE_VIEW;
#endif
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
AUDIO_KEYPAD_UP();
}
break;
@ -381,7 +381,7 @@ void menuMainView(uint8_t event)
case EVT_KEY_BREAK(KEY_UP):
case EVT_KEY_BREAK(KEY_DOWN):
g_eeGeneral.view = (event == EVT_KEY_BREAK(KEY_UP) ? (view_base == VIEW_COUNT-1 ? 0 : view_base+1) : (view_base == 0 ? VIEW_COUNT-1 : view_base-1));
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
AUDIO_KEYPAD_UP();
break;
@ -451,7 +451,7 @@ void menuMainView(uint8_t event)
if (view_base < VIEW_INPUTS) {
// scroll bar
lcd_hlineStip(38, 34, 54, DOTTED);
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
#if defined(PCBSKY9X)
lcd_hline(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
#else
@ -491,7 +491,7 @@ void menuMainView(uint8_t event)
int8_t len = (abs(val) * WBAR2 + lim/2) / lim;
if(len>WBAR2) len = WBAR2; // prevent bars from going over the end - comment for debugging
lcd_hlineStip(x0-WBAR2, y0, WBAR2*2+1, DOTTED);
lcdDrawHorizontalLine(x0-WBAR2, y0, WBAR2*2+1, DOTTED);
lcd_vline(x0,y0-2,5);
if (val>0)
x0+=1;
@ -567,7 +567,7 @@ void menuMainView(uint8_t event)
// And ! in case of unexpected shutdown
if (unexpectedShutdown) {
lcd_putcAtt(REBOOT_X, 0*FH, '!', INVERS);
lcdDrawChar(REBOOT_X, 0*FH, '!', INVERS);
}
#if defined(GVARS) && !defined(PCBSTD)

View file

@ -131,7 +131,7 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
for (; i < 4; i++) {
c = (lnum % 10) + '0';
x1 -= xinc;
lcd_putcAtt(x1, y, c, mode);
lcdDrawChar(x1, y, c, mode);
lnum /= 10;
if (lnum == 0) {
break;
@ -142,20 +142,20 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
x1 = x;
for (i = 0; i < 4; i++) {
x1 -= FW;
lcd_putcAtt(x1, y, '?', mode);
lcdDrawChar(x1, y, '?', mode);
}
} else {
if (val < 0) {
val = -val;
x1 -= xinc;
lcd_putcAtt(x1, y, '-', mode);
lcdDrawChar(x1, y, '-', mode);
}
if (precis)
{
uint8_t y_temp = y;
if (mode & DBLSIZE)
y_temp += FH;
lcd_putcAtt(x, y_temp, '.', (mode & (~DBLSIZE)));
lcdDrawChar(x, y_temp, '.', (mode & (~DBLSIZE)));
x -= (xinc / 2);
}
for (i = 0; i < precis; i++) {
@ -163,7 +163,7 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
int a = val;
c = a + '0';
x += xinc;
lcd_putcAtt(x, y, c, mode);
lcdDrawChar(x, y, c, mode);
val -= a;
}
}
@ -203,7 +203,7 @@ void mav_title(const pm_char * s, uint8_t index)
displayScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
lcd_putc(7 * FW, 0, (mav_heartbeat > 0) ? '*' : ' ');
if (telemetry_data.active)
lcd_putcAtt(8 * FW, 0, 'A', BLINK);
lcdDrawChar(8 * FW, 0, 'A', BLINK);
}
/*! \brief Global info menu
@ -444,7 +444,7 @@ void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val) {
x -= FWNUM;
char c = val & 0xf;
c = c > 9 ? c + 'A' - 10 : c + '0';
lcd_putcAtt(x, y, c, c >= 'A' ? CONDENSED : 0);
lcdDrawChar(x, y, c, c >= 'A' ? CONDENSED : 0);
val >>= 4;
}
}

View file

@ -50,7 +50,7 @@ void menuStatisticsView(uint8_t event)
#if defined(CPUARM)
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
sessionTimer = 0;
break;
#endif
@ -110,7 +110,7 @@ void menuStatisticsDebug(uint8_t event)
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.mAhUsed = 0;
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
#if defined(PCBSKY9X)
Current_used = 0;
#endif

View file

@ -56,12 +56,12 @@ void displayRssiLine()
#if !defined(CPUARM)
rssi = min((uint8_t)99, frskyData.rssi[1].value);
lcd_putsLeft(STATUS_BAR_Y, STR_TX); lcd_outdezNAtt(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2);
lcd_rect(BAR_LEFT+1, 57, 38, 7);
lcdDrawRect(BAR_LEFT+1, 57, 38, 7);
drawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
#endif
rssi = min((uint8_t)99, TELEMETRY_RSSI());
lcd_puts(104, STATUS_BAR_Y, STR_RX); lcd_outdezNAtt(105+4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
lcd_rect(65, 57, 38, 7);
lcdDrawRect(65, 57, 38, 7);
uint8_t v = 4*rssi/11;
drawFilledRect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
}
@ -76,9 +76,9 @@ void displayGpsTime()
{
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
lcd_outdezNAtt(CENTER_OFS+6*FW+7, STATUS_BAR_Y, frskyData.hub.hour, att, 2);
lcd_putcAtt(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
lcdDrawChar(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
lcd_outdezNAtt(CENTER_OFS+9*FW+2, STATUS_BAR_Y, frskyData.hub.min, att, 2);
lcd_putcAtt(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
lcdDrawChar(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
lcd_outdezNAtt(CENTER_OFS+12*FW-3, STATUS_BAR_Y, frskyData.hub.sec, att, 2);
lcd_status_line();
}
@ -261,7 +261,7 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
#else
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
#endif
lcd_rect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
lcdDrawRect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
#if defined(CPUARM)
getvalue_t value = getValue(source);
#else
@ -314,7 +314,7 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
}
if (thresholdX) {
lcd_vlineStip(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcdDrawVerticalLine(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcd_hline(BAR_LEFT+thresholdX, y-2, 3);
}
}

View file

@ -67,19 +67,19 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
{
lcd_outdezAtt(LCD_W, 0, count, attr);
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
lcd_putcAtt(x, 0, '/', attr);
lcdDrawChar(x, 0, '/', attr);
lcd_outdezAtt(x, 0, index+1, attr);
}
#if !defined(CPUM64)
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
{
lcd_vlineStip(x, y, h, DOTTED);
lcdDrawVerticalLine(x, y, h, DOTTED);
coord_t yofs = (h * offset) / count;
coord_t yhgt = (h * visible) / count;
if (yhgt + yofs > h)
yhgt = h - yofs;
lcd_vlineStip(x, y + yofs, yhgt, SOLID, FORCE);
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
}
#endif
@ -149,7 +149,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {
@ -169,7 +169,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
idx = -idx;
lcd_putcAtt(x-6, y, '-', attr);
lcdDrawChar(x-6, y, '-', attr);
}
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);
@ -193,7 +193,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
if (invers && event == EVT_KEY_LONG(KEY_ENTER)) {
s_editMode = !s_editMode;
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {
if (attr & LEFT)
@ -208,7 +208,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
idx = -idx;
lcd_putcAtt(x-6, y, '-', attr);
lcdDrawChar(x-6, y, '-', attr);
}
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx, delta);

View file

@ -41,391 +41,3 @@ uint8_t switchToMix(uint8_t source)
div_t qr = div(source-1, 3);
return qr.quot+MIXSRC_FIRST_SWITCH;
}
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
{
do {
current += inc;
if (current < min)
current = max;
else if (current > max)
current = min;
if (!isValueAvailable || isValueAvailable(current))
return current;
} while(1);
return 0;
}
bool isInputAvailable(int input)
{
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
}
bool isChannelUsed(int channel)
{
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return false;
if (md->destCh == channel) return true;
if (md->destCh > channel) return false;
}
return false;
}
int getChannelsUsed()
{
int result = 0;
int lastCh = -1;
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return result;
if (md->destCh != lastCh) { ++result; lastCh = md->destCh; }
}
return result;
}
bool isSourceAvailable(int source)
{
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
return isInputAvailable(source - MIXSRC_FIRST_INPUT);
}
#if defined(LUA_MODEL_SCRIPTS)
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA) {
div_t qr = div(source-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
return (qr.rem<scriptInputsOutputs[qr.quot].outputsCount);
}
#else
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA)
return false;
#endif
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH) {
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
}
#if !defined(HELI)
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
return false;
#endif
if (source>=MIXSRC_CH1 && source<=MIXSRC_LAST_CH) {
return isChannelUsed(source-MIXSRC_CH1);
}
if (source>=MIXSRC_FIRST_LOGICAL_SWITCH && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
LogicalSwitchData * cs = lswAddress(source-MIXSRC_FIRST_LOGICAL_SWITCH);
return (cs->func != LS_FUNC_NONE);
}
#if !defined(GVARS)
if (source>=MIXSRC_GVAR1 && source<=MIXSRC_LAST_GVAR)
return false;
#endif
if (source>=MIXSRC_RESERVE1 && source<=MIXSRC_RESERVE5)
return false;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
if (qr.rem == 0)
return isTelemetryFieldAvailable(qr.quot);
else
return isTelemetryFieldComparisonAvailable(qr.quot);
}
return true;
}
bool isSourceAvailableInGlobalFunctions(int source)
{
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
return false;
}
return isSourceAvailable(source);
}
bool isSourceAvailableInCustomSwitches(int source)
{
bool result = isSourceAvailable(source);
#if defined(FRSKY)
if (result && source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
result = isTelemetryFieldComparisonAvailable(qr.quot);
}
#endif
return result;
}
bool isInputSourceAvailable(int source)
{
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
return true;
if (source>=MIXSRC_FIRST_TRIM && source<=MIXSRC_LAST_TRIM)
return true;
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH)
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
return true;
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
return true;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
return isTelemetryFieldAvailable(qr.quot) && isTelemetryFieldComparisonAvailable(qr.quot);
}
return false;
}
enum SwitchContext
{
LogicalSwitchesContext,
ModelCustomFunctionsContext,
GeneralCustomFunctionsContext,
TimersContext,
MixesContext
};
bool isLogicalSwitchAvailable(int index)
{
LogicalSwitchData * lsw = lswAddress(index);
return (lsw->func != LS_FUNC_NONE);
}
bool isSwitchAvailable(int swtch, SwitchContext context)
{
bool negative = false;
if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
}
if (swtch >= SWSRC_SA0 && swtch <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(swtch);
if (!SWITCH_EXISTS(swinfo.quot)) {
return false;
}
if (!IS_3POS(swinfo.quot)) {
if (negative) {
return false;
}
if (IS_3POS_MIDDLE(swinfo.rem)) {
return false;
}
}
return true;
}
#if NUM_XPOTS > 0
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) {
int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT;
if (IS_POT_MULTIPOS(POT1+index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT));
}
else {
return false;
}
}
#endif
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
if (context == GeneralCustomFunctionsContext) {
return false;
}
else if (context != LogicalSwitchesContext) {
return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH);
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
if (context == MixesContext || context == GeneralCustomFunctionsContext) {
return false;
}
else {
swtch -= SWSRC_FIRST_FLIGHT_MODE;
if (swtch == 0) {
return true;
}
FlightModeData * fm = flightModeAddress(swtch);
return (fm->swtch != SWSRC_NONE);
}
}
if (swtch >= SWSRC_FIRST_SENSOR && swtch <= SWSRC_LAST_SENSOR) {
return isTelemetryFieldAvailable(swtch - SWSRC_FIRST_SENSOR);
}
return true;
}
bool isSwitchAvailableInLogicalSwitches(int swtch)
{
return isSwitchAvailable(swtch, LogicalSwitchesContext);
}
bool isSwitchAvailableInCustomFunctions(int swtch)
{
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
else
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
}
bool isSwitchAvailableInMixes(int swtch)
{
return isSwitchAvailable(swtch, MixesContext);
}
bool isSwitchAvailableInTimers(int swtch)
{
if (swtch >= 0) {
if (swtch < TMRMODE_COUNT)
return true;
else
swtch -= TMRMODE_COUNT-1;
}
else {
if (swtch > -TMRMODE_COUNT)
return false;
else
swtch += TMRMODE_COUNT-1;
}
return isSwitchAvailable(swtch, TimersContext);
}
bool isThrottleSourceAvailable(int source)
{
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;
}
bool isLogicalSwitchFunctionAvailable(int function)
{
return function != LS_FUNC_RANGE;
}
bool isAssignableFunctionAvailable(int function)
{
#if defined(OVERRIDE_CHANNEL_FUNCTION) || defined(GVARS)
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
#endif
switch (function) {
case FUNC_OVERRIDE_CHANNEL:
#if defined(OVERRIDE_CHANNEL_FUNCTION)
return modelFunctions;
#else
return false;
#endif
case FUNC_ADJUST_GVAR:
#if defined(GVARS)
return modelFunctions;
#else
return false;
#endif
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
#endif
#if !defined(LUA)
case FUNC_PLAY_SCRIPT:
#endif
case FUNC_RESERVE5:
return false;
default:
return true;
}
}
bool isSourceAvailableInGlobalResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM)
return false;
else
return isSourceAvailableInResetSpecialFunction(index);
}
bool isSourceAvailableInResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM) {
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM];
return telemetrySensor.isAvailable();
}
#if TIMERS < 3
else if (index == FUNC_RESET_TIMER3) {
return false;
}
#endif
#if TIMERS < 2
else if (index == FUNC_RESET_TIMER2) {
return false;
}
#endif
else {
return true;
}
}
bool isModuleAvailable(int module)
{
return true;
}
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
strcpy(buf, TEXT_EXT);
return isFileAvailable(filename);
}
int getFirstAvailable(int min, int max, bool (*func)(int))
{
int retval = 0;
for (int i = min; i <= max; i++) {
if ((*func)(i)) {
retval = i;
break;
}
}
return retval;
}

View file

@ -37,7 +37,7 @@
#include "../../opentx.h"
#if defined(SIMU)
display_t displayBuf[DISPLAY_BUF_SIZE];
display_t displayBuf[DISPLAY_BUFFER_SIZE];
#endif
uint16_t lcdColorTable[LCD_COLOR_COUNT];
@ -123,7 +123,7 @@ void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_
lcdNextPos = x + width;
}
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
{
int fontindex = FONTSIZE(flags) >> 8;
const pm_uchar * font = fontsTable[fontindex];
@ -131,11 +131,6 @@ void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
lcdPutFontPattern(x, y, font, fontspecs, getMappedChar(c), flags);
}
void lcd_putc(coord_t x, coord_t y, const unsigned char c)
{
lcd_putcAtt(x, y, c, 0);
}
uint8_t getStringInfo(const char *s)
{
uint8_t result = 0;
@ -180,11 +175,11 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
flags += TEXT_INVERTED_COLOR - TEXT_COLOR;
}
if (FONTSIZE(flags) == TINSIZE)
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+2, y-INVERT_VERT_MARGIN+2, width+2*INVERT_HORZ_MARGIN-5, INVERT_LINE_HEIGHT-7, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x-INVERT_HORZ_MARGIN+2, y-INVERT_VERT_MARGIN+2, width+2*INVERT_HORZ_MARGIN-5, INVERT_LINE_HEIGHT-7, TEXT_INVERTED_BGCOLOR);
else if (FONTSIZE(flags) == SMLSIZE)
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+1, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN-2, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x-INVERT_HORZ_MARGIN+1, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN-2, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
else
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
char str[256];
@ -330,13 +325,8 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, int len,
lcd_putsAtt(x, y, s, flags);
}
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
{
lcd_hlineStip(x, y, w, 0xff, att);
}
#if !defined(BOOT)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
{
int dx = x2-x1; /* the horizontal distance of the line */
int dy = y2-y1; /* the vertical distance of the line */
@ -380,44 +370,39 @@ void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFl
}
#endif
void lcd_vline(coord_t x, scoord_t y, scoord_t h)
{
lcd_vlineStip(x, y, h, SOLID);
}
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
if (att & ROUND) {
lcd_vlineStip(x, y+1, h-2, pat, att);
lcd_vlineStip(x+w-1, y+1, h-2, pat, att);
lcd_hlineStip(x+1, y+h-1, w-2, pat, att);
lcd_hlineStip(x+1, y, w-2, pat, att);
lcdDrawVerticalLine(x, y+1, h-2, pat, att);
lcdDrawVerticalLine(x+w-1, y+1, h-2, pat, att);
lcdDrawHorizontalLine(x+1, y+h-1, w-2, pat, att);
lcdDrawHorizontalLine(x+1, y, w-2, pat, att);
}
else {
lcd_vlineStip(x, y, h, pat, att);
lcd_vlineStip(x+w-1, y, h, pat, att);
lcd_hlineStip(x+1, y+h-1, w-2, pat, att);
lcd_hlineStip(x+1, y, w-2, pat, att);
lcdDrawVerticalLine(x, y, h, pat, att);
lcdDrawVerticalLine(x+w-1, y, h, pat, att);
lcdDrawHorizontalLine(x+1, y+h-1, w-2, pat, att);
lcdDrawHorizontalLine(x+1, y, w-2, pat, att);
}
}
#if defined(SIMU)
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
{
for (scoord_t i=y; i<y+h; i++) {
lcd_hlineStip(x, i, w, SOLID, att);
lcdDrawHorizontalLine(x, i, w, SOLID, att);
}
}
#endif
#if !defined(BOOT)
void lcdDrawFilledRectWithAttributes(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
for (scoord_t i=y; i<y+h; i++) {
if ((att&ROUND) && (i==y || i==y+h-1))
lcd_hlineStip(x+1, i, w-2, pat, att);
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
else
lcd_hlineStip(x, i, w, pat, att);
lcdDrawHorizontalLine(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
}
@ -433,7 +418,7 @@ void getTimerString(char * str, putstime_t tme, LcdFlags att)
div_t qr;
if (tme < 0) {
// TODO lcd_putcAtt(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
// TODO lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
tme = -tme;
*str++ = '-';
}
@ -504,15 +489,15 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
#if defined(LUA_MODEL_SCRIPTS)
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
lcd_putcAtt(x+2, y+1, '1'+qr.quot, TINSIZE);
lcdDrawFilledRect(x, y, 7, 7);
lcdDrawChar(x+2, y+1, '1'+qr.quot, TINSIZE);
lcdDrawSolidFilledRect(x, y, 7, 7);
lcd_putsnAtt(x+8, y, scriptInputsOutputs[qr.quot].outputs[qr.rem].name, att & STREXPANDED ? 9 : 4, att);
}
else
#endif
{
putsStrIdx(x, y, "LUA", qr.quot+1, att);
lcd_putcAtt(x+20, y, 'a'+qr.rem, att);
lcdDrawChar(x+20, y, 'a'+qr.rem, att);
}
}
@ -540,7 +525,7 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
#if 0
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
lcd_putcAtt(lcdNextPos, y, ' ', att);
lcdDrawChar(lcdNextPos, y, ' ', att);
lcd_putsnAtt(lcdNextPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
}
#endif
@ -682,7 +667,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
if (neg) {
if ((att&INVERS) && ((~att&BLINK) || BLINK_ON_PHASE))
att &= ~(INVERS|BLINK);
lcd_putcAtt(x-3, y, '!', att);
lcdDrawChar(x-3, y, '!', att);
}
}
@ -810,6 +795,12 @@ void lcdDrawPixel(display_t * p, display_t value)
*p = value;
}
void lcdDrawPixel(coord_t x, coord_t y, display_t value)
{
display_t * p = PIXEL_PTR(x, y);
lcdDrawPixel(p, value);
}
void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
{
display_t * p = PIXEL_PTR(x, y);
@ -843,7 +834,7 @@ void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att)
}
}
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
@ -864,7 +855,7 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
}
}
void lcd_vlineStip(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags att)
void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
if (y >= LCD_H) return;
@ -914,7 +905,218 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint16_t * img, coord_t offset, c
}
#endif
void drawBlackOverlay()
void lcdDrawBlackOverlay()
{
// TODO drawFilledRect(0, 0, LCD_W, LCD_H, SOLID, OPAQUE(10, GREY(3)));
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, TEXT_COLOR | (8<<24));
}
void lcdDrawCircle(int x0, int y0, int radius)
{
int x = radius;
int y = 0;
int decisionOver2 = 1 - x;
while (y <= x) {
lcdDrawPixel(x+x0, y+y0, WHITE);
lcdDrawPixel(y+x0, x+y0, WHITE);
lcdDrawPixel(-x+x0, y+y0, WHITE);
lcdDrawPixel(-y+x0, x+y0, WHITE);
lcdDrawPixel(-x+x0, -y+y0, WHITE);
lcdDrawPixel(-y+x0, -x+y0, WHITE);
lcdDrawPixel(x+x0, -y+y0, WHITE);
lcdDrawPixel(y+x0, -x+y0, WHITE);
y++;
if (decisionOver2 <= 0) {
decisionOver2 += 2*y + 1;
}
else {
x--;
decisionOver2 += 2 * (y-x) + 1;
}
}
}
#define PI 3.14159265
void lcdDrawPie(int x0, int y0, int radius, int startAngle, int endAngle)
{
int slope1s, slope1e, slope2s, slope2e;
if (startAngle >= 360 || endAngle <= 0)
return;
float angle1 = float(startAngle) * PI / 180;
float angle2 = float(endAngle) * PI / 180;
if (startAngle == 0) {
slope1e = 100000;
slope2s = -100000;
}
else if (startAngle >= 180) {
slope1e = -100000;
slope2s = cos(angle1)*100/sin(angle1);
}
else {
slope1e = cos(angle1)*100/sin(angle1);
slope2s = -100000;
}
if (endAngle == 360) {
slope1s = -100000;
slope2e = 100000;
}
else if (endAngle >= 180) {
slope1s = -100000;
slope2e = -cos(angle2)*100/sin(angle2);
}
else {
slope1s = cos(angle2)*100/sin(angle2);
slope2e = -100000;
}
for (int y=0; y<=radius; y++) {
for (int x=0; x<=radius; x++) {
if (x*x+y*y <= radius*radius) {
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
if (slope >= slope1s && slope < slope1e) {
lcdDrawPixel(x0+x, y0-y, WHITE);
}
if (-slope >= slope1s && -slope < slope1e) {
lcdDrawPixel(x0+x, y0+y, WHITE);
}
if (slope >= slope2s && slope < slope2e) {
lcdDrawPixel(x0-x, y0-y, WHITE);
}
if (-slope >= slope2s && -slope < slope2e) {
lcdDrawPixel(x0-x, y0+y, WHITE);
}
}
}
}
}
void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle)
{
const uint16_t * q = img;
coord_t width = *q++;
coord_t height = *q++;
int slope1s, slope1e, slope2s, slope2e;
if (startAngle >= 360 || endAngle <= 0)
return;
float angle1 = float(startAngle) * PI / 180;
float angle2 = float(endAngle) * PI / 180;
if (startAngle == 0) {
slope1e = 100000;
slope2s = -100000;
}
else if (startAngle >= 180) {
slope1e = -100000;
slope2s = cos(angle1)*100/sin(angle1);
}
else {
slope1e = cos(angle1)*100/sin(angle1);
slope2s = -100000;
}
if (endAngle == 360) {
slope1s = -100000;
slope2e = 100000;
}
else if (endAngle >= 180) {
slope1s = -100000;
slope2e = -cos(angle2)*100/sin(angle2);
}
else {
slope1s = cos(angle2)*100/sin(angle2);
slope2e = -100000;
}
int w2 = width/2;
int h2 = height/2;
for (int y=h2-1; y>=0; y--) {
for (int x=w2-1; x>=0; x--) {
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
if (slope >= slope1s && slope < slope1e) {
displayBuf[(y0+h2-y)*LCD_W + x0+w2+x] = q[(h2-y)*width + w2+x];
}
if (-slope >= slope1s && -slope < slope1e) {
displayBuf[(y0+h2+y)*LCD_W + x0+w2+x] = q[(h2+y)*width + w2+x];
}
if (slope >= slope2s && slope < slope2e) {
displayBuf[(y0+h2-y)*LCD_W + x0+w2-x] = q[(h2-y)*width + w2-x];
}
if (-slope >= slope2s && -slope < slope2e) {
displayBuf[(y0+h2+y)*LCD_W + x0+w2-x] = q[(h2+y)*width + w2-x];
}
}
}
}
void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * img, LcdFlags flags, int startAngle, int endAngle)
{
coord_t width = *((uint16_t *)img);
coord_t height = *(((uint16_t *)img)+1);
const uint8_t * q = img+4;
int slope1s, slope1e, slope2s, slope2e;
if (startAngle >= 360 || endAngle <= 0)
return;
display_t color = lcdColorTable[COLOR_IDX(flags)];
float angle1 = float(startAngle) * PI / 180;
float angle2 = float(endAngle) * PI / 180;
if (startAngle == 0) {
slope1e = 100000;
slope2s = -100000;
}
else if (startAngle >= 180) {
slope1e = -100000;
slope2s = cos(angle1)*100/sin(angle1);
}
else {
slope1e = cos(angle1)*100/sin(angle1);
slope2s = -100000;
}
if (endAngle == 360) {
slope1s = -100000;
slope2e = 100000;
}
else if (endAngle >= 180) {
slope1s = -100000;
slope2e = -cos(angle2)*100/sin(angle2);
}
else {
slope1s = cos(angle2)*100/sin(angle2);
slope2e = -100000;
}
int w2 = width/2;
int h2 = height/2;
for (int y=h2-1; y>=0; y--) {
for (int x=w2-1; x>=0; x--) {
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
if (slope >= slope1s && slope < slope1e) {
lcdDrawTransparentPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
}
if (-slope >= slope1s && -slope < slope1e) {
lcdDrawTransparentPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
}
if (slope >= slope2s && slope < slope2e) {
lcdDrawTransparentPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
}
if (-slope >= slope2s && -slope < slope2e) {
lcdDrawTransparentPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
}
}
}
}

View file

@ -139,6 +139,7 @@ extern uint16_t lcdColorTable[LCD_COLOR_COUNT];
void lcdColorsInit();
#define OPACITY_MAX 0x0F
#define OPACITY(x) ((x)<<24)
#define COLOR(index) ((index) << 16)
#define TEXT_COLOR COLOR(TEXT_COLOR_INDEX)
@ -170,27 +171,26 @@ void lcdColorsInit();
#define COLOR_JOIN(r, g, b) \
(((r) << 11) + ((g) << 5) + (b))
#define display_t uint16_t
#define DISPLAY_BUF_SIZE (LCD_W*LCD_H)
#define display_t uint16_t
#define DISPLAY_PIXELS_COUNT (LCD_W*LCD_H)
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_PIXELS_COUNT)
#if defined(SIMU)
extern display_t displayBuf[DISPLAY_BUF_SIZE];
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
#else
extern uint32_t CurrentFrameBuffer;
#define displayBuf ((uint16_t *)CurrentFrameBuffer)
extern uint32_t CurrentFrameBuffer;
#define displayBuf ((uint16_t *)CurrentFrameBuffer)
#endif
#define lcdRefreshWait()
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_BUF_SIZE)
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
extern coord_t lcdNextPos;
void lcdStartScreen();
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR);
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR);
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=TEXT_COLOR);
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=TEXT_COLOR);
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, unsigned char len, LcdFlags attr=TEXT_COLOR);
@ -235,54 +235,56 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color);
void lcdDrawTransparentPixel(display_t * p, uint8_t opacity, uint16_t color);
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att=0);
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(coord_t x, scoord_t y, scoord_t h);
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#if !defined(SIMU)
inline void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
{
lcdDrawFilledRectDMA(x, y, w, h, lcdColorTable[COLOR_IDX(att)]);
lcdDrawSolidFilledRectDMA(x, y, w, h, lcdColorTable[COLOR_IDX(att)]);
}
#else
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att);
void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att);
#endif
inline void lcdDrawHorizontalLine(coord_t x, scoord_t y, coord_t w, LcdFlags att)
inline void lcdClear()
{
lcdDrawFilledRect(x, y, w, 1, att);
lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, 0);
}
inline void lcdDrawVerticalLine(coord_t x, scoord_t y, coord_t h, LcdFlags att)
inline void lcdDrawSolidHorizontalLine(coord_t x, scoord_t y, coord_t w, LcdFlags att)
{
lcdDrawFilledRect(x, y, 1, h, att);
lcdDrawSolidFilledRect(x, y, w, 1, att);
}
inline void lcdDrawRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
inline void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, coord_t h, LcdFlags att)
{
lcdDrawVerticalLine(x, y, h, att);
lcdDrawVerticalLine(x+w-1, y, h, att);
lcdDrawHorizontalLine(x, y, w, att);
lcdDrawHorizontalLine(x, y+h-1, w, att);
if (h<0) { y+=h; h=-h; }
lcdDrawSolidFilledRect(x, y, 1, h, att);
}
void lcdDrawFilledRectWithAttributes(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att);
void drawBlackOverlay();
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
inline void lcdDrawSolidRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att)
{
lcdDrawSolidVerticalLine(x, y, h, att);
lcdDrawSolidVerticalLine(x+w-1, y, h, att);
lcdDrawSolidHorizontalLine(x, y, w, att);
lcdDrawSolidHorizontalLine(x, y+h-1, w, att);
}
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att);
void lcdDrawBlackOverlay();
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawCircle(int x0, int y0, int radius);
void lcdDrawPie(int x0, int y0, int radius, int angle1=0, int angle2=360);
void lcdDrawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle);
void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * img, LcdFlags flags=0, int startAngle=0, int endAngle=360);
inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
{
lcdDrawRect(x, y, w, w, att);
lcdDrawSolidRect(x, y, w, w, att);
}
#define V_BAR(xx, yy, ll) \
lcd_vline(xx-1,yy-ll,ll); \
lcd_vline(xx ,yy-ll,ll); \
lcd_vline(xx+1,yy-ll,ll);
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
@ -293,12 +295,6 @@ void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags fl
void lcdSetContrast();
#define lcdOff(...)
void lcdSendByte(uint8_t data);
void lcdSend(const uint8_t * data, uint32_t size);
void lcdSendString(const char * s);
uint32_t lcdReceive(uint8_t * data, uint32_t len);
void lcdClearRxBuffer();
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height);
#if defined(BOOT)
@ -309,7 +305,7 @@ const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int
#ifdef SIMU
extern bool lcd_refresh;
extern display_t lcd_buf[DISPLAY_BUF_SIZE];
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
#endif
char *strAppend(char * dest, const char * source, int len=0);
@ -317,15 +313,4 @@ char *strSetCursor(char *dest, int position);
char *strAppendDate(char * str, bool time=false);
char *strAppendFilename(char * dest, const char * filename, const int size);
#define BITMAP_IDX_SPLASH 0x00
#define BITMAP_IDX_ALERT 0x01
#define BITMAP_IDX_WARNING 0x02
#define BITMAP_IDX_MESSAGE 0x03
#define BITMAP_IDX_USB 0x04
#define BITMAP_IDX_STICKS_FIRST 0x05 // 4 bitmaps
#define BITMAP_IDX_BATTERY_FIRST 0x09 // 5 bitmaps
#define BITMAP_IDX_RSSI_FIRST 0x0E // 6 bitmaps
#define BITMAP_IDX_CHECKBOX_FIRST 0x14 // 4 bitmaps
#define BITMAP_IDX_MODEL_FIRST 0x80
#endif // _LCD_H_

View file

@ -163,7 +163,7 @@ void menuCommonCalib(evt_t event)
}
#endif
g_eeGeneral.chkSum = evalChkSum();
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
reusableBuffer.calib.state = 4;
break;

View file

@ -92,7 +92,7 @@ void onSdManagerMenu(const char *result)
}
else if (result == STR_PASTE) {
f_getcwd(lfn, _MAX_LFN);
POPUP_WARNING(fileCopy(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
REFRESH_FILES();
}
else if (result == STR_RENAME_FILE) {
@ -132,7 +132,7 @@ void onSdManagerMenu(const char *result)
else if (result == STR_ASSIGN_BITMAP) {
strAppendFilename(g_model.header.bitmap, line, sizeof(g_model.header.bitmap));
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
else if (result == STR_VIEW_TEXT) {

View file

@ -122,11 +122,11 @@ void menuGeneralSetup(evt_t event)
if (s_warning_result) {
s_warning_result = 0;
g_eeGeneral.fai = true;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
#endif
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 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) LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 1/*to force edit mode*/ });
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 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) LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, CASE_MAVLINK(0) 0, 0, 0, 0, 1/*to force edit mode*/ });
int sub = m_posVert;
@ -143,7 +143,7 @@ void menuGeneralSetup(evt_t event)
LcdFlags flags = 0;
if (attr && m_posHorz < 0) {
flags |= INVERS;
lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+YEAR_SEPARATOR_OFFSET, y, "-", flags);
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+MONTH_SEPARATOR_OFFSET, y, "-", flags);
@ -182,7 +182,7 @@ void menuGeneralSetup(evt_t event)
LcdFlags flags = 0;
if (attr && m_posHorz < 0) {
flags |= INVERS;
lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+HOUR_SEPARATOR_OFFSET, y, ":", flags);
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+MINUTE_SEPARATOR_OFFSET, y, ":", flags);
@ -215,7 +215,7 @@ void menuGeneralSetup(evt_t event)
LcdFlags color = WHITE;
if (attr && m_posHorz < 0) {
color = BLACK;
lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 90, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 90, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, color|(m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
lcd_puts(RADIO_SETUP_2ND_COLUMN+20, y, "-");
@ -498,6 +498,7 @@ void menuGeneralSetup(evt_t event)
case ITEM_SETUP_STICK_MODE:
{
lcd_putsLeft(y, NO_INDENT(STR_MODE));
char s[2] = " ";
s[0] = '1'+g_eeGeneral.stickMode;
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN, y, s, attr);

View file

@ -115,7 +115,7 @@ void menuGeneralTrainer(evt_t event)
if (attr) {
if (event==EVT_KEY_LONG(KEY_ENTER)){
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
AUDIO_WARNING1();
}
}

View file

@ -173,13 +173,13 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, evt_t event, uint
if (c != v) {
name[cur] = v;
eeDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
storageDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
}
lcd_putsnAtt(x, y, name, size, ZCHAR | mode);
coord_t w = (editNameCursorPos == 0 ? 0 : getTextWidth(name, editNameCursorPos, ZCHAR));
char s[] = { idx2char(v), '\0' };
lcdDrawFilledRect(x+w, y-INVERT_VERT_MARGIN, getTextWidth(s, 1)-1, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x+w-1, y-INVERT_VERT_MARGIN, getTextWidth(s, 1)+1, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcd_putsAtt(x+w, y, s, TEXT_INVERTED_COLOR);
}
else {

View file

@ -71,7 +71,7 @@ void DrawCurve(int offset=0)
do {
point_t point = getPoint(i++);
if (point.x == 0) break;
lcdDrawFilledRect(point.x-offset, point.y-1, 3, 3, TEXT_COLOR); // do markup square
lcdDrawSolidFilledRect(point.x-offset, point.y-1, 3, 3, TEXT_COLOR); // do markup square
} while(1);
}
@ -90,7 +90,7 @@ bool moveCurve(uint8_t index, int8_t shift)
curveEnd[index++] += shift;
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
return true;
}
@ -212,8 +212,8 @@ void menuModelCurveOne(evt_t event)
DrawCurve(6);
}
lcd_putsAtt(115, MENU_FOOTER_TOP, "X", HEADER_COLOR);
lcd_putsAtt(145, MENU_FOOTER_TOP, "Y", HEADER_COLOR);
// lcd_putsAtt(115, MENU_FOOTER_TOP, "X", HEADER_COLOR);
// lcd_putsAtt(145, MENU_FOOTER_TOP, "Y", HEADER_COLOR);
coord_t posY = MENU_CONTENT_TOP;
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
@ -233,15 +233,15 @@ void menuModelCurveOne(evt_t event)
if (i>=pointsOfs && i<pointsOfs+NUM_BODY_LINES) {
int8_t x = -100 + 200*i/(5+crv.points-1);
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) x = points[5+crv.points+i-1];
lcd_outdezAtt(110, posY, i+1, LEFT);
lcd_outdezAtt(130, posY, x, LEFT|(selectionMode==1?attr:0));
lcd_outdezAtt(160, posY, points[i], LEFT|(selectionMode==2?attr:0));
lcd_outdezAtt(120, posY, i+1, LEFT|TEXT_DISABLE_COLOR);
lcd_outdezAtt(150, posY, x, LEFT|(selectionMode==1?attr:0));
lcd_outdezAtt(200, posY, points[i], LEFT|(selectionMode==2?attr:0));
posY += FH;
}
if (selectionMode > 0) {
// do selection square
lcdDrawFilledRect(point.x-7, point.y-2, 5, 5, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(point.x-7, point.y-2, 5, 5, TEXT_INVERTED_BGCOLOR);
if (s_editMode > 0) {
if (selectionMode == 1)
CHECK_INCDEC_MODELVAR(event, points[5+crv.points+i-1], i==1 ? -100 : points[5+crv.points+i-2], i==5+crv.points-2 ? 100 : points[5+crv.points+i]); // edit X
@ -256,7 +256,7 @@ void menuModelCurveOne(evt_t event)
}
if (5+crv.points > NUM_BODY_LINES) {
lcdDrawScrollbar(167, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
lcdDrawScrollbar(250, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
}
}

View file

@ -57,7 +57,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cf->play.name), NULL)) {
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cf->play.name), NULL)) {
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
s_menu_flags = 0;
}
@ -65,7 +65,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
else {
// The user choosed a file in the list
memcpy(cf->play.name, result, sizeof(cf->play.name));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
if (func == FUNC_PLAY_SCRIPT) {
LUA_LOAD_MODEL_SCRIPTS();
}
@ -93,21 +93,21 @@ void onCustomFunctionsMenu(const char *result)
}
else if (result == STR_PASTE) {
*cfn = clipboard.data.cfn;
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_CLEAR) {
memset(cfn, 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_INSERT) {
memmove(cfn+1, cfn, (NUM_CFN-sub-1)*sizeof(CustomFunctionData));
memset(cfn, 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_DELETE) {
memmove(cfn, cfn+1, (NUM_CFN-sub-1)*sizeof(CustomFunctionData));
memset(&g_model.customFn[NUM_CFN-1], 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
}
@ -257,7 +257,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
menuHandler = onCustomFunctionsFileSelectionMenu;
}
else {

View file

@ -41,17 +41,17 @@ void onGVARSMenu(const char *result)
if (result == STR_ENABLE_POPUP) {
g_model.gvars[sub].popup = true;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_DISABLE_POPUP) {
g_model.gvars[sub].popup = false;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
g_model.flightModeData[i].gvars[sub] = 0;
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -99,7 +99,7 @@ void menuModelGVars(evt_t event)
if (attr) {
if (event == EVT_KEY_LONG(KEY_ENTER)) {
v = (v > GVAR_MAX ? 0 : GVAR_MAX+1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (s_editMode>0) {
v = checkIncDec(event, v, vmin, vmax, EE_MODEL);

View file

@ -63,7 +63,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, evt_t event, FlightModesTy
if (s_editMode && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
value ^= (1<<posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -96,20 +96,20 @@ coord_t getYCoord(FnFuncP fn, coord_t x)
void DrawFunction(FnFuncP fn, int offset)
{
lcd_vlineStip(CURVE_CENTER_X-offset, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
lcd_hlineStip(CURVE_CENTER_X-CURVE_SIDE_WIDTH-offset, CURVE_CENTER_Y, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
lcdDrawVerticalLine(CURVE_CENTER_X-offset, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
lcdDrawHorizontalLine(CURVE_CENTER_X-CURVE_SIDE_WIDTH-offset, CURVE_CENTER_Y, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
coord_t prev_yv = (coord_t)-1;
for (int xv=-CURVE_SIDE_WIDTH; xv<=CURVE_SIDE_WIDTH; xv++) {
coord_t yv = getYCoord(fn, xv);
if (prev_yv != (coord_t)-1) {
if (abs((int8_t)yv-prev_yv) <= 1) {
if (abs(yv-prev_yv) <= 1) {
lcdDrawPoint(CURVE_CENTER_X+xv-offset-1, prev_yv, CURVE_COLOR);
}
else {
uint8_t tmp = (prev_yv < yv ? 0 : 1);
lcdDrawVerticalLine(CURVE_CENTER_X+xv-offset-1, yv+tmp, prev_yv-yv, CURVE_COLOR);
lcdDrawSolidVerticalLine(CURVE_CENTER_X+xv-offset-1, yv+tmp, prev_yv-yv, CURVE_COLOR);
}
}
prev_yv = yv;
@ -177,7 +177,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
// TODO avoid this global s_currCh on ARM boards ...
@ -210,7 +210,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
mix->weight = 100;
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void copyExpoMix(uint8_t expo, uint8_t idx)
@ -225,7 +225,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void memswap(void *a, void *b, uint8_t size)
@ -369,8 +369,8 @@ void menuModelExpoOne(evt_t event)
x = divRound(x*CURVE_SIDE_WIDTH, RESX);
y = getYCoord(expoFn, x);
lcd_vlineStip(CURVE_CENTER_X+x, y-3, 7, SOLID, CURVE_CURSOR_COLOR);
lcd_hlineStip(CURVE_CENTER_X+x-3, y, 7, SOLID, CURVE_CURSOR_COLOR);
lcdDrawVerticalLine(CURVE_CENTER_X+x, y-3, 7, SOLID, CURVE_CURSOR_COLOR);
lcdDrawHorizontalLine(CURVE_CENTER_X+x-3, y, 7, SOLID, CURVE_CURSOR_COLOR);
}
for (unsigned int k=0; k<NUM_BODY_LINES; k++) {
@ -488,17 +488,16 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
barMin = -101;
if (barMax > 101)
barMax = 101;
lcd_hlineStip(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcd_hlineStip(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
lcd_vline(x-2, y+1, GAUGE_HEIGHT-1);
lcd_vline(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
lcdDrawHorizontalLine(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcdDrawHorizontalLine(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
// lcdDrawSolidVerticalLine(x-2, y+1, GAUGE_HEIGHT-1);
// lcdDrawSolidVerticalLine(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
if (barMin <= barMax) {
// TODO
// int8_t right = (barMax * GAUGE_WIDTH) / 200;
// int8_t left = ((barMin * GAUGE_WIDTH) / 200)-1;
// lcdDrawFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
int8_t right = (barMax * GAUGE_WIDTH) / 200;
int8_t left = ((barMin * GAUGE_WIDTH) / 200)-1;
// lcdDrawSolidFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
}
lcd_vline(x+GAUGE_WIDTH/2-1, y, GAUGE_HEIGHT+1);
// lcdDrawSolidVerticalLine(x+GAUGE_WIDTH/2-1, y, GAUGE_HEIGHT+1);
#if 0 // TODO
if (barMin == -101) {
for (uint8_t i=0; i<3; ++i) {
@ -526,7 +525,7 @@ void menuModelMixOne(evt_t event)
putsChn(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, md2->destCh+1, HEADER_COLOR);
// The separation line between 2 columns
lcd_vlineStip(MENU_COLUMN2_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, SOLID, HEADER_COLOR);
lcdDrawVerticalLine(MENU_COLUMN2_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, SOLID, HEADER_COLOR);
int8_t sub = m_posVert;
int8_t editMode = s_editMode;
@ -648,7 +647,7 @@ static uint8_t s_copySrcCh;
void lineSurround(bool expo, coord_t y, LcdFlags flags=CURVE_AXIS_COLOR)
{
lcd_rect(expo ? EXPO_LINE_SELECT_POS : MIX_LINE_SELECT_POS, y-INVERT_VERT_MARGIN, expo ? EXPO_LINE_SELECT_WIDTH : MIX_LINE_SELECT_WIDTH, INVERT_LINE_HEIGHT, (s_copyMode == COPY_MODE ? SOLID : DOTTED), flags);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : MIX_LINE_SELECT_POS, y-INVERT_VERT_MARGIN, expo ? EXPO_LINE_SELECT_WIDTH : MIX_LINE_SELECT_WIDTH, INVERT_LINE_HEIGHT, (s_copyMode == COPY_MODE ? SOLID : DOTTED), flags);
}
void onExpoMixMenu(const char *result)
@ -764,7 +763,7 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
s_copyTgtOfs += (s_copyTgtOfs < 0 ? +1 : -1);
} while (s_copyTgtOfs != 0);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
m_posVert = s_copySrcRow;
s_copyTgtOfs = 0;
@ -853,7 +852,7 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
else {
// only swap the mix with its neighbor
if (!swapExpoMix(expo, s_currIdx, IS_ROTARY_UP(event) || key==KEY_MOVE_UP)) break;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
s_copyTgtOfs = next_ofs;

View file

@ -144,7 +144,7 @@ void menuModelLimits(evt_t event)
s_warning_result = 0;
LimitData *ld = limitAddress(sub);
ld->revert = !ld->revert;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
for (int i=0; i<NUM_BODY_LINES; i++) {

View file

@ -87,11 +87,11 @@ void onLogicalSwitchesMenu(const char *result)
}
else if (result == STR_PASTE) {
*cs = clipboard.data.csw;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
memset(cs, 0, sizeof(LogicalSwitchData));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -252,7 +252,7 @@ void menuModelLogicalSwitches(evt_t event)
getvalue_t x = getValue(v1_val);
if (v1_val <= MIXSRC_LAST_CH)
cs->v2 = calcRESXto100(x);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
break;
case LS_FIELD_V3:

View file

@ -56,24 +56,24 @@ void onModelSelectMenu(const char *result)
s_copySrcRow = -1;
}
else if (result == STR_BACKUP_MODEL) {
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
POPUP_WARNING(eeBackupModel(sub));
}
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
if (!listSdFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
POPUP_WARNING(STR_NO_MODELS_ON_SD);
s_menu_flags = 0;
}
}
else if (result == STR_DELETE_MODEL) {
POPUP_CONFIRMATION(STR_DELETEMODEL);
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
// SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
}
else {
// The user choosed a file on SD to restore
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
if (!s_warning && g_eeGeneral.currModel == sub)
eeLoadModel(sub);
// if (!s_warning && g_eeGeneral.currModel == sub)
// eeLoadModel(sub);
}
}
@ -115,12 +115,12 @@ void menuModelSelect(evt_t event)
if (sub >= NUM_BODY_LINES) s_pgOfs = sub-(NUM_BODY_LINES-1);
s_copyMode = 0;
s_editMode = EDIT_MODE_INIT;
eeCheck(true);
storageCheck(true);
break;
case EVT_KEY_LONG(KEY_EXIT):
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
POPUP_CONFIRMATION(STR_DELETEMODEL);
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
// SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
killEvents(_event_);
break;
}
@ -149,7 +149,7 @@ void menuModelSelect(evt_t event)
}
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
if (s_copyMode == COPY_MODE) {
if (!eeCopyModel(cur, s_copySrcRow)) {
@ -170,7 +170,7 @@ void menuModelSelect(evt_t event)
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
s_copyMode = 0;
@ -248,7 +248,7 @@ void menuModelSelect(evt_t event)
LcdFlags flags = 0;
if (sub==k && s_copyMode == 0) {
flags |= TEXT_INVERTED_COLOR;
lcdDrawFilledRect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
char str[20];
@ -259,7 +259,7 @@ void menuModelSelect(evt_t event)
if (k == sub) {
if (s_copyMode == COPY_MODE) {
k = s_copySrcRow;
// lcd_rect(MENUS_MARGIN_LEFT-5, y-3, 170, 16, SOLID, YELLOW);
// lcdDrawRect(MENUS_MARGIN_LEFT-5, y-3, 170, 16, SOLID, YELLOW);
}
else {
k = sub + s_copyTgtOfs;
@ -274,7 +274,7 @@ void menuModelSelect(evt_t event)
k %= MAX_MODELS;
if (eeModelExists(k)) {
strcat_modelname(str, k);
// TODO strcat_modelname(str, k);
lcd_putsAtt(POS_MODEL_NAME, y, str, flags);
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+s_pgOfs!=(vertpos_t)sub)) {
lcd_puts(1, y, "*");
@ -285,7 +285,7 @@ void menuModelSelect(evt_t event)
}
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
lcd_rect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, s_copyMode == COPY_MODE ? SOLID : DOTTED, WARNING_COLOR);
lcdDrawRect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, s_copyMode == COPY_MODE ? SOLID : DOTTED, WARNING_COLOR);
}
}

View file

@ -106,7 +106,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
{
TimerData * timer = &g_model.timers[timerIdx];
if (attr && m_posHorz < 0) {
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 80+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 80+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_TIMER, timerIdx+1);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, (m_posHorz<=0 ? attr : 0));
@ -126,7 +126,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
int8_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) {
timer->mode = switchVal + (TMRMODE_COUNT-1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
#endif
@ -204,7 +204,6 @@ void menuModelSetup(evt_t event)
switch(k) {
case ITEM_MODEL_NAME:
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_MODELNAME, g_model.header.name, sizeof(g_model.header.name), event, attr);
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
break;
case ITEM_MODEL_BITMAP:
@ -291,7 +290,7 @@ void menuModelSetup(evt_t event)
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
}
}
@ -353,11 +352,11 @@ void menuModelSetup(evt_t event)
getMovedSwitch();
g_model.switchWarningState = switches_states;
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (attr && m_posHorz < 0) {
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, NUM_SWITCHES*18+INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, NUM_SWITCHES*18+INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
unsigned int newStates = 0;
@ -365,7 +364,7 @@ void menuModelSetup(evt_t event)
if (SWITCH_WARNING_ALLOWED(i)) {
if (!READ_ONLY() && attr && l_posHorz==current) {
// g_model.switchWarningEnable ^= (1 << i);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
unsigned int state = ((g_model.switchWarningState >> (3*i)) & 0x07);
LcdFlags color = (state > 0 ? TEXT_COLOR : TEXT_DISABLE_COLOR);
@ -414,12 +413,12 @@ void menuModelSetup(evt_t event)
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
SAVE_POT_POSITION(m_posHorz-1);
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
break;
case EVT_KEY_BREAK(KEY_ENTER):
g_model.potsWarnEnabled ^= (1 << (m_posHorz-1));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
break;
}
}
@ -437,7 +436,7 @@ void menuModelSetup(evt_t event)
if (attr && (m_posHorz == 0)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
break;
}
@ -445,11 +444,10 @@ void menuModelSetup(evt_t event)
case ITEM_MODEL_BEEP_CENTER:
lcd_putsLeft(y, STR_BEEPCTR);
if (attr && m_posHorz < 0) {
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, (NUM_STICKS+NUM_POTS)*11+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, (NUM_STICKS+NUM_POTS)*13+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
}
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
// TODO flash saving, \001 not needed in STR_RETA123
coord_t x = MODEL_SETUP_2ND_COLUMN+i*11;
coord_t x = MODEL_SETUP_2ND_COLUMN+i*13;
LcdFlags flags = ((m_posHorz==i && attr) ? INVERS : 0);
flags |= (g_model.beepANACenter & ((BeepANACenter)1<<i)) ? TEXT_COLOR : TEXT_DISABLE_COLOR;
if (attr && m_posHorz < 0) flags |= INVERS;
@ -460,7 +458,7 @@ void menuModelSetup(evt_t event)
if (READ_ONLY_UNLOCKED()) {
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
}
@ -583,16 +581,8 @@ void menuModelSetup(evt_t event)
}
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx)) {
if (xOffsetBind) lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
if (attr && l_posHorz==0) {
if (s_editMode>0) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], IS_MODULE_DSM2(moduleIdx) ? 20 : 63);
if (checkIncDec_Ret) {
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx];
}
}
if (s_editMode==0 && event==EVT_KEY_BREAK(KEY_ENTER)) {
checkModelIdUnique(g_eeGeneral.currModel, moduleIdx);
}
if (attr && l_posHorz==0 && s_editMode>0) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], IS_MODULE_DSM2(moduleIdx) ? 20 : 63);
}
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, l_posHorz==1 ? attr : 0);
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, l_posHorz==2 ? attr : 0);
@ -635,7 +625,7 @@ void menuModelSetup(evt_t event)
}
}
else {
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8, TEXT_COLOR);
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8, TEXT_COLOR);
}
}
}
@ -659,7 +649,7 @@ void menuModelFailsafe(evt_t event)
if (event == EVT_KEY_LONG(KEY_ENTER) && s_editMode) {
s_noHi = NO_HI_LEN;
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
}
@ -669,7 +659,7 @@ void menuModelFailsafe(evt_t event)
#define COL_W (LCD_W/2)
const uint8_t SLIDER_W = 64;
// Column separator
lcd_vline(LCD_W/2, FH, LCD_H-FH);
// TODO lcd_vline(LCD_W/2, FH, LCD_H-FH);
if (m_posVert >= 16) {
ch = 16;
@ -724,15 +714,11 @@ void menuModelFailsafe(evt_t event)
#endif
// Gauge
lcd_rect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
coord_t x0 = (val>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-len;
lcd_hline(x0, y+1, len);
lcd_hline(x0, y+2, len);
lcd_hline(x0, y+3, len);
lcd_hline(x0, y+4, len);
lcdDrawSolidFilledRect(x0, y+1, len, 4, LINE_COLOR);
ch++;
}
}

View file

@ -428,7 +428,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
if (result == STR_UPDATE_LIST) {
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
if (!sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
s_menu_flags = 0;
}
@ -436,7 +436,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
else {
// The user choosed a file in the list
memcpy(g_model.frsky.screens[screenIndex].script.file, result, sizeof(g_model.frsky.screens[screenIndex].script.file));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
LUA_LOAD_MODEL_SCRIPTS();
}
}
@ -610,7 +610,7 @@ void menuModelTelemetry(evt_t event)
if (m_posHorz==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
s_editMode = 0;
if (listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
menuHandler = onTelemetryScriptFileSelectionMenu;
}
else {

View file

@ -61,7 +61,7 @@ void pushMenu(MenuFuncP newMenu)
if (g_menuStackPtr == 0) {
if (newMenu == menuGeneralSetup)
g_menuPos[0] = 1;
if (newMenu == menuModelSelect)
if (newMenu == menuModelSetup)
g_menuPos[0] = 0;
}
else {
@ -80,7 +80,7 @@ void menuModelNotes(evt_t event)
{
if (event == EVT_ENTRY) {
strcpy(s_text_file, MODELS_PATH "/");
char *buf = strcat_modelname(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
char *buf = strcat_currentmodelname(&s_text_file[sizeof(MODELS_PATH)]);
strcpy(buf, TEXT_EXT);
}

View file

@ -105,6 +105,7 @@ void menuGeneralCalib(evt_t event);
void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
void menuModelSelect(evt_t event);
void menuModelSetup(evt_t event);
void menuModelCustomFunctions(evt_t event);
void menuStatisticsView(evt_t event);
void menuStatisticsDebug(evt_t event);
@ -192,26 +193,12 @@ int8_t checkIncDecMovedSwitch(int8_t val);
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
bool isThrottleSourceAvailable(int source);
bool isLogicalSwitchFunctionAvailable(int function);
bool isAssignableFunctionAvailable(int function);
bool isSourceAvailableInResetSpecialFunction(int index);
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
bool isSwitchAvailableInLogicalSwitches(int swtch);
bool isSwitchAvailableInCustomFunctions(int swtch);
bool isSwitchAvailableInMixes(int swtch);
bool isSwitchAvailableInTimers(int swtch);
bool isModuleAvailable(int module);
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
bool isInputAvailable(int input);
bool isSourceAvailable(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isInputSourceAvailable(int source);
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
var = checkIncDec(event, var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)

View file

@ -200,7 +200,7 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
AUDIO_KEYPAD_DOWN();
}
}
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
}
else {

View file

@ -48,28 +48,28 @@ int16_t s_warning_input_max;
void displayAlertBox()
{
drawBlackOverlay();
lcdDrawFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcd_rect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
lcd_rect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
lcdDrawBlackOverlay();
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_ALERT);
}
void displayWarningBox()
{
drawBlackOverlay();
lcdDrawFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcd_rect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
lcd_rect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
lcdDrawBlackOverlay();
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_WARNING);
}
void displayMessageBox()
{
drawBlackOverlay();
lcdDrawFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcd_rect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, WARNING_COLOR);
lcd_rect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, WARNING_COLOR);
lcdDrawBlackOverlay();
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, WARNING_COLOR);
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, WARNING_COLOR);
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_MESSAGE);
}
@ -152,17 +152,16 @@ void (*menuHandler)(const char *result);
const char * displayMenu(evt_t event)
{
const char * result = NULL;
uint8_t display_count = min(s_menu_count, (uint16_t)MENU_MAX_LINES);
int y = (LCD_H - (display_count*(FH+1))) / 2;
// drawBlackOverlay();
lcdDrawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1), TEXT_BGCOLOR);
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 1, ALARM_COLOR);
lcdDrawBlackOverlay();
lcdDrawSolidFilledRect(MENU_X, y, MENU_W, display_count * (FH+1), TEXT_BGCOLOR);
lcdDrawSolidRect(MENU_X, y, MENU_W, display_count * (FH+1) + 1, ALARM_COLOR);
for (uint8_t i=0; i<display_count; i++) {
if (i == s_menu_item) {
lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
lcd_putsAtt(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], TEXT_INVERTED_COLOR|s_menu_flags);
}
else {

View file

@ -43,11 +43,13 @@ const uint16_t LBM_SPLASH[] = {
#if defined(SPLASH)
void displaySplash()
{
lcdClear();
lcdDrawBitmap((LCD_W-256)/2, (LCD_H-256)/2, LBM_SPLASH);
#if MENUS_LOCK == 1
if (readonly == false) {
lcdDrawFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ERASE|ROUND);
lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ERASE|ROUND);
lcd_puts((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED);
}
#endif

View file

@ -73,7 +73,7 @@ void menuChannelsView(evt_t event)
if (isChannelUsed(ch)) {
if (++index > skipCount) {
// The black background
lcdDrawFilledRect(x, y, CHANNEL_WIDTH, CHANNEL_HEIGHT, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(x, y, CHANNEL_WIDTH, CHANNEL_HEIGHT, TEXT_BGCOLOR);
// The label
unsigned int lenLabel = ZLEN(g_model.limitData[ch].name);
@ -85,11 +85,11 @@ void menuChannelsView(evt_t event)
int32_t val = channelOutputs[ch];
// The bar
lcdDrawFilledRect(x+CHANNEL_PADDING_HORZ, y+15, BAR_WIDTH, 6, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x+CHANNEL_PADDING_HORZ, y+15, BAR_WIDTH, 6, TEXT_INVERTED_BGCOLOR);
unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2;
unsigned int len = limit<unsigned int>(1, (abs(val) * BAR_WIDTH/2 + lim/2) / lim, BAR_WIDTH/2);
unsigned int x0 = (val>0) ? x+CHANNEL_PADDING_HORZ-1+BAR_WIDTH/2 : x+CHANNEL_PADDING_HORZ+BAR_WIDTH/2+1-len;
lcdDrawFilledRect(x0, y+16, len, 4, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(x0, y+16, len, 4, TEXT_BGCOLOR);
y += CHANNEL_HEIGHT + CHANNEL_MARGIN;
if (y >= 4*(CHANNEL_HEIGHT + CHANNEL_MARGIN)) {

View file

@ -59,7 +59,7 @@ void drawPotsBars()
if (IS_POT_AVAILABLE(i)) {
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
// TODO 220 constant
lcdDrawFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
lcdDrawSolidFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
}
}
}
@ -79,7 +79,7 @@ void doMainScreenGraphics()
void drawTrimSquare(coord_t x, coord_t y)
{
lcdDrawFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR);
}
@ -87,13 +87,13 @@ void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
{
drawTrimSquare(x, y);
if (dir >= 0) {
lcdDrawVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
lcdDrawSolidVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
}
if (dir <= 0) {
lcdDrawVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
lcdDrawSolidVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
}
// if (exttrim) {
// lcdDrawVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
// lcdDrawSolidVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
// }
}
@ -101,13 +101,13 @@ void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
{
drawTrimSquare(x, y);
if (dir >= 0) {
lcdDrawHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
lcdDrawSolidHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
}
if (dir <= 0) {
lcdDrawHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
lcdDrawSolidHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
}
// if (exttrim) {
// lcdDrawHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
// lcdDrawSolidHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
// }
}
@ -115,20 +115,20 @@ void drawHorizontalStick(coord_t x, int val)
{
for (int i=0; i<=160; i+=4) {
if (i==0 || i==80 || i==160)
lcdDrawVerticalLine(x+i, 250, 13, TEXT_COLOR);
lcdDrawSolidVerticalLine(x+i, 250, 13, TEXT_COLOR);
else
lcdDrawVerticalLine(x+i, 252, 9, TEXT_COLOR);
lcdDrawSolidVerticalLine(x+i, 252, 9, TEXT_COLOR);
}
drawHorizontalTrimPosition(x+TRIM_LEN+val*TRIM_LEN/RESX-4, TRIM_H_Y+16, val);
drawHorizontalTrimPosition(x+TRIM_LEN+val*TRIM_LEN/RESX-5, TRIM_H_Y+16, val);
}
void drawVerticalStick(coord_t x, int val)
{
for (int i=0; i<=160; i+=4) {
if (i==0 || i==80 || i==160)
lcdDrawHorizontalLine(x, 56+i, 13, TEXT_COLOR);
lcdDrawSolidHorizontalLine(x, 56+i, 13, TEXT_COLOR);
else
lcdDrawHorizontalLine(x+2, 56+i, 9, TEXT_COLOR);
lcdDrawSolidHorizontalLine(x+2, 56+i, 9, TEXT_COLOR);
}
drawVerticalTrimPosition(x, TRIM_V_Y+val*TRIM_LEN/RESX-6, val);
}
@ -208,7 +208,7 @@ void displayTimers()
if (timerState.val < 0) {
color = ALARM_COLOR;
}
// TODO lcdDrawFilledRect(TIMERS_MARGIN, y, TIMERS_W, TIMERS_H, SOLID, bgColor);
// TODO lcdDrawSolidFilledRect(TIMERS_MARGIN, y, TIMERS_W, TIMERS_H, SOLID, bgColor);
putsTimer(TIMERS_MARGIN+TIMERS_PADDING, y+12, abs(timerState.val), color|DBLSIZE|LEFT);
if (len > 0)
lcd_putsnAtt(TIMERS_MARGIN+TIMERS_PADDING, y+2, timerData.name, LEN_TIMER_NAME, color|ZCHAR);
@ -241,7 +241,7 @@ void displayMainTelemetryFields()
att |= PREC1;
}
att |= (item.isOld() ? ALARM_COLOR : TEXT_COLOR);
lcdDrawFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcd_putsAtt(ALTITUDE_X+PADDING, VOLTS_Y+2, "Voltage", att);
putsValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, DBLSIZE|LEFT|att);
}
@ -254,7 +254,7 @@ void displayMainTelemetryFields()
TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1];
if (sensor.prec) value /= sensor.prec == 2 ? 100 : 10;
LcdFlags att = (item.isOld() ? ALARM_COLOR : TEXT_COLOR);
lcdDrawFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcd_putsAtt(ALTITUDE_X+PADDING, ALTITUDE_Y+2, "Alt", att);
putsValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, DBLSIZE|LEFT|att);
}
@ -276,10 +276,10 @@ void displayMainViewIndex()
for (int i=VIEW_COUNT; i>=0; --i) {
if (isViewAvailable(i)) {
if (g_eeGeneral.view == i) {
lcdDrawFilledRect(x, MENU_FOOTER_TOP+17, 9, 9, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x, MENU_FOOTER_TOP+17, 9, 9, TEXT_INVERTED_BGCOLOR);
}
else {
lcdDrawRect(x+1, MENU_FOOTER_TOP+18, 7, 7, TEXT_COLOR);
lcdDrawSolidRect(x+1, MENU_FOOTER_TOP+18, 7, 7, TEXT_COLOR);
}
x -= 11;
}
@ -343,11 +343,18 @@ const uint16_t LBM_CORSAIR[] = {
#include "../../bitmaps/Horus/corsair.lbm"
};
const uint8_t LBM_TIMER_BACKGROUND[] = {
#include "../../bitmaps/Horus/mask_timer_bg.lbm"
};
const uint8_t LBM_RSCALE[] = {
#include "../../bitmaps/Horus/mask_rscale.lbm"
};
void menuMainView(evt_t event)
{
// clear the screen
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
switch (event) {
case EVT_ENTRY:
@ -377,13 +384,13 @@ void menuMainView(evt_t event)
break;
case EVT_KEY_BREAK(KEY_DOWN):
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, +1, 0, VIEW_COUNT-1, isViewAvailable);
break;
case EVT_KEY_BREAK(KEY_UP):
killEvents(event);
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, -1, 0, VIEW_COUNT-1, isViewAvailable);
break;
@ -401,14 +408,19 @@ void menuMainView(evt_t event)
// lcdDrawBitmap(0, 0, LBM_MAINVIEW_FLAT);
// Header
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
lcdDrawTopmenuDatetime();
// Flight Mode Name
int mode = mixerCurrentFlightMode;
lcd_putsnAtt(212, 237, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|SMLSIZE);
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
lcdDrawSolidVerticalLine(LCD_W/2-20+5*i, 254, 13, TEXT_COLOR);
}
drawTrimSquare(LCD_W/2-25+5*mixerCurrentFlightMode, 253);
lcdDrawChar(LCD_W/2-23+5*mixerCurrentFlightMode, 254, '0'+mixerCurrentFlightMode, SMLSIZE|TEXT_INVERTED_COLOR);
lcd_putsnAtt(LCD_W/2-getTextWidth(g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|SMLSIZE)/2, 237, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|SMLSIZE);
// Sticks
drawSticks();
@ -417,12 +429,19 @@ void menuMainView(evt_t event)
displayTrims(mode);
// Model panel
lcdDrawFilledRectWithAttributes(248, 58, 188, 158, SOLID, TEXT_BGCOLOR | (5<<24));
lcdDrawFilledRect(248, 58, 188, 158, SOLID, TEXT_BGCOLOR | OPACITY(5));
lcdDrawBitmapPattern(256, 62, LBM_MODEL_ICON, TITLE_BGCOLOR);
lcd_putsAtt(293, 68, "MyPlane Name", SMLSIZE);
lcdDrawHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
lcd_putsnAtt(293, 68, g_model.header.name, ZCHAR|SMLSIZE, LEN_MODEL_NAME);
lcdDrawSolidHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
lcdDrawBitmap(256, 104, LBM_CORSAIR);
// Timer 1
if (g_model.timers[0].start) {
TimerState & timerState = timersStates[0];
lcdDrawBitmapPattern(58, 61, LBM_TIMER_BACKGROUND, TEXT_BGCOLOR);
lcdDrawBitmapPatternPie(60, 64, LBM_RSCALE, TITLE_BGCOLOR, 0, 360*timerState.val/g_model.timers[0].start);
putsTimer(125, 94, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
}
#if 0
displayMainViewIndex();

View file

@ -48,7 +48,7 @@ void menuStatisticsView(evt_t event)
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
sessionTimer = 0;
break;
@ -72,14 +72,14 @@ void menuStatisticsView(evt_t event)
coord_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
const coord_t x = 4;
const coord_t y = 200;
lcd_hlineStip(x-3, y, MAXTRACE+3+3, SOLID, TEXT_COLOR);
lcd_vlineStip(x, y-96, 96+3, SOLID, TEXT_COLOR);
lcdDrawHorizontalLine(x-3, y, MAXTRACE+3+3, SOLID, TEXT_COLOR);
lcdDrawVerticalLine(x, y-96, 96+3, SOLID, TEXT_COLOR);
for (coord_t i=0; i<MAXTRACE; i+=6) {
lcd_vlineStip(x+i+6, y-1, 3, SOLID, TEXT_COLOR);
lcdDrawVerticalLine(x+i+6, y-1, 3, SOLID, TEXT_COLOR);
}
for (coord_t i=1; i<=MAXTRACE; i++) {
lcd_vlineStip(x+i, y-3*s_traceBuf[traceRd], 3*s_traceBuf[traceRd], SOLID, TEXT_COLOR);
lcdDrawVerticalLine(x+i, y-3*s_traceBuf[traceRd], 3*s_traceBuf[traceRd], SOLID, TEXT_COLOR);
traceRd++;
if (traceRd>=MAXTRACE) traceRd = 0;
if (traceRd==s_traceWr) break;
@ -103,7 +103,7 @@ void menuStatisticsDebug(evt_t event)
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.mAhUsed = 0;
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
sessionTimer = 0;
killEvents(event);
AUDIO_KEYPAD_UP();
@ -181,7 +181,7 @@ void menuTraceBuffer(evt_t event)
uint8_t k = 0;
int8_t sub = m_posVert;
lcd_putc(0, FH, '#');
lcdDrawChar(0, FH, '#', TEXT_COLOR);
lcd_puts(4*10, FH, "Time");
lcd_puts(14*10, FH, "Event");
lcd_puts(20*10, FH, "Data");

View file

@ -81,7 +81,7 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
int y = GAUGE_MARGIN + i*(GAUGE_HEIGHT+GAUGE_MARGIN);
// The black background
lcdDrawFilledRect(GAUGE_MARGIN, y, GAUGE_WIDTH, GAUGE_HEIGHT, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(GAUGE_MARGIN, y, GAUGE_WIDTH, GAUGE_HEIGHT, TEXT_BGCOLOR);
getvalue_t value = getValue(source);
LcdFlags color = TEXT_COLOR;
@ -98,7 +98,7 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
if (value < 0) {
putsMixerSource(GAUGE_MARGIN+GAUGE_PADDING_HORZ, y+GAUGE_PADDING_VERT, source, ALARM_COLOR);
putsTimer(GAUGE_MARGIN+GAUGE_WIDTH-VAL_WIDTH, y+GAUGE_PADDING_VERT+3, -value, LEFT|DBLSIZE|ALARM_COLOR);
// TODO lcdDrawFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ, y+15, BAR_WIDTH, 6, ALARM_BGCOLOR);
// TODO lcdDrawSolidFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ, y+15, BAR_WIDTH, 6, ALARM_BGCOLOR);
continue;
}
}
@ -110,19 +110,19 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
putsChannel(GAUGE_MARGIN+GAUGE_WIDTH-VAL_WIDTH, y+GAUGE_PADDING_VERT+3, source, LEFT|DBLSIZE|NO_UNIT|color);
// The bar
// TODO lcdDrawFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ, y+15, BAR_WIDTH, 6, SOLID, color);
// TODO lcdDrawSolidFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ, y+15, BAR_WIDTH, 6, SOLID, color);
//uint8_t thresholdX = 0;
int width = barCoord(value, barMin, barMax, BAR_WIDTH-2);
//uint8_t barShade = SOLID;
lcdDrawFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ+1, y+16, width, 4, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(GAUGE_MARGIN+GAUGE_PADDING_HORZ+1, y+16, width, 4, TEXT_BGCOLOR);
/* for (uint8_t j=24; j<99; j+=25) {
if (j>thresholdX || j>width) {
lcd_vline(j*BAR_WIDTH/100+BAR_LEFT+1, y+1, barHeight);
}
}
if (thresholdX) {
lcd_vlineStip(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcd_hline(BAR_LEFT+thresholdX, y-2, 3);
lcdDrawVerticalLine(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcdDrawSolidHorizontalLine(BAR_LEFT+thresholdX, y-2, 3);
}
*/
}
@ -144,7 +144,7 @@ void displayNumbersTelemetryScreen(FrSkyScreenData & screen)
coord_t pos[] = { NUMBERS_MARGIN, (LCD_W-NUMBERS_W)/2, LCD_W-NUMBERS_MARGIN-NUMBERS_W };
int x = pos[j];
int y = NUMBERS_MARGIN + i*(NUMBERS_H+NUMBERS_MARGIN);
lcdDrawFilledRect(x, y, NUMBERS_W, NUMBERS_H, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(x, y, NUMBERS_W, NUMBERS_H, TEXT_BGCOLOR);
if (field >= MIXSRC_FIRST_TELEM) {
TelemetryItem & telemetryItem = telemetryItems[(field-MIXSRC_FIRST_TELEM)/3]; // TODO macro to convert a source to a telemetry index
if (!telemetryItem.isAvailable()) {

View file

@ -58,7 +58,7 @@ const char * STR_MONTHS[] = { "Jan", "Fev", "Mar", "Apr", "May", "Jun", "Jul", "
void lcdDrawTopmenuDatetime()
{
lcdDrawVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR);
lcdDrawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, TEXT_INVERTED_COLOR);
struct gtm t;
gettime(&t);
@ -76,8 +76,8 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval)
#define MARKER_WIDTH 5
lcdDrawSquare(centrex-BOX_WIDTH/2, BOX_CENTERY-BOX_WIDTH/2, BOX_WIDTH, TEXT_COLOR);
lcd_vlineStip(centrex, BOX_CENTERY-1, 3, SOLID, TEXT_COLOR);
lcd_hlineStip(centrex-1, BOX_CENTERY, 3, SOLID, TEXT_COLOR);
lcdDrawVerticalLine(centrex, BOX_CENTERY-1, 3, SOLID, TEXT_COLOR);
lcdDrawHorizontalLine(centrex-1, BOX_CENTERY, 3, SOLID, TEXT_COLOR);
lcdDrawSquare(centrex + (xval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, BOX_CENTERY - (yval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, MARKER_WIDTH, ROUND|TEXT_COLOR);
#undef BOX_CENTERY
@ -87,37 +87,37 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval)
void lcdDrawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
{
if (attr) {
lcdDrawFilledRect(x-1, y+2, 13, 13, TEXT_INVERTED_BGCOLOR);
lcdDrawFilledRect(x+1, y+4, 9, 9, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(x-1, y+2, 13, 13, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x+1, y+4, 9, 9, TEXT_BGCOLOR);
if (value) {
lcdDrawFilledRect(x+2, y+5, 7, 7, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x+2, y+5, 7, 7, TEXT_INVERTED_BGCOLOR);
}
}
else {
if (value) {
lcdDrawFilledRect(x+2, y+5, 7, 7, SCROLLBOX_COLOR);
lcdDrawRect(x, y+3, 11, 11, LINE_COLOR);
lcdDrawSolidFilledRect(x+2, y+5, 7, 7, SCROLLBOX_COLOR);
lcdDrawSolidRect(x, y+3, 11, 11, LINE_COLOR);
}
else {
lcdDrawRect(x, y+3, 11, 11, LINE_COLOR);
lcdDrawSolidRect(x, y+3, 11, 11, LINE_COLOR);
}
}
}
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
{
lcdDrawVerticalLine(x, y, h, LINE_COLOR);
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
coord_t yofs = (h*offset + count/2) / count;
coord_t yhgt = (h*visible + count/2) / count;
if (yhgt + yofs > h)
yhgt = h - yofs;
lcdDrawFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
lcdDrawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
}
void displayProgressBar(const char *label)
{
lcd_putsLeft(4*FH, label);
lcd_rect(3, 6*FH+4, 204, 7);
lcdDrawRect(3, 6*FH+4, 204, 7);
lcdRefresh();
}
@ -125,9 +125,7 @@ void updateProgressBar(int num, int den)
{
if (num > 0 && den > 0) {
int width = (200*num)/den;
lcd_hline(5, 6*FH+6, width);
lcd_hline(5, 6*FH+7, width);
lcd_hline(5, 6*FH+8, width);
lcdDrawSolidFilledRect(5, 6*FH+6, width, 3, LINE_COLOR);
lcdRefresh();
}
}
@ -137,11 +135,11 @@ void updateProgressBar(int num, int den)
void drawMenuTemplate(const char * name, evt_t event)
{
// clear the screen
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP-MENU_HEADER_HEIGHT, TEXT_BGCOLOR);
lcdDrawFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR);
lcdDrawFilledRect(0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT, TEXT_BGCOLOR);
lcdDrawFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP-MENU_HEADER_HEIGHT, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR);
lcdDrawSolidFilledRect(0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT, TEXT_BGCOLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
@ -149,7 +147,7 @@ void drawMenuTemplate(const char * name, evt_t event)
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
}
else {
lcdDrawFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
lcdDrawSolidFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR);
}
@ -199,12 +197,12 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e
void displaySlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
{
const int width = 50;
lcd_hlineStip(x, y+5, width, SOLID, TEXT_COLOR);
lcdDrawHorizontalLine(x, y+5, width, SOLID, TEXT_COLOR);
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) {
lcdDrawFilledRect(x+value*(width-5)/max, y, 5, 11, TEXT_INVERTED_BGCOLOR);
lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, TEXT_INVERTED_BGCOLOR);
}
else {
lcdDrawFilledRect(x+value*(width-5)/max, y, 5, 11, LINE_COLOR);
lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, LINE_COLOR);
}
}
@ -227,7 +225,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {

View file

@ -41,391 +41,3 @@ uint8_t switchToMix(uint8_t source)
div_t qr = div(source-1, 3);
return qr.quot+MIXSRC_FIRST_SWITCH;
}
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
{
do {
current += inc;
if (current < min)
current = max;
else if (current > max)
current = min;
if (!isValueAvailable || isValueAvailable(current))
return current;
} while(1);
return 0;
}
bool isInputAvailable(int input)
{
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
}
bool isChannelUsed(int channel)
{
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return false;
if (md->destCh == channel) return true;
if (md->destCh > channel) return false;
}
return false;
}
int getChannelsUsed()
{
int result = 0;
int lastCh = -1;
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return result;
if (md->destCh != lastCh) { ++result; lastCh = md->destCh; }
}
return result;
}
bool isSourceAvailable(int source)
{
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
return isInputAvailable(source - MIXSRC_FIRST_INPUT);
}
#if defined(LUA_MODEL_SCRIPTS)
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA) {
div_t qr = div(source-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
return (qr.rem<scriptInputsOutputs[qr.quot].outputsCount);
}
#else
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA)
return false;
#endif
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH) {
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
}
#if !defined(HELI)
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
return false;
#endif
if (source>=MIXSRC_CH1 && source<=MIXSRC_LAST_CH) {
return isChannelUsed(source-MIXSRC_CH1);
}
if (source>=MIXSRC_FIRST_LOGICAL_SWITCH && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
LogicalSwitchData * cs = lswAddress(source-MIXSRC_FIRST_LOGICAL_SWITCH);
return (cs->func != LS_FUNC_NONE);
}
#if !defined(GVARS)
if (source>=MIXSRC_GVAR1 && source<=MIXSRC_LAST_GVAR)
return false;
#endif
if (source>=MIXSRC_RESERVE1 && source<=MIXSRC_RESERVE5)
return false;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
if (qr.rem == 0)
return isTelemetryFieldAvailable(qr.quot);
else
return isTelemetryFieldComparisonAvailable(qr.quot);
}
return true;
}
bool isSourceAvailableInGlobalFunctions(int source)
{
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
return false;
}
return isSourceAvailable(source);
}
bool isSourceAvailableInCustomSwitches(int source)
{
bool result = isSourceAvailable(source);
#if defined(FRSKY)
if (result && source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
result = isTelemetryFieldComparisonAvailable(qr.quot);
}
#endif
return result;
}
bool isInputSourceAvailable(int source)
{
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
return true;
if (source>=MIXSRC_FIRST_TRIM && source<=MIXSRC_LAST_TRIM)
return true;
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH)
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
return true;
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
return true;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
return isTelemetryFieldAvailable(qr.quot) && isTelemetryFieldComparisonAvailable(qr.quot);
}
return false;
}
enum SwitchContext
{
LogicalSwitchesContext,
ModelCustomFunctionsContext,
GeneralCustomFunctionsContext,
TimersContext,
MixesContext
};
bool isLogicalSwitchAvailable(int index)
{
LogicalSwitchData * lsw = lswAddress(index);
return (lsw->func != LS_FUNC_NONE);
}
bool isSwitchAvailable(int swtch, SwitchContext context)
{
bool negative = false;
if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
}
if (swtch >= SWSRC_SA0 && swtch <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(swtch);
if (!SWITCH_EXISTS(swinfo.quot)) {
return false;
}
if (!IS_3POS(swinfo.quot)) {
if (negative) {
return false;
}
if (IS_3POS_MIDDLE(swinfo.rem)) {
return false;
}
}
return true;
}
#if NUM_XPOTS > 0
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) {
int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT;
if (IS_POT_MULTIPOS(POT1+index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT));
}
else {
return false;
}
}
#endif
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
if (context == GeneralCustomFunctionsContext) {
return false;
}
else if (context != LogicalSwitchesContext) {
return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH);
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
if (context == MixesContext || context == GeneralCustomFunctionsContext) {
return false;
}
else {
swtch -= SWSRC_FIRST_FLIGHT_MODE;
if (swtch == 0) {
return true;
}
FlightModeData * fm = flightModeAddress(swtch);
return (fm->swtch != SWSRC_NONE);
}
}
if (swtch >= SWSRC_FIRST_SENSOR && swtch <= SWSRC_LAST_SENSOR) {
return isTelemetryFieldAvailable(swtch - SWSRC_FIRST_SENSOR);
}
return true;
}
bool isSwitchAvailableInLogicalSwitches(int swtch)
{
return isSwitchAvailable(swtch, LogicalSwitchesContext);
}
bool isSwitchAvailableInCustomFunctions(int swtch)
{
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
else
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
}
bool isSwitchAvailableInMixes(int swtch)
{
return isSwitchAvailable(swtch, MixesContext);
}
bool isSwitchAvailableInTimers(int swtch)
{
if (swtch >= 0) {
if (swtch < TMRMODE_COUNT)
return true;
else
swtch -= TMRMODE_COUNT-1;
}
else {
if (swtch > -TMRMODE_COUNT)
return false;
else
swtch += TMRMODE_COUNT-1;
}
return isSwitchAvailable(swtch, TimersContext);
}
bool isThrottleSourceAvailable(int source)
{
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;
}
bool isLogicalSwitchFunctionAvailable(int function)
{
return function != LS_FUNC_RANGE;
}
bool isAssignableFunctionAvailable(int function)
{
#if defined(OVERRIDE_CHANNEL_FUNCTION) || defined(GVARS)
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
#endif
switch (function) {
case FUNC_OVERRIDE_CHANNEL:
#if defined(OVERRIDE_CHANNEL_FUNCTION)
return modelFunctions;
#else
return false;
#endif
case FUNC_ADJUST_GVAR:
#if defined(GVARS)
return modelFunctions;
#else
return false;
#endif
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
#endif
#if !defined(LUA)
case FUNC_PLAY_SCRIPT:
#endif
case FUNC_RESERVE5:
return false;
default:
return true;
}
}
bool isSourceAvailableInGlobalResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM)
return false;
else
return isSourceAvailableInResetSpecialFunction(index);
}
bool isSourceAvailableInResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM) {
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM];
return telemetrySensor.isAvailable();
}
#if TIMERS < 3
else if (index == FUNC_RESET_TIMER3) {
return false;
}
#endif
#if TIMERS < 2
else if (index == FUNC_RESET_TIMER2) {
return false;
}
#endif
else {
return true;
}
}
bool isModuleAvailable(int module)
{
return true;
}
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
strcpy(buf, TEXT_EXT);
return isFileAvailable(filename);
}
int getFirstAvailable(int min, int max, bool (*func)(int))
{
int retval = 0;
for (int i = min; i <= max; i++) {
if ((*func)(i)) {
retval = i;
break;
}
}
return retval;
}

View file

@ -38,11 +38,11 @@
#include "../../timers.h"
#if defined(REVPLUS) && defined(LCD_DUAL_BUFFER)
display_t displayBuf1[DISPLAY_BUF_SIZE] __DMA;
display_t displayBuf2[DISPLAY_BUF_SIZE] __DMA;
display_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA;
display_t displayBuf2[DISPLAY_BUFFER_SIZE] __DMA;
display_t * displayBuf = displayBuf1;
#else
display_t displayBuf[DISPLAY_BUF_SIZE] __DMA;
display_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
#endif
inline bool lcdIsPointOutside(coord_t x, coord_t y)
@ -143,7 +143,7 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
}
}
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
{
const pm_uchar * q;
@ -215,7 +215,7 @@ void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcd_putc(coord_t x, coord_t y, const unsigned char c)
{
lcd_putcAtt(x, y, c, 0);
lcdDrawChar(x, y, c, 0);
}
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags flags)
@ -248,7 +248,7 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
break;
}
else if (c >= 0x20) {
lcd_putcAtt(x, y, c, flags);
lcdDrawChar(x, y, c, flags);
x = lcdNextPos;
}
else if (c == 0x1F) { //X-coord prefix
@ -315,7 +315,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
x -= FWNUM;
char c = val & 0xf;
c = c>9 ? c+'A'-10 : c+'0';
lcd_putcAtt(x, y, c, flags|(c>='A' ? CONDENSED : 0));
lcdDrawChar(x, y, c, flags|(c>='A' ? CONDENSED : 0));
val >>= 4;
}
}
@ -403,7 +403,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
div_t qr = div((lcduint_t)val, 10);
char c = qr.rem + '0';
LcdFlags f = flags;
lcd_putcAtt(x, y, c, f);
lcdDrawChar(x, y, c, f);
if (mode == i) {
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
if (dblsize) {
@ -422,7 +422,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (xxlsize) {
x -= 17;
lcd_putcAtt(x+2, y, '.', f);
lcdDrawChar(x+2, y, '.', f);
}
else if (midsize) {
x -= 3;
@ -445,7 +445,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else {
x -= 2;
lcd_putcAtt(x, y, '.', f);
lcdDrawChar(x, y, '.', f);
}
}
val = qr.quot;
@ -469,17 +469,17 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
drawFilledRect(xn, y+2*FH-3, ln, 2);
}
}
if (neg) lcd_putcAtt(x, y, '-', flags);
if (neg) lcdDrawChar(x, y, '-', flags);
}
#endif
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
{
lcd_hlineStip(x, y, w, 0xff, att);
lcdDrawHorizontalLine(x, y, w, 0xff, att);
}
#if !defined(BOOT)
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
void lcdDrawLine(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;
@ -526,17 +526,17 @@ void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFl
void lcd_vline(coord_t x, scoord_t y, scoord_t h)
{
lcd_vlineStip(x, y, h, SOLID);
lcdDrawVerticalLine(x, y, h, SOLID);
}
#endif
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
{
lcd_vlineStip(x, y, h, pat, att);
lcd_vlineStip(x+w-1, y, h, pat, att);
lcdDrawVerticalLine(x, y, h, pat, att);
lcdDrawVerticalLine(x+w-1, y, h, pat, att);
if (~att & ROUND) { x+=1; w-=2; }
lcd_hlineStip(x, y+h-1, w, pat, att);
lcd_hlineStip(x, y, w, pat, att);
lcdDrawHorizontalLine(x, y+h-1, w, pat, att);
lcdDrawHorizontalLine(x, y, w, pat, att);
}
#if !defined(BOOT)
@ -544,9 +544,9 @@ void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, Lc
{
for (scoord_t i=y; i<y+h; i++) {
if ((att&ROUND) && (i==y || i==y+h-1))
lcd_hlineStip(x+1, i, w-2, pat, att);
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
else
lcd_hlineStip(x, i, w, pat, att);
lcdDrawHorizontalLine(x, i, w, pat, att);
pat = (pat >> 1) + ((pat & 1) << 7);
}
}
@ -588,7 +588,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
}
if (tme < 0) {
lcd_putcAtt(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
tme = -tme;
}
@ -598,7 +598,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
if (att & TIMEHOUR) {
div_t qr2 = div(qr.quot, 60);
lcd_outdezNAtt(x, y, qr2.quot, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, separator, att&att2);
lcdDrawChar(lcdLastPos, y, separator, att&att2);
qr.quot = qr2.rem;
if (att & MIDSIZE)
x += 17;
@ -607,9 +607,9 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
}
lcd_outdezNAtt(x, y, qr.quot, att|LEADING0|LEFT, 2);
if (att&TIMEBLINK)
lcd_putcAtt(lcdLastPos, y, separator, BLINK);
lcdDrawChar(lcdLastPos, y, separator, BLINK);
else
lcd_putcAtt(lcdLastPos, y, separator, att&att2);
lcdDrawChar(lcdLastPos, y, separator, att&att2);
lcd_outdezNAtt(lcdNextPos, y, qr.rem, att2|LEADING0|LEFT, 2);
}
@ -617,7 +617,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
{
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'V', att);
if (~att & NO_UNIT) lcdDrawChar(lcdLastPos, y, 'V', att);
}
void putsVBat(coord_t x, coord_t y, LcdFlags att)
@ -643,7 +643,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
lcd_putsiAtt(x, y, STR_VSRCRAW, 0, att); // TODO macro
}
else if (idx <= MIXSRC_LAST_INPUT) {
lcd_putcAtt(x+2, y+1, CHR_INPUT, TINSIZE);
lcdDrawChar(x+2, y+1, CHR_INPUT, TINSIZE);
drawFilledRect(x, y, 7, 7);
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT]))
lcd_putsnAtt(x+8, y, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME, ZCHAR|att);
@ -655,7 +655,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
#if defined(LUA_MODEL_SCRIPTS)
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
lcd_putcAtt(x+2, y+1, '1'+qr.quot, TINSIZE);
lcdDrawChar(x+2, y+1, '1'+qr.quot, TINSIZE);
drawFilledRect(x, y, 7, 7);
lcd_putsnAtt(x+8, y, scriptInputsOutputs[qr.quot].outputs[qr.rem].name, att & STREXPANDED ? 9 : 4, att);
}
@ -663,7 +663,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
#endif
{
putsStrIdx(x, y, "LUA", qr.quot+1, att);
lcd_putcAtt(lcdLastPos, y, 'a'+qr.rem, att);
lcdDrawChar(lcdLastPos, y, 'a'+qr.rem, att);
}
}
@ -671,11 +671,11 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
idx = idx-MIXSRC_Rud;
if (ZEXIST(g_eeGeneral.anaNames[idx])) {
if (idx < MIXSRC_FIRST_POT-MIXSRC_Rud )
lcd_putcAtt(x, y, '\307', att); //stick symbol
lcdDrawChar(x, y, '\307', att); //stick symbol
else if (idx < MIXSRC_FIRST_SLIDER-MIXSRC_Rud )
lcd_putcAtt(x, y, '\310', att); //pot symbol
lcdDrawChar(x, y, '\310', att); //pot symbol
else
lcd_putcAtt(x, y, '\311', att); //slider symbol
lcdDrawChar(x, y, '\311', att); //slider symbol
lcd_putsnAtt(lcdNextPos, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, ZCHAR|att);
}
else
@ -684,7 +684,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
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
lcdDrawChar(x, y, '\312', att); //switch symbol
lcd_putsnAtt(lcdNextPos, y, g_eeGeneral.switchNames[idx], LEN_SWITCH_NAME, ZCHAR|att);
}
else
@ -699,7 +699,7 @@ 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|SMLSIZE);
lcdDrawChar(lcdLastPos, y, ' ', att|SMLSIZE);
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
}
}
@ -713,7 +713,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
lcd_putsnAtt(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, ZCHAR|att);
if (qr.rem) lcd_putcAtt(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
if (qr.rem) lcdDrawChar(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
}
}
@ -744,7 +744,7 @@ void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
}
if (idx < 0) {
lcd_putcAtt(x-2, y, '!', att);
lcdDrawChar(x-2, y, '!', att);
idx = -idx;
}
@ -754,11 +754,11 @@ void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);
}
else {
lcd_putcAtt(x, y, 'S', att);
lcd_putcAtt(lcdNextPos, y, 'A'+swinfo.quot, att);
lcdDrawChar(x, y, 'S', att);
lcdDrawChar(lcdNextPos, y, 'A'+swinfo.quot, att);
}
char c = "\300-\301"[swinfo.rem];
lcd_putcAtt(lcdNextPos, y, c, att);
lcdDrawChar(lcdNextPos, y, c, att);
}
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
@ -788,7 +788,7 @@ void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
if (idx < 0) { lcd_putcAtt(x-2, y, '!', att); idx = -idx; }
if (idx < 0) { lcdDrawChar(x-2, y, '!', att); idx = -idx; }
if (att & CONDENSED)
lcd_outdezNAtt(x+FW*1, y, idx-1, (att & ~CONDENSED), 1);
else
@ -801,12 +801,12 @@ void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att)
if (curve.value != 0) {
switch (curve.type) {
case CURVE_REF_DIFF:
lcd_putcAtt(x, y, 'D', att);
lcdDrawChar(x, y, 'D', att);
GVAR_MENU_ITEM(x+FW, y, curve.value, -100, 100, LEFT|att, 0, 0);
break;
case CURVE_REF_EXPO:
lcd_putcAtt(x, y, 'E', att);
lcdDrawChar(x, y, 'E', att);
GVAR_MENU_ITEM(x+FW, y, curve.value, -100, 100, LEFT|att, 0, 0);
break;
@ -828,7 +828,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
}
if (idx < 0) {
lcd_putcAtt(x-3, y, '!', att);
lcdDrawChar(x-3, y, '!', att);
idx = -idx;
}
@ -857,10 +857,10 @@ void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
}
else {
if (mode % 2 == 0)
lcd_putcAtt(x, y, ':', att|FIXEDWIDTH);
lcdDrawChar(x, y, ':', att|FIXEDWIDTH);
else
lcd_putcAtt(x, y, '+', att|FIXEDWIDTH);
lcd_putcAtt(lcdNextPos, y, '0'+p, att);
lcdDrawChar(x, y, '+', att|FIXEDWIDTH);
lcdDrawChar(lcdNextPos, y, '0'+p, att);
}
}
@ -888,7 +888,7 @@ void displayGpsCoord(coord_t x, coord_t y, char direction, int16_t bp, int16_t a
{
if (!direction) direction = '-';
lcd_outdezAtt(x, y, bp / 100, att); // ddd before '.'
lcd_putcAtt(lcdLastPos, y, '@', att);
lcdDrawChar(lcdLastPos, y, '@', att);
uint8_t mn = bp % 100; // TODO div_t
if (g_eeGeneral.gpsFormat == 0) {
lcd_outdezNAtt(lcdNextPos, y, mn, att|LEFT|LEADING0, 2); // mm before '.'
@ -917,27 +917,27 @@ void displayDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags a
x -= 42;
att &= ~0x0F00; // TODO constant
lcd_outdezNAtt(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezNAtt(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezAtt(lcdNextPos-1, y, telemetryItem.datetime.year, att|LEFT);
y += FH;
lcd_outdezNAtt(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
}
else {
lcd_outdezNAtt(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.month, att|LEFT, 2);
lcd_putcAtt(lcdLastPos-1, y, '-', att);
lcdDrawChar(lcdLastPos-1, y, '-', att);
lcd_outdezAtt(lcdNextPos, y, telemetryItem.datetime.year, att|LEFT);
lcd_outdezNAtt(lcdNextPos+FW+1, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, ':', att);
lcdDrawChar(lcdLastPos, y, ':', att);
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
}
}
@ -1048,7 +1048,7 @@ void lcd_plot(coord_t x, coord_t y, LcdFlags att)
lcd_mask(p, mask, att);
}
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (y < 0 || y >= LCD_H) return;
if (x+w > LCD_W) {
@ -1070,7 +1070,7 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
}
}
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
{
if (x >= LCD_W) return;
if (y >= LCD_H) return;

View file

@ -119,14 +119,14 @@
#define LcdFlags uint32_t
#define display_t uint8_t
#define DISPLAY_BUF_SIZE (LCD_W*LCD_H*4/8)
#define DISPLAY_BUFFER_SIZE (LCD_W*LCD_H*4/8)
#if defined(REVPLUS) && defined(LCD_DUAL_BUFFER)
extern display_t displayBuf1[DISPLAY_BUF_SIZE];
extern display_t displayBuf2[DISPLAY_BUF_SIZE];
extern display_t displayBuf1[DISPLAY_BUFFER_SIZE];
extern display_t displayBuf2[DISPLAY_BUFFER_SIZE];
extern display_t * displayBuf;
#else
extern display_t displayBuf[DISPLAY_BUF_SIZE];
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
#endif
#if defined(REVPLUS) && !defined(LCD_DUAL_BUFFER) && !defined(SIMU)
@ -138,8 +138,7 @@
extern coord_t lcdLastPos;
extern coord_t lcdNextPos;
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_BUF_SIZE)
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
#if defined(BOOT)
@ -149,7 +148,7 @@ typedef const char pm_char;
#endif
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags mode);
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
@ -201,17 +200,17 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
void lcd_plot(coord_t x, coord_t y, LcdFlags att=0);
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att=0);
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcd_vline(coord_t x, scoord_t y, scoord_t h);
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
void lcd_invert_line(int8_t line);
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcdDrawRect(x, y, w, w, SOLID, att); }
void displaySleepBitmap();
@ -248,7 +247,7 @@ const char *writeScreenshot();
#if defined(SIMU)
extern bool lcd_refresh;
extern display_t lcd_buf[DISPLAY_BUF_SIZE];
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
#endif
char *strAppend(char * dest, const char * source, int len=0);

View file

@ -175,7 +175,7 @@ void menuCommonCalib(uint8_t event)
}
}
g_eeGeneral.chkSum = evalChkSum();
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
reusableBuffer.calib.state = 4;
break;

View file

@ -39,7 +39,7 @@
void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
{
uint8_t t = switchState(key);
lcd_putcAtt(x, y, t+'0', t ? INVERS : 0);
lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
}
void menuGeneralDiagKeys(uint8_t event)

View file

@ -181,7 +181,7 @@ void onSdManagerMenu(const char *result)
strcat(lfn, line);
}
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
POPUP_WARNING(fileCopy(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
REFRESH_FILES();
}
}
@ -217,7 +217,7 @@ void onSdManagerMenu(const char *result)
else if (result == STR_ASSIGN_BITMAP) {
strAppendFilename(g_model.header.bitmap, line, sizeof(g_model.header.bitmap));
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_VIEW_TEXT) {
getSelectionFullPath(lfn);
@ -448,7 +448,7 @@ void menuGeneralSdManager(uint8_t _event)
lcdNextPos = 0;
LcdFlags attr = (index == i ? BSS|INVERS : BSS);
if (reusableBuffer.sdmanager.lines[i][0]) {
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) { lcd_putcAtt(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) { lcdDrawChar(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
if (s_editMode == EDIT_MODIFY_STRING && attr) {
editName(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], SD_SCREEN_FILE_LENGTH-4, _event, attr, 0);
if (s_editMode == 0) {
@ -467,7 +467,7 @@ void menuGeneralSdManager(uint8_t _event)
else {
lcd_putsAtt(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
}
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) { lcd_putcAtt(lcdNextPos, y, ']', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) { lcdDrawChar(lcdNextPos, y, ']', s_editMode == EDIT_MODIFY_STRING ? 0 : attr); }
}
}

View file

@ -124,7 +124,7 @@ void menuGeneralSetup(uint8_t event)
if (s_warning_result) {
s_warning_result = 0;
g_eeGeneral.fai = true;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
#endif
@ -251,7 +251,7 @@ void menuGeneralSetup(uint8_t event)
case ITEM_SETUP_SPEAKER_PITCH:
lcd_putsLeft( y, STR_SPKRPITCH);
lcd_putcAtt(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
lcd_putsAtt(lcdLastPos, y, "Hz", attr);
if (attr) {
@ -486,13 +486,13 @@ void menuGeneralSetup(uint8_t event)
if (attr) {
s_editMode = 0;
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickReverse, 0, 15);
lcd_rect(6*FW-1, y-1, 15*FW+2, 9);
lcdDrawRect(6*FW-1, y-1, 15*FW+2, 9);
}
#endif
break;
case ITEM_SETUP_STICK_MODE:
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
lcdDrawChar(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
for (uint8_t i=0; i<4; i++) {
putsStickName((6+4*i)*FW, y, pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
}

View file

@ -108,7 +108,7 @@ void menuGeneralTrainer(uint8_t event)
if (attr) {
if (event==EVT_KEY_LONG(KEY_ENTER)){
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
AUDIO_WARNING1();
}
}

View file

@ -47,19 +47,14 @@ void backupEeprom()
// reset unexpectedShutdown to prevent warning when user restores EEPROM backup
g_eeGeneral.unexpectedShutdown = 0;
eeDirty(EE_GENERAL);
eeCheck(true);
storageDirty(EE_GENERAL);
storageCheck(true);
// create the directory if needed...
DIR folder;
FRESULT result = f_opendir(&folder, EEPROMS_PATH);
if (result != FR_OK) {
if (result == FR_NO_PATH)
result = f_mkdir(EEPROMS_PATH);
if (result != FR_OK) {
POPUP_WARNING(SDCARD_ERROR(result));
return;
}
const char * error = sdCheckAndCreateDirectory(EEPROMS_PATH);
if (error) {
POPUP_WARNING(error);
return;
}
// prepare the filename...
@ -82,8 +77,8 @@ void backupEeprom()
//set back unexpectedShutdown
g_eeGeneral.unexpectedShutdown = 1;
eeDirty(EE_GENERAL);
eeCheck(true);
storageDirty(EE_GENERAL);
storageCheck(true);
}
void menuGeneralVersion(uint8_t event)
@ -91,7 +86,7 @@ void menuGeneralVersion(uint8_t event)
if (s_warning_result) {
s_warning_result = 0;
displayPopup(STR_EEPROMFORMATTING);
eeErase(false);
storageEraseAll(false);
#if !defined(SIMU)
NVIC_SystemReset();
#else

View file

@ -209,14 +209,14 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
if (c != v) {
name[cur] = v;
eeDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
storageDirty(g_menuPos[0] == 0 ? EE_MODEL : EE_GENERAL);
}
if (attr == ZCHAR) {
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
lcdDrawChar(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
}
else {
lcd_putcAtt(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
lcdDrawChar(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
}
}
else {

View file

@ -91,7 +91,7 @@ bool moveCurve(uint8_t index, int8_t shift)
curveEnd[index++] += shift;
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
return true;
}
@ -99,7 +99,7 @@ void displayPresetChoice(uint8_t event)
{
displayWarning(event);
lcd_outdezAtt(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*s_warning_input_value/4, LEFT|INVERS);
lcd_putcAtt(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
if (s_warning_result) {
s_warning_result = 0;

View file

@ -67,7 +67,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
s_menu_flags = 0;
}
@ -75,7 +75,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
else {
// The user choosed a file in the list
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
eeDirty(eeFlags);
storageDirty(eeFlags);
if (func == FUNC_PLAY_SCRIPT) {
LUA_LOAD_MODEL_SCRIPTS();
}
@ -103,21 +103,21 @@ void onCustomFunctionsMenu(const char *result)
}
else if (result == STR_PASTE) {
*cfn = clipboard.data.cfn;
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_CLEAR) {
memset(cfn, 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_INSERT) {
memmove(cfn+1, cfn, (NUM_CFN-sub-1)*sizeof(CustomFunctionData));
memset(cfn, 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
else if (result == STR_DELETE) {
memmove(cfn, cfn+1, (NUM_CFN-sub-1)*sizeof(CustomFunctionData));
memset(&g_model.customFn[NUM_CFN-1], 0, sizeof(CustomFunctionData));
eeDirty(eeFlags);
storageDirty(eeFlags);
}
}
@ -128,22 +128,22 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
if (result == STR_CONSTANT) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_MIXSOURCE) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_GLOBALVAR) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else {
onSourceLongEnterPress(result);
@ -303,7 +303,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
strcpy(directory, SOUNDS_PATH);
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
}
if (listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
menuHandler = onCustomFunctionsFileSelectionMenu;
}
else {
@ -415,12 +415,12 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
lcd_putsAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN+2, y, "1x", attr);
}
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
lcd_putcAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN-1, y, '!', attr);
lcdDrawChar(MODEL_CUSTOM_FUNC_4TH_COLUMN-1, y, '!', attr);
lcd_putsAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN+2, y, "1x", attr);
}
else {
lcd_outdezAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, attr);
lcd_putcAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN+2+FW, y, 's', attr);
lcdDrawChar(MODEL_CUSTOM_FUNC_4TH_COLUMN+2+FW, y, 's', attr);
}
if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags);
}

View file

@ -40,7 +40,7 @@ void onModelCustomScriptMenu(const char *result)
ScriptData &sd = g_model.scriptsData[s_currIdx];
if (result == STR_UPDATE_LIST) {
if (!listSdFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), NULL)) {
if (!sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), NULL)) {
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
s_menu_flags = 0;
}
@ -49,7 +49,7 @@ void onModelCustomScriptMenu(const char *result)
// The user choosed a lua file in the list
copySelection(sd.file, result, sizeof(sd.file));
memset(sd.inputs, 0, sizeof(sd.inputs));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
LUA_LOAD_MODEL_SCRIPT(s_currIdx);
}
}
@ -88,7 +88,7 @@ void menuModelCustomScriptOne(uint8_t event)
lcd_putsiAtt(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) {
s_editMode = 0;
if (listSdFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
menuHandler = onModelCustomScriptMenu;
}
else {

View file

@ -41,17 +41,17 @@ void onGVARSMenu(const char *result)
if (result == STR_ENABLE_POPUP) {
g_model.gvars[sub].popup = true;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_DISABLE_POPUP) {
g_model.gvars[sub].popup = false;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
g_model.flightModeData[i].gvars[sub] = 0;
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -115,7 +115,7 @@ void menuModelGVars(uint8_t event)
if (attr) {
if (event == EVT_KEY_LONG(KEY_ENTER)) {
v = (v > GVAR_MAX ? 0 : GVAR_MAX+1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (s_editMode>0) {
v = checkIncDec(event, v, vmin, vmax, EE_MODEL);

View file

@ -53,9 +53,9 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
if (posHorz==p) flags |= BLINK;
}
if (value & (1<<p))
lcd_putcAtt(x, y, ' ', flags|FIXEDWIDTH);
lcdDrawChar(x, y, ' ', flags|FIXEDWIDTH);
else
lcd_putcAtt(x, y, '0'+p, flags);
lcdDrawChar(x, y, '0'+p, flags);
x += FW;
}
@ -63,7 +63,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
if (s_editMode && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
value ^= (1<<posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -83,8 +83,8 @@ int16_t expoFn(int16_t x)
void DrawFunction(FnFuncP fn, uint8_t offset)
{
lcd_vlineStip(X0-offset, 0/*TODO Y0-WCHART*/, WCHART*2, 0xee);
lcd_hlineStip(X0-WCHART-offset, Y0, WCHART*2, 0xee);
lcdDrawVerticalLine(X0-offset, 0/*TODO Y0-WCHART*/, WCHART*2, 0xee);
lcdDrawHorizontalLine(X0-WCHART-offset, Y0, WCHART*2, 0xee);
coord_t prev_yv = (coord_t)-1;
@ -145,7 +145,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
// TODO avoid this global s_currCh on ARM boards ...
@ -178,7 +178,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
mix->weight = 100;
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void copyExpoMix(uint8_t expo, uint8_t idx)
@ -193,7 +193,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
}
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void memswap(void *a, void *b, uint8_t size)
@ -460,8 +460,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
barMin = -101;
if (barMax > 101)
barMax = 101;
lcd_hlineStip(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcd_hlineStip(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
lcdDrawHorizontalLine(x-2, y, GAUGE_WIDTH+2, DOTTED);
lcdDrawHorizontalLine(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
lcd_vline(x-2, y+1, GAUGE_HEIGHT-1);
lcd_vline(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
if (barMin <= barMax) {
@ -734,7 +734,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
s_copyTgtOfs += (s_copyTgtOfs < 0 ? +1 : -1);
} while (s_copyTgtOfs != 0);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
m_posVert = s_copySrcRow;
s_copyTgtOfs = 0;
@ -822,7 +822,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
else {
// only swap the mix with its neighbor
if (!swapExpoMix(expo, s_currIdx, key==KEY_MOVE_UP)) break;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
s_copyTgtOfs = next_ofs;
@ -887,7 +887,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
do {
if (s_copyMode) {
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
lcd_rect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
lcdDrawRect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
cur++; y+=FH;
}
if (s_currIdx == i) {
@ -926,7 +926,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
if (s_copyMode) {
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
/* draw a border around the raw on selection mode (copy/move) */
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
}
if (cur == sub) {
/* invert the raw when it's the current one */
@ -937,7 +937,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
if (s_copyMode == MOVE_MODE && cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
cur++; y+=FH;
}
}
@ -958,7 +958,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
putsChn(0, y, ch, attr); // show CHx
}
if (s_copyMode == MOVE_MODE && s_copySrcCh == ch) {
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
}
}
cur++; y+=FH;

View file

@ -136,7 +136,7 @@ void menuModelLimits(uint8_t event)
s_warning_result = 0;
LimitData *ld = limitAddress(sub);
ld->revert = !ld->revert;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
for (int i=0; i<NUM_BODY_LINES; i++) {
@ -229,7 +229,7 @@ void menuModelLimits(uint8_t event)
{
uint8_t revert = ld->revert;
#if defined(PPM_CENTER_ADJUSTABLE)
lcd_putcAtt(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
lcdDrawChar(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
#else
lcd_putsiAtt(LIMITS_REVERT_POS, y, STR_MMMINV, revert, attr);
#endif
@ -269,7 +269,7 @@ void menuModelLimits(uint8_t event)
#if defined(PPM_LIMITS_SYMETRICAL)
case ITEM_LIMITS_SYMETRICAL:
lcd_putcAtt(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
if (active) {
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
}

View file

@ -84,11 +84,11 @@ void onLogicalSwitchesMenu(const char *result)
}
else if (result == STR_PASTE) {
*cs = clipboard.data.csw;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (result == STR_CLEAR) {
memset(cs, 0, sizeof(LogicalSwitchData));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -258,7 +258,7 @@ void menuModelLogicalSwitches(uint8_t event)
if (v1_val <= MIXSRC_LAST_CH) {
cs->v2 = calcRESXto100(x);
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
break;
case LS_FIELD_V3:

View file

@ -56,11 +56,11 @@ void onModelSelectMenu(const char *result)
s_copySrcRow = -1;
}
else if (result == STR_BACKUP_MODEL) {
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
POPUP_WARNING(eeBackupModel(sub));
}
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
if (!listSdFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
POPUP_WARNING(STR_NO_MODELS_ON_SD);
s_menu_flags = 0;
}
@ -71,7 +71,7 @@ void onModelSelectMenu(const char *result)
}
else {
// The user choosed a file on SD to restore
eeCheck(true);
storageCheck(true);
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
if (!s_warning && g_eeGeneral.currModel == sub) {
eeLoadModel(sub);
@ -83,7 +83,7 @@ void menuModelSelect(uint8_t event)
{
if (s_warning_result) {
s_warning_result = 0;
eeCheck(true);
storageCheck(true);
eeDeleteModel(m_posVert); // delete file
s_copyMode = 0;
event = EVT_ENTRY_UP;
@ -145,7 +145,7 @@ void menuModelSelect(uint8_t event)
}
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
displayPopup(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
eeCheck(true); // force writing of current model data before this is changed
storageCheck(true); // force writing of current model data before this is changed
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
@ -167,7 +167,7 @@ void menuModelSelect(uint8_t event)
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
s_copyMode = 0;
@ -278,7 +278,7 @@ void menuModelSelect(uint8_t event)
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
drawFilledRect(9, y, MODELSEL_W-1-9, 7);
lcd_rect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
}
}

View file

@ -120,7 +120,7 @@ void copySelection(char *dst, const char *src, uint8_t size)
void onModelSetupBitmapMenu(const char *result)
{
if (result == STR_UPDATE_LIST) {
if (!listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
if (!sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), NULL)) {
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
s_menu_flags = 0;
}
@ -129,7 +129,7 @@ void onModelSetupBitmapMenu(const char *result)
// The user choosed a bmp file in the list
copySelection(g_model.header.bitmap, result, sizeof(g_model.header.bitmap));
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
@ -157,7 +157,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
swsrc_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) {
timer->mode = switchVal + (TMRMODE_COUNT-1);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
#endif
@ -304,7 +304,7 @@ void menuModelSetup(uint8_t event)
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
s_editMode = 0;
if (listSdFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), g_model.header.bitmap, LIST_NONE_SD_FILE)) {
menuHandler = onModelSetupBitmapMenu;
}
else {
@ -402,7 +402,7 @@ void menuModelSetup(uint8_t event)
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
}
}
@ -494,7 +494,7 @@ void menuModelSetup(uint8_t event)
getMovedSwitch();
g_model.switchWarningState = switches_states;
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
killEvents(event);
break;
@ -510,11 +510,11 @@ void menuModelSetup(uint8_t event)
div_t qr = div(current, 8);
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && line && l_posHorz==current) {
g_model.switchWarningEnable ^= (1 << i);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
c = "\300-\301"[states & 0x03];
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (m_posHorz==current) ? INVERS : 0);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (m_posHorz==current) ? INVERS : 0);
if (swactive) lcd_putc(lcdNextPos, y+FH*qr.quot, c);
++current;
}
@ -545,7 +545,7 @@ void menuModelSetup(uint8_t event)
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), g_model.potsWarnMode, (m_posHorz == 0) ? attr : 0);
if (attr && (m_posHorz == 0)) {
CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (attr) {
@ -557,12 +557,12 @@ void menuModelSetup(uint8_t event)
if (g_model.potsWarnMode == POTS_WARN_MANUAL) {
SAVE_POT_POSITION(m_posHorz-1);
AUDIO_WARNING1();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
break;
case EVT_KEY_BREAK(KEY_ENTER):
g_model.potsWarnEnabled ^= (1 << (m_posHorz-1));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
break;
}
}
@ -617,7 +617,7 @@ void menuModelSetup(uint8_t event)
if (READ_ONLY_UNLOCKED()) {
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
}
@ -767,7 +767,7 @@ void menuModelSetup(uint8_t event)
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
if (attr && s_editMode>0) {
switch (m_posHorz) {
@ -878,7 +878,7 @@ void menuModelFailsafe(uint8_t event)
event = 0;
if (s_editMode) {
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
}
@ -890,7 +890,7 @@ void menuModelFailsafe(uint8_t event)
failsafe = FAILSAFE_CHANNEL_NOPULSE;
else
failsafe = channelOutputs[m_posVert];
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
}
@ -981,13 +981,13 @@ void menuModelFailsafe(uint8_t event)
}
// Gauge
lcd_rect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
coord_t xChannel = (channelValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenChannel;
coord_t xFailsafe = (failsafeValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenFailsafe;
lcd_hlineStip(xChannel, y+1, lenChannel, DOTTED, 0);
lcd_hlineStip(xChannel, y+2, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
lcd_hline(xFailsafe, y+3, lenFailsafe);
lcd_hline(xFailsafe, y+4, lenFailsafe);

View file

@ -367,7 +367,7 @@ void menuModelSensor(uint8_t event)
lcd_putsLeft(y, STR_RATIO);
if (attr) sensor->custom.ratio = checkIncDec(event, sensor->custom.ratio, 0, 30000, EE_MODEL|NO_INCDEC_MARKS|INCDEC_REP10);
if (sensor->custom.ratio == 0)
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
else
lcd_outdezAtt(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
break;
@ -416,7 +416,7 @@ void menuModelSensor(uint8_t event)
source = checkIncDec(event, source, -MAX_SENSORS, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
}
if (source < 0) {
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
putsMixerSource(lcdNextPos, y, MIXSRC_FIRST_TELEM+3*(-1-source), attr);
}
else {
@ -478,7 +478,7 @@ void onSensorMenu(const char *result)
TelemetryItem & sourceItem = telemetryItems[index];
TelemetryItem & newItem = telemetryItems[newIndex];
newItem = sourceItem;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else {
POPUP_WARNING(STR_TELEMETRYFULL);
@ -494,7 +494,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
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)) {
if (!sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
s_menu_flags = 0;
}
@ -502,7 +502,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
else {
// The user choosed a file in the list
memcpy(g_model.frsky.screens[screenIndex].script.file, result, sizeof(g_model.frsky.screens[screenIndex].script.file));
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
LUA_LOAD_MODEL_SCRIPTS();
}
}
@ -535,7 +535,7 @@ void menuModelTelemetry(uint8_t event)
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
int index = k-ITEM_TELEMETRY_SENSOR1;
lcd_outdezAtt(INDENT_WIDTH, y, index+1, LEFT|attr);
lcd_putcAtt(lcdLastPos, y, ':', attr);
lcdDrawChar(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, '*');
@ -734,7 +734,7 @@ void menuModelTelemetry(uint8_t event)
if (m_posHorz==1 && attr && event==EVT_KEY_BREAK(KEY_ENTER) && READ_ONLY_UNLOCKED()) {
s_editMode = 0;
if (listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
if (sdListFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), g_model.frsky.screens[screenIndex].script.file)) {
menuHandler = onTelemetryScriptFileSelectionMenu;
}
else {

View file

@ -193,29 +193,12 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
bool isThrottleSourceAvailable(int source);
bool isLogicalSwitchFunctionAvailable(int function);
bool isAssignableFunctionAvailable(int function);
bool isSourceAvailableInResetSpecialFunction(int index);
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
bool isLogicalSwitchAvailable(int index);
bool isSwitchAvailableInLogicalSwitches(int swtch);
bool isSwitchAvailableInCustomFunctions(int swtch);
bool isSwitchAvailableInMixes(int swtch);
bool isSwitchAvailableInTimers(int swtch);
bool isModuleAvailable(int module);
int getFirstAvailable(int min, int max, bool (*func)(int));
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
bool isInputAvailable(int input);
bool isSourceAvailable(int source);
bool isSourceAvailableInGlobalFunctions(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isInputSourceAvailable(int source);
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)

View file

@ -259,7 +259,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
AUDIO_KEYPAD_DOWN();
}
}
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
checkIncDec_Ret = (newval > val ? 1 : -1);
}
else {

View file

@ -57,7 +57,7 @@ void (*menuHandler)(const char *result);
void displayBox(const char *title)
{
drawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
lcd_rect(10, 16, LCD_W-20, 40);
lcdDrawRect(10, 16, LCD_W-20, 40);
lcd_putsn(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN);
// could be a place for a s_warning_info
}
@ -131,7 +131,7 @@ const char * displayMenu(uint8_t event)
uint8_t display_count = min<unsigned int>(s_menu_count, MENU_MAX_DISPLAY_LINES);
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
drawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
lcd_rect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
for (uint8_t i=0; i<display_count; i++) {
lcd_putsAtt(MENU_X+6, i*(FH+1) + y + 2, s_menu[i+(s_menu_offset_type == MENU_OFFSET_INTERNAL ? s_menu_offset : 0)], s_menu_flags);

View file

@ -225,13 +225,13 @@ void displayTopBar()
/* Tx voltage */
putsVBat(BAR_X+2, BAR_Y+1, LEFT);
batt_icon_x = lcdLastPos;
lcd_rect(batt_icon_x+FW, BAR_Y+1, 13, 7);
lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7);
lcd_vline(batt_icon_x+FW+13, BAR_Y+2, 5);
if (TELEMETRY_STREAMING()) {
/* RSSI */
LCD_ICON(batt_icon_x+3*FW+3, BAR_Y, ICON_RSSI);
lcd_rect(batt_icon_x+5*FW, BAR_Y+1, 13, 7);
lcdDrawRect(batt_icon_x+5*FW, BAR_Y+1, 13, 7);
/* Rx voltage */
altitude_icon_x = batt_icon_x+7*FW+3;
@ -323,7 +323,7 @@ void displayTimers()
}
putsTimer(TIMERS_X, y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT);
if (timerData.persistent) {
lcd_putcAtt(TIMERS_R, y+1, 'P', SMLSIZE);
lcdDrawChar(TIMERS_R, y+1, 'P', SMLSIZE);
}
if (timerState.val < 0) {
if (BLINK_ON_PHASE) {
@ -400,7 +400,7 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
}
}
lcd_putcAtt(width==5 ? x+1 : x, y, 'A'+index, TINSIZE);
lcdDrawChar(width==5 ? x+1 : x, y, 'A'+index, TINSIZE);
y += 6;
if (val <= 0) {
@ -508,7 +508,7 @@ void menuMainView(uint8_t event)
#endif
case EVT_KEY_BREAK(KEY_PAGE):
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
g_eeGeneral.view += 1;
if (g_eeGeneral.view >= VIEW_COUNT) {
g_eeGeneral.view = 0;
@ -604,7 +604,7 @@ void menuMainView(uint8_t event)
drawFilledRect(x, y, 4, 8);
}
else {
lcd_rect(x, y, 4, 8);
lcdDrawRect(x, y, 4, 8);
}
}
}
@ -613,7 +613,7 @@ void menuMainView(uint8_t event)
if (s_gvar_timer > 0) {
s_gvar_timer--;
drawFilledRect(BITMAP_X, BITMAP_Y, 64, 32, SOLID, ERASE);
lcd_rect(BITMAP_X, BITMAP_Y, 64, 32);
lcdDrawRect(BITMAP_X, BITMAP_Y, 64, 32);
putsStrIdx(BITMAP_X+FW, BITMAP_Y+FH-1, STR_GV, s_gvar_last+1);
lcd_putsnAtt(BITMAP_X+4*FW+FW/2, BITMAP_Y+FH-1, g_model.gvars[s_gvar_last].name, LEN_GVAR_NAME, ZCHAR);
lcd_putsAtt(BITMAP_X+FW, BITMAP_Y+2*FH+3, PSTR("[\010]"), BOLD);

View file

@ -49,7 +49,7 @@ void menuStatisticsView(uint8_t event)
case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
sessionTimer = 0;
break;
@ -125,7 +125,7 @@ void menuStatisticsDebug(uint8_t event)
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.mAhUsed = 0;
g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
sessionTimer = 0;
killEvents(event);
AUDIO_KEYPAD_UP();

View file

@ -54,7 +54,7 @@ void displayRssiLine()
lcd_hline(0, 55, 212, 0); // separator
uint8_t rssi = min((uint8_t)99, TELEMETRY_RSSI());
lcd_putsn(0, STATUS_BAR_Y, STR_RX, 2); lcd_outdezNAtt(4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
lcd_rect(BAR_LEFT, 57, 78, 7);
lcdDrawRect(BAR_LEFT, 57, 78, 7);
drawFilledRect(BAR_LEFT+1, 58, 19*rssi/25, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
}
else {
@ -94,7 +94,7 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
if (source && barMax > barMin) {
int y = barHeight+6+i*(barHeight+6);
putsMixerSource(0, y+barHeight-5, source, 0);
lcd_rect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
lcdDrawRect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
getvalue_t value = getValue(source);
putsChannel(BAR_LEFT+2+BAR_WIDTH, y+barHeight-5, source, LEFT);
uint8_t thresholdX = 0;
@ -107,7 +107,7 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
}
}
if (thresholdX) {
lcd_vlineStip(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcdDrawVerticalLine(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
lcd_hline(BAR_LEFT+thresholdX, y-2, 3);
}
}

View file

@ -78,18 +78,18 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
{
lcd_outdezAtt(LCD_W, 0, count, attr);
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
lcd_putcAtt(x, 0, '/', attr);
lcdDrawChar(x, 0, '/', attr);
lcd_outdezAtt(x, 0, index+1, attr);
}
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
{
lcd_vlineStip(x, y, h, DOTTED);
lcdDrawVerticalLine(x, y, h, DOTTED);
coord_t yofs = (h * offset) / count;
coord_t yhgt = (h * visible) / count;
if (yhgt + yofs > h)
yhgt = h - yofs;
lcd_vlineStip(x, y + yofs, yhgt, SOLID, FORCE);
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
}
const pm_uchar MAINMENU_LBM[] PROGMEM = {
@ -102,14 +102,14 @@ void displayMenuBar(const MenuItem *menu, int index)
drawFilledRect(0, 24, LCD_W, 7, SOLID, GREY_DEFAULT);
lcd_bmp(1, 0, MAINMENU_LBM);
lcd_putsAtt(0, 24, menu[index].name, INVERS);
lcd_rect(index*24, 0, 26, 24, SOLID, FORCE);
lcd_hlineStip(0, 31, LCD_W, SOLID, FORCE);
lcdDrawRect(index*24, 0, 26, 24, SOLID, FORCE);
lcdDrawHorizontalLine(0, 31, LCD_W, SOLID, FORCE);
}
void displayProgressBar(const char *label)
{
lcd_putsLeft(4*FH, label);
lcd_rect(3, 6*FH+4, 204, 7);
lcdDrawRect(3, 6*FH+4, 204, 7);
lcdRefresh();
}
@ -126,7 +126,7 @@ void updateProgressBar(int num, int den)
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max)
{
lcd_rect(x, y, w+1, h);
lcdDrawRect(x, y, w+1, h);
drawFilledRect(x+1, y+1, w-1, 4, SOLID, ERASE);
coord_t len = limit((uint8_t)1, uint8_t((abs(val) * w/2 + max/2) / max), uint8_t(w/2));
coord_t x0 = (val>0) ? x+w/2 : x+1+w/2-len;
@ -188,7 +188,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
else
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value, min, max)) {
@ -208,7 +208,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
idx = -idx;
lcd_putcAtt(x-6, y, '-', attr);
lcdDrawChar(x-6, y, '-', attr);
}
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);

View file

@ -37,6 +37,10 @@
#ifndef _GUI_H_
#define _GUI_H_
#if defined(CPUARM)
#include "gui_helpers.h"
#endif
#if defined(PCBHORUS)
#include "Horus/gui.h"
#elif defined(PCBFLAMENCO)

View file

@ -0,0 +1,436 @@
/*
* 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"
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
{
do {
current += inc;
if (current < min)
current = max;
else if (current > max)
current = min;
if (!isValueAvailable || isValueAvailable(current))
return current;
} while(1);
return 0;
}
#if defined(VIRTUALINPUTS)
bool isInputAvailable(int input)
{
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
}
#endif
bool isChannelUsed(int channel)
{
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return false;
if (md->destCh == channel) return true;
if (md->destCh > channel) return false;
}
return false;
}
int getChannelsUsed()
{
int result = 0;
int lastCh = -1;
for (int i=0; i<MAX_MIXERS; ++i) {
MixData *md = mixAddress(i);
if (md->srcRaw == 0) return result;
if (md->destCh != lastCh) { ++result; lastCh = md->destCh; }
}
return result;
}
bool isSourceAvailable(int source)
{
#if defined(VIRTUALINPUTS)
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
return isInputAvailable(source - MIXSRC_FIRST_INPUT);
}
#endif
#if defined(LUA_MODEL_SCRIPTS)
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA) {
div_t qr = div(source-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
return (qr.rem<scriptInputsOutputs[qr.quot].outputsCount);
}
#elif defined(VIRTUALINPUTS)
if (source>=MIXSRC_FIRST_LUA && source<=MIXSRC_LAST_LUA)
return false;
#endif
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH) {
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
}
#if !defined(HELI)
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
return false;
#endif
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH) {
return isChannelUsed(source-MIXSRC_FIRST_CH);
}
if (source>=MIXSRC_FIRST_LOGICAL_SWITCH && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
LogicalSwitchData * cs = lswAddress(source-MIXSRC_FIRST_LOGICAL_SWITCH);
return (cs->func != LS_FUNC_NONE);
}
#if !defined(GVARS)
if (source>=MIXSRC_GVAR1 && source<=MIXSRC_LAST_GVAR)
return false;
#endif
if (source>=MIXSRC_RESERVE1 && source<=MIXSRC_RESERVE5)
return false;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
if (qr.rem == 0)
return isTelemetryFieldAvailable(qr.quot);
else
return isTelemetryFieldComparisonAvailable(qr.quot);
}
return true;
}
bool isSourceAvailableInGlobalFunctions(int source)
{
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
return false;
}
return isSourceAvailable(source);
}
bool isSourceAvailableInCustomSwitches(int source)
{
bool result = isSourceAvailable(source);
#if defined(FRSKY)
if (result && source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
result = isTelemetryFieldComparisonAvailable(qr.quot);
}
#endif
return result;
}
bool isInputSourceAvailable(int source)
{
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
return true;
if (source>=MIXSRC_FIRST_TRIM && source<=MIXSRC_LAST_TRIM)
return true;
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH)
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
return true;
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
return true;
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
return isTelemetryFieldAvailable(qr.quot) && isTelemetryFieldComparisonAvailable(qr.quot);
}
return false;
}
enum SwitchContext
{
LogicalSwitchesContext,
ModelCustomFunctionsContext,
GeneralCustomFunctionsContext,
TimersContext,
MixesContext
};
bool isLogicalSwitchAvailable(int index)
{
LogicalSwitchData * lsw = lswAddress(index);
return (lsw->func != LS_FUNC_NONE);
}
bool isSwitchAvailable(int swtch, SwitchContext context)
{
bool negative = false;
if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
}
#if defined(PCBSKY9X)
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
negative = negative;
return true;
}
#else
if (swtch >= SWSRC_FIRST_SWITCH && swtch <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(swtch);
if (!SWITCH_EXISTS(swinfo.quot)) {
return false;
}
if (!IS_3POS(swinfo.quot)) {
if (negative) {
return false;
}
if (IS_3POS_MIDDLE(swinfo.rem)) {
return false;
}
}
return true;
}
#endif
#if NUM_XPOTS > 0
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) {
int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT;
if (IS_POT_MULTIPOS(POT1+index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT));
}
else {
return false;
}
}
#endif
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
if (context == GeneralCustomFunctionsContext) {
return false;
}
else if (context != LogicalSwitchesContext) {
return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH);
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
if (context == MixesContext || context == GeneralCustomFunctionsContext) {
return false;
}
else {
swtch -= SWSRC_FIRST_FLIGHT_MODE;
if (swtch == 0) {
return true;
}
FlightModeData * fm = flightModeAddress(swtch);
return (fm->swtch != SWSRC_NONE);
}
}
if (swtch >= SWSRC_FIRST_SENSOR && swtch <= SWSRC_LAST_SENSOR) {
return isTelemetryFieldAvailable(swtch - SWSRC_FIRST_SENSOR);
}
return true;
}
bool isSwitchAvailableInLogicalSwitches(int swtch)
{
return isSwitchAvailable(swtch, LogicalSwitchesContext);
}
bool isSwitchAvailableInCustomFunctions(int swtch)
{
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
else
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
}
bool isSwitchAvailableInMixes(int swtch)
{
return isSwitchAvailable(swtch, MixesContext);
}
bool isSwitchAvailableInTimers(int swtch)
{
if (swtch >= 0) {
if (swtch < TMRMODE_COUNT)
return true;
else
swtch -= TMRMODE_COUNT-1;
}
else {
if (swtch > -TMRMODE_COUNT)
return false;
else
swtch += TMRMODE_COUNT-1;
}
return isSwitchAvailable(swtch, TimersContext);
}
bool isThrottleSourceAvailable(int source)
{
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;
}
bool isLogicalSwitchFunctionAvailable(int function)
{
return function != LS_FUNC_RANGE;
}
bool isAssignableFunctionAvailable(int function)
{
#if defined(OVERRIDE_CHANNEL_FUNCTION) || defined(GVARS)
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
#endif
switch (function) {
case FUNC_OVERRIDE_CHANNEL:
#if defined(OVERRIDE_CHANNEL_FUNCTION)
return modelFunctions;
#else
return false;
#endif
case FUNC_ADJUST_GVAR:
#if defined(GVARS)
return modelFunctions;
#else
return false;
#endif
#if !defined(HAPTIC)
case FUNC_HAPTIC:
#endif
case FUNC_RESERVE4:
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
case FUNC_RANGECHECK:
case FUNC_BIND:
#endif
#if !defined(LUA)
case FUNC_PLAY_SCRIPT:
#endif
case FUNC_RESERVE5:
return false;
default:
return true;
}
}
bool isSourceAvailableInGlobalResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM)
return false;
else
return isSourceAvailableInResetSpecialFunction(index);
}
bool isSourceAvailableInResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM) {
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM];
return telemetrySensor.isAvailable();
}
#if TIMERS < 3
else if (index == FUNC_RESET_TIMER3) {
return false;
}
#endif
#if TIMERS < 2
else if (index == FUNC_RESET_TIMER2) {
return false;
}
#endif
else {
return true;
}
}
bool isModuleAvailable(int module)
{
return true;
}
bool modelHasNotes()
{
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
char *buf = strcat_currentmodelname(&filename[sizeof(MODELS_PATH)]);
strcpy(buf, TEXT_EXT);
return isFileAvailable(filename);
}
int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable)
{
int retval = 0;
for (int i = min; i <= max; i++) {
if (isValueAvailable(i)) {
retval = i;
break;
}
}
return retval;
}

View file

@ -0,0 +1,64 @@
/*
* 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 _GUI_HELPERS_H_
#define _GUI_HELPERS_H_
typedef bool (*IsValueAvailable)(int);
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable);
int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable);
#if defined(VIRTUALINPUTS)
bool isInputAvailable(int input);
#endif
bool isInputSourceAvailable(int source);
bool isThrottleSourceAvailable(int source);
bool isLogicalSwitchFunctionAvailable(int function);
bool isLogicalSwitchAvailable(int index);
bool isAssignableFunctionAvailable(int function);
bool isSourceAvailable(int source);
bool isSourceAvailableInGlobalFunctions(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isSourceAvailableInResetSpecialFunction(int index);
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
bool isSwitchAvailableInLogicalSwitches(int swtch);
bool isSwitchAvailableInCustomFunctions(int swtch);
bool isSwitchAvailableInMixes(int swtch);
bool isSwitchAvailableInTimers(int swtch);
bool isModuleAvailable(int module);
#endif // _GUI_HELPERS_H_

View file

@ -52,7 +52,7 @@
#if defined(PCBSKY9X)
#include "AT91SAM3S4.h"
#else
#include "board_taranis.h"
#include "targets/Taranis/board_taranis.h"
#endif
#if defined(PCBTARANIS)

View file

@ -53,7 +53,6 @@ const pm_char * openLogs()
{
// Determine and set log file filename
FRESULT result;
DIR folder;
char filename[34]; // /LOGS/modelnamexxx-2013-01-01.log
if (!sdMounted())
@ -64,12 +63,9 @@ const pm_char * openLogs()
// check and create folder here
strcpy_P(filename, STR_LOGS_PATH);
result = f_opendir(&folder, filename);
if (result != FR_OK) {
if (result == FR_NO_PATH)
result = f_mkdir(filename);
if (result != FR_OK)
return SDCARD_ERROR(result);
const char * error = sdCheckAndCreateDirectory(filename);
if (error) {
return error;
}
filename[sizeof(LOGS_PATH)-1] = '/';

View file

@ -439,7 +439,7 @@ static int luaLcdDrawLine(lua_State *L)
int y2 = luaL_checkinteger(L, 4);
int pat = luaL_checkinteger(L, 5);
int flags = luaL_checkinteger(L, 6);
lcd_line(x1, y1, x2, y2, pat, flags);
lcdDrawLine(x1, y1, x2, y2, pat, flags);
return 0;
}
@ -562,7 +562,7 @@ static int luaLcdDrawRectangle(lua_State *L)
int w = luaL_checkinteger(L, 3);
int h = luaL_checkinteger(L, 4);
unsigned int flags = luaL_optunsigned(L, 5, 0);
lcd_rect(x, y, w, h, 0xff, flags);
lcdDrawRect(x, y, w, h, 0xff, flags);
return 0;
}
@ -588,7 +588,7 @@ static int luaLcdDrawGauge(lua_State *L)
int num = luaL_checkinteger(L, 5);
int den = luaL_checkinteger(L, 6);
// int flags = luaL_checkinteger(L, 7);
lcd_rect(x, y, w, h);
lcdDrawRect(x, y, w, h);
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
for (int i=1; i<h-1; i++) {
lcd_hline(x+1, y+i, len);
@ -627,7 +627,7 @@ static int luaLcdDrawCombobox(lua_State *L)
}
if (flags & BLINK) {
drawFilledRect(x, y, w-9, count*9+2, SOLID, ERASE);
lcd_rect(x, y, w-9, count*9+2);
lcdDrawRect(x, y, w-9, count*9+2);
for (int i=0; i<count; i++) {
lua_rawgeti(L, 4, i+1);
const char * item = luaL_checkstring(L, -1);
@ -635,7 +635,7 @@ static int luaLcdDrawCombobox(lua_State *L)
}
drawFilledRect(x+1, y+1+9*idx, w-11, 9);
drawFilledRect(x+w-10, y, 10, 11, SOLID, ERASE);
lcd_rect(x+w-10, y, 10, 11);
lcdDrawRect(x+w-10, y, 10, 11);
}
else if (flags & INVERS) {
drawFilledRect(x, y, w, 11);
@ -646,7 +646,7 @@ static int luaLcdDrawCombobox(lua_State *L)
}
else {
drawFilledRect(x, y, w, 11, SOLID, ERASE);
lcd_rect(x, y, w, 11);
lcdDrawRect(x, y, w, 11);
drawFilledRect(x+w-10, y+1, 9, 9, SOLID);
lua_rawgeti(L, 4, idx+1);
const char * item = luaL_checkstring(L, -1);
@ -692,7 +692,7 @@ static int luaModelSetInfo(lua_State *L)
#endif
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
return 0;
}
@ -736,7 +736,7 @@ static int luaModelSetModule(lua_State *L)
module.channelsCount = luaL_checkinteger(L, -1) - 8;
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
}
@ -789,7 +789,7 @@ static int luaModelSetTimer(lua_State *L)
timer.persistent = luaL_checkinteger(L, -1);
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
}
@ -1133,7 +1133,7 @@ static int luaModelSetLogicalSwitch(lua_State *L)
sw->duration = luaL_checkinteger(L, -1);
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
@ -1238,7 +1238,7 @@ static int luaModelSetCustomFunction(lua_State *L)
CFN_ACTIVE(cfn) = luaL_checkinteger(L, -1);
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
@ -1306,7 +1306,7 @@ static int luaModelSetOutput(lua_State *L)
limit->curve = luaL_checkinteger(L, -1) + 1;
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
@ -1330,7 +1330,7 @@ static int luaModelSetGlobalVariable(lua_State *L)
int value = luaL_checkinteger(L, 3);
if (phase < MAX_FLIGHT_MODES && idx < MAX_GVARS && value >= -GVAR_MAX && value <= GVAR_MAX) {
g_model.flightModeData[phase].gvars[idx] = value;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
return 0;
}
@ -1996,7 +1996,7 @@ void luaDoOneRunStandalone(uint8_t evt)
lcd_outdezAtt(lcdLastPos, 7*FH, luaGetMemUsed(), LEFT);
lcd_putc(lcdLastPos, 7*FH, 'b');
lcd_hline(0, 7*FH-2, lcdLastPos+6, FORCE);
lcd_vlineStip(lcdLastPos+6, 7*FH-2, FH+2, SOLID, FORCE);
lcdDrawVerticalLine(lcdLastPos+6, 7*FH-2, FH+2, SOLID, FORCE);
}
}
}

View file

@ -96,9 +96,15 @@ void checkEeprom()
if (eepromIsWriting())
eepromWriteProcess();
else if (TIME_TO_WRITE())
eeCheck(false);
storageCheck(false);
}
}
#else
void checkEeprom()
{
if (TIME_TO_WRITE())
storageCheck(false);
}
#endif
#if defined(PCBFLAMENCO)
@ -247,9 +253,7 @@ void perMain()
calcConsumption();
#endif
checkSpeakerVolume();
#if defined(EEPROM)
checkEeprom();
#endif
sdMountPoll();
writeLogs();
handleUsbConnection();

View file

@ -102,7 +102,7 @@ void perMain()
if (theFile.isWriting())
theFile.nextWriteStep();
else if (TIME_TO_WRITE())
eeCheck(false);
storageCheck(false);
}
#if defined(SDCARD)

View file

@ -47,7 +47,7 @@
#define LUA_EXPORT(...)
#define LUA_EXPORT_MULTIPLE(...)
#define LUA_EXPORT_EXTRA(...)
#endif
#endif
#define WARN_THR_BIT 0x01
#define WARN_BEP_BIT 0x80
@ -446,7 +446,8 @@ enum UartModes {
uint32_t switchConfig; \
uint8_t potsType; /*two bits for every pot*/\
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME];
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
char currModelFilename[10];
#elif defined(PCBFLAMENCO)
#define LEN_SWITCH_NAME 3
#define LEN_ANA_NAME 3
@ -846,6 +847,9 @@ PACK(typedef struct {
#define IS_TOGGLE(x) (SWITCH_CONFIG(x) == SWITCH_TOGGLE)
#define IS_3POS_MIDDLE(x) ((x) == 1)
#define SWITCH_WARNING_ALLOWED(x) (SWITCH_EXISTS(x) && !IS_TOGGLE(x))
#else
#define switchInfo(x) ((x) >= 3 ? (x)-2 : 0)
#define SWITCH_EXISTS(x) true
#endif
#define ALTERNATE_VIEW 0x10

View file

@ -367,22 +367,22 @@ void defaultInputs()
g_model.inputNames[i][3] = '\0';
#endif
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
#if defined(TEMPLATES)
inline void applyDefaultTemplate()
{
applyTemplate(TMPL_SIMPLE_4CH); // calls eeDirty internally
applyTemplate(TMPL_SIMPLE_4CH); // calls storageDirty internally
}
#else
void applyDefaultTemplate()
{
#if defined(VIRTUALINPUTS)
defaultInputs(); // calls eeDirty internally
defaultInputs(); // calls storageDirty internally
#else
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
#endif
for (int i=0; i<NUM_STICKS; i++) {
@ -398,7 +398,7 @@ void applyDefaultTemplate()
}
#endif
#if defined(CPUARM)
#if defined(CPUARM) && defined(EEPROM)
void checkModelIdUnique(uint8_t index, uint8_t module)
{
uint8_t modelId = g_model.header.modelId[module];
@ -447,7 +447,7 @@ void modelDefault(uint8_t id)
g_model.moduleData[EXTERNAL_MODULE].type = MODULE_TYPE_PPM;
#endif
#if defined(CPUARM)
#if defined(CPUARM) && defined(EEPROM)
for (int i=0; i<NUM_MODULES; i++) {
modelHeaders[id].modelId[i] = g_model.header.modelId[i] = id+1;
}
@ -602,7 +602,7 @@ bool setTrimValue(uint8_t phase, uint8_t idx, int trim)
break;
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
return true;
}
#else
@ -617,7 +617,7 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim)
FlightModeData *p = flightModeAddress(phase);
p->trim[idx] = trim;
#endif
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
@ -661,7 +661,7 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
g_rotenc[idx] += inc;
int16_t *value = &(flightModeAddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
*value = limit((int16_t)-1024, (int16_t)(*value + (inc * 8)), (int16_t)+1024);
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
@ -669,11 +669,11 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
#if defined(PCBSTD)
#define SET_GVAR_VALUE(idx, phase, value) \
(GVAR_VALUE(idx, phase) = value, eeDirty(EE_MODEL))
(GVAR_VALUE(idx, phase) = value, storageDirty(EE_MODEL))
#else
#define SET_GVAR_VALUE(idx, phase, value) \
GVAR_VALUE(idx, phase) = value; \
eeDirty(EE_MODEL); \
storageDirty(EE_MODEL); \
if (g_model.gvars[idx].popup) { \
s_gvar_last = idx; \
s_gvar_timer = GVAR_DISPLAY_TIME; \
@ -1121,7 +1121,9 @@ void checkAll()
#if defined(MODULE_ALWAYS_SEND_PULSES)
startupWarningState = STARTUP_WARNING_THROTTLE;
#else
checkTHR();
if (g_eeGeneral.chkSum == evalChkSum()) {
checkTHR();
}
checkSwitches();
checkFailsafe();
#endif
@ -1853,10 +1855,6 @@ void opentxStart()
}
#endif
#if defined(CPUARM)
eeLoadModel(g_eeGeneral.currModel);
#endif
#if defined(GUI)
checkAlarm();
checkAll();
@ -1867,7 +1865,6 @@ void opentxStart()
chainMenu(menuFirstCalib);
}
#endif
}
#if defined(CPUARM) || defined(CPUM2560)
@ -1899,11 +1896,11 @@ void opentxClose()
if (sensor.type == TELEM_TYPE_CALCULATED) {
if (sensor.persistent && sensor.persistentValue != telemetryItems[i].value) {
sensor.persistentValue = telemetryItems[i].value;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
else if (!sensor.persistent) {
sensor.persistentValue = 0;
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
}
}
@ -1923,20 +1920,20 @@ void opentxClose()
SAVE_POT_POSITION(i);
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
#endif
#if !defined(PCBTARANIS)
if (s_eeDirtyMsk & EE_MODEL) {
if (s_storageDirtyMsk & EE_MODEL) {
displayPopup(STR_SAVEMODEL);
}
#endif
g_eeGeneral.unexpectedShutdown = 0;
eeDirty(EE_GENERAL);
eeCheck(true);
storageDirty(EE_GENERAL);
storageCheck(true);
#if defined(CPUARM)
while (IS_PLAYING(ID_PLAY_BYE)) {
@ -2265,7 +2262,7 @@ void instantTrim()
}
}
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING2();
}
@ -2289,7 +2286,7 @@ void copySticksToOffset(uint8_t ch)
#endif
ld->offset = (ld->revert ? -zero : zero);
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void copyTrimsToOffset(uint8_t ch)
@ -2314,7 +2311,7 @@ void copyTrimsToOffset(uint8_t ch)
g_model.limitData[ch].offset = limit((int16_t)-1000, (int16_t)v, (int16_t)1000); // make sure the offset doesn't go haywire
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
}
void moveTrimsToOffsets() // copy state of 3 primary to subtrim
@ -2362,7 +2359,7 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
resumeMixerCalculations();
eeDirty(EE_MODEL);
storageDirty(EE_MODEL);
AUDIO_WARNING2();
}
@ -2411,9 +2408,7 @@ void opentxInit(OPENTX_INIT_ARGS)
{
TRACE("opentxInit()");
#if defined(EEPROM)
eeReadAll();
#endif
storageReadAll();
#if defined(CPUARM)
if (UNEXPECTED_SHUTDOWN()) {
@ -2464,10 +2459,6 @@ void opentxInit(OPENTX_INIT_ARGS)
#if !defined(CPUARM)
// is done above on ARM
unexpectedShutdown = 1;
#endif
#if defined(CPUARM)
TRACE("eeLoadModel(g_eeGeneral.currModel)");
eeLoadModel(g_eeGeneral.currModel);
#endif
}
else {
@ -2478,7 +2469,7 @@ void opentxInit(OPENTX_INIT_ARGS)
#if defined(CPUARM) || defined(CPUM2560)
if (!g_eeGeneral.unexpectedShutdown) {
g_eeGeneral.unexpectedShutdown = 1;
eeDirty(EE_GENERAL);
storageDirty(EE_GENERAL);
}
#endif
@ -2554,7 +2545,7 @@ int main(void)
displaySplash();
#endif
sei(); // interrupts needed for telemetryInit and eeReadAll.
sei(); // interrupts needed now
#if defined(FRSKY) && !defined(DSM2_SERIAL)
telemetryInit();

View file

@ -288,15 +288,15 @@
#elif defined(PCBFLAMENCO)
#include "targets/Flamenco/board_flamenco.h"
#elif defined(PCBTARANIS)
#include "targets/taranis/board_taranis.h"
#include "targets/Taranis/board_taranis.h"
#elif defined(PCBSKY9X)
#include "targets/sky9x/board_sky9x.h"
#include "targets/Sky9x/board_sky9x.h"
#elif defined(PCBGRUVIN9X)
#include "targets/gruvin9x/board_gruvin9x.h"
#include "targets/Gruvin9x/board_gruvin9x.h"
#elif defined(PCBMEGA2560)
#include "targets/mega2560/board_mega2560.h"
#include "targets/Mega2560/board_mega2560.h"
#else
#include "targets/stock/board_stock.h"
#include "targets/9x/board_stock.h"
#endif
#include "debug.h"
@ -469,14 +469,8 @@
#include "cli.h"
#endif
#include "eeprom_common.h"
#if defined(EEPROM_RLC)
#include "eeprom_rlc.h"
#else
#include "eeprom_raw.h"
#endif
#include "timers.h"
#include "storage/storage.h"
#include "pulses/pulses.h"
#if defined(PCBTARANIS)
@ -1530,11 +1524,11 @@ enum AUDIO_SOUNDS {
#include "buzzer.h"
#if defined(PCBSTD) && defined(VOICE)
#include "targets/stock/voice.h"
#include "targets/9x/voice.h"
#endif
#if defined(PCBGRUVIN9X) && defined(VOICE)
#include "targets/gruvin9x/somo14d.h"
#include "targets/Gruvin9x/somo14d.h"
#endif
#include "translations.h"
@ -1630,8 +1624,13 @@ void convertUnit(getvalue_t & val, uint8_t & unit); // TODO check FORCEINLINE on
uint8_t zlen(const char *str, uint8_t size);
bool zexist(const char *str, uint8_t size);
char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defaultName=NULL, uint8_t defaultNameSize=0, uint8_t defaultIdx=0);
#define strcat_modelname(dest, idx) strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, STR_MODEL, PSIZE(TR_MODEL), idx+1)
#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, STR_FP, PSIZE(TR_FP), idx+1)
#if defined(EEPROM)
#define strcat_modelname(dest, idx) strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, STR_MODEL, PSIZE(TR_MODEL), idx+1)
#define strcat_currentmodelname(dest) strcat_modelname(dest, g_eeGeneral.currModel)
#else
#define strcat_currentmodelname(dest) strcat_zchar(dest, g_model.header.name, LEN_MODEL_NAME)
#endif
#define ZLEN(s) zlen(s, sizeof(s))
#define ZEXIST(s) zexist(s, sizeof(s))
#endif

View file

@ -40,7 +40,25 @@
#define LIST_NONE_SD_FILE 1
bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen, const char *selection, uint8_t flags=0)
const char * sdCheckAndCreateDirectory(const char * path)
{
DIR archiveFolder;
FRESULT result = f_opendir(&archiveFolder, path);
if (result != FR_OK) {
if (result == FR_NO_PATH)
result = f_mkdir(path);
if (result != FR_OK)
return SDCARD_ERROR(result);
}
else {
f_closedir(&archiveFolder);
}
return NULL;
}
bool sdListFiles(const char *path, const char *extension, const uint8_t maxlen, const char *selection, uint8_t flags=0)
{
FILINFO fno;
DIR dir;
@ -189,7 +207,7 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
}
#if defined(CPUARM) && defined(SDCARD)
const char *fileCopy(const char *filename, const char *srcDir, const char *destDir)
const char * sdCopyFile(const char * filename, const char * srcDir, const char * destDir)
{
FIL srcFile;
FIL dstFile;

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