Compare commits

..

1 Commits

Author SHA1 Message Date
Arne Schwabe fe72bb028c 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-04 17:44:00 +01:00
538 changed files with 23950 additions and 37843 deletions
+7 -13
View File
@@ -1,20 +1,14 @@
language: cpp
before_install:
- 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 add-apt-repository ppa:ubuntu-toolchain-r/test --yes
- sudo add-apt-repository ppa:beineri/opt-qt551 --yes
- sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' --yes
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-get update -qq
- rsync -av firmware.diydrones.com::Tools/Travis/*.deb ExtraPackages
- 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 install -y xvfb lcov cmake cmake-data bc curl gcc-arm-none-eabi qt-latest g++-5 libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libfox-1.6-dev libgtest-dev python-clang-3.8 libclang-3.8-dev python-qt4
- sudo dpkg -i ExtraPackages/*.deb || echo "FAILED INSTALL OF EXTRA DEBS"
- export CXX="g++-5" CC="gcc-5"
- 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:
- ./radio/util/commit-tests.sh .
- radio/util/commit-tests.sh
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS .. && cmake --build .
+1 -19
View File
@@ -9,10 +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)
set(CMAKE_CXX_STANDARD 11)
set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio)
set(RADIO_SRC_DIRECTORY ${RADIO_DIRECTORY}/src)
@@ -22,19 +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)
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 -1
View File
@@ -1,6 +1,6 @@
##OpenTX 2.2 Branch
[![Build Status](https://travis-ci.org/opentx/opentx.svg?branch=next)](https://travis-ci.org/opentx/opentx)
[![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)
+5 -2
View File
@@ -5,7 +5,7 @@ macro(add_bitmaps_target targetname filter width format)
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})
@@ -15,8 +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}
)
add_custom_target(ttf_${radio}_${name} DEPENDS ${target}.png ${target}.specs)
endmacro(add_truetype_font_target)
+21 -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.
@@ -161,4 +162,4 @@ IF(SDL_LIBRARY_TEMP)
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}})
+68 -25
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,6 +27,24 @@ 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)
@@ -36,6 +56,21 @@ 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 ")
find_package(Lupdate)
if(LUPDATE_FOUND)
@@ -46,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)
@@ -67,6 +108,7 @@ include_directories(
${COMPANION_SRC_DIRECTORY}
${COMPANION_SRC_DIRECTORY}/shared
${SIMU_SRC_DIRECTORY}
${XSD_INCLUDE_DIR}
${COMPANION_SRC_DIRECTORY}/qxtcommandoptions
)
@@ -74,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)
@@ -96,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
@@ -194,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)
@@ -219,23 +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})
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()
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 ###############
@@ -249,20 +294,21 @@ 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()
# 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 ####################
@@ -283,13 +329,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
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")
else()
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)
@@ -317,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
@@ -344,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
@@ -371,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)
-14
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++)
-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;
+6 -1
View File
@@ -109,9 +109,14 @@ void AppPreferencesDialog::initSettings()
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
#if defined(ALLOW_NIGHTLY_BUILDS)
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
#else
ui->useCompanionNightlyBuilds->hide();
ui->useFirmwareNightlyBuilds->hide();
#endif
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize());
+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
+1 -4
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;
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE RCC><RCC version="1.0">
<RCC>
<qresource prefix="/">
<file>images/customize.png</file>
<file>icon.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
@@ -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;
}
+7 -8
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();
}
}
}
@@ -1525,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++) {
@@ -1686,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 {
@@ -1706,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 {
@@ -1727,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 {
+5 -7
View File
@@ -21,7 +21,7 @@
#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>
@@ -46,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},
@@ -1080,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();
@@ -1509,7 +1506,8 @@ void registerOpenTxFirmwares();
void unregisterOpenTxFirmwares();
enum EepromLoadErrors {
ALL_OK,
NO_ERROR,
UNKNOWN_ERROR,
UNSUPPORTED_NEWER_VERSION,
WRONG_SIZE,
+5 -33
View File
@@ -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) {
@@ -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;
@@ -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; };
@@ -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;
@@ -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; };
@@ -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();
}
+53 -77
View File
@@ -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;
@@ -1465,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>());
@@ -1628,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);
@@ -1773,7 +1767,7 @@ class LogicalSwitchField: public TransformedField {
}
}
~LogicalSwitchField()
~LogicalSwitchField()
{
delete andswitchesConversionTable;
}
@@ -2119,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);
@@ -2215,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);
@@ -2232,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);
@@ -2535,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>());
@@ -2884,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);
@@ -2906,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)
@@ -3199,7 +3193,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
}
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));
}
@@ -3227,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))
@@ -3255,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) {
@@ -3375,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));
@@ -3386,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));
@@ -3403,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));
@@ -3427,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));
@@ -3461,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) {
@@ -3526,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));
}
@@ -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();
}
@@ -973,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)
@@ -1081,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();
}
@@ -1097,10 +1097,25 @@ QString OpenTxFirmware::getFirmwareBaseUrl()
QString OpenTxFirmware::getFirmwareUrl()
{
QString url = getFirmwareBaseUrl();
if (IS_ARM(board))
url.append(QString("/getfw.php?fw=%1.bin").arg(id));
else
url.append(QString("/getfw.php?fw=%1.hex").arg(id));
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;
}
@@ -1325,7 +1340,7 @@ 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("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"));
@@ -1423,7 +1438,6 @@ void registerOpenTxFirmwares()
/* 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"));
firmware->addOption("horussticks", QObject::tr("Horus magnetic sticks"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
@@ -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
@@ -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"
+1
View File
@@ -203,6 +203,7 @@ void FlashFirmwareDialog::on_useLibrarySplash_clicked()
void FlashFirmwareDialog::on_burnButton_clicked()
{
g.flashDir(QFileInfo(fwName).dir().absolutePath());
g.profile[g.id()].fwName(fwName);
g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked());
g.backupOnFlash(ui->backupEEprom->isChecked());
+2 -1
View File
@@ -1,7 +1,8 @@
#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"
+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);
+7 -67
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();
@@ -136,45 +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;
@@ -222,8 +183,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
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 {
@@ -239,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) ,
@@ -268,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>
+1 -1
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);
}
}
+1 -2
View File
@@ -1,8 +1,7 @@
#ifndef HELPERS_H
#define HELPERS_H
#include <QCheckBox>
#include <QSpinBox>
#include <QtGui>
#include <QTableWidget>
#include <QGridLayout>
#include <QDebug>
+2 -2
View File
@@ -499,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));
}
+125 -123
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,7 +350,7 @@ 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 memory for all the selected firmware options");
@@ -395,105 +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) {
startFirmwareDownload();
else {
// TODO remove serverFails config?
return onUpdatesError();
}
checkForUpdates();
@@ -899,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"));
+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})
+7 -1
View File
@@ -1,5 +1,11 @@
#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, int min, int max, int deflt):
firmware(firmware),
@@ -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();
}
}
+1
View File
@@ -3,6 +3,7 @@
#include "helpers.h"
#include "modeledit.h"
#include <QSpinBox>
class GVarGroup;
+6 -1
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();
}
+1
View File
@@ -3,6 +3,7 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QSpinBox>
enum CopyAction {
CURVE_COPY,
+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>
+51 -37
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);
@@ -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;
+1 -1
View File
@@ -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"
+6 -3
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),
@@ -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]);
}
@@ -241,7 +244,7 @@ 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();
}
@@ -309,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();
}
}
+6
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;
+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
{
+2 -1
View File
@@ -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;
+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
+3 -4
View File
@@ -115,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();
}
@@ -728,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);
@@ -774,7 +774,6 @@ void SetupPanel::populateThrottleSourceCB()
lock = true;
ui->throttleSource->clear();
ui->throttleSource->addItem(QObject::tr("THR"));
if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
+6
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;
+1 -1
View File
@@ -648,7 +648,7 @@ void TelemetrySensorPanel::updateSourcesComboBox(AutoComboBox * cb, bool negativ
void TelemetrySensorPanel::on_name_editingFinished()
{
if (!lock) {
strcpy(sensor.label, ui->name->text().toLatin1());
strcpy(sensor.label, ui->name->text().toAscii());
emit dataModified();
emit modified();
}
+3
View File
@@ -3,6 +3,9 @@
#include "modeledit.h"
#include "eeprominterface.h"
#include <QGroupBox>
#include <QComboBox>
#include <QDoubleSpinBox>
class AutoComboBox;
+2
View File
@@ -1,4 +1,6 @@
#include "templates.h"
#include <QListWidget>
#include <QMessageBox>
#define CHANNEL_ORDER(x) generalSettings.getDefaultStick(x)
#define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef TEMPLATES_H
#define TEMPLATES_H
#include <QtWidgets>
#include <QWidget>
#include "eeprominterface.h"
class Templates : public QWidget
+22 -25
View File
@@ -269,7 +269,7 @@ QString ModelPrinter::printInputName(int idx)
else {
result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model);
}
return result.toHtmlEscaped();
return Qt::escape(result);
}
QString ModelPrinter::printInputLine(int idx)
@@ -288,29 +288,26 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
}
if (firmware->getCapability(VirtualInputs)) {
str += input.srcRaw.toString(&model).toHtmlEscaped();
str += Qt::escape(input.srcRaw.toString(&model));
}
str += " " + tr("Weight").toHtmlEscaped() + QString("(%1)").arg(getGVarString(input.weight,true).toHtmlEscaped());
if (input.curve.value) str += " " + input.curve.toString().toHtmlEscaped();
str += " " + Qt::escape(tr("Weight")) + QString("(%1)").arg(getGVarString(input.weight,true));
if (input.curve.value) str += " " + Qt::escape(input.curve.toString());
QString flightModesStr = printFlightModes(input.flightModes);
if (!flightModesStr.isEmpty()) str += " " + flightModesStr.toHtmlEscaped();
if (!flightModesStr.isEmpty()) str += " " + Qt::escape(flightModesStr);
if (input.swtch.type != SWITCH_TYPE_NONE)
str += " " + tr("Switch").toHtmlEscaped() + QString("(%1)").arg(input.swtch.toString().toHtmlEscaped());
str += " " + Qt::escape(tr("Switch")) + QString("(%1)").arg(input.swtch.toString());
if (firmware->getCapability(VirtualInputs)) {
if (input.carryTrim>0) str += " " + tr("NoTrim").toHtmlEscaped();
else if (input.carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model).toHtmlEscaped();
if (input.carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
else if (input.carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model));
}
if (input.offset)
str += " " + tr("Offset(%1)").arg(getGVarString(input.offset)).toHtmlEscaped();
if (firmware->getCapability(HasExpoNames) && input.name[0])
str += QString(" [%1]").arg(input.name).toHtmlEscaped();
str += Qt::escape(QString(" [%1]").arg(input.name));
return str;
}
@@ -326,7 +323,7 @@ QString ModelPrinter::printMixerName(int curDest)
name.append(" ");
str += name.left(8);
}
return str.toHtmlEscaped();
return Qt::escape(str);
}
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
@@ -349,43 +346,43 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in
str += "&nbsp;&nbsp;";
}
// highlight source if needed
QString source = mix.srcRaw.toString(&model).toHtmlEscaped();
QString source = Qt::escape(mix.srcRaw.toString(&model));
if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {
source = "<b>" + source + "</b>";
}
str += "&nbsp;" + source;
str += " " + tr("Weight(%1)").arg(getGVarString(mix.weight, true)).toHtmlEscaped();
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(mix.weight, true)));
QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty())
str += " " + flightModesStr.toHtmlEscaped();
str += " " + Qt::escape(flightModesStr);
if (mix.swtch.type != SWITCH_TYPE_NONE)
str += " " + tr("Switch(%1)").arg(mix.swtch.toString()).toHtmlEscaped();
str += " " + Qt::escape(tr("Switch(%1)").arg(mix.swtch.toString()));
if (mix.carryTrim > 0)
str += " " + tr("NoTrim").toHtmlEscaped();
str += " " + Qt::escape(tr("NoTrim"));
else if (mix.carryTrim < 0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model);
if (firmware->getCapability(HasNoExpo) && mix.noExpo)
str += " " + tr("No DR/Expo").toHtmlEscaped();
str += " " + Qt::escape(tr("No DR/Expo"));
if (mix.sOffset)
str += " " + tr("Offset(%1)").arg(getGVarString(mix.sOffset)).toHtmlEscaped();
str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(mix.sOffset)));
if (mix.curve.value)
str += " " + mix.curve.toString().toHtmlEscaped();
str += " " + Qt::escape(mix.curve.toString());
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (mix.delayDown || mix.delayUp)
str += " " + tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale).toHtmlEscaped();
str += " " + Qt::escape(tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale));
if (mix.speedDown || mix.speedUp)
str += " " + tr("Slow(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale).toHtmlEscaped();
str += " " + Qt::escape(tr("Slow(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale));
if (mix.mixWarn)
str += " " + tr("Warn(%1)").arg(mix.mixWarn).toHtmlEscaped();
str += " " + Qt::escape(tr("Warn(%1)").arg(mix.mixWarn));
if (firmware->getCapability(HasMixerNames) && mix.name[0])
str += QString(" [%1]").arg(mix.name).toHtmlEscaped();
str += Qt::escape(QString(" [%1]").arg(mix.name));
return str;
}
+1 -1
View File
@@ -42,8 +42,8 @@
#ifndef MODELSLIST_H
#define MODELSLIST_H
#include <QtWidgets>
#include "eeprominterface.h"
#include <QListWidget>
struct CurrentSelection
{
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _PRINTDIALOG_H
#define _PRINTDIALOG_H
#include <QtWidgets>
#include <QDialog>
#include "eeprominterface.h"
#include "multimodelprinter.h"
+2 -2
View File
@@ -94,7 +94,7 @@ QString SyncProcess::updateEntry(const QString & path, const QDir & source, cons
else {
if (!destinationInfo.exists()) {
// qDebug() << "Copy" << path << "to" << destinationPath;
progress->addText(tr("Copy %1 to %2").arg(path).arg(destinationPath) + "\n");
progress->addText(tr("Copy %1 to %2\n").arg(path).arg(destinationPath));
if (!QFile::copy(path, destinationPath)) {
return QObject::tr("Copy '%1' to '%2' failed").arg(path).arg(destinationPath);
}
@@ -120,7 +120,7 @@ QString SyncProcess::updateEntry(const QString & path, const QDir & source, cons
if (!destinationFile.open(QFile::WriteOnly)) {
return QObject::tr("Write '%1' failed").arg(destinationPath);
}
progress->addText(tr("Write %1").arg(destinationPath) + "\n");
progress->addText(tr("Write %1\n").arg(destinationPath));
// qDebug() << "Write" << destinationPath;
QTextStream destinationStream(&destinationFile);
destinationStream << sourceContents;
-1
View File
@@ -1,7 +1,6 @@
#ifndef SYNCPROCESS_H_
#define SYNCPROCESS_H_
#include <QObject>
#include <QString>
#include <QStringList>
+1 -2
View File
@@ -6,7 +6,6 @@ set(qcustomplot_HDRS
qcustomplot.h
)
qt5_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS})
qt4_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS})
add_library(qcustomplot ${qcustomplot_SRCS})
qt5_use_modules(qcustomplot Widgets PrintSupport)
+8 -2
View File
@@ -45,8 +45,14 @@
#include <QMargins>
#include <qmath.h>
#include <limits>
#include <QtNumeric>
#include <QtPrintSupport>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
# include <qnumeric.h>
# include <QPrinter>
# include <QPrintEngine>
#else
# include <QtNumeric>
# include <QtPrintSupport>
#endif
class QCPPainter;
class QCustomPlot;
@@ -2,8 +2,10 @@ set(qxtcommandoptions_SRCS
qxtcommandoptions.cpp
)
qt5_wrap_cpp(qxtcommandoptions_SRCS)
set(qxtcommandoptions_HDRS
qxtcommandoptions.h
)
qt4_wrap_cpp(qxtcommandoptions_SRCS ${qxtcommandoptions_HDRS})
add_library(qxtcommandoptions ${qxtcommandoptions_SRCS})
qt5_use_modules(qxtcommandoptions Widgets)
@@ -150,19 +150,19 @@ static int isQtOption(const QString& param)
if (param.left(5) == "-psn_") return 1;
#endif
QString name = param.mid(1), value;
// bool hasEquals;
bool hasEquals;
// Separate the option and the value, if present
if (name.indexOf('=') != -1)
{
value = param.section('=', 1);
name = param.section('=', 0, 0);
// hasEquals = true;
hasEquals = true;
}
else
{
value = "";
// hasEquals = false;
hasEquals = false;
}
const char* option;
@@ -540,7 +540,7 @@ void QxtCommandOptionsPrivate::parse(const QStringList& params)
int ct = params.count();
int skip = 0;
bool endFlags = false;
bool /*notUnrecognized, */hasEquals;
bool notUnrecognized, hasEquals;
QString name, param, value;
while (pos < ct)
@@ -566,7 +566,7 @@ void QxtCommandOptionsPrivate::parse(const QStringList& params)
positional.append(param);
continue;
}
// notUnrecognized = false;
notUnrecognized = false;
if (flagStyle != QxtCommandOptions::Slash && param == "--")
{
@@ -36,7 +36,7 @@ QT_FORWARD_DECLARE_CLASS(QTextStream)
QT_FORWARD_DECLARE_CLASS(QIODevice)
class QxtCommandOptions
class QXT_CORE_EXPORT QxtCommandOptions
{
Q_DECLARE_TR_FUNCTIONS(QxtCommandOptions)
+1 -1
View File
@@ -19,7 +19,7 @@ QString getRadioInterfaceCmd()
{
burnConfigDialog bcd;
EEPROMInterface *eepromInterface = GetEepromInterface();
if (IS_STM32(eepromInterface->getBoard())) {
if (IS_TARANIS(eepromInterface->getBoard())) {
return bcd.getDFU();
}
else if (IS_SKY9X(GetEepromInterface()->getBoard())) {
+3 -3
View File
@@ -14,9 +14,9 @@ set(shared_HDRS
autolineedit.h
genericpanel.h
hexspinbox.h
verticalscrollarea.h
)
qt5_wrap_cpp(shared_SRCS ${shared_HDRS})
qt4_wrap_cpp(shared_SRCS ${shared_HDRS})
add_library(shared ${shared_SRCS})
qt5_use_modules(shared Widgets)
add_library(shared ${shared_SRCS})
+1 -1
View File
@@ -44,7 +44,7 @@ class AutoLineEdit: public QLineEdit
void onEdited()
{
if (field && !lock) {
strcpy(field, text().toLatin1());
strcpy(field, text().toAscii());
if (panel) {
emit panel->modified();
}
+2 -3
View File
@@ -53,8 +53,7 @@ include_directories(
${RADIO_SRC_DIRECTORY}/fonts/std
)
qt5_wrap_ui(simulation_SRCS ${simulation_UIS})
qt5_wrap_cpp(simulation_SRCS ${simulation_HDRS})
qt4_wrap_ui(simulation_SRCS ${simulation_UIS})
qt4_wrap_cpp(simulation_SRCS ${simulation_HDRS})
add_library(simulation ${simulation_SRCS})
qt5_use_modules(simulation Widgets Xml)
-1
View File
@@ -19,7 +19,6 @@
#include <QWidget>
#include <QtGui>
#include <QStyleOption>
class ButtonsWidget : public QWidget
{
+3
View File
@@ -1,3 +1,5 @@
#include <QtGui>
#include <stdint.h>
#include "debugoutput.h"
#include "ui_debugoutput.h"
@@ -16,6 +18,7 @@ DebugOutput::DebugOutput(QWidget * parent):
QFont newFont("Courier", 9);
ui->Output->setFont(newFont);
#endif
}
DebugOutput::~DebugOutput()
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef debugoutput_h
#define debugoutput_h
#include <QtWidgets>
#include <QDialog>
#include "simulatorinterface.h"
namespace Ui {
+10 -16
View File
@@ -27,31 +27,29 @@ Joystick::~Joystick()
bool Joystick::open(int stick)
{
if (isOpen())
if ( isOpen() )
close();
joystick = SDL_JoystickOpen(stick);
if (joystick) {
if ( joystick ) {
numAxes = SDL_JoystickNumAxes(joystick);
numButtons = SDL_JoystickNumButtons(joystick);
numHats = SDL_JoystickNumHats(joystick);
numTrackballs = SDL_JoystickNumBalls(joystick);
joystickTimer.start(eventTimeout);
return true;
}
else {
return TRUE;
} else {
fprintf(stderr, "ERROR: couldn't open SDL joystick #%d", stick);
return false;
return FALSE;
}
}
void Joystick::close()
{
joystickTimer.stop();
if (joystick) {
if ( joystick )
SDL_JoystickClose(joystick);
joystick = NULL;
}
joystick = NULL;
numAxes = numButtons = numHats = numTrackballs = 0;
}
@@ -72,19 +70,15 @@ void Joystick::processEvents()
emit axisValueChanged(i, moved);
axes[i] = moved;
axisRepeatTimers[i].restart();
}
else if (autoRepeat && moved != 0) {
} else if (autoRepeat && moved != 0) {
if ( axisRepeatTimers[i].elapsed() >= autoRepeatDelay ) {
emit axisValueChanged(i, moved);
axes[i] = moved;
}
}
else
} else
axisRepeatTimers[i].restart();
}
else {
} else
emit axisValueChanged(i, 0);
}
}
for (i = 0; i < numButtons; i++) {
Uint8 changed = SDL_JoystickGetButton(joystick, i);
+1 -1
View File
@@ -31,7 +31,7 @@ class Joystick : public QObject
Joystick(QObject *parent = 0,
int joystickEventTimeout = SDL_JOYSTICK_DEFAULT_EVENT_TIMEOUT,
bool doAutoRepeat = true,
bool doAutoRepeat = TRUE,
int autoRepeatDelay = SDL_JOYSTICK_DEFAULT_AUTOREPEAT_DELAY);
~Joystick();
bool open(int);
@@ -1,6 +1,7 @@
#include "joystickdialog.h"
#include "ui_joystickdialog.h"
#include "appdata.h"
#include <QtGui>
joystickDialog::joystickDialog(QWidget *parent, int stick) :
QDialog(parent),
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef JOYSTICKDIALOG_H
#define JOYSTICKDIALOG_H
#include <QtWidgets>
#include "joystick.h"
#include <QDialog>
namespace Ui {
class joystickDialog;
@@ -1,6 +1,7 @@
#ifndef SIMULATORDIALOG_H
#define SIMULATORDIALOG_H
#include <QDialog>
#include "modeledit/node.h"
#include "telemetrysimu.h"
#include "trainersimu.h"
+1 -1
View File
@@ -71,7 +71,7 @@ for (int i=0; i<NUM_LOGICAL_SWITCH; i++)
#if defined(GVARS)
for (int fm=0; fm<MAX_FLIGHT_MODES; fm++) {
for (int gv=0; gv<MAX_GVARS; gv++) {
outputs.gvars[fm][gv] = GVAR_VALUE(gv, getGVarFlightMode(fm, gv));
outputs.gvars[fm][gv] = GVAR_VALUE(gv, getGVarFlightPhase(fm, gv));
}
}
#endif
@@ -14,8 +14,8 @@
*
*/
#ifndef _SIMULATOR_INTERFACE_H_
#define _SIMULATOR_INTERFACE_H_
#ifndef simulator_interface_h
#define simulator_interface_h
#include "constants.h"
#include <inttypes.h>
@@ -99,7 +99,7 @@ class SimulatorInterface
virtual void sendTelemetry(uint8_t * data, unsigned int len) = 0;
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) = 0;
virtual uint8_t getSensorInstance(uint16_t id) = 0;
virtual uint16_t getSensorRatio(uint16_t id) = 0;
@@ -128,4 +128,4 @@ void unregisterSimulators();
SimulatorFactory *getSimulatorFactory(const QString &name);
extern QMap<QString, SimulatorFactory *> registered_simulators;
#endif // _SIMULATOR_INTERFACE_H_
#endif

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