Compare commits

..

1 Commits

Author SHA1 Message Date
Arne Schwabe e681c876e6 First version of multi module support for Taranis
Since DSM2 uses the same framing/serial protocol (Serial with 125k)
the multi module code heavily reuses that code and depends on it being enabled.

This first version only implements the protocol on the taranis.

Telemetry code is currently untested.
2016-01-03 18:40:22 +01:00
1089 changed files with 56003 additions and 91463 deletions
-1
View File
@@ -10,4 +10,3 @@ radio/src/bootloader/bootloader_ramBoot*
*.stamp
radio/src/lua/lua_fields_*.txt
radio/src/lua/lua_exports_*.txt
build*/
+8 -21
View File
@@ -1,27 +1,14 @@
sudo: required
dist: trusty
language: python
virtualenv:
system_site_packages: true
python:
- 3.4
language: cpp
before_install:
- sudo add-apt-repository ppa:ubuntu-sdk-team/ppa --yes
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test --yes
- sudo apt-get update -qq
- sudo apt-get remove cmake cmake-data --yes
- sudo add-apt-repository ppa:george-edison55/precise-backports --yes
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes
- sudo apt-get update
install:
- sudo apt-get --yes --force-yes install qtbase5-dev qtmultimedia5-dev qttools5-dev qttools5-dev-tools python3-pyqt5 curl gcc-arm-none-eabi libfox-1.6-dev libgtest-dev
- wget --quiet http://firmware.ardupilot.org/Tools/Travis/gcc-avr_1%253a4.8-2.1_amd64.deb
- wget --quiet http://firmware.ardupilot.org/Tools/Travis/libmpfr4_3.1.2-1_amd64.deb
- wget --quiet http://firmware.ardupilot.org/Tools/Travis/avr-libc_1%253a1.8.0-4.1_all.deb
- wget --quiet http://firmware.ardupilot.org/Tools/Travis/binutils-avr_2.23.1-2.1_amd64.deb
- wget --quiet http://firmware.ardupilot.org/Tools/Travis/libmpc3_1.0.1-1ubuntu1_amd64.deb
- sudo dpkg --install gcc-avr_1%3a4.8-2.1_amd64.deb avr-libc_1%3a1.8.0-4.1_all.deb libmpfr4_3.1.2-1_amd64.deb binutils-avr_2.23.1-2.1_amd64.deb libmpc3_1.0.1-1ubuntu1_amd64.deb
- sudo apt-get install -y xvfb lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
script:
- ./tools/commit-tests.sh .
- radio/util/commit-tests.sh
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS .. && cmake --build .
+1 -36
View File
@@ -9,13 +9,6 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFI
message(STATUS "OpenTX ${VERSION}")
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0020 NEW)
cmake_policy(SET CMP0023 OLD)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
endif()
set(CMAKE_CXX_STANDARD 11)
set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio)
set(RADIO_SRC_DIRECTORY ${RADIO_DIRECTORY}/src)
@@ -25,33 +18,5 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
find_package(Qt5Widgets)
find_package(Qt5Xml)
find_package(Qt5LinguistTools)
find_package(Qt5PrintSupport)
find_package(Qt5Multimedia)
message(STATUS "Looking for SDL ")
find_package(Sdl)
if(SDL_FOUND)
message("SDL Include Path: " ${SDL_INCLUDE_DIR})
else()
message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.")
endif()
message(STATUS "Looking for FOX ")
find_package(Fox)
if ((NOT FOX_FOUND) AND (NOT WIN32))
message("Libfox not found, simu target will not be available")
endif()
include(Macros)
today(DATE)
now(TIME)
git_id(GIT_STR)
add_subdirectory(${RADIO_SRC_DIRECTORY})
if(Qt5Widgets_FOUND)
add_subdirectory(${COMPANION_SRC_DIRECTORY})
endif()
add_subdirectory(${COMPANION_SRC_DIRECTORY})
-1
View File
@@ -17,4 +17,3 @@ Karl Szmutny
Michal Hlavinka
Pat Mackenzie
Michael Byrne
Christophe Brision (Ingwie)
+2 -2
View File
@@ -1,7 +1,7 @@
##OpenTX 2.2 Branch
[![Build Status](https://travis-ci.org/opentx/opentx.svg?branch=next)](https://travis-ci.org/opentx/opentx)
[![Join the chat at https://opentx.rocket.chat](https://camo.githubusercontent.com/3d659054abd6ce21c0e47cf3b83a51bda69ca282/68747470733a2f2f64656d6f2e726f636b65742e636861742f696d616765732f6a6f696e2d636861742e737667)](https://opentx.rocket.chat)
[![Build Status](https://travis-ci.org/opentx/opentx.svg?branch=master)](https://travis-ci.org/opentx/opentx)
[![Join the chat at https://gitter.im/opentx/opentx](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/opentx/opentx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Donate using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
The ongoing development on 2.2.x is done in this branch.
+5 -4
View File
@@ -1,12 +1,11 @@
macro(add_bitmaps_target targetname filter width format)
set(bitmaps_files)
file(GLOB bitmaps ${filter})
foreach(bitmap ${bitmaps})
get_filename_component(target ${bitmap} NAME_WE)
set(target ${target}.lbm)
add_custom_command(
OUTPUT ${target}
COMMAND python ${RADIO_DIRECTORY}/util/img2lbm.py ${bitmap} ${target} ${width} ${format} ${ARGN}
COMMAND python ${RADIO_DIRECTORY}/util/img2lbm.py ${bitmap} ${target} ${width} ${format}
DEPENDS ${bitmap}
)
list(APPEND bitmaps_files ${target})
@@ -16,9 +15,11 @@ endmacro(add_bitmaps_target)
macro(add_truetype_font_target radio name font size bold)
set(target ${RADIO_SRC_DIRECTORY}/fonts/${radio}/font_${name})
add_custom_target(ttf_${radio}_${name}
add_custom_command(
OUTPUT ${target}.png
OUTPUT ${target}.specs
COMMAND ${RADIO_DIRECTORY}/util/font2png.py ${font} ${size} ${bold} ${target}
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
set(ttf_${radio}_fonts_targets ${ttf_${radio}_fonts_targets} ttf_${radio}_${name})
add_custom_target(ttf_${radio}_${name} DEPENDS ${target}.png ${target}.specs)
endmacro(add_truetype_font_target)
-63
View File
@@ -1,63 +0,0 @@
# Imported from the DeskVox project (LPGL 2.1)
include(FindPackageHandleStandardArgs)
set(hints
$ENV{LIB_BASE_PATH}/fox
)
set(paths
/usr
/usr/local
)
find_path(FOX_INCLUDE_DIR
NAMES
fx.h
HINTS
${hints}
PATHS
${paths}
PATH_SUFFIXES
include
include/fox
include/fox-1.6
)
find_library(FOX_LIBRARY
NAMES
FOX-1.6
fox-1.6
HINTS
${hints}
PATHS
${paths}
PATH_SUFFIXES
lib64
lib
)
find_library(FOX_LIBRARY_DEBUG
NAMES
FOXD-1.6
foxd-1.6
HINTS
${hints}
PATHS
${paths}
PATH_SUFFIXES
lib64
lib
)
if(FOX_LIBRARY_DEBUG)
set(FOX_LIBRARIES optimized ${FOX_LIBRARY} debug ${FOX_LIBRARY_DEBUG})
else()
set(FOX_LIBRARIES ${FOX_LIBRARY})
endif()
find_package_handle_standard_args(FOX
DEFAULT_MSG
FOX_INCLUDE_DIR
FOX_LIBRARY
)
+26 -20
View File
@@ -4,25 +4,25 @@
# SDL_FOUND, if false, do not try to link to SDL
# SDL_INCLUDE_DIR, where to find SDL.h
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
# this module will try to find on your behalf.) Also for OS X, this
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Modified by Eric Wing.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL guidelines.
# Added a search for SDLmain which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# People will have to manually change the cache values of
# SDL_LIBRARY to override this selection.
#
# Note that the header path has changed from SDL/SDL.h to just SDL.h
@@ -46,14 +46,14 @@ FIND_PATH(SDL_INCLUDE_DIR SDL.h
/opt/local/include/SDL # DarwinPorts
/opt/local/include
/opt/csw/include/SDL # Blastwave
/opt/csw/include
/opt/csw/include
/opt/include/SDL
/opt/include
C:/Programs/SDL/include
)
# I'm not sure if I should do a special casing for Apple. It is
# I'm not sure if I should do a special casing for Apple. It is
# unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?),
# But if they do ([Next|Open|GNU]Step?),
# do they want the -framework option also?
IF(${SDL_INCLUDE_DIR} MATCHES ".framework")
# The Cocoa framework must be linked into SDL because SDL is Cocoa based.
@@ -83,7 +83,7 @@ IF(${SDL_INCLUDE_DIR} MATCHES ".framework")
ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
FIND_LIBRARY(SDL_LIBRARY_TEMP
FIND_LIBRARY(SDL_LIBRARY_TEMP
NAMES SDL SDL-1.1
PATHS
$ENV{SDLDIR}/lib
@@ -93,13 +93,13 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
/opt/local/lib
/opt/csw/lib
/opt/lib
C:/Programs/SDL/lib/x86
C:/Programs/SDL/lib
)
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other platforms
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDLMAIN_LIBRARY
FIND_LIBRARY(SDLMAIN_LIBRARY
NAMES SDLmain SDLmain-1.1
PATHS
$ENV{SDLDIR}/lib
@@ -109,12 +109,13 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
/opt/local/lib
/opt/csw/lib
/opt/lib
C:/Programs/SDL/lib
)
ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework")
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
@@ -135,14 +136,14 @@ IF(SDL_LIBRARY_TEMP)
ENDIF(SDLMAIN_LIBRARY)
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there. I think it has something to do
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there. I think it has something to do
# with the CACHE STRING. Maybe somebody else knows how to fix this.
# The problem is mainly cosmetic, and not a functional issue.
IF(APPLE)
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if Find the threads package
# and try using this line, so I'm just skipping it entirely for OS X.
@@ -150,10 +151,15 @@ IF(SDL_LIBRARY_TEMP)
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
ENDIF(MINGW)
# Set the final string here so the GUI reflects the final state.
SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
SET(SDL_FOUND "YES")
ENDIF(SDL_LIBRARY_TEMP)
MARK_AS_ADVANCED(SDL_LIBRARY_TEMP)
MARK_AS_ADVANCED(SDL_LIBRARY_TEMP)
-1
View File
@@ -2,7 +2,6 @@ macro(today RESULT)
if(WIN32)
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\1.\\2.\\3" ${RESULT} ${${RESULT}})
string(SUBSTRING ${${RESULT}} 0 10 ${RESULT})
elseif(UNIX)
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(....)-(..)-(..).*" "\\1-\\2-\\3" ${RESULT} ${${RESULT}})
+85 -60
View File
@@ -1,3 +1,5 @@
include(Macros)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(C9X_NAME_SUFFIX ${VERSION_MAJOR}${VERSION_MINOR})
set(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
@@ -25,10 +27,48 @@ if(TABLE_LAYOUT)
message(STATUS "Using QTableWidget")
endif(TABLE_LAYOUT)
message(STATUS "Looking for XercesC ")
find_package(XercesC)
if(XERCESC_FOUND)
include_directories(${XERCESC_INCLUDE_DIR})
set(LidarFormat_LIBRAIRIES ${LidarFormat_LIBRAIRIES} ${XERCESC_LIBRARIES})
else()
message(FATAL_ERROR "XercesC not found! Please set XercesC path ...")
endif()
message(STATUS "Looking for Xsd ")
find_package(Xsd)
if(XSD_FOUND)
include_directories(${XSD_INCLUDE_DIR})
message("XSD Include Path: " ${XSD_INCLUDE_DIR})
else()
message(FATAL_ERROR "XSD not found! Please set XSD path ...")
endif()
message(STATUS "Looking for SDL ")
find_package(Sdl)
if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})
add_definitions(-DSIMU_AUDIO)
message("SDL Include Path: " ${SDL_INCLUDE_DIR})
add_definitions(-DJOYSTICKS)
add_definitions(-DSIMU_AUDIO)
else()
message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.")
endif()
find_package(Qt4 4.8.1 REQUIRED)
set(QT_USE_QTNETWORK True)
set(QT_USE_QTXML True)
include(${QT_USE_FILE})
message(STATUS "Looking for PHONON ")
find_package(Phonon)
if(PHONON_FOUND)
include_directories(${PHONO_INCLUDE_DIR})
message("PHONON Include Path: " ${PHONON_INCLUDE_DIR})
add_definitions(-DPHONON)
else()
message("PHONON not found!")
endif()
message(STATUS "Looking for QT lupdate ")
@@ -41,6 +81,12 @@ endif()
add_definitions(-DQXT_STATIC)
add_custom_command(
COMMAND ${XSDCXX_EXECUTABLE} cxx-tree --root-element-all --generate-serialization --output-dir ${PROJECT_BINARY_DIR}/ ${PROJECT_SOURCE_DIR}/radio.xsd
OUTPUT ${PROJECT_BINARY_DIR}/radio.hxx ${PROJECT_BINARY_DIR}/radio.cxx
DEPENDS ${PROJECT_SOURCE_DIR}/radio.xsd
)
if(MSVC)
set(CMAKE_CXX_FLAGS "/EHsc /LD")
include_directories(${PROJECT_SOURCE_DIR}/winbuild C:/Programs/pthreads/Pre-built.2/include C:/Programs/msinttypes C:/Programs/dirent/include)
@@ -62,6 +108,7 @@ include_directories(
${COMPANION_SRC_DIRECTORY}
${COMPANION_SRC_DIRECTORY}/shared
${SIMU_SRC_DIRECTORY}
${XSD_INCLUDE_DIR}
${COMPANION_SRC_DIRECTORY}/qxtcommandoptions
)
@@ -69,6 +116,7 @@ add_subdirectory(shared)
add_subdirectory(modeledit)
add_subdirectory(generaledit)
add_subdirectory(simulation)
add_subdirectory(firmwares/opentx/simulator)
add_subdirectory(qcustomplot)
add_subdirectory(qxtcommandoptions)
@@ -91,10 +139,9 @@ set(common_SRCS
appdata.cpp
)
qt5_wrap_cpp(common_SRCS)
qt4_wrap_cpp(common_SRCS)
add_library(common ${common_SRCS})
qt5_use_modules(common Core Xml Widgets)
set(companion_SRCS
hexinterface.cpp
@@ -189,11 +236,14 @@ set(companion_UIS
radionotfound.ui
)
set(companion_RESOURCES
set(companion_RCS
companion.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
)
today(DATE)
now(TIME)
configure_file(${COMPANION_SRC_DIRECTORY}/version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY)
configure_file(${COMPANION_SRC_DIRECTORY}/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @ONLY)
configure_file(${COMPANION_SRC_DIRECTORY}/companion.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop @ONLY)
@@ -214,25 +264,23 @@ foreach(language ${LANGUAGES})
set(companion_TS ${companion_TS} translations/companion_${language}.ts)
endforeach(language)
qt5_wrap_ui(companion_SRCS ${companion_UIS})
qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
qt5_add_translation(companion_QM ${companion_TS})
qt5_add_resources(companion_RCC ${companion_RESOURCES})
add_custom_target(gen_qrc DEPENDS ${companion_RCC})
set(companion_SRCS ${companion_SRCS})
qt4_wrap_ui(companion_SRCS ${companion_UIS})
qt4_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
qt4_add_translation(companion_QM ${companion_TS})
qt4_add_resources(companion_SRCS ${companion_RCS})
add_definitions(-DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}")
if(APPLE)
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_RCC} ${companion_QM})
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM})
# OS X compiler no longer automatically includes /Library/Frameworks in search path
set(CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks)
else()
add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_RCC} ${companion_QM})
add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM})
endif()
add_dependencies(${COMPANION_NAME} gen_qrc)
qt5_use_modules(${COMPANION_NAME} Core Widgets Network)
target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit simulation common qcustomplot shared ${PTHREAD_LIBRARY} ${SDL_LIBRARY})
target_link_libraries(${COMPANION_NAME} generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
############# Standalone simu ###############
@@ -246,68 +294,44 @@ set(simu_MOC_HDRS
modeledit/node.h
)
qt5_wrap_cpp(simu_SRCS ${simu_MOC_HDRS} )
set(simu_SRCS ${simu_SRCS})
qt4_wrap_cpp(simu_SRCS ${simu_MOC_HDRS})
qt4_add_resources(simu_SRCS companion.qrc) # TODO not needed
if(WIN32)
set(simu_SRCS ${simu_SRCS} icon.rc)
endif()
if(APPLE)
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS} ${companion_RCC})
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS})
else()
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS} ${companion_RCC})
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS})
endif()
add_dependencies(${SIMULATOR_NAME} gen_qrc)
# TODO not the same link command than companion?
target_link_libraries(${SIMULATOR_NAME} PRIVATE simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${OPENTX_SIMULATOR_LIBS})
target_link_libraries(${SIMULATOR_NAME} simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
############# Packaging ####################
message(STATUS ${CMAKE_BINARY_DIR} ${CMAKE_INSTALL_PREFIX}/bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${COMPANION_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${CMAKE_BINARY_DIR}/ DESTINATION ${SIMULATOR_LIB_PATH} USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN "libopentx-*.so"
PATTERN "CMakeFiles" EXCLUDE
PATTERN "_CPack_Packages" EXCLUDE
PATTERN "companion" EXCLUDE
PATTERN "radio" EXCLUDE
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop DESTINATION share/applications RENAME companion${C9X_NAME_SUFFIX}.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop DESTINATION share/applications RENAME simulator${C9X_NAME_SUFFIX}.desktop)
if(${CMAKE_INSTALL_PREFIX} MATCHES "/usr/local")
install(FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg)
install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
else()
install(FILES images/linuxicons/16x16/companion.png DESTINATION share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/22x22/companion.png DESTINATION share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/24x24/companion.png DESTINATION share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/32x32/companion.png DESTINATION share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/48x48/companion.png DESTINATION share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/128x128/companion.png DESTINATION share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/256x256/companion.png DESTINATION share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/512x512/companion.png DESTINATION share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/scalable/companion.svg DESTINATION share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg)
install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
endif()
install(FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png)
install(FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg)
install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
# Linux specific code
set(OperatingSystem "Linux")
elseif(WIN32)
get_target_property(QtCore_LOCATION Qt5::Core LOCATION)
get_filename_component(QT_DLL_DIR ${QtCore_LOCATION} PATH)
get_filename_component(SDL_DIR ${SDL_LIBRARY} PATH)
install(FILES ${QT_DLL_DIR}/icudt54.dll ${QT_DLL_DIR}/icuin54.dll ${QT_DLL_DIR}/icuuc54.dll ${QT_DLL_DIR}/Qt5Core.dll ${QT_DLL_DIR}/Qt5Gui.dll ${QT_DLL_DIR}/Qt5Widgets.dll ${QT_DLL_DIR}/Qt5Xml.dll ${QT_DLL_DIR}/Qt5Network.dll ${QT_DLL_DIR}/Qt5PrintSupport.dll ${QT_DLL_DIR}/Qt5Multimedia.dll ${SDL_DIR}/SDL.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>)
install(FILES ${QT_DLL_DIR}/icudt54.dll ${QT_DLL_DIR}/icuin54.dll ${QT_DLL_DIR}/icuuc54.dll ${QT_DLL_DIR}/Qt5Cored.dll ${QT_DLL_DIR}/Qt5Guid.dll ${QT_DLL_DIR}/Qt5Widgetsd.dll ${QT_DLL_DIR}/Qt5Xmld.dll ${QT_DLL_DIR}/Qt5Networkd.dll ${QT_DLL_DIR}/Qt5PrintSupportd.dll ${QT_DLL_DIR}/Qt5Multimediad.dll ${SDL_DIR}/SDL.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>)
endif()
else(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(WIN32)
if(MSVC)
@@ -335,7 +359,7 @@ if(WIN32)
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/companion/simulator-install.exe
COMMAND "${NSIS_EXE}" ARGS ${PROJECT_BINARY_DIR}/companion/simulator.nsi
DEPENDS simulator ${PROJECT_BINARY_DIR}/companion/simulator.nsi
DEPENDS simulator opentx-simulators ${PROJECT_BINARY_DIR}/companion/simulator.nsi
COMMENT "Simulator Windows NSIS Installer")
add_custom_target(installer
@@ -362,6 +386,7 @@ if(APPLE)
COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
COMMAND rsync -r ${XSD_INCLUDE_DIR}/.. companion.app/Contents/Frameworks/
COMMAND rsync -r /Library/Frameworks/SDL.framework companion.app/Contents/Frameworks/
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL companion.app/Contents/MacOS/companion
@@ -389,7 +414,7 @@ set(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
# The file stripping is deliberately disabled, with the stripped file we get
# The file stripping is deliberately disabled, with the stripped file we get
# very poor trace-backs from the users when they report Companion crash
set(CPACK_STRIP_FILES FALSE)
+1 -15
View File
@@ -312,8 +312,6 @@ QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
QString Profile::controlTypes() const { return _controlTypes; }
QString Profile::controlNames() const { return _controlNames; }
int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
@@ -344,8 +342,6 @@ void Profile::speaker (const QString x) { store(x, _speaker, "Speake
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::controlTypes (const QString x) { store(x, _controlTypes, "ControlTypes" ,"Profiles", QString("profile%1").arg(index));}
void Profile::controlNames (const QString x) { store(x, _controlNames, "ControlNames" ,"Profiles", QString("profile%1").arg(index));}
void Profile::txCurrentCalibration (const int x) { store(x, _txCurrentCalibration, "currentCalib","Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
@@ -382,8 +378,6 @@ Profile& Profile::operator=(const Profile& rhs)
speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() );
controlTypes ( rhs.controlTypes() );
controlNames ( rhs.controlNames() );
txCurrentCalibration ( rhs.txCurrentCalibration() );
gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() );
@@ -429,8 +423,6 @@ void Profile::initFwVariables()
_stickPotCalib = "";
_timeStamp = "";
_trainerCalib = "";
_controlTypes = "";
_controlNames = "";
_txCurrentCalibration = 0;
_gsStickMode = 0;
@@ -491,8 +483,6 @@ void Profile::flush()
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _controlTypes, "ControlTypes" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _controlNames, "ControlNames" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _txCurrentCalibration, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
@@ -605,10 +595,6 @@ void AppData::warningId (const int x) { store(x, _warningId,
// Constructor
AppData::AppData()
{
}
void AppData::init()
{
//Initialize the profiles
for (int i=0; i<MAX_PROFILES; i++)
@@ -740,7 +726,7 @@ void AppData::init()
// Load and store all variables. Use default values if setting values are missing
QString _tempString; // Do not touch. Do not change the settings version before a new verson update!
getset( _tempString, "settings_version" ,"220" ); // This is a version marker. Will be used to upgrade the settings later on.
getset( _tempString, "settings_version" ,"210" ); // This is a version marker. Will be used to upgrade the settings later on.
getset( _recentFiles, "recentFileList" ,"" );
getset( _mainWinGeo, "mainWindowGeometry" ,"" );
-7
View File
@@ -125,8 +125,6 @@ class Profile: protected CompStoreObj
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
QString _controlTypes;
QString _controlNames;
int _txCurrentCalibration;
int _gsStickMode;
int _ppmMultiplier;
@@ -158,8 +156,6 @@ class Profile: protected CompStoreObj
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
QString controlTypes() const;
QString controlNames() const;
int txCurrentCalibration() const;
int gsStickMode() const;
int ppmMultiplier() const;
@@ -190,8 +186,6 @@ class Profile: protected CompStoreObj
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void controlTypes (const QString);
void controlNames (const QString);
void txCurrentCalibration (const int);
void gsStickMode (const int);
void ppmMultiplier (const int);
@@ -384,7 +378,6 @@ class AppData: protected CompStoreObj
// Constructor
AppData();
void init();
};
extern AppData g;
+3 -3
View File
@@ -21,7 +21,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
getSettings();
populateProgrammers();
EEPROMInterface *eepromInterface = GetEepromInterface();
if (IS_STM32(eepromInterface->getBoard())) {
if (IS_TARANIS(eepromInterface->getBoard())) {
setWindowTitle(tr("DFU-UTIL Configuration"));
ui->avrArgs->hide();
ui->avrdude_location->hide();
@@ -310,7 +310,7 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
{
EEPROMInterface *eepromInterface = GetEepromInterface();
if (checked) {
if (IS_STM32(eepromInterface->getBoard())) {
if (IS_TARANIS(eepromInterface->getBoard())) {
ui->label_dfu2->show();
ui->dfuArgs->show();
}
@@ -327,7 +327,7 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
}
}
else {
if (IS_STM32(eepromInterface->getBoard())) {
if (IS_TARANIS(eepromInterface->getBoard())) {
ui->label_dfu2->hide();
ui->dfuArgs->hide();
}
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef BURNCONFIGDIALOG_H_
#define BURNCONFIGDIALOG_H_
#include <QtWidgets>
#include <QDialog>
#include <QtGui>
#define MEM_TYPE_EEPROM 1
#define MEM_TYPE_FLASH 2
+5 -5
View File
@@ -82,15 +82,12 @@ class MyProxyStyle : public QProxyStyle
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(companion);
QApplication app(argc, argv);
app.setApplicationName("OpenTX Companion");
app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org");
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
g.init();
QStringList strl = QApplication::arguments();
if (strl.contains("--version")) {
printf("%s\n", VERSION);
@@ -109,7 +106,7 @@ int main(int argc, char *argv[])
app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator);
// QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0;
@@ -134,7 +131,10 @@ int main(int argc, char *argv[])
}
QString splashScreen;
splashScreen = ":/images/splash.png";
if ( g.profile[g.id()].fwType().contains("taranis")) splashScreen = ":/images/splash-taranis.png";
else if ( g.profile[g.id()].fwType().contains("9xrpro")) splashScreen = ":/images/splash-9xrpro.png";
else if ( g.profile[g.id()].fwType().contains("9xr")) splashScreen = ":/images/splash-9xr.png";
else splashScreen = ":/images/splash-9x.png";
QPixmap pixmap = QPixmap(splashScreen);
QSplashScreen *splash = new QSplashScreen(pixmap);
+5 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE RCC><RCC version="1.0">
<RCC>
<qresource prefix="/">
<file>images/customize.png</file>
<file>icon.png</file>
@@ -54,7 +54,10 @@
<file>images/simulator/9X/9xcursdown.png</file>
<file>images/simulator/9X/9xcursphoto.png</file>
<file>images/screenshot.png</file>
<file>images/splash.png</file>
<file>images/splash-9x.png</file>
<file>images/splash-9xrpro.png</file>
<file>images/splash-9xr.png</file>
<file>images/splash-taranis.png</file>
<file>images/companion-title.png</file>
<file>images/maps.png</file>
<file>images/track.png</file>
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef _COMPAREDIALOG_H
#define _COMPAREDIALOG_H
#include <QtWidgets>
#include <QDialog>
#include <QLabel>
#include "multimodelprinter.h"
namespace Ui {
+1 -1
View File
@@ -3,7 +3,7 @@
#include "helpers.h"
ContributorsDialog::ContributorsDialog(QWidget * parent):
QDialog(parent),
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::HtmlDialog)
{
ui->setupUi(this);
+1 -1
View File
@@ -27,7 +27,7 @@ bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size));
if (!errors.test(ALL_OK)
if (!errors.test(NO_ERROR)
|| !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) {
return false;
}
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef CUSTOMIZESPLASHDIALOG_H
#define CUSTOMIZESPLASHDIALOG_H
#include <QtWidgets>
#include <QtGui>
#include <QDialog>
#include "firmwareinterface.h"
namespace Ui
+2
View File
@@ -1,5 +1,7 @@
#include "downloaddialog.h"
#include "ui_downloaddialog.h"
#include <QMessageBox>
#include <QtGui>
#include <QTime>
#include "helpers.h"
+2 -1
View File
@@ -1,12 +1,13 @@
#ifndef DOWNLOADDIALOG_H
#define DOWNLOADDIALOG_H
#include <QtWidgets>
#include <QDialog>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QFile>
namespace Ui {
class downloadDialog;
}
+14 -82
View File
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <list>
#include <float.h>
#include <QtWidgets>
#include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h"
@@ -1170,9 +1169,9 @@ GeneralSettings::GeneralSettings()
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok)
imperial=byte8u;
QString chars = t_CountrySet.mid(4, 2);
ttsLanguage[0] = chars[0].toLatin1();
ttsLanguage[1] = chars[1].toLatin1();
QString chars=t_CountrySet.mid(4,2);
ttsLanguage[0]=chars[0].toAscii();
ttsLanguage[1]=chars[1].toAscii();
}
}
}
@@ -1380,9 +1379,9 @@ void ModelData::clear()
moduleData[0].channelsCount = 8;
moduleData[1].channelsStart = 0;
moduleData[1].channelsCount = 8;
moduleData[0].ppm.delay = 300;
moduleData[1].ppm.delay = 300;
moduleData[2].ppm.delay = 300;
moduleData[0].ppmDelay = 300;
moduleData[1].ppmDelay = 300;
moduleData[2].ppmDelay = 300;
int board = GetEepromInterface()->getBoard();
if (IS_TARANIS(board)) {
moduleData[0].protocol = PULSES_PXX_XJT_X16;
@@ -1397,7 +1396,7 @@ void ModelData::clear()
moduleData[1].protocol = PULSES_OFF;
}
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
flightModeData[i].clear(i);
flightModeData[i].clear();
}
clearInputs();
clearMixes();
@@ -1510,7 +1509,9 @@ int ModelData::getTrimValue(int phaseIdx, int trimIdx)
}
else {
phaseIdx = phase.trimRef[trimIdx];
if (phase.trimMode[trimIdx] != 0)
if (phase.trimMode[trimIdx] == 0)
result = 0;
else
result += phase.trim[trimIdx];
}
}
@@ -1523,7 +1524,7 @@ bool ModelData::isGVarLinked(int phaseIdx, int gvarIdx)
return flightModeData[phaseIdx].gvars[gvarIdx] > 1024;
}
int ModelData::getGVarFieldValue(int phaseIdx, int gvarIdx)
int ModelData::getGVarValue(int phaseIdx, int gvarIdx)
{
int idx = flightModeData[phaseIdx].gvars[gvarIdx];
for (int i=0; idx>1024 && i<C9X_MAX_FLIGHT_MODES; i++) {
@@ -1684,7 +1685,7 @@ unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, eeprom, size));
if (result.test(ALL_OK)) {
if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
@@ -1704,7 +1705,7 @@ unsigned long LoadBackup(RadioData & radioData, uint8_t * eeprom, int size, int
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index));
if (result.test(ALL_OK)) {
if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
@@ -1725,7 +1726,7 @@ unsigned long LoadEepromXml(RadioData & radioData, QDomDocument & doc)
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadxml(radioData, doc));
if (result.test(ALL_OK)) {
if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
@@ -1765,33 +1766,6 @@ QString getBoardName(BoardEnum board)
}
}
const int Firmware::getFlashSize()
{
switch (board) {
case BOARD_STOCK:
return FSIZE_STOCK;
case BOARD_M128:
return FSIZE_M128;
case BOARD_MEGA2560:
case BOARD_GRUVIN9X:
return FSIZE_GRUVIN9X;
case BOARD_SKY9X:
return FSIZE_SKY9X;
case BOARD_9XRPRO:
case BOARD_AR9X:
return FSIZE_9XRPRO;
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
case BOARD_FLAMENCO:
return FSIZE_TARANIS;
case BOARD_HORUS:
return FSIZE_HORUS;
default:
return 0;
}
}
Firmware * GetFirmware(QString id)
{
foreach(Firmware * firmware, firmwares) {
@@ -1855,45 +1829,3 @@ SimulatorInterface *GetCurrentFirmwareSimulator()
else
return NULL;
}
unsigned int getNumSubtypes(MultiModuleRFProtocols type) {
switch (type) {
case MM_RF_PROTO_HISKY:
case MM_RF_PROTO_DSM2:
case MM_RF_PROTO_SYMAX:
case MM_RF_PROTO_KN:
return 2;
case MM_RF_PROTO_FRSKY:
case MM_RF_PROTO_CG023:
case MM_RF_PROTO_MT99XX:
return 3;
case MM_RF_PROTO_FLYSKY:
case MM_RF_PROTO_MJXQ:
return 4;
case MM_RF_PROTO_YD717:
return 5;
case MM_RF_PROTO_CX10:
case MM_RF_PROTO_CUSTOM:
return 8;
default:
return 1;
}
}
void FlightModeData::clear(const int phase)
{
memset(this, 0, sizeof(FlightModeData));
if (phase != 0) {
for (int idx=0; idx<C9X_MAX_GVARS; idx++) {
gvars[idx] = 1025;
}
for (int idx=0; idx<C9X_MAX_ENCODERS; idx++) {
rotaryEncoders[idx] = 1025;
}
}
}
+32 -86
View File
@@ -21,12 +21,11 @@
#include <QString>
#include <QStringList>
#include <QList>
#include <QtXml> // This should be removed from here, and remove Xml dependency from all libs which don't need it.
#include <QtXml>
#include <QComboBox>
#include <iostream>
#include <bitset>
#include "constants.h"
#include "../../radio/src/definitions.h"
#include "simulatorinterface.h"
#define EESIZE_STOCK 2048
@@ -37,15 +36,6 @@
#define EESIZE_9XRPRO (128*4096)
#define EESIZE_MAX EESIZE_9XRPRO
#define FSIZE_STOCK (64*1024)
#define FSIZE_M128 (128*1024)
#define FSIZE_GRUVIN9X (256*1024)
#define FSIZE_TARANIS (512*1024)
#define FSIZE_SKY9X (256*1024)
#define FSIZE_9XRPRO (512*1024)
#define FSIZE_HORUS (2048*1024)
#define FSIZE_MAX FSIZE_HORUS
QString getBoardName(BoardEnum board);
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
@@ -56,10 +46,7 @@ QString getBoardName(BoardEnum board);
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_TARANIS_X9E(board) (board==BOARD_TARANIS_X9E)
#define IS_HORUS(board) (board==BOARD_HORUS)
#define IS_FLAMENCO(board) (board==BOARD_FLAMENCO)
#define IS_STM32(board) (IS_TARANIS(board) || IS_HORUS(board) || IS_FLAMENCO(board))
#define IS_ARM(board) (IS_STM32(board) || IS_SKY9X(board))
#define IS_ARM(board) (IS_TARANIS(board) || IS_SKY9X(board))
const uint8_t modn12x3[4][4]= {
{1, 2, 3, 4},
@@ -145,11 +132,7 @@ enum FailsafeModes {
#define TRIM_RV_UP 5
#define TRIM_RH_L 6
#define TRIM_RH_R 7
#define TRIM_T5_DN 8
#define TRIM_T5_UP 9
#define TRIM_T6_DN 10
#define TRIM_T6_UP 11
#define TRIM_NONE 12
#define TRIM_NONE 8
// Beep center bits
#define BC_BIT_RUD (0x01)
@@ -163,6 +146,23 @@ enum FailsafeModes {
#define BC_BIT_REA (0x80)
#define BC_BIT_REB (0x100)
// TODO remove this enum!
enum EnumKeys {
KEY_MENU,
KEY_EXIT,
#if defined(PCBTARANIS)
KEY_ENTER,
KEY_PAGE,
KEY_PLUS,
KEY_MINUS,
#else
KEY_DOWN,
KEY_UP,
KEY_RIGHT,
KEY_LEFT,
#endif
};
#define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-."
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
@@ -632,7 +632,7 @@ class CustomFunctionData { // Function Switches data
class FlightModeData {
public:
FlightModeData() { clear(0); }
FlightModeData() { clear(); }
int trimMode[NUM_STICKS];
int trimRef[NUM_STICKS];
int trim[NUM_STICKS];
@@ -640,9 +640,9 @@ class FlightModeData {
char name[10+1];
unsigned int fadeIn;
unsigned int fadeOut;
int rotaryEncoders[C9X_MAX_ENCODERS];
int rotaryEncoders[2];
int gvars[C9X_MAX_GVARS];
void clear(const int phase);
void clear() { memset(this, 0, sizeof(FlightModeData)); }
};
class SwashRingData { // Swash Ring data
@@ -842,38 +842,9 @@ enum PulsesProtocol {
PULSES_PXX_XJT_LR12,
PULSES_PXX_DJT,
PULSES_CROSSFIRE,
PULSES_MULTIMODULE,
PULSES_PROTOCOL_LAST
};
enum MultiModuleRFProtocols {
MM_RF_PROTO_FLYSKY=0,
MM_RF_PROTO_FIRST=MM_RF_PROTO_FLYSKY,
MM_RF_PROTO_HUBSAN,
MM_RF_PROTO_FRSKY,
MM_RF_PROTO_HISKY,
MM_RF_PROTO_V2X2,
MM_RF_PROTO_DSM2,
MM_RF_PROTO_DEVO,
MM_RF_PROTO_YD717,
MM_RF_PROTO_KN,
MM_RF_PROTO_SYMAX,
MM_RF_PROTO_SLT,
MM_RF_PROTO_CX10,
MM_RF_PROTO_CG023,
MM_RF_PROTO_BAYANG,
MM_RF_PROTO_ESky,
MM_RF_PROTO_MT99XX,
MM_RF_PROTO_MJXQ,
MM_RF_PROTO_SHENQI,
MM_RF_PROTO_FY326,
MM_RF_PROTO_SFHSS,
MM_RF_PROTO_CUSTOM,
MM_RF_PROTO_LAST= MM_RF_PROTO_CUSTOM
};
unsigned int getNumSubtypes(MultiModuleRFProtocols type);
enum TrainerProtocol {
TRAINER_MASTER_JACK,
TRAINER_SLAVE_JACK,
@@ -887,39 +858,17 @@ class ModuleData {
ModuleData() { clear(); }
unsigned int modelId;
int protocol;
unsigned int subType;
bool invertedSerial;
int subprotocol;
unsigned int channelsStart;
int channelsCount; // 0=8 channels
unsigned int failsafeMode;
int failsafeChannels[C9X_NUM_CHNOUT];
// By pure coincidence the struct are unions with the same datatype in Companion
// and the firmware itself. If this changes the multi struct needs it own logic in the eeprom interface
union {
struct {
int delay;
bool pulsePol; // false = positive
bool outputType; // false = open drain, true = push pull
int frameLength;
} ppm;
struct {
int rfProtocol;
bool autoBindMode;
bool lowPowerMode;
int optionValue;
} multi;
};
// Currently the Eeprom read/write code does not work with unions
// define a hack for the multi rf Protocol to get the real numbers here
// (reverse the int => ms logic of the ppm delay)
int getMultiRfProtocol () { return (multi.rfProtocol - 300) / 50; }
void setMultiRfProtocol (int val) { multi.rfProtocol = 300 + 50 * val; }
int ppmDelay;
bool ppmPulsePol; // false = positive
bool ppmOutputType; // false = open drain, true = push pull
int ppmFrameLength;
void clear() { memset(this, 0, sizeof(ModuleData)); }
QString polarityToString() const { return ppm.pulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
QString polarityToString() const { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
};
#define C9X_MAX_SCRIPTS 7
@@ -1128,7 +1077,7 @@ class ModelData {
void setTrimValue(int phaseIdx, int trimIdx, int value);
bool isGVarLinked(int phaseIdx, int gvarIdx);
int getGVarFieldValue(int phaseIdx, int gvarIdx);
int getGVarValue(int phaseIdx, int gvarIdx);
ModelData removeGlobalVars();
@@ -1557,7 +1506,8 @@ void registerOpenTxFirmwares();
void unregisterOpenTxFirmwares();
enum EepromLoadErrors {
ALL_OK,
NO_ERROR,
UNKNOWN_ERROR,
UNSUPPORTED_NEWER_VERSION,
WRONG_SIZE,
@@ -1675,13 +1625,9 @@ class Firmware {
virtual int getCapability(const Capability) = 0;
virtual QTime getMaxTimerStart() = 0;
virtual bool isTelemetrySourceAvailable(int source) = 0;
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
const int getFlashSize();
public:
QList<const char *> languages;
+6 -34
View File
@@ -125,7 +125,7 @@ bool RleFile::searchFat()
uint32_t bestFatIndex = 0;
for (int i=0; i<EEPROM_ZONE_SIZE/EEPROM_FAT_SIZE; i++) {
EepromHeader * header = (EepromHeader *)(eeprom+i*EEPROM_FAT_SIZE);
if (header->mark == EEPROM_MARK && header->index >= bestFatIndex) {
if (header->mark == EEPROM_MARK && (int)header->index >= bestFatIndex) {
eepromFatHeader = header;
bestFatIndex = header->index;
}
@@ -236,9 +236,6 @@ void RleFile::EeFsSetDat(unsigned int blk, unsigned int ofs, const uint8_t *buf,
unsigned int RleFile::EeFsGetFree()
{
if (IS_HORUS(board))
return 0;
unsigned int ret = 0;
unsigned int i;
if (IS_ARM(board))
@@ -258,9 +255,6 @@ unsigned int RleFile::EeFsGetFree()
*/
void RleFile::EeFsFree(unsigned int blk)
{
if (IS_HORUS(board))
return;
unsigned int i = blk;
while (EeFsGetLink(i)) i = EeFsGetLink(i);
if (IS_ARM(board)) {
@@ -278,8 +272,6 @@ void RleFile::EeFsFree(unsigned int blk)
*/
unsigned int RleFile::EeFsAlloc()
{
if (IS_HORUS(board))
return 0;
unsigned int ret = (IS_ARM(board) ? eeFsArm->freeList : eeFs->freeList);
if (ret) {
if (IS_ARM(board))
@@ -293,18 +285,12 @@ unsigned int RleFile::EeFsAlloc()
unsigned int RleFile::size(unsigned int id)
{
if (IS_HORUS(board))
return 0;
else
return IS_ARM(board) ? eeFsArm->files[id].size : eeFs->files[id].size;
return IS_ARM(board) ? eeFsArm->files[id].size : eeFs->files[id].size;
}
unsigned int RleFile::openRd(unsigned int i_fileId)
{
if (IS_HORUS(board)) {
return 1;
}
else if (IS_SKY9X(board)) {
if (IS_SKY9X(board)) {
if (eepromFatHeader) {
m_fileId = eepromFatHeader->files[i_fileId].zoneIndex;
if (eepromFatHeader->files[i_fileId].exists) {
@@ -338,9 +324,6 @@ unsigned int RleFile::openRd(unsigned int i_fileId)
unsigned int RleFile::read(uint8_t *buf, unsigned int i_len)
{
if (IS_HORUS(board))
return 0;
unsigned int len = IS_ARM(board) ? eeFsArm->files[m_fileId].size : eeFs->files[m_fileId].size;
len -= m_pos;
if (i_len > len) i_len = len;
@@ -361,9 +344,6 @@ unsigned int RleFile::read(uint8_t *buf, unsigned int i_len)
// G: Read runlength (RLE) compressed bytes into buf.
unsigned int RleFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2)
{
if (IS_HORUS(board))
return 0;
memset(buf, 0, i_len);
if (IS_SKY9X(board)) {
@@ -436,11 +416,9 @@ unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersi
dst.resize(0);
for( ; 1; ) {
if (zeroes > 0) {
for (int i = 0; i < zeroes; i++)
dst.append((char) 0);
zeroes = 0;
}
for (int i=0; i<zeroes; i++)
dst.append((char)0);
zeroes = 0;
if (len == 0)
return dst.size();
@@ -547,9 +525,6 @@ void RleFile::closeTrunc()
unsigned int RleFile::writeRlc1(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len)
{
if (IS_HORUS(board))
return 0;
create(i_fileId, typ);
bool state0 = true;
uint8_t cnt = 0;
@@ -596,9 +571,6 @@ unsigned int RleFile::writeRlc1(unsigned int i_fileId, unsigned int typ, const u
*/
unsigned int RleFile::writeRlc2(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len)
{
if (IS_HORUS(board))
return 0;
if (IS_SKY9X(board)) {
openRd(i_fileId);
if (eepromFatHeader) {
+8 -16
View File
@@ -44,7 +44,7 @@ int getFileType(const QString &fullFileName)
}
FirmwareInterface::FirmwareInterface(const QString &filename):
flash(FSIZE_MAX, 0),
flash(MAX_FSIZE, 0),
flashSize(0),
versionId(0),
eepromVersion(0),
@@ -59,11 +59,11 @@ FirmwareInterface::FirmwareInterface(const QString &filename):
QFile file(filename);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
QTextStream inputStream(&file);
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), FSIZE_MAX);
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
file.close();
if (flashSize == 0) {
file.open(QIODevice::ReadOnly);
flashSize = file.read((char *)flash.data(), FSIZE_MAX);
flashSize = file.read((char *)flash.data(), MAX_FSIZE);
}
}
}
@@ -130,12 +130,10 @@ QString FirmwareInterface::seekLabel(const QString & label)
QString FirmwareInterface::getFlavour() const
{
if (flavour == "opentx-taranis-x9e")
return "opentx-x9e";
else if (flavour == "opentx-x9dp" || flavour == "opentx-taranis-plus")
return "opentx-x9d+";
else if (flavour == "opentx-taranis")
return "opentx-x9d";
if (flavour == "opentx-x9dp")
return "opentx-taranis-plus";
else if (flavour == "opentx-x9d")
return "opentx-taranis";
else
return flavour;
}
@@ -342,10 +340,7 @@ bool FirmwareInterface::isValid()
unsigned int FirmwareInterface::save(QString fileName)
{
uint8_t *binflash = (uint8_t*)malloc(FSIZE_MAX);
if (binflash == NULL) {
return -1;
}
uint8_t binflash[MAX_FSIZE];
memcpy(&binflash, flash.constData(), flashSize);
QFile file(fileName);
@@ -353,7 +348,6 @@ unsigned int FirmwareInterface::save(QString fileName)
if (fileType == FILE_TYPE_HEX) {
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { //reading HEX TEXT file
free(binflash);
return -1;
}
QTextStream outputStream(&file);
@@ -362,7 +356,6 @@ unsigned int FirmwareInterface::save(QString fileName)
}
else {
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { //reading HEX TEXT file
free(binflash);
return -1;
}
file.write((char*)binflash, flashSize);
@@ -370,6 +363,5 @@ unsigned int FirmwareInterface::save(QString fileName)
file.close();
free(binflash);
return flashSize;
}
+1
View File
@@ -19,6 +19,7 @@
#include <QImage>
#include <QByteArray>
#define MAX_FSIZE (512*1024)
#define SPLASH_WIDTH (128)
#define SPLASH_HEIGHT (64)
#define SPLASHX9D_WIDTH (212)
+3 -3
View File
@@ -373,17 +373,17 @@ t_Er9xModelData::operator ModelData ()
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppm.frameLength=ppmFrameLength;
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.customFn[0].func = FuncInstantTrim;
if (trimSw) {
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
}
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
@@ -114,7 +114,7 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
}
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -186,7 +186,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -261,7 +261,7 @@ QDomElement Er9xInterface::getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral *
{
QDomElement gd = qdoc->createElement("GENERAL_DATA");
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here
appendTextElement(qdoc, &gd, "Owner", QString::fromLatin1(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Er9xGeneral));
return gd;
}
@@ -271,7 +271,7 @@ QDomElement Er9xInterface::getModelDataXML(QDomDocument * qdoc, Er9xModelData *
QDomElement md = qdoc->createElement("MODEL_DATA");
md.setAttribute("number", modelNum);
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here
appendTextElement(qdoc, &md, "Name", QString::fromLatin1(tmod->name,sizeof(tmod->name)).trimmed());
appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed());
appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Er9xModelData));
return md;
}
@@ -289,7 +289,7 @@ bool Er9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen)
while (!n.isNull()) {
if (n.isCDATASection()) {
QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
const char * data = ba.data();
memcpy(tgen, data, sizeof(Er9xGeneral));
break;
@@ -326,7 +326,7 @@ bool Er9xInterface::loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod,
while (!n.isNull()) {
if (n.isCDATASection()) {
QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
const char * data = ba.data();
memcpy(tmod, data, sizeof(Er9xModelData));
break;
@@ -19,14 +19,13 @@
#define SIMU
#define SIMU_EXCEPTIONS
#define TELEMETRY_FRSKY
#define FRSKY
#define PHASES
#undef min
#undef max
#define NUM_POTS 3
#define NUM_SLIDERS 0
#define SWSRC_SW1 DSW_SW1
#define NUM_POTS 3
#define SWSRC_SW1 DSW_SW1
#include <exception>
@@ -48,7 +47,7 @@ namespace Er9x {
uint8_t pxxFlag = 0;
int16_t g_anas[7];
#define isBacklightEnabled() (PORTB & (1<<OUT_B_LIGHT))
#define isBacklightEnable() (PORTB & (1<<OUT_B_LIGHT))
uint16_t anaIn(uint8_t chan)
{
@@ -152,7 +151,7 @@ void simuSetKey(uint8_t key, bool state)
}
}
#define isBacklightEnabled() (PORTB & (1<<OUT_B_LIGHT))
#define isBacklightEnable() (PORTB & (1<<OUT_B_LIGHT))
}
@@ -54,7 +54,7 @@ class Er9xSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) { return 0; };
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
@@ -505,17 +505,17 @@ t_Ersky9xModelData_v10::operator ModelData ()
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppm.frameLength=ppmFrameLength;
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.customFn[0].func = FuncInstantTrim;
if (trimSw) {
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
}
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
@@ -620,17 +620,17 @@ t_Ersky9xModelData_v11::operator ModelData ()
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppm.frameLength=ppmFrameLength;
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.customFn[0].func = FuncInstantTrim;
if (trimSw) {
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
}
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
@@ -152,7 +152,7 @@ unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
}
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -230,7 +230,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -305,7 +305,7 @@ QDomElement Ersky9xInterface::getGeneralDataXML(QDomDocument * qdoc, Ersky9xGene
{
QDomElement gd = qdoc->createElement("GENERAL_DATA");
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here
appendTextElement(qdoc, &gd, "Owner", QString::fromLatin1(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Ersky9xGeneral));
return gd;
}
@@ -315,7 +315,7 @@ QDomElement Ersky9xInterface::getModelDataXML(QDomDocument * qdoc, Ersky9xModelD
QDomElement md = qdoc->createElement("MODEL_DATA");
md.setAttribute("number", modelNum);
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here
appendTextElement(qdoc, &md, "Name", QString::fromLatin1(tmod->name,sizeof(tmod->name)).trimmed());
appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed());
appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Ersky9xModelData_v11));
return md;
}
@@ -333,7 +333,7 @@ bool Ersky9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral *
while (!n.isNull()) {
if (n.isCDATASection()) {
QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
const char * data = ba.data();
memcpy(tgen, data, std::min((unsigned int)ba.size(), (unsigned int)sizeof(Ersky9xGeneral)));
break;
@@ -373,7 +373,7 @@ bool Ersky9xInterface::loadModelDataXML(QDomDocument * qdoc, ModelData *model, i
while (!n.isNull()) {
if (n.isCDATASection()) {
QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
const char * data = ba.data();
memcpy(&ersky9xModel, data, std::min(ba.size(), (int)sizeof(ersky9xModel)));
break;
@@ -22,7 +22,7 @@
#define PCBSKY9X
#define PCBSKY
#define STAMP
#define TELEMETRY_FRSKY
#define FRSKY
#define FRSKY_HUB
#define WS_HOW_HIGH
#define TEMPLATES
@@ -31,9 +31,8 @@
#define AUDIO
#define REVB
#define NUM_POTS 3
#define NUM_SLIDERS 0
#define SWSRC_SW1 DSW_SW1
#define NUM_POTS 3
#define SWSRC_SW1 DSW_SW1
#undef min
#undef max
@@ -59,7 +58,7 @@ namespace Ersky9x {
#include "../ersky9x/sound.cpp"
#include "../ersky9x/diskio.cpp"
#define isBacklightEnabled() (PWM->PWM_CH_NUM[0].PWM_CDTY != 100)
#define isBacklightEnable() (PWM->PWM_CH_NUM[0].PWM_CDTY != 100)
//uint8_t pxxFlag = 0;
int16_t g_anas[7];
@@ -54,7 +54,7 @@ class Ersky9xSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) { return 0; };
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
@@ -447,9 +447,9 @@ t_Gruvin9xModelData_v102::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.flightModeData[i] = flightModeData[i];
@@ -517,9 +517,9 @@ t_Gruvin9xModelData_v103::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.flightModeData[i] = flightModeData[i];
@@ -587,9 +587,9 @@ t_Gruvin9xModelData_v105::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
@@ -677,9 +677,9 @@ t_Gruvin9xModelData_v106::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
@@ -207,7 +207,7 @@ unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eepro
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -455,9 +455,9 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -499,7 +499,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -533,9 +533,9 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -578,7 +578,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.frsky.varioSource = varioSource;
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -615,9 +615,9 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -661,7 +661,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -698,9 +698,9 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -744,7 +744,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -785,9 +785,9 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -831,7 +831,7 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -735,9 +735,9 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<9; i++) {
@@ -780,7 +780,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.frsky.varioSource = varioSource;
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -818,9 +818,9 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<9; i++) {
@@ -864,7 +864,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -902,9 +902,9 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<9; i++) {
@@ -948,7 +948,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -986,9 +986,9 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<9; i++) {
@@ -1032,7 +1032,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
@@ -1073,9 +1073,9 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<9; i++) {
@@ -1119,7 +1119,7 @@ t_Open9xArmModelData_v212::operator ModelData ()
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -932,9 +932,9 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1006,9 +1006,9 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter,
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1052,7 +1052,7 @@ t_Open9xModelData_v202::operator ModelData ()
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -1082,9 +1082,9 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1126,7 +1126,7 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -1156,9 +1156,9 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1202,7 +1202,7 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.rssiAlarms[0] = frskyRssiAlarms[0].get(0);
c9x.frsky.rssiAlarms[1] = frskyRssiAlarms[1].get(1);
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
@@ -1235,9 +1235,9 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1279,7 +1279,7 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0]. modelId = modelId;
c9x.frsky.screens[1].type = 0;
@@ -1314,9 +1314,9 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1362,7 +1362,7 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
c9x.frsky.screens[1].type = 0;
@@ -1400,9 +1400,9 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1449,7 +1449,7 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
c9x.frsky.screens[1].type = 0;
@@ -1487,9 +1487,9 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1536,7 +1536,7 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
@@ -1575,9 +1575,9 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.thrTrim = thrTrim;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.moduleData[0].ppmPulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
@@ -1624,7 +1624,7 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
+80 -107
View File
@@ -26,7 +26,7 @@
#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? (version >= 216 ? 64 : 32) : (IS_DBLEEPROM(board, version) ? 24 : 16))
#define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : 8)
#define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
#define MAX_TELEMETRY_SENSORS(board, version) (32)
#define MAX_SENSORS(board, version) (32)
#define NUM_PPM_INPUTS(board, version) ((IS_ARM(board) && version >= 216) ? 16 : 8)
#define ROTENC_COUNT(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 218) ? 0 : 1) : (IS_2560(board) ? 2 : 0))
@@ -183,7 +183,7 @@ class SwitchesConversionTable: public ConversionTable {
internalCache.push_back(element);
return element.table;
}
static void Cleanup()
static void Cleanup()
{
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
@@ -370,7 +370,7 @@ class SourcesConversionTable: public ConversionTable {
internalCache.push_back(element);
return element.table;
}
static void Cleanup()
static void Cleanup()
{
for (std::list<Cache>::iterator it=internalCache.begin(); it!=internalCache.end(); it++) {
Cache element = *it;
@@ -384,7 +384,7 @@ std::list<SourcesConversionTable::Cache> SourcesConversionTable::internalCache;
void OpenTxEepromCleanup(void)
{
SourcesConversionTable::Cleanup();
SourcesConversionTable::Cleanup();
SwitchesConversionTable::Cleanup();
}
@@ -392,8 +392,8 @@ template <int N>
class SwitchField: public ConversionField< SignedField<N> > {
public:
SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0):
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toLatin1(),
QObject::tr("Switch ").toLatin1()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toLatin1()),
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toAscii(),
QObject::tr("Switch ").toAscii()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toAscii()),
sw(sw),
_switch(0)
{
@@ -408,14 +408,14 @@ class SwitchField: public ConversionField< SignedField<N> > {
_switch = sw.toValue();
ConversionField< SignedField<N> >::beforeExport();
}
virtual void afterImport()
{
ConversionField< SignedField<N> >::afterImport();
ConversionField< SignedField<N> >::afterImport();
sw = RawSwitch(_switch);
eepromImportDebug() << QString("imported %1: %2").arg(ConversionField< SignedField<N> >::internalField.getName()).arg(sw.toString());
}
}
protected:
RawSwitch & sw;
int _switch;
@@ -553,7 +553,7 @@ template <int N>
class SourceField: public ConversionField< UnsignedField<N> > {
public:
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
"Source", QObject::tr("Source %1 cannot be exported on this board!").arg(source.toString())),
source(source),
_source(0)
@@ -569,13 +569,13 @@ class SourceField: public ConversionField< UnsignedField<N> > {
_source = source.toValue();
ConversionField< UnsignedField<N> >::beforeExport();
}
virtual void afterImport()
{
ConversionField< UnsignedField<N> >::afterImport();
ConversionField< UnsignedField<N> >::afterImport();
source = RawSource(_source);
eepromImportDebug() << QString("imported %1: %2").arg(ConversionField< UnsignedField<N> >::internalField.getName()).arg(source.toString());
}
}
protected:
RawSource & source;
@@ -742,14 +742,6 @@ class CurveReferenceField: public TransformedField {
int _curve_value;
};
static int exportHeliInversionWeight(int source) {
return (source < 0) ? 1 : 0;
}
static int importHeliInversionWeight(int source) {
return source ? -100: 100;
}
class HeliField: public StructField {
public:
HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant)
@@ -765,15 +757,22 @@ class HeliField: public StructField {
Append(new SignedField<8>(heli.elevatorWeight));
}
else {
Append(new ConversionField< SignedField<1> >(heli.elevatorWeight, exportHeliInversionWeight, importHeliInversionWeight));
Append(new ConversionField< SignedField<1> >(heli.aileronWeight, exportHeliInversionWeight, importHeliInversionWeight));
Append(new ConversionField< SignedField<1> >(heli.collectiveWeight, exportHeliInversionWeight, importHeliInversionWeight));
Append(new BoolField<1>(invertELE));
Append(new BoolField<1>(invertAIL));
Append(new BoolField<1>(invertCOL));
Append(new UnsignedField<5>(heli.type));
Append(new SourceField<8>(heli.collectiveSource, board, version, variant));
//, FLAG_NOSWITCHES)); Fix shift in collective
Append(new UnsignedField<8>(heli.value));
}
}
// TODO before + after
protected:
bool invertELE;
bool invertAIL;
bool invertCOL;
};
class FlightModeField: public TransformedField {
@@ -1466,13 +1465,7 @@ class CurvesField: public TransformedField {
maxPoints(IS_ARM(board) ? 512 : 112-8)
{
for (int i=0; i<maxCurves; i++) {
if (IS_TARANIS(board) && version >= 218) {
internalField.Append(new UnsignedField<1>((unsigned int &)curves[i].type));
internalField.Append(new BoolField<1>(curves[i].smooth));
internalField.Append(new ConversionField< SignedField<6> >(curves[i].count, -5));
internalField.Append(new ZCharField<3>(curves[i].name));
}
else if (IS_TARANIS(board) && version >= 216) {
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<3>((unsigned int &)curves[i].type));
internalField.Append(new BoolField<1>(curves[i].smooth));
internalField.Append(new SpareBitsField<4>());
@@ -1629,7 +1622,7 @@ class AndSwitchesConversionTable: public ConversionTable {
{
int val=0;
addConversion(RawSwitch(SWITCH_TYPE_NONE), val++);
if (IS_TARANIS(board)) {
for (int i=1; i<=MAX_SWITCHES_POSITION(board, version); i++) {
int s = switchIndex(i, board, version);
@@ -1774,7 +1767,7 @@ class LogicalSwitchField: public TransformedField {
}
}
~LogicalSwitchField()
~LogicalSwitchField()
{
delete andswitchesConversionTable;
}
@@ -2120,7 +2113,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.swtch.type != SWITCH_TYPE_NONE) {
_func = fn.func;
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
else
_active = (fn.enabled ? 1 : 0);
@@ -2216,7 +2209,7 @@ class ArmCustomFunctionField: public TransformedField {
{
fn.func = (AssignFunc)_func;
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic)
fn.repeatParam = (version >= 216 ? _active : (_active*5));
else
fn.enabled = (_active & 0x01);
@@ -2233,7 +2226,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
fn.func = AssignFunc(fn.func + index);
fn.param = (int16_t)(uint16_t)value;
fn.param = (int8_t)value;
}
else if (fn.func >= FuncSetTimer1 && fn.func <= FuncSetTimer3) {
fn.func = AssignFunc(fn.func + index);
@@ -2536,7 +2529,7 @@ class FrskyScreenField: public DataField {
else
numbers.Append(new SpareBitsField<4*8>());
}
if (IS_TARANIS(board) && version >= 217) {
script.Append(new CharField<8>(screen.body.script.filename));
script.Append(new SpareBitsField<16*8>());
@@ -2885,7 +2878,7 @@ class SensorField: public TransformedField {
_instance = sensor.formula;
if (sensor.formula == SensorData::TELEM_FORMULA_CELL)
_param = (sensor.source) + (sensor.index << 8);
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_AVERAGE || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
_param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24);
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
_param = (sensor.gps) + (sensor.alt << 8);
@@ -2907,7 +2900,7 @@ class SensorField: public TransformedField {
sensor.formula = _instance;
if (sensor.formula == SensorData::TELEM_FORMULA_CELL)
(sensor.source = _sources[0], sensor.index = _sources[1]);
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_AVERAGE || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
for (int i=0; i<4; ++i)
sensor.sources[i] = _sources[i];
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
@@ -3056,14 +3049,14 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216))
internalField.Append(new BoolField<1>(modelData.displayChecklist));
else
internalField.Append(new BoolField<1>(modelData.moduleData[0].ppm.pulsePol));
internalField.Append(new BoolField<1>(modelData.moduleData[0].ppmPulsePol));
internalField.Append(new BoolField<1>(modelData.extendedLimits));
internalField.Append(new BoolField<1>(modelData.extendedTrims));
internalField.Append(new BoolField<1>(modelData.throttleReversed));
if (!IS_ARM(board) || version < 216) {
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].ppm.delay, exportPpmDelay, importPpmDelay));
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].ppmDelay, exportPpmDelay, importPpmDelay));
}
if (IS_ARM(board) || IS_2560(board))
@@ -3092,7 +3085,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
if (!IS_ARM(board) || version < 216) {
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppm.frameLength));
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
}
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc, "Throttle Source"));
@@ -3171,38 +3164,36 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 215) {
for (int module=0; module<modulesCount; module++) {
if (version >= 217) {
internalField.Append(new ConversionField<SignedField<4> >(modelData.moduleData[module].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
internalField.Append(new ConversionField< SignedField<4> >(modelData.moduleData[module].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
internalField.Append(new SignedField<4>(subprotocols[module]));
}
else {
internalField.Append(new SignedField<8>(subprotocols[module]));
}
internalField.Append(new UnsignedField<8>(modelData.moduleData[module].channelsStart));
internalField.Append(new ConversionField<SignedField<8> >(modelData.moduleData[module].channelsCount, -8));
if (version >= 217) {
internalField.Append(new UnsignedField<4>(modelData.moduleData[module].failsafeMode));
internalField.Append(new UnsignedField<3>(modelData.moduleData[module].subType));
internalField.Append(new BoolField<1>(modelData.moduleData[module].invertedSerial));
} else
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[module].channelsCount, -8));
if (version >= 217)
internalField.Append(new UnsignedField<8>(modelData.moduleData[module].failsafeMode));
else
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.moduleData[module].failsafeMode, -1));
for (int i=0; i<32; i++) {
internalField.Append(new SignedField<16>(modelData.moduleData[module].failsafeChannels[i]));
}
if (version >= 217) {
internalField.Append(new ConversionField< SignedField<6> >(modelData.moduleData[module].ppm.delay, exportPpmDelay, importPpmDelay));
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppm.pulsePol));
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppm.outputType));
internalField.Append(new SignedField<8>(modelData.moduleData[module].ppm.frameLength));
internalField.Append(new ConversionField< SignedField<6> >(modelData.moduleData[module].ppmDelay, exportPpmDelay, importPpmDelay));
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppmPulsePol));
internalField.Append(new BoolField<1>(modelData.moduleData[module].ppmOutputType));
internalField.Append(new SignedField<8>(modelData.moduleData[module].ppmFrameLength));
}
else {
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[module].ppm.delay, exportPpmDelay, importPpmDelay));
internalField.Append(new SignedField<8>(modelData.moduleData[module].ppm.frameLength));
internalField.Append(new BoolField<8>(modelData.moduleData[module].ppm.pulsePol));
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[module].ppmDelay, exportPpmDelay, importPpmDelay));
internalField.Append(new SignedField<8>(modelData.moduleData[module].ppmFrameLength));
internalField.Append(new BoolField<8>(modelData.moduleData[module].ppmPulsePol));
}
}
}
if (IS_TARANIS(board) && version < 218) {
if (IS_TARANIS(board)) {
for (int i=0; i<MAX_CURVES(board, version); i++) {
internalField.Append(new ZCharField<6>(modelData.curves[i].name));
}
@@ -3230,13 +3221,13 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
}
}
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++) {
internalField.Append(new ZCharField<4>(modelData.inputNames[i]));
}
}
if (IS_ARM(board) && version >= 217) {
for (int i=0; i<8; i++) {
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
@@ -3258,7 +3249,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 216) {
for (int i=0; i < MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
}
}
}
if (IS_ARM(board) && version == 216) {
@@ -3271,7 +3262,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
if (IS_ARM(board) && version >= 217) {
for (int i=0; i<MAX_TELEMETRY_SENSORS(board, version); ++i) {
for (int i=0; i<MAX_SENSORS(board, version); ++i) {
internalField.Append(new SensorField(modelData.sensorData[i], board, version));
}
}
@@ -3378,9 +3369,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
internalField.Append(new SignedField<8>(generalData.backlightMode));
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<NUM_STICKS; i++)
internalField.Append(new SignedField<16>(generalData.trainer.calib[i]));
}
for (int i=0; i<NUM_STICKS; i++) {
internalField.Append(new UnsignedField<6>(generalData.trainer.mix[i].src));
internalField.Append(new UnsignedField<2>(generalData.trainer.mix[i].mode));
@@ -3389,7 +3379,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.view, 0, MAX_VIEWS(board)-1));
internalField.Append(new SpareBitsField<2>()); // TODO buzzerMode?
internalField.Append(new SpareBitsField<2>());
internalField.Append(new BoolField<1>(generalData.fai));
internalField.Append(new SignedField<2>((int &)generalData.beeperMode));
internalField.Append(new BoolField<1>(generalData.flashBeep));
@@ -3406,18 +3396,13 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
internalField.Append(new UnsignedField<8>(generalData.inactivityTimer));
if (IS_9X(board)) {
if (version >= 215) {
internalField.Append(new UnsignedField<3>(generalData.mavbaud));
}
else {
internalField.Append(new SpareBitsField<1>());
internalField.Append(new BoolField<1>(generalData.minuteBeep));
internalField.Append(new BoolField<1>(generalData.preBeep));
}
if (IS_9X(board) && version >= 215) {
internalField.Append(new UnsignedField<3>(generalData.mavbaud));
}
else {
internalField.Append(new SpareBitsField<3>());
internalField.Append(new SpareBitsField<1>());
internalField.Append(new BoolField<1>(generalData.minuteBeep));
internalField.Append(new BoolField<1>(generalData.preBeep));
}
if (version >= 216 && IS_TARANIS(board))
internalField.Append(new SignedField<3>(generalData.splashDuration));
@@ -3430,19 +3415,20 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
if (IS_ARM(board))
internalField.Append(new SignedField<8>(generalData.switchesDelay));
else
internalField.Append(new SpareBitsField<8>()); // TODO blOffBright + blOnBright
internalField.Append(new SpareBitsField<8>());
internalField.Append(new UnsignedField<8>(generalData.backlightDelay));
internalField.Append(new UnsignedField<8>(generalData.templateSetup));
internalField.Append(new SignedField<8>(generalData.PPM_Multiplier));
internalField.Append(new SignedField<8>(generalData.hapticLength));
if (version < 216 || (version < 218 && !IS_9X(board)) || (!IS_9X(board) && !IS_TARANIS(board))) {
if (version < 216 || !IS_9X(board)) {
internalField.Append(new UnsignedField<8>(generalData.reNavigation));
}
if (version >= 216 && !IS_TARANIS(board)) {
internalField.Append(new UnsignedField<8>(generalData.stickReverse));
internalField.Append(new UnsignedField<4>(generalData.stickReverse));
internalField.Append(new SpareBitsField<4>());
}
internalField.Append(new SignedField<3>(generalData.beeperLength));
@@ -3464,46 +3450,33 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(generalData.backlightBright));
if (version < 218) internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
if (version >= 213) {
if (version < 218) internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
if (version < 218) internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
if (version < 218) internalField.Append(new UnsignedField<16>(generalData.mAhUsed));
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
internalField.Append(new UnsignedField<16>(generalData.mAhUsed));
internalField.Append(new UnsignedField<32>(generalData.globalTimer));
if (version < 218) internalField.Append(new SignedField<8>(generalData.temperatureCalib)); // TODO
internalField.Append(new SignedField<8>(generalData.temperatureCalib)); // TODO
internalField.Append(new UnsignedField<8>(generalData.btBaudrate)); // TODO
if (version < 218) internalField.Append(new BoolField<8>(generalData.optrexDisplay)); //TODO
if (version < 218) internalField.Append(new UnsignedField<8>(generalData.sticksGain)); // TODO
internalField.Append(new BoolField<8>(generalData.optrexDisplay)); //TODO
internalField.Append(new UnsignedField<8>(generalData.sticksGain)); // TODO
}
if (version >= 214) {
if (version < 218) internalField.Append(new UnsignedField<8>(generalData.rotarySteps)); // TODO
internalField.Append(new UnsignedField<8>(generalData.rotarySteps)); // TODO
internalField.Append(new UnsignedField<8>(generalData.countryCode));
internalField.Append(new UnsignedField<8>(generalData.imperial));
}
if (version >= 215) {
internalField.Append(new CharField<2>(generalData.ttsLanguage));
if (version < 218) {
internalField.Append(new SignedField<8>(generalData.beepVolume));
internalField.Append(new SignedField<8>(generalData.wavVolume));
internalField.Append(new SignedField<8>(generalData.varioVolume));
}
else {
internalField.Append(new SignedField<4>(generalData.beepVolume));
internalField.Append(new SignedField<4>(generalData.wavVolume));
internalField.Append(new SignedField<4>(generalData.varioVolume));
internalField.Append(new SignedField<4>(generalData.backgroundVolume));
}
internalField.Append(new SignedField<8>(generalData.beepVolume));
internalField.Append(new SignedField<8>(generalData.wavVolume));
internalField.Append(new SignedField<8>(generalData.varioVolume));
if (version >= 216) {
internalField.Append(new SignedField<8>(generalData.varioPitch));
internalField.Append(new SignedField<8>(generalData.varioRange));
internalField.Append(new SignedField<8>(generalData.varioRepeat));
}
if (version < 218) internalField.Append(new SignedField<8>(generalData.backgroundVolume));
}
if (version >= 218) {
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
internalField.Append(new ArmCustomFunctionField(generalData.customFn[i], board, version, variant));
}
internalField.Append(new SignedField<8>(generalData.backgroundVolume));
}
if (IS_TARANIS(board) && version >= 216) {
if (version >= 217) {
@@ -3529,11 +3502,11 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
if (IS_TARANIS_X9E(board))
internalField.Append(new SpareBitsField<64>()); // switchUnlockStates
internalField.Append(new SpareBitsField<64>());
else if (IS_TARANIS(board))
internalField.Append(new SpareBitsField<16>()); // switchUnlockStates
if (version == 217) {
internalField.Append(new SpareBitsField<16>());
if (version >= 217) {
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
internalField.Append(new ArmCustomFunctionField(generalData.customFn[i], board, version, variant));
}
@@ -83,7 +83,6 @@ class ProtocolsConversionTable: public ConversionTable
}
if (IS_TARANIS(board)) {
addConversion(PULSES_CROSSFIRE, val++);
addConversion(PULSES_MULTIMODULE, val++);
}
}
};
+154 -168
View File
@@ -393,7 +393,7 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *e
}
}
std::cout << " ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -813,16 +813,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
}
}
QTime OpenTxFirmware::getMaxTimerStart()
{
if (IS_TARANIS(board) || IS_HORUS(board))
return QTime(23, 59, 59);
else if (IS_ARM(board))
return QTime(8, 59, 59);
else
return QTime(0, 59, 59);
}
bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
{
if (IS_TARANIS(board) && (source == TELEMETRY_SOURCE_RSSI_TX))
@@ -865,8 +855,6 @@ int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
case PULSES_DSMX:
case PULSES_CROSSFIRE:
return 1;
case PULSES_MULTIMODULE:
return id.contains("multimodule") ? 1 : 0;
default:
return 0;
}
@@ -985,7 +973,7 @@ EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version)
return NOT_OPENTX;
}
return ALL_OK;
return NO_ERROR;
}
bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant)
@@ -1093,7 +1081,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *e
}
std::cout << " ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
@@ -1109,12 +1097,25 @@ QString OpenTxFirmware::getFirmwareBaseUrl()
QString OpenTxFirmware::getFirmwareUrl()
{
QString url = getFirmwareBaseUrl();
QByteArray data = QUrl::toPercentEncoding(id);
if (IS_ARM(board))
url.append(QString("/getfw.php?fw=%1.bin").arg((QString)data));
else
url.append(QString("/getfw.php?fw=%1.hex").arg((QString)data));
switch (board) {
case BOARD_STOCK:
case BOARD_M128:
case BOARD_GRUVIN9X:
case BOARD_MEGA2560:
url.append(QString("/getfw.php?fw=%1.hex").arg(id));
break;
case BOARD_SKY9X:
case BOARD_AR9X:
case BOARD_9XRPRO:
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
url.append(QString("/getfw.php?fw=%1.bin").arg(id));
break;
default:
url.clear();
break;
}
return url;
}
@@ -1135,6 +1136,7 @@ QString OpenTxFirmware::getStampUrl()
void addOpenTxCommonOptions(OpenTxFirmware * firmware)
{
firmware->addOption("ppmus", QObject::tr("Channel values displayed in us"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
firmware->addOption("nooverridech", QObject::tr("No OverrideCH functions available"));
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE (no telemetry) at field") }, { "faimode", QObject::tr("FAI MODE (no telemetry) always enabled") }, { NULL } };
firmware->addOptions(fai_options);
@@ -1149,10 +1151,8 @@ void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
Option usb_options[] = { { "massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)") }, { "cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface") }, { NULL } };
firmware->addOptions(usb_options);
firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views"));
firmware->addOption("eu", QObject::tr("Removes D8 FrSky protocol support which is not legal for use in the EU on radios sold after Jan 1st, 2015"));
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015"));
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
firmware->addOption("multimodule", QObject::tr("Support for the DIY-Multiprotocol-TX-Module"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
}
void addOpenTxLcdOptions(OpenTxFirmware * firmware)
@@ -1162,7 +1162,6 @@ void addOpenTxLcdOptions(OpenTxFirmware * firmware)
{ "ST7565R", QObject::tr("ST7565R LCD or compatible") },
{ "ERC12864FSF", QObject::tr("ERC12864FSF LCD") },
{ "ST7920", QObject::tr("ST7920 LCD") },
{ "KS108", QObject::tr("KS108 LCD") },
{ NULL }
};
firmware->addOptions(lcd_options);
@@ -1177,124 +1176,8 @@ void registerOpenTxFirmwares()
Option nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } };
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
/* Taranis Plus board */
firmware = new OpenTxFirmware("opentx-x9d+", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis board */
firmware = new OpenTxFirmware("opentx-x9d", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis X9E board */
firmware = new OpenTxFirmware("opentx-x9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Horus board */
firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS);
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
Option usb_options[] = { { "massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)") }, { "cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface") }, { NULL } };
firmware->addOptions(usb_options);
firmware->addOption("multimodule", QObject::tr("Support for the DIY-Multiprotocol-TX-Module"));
addOpenTxCommonOptions(firmware);
firmware->addOption("pcbdev", QObject::tr("Use ONLY with first DEV pcb version"));
firmwares.push_back(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("Turnigy 9XR with m128 chip"), BOARD_M128);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("Turnigy 9XR"), BOARD_STOCK);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
firmware->addOption("novario", QObject::tr("No vario support"));
firmware->addOption("nogps", QObject::tr("No GPS support"));
firmware->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9x board */
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X with stock board"), BOARD_STOCK);
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X board"), BOARD_STOCK);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1326,12 +1209,11 @@ void registerOpenTxFirmwares()
firmware->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
firmware->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9x board with M128 chip */
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("9X with stock board and m128 chip"), BOARD_M128);
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("M128 / 9X board"), BOARD_M128);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1357,58 +1239,72 @@ void registerOpenTxFirmwares()
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("9X with AR9X board"), BOARD_AR9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
/* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("9XR"), BOARD_STOCK);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
firmware->addOption("novario", QObject::tr("No vario support"));
firmware->addOption("nogps", QObject::tr("No GPS support"));
firmware->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("9X with Sky9x board"), BOARD_SKY9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
/* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("9XR with M128 chip"), BOARD_M128);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Gruvin9x board */
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("9X with Gruvin9x board"), BOARD_GRUVIN9X);
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("Gruvin9x board / 9X"), BOARD_GRUVIN9X);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
@@ -1429,12 +1325,11 @@ void registerOpenTxFirmwares()
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* MEGA2560 board */
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("DIY MEGA2560 radio"), BOARD_MEGA2560);
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("MEGA2560 board"), BOARD_MEGA2560);
addOpenTxLcdOptions(firmware);
firmware->addOption("PWR", QObject::tr("Power management by soft-off circuitry"));
firmware->addOptions(ext_options);
@@ -1445,8 +1340,8 @@ void registerOpenTxFirmwares()
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("sdcard", QObject::tr("Support for SD memory card"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
//firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
//firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
@@ -1460,11 +1355,102 @@ void registerOpenTxFirmwares()
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
default_firmware_variant = GetFirmware("opentx-x9d+");
/* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("Sky9x board / 9X"), BOARD_SKY9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("ar9x board / 9X"), BOARD_AR9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis board */
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis Plus board */
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis X9E board */
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Horus board */
firmware = new OpenTxFirmware("opentx-horus", QObject::tr("FrSky Horus"), BOARD_HORUS);
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
default_firmware_variant = GetFirmware("opentx-taranisplus-en");
current_firmware_variant = default_firmware_variant;
}
@@ -118,8 +118,6 @@ class OpenTxFirmware: public Firmware {
virtual QString getFirmwareUrl();
virtual int getCapability(const Capability);
virtual QTime getMaxTimerStart();
virtual bool isTelemetrySourceAvailable(int source);
@@ -0,0 +1,195 @@
today(DATE)
now(TIME)
git_id(GIT_STR)
configure_file(${RADIO_SRC_DIRECTORY}/stamp.h.in ${RADIO_SRC_DIRECTORY}/stamp.h @ONLY)
set(OPENTX_SRC_FILES
opentxsimulator.cpp
)
include_directories(
${CMAKE_BINARY_DIR}/radio/src
${CMAKE_CURRENT_BINARY_DIR}
${RADIO_BIN_DIRECTORY}
${PROJECT_SOURCE_DIR}
${COMPANION_SRC_DIRECTORY}/firmwares/opentx
${RADIO_SRC_DIRECTORY}
${RADIO_SRC_DIRECTORY}/fonts/std
${RADIO_SRC_DIRECTORY}/lua/src
${RADIO_SRC_DIRECTORY}/thirdparty
${RADIO_SRC_DIRECTORY}/thirdparty/FatFs
${RADIO_SRC_DIRECTORY}/thirdparty/FatFs/option
${RADIO_SRC_DIRECTORY}/thirdparty/CoOS
${RADIO_SRC_DIRECTORY}/thirdparty/Lua/src
)
if(APPLE)
# OS X compiler no longer automatically includes /Library/Frameworks in search path
set(CMAKE_SHARED_LINKER_FLAGS -F/Library/Frameworks)
endif(APPLE)
if(DEFINED TRANSLATIONS)
set(COMMON_DEFINITIONS ${COMMON_DEFINITIONS} TRANSLATIONS_${TRANSLATIONS})
string(TOLOWER ${TRANSLATIONS} TRANSLATION_SUFFIX)
set(SUFFIX ${SUFFIX}-${TRANSLATION_SUFFIX})
endif()
set(COMMON_DEFINITIONS
${COMMON_DEFINITIONS}
SUFFIX="${SUFFIX}"
HELI
GVARS
FLIGHT_MODES
PPM_CENTER_ADJUSTABLE
PPM_LIMITS_SYMETRICAL
OVERRIDE_CHANNEL_FUNCTION
FAI_CHOICE
)
set(COMMON_LIBRARIES
${QT_LIBRARIES}
${PTHREAD_LIBRARY}
${SDL_LIBRARY}
)
add_library(opentx-9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9xr${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9x128${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9xr128${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-horus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
set(dependencies_9x 9x_bitmaps firmware_translations)
add_dependencies(opentx-9x${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-9xr${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-9x128${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-9xr128${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-mega2560${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-sky9x${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-9xrpro${SUFFIX}-simulator ${dependencies_9x})
add_dependencies(opentx-ar9x${SUFFIX}-simulator ${dependencies_9x})
set(dependencies_taranis taranis_bitmaps firmware_translations)
add_dependencies(opentx-taranis${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis)
add_dependencies(opentx-taranisplus${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis)
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis_x9e)
add_dependencies(opentx-horus${SUFFIX}-simulator horus_bitmaps horus_fonts firmware_translations lua_export_horus)
set(OPENTX_LIBRARIES
opentx-9x${SUFFIX}-simulator
opentx-9xr${SUFFIX}-simulator
opentx-9x128${SUFFIX}-simulator
opentx-9xr128${SUFFIX}-simulator
opentx-gruvin9x${SUFFIX}-simulator
opentx-mega2560${SUFFIX}-simulator
opentx-sky9x${SUFFIX}-simulator
opentx-9xrpro${SUFFIX}-simulator
opentx-ar9x${SUFFIX}-simulator
opentx-taranis${SUFFIX}-simulator
opentx-taranisplus${SUFFIX}-simulator
opentx-taranisx9e${SUFFIX}-simulator
opentx-horus${SUFFIX}-simulator
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${OPENTX_LIBRARIES} LIBRARY DESTINATION ${SIMULATOR_LIB_PATH})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# 9X with ATmega64
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/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})
# Horus
target_include_directories(opentx-horus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/horus PRIVATE ${RADIO_SRC_DIRECTORY}/fonts/horus PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/horus)
target_compile_definitions(opentx-horus${SUFFIX}-simulator PRIVATE PCBHORUS CPUARM CPUSTM32 STM32F40_41xxx COLORLCD VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-horus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
add_custom_target(opentx-simulators
DEPENDS ${OPENTX_LIBRARIES}
)
if(APPLE)
set(SIMULATOR_BUNDLES)
foreach(_file ${OPENTX_LIBRARIES})
set(SIMULATOR_BUNDLE "${_file}-bundle")
add_custom_target(${SIMULATOR_BUNDLE}
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${_file}.dylib
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${_file}.dylib
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND pwd
COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/
DEPENDS ${_file}
)
list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE})
endforeach()
add_custom_target(opentx-simulators-bundle DEPENDS ${SIMULATOR_BUNDLES})
endif(APPLE)
@@ -0,0 +1,695 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 "opentxsimulator.h"
#include <QDebug>
#include <stdio.h>
#include <exception>
#include <map>
#include <string>
#define COMPANION
#define SIMU
#define SIMU_EXCEPTIONS
#define GUI
#define SPLASH
#define FRSKY
#define FRSKY_HUB
#define GPS
#define VARIO
#define GAUGES
#define PPM_UNIT_PERCENT_PREC1
#define AUDIO
#define PXX
#define DSM2
#define DSM2_PPM
#define DBLKEYS
#define AUTOSWITCH
#define GRAPHICS
#define CURVES
#if defined(PCBFLAMENCO)
#define RTCLOCK
#define XCURVES
#define VIRTUALINPUTS
#elif defined(PCBTARANIS) || defined(PCBHORUS)
#define RTCLOCK
#define XCURVES
#define VIRTUALINPUTS
#define LUA
#define LUA_MODEL_SCRIPTS
#define LUAINPUTS
#else
#define BUZZER
#define TEMPLATES
#endif
#define BOLD_FONT
#define HAPTIC
#define THRTRACE
#if defined(CPUARM)
#define TIMERS 3
#else
#define TIMERS 2
#endif
#if defined(PCBSKY9X) && !defined(REVX)
#define ROTARY_ENCODERS 1
#elif defined(PCBGRUVIN9X)
#define ROTARY_ENCODERS 2
#endif
#if defined(CPUARM)
#define FRSKY_SPORT
#endif
#if defined (PCBTARANIS)
#define MIXERS_MONITOR
#endif
#undef min
#undef max
namespace NAMESPACE {
#if defined(CPUARM)
#include "radio/src/pulses/ppm_arm.cpp"
#include "radio/src/pulses/pxx_arm.cpp"
#include "radio/src/pulses/dsm2_arm.cpp"
#include "radio/src/main_arm.cpp"
#include "radio/src/pulses/pulses_arm.cpp"
#include "radio/src/tasks_arm.cpp"
#include "radio/src/audio_arm.cpp"
#include "radio/src/telemetry/telemetry.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/sbus.cpp"
#include "radio/src/crc16.cpp"
#else
#include "radio/src/main_avr.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/pulses/pulses_avr.cpp"
#endif
#include "radio/src/storage/storage_common.cpp"
#if defined(EEPROM_RLC)
#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/storage/eeprom_conversions.cpp"
#endif
#include "radio/src/opentx.cpp"
#include "radio/src/debug.cpp"
#include "radio/src/strhelpers.cpp"
#include "radio/src/switches.cpp"
#include "radio/src/functions.cpp"
#include "radio/src/curves.cpp"
#include "radio/src/mixer.cpp"
#if defined(SDCARD)
#include "radio/src/sdcard.cpp"
#endif
#include "radio/src/timers.cpp"
#include "radio/src/stamp.cpp"
#include "radio/src/maths.cpp"
#include "radio/src/vario.cpp"
#include "radio/src/trainer_input.cpp"
#if defined(PCBHORUS)
#include "radio/src/bmp.cpp"
#include "radio/src/gui/horus/bitmaps.cpp"
#include "radio/src/gui/horus/curves.cpp"
#include "radio/src/gui/horus/fonts.cpp"
#include "radio/src/gui/horus/widgets.cpp"
#include "radio/src/gui/horus/navigation.cpp"
#include "radio/src/gui/horus/popups.cpp"
#include "radio/src/gui/horus/helpers.cpp"
#include "radio/src/gui/horus/menus.cpp"
#include "radio/src/gui/horus/menu_model.cpp"
#include "radio/src/gui/horus/menu_model_select.cpp"
#include "radio/src/gui/horus/menu_model_setup.cpp"
#include "radio/src/gui/horus/menu_model_heli.cpp"
#include "radio/src/gui/horus/menu_model_flightmodes.cpp"
#include "radio/src/gui/horus/menu_model_inputs_mixes.cpp"
#include "radio/src/gui/horus/menu_model_curves.cpp"
#include "radio/src/gui/horus/menu_model_logical_switches.cpp"
#include "radio/src/gui/horus/menu_model_custom_functions.cpp"
#include "radio/src/gui/horus/menu_model_custom_scripts.cpp"
#include "radio/src/gui/horus/menu_model_gvars.cpp"
#include "radio/src/gui/horus/menu_model_limits.cpp"
#include "radio/src/gui/horus/menu_model_telemetry.cpp"
#include "radio/src/gui/horus/menu_general.cpp"
#include "radio/src/gui/horus/menu_general_setup.cpp"
#include "radio/src/gui/horus/menu_general_sdmanager.cpp"
#include "radio/src/gui/horus/menu_general_trainer.cpp"
#include "radio/src/gui/horus/menu_general_version.cpp"
// #include "radio/src/gui/horus/menu_general_hardware.cpp"
#include "radio/src/gui/horus/menu_general_calib.cpp"
#include "radio/src/gui/horus/view_main.cpp"
#include "radio/src/gui/horus/view_statistics.cpp"
#include "radio/src/gui/horus/view_channels.cpp"
#include "radio/src/gui/horus/view_telemetry.cpp"
#include "radio/src/gui/horus/view_text.cpp"
#include "radio/src/gui/horus/view_about.cpp"
#include "radio/src/gui/horus/lcd.cpp"
#include "radio/src/gui/horus/splash.cpp"
#elif defined(PCBFLAMENCO)
#include "radio/src/gui/Flamenco/fonts.cpp"
#include "radio/src/gui/Flamenco/widgets.cpp"
#include "radio/src/gui/Flamenco/navigation.cpp"
#include "radio/src/gui/Flamenco/popups.cpp"
#include "radio/src/gui/Flamenco/helpers.cpp"
#include "radio/src/gui/Flamenco/menus.cpp"
#include "radio/src/gui/Flamenco/menu_model.cpp"
#include "radio/src/gui/Flamenco/menu_model_select.cpp"
#include "radio/src/gui/Flamenco/menu_model_setup.cpp"
#include "radio/src/gui/Flamenco/menu_model_heli.cpp"
#include "radio/src/gui/Flamenco/menu_model_flightmodes.cpp"
#include "radio/src/gui/Flamenco/menu_model_inputs_mixes.cpp"
#include "radio/src/gui/Flamenco/menu_model_curves.cpp"
#include "radio/src/gui/Flamenco/menu_model_logical_switches.cpp"
#include "radio/src/gui/Flamenco/menu_model_custom_functions.cpp"
// #include "radio/src/gui/Flamenco/menu_model_custom_scripts.cpp"
#include "radio/src/gui/Flamenco/menu_model_gvars.cpp"
#include "radio/src/gui/Flamenco/menu_model_limits.cpp"
#include "radio/src/gui/Flamenco/menu_model_telemetry.cpp"
#include "radio/src/gui/Flamenco/menu_general.cpp"
#include "radio/src/gui/Flamenco/menu_general_setup.cpp"
#include "radio/src/gui/Flamenco/menu_general_sdmanager.cpp"
#include "radio/src/gui/Flamenco/menu_general_trainer.cpp"
#include "radio/src/gui/Flamenco/menu_general_version.cpp"
// #include "radio/src/gui/Flamenco/menu_general_hardware.cpp"
#include "radio/src/gui/Flamenco/menu_general_calib.cpp"
#include "radio/src/gui/Flamenco/view_main.cpp"
#include "radio/src/gui/Flamenco/view_statistics.cpp"
#include "radio/src/gui/Flamenco/view_channels.cpp"
#include "radio/src/gui/Flamenco/view_telemetry.cpp"
#include "radio/src/gui/Flamenco/view_text.cpp"
#include "radio/src/gui/Flamenco/view_about.cpp"
#include "radio/src/gui/Flamenco/lcd.cpp"
#include "radio/src/gui/Flamenco/splash.cpp"
#include "radio/src/targets/flamenco/tw8823_driver.cpp"
#elif defined(PCBTARANIS)
#include "radio/src/bmp.cpp"
#include "radio/src/gui/taranis/fonts.cpp"
#include "radio/src/gui/taranis/widgets.cpp"
#include "radio/src/gui/taranis/navigation.cpp"
#include "radio/src/gui/taranis/popups.cpp"
#include "radio/src/gui/taranis/helpers.cpp"
#include "radio/src/gui/taranis/menus.cpp"
#include "radio/src/gui/taranis/menu_model.cpp"
#include "radio/src/gui/taranis/menu_model_select.cpp"
#include "radio/src/gui/taranis/menu_model_setup.cpp"
#include "radio/src/gui/taranis/menu_model_heli.cpp"
#include "radio/src/gui/taranis/menu_model_flightmodes.cpp"
#include "radio/src/gui/taranis/menu_model_inputs_mixes.cpp"
#include "radio/src/gui/taranis/menu_model_curves.cpp"
#include "radio/src/gui/taranis/menu_model_logical_switches.cpp"
#include "radio/src/gui/taranis/menu_model_custom_functions.cpp"
#include "radio/src/gui/taranis/menu_model_custom_scripts.cpp"
#include "radio/src/gui/taranis/menu_model_gvars.cpp"
#include "radio/src/gui/taranis/menu_model_limits.cpp"
#include "radio/src/gui/taranis/menu_model_telemetry.cpp"
#include "radio/src/gui/taranis/menu_general.cpp"
#include "radio/src/gui/taranis/menu_general_setup.cpp"
#include "radio/src/gui/taranis/menu_general_sdmanager.cpp"
#include "radio/src/gui/taranis/menu_general_trainer.cpp"
#include "radio/src/gui/taranis/menu_general_version.cpp"
#include "radio/src/gui/taranis/menu_general_diagkeys.cpp"
#include "radio/src/gui/taranis/menu_general_diaganas.cpp"
#include "radio/src/gui/taranis/menu_general_hardware.cpp"
#include "radio/src/gui/taranis/menu_general_calib.cpp"
#include "radio/src/gui/taranis/view_main.cpp"
#include "radio/src/gui/taranis/view_statistics.cpp"
#include "radio/src/gui/taranis/view_channels.cpp"
#include "radio/src/gui/taranis/view_telemetry.cpp"
#include "radio/src/gui/taranis/view_text.cpp"
#include "radio/src/gui/taranis/view_about.cpp"
#include "radio/src/gui/taranis/lcd.cpp"
#include "radio/src/gui/taranis/splash.cpp"
#else
#include "radio/src/gui/9x/fonts.cpp"
#include "radio/src/gui/9x/widgets.cpp"
#include "radio/src/gui/9x/navigation.cpp"
#include "radio/src/gui/9x/popups.cpp"
#include "radio/src/gui/9x/helpers.cpp"
#include "radio/src/gui/9x/menus.cpp"
#include "radio/src/gui/9x/menu_model.cpp"
#include "radio/src/gui/9x/menu_model_select.cpp"
#include "radio/src/gui/9x/menu_model_setup.cpp"
#include "radio/src/gui/9x/menu_model_heli.cpp"
#include "radio/src/gui/9x/menu_model_flightmodes.cpp"
#include "radio/src/gui/9x/menu_model_inputs_mixes.cpp"
#include "radio/src/gui/9x/menu_model_curves.cpp"
#include "radio/src/gui/9x/menu_model_logical_switches.cpp"
#include "radio/src/gui/9x/menu_model_custom_functions.cpp"
#include "radio/src/gui/9x/menu_model_limits.cpp"
#include "radio/src/gui/9x/menu_model_telemetry.cpp"
#include "radio/src/gui/9x/menu_model_templates.cpp"
#include "radio/src/gui/9x/menu_general.cpp"
#include "radio/src/gui/9x/menu_general_setup.cpp"
#if defined(SDCARD)
#include "radio/src/gui/9x/menu_general_sdmanager.cpp"
#include "radio/src/gui/9x/view_text.cpp"
#endif
#include "radio/src/gui/9x/menu_general_trainer.cpp"
#include "radio/src/gui/9x/menu_general_version.cpp"
#include "radio/src/gui/9x/menu_general_diagkeys.cpp"
#include "radio/src/gui/9x/menu_general_diaganas.cpp"
#if defined(CPUARM)
#include "radio/src/gui/9x/menu_general_hardware.cpp"
#endif
#include "radio/src/gui/9x/menu_general_calib.cpp"
#include "radio/src/gui/9x/view_main.cpp"
#include "radio/src/gui/9x/view_statistics.cpp"
#include "radio/src/gui/9x/view_telemetry.cpp"
#if !defined(CPUM64)
#include "radio/src/gui/9x/view_about.cpp"
#endif
#include "radio/src/gui/9x/lcd.cpp"
#include "radio/src/gui/9x/splash.cpp"
#endif
#if !defined(VIRTUALINPUTS)
#include "radio/src/templates.cpp"
#endif
#if defined(SDCARD)
#include "radio/src/logs.cpp"
#endif
#if defined(RTCLOCK)
#include "radio/src/rtc.cpp"
#endif
#if defined(BUZZER)
#include "radio/src/buzzer.cpp"
#endif
#if defined(PCBHORUS)
#include "radio/src/targets/horus/board_horus.cpp"
#include "radio/src/targets/horus/keys_driver.cpp"
#include "radio/src/targets/horus/audio_driver.cpp"
#include "radio/src/targets/horus/telemetry_driver.cpp"
#include "radio/src/targets/horus/haptic_driver.cpp"
#include "radio/src/targets/horus/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/horus/trainer_driver.cpp"
#include "radio/src/targets/horus/serial2_driver.cpp"
#elif defined(PCBFLAMENCO)
#include "radio/src/targets/flamenco/board_flamenco.cpp"
#include "radio/src/targets/flamenco/keys_driver.cpp"
#include "radio/src/targets/flamenco/audio_driver.cpp"
#include "radio/src/targets/flamenco/telemetry_driver.cpp"
#include "radio/src/targets/flamenco/eeprom_driver.cpp"
// #include "radio/src/targets/flamenco/haptic_driver.cpp"
#include "radio/src/targets/flamenco/pulses_driver.cpp"
#include "radio/src/targets/flamenco/rtc_driver.cpp"
#include "radio/src/targets/flamenco/trainer_driver.cpp"
#elif 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"
#if defined(REV9E)
#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"
#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"
#elif defined(PCBGRUVIN9X)
#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"
#else
#include "radio/src/targets/9x/board_stock.cpp"
#endif
#if defined(CPUARM)
#include "radio/src/gui/gui_helpers.cpp"
#endif
#include "radio/src/keys.cpp"
#include "radio/src/haptic.cpp"
#include "radio/src/targets/simu/simpgmspace.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/telemetry/frsky.cpp"
#if defined(CPUARM)
#include "radio/src/telemetry/frsky_d_arm.cpp"
#else
#include "radio/src/telemetry/frsky_d.cpp"
#endif
#include "radio/src/translations/tts_en.cpp"
#if defined(CPUARM)
#include "radio/src/translations/tts_cz.cpp"
#include "radio/src/translations/tts_de.cpp"
#include "radio/src/translations/tts_es.cpp"
#include "radio/src/translations/tts_fr.cpp"
#include "radio/src/translations/tts_hu.cpp"
#include "radio/src/translations/tts_it.cpp"
#include "radio/src/translations/tts_nl.cpp"
#include "radio/src/translations/tts_pl.cpp"
#include "radio/src/translations/tts_pt.cpp"
#include "radio/src/translations/tts_se.cpp"
#include "radio/src/translations/tts_sk.cpp"
#endif
#if defined(LUA)
#include "radio/src/lua/interface.cpp"
#include "radio/src/lua/api_general.cpp"
#include "radio/src/lua/api_lcd.cpp"
#include "radio/src/lua/api_model.cpp"
#include "radio/src/thirdparty/Lua/src/lapi.c"
#include "radio/src/thirdparty/Lua/src/lcode.c"
#include "radio/src/thirdparty/Lua/src/lctype.c"
#include "radio/src/thirdparty/Lua/src/ldebug.c"
#include "radio/src/thirdparty/Lua/src/ldo.c"
#include "radio/src/thirdparty/Lua/src/ldump.c"
#include "radio/src/thirdparty/Lua/src/lfunc.c"
#include "radio/src/thirdparty/Lua/src/lgc.c"
#include "radio/src/thirdparty/Lua/src/llex.c"
#include "radio/src/thirdparty/Lua/src/lmem.c"
#include "radio/src/thirdparty/Lua/src/lobject.c"
#include "radio/src/thirdparty/Lua/src/lopcodes.c"
#include "radio/src/thirdparty/Lua/src/lparser.c"
#include "radio/src/thirdparty/Lua/src/lstate.c"
#include "radio/src/thirdparty/Lua/src/lstring.c"
#include "radio/src/thirdparty/Lua/src/ltable.c"
#include "radio/src/thirdparty/Lua/src/lrotable.c"
#include "radio/src/thirdparty/Lua/src/ltm.c"
#include "radio/src/thirdparty/Lua/src/lundump.c"
#include "radio/src/thirdparty/Lua/src/lvm.c"
#include "radio/src/thirdparty/Lua/src/lzio.c"
#include "radio/src/thirdparty/Lua/src/lbaselib.c"
#include "radio/src/thirdparty/Lua/src/linit.c"
#include "radio/src/thirdparty/Lua/src/lmathlib.c"
#include "radio/src/thirdparty/Lua/src/lbitlib.c"
#include "radio/src/thirdparty/Lua/src/loadlib.c"
#include "radio/src/thirdparty/Lua/src/lauxlib.c"
#include "radio/src/thirdparty/Lua/src/ltablib.c"
#include "radio/src/thirdparty/Lua/src/lcorolib.c"
#include "radio/src/thirdparty/Lua/src/liolib.c"
#include "radio/src/thirdparty/Lua/src/lstrlib.c"
#endif
int16_t g_anas[NUM_STICKS+NUM_POTS];
uint16_t anaIn(uint8_t chan)
{
return g_anas[chan];
}
bool hasExtendedTrims()
{
return g_model.extendedTrims;
}
uint8_t getStickMode()
{
return limit<uint8_t>(0, g_eeGeneral.stickMode, 3);
}
#if defined(PCBTARANIS)
void resetTrims()
{
TRIMS_GPIO_REG_RVD |= TRIMS_GPIO_PIN_RVD;
TRIMS_GPIO_REG_RVU |= TRIMS_GPIO_PIN_RVU;
TRIMS_GPIO_REG_RHL |= TRIMS_GPIO_PIN_RHL;
TRIMS_GPIO_REG_RHR |= TRIMS_GPIO_PIN_RHR;
TRIMS_GPIO_REG_LVD |= TRIMS_GPIO_PIN_LVD;
TRIMS_GPIO_REG_LVU |= TRIMS_GPIO_PIN_LVU;
TRIMS_GPIO_REG_LHL |= TRIMS_GPIO_PIN_LHL;
TRIMS_GPIO_REG_LHR |= TRIMS_GPIO_PIN_LHR;
}
#endif
void delay_01us(::uint16_t nb)
{
}
OpenTxSimulator::OpenTxSimulator()
{
}
void OpenTxSimulator::setSdPath(const QString &sdPath)
{
#if defined(SDCARD)
strncpy(simuSdDirectory, sdPath.toAscii().constData(), sizeof(simuSdDirectory)-1);
simuSdDirectory[sizeof(simuSdDirectory)-1] = '\0';
#endif
}
void OpenTxSimulator::setVolumeGain(int value)
{
volumeGain = value;
}
bool OpenTxSimulator::timer10ms()
{
#define TIMER10MS_IMPORT
#include "simulatorimport.h"
}
::uint8_t * OpenTxSimulator::getLcd()
{
return (::uint8_t *)simuLcdBuf;
}
bool OpenTxSimulator::lcdChanged(bool & lightEnable)
{
#define LCDCHANGED_IMPORT
#include "simulatorimport.h"
}
void OpenTxSimulator::start(QByteArray & eeprom, bool tests)
{
memcpy(NAMESPACE::eeprom, eeprom.data(), std::min<int>(sizeof(NAMESPACE::eeprom), eeprom.size()));
start((const char *)0, tests);
}
void OpenTxSimulator::start(const char * filename, bool tests)
{
#if defined(PCBSKY9X) && !defined(REVX)
g_rotenc[0] = 0;
#elif defined(PCBGRUVIN9X)
g_rotenc[0] = 0;
g_rotenc[1] = 0;
#endif
StartEepromThread(filename);
StartAudioThread(volumeGain);
StartMainThread(tests);
}
void OpenTxSimulator::stop()
{
StopMainThread();
#if defined(CPUARM)
StopAudioThread();
#endif
StopEepromThread();
}
void OpenTxSimulator::getValues(TxOutputs &outputs)
{
#define GETVALUES_IMPORT
#define g_chans512 channelOutputs
#include "simulatorimport.h"
#if defined(PCBSKY9X)
outputs.beep = g_beepCnt;
g_beepCnt = 0;
#endif
}
void OpenTxSimulator::setValues(TxInputs &inputs)
{
#define SETVALUES_IMPORT
#include "simulatorimport.h"
}
void OpenTxSimulator::setTrim(unsigned int idx, int value)
{
idx = NAMESPACE::modn12x3[4*getStickMode() + idx];
::uint8_t phase = getTrimFlightPhase(getFlightMode(), idx);
setTrimValue(phase, idx, value);
}
void OpenTxSimulator::getTrims(Trims & trims)
{
::uint8_t phase = getFlightMode();
trims.extended = hasExtendedTrims();
for (::uint8_t idx=0; idx<4; idx++) {
trims.values[idx] = getTrimValue(getTrimFlightPhase(phase, idx), idx);
}
for (int i=0; i<2; i++) {
::uint8_t idx = NAMESPACE::modn12x3[4*getStickMode() + i];
::int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
}
}
void OpenTxSimulator::wheelEvent(int steps)
{
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
if (steps > 0)
rotencValue -= 2;
else
rotencValue += 2;
#elif defined(REV9E)
if (steps == 255)
rotencValue -= 2;
else
rotencValue += 2;
#elif defined(PCBSKY9X) && !defined(REVX)
g_rotenc[0] += steps*4;
#elif defined(PCBGRUVIN9X)
g_rotenc[0] += steps;
#endif
}
unsigned int OpenTxSimulator::getPhase()
{
return getFlightMode();
}
const char * OpenTxSimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.flightModeData[0].name)+1];
zchar2str(buff, g_model.flightModeData[phase].name, sizeof(g_model.flightModeData[0].name));
return buff;
}
const char * OpenTxSimulator::getError()
{
#define GETERROR_IMPORT
#include "simulatorimport.h"
}
void OpenTxSimulator::sendTelemetry(::uint8_t * data, unsigned int len)
{
#if defined(FRSKY_SPORT)
processSportPacket(data);
#endif
}
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id)
{
#if defined(FRSKY_SPORT)
for (int i = 0; i<MAX_SENSORS; i++) {
if (isTelemetryFieldAvailable(i)) {
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
if (sensor->id == id) {
return sensor->instance;
}
}
}
#endif
return 0;
}
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
{
#if defined(FRSKY_SPORT)
for (int i = 0; i<MAX_SENSORS; i++) {
if (isTelemetryFieldAvailable(i)) {
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
if (sensor->id == id) {
return sensor->custom.ratio;
}
}
}
#endif
return 0;
}
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, ::int16_t value)
{
#define SETTRAINER_IMPORT
#include "simulatorimport.h"
}
void OpenTxSimulator::setLuaStateReloadPermanentScripts()
{
#if defined(LUA)
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
#endif
}
void OpenTxSimulator::installTraceHook(void (*callback)(const char *))
{
traceCallback = callback;
}
class OpenTxSimulatorFactory: public SimulatorFactory
{
public:
OpenTxSimulatorFactory()
{
}
virtual SimulatorInterface *create()
{
return new OpenTxSimulator();
}
virtual QString name()
{
return QString("opentx-" FLAVOUR SUFFIX);
}
virtual BoardEnum type()
{
#if defined(PCBHORUS)
return BOARD_HORUS;
#elif defined(PCBFLAMENCO)
return BOARD_FLAMENCO;
#elif defined(PCBTARANIS)
return BOARD_TARANIS;
#else
return BOARD_STOCK;
#endif
}
};
}
extern "C" DLLEXPORT SimulatorFactory *registerSimu()
{
return new NAMESPACE::OpenTxSimulatorFactory();
}
@@ -1,6 +1,6 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
@@ -14,17 +14,79 @@
*
*/
#ifndef _OPENTX_SIMULATOR_H_
#define _OPENTX_SIMULATOR_H_
#ifndef opentx_taranis_simulator_h
#define opentx_taranis_simulator_h
#include "simulatorinterface.h"
#if defined(PCBHORUS)
#define FLAVOUR "horus"
#define NAMESPACE HORUS
#define EEPROM_VARIANT 0
#elif defined(PCBFLAMENCO)
#define FLAVOUR "flamenco"
#define NAMESPACE FLAMENCO
#define EEPROM_VARIANT 0
#elif defined(PCBTARANIS) && defined(REV9E)
#define FLAVOUR "taranisx9e"
#define NAMESPACE TaranisX9E
#define EEPROM_VARIANT 0x8000
#elif defined(PCBTARANIS) && defined(REVPLUS)
#define FLAVOUR "taranisplus"
#define NAMESPACE TaranisPlus
#define EEPROM_VARIANT 0
#elif defined(PCBTARANIS)
#define FLAVOUR "taranis"
#define NAMESPACE Taranis
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X) && defined(REVX)
#define FLAVOUR "9xrpro"
#define NAMESPACE Sky9xPro
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X) && defined(AR9X)
#define FLAVOUR "ar9x"
#define NAMESPACE Ar9x
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X)
#define FLAVOUR "sky9x"
#define NAMESPACE Sky9X
#define EEPROM_VARIANT 0
#elif defined(PCBGRUVIN9X)
#define FLAVOUR "gruvin9x"
#define NAMESPACE Gruvin9X
#define EEPROM_VARIANT 0
#elif defined(PCBMEGA2560)
#define FLAVOUR "mega2560"
#define NAMESPACE Mega2560
#define EEPROM_VARIANT 0
#elif defined(PCB9XR) && defined(CPUM128)
#define FLAVOUR "9xr128"
#define NAMESPACE M128XR
#define EEPROM_VARIANT 0x8003
#elif defined(PCB9X) && defined(CPUM128)
#define FLAVOUR "9x128"
#define NAMESPACE M128
#define EEPROM_VARIANT 0x8003
#elif defined(PCB9XR) && defined(CPUM64)
#define FLAVOUR "9xr"
#define NAMESPACE M64XR
#define EEPROM_VARIANT 0x0003
#elif defined(PCB9X) && defined(CPUM64)
#define FLAVOUR "9x"
#define NAMESPACE M64
#define EEPROM_VARIANT 0x0003
#else
#error "Unknown board"
#endif
#if defined __GNUC__
#define DLLEXPORT
#else
#define DLLEXPORT __declspec(dllexport)
#endif
namespace NAMESPACE {
class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
private:
@@ -68,7 +130,7 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len);
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0);
virtual uint8_t getSensorInstance(uint16_t id);
virtual uint16_t getSensorRatio(uint16_t id);
@@ -79,4 +141,6 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
virtual void setLuaStateReloadPermanentScripts();
};
#endif // _OPENTX_SIMULATOR_H_
}
#endif
@@ -24,10 +24,9 @@
#undef min
#undef max
#define NUM_POTS 3
#define NUM_SLIDERS 0
#define NUM_CSW 12
#define SWSRC_SW1 10
#define NUM_POTS 3
#define NUM_CSW 12
#define SWSRC_SW1 10
#include <exception>
#include <algorithm>
@@ -157,7 +156,7 @@ void simuSetKey(uint8_t key, bool state)
}
}
#define isBacklightEnabled() (PORTB & (1<<OUT_B_LIGHT))
#define isBacklightEnable() (PORTB & (1<<OUT_B_LIGHT))
}
+1 -1
View File
@@ -273,7 +273,7 @@ t_Th9xModelData::operator ModelData ()
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
c9x.customFn[0].func = FuncTrims2Offsets;
if (trimSw) {
c9x.customFn[0].swtch = trimSw;
@@ -123,7 +123,7 @@ unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
}
std::cout << "ok\n";
errors.set(ALL_OK);
errors.set(NO_ERROR);
return errors.to_ulong();
}
+2 -2
View File
@@ -126,7 +126,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
if (xmlOK) {
RadioData * radioData = new RadioData();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(*radioData, doc));
if (!errors.test(ALL_OK)) {
if (!errors.test(NO_ERROR)) {
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
}
else {
@@ -162,7 +162,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
RadioData * radioData = new RadioData();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size));
if (eeprom_size == 0 || !errors.test(ALL_OK)) {
if (eeprom_size == 0 || !errors.test(NO_ERROR)) {
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename));
}
else {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef FLASHEEPROMDIALOG_H_
#define FLASHEEPROMDIALOG_H_
#include <QtWidgets>
#include <QDialog>
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
+2 -2
View File
@@ -37,7 +37,7 @@ fwName(g.profile[g.id()].fwName())
ui->useProfileSplash->setDisabled(true);
}
if (IS_STM32(GetEepromInterface()->getBoard())) {
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
// No backup on Taranis ... could be done if in massstorage
ui->backupEEprom->hide();
ui->backupEEprom->setCheckState(Qt::Unchecked);
@@ -124,7 +124,7 @@ void FlashFirmwareDialog::on_firmwareLoad_clicked()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
if (!fileName.isEmpty()) {
fwName = fileName;
if (!fwName.isEmpty() && !fwName.endsWith(".dfu") && !FirmwareInterface(fwName).isValid()) {
if (!fwName.isEmpty() && !FirmwareInterface(fwName).isValid()) {
QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fwName));
}
updateUI();
+3 -3
View File
@@ -1,17 +1,17 @@
#ifndef FLASH_FIRMWARE_DIALOG_H
#define FLASH_FIRMWARE_DIALOG_H
#include <QtWidgets>
#include <QtGui>
#include <QDialog>
#include "eeprominterface.h"
#include "firmwareinterface.h"
#include "xmlinterface.h"
#define HEX_FILES_FILTER "HEX files (*.hex);;"
#define BIN_FILES_FILTER "BIN files (*.bin);;"
#define DFU_FILES_FILTER "DFU files (*.dfu);;"
#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;"
#define EEPROM_FILES_FILTER "EEPE files (*.eepe *.bin *.hex);;" EEPE_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex *.dfu);;" BIN_FILES_FILTER HEX_FILES_FILTER DFU_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
+3 -4
View File
@@ -24,8 +24,7 @@ foreach(name ${generaledit_NAMES})
set(generaledit_UIS ${generaledit_UIS} ${name}.ui)
endforeach()
qt5_wrap_ui(generaledit_SRCS ${generaledit_UIS})
qt5_wrap_cpp(generaledit_SRCS ${generaledit_HDRS})
qt4_wrap_ui(generaledit_SRCS ${generaledit_UIS})
qt4_wrap_cpp(generaledit_SRCS ${generaledit_HDRS})
add_library(generaledit ${generaledit_SRCS})
qt5_use_modules(generaledit Widgets Xml Multimedia)
add_library(generaledit ${generaledit_SRCS})
+1 -1
View File
@@ -14,7 +14,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
layout->setContentsMargins(0, 0, 0, 0);
this->setLayout(layout);
tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
tableWidget->setColumnCount(3);
tableWidget->setShowGrid(false);
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
+41 -87
View File
@@ -1,3 +1,6 @@
#include <QDateTime>
#include <QtGui>
#include <QScrollArea>
#include "generaledit.h"
#include "ui_generaledit.h"
#include "helpers.h"
@@ -81,15 +84,12 @@ void GeneralEdit::on_calretrieve_PB_clicked()
{
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].stickPotCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int numSwPots=GetCurrentFirmware()->getCapability(Switches)+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (calib.isEmpty()) {
return;
}
else {
QString trainercalib = g.profile[profile_id].trainerCalib();
QString hwtypes = g.profile[profile_id].controlTypes();
QString controlNames=g.profile[profile_id].controlNames();
int8_t txVoltageCalibration = (int8_t)g.profile[profile_id].txVoltageCalibration();
int8_t txCurrentCalibration = (int8_t)g.profile[profile_id].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
@@ -108,18 +108,22 @@ void GeneralEdit::on_calretrieve_PB_clicked()
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
Byte=calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) generalSettings.calibMid[i]=byte16;
if (ok)
generalSettings.calibMid[i]=byte16;
Byte=calib.mid(4+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) generalSettings.calibSpanNeg[i]=byte16;
if (ok)
generalSettings.calibSpanNeg[i]=byte16;
Byte=calib.mid(8+i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) generalSettings.calibSpanPos[i]=byte16;
if (ok)
generalSettings.calibSpanPos[i]=byte16;
}
for (int i=0; i<4; i++) {
Byte=trainercalib.mid(i*4,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) generalSettings.trainer.calib[i]=byte16;
if (ok)
generalSettings.trainer.calib[i]=byte16;
}
generalSettings.txCurrentCalibration=txCurrentCalibration;
generalSettings.txVoltageCalibration=txVoltageCalibration;
@@ -132,48 +136,6 @@ void GeneralEdit::on_calretrieve_PB_clicked()
} else {
QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, radio calibration was not retrieved"));
}
if (hwtypes.length()==numSwPots) {
QString Byte;
int16_t byte16;
QByteArray qba;
int16_t offset;
bool ok;
for (int i=0; i<NUM_STICKS; i++) {
qba = controlNames.mid(3*i,3).toLatin1();
strcpy(generalSettings.stickName[i], qba.data());
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
Byte=hwtypes.mid(i,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS),3).toLatin1();
if (ok) {
generalSettings.switchConfig[i]=byte16;
strcpy(generalSettings.switchName[i], qba.data());
}
}
offset = GetCurrentFirmware()->getCapability(Switches);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1();
if (ok) {
generalSettings.potConfig[i]=byte16;
strcpy(generalSettings.potName[i], qba.data());
}
}
offset += GetCurrentFirmware()->getCapability(Pots);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1();
if (ok) {
generalSettings.sliderConfig[i]=byte16;
strcpy(generalSettings.sliderName[i], qba.data());
}
}
} else {
QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, Switch/pot config not retrieved"));
}
if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) {
generalSettings.stickMode=GSStickMode;
uint8_t byte8u;
@@ -181,35 +143,48 @@ void GeneralEdit::on_calretrieve_PB_clicked()
QString chars;
bool ok;
byte8=(int8_t)DisplaySet.mid(0,2).toInt(&ok,16);
if (ok) generalSettings.optrexDisplay=(byte8==1 ? true : false);
if (ok)
generalSettings.optrexDisplay=(byte8==1 ? true : false);
byte8u=(uint8_t)DisplaySet.mid(2,2).toUInt(&ok,16);
if (ok) generalSettings.contrast=byte8u;
if (ok)
generalSettings.contrast=byte8u;
byte8u=(uint8_t)DisplaySet.mid(4,2).toUInt(&ok,16);
if (ok) generalSettings.backlightBright=byte8u;
if (ok)
generalSettings.backlightBright=byte8u;
byte8=(int8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
if (ok) generalSettings.beeperMode = (GeneralSettings::BeeperMode)byte8;
if (ok)
generalSettings.beeperMode = (GeneralSettings::BeeperMode)byte8;
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
if (ok) generalSettings.beeperLength=byte8;
if (ok)
generalSettings.beeperLength=byte8;
byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16);
if (ok) generalSettings.hapticMode=(GeneralSettings::BeeperMode)byte8;
if (ok)
generalSettings.hapticMode=(GeneralSettings::BeeperMode)byte8;
byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16);
if (ok) generalSettings.hapticStrength=byte8;
if (ok)
generalSettings.hapticStrength=byte8;
byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16);
if (ok) generalSettings.hapticLength=byte8;
if (ok)
generalSettings.hapticLength=byte8;
byte8u=(uint8_t)SpeakerSet.mid(0,2).toUInt(&ok,16);
if (ok) generalSettings.speakerMode=byte8u;
if (ok)
generalSettings.speakerMode=byte8u;
byte8u=(uint8_t)SpeakerSet.mid(2,2).toUInt(&ok,16);
if (ok) generalSettings.speakerPitch=byte8u;
if (ok)
generalSettings.speakerPitch=byte8u;
byte8u=(uint8_t)SpeakerSet.mid(4,2).toUInt(&ok,16);
if (ok) generalSettings.speakerVolume=byte8u;
if (ok)
generalSettings.speakerVolume=byte8u;
if (CountrySet.length()==6) {
byte8u=(uint8_t)CountrySet.mid(0,2).toUInt(&ok,16);
if (ok) generalSettings.countryCode=byte8u;
if (ok)
generalSettings.countryCode=byte8u;
byte8u=(uint8_t)CountrySet.mid(2,2).toUInt(&ok,16);
if (ok) generalSettings.imperial=byte8u;
if (ok)
generalSettings.imperial=byte8u;
chars=CountrySet.mid(4,2);
generalSettings.ttsLanguage[0]=chars[0].toLatin1();
generalSettings.ttsLanguage[1]=chars[1].toLatin1();
generalSettings.ttsLanguage[0]=chars[0].toAscii();
generalSettings.ttsLanguage[1]=chars[1].toAscii();
}
}
else {
@@ -225,15 +200,13 @@ void GeneralEdit::on_calstore_PB_clicked()
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].name();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true);
return;
}
else {
QString calib=g.profile[profile_id].stickPotCalib();
QString hwtypes=g.profile[profile_id].controlTypes();
QString controlNames=g.profile[profile_id].controlNames();
if (!(calib.isEmpty())) {
int ret = QMessageBox::question(this, "Companion",
tr("Do you want to store calibration in %1 profile<br>overwriting existing calibration?").arg(name) ,
@@ -254,25 +227,6 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0')));
}
g.profile[profile_id].trainerCalib( calib );
hwtypes.clear();
controlNames.clear();
for (int i=0; i<NUM_STICKS; i++) {
controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.switchConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.switchName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.potConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.potName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.sliderConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.sliderName[i], -3));
}
g.profile[profile_id].controlTypes( hwtypes );
g.profile[profile_id].controlNames( controlNames );
g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GENERALEDIT_H
#define GENERALEDIT_H
#include <QtWidgets>
#include <QDialog>
#include "eeprominterface.h"
#include "genericpanel.h"
+4 -3
View File
@@ -1,5 +1,6 @@
#include "generalsetup.h"
#include "ui_generalsetup.h"
#include <QMessageBox>
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
GeneralPanel(parent, generalSettings, firmware),
@@ -274,8 +275,8 @@ void GeneralSetupPanel::populateBacklightCB()
void GeneralSetupPanel::populateVoiceLangCB()
{
QComboBox * b = ui->voiceLang_CB;
QString strings[] = { QObject::tr("English"), QObject::tr("Dutch"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), QObject::tr("Hungarian"), NULL};
QString langcode[] = { "en", "nl","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", "hu", NULL};
QString strings[] = { QObject::tr("English"), QObject::tr("Finnish"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), NULL};
QString langcode[] = { "en", "fi","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", NULL};
b->clear();
for (int i=0; strings[i]!=NULL; i++) {
@@ -315,7 +316,7 @@ void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index)
if (!lock) {
QString code = ui->voiceLang_CB->itemData(index).toString();
for (int i=0; i<2; i++) {
generalSettings.ttsLanguage[i] = code.at(i).toLatin1();
generalSettings.ttsLanguage[i] = code.at(i).toAscii();
}
generalSettings.ttsLanguage[2] = '\0';
emit modified();
+1 -1
View File
@@ -658,7 +658,7 @@
<item>
<widget class="QCheckBox" name="adjustRTC">
<property name="toolTip">
<string>Automatically adjust the radio's clock if a GPS is connected to telemetry.</string>
<string>If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio.</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
+15 -23
View File
@@ -86,7 +86,7 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
{
memset(dest, 0, length+1);
if (b->currentText() != "----") {
strncpy(dest, b->currentText().toLatin1(), length);
strncpy(dest, b->currentText().toAscii(), length);
}
}
@@ -103,7 +103,7 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
GVarGroup::GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
QObject(),
weightGV(weightGV),
weightSB(weightSB),
@@ -115,7 +115,7 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo
lock(true)
{
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
populateGVCB(*weightCB, weight, model);
populateGVCB(weightCB, weight);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
}
@@ -179,14 +179,13 @@ void GVarGroup::valuesChanged()
}
}
CurveGroup::CurveGroup(QComboBox * curveTypeCB, QCheckBox * curveGVarCB, QComboBox * curveValueCB, QSpinBox * curveValueSB, CurveReference & curve, const ModelData & model, unsigned int flags):
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
QObject(),
curveTypeCB(curveTypeCB),
curveGVarCB(curveGVarCB),
curveValueCB(curveValueCB),
curveValueSB(curveValueSB),
curve(curve),
model(model),
flags(flags),
lock(false),
lastType(-1)
@@ -220,7 +219,7 @@ void CurveGroup::update()
curveGVarCB->setChecked(true);
if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
lastType = curve.type;
populateGVCB(*curveValueCB, curve.value, model);
populateGVCB(curveValueCB, curve.value);
}
curveValueCB->show();
curveValueSB->hide();
@@ -277,7 +276,6 @@ void CurveGroup::gvarCBChanged(int state)
if (!lock) {
if (state) {
curve.value = 10000+1; // TODO constant in EEpromInterface ...
lastType = -1; // quickfix for issue #3518: force refresh of curveValueCB at next update() to set current index to GV1
}
else {
curve.value = 0; // TODO could be better
@@ -480,39 +478,33 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
b->setMaxVisibleItems(10);
}
void populateGVCB(QComboBox & b, int value, const ModelData & model)
void populateGVCB(QComboBox *b, int value)
{
bool selected = false;
b.clear();
b->clear();
int count = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-count; i<=-1; i++) {
int pgvars = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i);
if (strlen(model.gvars_names[-i-1]) > 0)
b.addItem(QObject::tr("-GV%1 (%2)").arg(-i).arg(model.gvars_names[-i-1]), gval);
else
b.addItem(QObject::tr("-GV%1").arg(-i), gval);
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
if (value == gval) {
b.setCurrentIndex(b.count()-1);
b->setCurrentIndex(b->count()-1);
selected = true;
}
}
for (int i=1; i<=count; i++) {
for (int i=1; i<=pgvars; i++) {
int16_t gval = (int16_t)(10000+i);
if (strlen(model.gvars_names[i-1]) > 0)
b.addItem(QObject::tr("GV%1 (%2)").arg(i).arg(model.gvars_names[i-1]), gval);
else
b.addItem(QObject::tr("GV%1").arg(i), gval);
b->addItem(QObject::tr("GV%1").arg(i), gval);
if (value == gval) {
b.setCurrentIndex(b.count()-1);
b->setCurrentIndex(b->count()-1);
selected = true;
}
}
if (!selected) {
b.setCurrentIndex(count);
b->setCurrentIndex(pgvars);
}
}
+5 -6
View File
@@ -1,8 +1,7 @@
#ifndef HELPERS_H
#define HELPERS_H
#include <QCheckBox>
#include <QSpinBox>
#include <QtGui>
#include <QTableWidget>
#include <QGridLayout>
#include <QDebug>
@@ -46,7 +45,7 @@ class GVarGroup: public QObject {
Q_OBJECT
public:
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
protected slots:
void gvarCBChanged(int);
@@ -72,7 +71,7 @@ class CurveGroup : public QObject {
Q_OBJECT
public:
CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, const ModelData & model, unsigned int flags=0);
CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags=0);
void update();
protected slots:
@@ -86,7 +85,6 @@ class CurveGroup : public QObject {
QComboBox *curveValueCB;
QSpinBox *curveValueSB;
CurveReference & curve;
const ModelData & model;
unsigned int flags;
bool lock;
int lastType;
@@ -119,7 +117,8 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase);
#define GVARS_VARIANT 0x0001
#define FRSKY_VARIANT 0x0002
void populateGVCB(QComboBox & b, int value, const ModelData & model);
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
void populateGVCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, const RawSource &source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags);
QString image2qstring(QImage image);
int findmult(float value, float base);
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 866 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 960 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

+6 -166
View File
@@ -1,4 +1,3 @@
#include <math.h>
#include "logsdialog.h"
#include "appdata.h"
#include "ui_logsdialog.h"
@@ -11,11 +10,7 @@
LogsDialog::LogsDialog(QWidget *parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::LogsDialog),
tracerMaxAlt(0),
cursorA(0),
cursorB(0),
cursorLine(0)
ui(new Ui::LogsDialog)
{
csvlog.clear();
@@ -83,7 +78,7 @@ LogsDialog::LogsDialog(QWidget *parent) :
// connect slot that ties some axis selections together (especially opposite axes):
connect(ui->customPlot, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
// connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
connect(ui->customPlot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress(QMouseEvent*)));
connect(ui->customPlot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
connect(ui->customPlot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));
// make left axes transfer its range to right axes:
@@ -424,7 +419,7 @@ void LogsDialog::on_mapsButton_clicked()
ui->logTable->setDisabled(false);
}
void LogsDialog::mousePress(QMouseEvent * event)
void LogsDialog::mousePress()
{
// if an axis is selected, only allow the direction of that axis to be dragged
// if no axis is selected, both directions may be dragged
@@ -435,74 +430,6 @@ void LogsDialog::mousePress(QMouseEvent * event)
axisRect->setRangeDrag(axisRect->axis(QCPAxis::atLeft)->orientation());
else
axisRect->setRangeDrag(Qt::Horizontal | Qt::Vertical);
if (event->button() == Qt::RightButton) {
double x = axisRect->axis(QCPAxis::atBottom)->pixelToCoord(event->pos().x());
placeCursor(x, event->modifiers() & Qt::ShiftModifier);
}
}
void LogsDialog::placeCursor(double x, bool second)
{
QCPItemTracer * cursor = second ? cursorB : cursorA;
if (cursor) {
cursor->setGraphKey(x);
cursor->updatePosition();
cursor->setVisible(true);
}
if (cursorA && cursorB) {
updateCursorsLabel();
}
}
void LogsDialog::updateCursorsLabel()
{
QString text = QString("Max Altitude: %1 m\n").arg(tracerMaxAlt->position->value(), 0, 'f', 1);
if (cursorA->visible() ) {
text += tr("Cursor A: %1 m").arg(cursorA->position->value(), 0, 'f', 1) + "\n";
}
if (cursorB->visible() ) {
text += tr("Cursor B: %1 m").arg(cursorB->position->value(), 0, 'f', 1) + "\n";
}
if (cursorA->visible() && cursorB->visible()) {
cursorLine->setVisible(true);
// calc deltas
double deltaX = cursorB->position->key() - cursorA->position->key();
double deltaY = cursorB->position->value() - cursorA->position->value();
double slope = 0;
if (deltaX != 0) {
slope = deltaY / deltaX;
}
qDebug() << "Cursors: dt:" << formatTimeDelta(deltaX) << "dy:" << deltaY << "rate:" << slope;
text += tr("Time delta: %1").arg(formatTimeDelta(deltaX)) + "\n";
text += tr("Climb rate: %1 m/s").arg(slope, 0, 'f', fabs(slope)<1.0 ? 2 : 1) + "\n";
}
ui->labelCursors->setText(text);
}
QString LogsDialog::formatTimeDelta(double timeDelta)
{
if (abs(timeDelta) < 10) {
return QString("%1 s").arg(timeDelta, 1, 'f', 1);
}
int seconds = (int)round(abs(timeDelta));
int hours = seconds / 3600;
seconds %= 3600;
int minutes = seconds / 60;
seconds %= 60;
if (hours) {
return QString("%1h:%2:%3").arg(hours).arg(minutes, 2, 10, QChar('0')).arg(seconds, 2, 10, QChar('0'));
}
else if (minutes) {
return QString("%1m:%2").arg(minutes).arg(seconds, 2, 10, QChar('0'));
}
else {
return QString("%1 s").arg(seconds);
}
}
void LogsDialog::mouseWheel()
@@ -526,7 +453,6 @@ void LogsDialog::mouseWheel()
void LogsDialog::removeAllGraphs()
{
ui->customPlot->clearGraphs();
ui->customPlot->clearItems();
ui->customPlot->legend->setVisible(false);
rightLegend->clearItems();
rightLegend->setVisible(false);
@@ -540,11 +466,6 @@ void LogsDialog::removeAllGraphs()
axisRect->axis(QCPAxis::atRight, 1)->setSelectedParts(QCPAxis::spNone);
axisRect->axis(QCPAxis::atBottom)->setSelectedParts(QCPAxis::spNone);
ui->customPlot->replot();
tracerMaxAlt = 0;
cursorA = 0;
cursorB = 0;
cursorLine = 0;
ui->labelCursors->setText("");
}
void LogsDialog::on_fileOpen_BT_clicked()
@@ -578,12 +499,12 @@ void LogsDialog::on_fileOpen_BT_clicked()
}
}
ui->logTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->logTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
QVarLengthArray<int> sizes;
for (int i = 0; i < ui->logTable->columnCount(); i++) {
sizes.append(ui->logTable->columnWidth(i));
}
ui->logTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
ui->logTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
for (int i = 0; i < ui->logTable->columnCount(); i++) {
ui->logTable->setColumnWidth(i, sizes.at(i));
}
@@ -687,7 +608,7 @@ void LogsDialog::setFlightSessions()
QDateTime lastvalue;
for (int i = 1; i < n; i++) {
QDateTime tmp = getRecordTimeStamp(i);
if (!lastvalue.isValid() || lastvalue.secsTo(tmp) > 60) {
if (lastvalue.secsTo(tmp) > 60) {
sessions.push_back(i-1);
// qDebug() << "session index" << i-1;
}
@@ -983,17 +904,6 @@ void LogsDialog::plotLogs()
plots.coords.at(i).y);
pen.setColor(colors.at(i % colors.size()));
ui->customPlot->graph(i)->setPen(pen);
if (!tracerMaxAlt && (plots.coords.at(i).name.endsWith("(m)") ||
plots.coords.at(i).name.endsWith(" Alt") ||
plots.coords.at(i).name.endsWith("(ft)"))) {
addMaxAltitudeMarker(plots.coords.at(i), ui->customPlot->graph(i));
countNumberOfThrows(plots.coords.at(i), ui->customPlot->graph(i));
addCursor(&cursorA, ui->customPlot->graph(i), Qt::blue);
addCursor(&cursorB, ui->customPlot->graph(i), Qt::red);
addCursorLine(&cursorLine, ui->customPlot->graph(i), Qt::black);
updateCursorsLabel();
}
}
ui->customPlot->legend->setVisible(true);
@@ -1041,73 +951,3 @@ void LogsDialog::yAxisChangeRanges(QCPRange range)
yAxesRanges[firstLeft].max = range.upper;
}
}
void LogsDialog::addMaxAltitudeMarker(const coords & c, QCPGraph * graph) {
// find max altitude
int positionIndex = 0;
double maxAlt = -100000;
for(int i=0; i<c.x.count(); ++i) {
double alt = c.y.at(i);
if (alt > maxAlt) {
maxAlt = alt;
positionIndex = i;
// qDebug() << "max alt: " << maxAlt << "@" << result;
}
}
// qDebug() << "max alt: " << maxAlt << "@" << positionIndex;
// add max altitude marker
tracerMaxAlt = new QCPItemTracer(ui->customPlot);
ui->customPlot->addItem(tracerMaxAlt);
tracerMaxAlt->setGraph(graph);
tracerMaxAlt->setInterpolating(true);
tracerMaxAlt->setStyle(QCPItemTracer::tsSquare);
tracerMaxAlt->setPen(QPen(Qt::blue));
tracerMaxAlt->setBrush(Qt::NoBrush);
tracerMaxAlt->setSize(7);
tracerMaxAlt->setGraphKey(c.x.at(positionIndex));
tracerMaxAlt->updatePosition();
}
void LogsDialog::countNumberOfThrows(const coords & c, QCPGraph * graph)
{
#if 0
// find all launches
// TODO
double startTime = c.x.at(0);
for(int i=0; i<c.x.count(); ++i) {
double alt = c.y.at(i);
double time = c.x.at(i);
}
#endif
}
void LogsDialog::addCursor(QCPItemTracer ** cursor, QCPGraph * graph, const QColor & color) {
QCPItemTracer * c = new QCPItemTracer(ui->customPlot);
ui->customPlot->addItem(c);
c->setGraph(graph);
c->setInterpolating(false);
c->setStyle(QCPItemTracer::tsCrosshair);
QPen pen(color);
pen.setStyle(Qt::DashLine);
c->setPen(pen);
c->setBrush(color);
c->setSize(7);
c->setVisible(false);
*cursor = c;
}
void LogsDialog::addCursorLine(QCPItemStraightLine ** line, QCPGraph * graph, const QColor & color) {
QCPItemStraightLine * l = new QCPItemStraightLine(ui->customPlot);
ui->customPlot->addItem(l);
l->point1->setParentAnchor(cursorA->position);
l->point2->setParentAnchor(cursorB->position);
QPen pen(color);
pen.setStyle(Qt::DashLine);
l->setPen(pen);
l->setVisible(false);
*line = l;
}
+1 -15
View File
@@ -53,7 +53,7 @@ private slots:
void axisLabelDoubleClick(QCPAxis* axis, QCPAxis::SelectablePart part);
void legendDoubleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
void selectionChanged();
void mousePress(QMouseEvent * event);
void mousePress();
void mouseWheel();
void removeAllGraphs();
void plotLogs();
@@ -76,11 +76,6 @@ private:
double yAxesRatios[AXES_LIMIT];
minMax yAxesRanges[AXES_LIMIT];
QCPItemTracer * tracerMaxAlt;
QCPItemTracer * cursorA;
QCPItemTracer * cursorB;
QCPItemStraightLine * cursorLine;
bool cvsFileParse();
QList<QStringList> filterGePoints(const QList<QStringList> & input);
void exportToGoogleEarth();
@@ -88,15 +83,6 @@ private:
QString generateDuration(const QDateTime & start, const QDateTime & end);
void setFlightSessions();
void addMaxAltitudeMarker(const coords & c, QCPGraph * graph);
void countNumberOfThrows(const coords & c, QCPGraph * graph);
void addCursor(QCPItemTracer ** cursor, QCPGraph * graph, const QColor & color);
void addCursorLine(QCPItemStraightLine ** line, QCPGraph * graph, const QColor & color);
void placeCursor(double x, bool second);
QString formatTimeDelta(double timeDelta);
void updateCursorsLabel();
};
#endif // _LOGSDIALOG_H_
+129 -159
View File
@@ -16,78 +16,32 @@
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,0,0,0,0,0,0">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label">
<property name="text">
<string>Fly sessions</string>
<string>Filename</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sessions_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QLineEdit" name="FileName_LE">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QPushButton" name="fileOpen_BT">
<property name="text">
<string>Open LogFile</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" rowspan="12">
<widget class="QTableWidget" name="FieldsTW">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="autoScrollMargin">
<number>0</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<property name="columnCount">
<number>0</number>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="1" column="1">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
@@ -173,7 +127,121 @@
</item>
</layout>
</item>
<item row="13" column="0">
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Fly sessions</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sessions_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="1" rowspan="4">
<widget class="QTableWidget" name="logTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>0</number>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>18</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="1" column="0" rowspan="6">
<widget class="QTableWidget" name="FieldsTW">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="autoScrollMargin">
<number>0</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<property name="columnCount">
<number>0</number>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="7" column="0">
<widget class="QPushButton" name="mapsButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
@@ -208,106 +276,6 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Filename</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="FileName_LE">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fileOpen_BT">
<property name="text">
<string>Open LogFile</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1" rowspan="8">
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="5,1">
<item>
<widget class="QTableWidget" name="logTable">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>0</number>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>18</number>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QLabel" name="labelCursors">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
@@ -321,12 +289,14 @@
</customwidgets>
<tabstops>
<tabstop>FileName_LE</tabstop>
<tabstop>fileOpen_BT</tabstop>
<tabstop>FieldsTW</tabstop>
<tabstop>mapsButton</tabstop>
<tabstop>ZoomX_ChkB</tabstop>
<tabstop>ZoomY_ChkB</tabstop>
<tabstop>Reset_PB</tabstop>
<tabstop>sessions_CB</tabstop>
<tabstop>logTable</tabstop>
</tabstops>
<resources>
<include location="companion.qrc"/>
+136 -169
View File
@@ -71,6 +71,7 @@
#include "progressdialog.h"
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/companion"
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightly/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#ifdef __APPLE__
@@ -84,10 +85,8 @@
#if defined WIN32 || !defined __GNUC__
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightly/companion/windows"
#else
#include <unistd.h>
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightly/companion/linux"
#endif
MainWindow::MainWindow():
@@ -276,57 +275,51 @@ void MainWindow::closeUpdatesWaitDialog()
}
}
QString MainWindow::seekCodeString(const QByteArray & qba, const QString & label)
{
int posLabel = qba.indexOf(label);
if (posLabel < 0)
return QString::null;
int start = qba.indexOf("\"", posLabel + label.length());
if (start < 0)
return QString::null;
int end = qba.indexOf("\"", start + 1);
if (end < 0)
return QString::null;
return qba.mid(start + 1, end - start - 1);
}
void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
{
QByteArray qba = reply->readAll();
QString version = seekCodeString(qba, "VERSION");
if (version.isNull())
return onUpdatesError();
int i = qba.indexOf("VERSION");
if (i>0) {
QString version = qba.mid(i+14, qba.indexOf("\"", i+14)-i-14);
int vnum = version2index(version);
if (version.isNull()) {
return onUpdatesError();
}
QString c9xversion = QString(VERSION);
int c9xver = version2index(c9xversion);
int vnum = version2index(version);
if (c9xver < vnum) {
QString c9xversion = QString(VERSION);
int c9xver = version2index(c9xversion);
if (c9xver < vnum) {
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
"Would you like to download it?").arg(version) ,
QMessageBox::Yes | QMessageBox::No);
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
"Would you like to download it?").arg(version) ,
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
QDir dir(g.updatesDir());
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), dir.absoluteFilePath(QString(COMPANION_INSTALLER).arg(version)), tr("Executable (*.exe)"));
if (!fileName.isEmpty()) {
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->exec();
if (ret == QMessageBox::Yes) {
QDir dir(g.updatesDir());
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), dir.absoluteFilePath(QString(COMPANION_INSTALLER).arg(version)), tr("Executable (*.exe)"));
if (!fileName.isEmpty()) {
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->exec();
}
}
#else
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
#endif
}
else {
if (downloadDialog_forWait && checkForUpdatesState==0) {
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
}
#else
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
#endif
}
else {
if (downloadDialog_forWait && checkForUpdatesState==0) {
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
return onUpdatesError();
}
checkForUpdates();
@@ -357,28 +350,19 @@ void MainWindow::firmwareDownloadAccepted()
QTextStream inputStream(&file);
QString hline = inputStream.readLine();
if (hline.startsWith("ERROR:")) {
int errnum = hline.mid(6).toInt();
int errnum=hline.mid(6).toInt();
switch(errnum) {
case 1:
errormsg = tr("Not enough flash available on this board for all the selected options");
errormsg = tr("Not enough memory for all the selected firmware options");
break;
case 2:
errormsg = tr("Compilation server temporary failure, try later");
errormsg = tr("Compilation server termporary failure, try later");
break;
case 3:
errormsg = tr("Compilation server too busy, try later");
break;
case 4:
errormsg = tr("Compilation error");
break;
case 5:
errormsg = tr("Invalid firmware");
break;
case 6:
errormsg = tr("Invalid board");
break;
case 7:
errormsg = tr("Invalid language");
errormsg = tr("Compilation server requires registration, please check OpenTX web site");
break;
default:
errormsg = tr("Unknown server failure, try later");
@@ -404,106 +388,114 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
bool ignore = false;
QByteArray qba = reply->readAll();
QString versionString = seekCodeString(qba, "VERSION");
QString dateString = seekCodeString(qba, "DATE");
if (versionString.isNull() || dateString.isNull())
return onUpdatesError();
long version = version2index(versionString);
if (version <= 0)
return onUpdatesError();
long version = 0;
QString fullVersionString = QString("%1 (%2)").arg(versionString).arg(dateString);
int versionIndex = qba.indexOf("VERS_STR");
int dateIndex = qba.indexOf("DATE_STR");
if (checkForUpdatesState & AUTOMATIC_DOWNLOAD) {
checkForUpdatesState -= AUTOMATIC_DOWNLOAD;
download = true;
QString versionString;
if (versionIndex > 0 && dateIndex > 0) {
firmwareVersionString = qba.mid(versionIndex+10, qba.indexOf("\"", versionIndex+10)-versionIndex-10);
QString dateString = qba.mid(dateIndex+10, 10);
version = version2index(firmwareVersionString);
versionString = QString("%1 (%2)").arg(firmwareVersionString).arg(dateString);
}
else {
int currentVersion = g.fwRev.get(current_firmware_variant->getId());
QString currentVersionString = index2version(currentVersion);
QMessageBox msgBox;
msgBox.setWindowTitle("Companion");
QSpacerItem * horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout * layout = (QGridLayout*)msgBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (currentVersion == 0) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(fullVersionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
}
msgBox.setIcon(QMessageBox::Question);
msgBox.resize(0, 0);
msgBox.exec();
if (msgBox.clickedButton() == rnButton) {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(fullVersionString), QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes)
download = true;
else
ignore = true;
}
else if (msgBox.clickedButton() == YesButton ) {
download = true;
}
else {
ignore = true;
}
if (version > 0) {
if (checkForUpdatesState & AUTOMATIC_DOWNLOAD) {
checkForUpdatesState -= AUTOMATIC_DOWNLOAD;
download = true;
}
else if (version > currentVersion) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(fullVersionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
}
msgBox.setIcon(QMessageBox::Question);
msgBox.resize(0,0);
msgBox.exec();
if( msgBox.clickedButton() == rnButton ) {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(fullVersionString),
QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
else {
int currentVersion = g.fwRev.get(current_firmware_variant->getId());
QString currentVersionString = index2version(currentVersion);
QMessageBox msgBox;
msgBox.setWindowTitle("Companion");
QSpacerItem * horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout * layout = (QGridLayout*)msgBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (currentVersion == 0) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
}
msgBox.setIcon(QMessageBox::Question);
msgBox.resize(0, 0);
msgBox.exec();
if (msgBox.clickedButton() == rnButton) {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes)
download = true;
else
ignore = true;
}
else if (msgBox.clickedButton() == YesButton ) {
download = true;
}
else {
ignore = true;
}
}
else if (msgBox.clickedButton() == YesButton ) {
download = true;
else if (version > currentVersion) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole);
}
msgBox.setIcon(QMessageBox::Question);
msgBox.resize(0,0);
msgBox.exec();
if( msgBox.clickedButton() == rnButton ) {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(versionString),
QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
download = true;
}
else {
ignore = true;
}
}
else if (msgBox.clickedButton() == YesButton ) {
download = true;
}
else {
ignore = true;
}
}
else {
ignore = true;
if (downloadDialog_forWait && checkForUpdatesState==0) {
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
}
}
else {
if (downloadDialog_forWait && checkForUpdatesState==0) {
QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
}
}
if (ignore) {
int res = QMessageBox::question(this, "Companion", tr("Ignore this release %1?").arg(fullVersionString), QMessageBox::Yes | QMessageBox::No);
if (res==QMessageBox::Yes) {
g.fwRev.set(current_firmware_variant->getId(), version);
if (ignore) {
int res = QMessageBox::question(this, "Companion", tr("Ignore this release %1?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
if (res==QMessageBox::Yes) {
g.fwRev.set(current_firmware_variant->getId(), version);
}
}
else if (download == true) {
startFirmwareDownload();
}
}
else if (download == true) {
firmwareVersionString = versionString;
startFirmwareDownload();
else {
// TODO remove serverFails config?
return onUpdatesError();
}
checkForUpdates();
@@ -909,7 +901,7 @@ void MainWindow::about()
aboutStr.append("<br/><br/>");
aboutStr.append(QString("Version %1, %2").arg(VERSION).arg(__DATE__));
aboutStr.append("<br/><br/>");
aboutStr.append(tr("Copyright OpenTX Team") + "<br/>&copy; 2011-2016<br/>");
aboutStr.append(tr("Copyright OpenTX Team") + "<br/>&copy; 2011-2015<br/>");
QMessageBox msgBox(this);
msgBox.setWindowIcon(CompanionIcon("information.png"));
msgBox.setWindowTitle(tr("About Companion"));
@@ -920,38 +912,15 @@ void MainWindow::about()
void MainWindow::updateMenus()
{
bool hasMdiChild = (activeMdiChild() != 0);
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
if(GetCurrentFirmware()->getBoard() == BOARD_HORUS) {
newAct->setEnabled(false);
openAct->setEnabled(false);
saveAct->setEnabled(false);
saveAsAct->setEnabled(false);
writeEepromAct->setEnabled(false);
readEepromAct->setEnabled(false);
writeBackupToRadioAct->setEnabled(false);
readBackupToFileAct->setEnabled(false);
cutAct->setEnabled(false);
copyAct->setEnabled(false);
pasteAct->setEnabled(false);
for (int i=0; i<MAX_RECENT; ++i)
recentFileActs[i]->setEnabled(false);
} else {
newAct->setEnabled(true);
openAct->setEnabled(true);
saveAct->setEnabled(hasMdiChild);
saveAsAct->setEnabled(hasMdiChild);
cutAct->setEnabled(hasSelection);
copyAct->setEnabled(hasSelection);
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
writeEepromAct->setEnabled(hasMdiChild);
readEepromAct->setEnabled(true);
writeBackupToRadioAct->setEnabled(true);
readBackupToFileAct->setEnabled(true);
for (int i=0; i<MAX_RECENT; ++i)
recentFileActs[i]->setEnabled(true);
}
saveAct->setEnabled(hasMdiChild);
saveAsAct->setEnabled(hasMdiChild);
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
writeEepromAct->setEnabled(hasMdiChild);
separatorAct->setVisible(hasMdiChild);
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
cutAct->setEnabled(hasSelection);
copyAct->setEnabled(hasSelection);
simulateAct->setEnabled(hasSelection);
printAct->setEnabled(hasSelection);
loadbackupAct->setEnabled(hasMdiChild);
@@ -1471,8 +1440,6 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
void MainWindow::dropEvent(QDropEvent *event)
{
if(GetCurrentFirmware()->getBoard()== BOARD_HORUS)
return;
QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty())
return;
+4 -4
View File
@@ -42,7 +42,8 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtWidgets>
#include <QtGui>
#include <QMainWindow>
#include <QDateTime>
#include "downloaddialog.h"
#include "eeprominterface.h"
@@ -82,7 +83,6 @@ class MainWindow : public QMainWindow
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void setLanguage(const QString & langString);
QString seekCodeString(const QByteArray & qba, const QString & label);
private slots:
void openDocURL();
@@ -164,7 +164,7 @@ class MainWindow : public QMainWindow
QMenu * createRecentFileMenu();
QMenu * createProfilesMenu();
void autoClose();
private:
void closeUpdatesWaitDialog();
void onUpdatesError();
@@ -205,7 +205,7 @@ class MainWindow : public QMainWindow
downloadDialog * downloadDialog_forWait;
unsigned int checkForUpdatesState;
QString firmwareVersionString;
QNetworkAccessManager *networkManager;
QMenu *fileMenu;
+5 -5
View File
@@ -270,7 +270,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
bool xmlOK = doc.setContent(&file);
if(xmlOK) {
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(radioData, doc));
if (errors.test(ALL_OK)) {
if (errors.test(NO_ERROR)) {
ui->modelsList->refreshList();
if(resetCurrentFile) setCurrentFile(fileName);
return true;
@@ -301,7 +301,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
file.close();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(radioData, (uint8_t *)eeprom.data(), eeprom_size));
if (!errors.test(ALL_OK)) {
if (!errors.test(NO_ERROR)) {
ShowEepromErrors(this, tr("Error"), tr("Invalid EEPROM File %1").arg(fileName), errors.to_ulong());
return false;
}
@@ -339,9 +339,9 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
}
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size));
if (!errorsEeprom.test(ALL_OK)) {
if (!errorsEeprom.test(NO_ERROR)) {
std::bitset<NUM_ERRORS> errorsBackup((unsigned long long)LoadBackup(radioData, eeprom, eeprom_size, 0));
if (!errorsBackup.test(ALL_OK)) {
if (!errorsBackup.test(NO_ERROR)) {
ShowEepromErrors(this, tr("Error"), tr("Invalid binary EEPROM File %1").arg(fileName), (errorsEeprom | errorsBackup).to_ulong());
return false;
}
@@ -617,7 +617,7 @@ bool MdiChild::loadBackup()
}
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index));
if (!errorsEeprom.test(ALL_OK)) {
if (!errorsEeprom.test(NO_ERROR)) {
ShowEepromErrors(this, tr("Error"), tr("Invalid binary backup File %1").arg(fileName), (errorsEeprom).to_ulong());
return false;
}
+3 -4
View File
@@ -54,8 +54,7 @@ foreach(name ${modeledit_NAMES})
set(modeledit_UIS ${modeledit_UIS} ${name}.ui)
endforeach()
qt5_wrap_ui(modeledit_SRCS ${modeledit_UIS})
qt5_wrap_cpp(modeledit_SRCS ${modeledit_HDRS})
qt4_wrap_ui(modeledit_SRCS ${modeledit_UIS})
qt4_wrap_cpp(modeledit_SRCS ${modeledit_HDRS})
add_library(modeledit ${modeledit_SRCS})
qt5_use_modules(modeledit Widgets Xml Multimedia)
add_library(modeledit ${modeledit_SRCS})
+12 -6
View File
@@ -1,7 +1,13 @@
#include "channels.h"
#include "helpers.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt):
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt):
firmware(firmware),
spinbox(new QDoubleSpinBox()),
value(value),
@@ -44,7 +50,7 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row
horizontalLayout->addWidget(cb);
horizontalLayout->addWidget(spinbox);
tableLayout->addLayout(row, col, horizontalLayout);
gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, allowGVars);
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
}
LimitsGroup::~LimitsGroup()
@@ -113,13 +119,13 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
// Channel offset
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, -1000, 1000, 0);
// Channel min
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax()*10, 0, -1000);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
// Channel max
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax()*10, 1000);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
// Channel inversion
QComboBox * invCB = new QComboBox(this);
@@ -194,7 +200,7 @@ void Channels::nameEdited()
if (!lock) {
QLineEdit *le = qobject_cast<QLineEdit*>(sender());
int index = le->property("index").toInt();
strcpy(model->limitData[index].name, le->text().toLatin1());
strcpy(model->limitData[index].name, le->text().toAscii());
emit modified();
}
}
+2 -1
View File
@@ -3,13 +3,14 @@
#include "helpers.h"
#include "modeledit.h"
#include <QSpinBox>
class GVarGroup;
class LimitsGroup
{
public:
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt);
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt);
~LimitsGroup();
void updateMinMax(int max);
+8 -2
View File
@@ -3,6 +3,11 @@
#include "node.h"
#include "edge.h"
#include "helpers.h"
#include <QSpinBox>
#include <QCheckBox>
#include <QPushButton>
#include <QMessageBox>
#include <QAction>
#define GFX_MARGIN 16
@@ -486,7 +491,7 @@ void Curves::on_curveSmooth_currentIndexChanged(int index)
void Curves::on_curveName_editingFinished()
{
memset(model->curves[currentCurve].name, 0, sizeof(model->curves[currentCurve].name));
strcpy(model->curves[currentCurve].name, ui->curveName->text().toLatin1());
strcpy(model->curves[currentCurve].name, ui->curveName->text().toAscii());
emit modified();
}
@@ -498,8 +503,9 @@ void Curves::resizeEvent(QResizeEvent *event)
ModelPanel::resizeEvent(event);
}
void Curves::on_curveType_currentIndexChanged(int index)
void Curves::on_curveType_currentIndexChanged()
{
int index = ui->curveType->currentIndex();
unsigned int flags = templates[index].flags;
ui->curveCoeffLabel->setVisible(flags & CURVE_COEFF_ENABLE);
ui->curveCoeff->setVisible(flags & CURVE_COEFF_ENABLE);
+2 -1
View File
@@ -3,6 +3,7 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QSpinBox>
enum CopyAction {
CURVE_COPY,
@@ -45,7 +46,7 @@ class Curves : public ModelPanel
void onNodeMoved(int x, int y);
void onNodeFocus();
void onNodeUnfocus();
void on_curveType_currentIndexChanged(int index);
void on_curveType_currentIndexChanged();
void on_curveApply_clicked();
protected:
+1 -1
View File
@@ -94,7 +94,7 @@
<item row="1" column="1">
<widget class="QLineEdit" name="curveName">
<property name="maxLength">
<number>3</number>
<number>6</number>
</property>
</widget>
</item>
+52 -38
View File
@@ -43,9 +43,13 @@ void RepeatComboBox::update()
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
GenericPanel(parent, model, generalSettings, firmware),
functions(model ? model->customFn : generalSettings.customFn),
mediaPlayerCurrent(-1),
mediaPlayer(NULL)
functions(model ? model->customFn : generalSettings.customFn)
#if defined(PHONON)
,
phononCurrent(-1),
clickObject(NULL),
clickOutput(NULL)
#endif
{
Stopwatch s1("CustomFunctionsPanel - populate");
lock = true;
@@ -66,7 +70,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
s1.report("get tracks");
if (IS_TARANIS(firmware->getBoard())) {
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
for (int i=0; i<num_fsw; i++) {
if (functions[i].func==FuncPlayScript) {
QString temp = functions[i].paramarm;
@@ -174,12 +178,14 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
paramLayout->addWidget(fswtchBLcolor[i]);
connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));
#ifdef PHONON
playBT[i] = new QPushButton(this);
playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
playBT[i]->setProperty("index", i);
playBT[i]->setIcon(playIcon);
paramLayout->addWidget(playBT[i]);
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif
QHBoxLayout * repeatLayout = new QHBoxLayout();
tableLayout->addLayout(i, 4, repeatLayout);
@@ -214,42 +220,35 @@ CustomFunctionsPanel::~CustomFunctionsPanel()
{
}
void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state)
#ifdef PHONON
void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::State oldState)
{
if (!lock) {
lock = true;
if (state==QMediaPlayer::StoppedState || state==QMediaPlayer::PausedState) {
mediaPlayer->stop();
if (mediaPlayerCurrent >= 0) {
playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png"));
mediaPlayerCurrent = -1;
if ((newState==Phonon::ErrorState || newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
clickObject->stop();
clickObject->clearQueue();
clickObject->clear();
if (phononCurrent >= 0) {
playBT[phononCurrent]->setIcon(CompanionIcon("play.png"));
phononCurrent = -1;
}
}
lock = false;
}
}
void CustomFunctionsPanel::onMediaPlayerError(QMediaPlayer::Error error)
{
if (!lock) {
lock = true;
if (mediaPlayerCurrent >= 0) {
playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png"));
mediaPlayerCurrent = -1;
}
lock = false;
}
}
void CustomFunctionsPanel::playMusic()
{
if (!mediaPlayer) {
mediaPlayer = new QMediaPlayer(this);
connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onMediaPlayerStateChanged(QMediaPlayer::State)));
connect(mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onMediaPlayerError(QMediaPlayer::Error)));
if (!clickObject) {
clickObject = new Phonon::MediaObject(this);
clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
Phonon::createPath(clickObject, clickOutput);
connect(clickObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State, Phonon::State)));
}
int index = sender()->property("index").toInt();
QPushButton * button = qobject_cast<QPushButton*>(sender());
int index = button->property("index").toInt();
QString path = g.profile[g.id()].sdPath();
QDir qd(path);
QString track;
@@ -273,22 +272,29 @@ void CustomFunctionsPanel::playMusic()
return;
}
if (mediaPlayerCurrent == index) {
mediaPlayer->stop();
if (phononCurrent == index) {
clickObject->stop();
clickObject->clear();
playBT[index]->setIcon(CompanionIcon("play.png"));
mediaPlayerCurrent = -1;
phononCurrent = -1;
}
else {
if (mediaPlayerCurrent >= 0) {
playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png"));
if (phononCurrent >= 0) {
playBT[phononCurrent]->setIcon(CompanionIcon("play.png"));
}
mediaPlayerCurrent = index;
mediaPlayer->setMedia(QUrl::fromLocalFile(track));
mediaPlayer->play();
phononCurrent = index;
clickObject->clear();
#ifdef __APPLE__
clickObject->setCurrentSource(QUrl("file://"+track));
#else
clickObject->setCurrentSource(QUrl(track));
#endif
clickObject->play();
playBT[index]->setIcon(CompanionIcon("stop.png"));
}
}
}
#endif
#define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0)
#define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1)
@@ -367,8 +373,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
}
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
if (modified) cfn.adjustMode = fswtchGVmode[i]->currentIndex();
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | (IS_ARM(firmware->getBoard()) ? CUSTOM_FUNCTION_REPEAT : CUSTOM_FUNCTION_ENABLE);
if (cfn.adjustMode==0 || cfn.adjustMode==3) {
widgetsMask |= CUSTOM_FUNCTION_GV_MODE + CUSTOM_FUNCTION_ENABLE;
if (cfn.adjustMode==0) {
if (modified) cfn.param = fswtchParam[i]->value();
fswtchParam[i]->setDecimals(0);
fswtchParam[i]->setSingleStep(1);
@@ -397,7 +403,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
else if (func>=FuncSetTimer1 && func<=FuncSetTimer3) {
if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds();
fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0));
fswtchParamTime[i]->setMaximumTime(firmware->getMaxTimerStart());
fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59));
fswtchParamTime[i]->setTime(QTimeS(cfn.param));
widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE;
}
@@ -520,7 +526,9 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT);
fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE);
fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR);
#ifdef PHONON
playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY);
#endif
}
void CustomFunctionsPanel::update()
@@ -669,6 +677,12 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi
case 2:
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_GVARS);
break;
case 3:
b->clear();
b->addItem("-1", 0);
b->addItem("+1", 1);
b->setCurrentIndex(value);
break;
}
}
else {
+21 -7
View File
@@ -3,14 +3,24 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QtMultimedia>
#include <QLabel>
#include <QCheckBox>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QTimeEdit>
#ifdef PHONON
#include <phonon/audiooutput.h>
#include <phonon/mediaobject.h>
#include <phonon/mediasource.h>
#endif
class RepeatComboBox: public QComboBox
{
Q_OBJECT
public:
RepeatComboBox(QWidget * parent, int & repeatParam);
RepeatComboBox(QWidget *parent, int & repeatParam);
void update();
signals:
@@ -25,7 +35,7 @@ class RepeatComboBox: public QComboBox
class CustomFunctionsPanel : public GenericPanel
{
Q_OBJECT
Q_OBJECT
public:
CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, Firmware * firmware);
@@ -42,9 +52,10 @@ class CustomFunctionsPanel : public GenericPanel
void fsw_customContextMenuRequested(QPoint pos);
void refreshCustomFunction(int index, bool modified=false);
void onChildModified();
#ifdef PHONON
void playMusic();
void onMediaPlayerStateChanged(QMediaPlayer::State state);
void onMediaPlayerError(QMediaPlayer::Error error);
void mediaPlayer_state(Phonon::State newState, Phonon::State oldState);
#endif
void fswDelete();
void fswCopy();
void fswPaste();
@@ -57,7 +68,7 @@ class CustomFunctionsPanel : public GenericPanel
QSet<QString> tracksSet;
QSet<QString> scriptsSet;
int mediaPlayerCurrent;
int phononCurrent;
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
@@ -70,7 +81,10 @@ class CustomFunctionsPanel : public GenericPanel
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS];
QMediaPlayer * mediaPlayer;
#ifdef PHONON
Phonon::MediaObject *clickObject;
Phonon::AudioOutput *clickOutput;
#endif
int selectedFunction;
+5 -5
View File
@@ -21,11 +21,11 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, 0, -100, 100);
}
else {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, 0, 100);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
gvOffsetGroup = NULL;
ui->offsetLabel->hide();
ui->offsetGV->hide();
@@ -33,7 +33,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->offsetCB->hide();
}
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, model,
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
@@ -154,7 +154,7 @@ void ExpoDialog::valuesChanged()
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toLatin1().data());
strcpy(ed->name, ui->lineName->text().toAscii().data());
if (firmware->getCapability(VirtualInputs)) {
inputName = ui->inputName->text();
}
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef EXPODIALOG_H
#define EXPODIALOG_H
#include <QtWidgets>
#include <QDialog>
#include "eeprominterface.h"
#include "modelprinter.h"
+25 -52
View File
@@ -1,6 +1,9 @@
#include "flightmodes.h"
#include "ui_flightmode.h"
// #include "firmwares/opentx/opentxeeprom.h" // TODO shouldn't be there
#include "helpers.h"
#include <QComboBox>
#include <QGridLayout>
FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
@@ -107,14 +110,14 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
reLayout->addWidget(label, i, 0, 1, 1);
if (phaseIdx > 0) {
// RE link to another RE
reUse[i] = new QComboBox(ui->reGB);
reUse[i]->setProperty("index", i);
populateGvarUseCB(reUse[i], phaseIdx);
QComboBox *link = new QComboBox(ui->gvGB);
link->setProperty("index", i);
populateGvarUseCB(link, phaseIdx);
connect(link, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
if (phase.rotaryEncoders[i] > 1024) {
reUse[i]->setCurrentIndex(phase.rotaryEncoders[i] - 1024);
link->setCurrentIndex(phase.rotaryEncoders[i] - 1024);
}
connect(reUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
reLayout->addWidget(reUse[i], i, 1, 1, 1);
reLayout->addWidget(link, i, 1, 1, 1);
}
// RE value
reValues[i] = new QSpinBox(ui->reGB);
@@ -149,14 +152,14 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
}
if (phaseIdx > 0) {
// GVar link to another GVar
gvUse[i] = new QComboBox(ui->gvGB);
gvUse[i]->setProperty("index", i);
populateGvarUseCB(gvUse[i], phaseIdx);
QComboBox *link = new QComboBox(ui->gvGB);
link->setProperty("index", i);
populateGvarUseCB(link, phaseIdx);
if (phase.gvars[i] > 1024) {
gvUse[i]->setCurrentIndex(phase.gvars[i] - 1024);
link->setCurrentIndex(phase.gvars[i] - 1024);
}
connect(gvUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUse_currentIndexChanged(int)));
gvLayout->addWidget(gvUse[i], i, col++, 1, 1);
connect(link, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUse_currentIndexChanged(int)));
gvLayout->addWidget(link, i, col++, 1, 1);
}
// GVar value
gvValues[i] = new QSpinBox(ui->gvGB);
@@ -217,7 +220,7 @@ void FlightModePanel::update()
gvNames[i]->setText(model->gvars_names[i]);
}
gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i));
gvValues[i]->setValue(model->getGVarFieldValue(phaseIdx, i));
gvValues[i]->setValue(model->getGVarValue(phaseIdx, i));
if (IS_TARANIS(GetEepromInterface()->getBoard()) && phaseIdx == 0) {
gvPopups[i]->setChecked(model->gvars_popups[i]);
}
@@ -229,9 +232,8 @@ void FlightModePanel::update()
int idx = phase.rotaryEncoders[i];
FlightModeData *phasere = &phase;
while (idx > 1024) {
int nextPhase = idx - 1025;
if (nextPhase >= phaseIdx) nextPhase += 1;
phasere = &model->flightModeData[nextPhase];
idx -= 1025;
phasere = &model->flightModeData[idx];
idx = phasere->rotaryEncoders[i];
reValues[i]->setDisabled(true);
}
@@ -242,18 +244,16 @@ void FlightModePanel::update()
void FlightModePanel::phaseName_editingFinished()
{
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender());
strcpy(phase.name, lineEdit->text().toLatin1());
strcpy(phase.name, lineEdit->text().toAscii());
emit modified();
emit nameModified();
}
void FlightModePanel::phaseSwitch_currentIndexChanged(int index)
{
if (!lock) {
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
phase.swtch = RawSwitch(comboBox->itemData(index).toInt());
emit modified();
}
}
void FlightModePanel::phaseFadeIn_editingFinished()
@@ -290,14 +290,8 @@ void FlightModePanel::trimUpdate(unsigned int trim)
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
else
trimsUse[trim]->setCurrentIndex(phase.trimRef[chn]);
if (phaseIdx == 0 || phase.trimRef[chn] == phaseIdx || (IS_TARANIS(board) && phase.trimMode[chn] != 0)) {
trimsValue[trim]->setEnabled(true);
trimsSlider[trim]->setEnabled(true);
}
else {
trimsValue[trim]->setEnabled(false);
trimsSlider[trim]->setEnabled(false);
}
trimsValue[trim]->setEnabled(true);
trimsSlider[trim]->setEnabled(true);
}
lock = false;
}
@@ -318,7 +312,7 @@ void FlightModePanel::GVName_editingFinished()
QLineEdit *lineedit = qobject_cast<QLineEdit*>(sender());
int gvar = lineedit->property("index").toInt();
memset(&model->gvars_names[gvar], 0, sizeof(model->gvars_names[gvar]));
strcpy(model->gvars_names[gvar], lineedit->text().toLatin1());
strcpy(model->gvars_names[gvar], lineedit->text().toAscii());
emit modified();
}
}
@@ -346,7 +340,6 @@ void FlightModePanel::phaseGVPopupToggled(bool checked)
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
int gvar = cb->property("index").toInt();
model->gvars_popups[gvar] = checked;
emit modified();
}
void FlightModePanel::phaseREValue_editingFinished()
@@ -449,29 +442,9 @@ void FlightModePanel::fmClear()
{
int res = QMessageBox::question(this, "Companion", tr("Clear all current Flight Mode properties?"), QMessageBox::Yes | QMessageBox::No);
if (res == QMessageBox::Yes) {
phase.clear(phaseIdx);
if (phaseIdx == 0) {
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i < gvCount; ++i) {
memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i]));
model->gvars_popups[i] = 0;
}
}
}
else {
lock = true;
QComboBox * pswtch = ui->swtch;
RawSwitch item = RawSwitch(SWITCH_TYPE_NONE);
pswtch->setCurrentIndex(pswtch->findText(item.toString()));
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes))) {
for (int i=0; i<gvCount; i++) {
gvUse[i]->setCurrentIndex((phase.gvars[i] > 1024 ? (phase.gvars[i] - 1024) : 0));
}
}
for (int i=0; i<reCount; i++) {
reUse[i]->setCurrentIndex((phase.rotaryEncoders[i] > 1024 ? (phase.rotaryEncoders[i] - 1024) : 0));
}
lock = false;
phase.clear();
for(int i=0; i < 4; ++i) {
model->setTrimValue(phaseIdx, i, 0);
}
update();
emit modified();
+6 -2
View File
@@ -3,6 +3,12 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QVector>
#include <QLabel>
#include <QTabWidget>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
namespace Ui {
class FlightMode;
@@ -48,9 +54,7 @@ class FlightModePanel : public ModelPanel
QLineEdit * gvNames[C9X_MAX_GVARS];
QSpinBox * gvValues[C9X_MAX_GVARS];
QCheckBox * gvPopups[C9X_MAX_GVARS];
QComboBox * gvUse[C9X_MAX_GVARS];
QSpinBox * reValues[C9X_MAX_ENCODERS];
QComboBox * reUse[C9X_MAX_ENCODERS];
QVector<QComboBox *> trimsUse;
QVector<QSpinBox *> trimsValue;
QVector<QSlider *> trimsSlider;
+9 -7
View File
@@ -1,4 +1,5 @@
#include "inputs.h"
#include <QMessageBox>
#include "expodialog.h"
#include "helpers.h"
@@ -198,7 +199,7 @@ void InputsPanel::gm_openExpo(int index)
if (g->exec()) {
model->expoData[index] = mixd;
if (firmware->getCapability(VirtualInputs))
strncpy(model->inputNames[mixd.chn], inputName.toLatin1().data(), 4);
strncpy(model->inputNames[mixd.chn], inputName.toAscii().data(), 4);
emit modified();
update();
}
@@ -287,6 +288,8 @@ void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropActi
pasteExpoMimeData(data, idx);
}
#include <iostream>
#include <QtGui/qwidget.h>
void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
{
if (mimeData->hasFormat("application/x-companion-expo")) {
@@ -322,12 +325,11 @@ void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
void InputsPanel::exposPaste()
{
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
QListWidgetItem *item = ExposlistWidget->currentItem();
if (item) {
pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
}
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
QListWidgetItem *item = ExposlistWidget->currentItem();
if (item)
pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
}
void InputsPanel::exposDuplicate()
@@ -1,4 +1,10 @@
#include "logicalswitches.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>
#include "helpers.h"
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
@@ -3,6 +3,9 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QTimeEdit>
class LogicalSwitchesPanel : public ModelPanel
{
+5 -4
View File
@@ -25,10 +25,10 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
int limit = firmware->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, model, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, model, 0, -limit, limit);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB,
md->curve, model, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
ui->MixDR_CB->setChecked(md->noExpo == 0);
@@ -159,7 +159,8 @@ void MixerDialog::valuesChanged()
md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale);
md->speedUp = round(ui->slowUpSB->value()*scale);
strcpy(md->name, ui->mixerName->text().toLatin1());
strcpy(md->name, ui->mixerName->text().toAscii());
md->flightModes = 0;
for (int i=8; i>=0 ; i--) {
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef MIXERDIALOG_H
#define MIXERDIALOG_H
#include <QtWidgets>
#include <QDialog>
#include "eeprominterface.h"
class GVarGroup;
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef MIXERSLIST_H
#define MIXERSLIST_H
#include <QtWidgets>
#include <QtGui>
#define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled
const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item
+2
View File
@@ -1,5 +1,7 @@
#include "mixes.h"
#include "helpers.h"
// #include <QMessageBox>
// #include "expodialog.h"
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
+1
View File
@@ -13,6 +13,7 @@
#include "customfunctions.h"
#include "telemetry.h"
#include "appdata.h"
#include <QScrollArea>
ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware) :
QDialog(parent),
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef MODELEDIT_H
#define MODELEDIT_H
#include <QtWidgets>
#include <QDialog>
#include "genericpanel.h"
class RadioData;
+2 -2
View File
@@ -82,7 +82,7 @@ void Node::stepToCenter(qreal step)
if(centerX)
{
qreal x = qr.right() - qr.width()/2;
if(fabs(x-p.x())>xStep)
if(abs(x-p.x())>xStep)
p.rx() += p.x()>x ? -xStep : xStep;
else
p.rx() = x;
@@ -91,7 +91,7 @@ void Node::stepToCenter(qreal step)
if(centerY)
{
qreal y = qr.bottom() - qr.height()/2;
if(fabs(y-p.y())>yStep)
if(abs(y-p.y())>yStep)
p.ry() += p.y()>y ? -yStep : yStep;
else
p.ry() = y;
+1 -1
View File
@@ -42,7 +42,7 @@
#ifndef NODE_H
#define NODE_H
#include <QtWidgets>
#include <QtGui>
#define DEFAULT_BALL_SIZE 10
#define BALL_HEIGHT 2
+17 -90
View File
@@ -42,8 +42,6 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE);
ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC);
}
ui->value->setMaximumTime(firmware->getMaxTimerStart());
ui->persistent->setField(timer.persistent, this);
ui->persistent->addItem(tr("Not persistent"), 0);
@@ -68,11 +66,9 @@ TimerPanel::~TimerPanel()
void TimerPanel::update()
{
int hour = timer.val / 3600;
int min = (timer.val - (hour * 3600)) / 60;
int sec = (timer.val - (hour * 3600)) % 60;
ui->value->setTime(QTime(hour, min, sec));
int min = timer.val / 60;
int sec = timer.val % 60;
ui->value->setTime(QTime(0, min, sec));
if (firmware->getCapability(PermTimers)) {
int sign = 1;
@@ -98,7 +94,7 @@ QWidget * TimerPanel::getLastFocus()
void TimerPanel::on_value_editingFinished()
{
timer.val = ui->value->time().hour()*3600 + ui->value->time().minute()*60 + ui->value->time().second();
timer.val = ui->value->time().minute()*60 + ui->value->time().second();
emit modified();
}
@@ -119,7 +115,7 @@ void TimerPanel::on_minuteBeep_toggled(bool checked)
void TimerPanel::on_name_editingFinished()
{
int length = ui->name->maxLength();
strncpy(timer.name, ui->name->text().toLatin1(), length);
strncpy(timer.name, ui->name->text().toAscii(), length);
emit modified();
}
@@ -181,11 +177,6 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
}
}
for (int i=0; i<=MM_RF_PROTO_LAST; i++)
{
ui->multiProtocol->addItem(ModelPrinter::printMultiRfProtocol(i), (QVariant) i);
}
if (firmware->getCapability(HasFailsafe)) {
for (int i=0; i<maxChannels; i++) {
QLabel * label = new QLabel(this);
@@ -231,7 +222,6 @@ ModulePanel::~ModulePanel()
#define MASK_PPM_FIELDS 16
#define MASK_FAILSAFES 32
#define MASK_OPEN_DRAIN 64
#define MASK_MULTIMODULE 128
void ModulePanel::update()
{
@@ -267,9 +257,6 @@ void ModulePanel::update()
mask |= MASK_OPEN_DRAIN;
}
break;
case PULSES_MULTIMODULE:
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER | MASK_MULTIMODULE;
break;
case PULSES_OFF:
default:
break;
@@ -302,44 +289,18 @@ void ModulePanel::update()
// PPM settings fields
ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmPolarity->setCurrentIndex(module.ppm.pulsePol);
ui->ppmPolarity->setCurrentIndex(module.ppmPulsePol);
ui->label_ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
ui->ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
ui->ppmOutputType->setCurrentIndex(module.ppm.outputType);
ui->ppmOutputType->setCurrentIndex(module.ppmOutputType);
ui->label_ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmDelay->setValue(module.ppm.delay);
ui->ppmDelay->setValue(module.ppmDelay);
ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
ui->ppmFrameLength->setMinimum(module.channelsCount*(model->extendedLimits ? 2.250 : 2)+3.5);
ui->ppmFrameLength->setMaximum(firmware->getCapability(PPMFrameLength));
ui->ppmFrameLength->setValue(22.5+((double)module.ppm.frameLength)*0.5);
// Multi settings fields
ui->label_multiProtocol->setVisible(mask & MASK_MULTIMODULE);
ui->multiProtocol->setVisible(mask & MASK_MULTIMODULE);
ui->multiProtocol->setCurrentIndex(module.getMultiRfProtocol());
ui->label_multiSubType->setVisible(mask & MASK_MULTIMODULE);
ui->multiSubType->setVisible(mask & MASK_MULTIMODULE);
if (mask & MASK_MULTIMODULE) {
int numEntries = getNumSubtypes(static_cast<MultiModuleRFProtocols>(module.getMultiRfProtocol()));
// Removes extra items
ui->multiSubType->setMaxCount(numEntries);
for (int i=0; i < numEntries; i++) {
if (i < ui->multiSubType->count())
ui->multiSubType->setItemText(i, ModelPrinter::printMultiSubType(module.getMultiRfProtocol(), i));
else
ui->multiSubType->addItem(ModelPrinter::printMultiSubType(module.getMultiRfProtocol(), i), (QVariant) i);
}
}
ui->multiSubType->setCurrentIndex(module.subType);
ui->cb_autoBind->setVisible(mask & MASK_MULTIMODULE);
ui->cb_autoBind->setChecked(module.multi.autoBindMode ? Qt::Checked : Qt::Unchecked);
ui->cb_lowPower->setVisible(mask & MASK_MULTIMODULE);
ui->cb_lowPower->setChecked(module.multi.lowPowerMode ? Qt::Checked : Qt::Unchecked);
ui->ppmFrameLength->setValue(22.5+((double)module.ppmFrameLength)*0.5);
if (firmware->getCapability(HasFailsafe)) {
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
@@ -366,8 +327,8 @@ void ModulePanel::update()
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
if (mask & MASK_CHANNELS_RANGE) {
ui->channelsStart->setMaximum(33 - ui->channelsCount->value());
ui->channelsCount->setMaximum(qMin(16, 33-ui->channelsStart->value()));
ui->channelsStart->setMaximum(32 - ui->channelsCount->value());
ui->channelsCount->setMaximum(qMin(16, 32-ui->channelsStart->value()));
}
}
@@ -391,13 +352,13 @@ void ModulePanel::on_protocol_currentIndexChanged(int index)
void ModulePanel::on_ppmPolarity_currentIndexChanged(int index)
{
module.ppm.pulsePol = index;
module.ppmPulsePol = index;
emit modified();
}
void ModulePanel::on_ppmOutputType_currentIndexChanged(int index)
{
module.ppm.outputType = index;
module.ppmOutputType = index;
emit modified();
}
@@ -423,7 +384,7 @@ void ModulePanel::on_ppmDelay_editingFinished()
{
if (!lock) {
// TODO only accept valid values
module.ppm.delay = ui->ppmDelay->value();
module.ppmDelay = ui->ppmDelay->value();
emit modified();
}
}
@@ -436,7 +397,7 @@ void ModulePanel::on_rxNumber_editingFinished()
void ModulePanel::on_ppmFrameLength_editingFinished()
{
module.ppm.frameLength = (ui->ppmFrameLength->value()-22.5) / 0.5;
module.ppmFrameLength = (ui->ppmFrameLength->value()-22.5) / 0.5;
emit modified();
}
@@ -470,39 +431,6 @@ void ModulePanel::onFailsafeComboIndexChanged(int index)
}
}
void ModulePanel::on_multiProtocol_currentIndexChanged(int index)
{
if (!lock) {
lock=true;
module.setMultiRfProtocol(index);
unsigned int maxSubTypes = getNumSubtypes(static_cast<MultiModuleRFProtocols>(index));
module.subType = std::min(module.subType, maxSubTypes -1);
update();
emit modified();
lock = false;
}
}
void ModulePanel::on_multiSubType_currentIndexChanged(int index)
{
if (!lock) {
lock=true;
module.subType = index;
update();
emit modified();
lock = false;
}
}
void ModulePanel::on_autoBind_stateChanged(int state)
{
module.multi.autoBindMode = (state == Qt::Checked);
}
void ModulePanel::on_lowPower_stateChanged(int state)
{
module.multi.lowPowerMode = (state == Qt::Checked);
}
void ModulePanel::updateFailsafe(int channel)
{
int failsafeValue = module.failsafeChannels[channel];
@@ -800,14 +728,14 @@ void SetupPanel::on_throttleSource_currentIndexChanged(int index)
void SetupPanel::on_name_editingFinished()
{
int length = ui->name->maxLength();
strncpy(model->name, ui->name->text().toLatin1(), length);
strncpy(model->name, ui->name->text().toAscii(), length);
emit modified();
}
void SetupPanel::on_image_currentIndexChanged(int index)
{
if (!lock) {
strncpy(model->bitmap, ui->image->currentText().toLatin1(), 10);
strncpy(model->bitmap, ui->image->currentText().toAscii(), 10);
QString path = g.profile[g.id()].sdPath();
path.append("/BMP/");
QDir qd(path);
@@ -846,7 +774,6 @@ void SetupPanel::populateThrottleSourceCB()
lock = true;
ui->throttleSource->clear();
ui->throttleSource->addItem(QObject::tr("THR"));
if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
+6 -4
View File
@@ -3,6 +3,12 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QVector>
#include <QCheckBox>
#include <QSlider>
#include <QSpinBox>
#include <QComboBox>
#include <QLabel>
namespace Ui {
class Setup;
@@ -65,10 +71,6 @@ class ModulePanel : public ModelPanel
void on_failsafeMode_currentIndexChanged(int value);
void onFailsafeComboIndexChanged(int index);
void onFailsafeSpinChanged(double value);
void on_multiProtocol_currentIndexChanged(int index);
void on_multiSubType_currentIndexChanged(int index);
void on_autoBind_stateChanged(int state);
void on_lowPower_stateChanged(int state);
private:
ModuleData & module;

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