Merge remote-tracking branch 'origin/next' into kilrah/Bootloader
Conflicts: radio/src/Makefile
@@ -0,0 +1,3 @@
|
||||
/.*project
|
||||
/.settings
|
||||
/.autotools
|
||||
@@ -19,3 +19,4 @@ Grootwitbaas - 9xforums.com (mac)
|
||||
Adrian Amberg (splash screens)
|
||||
Wallaguest1 - 9xforums.com (splash screens)
|
||||
HC1969 - 9xforums.com (splash screens)
|
||||
|
||||
|
||||
@@ -95,8 +95,7 @@ Heinrich Illig
|
||||
Michael Collins
|
||||
Michael Manning
|
||||
Craig Lorentz
|
||||
Jonathan Modellismo - http://jonathan.it
|
||||
Aviomotive - http://www.aviomotive.com
|
||||
Jonathan Modellismo - jonathan.it
|
||||
André Lasseret
|
||||
Felipe Alexandre de Oliveira
|
||||
Brian Harris
|
||||
@@ -126,7 +125,7 @@ Larisa Filocamo
|
||||
Alex Calderhead
|
||||
Hartmut Sahm
|
||||
Åke Brodin
|
||||
Aloft Hobbies - http://www.alofthobbies.com
|
||||
Aloft Hobbies - www.alofthobbies.com
|
||||
Ted Moss
|
||||
Filippos Tigarakis
|
||||
Chewytm
|
||||
@@ -288,3 +287,47 @@ Josep Clodas Sola
|
||||
Thierry Martin
|
||||
Peter Mauro
|
||||
Mitchell Brenner
|
||||
Ulach Green
|
||||
Lluis Bullich Rañe
|
||||
Steffen Rohr
|
||||
Eric Jacquin
|
||||
Harvest Lane
|
||||
Ville Kuvaja
|
||||
DK-System
|
||||
Heinz Vogel
|
||||
Heung Jin Choi
|
||||
MMJS van der Helm
|
||||
Dan Neelands
|
||||
Yashiro Masayuki
|
||||
Isaac Sloan
|
||||
Harold Baird
|
||||
Roy Bender
|
||||
Bradley Murchie
|
||||
Maximilian Süß
|
||||
Dean Jansa
|
||||
Ronald Donker
|
||||
Paul Oldenkamp
|
||||
Dietmar Drees
|
||||
Bradley Murchie
|
||||
Richard Fahie
|
||||
James Kaufman
|
||||
Henry Deucker
|
||||
Christian Fuchs
|
||||
Arold Reinders
|
||||
Robert Miller
|
||||
Aviomotive - www.aviomotive.com
|
||||
Mark Gaskievicz
|
||||
Roland Müller
|
||||
Frank Gewalt
|
||||
Remi Viard
|
||||
Leonard MacKey
|
||||
Reginald H Millsom
|
||||
Emanuel Stassar
|
||||
Pierluigi Sommaruga
|
||||
Rafael Eric Suarez Nordlow
|
||||
A Harris
|
||||
Stefan Grunenberg
|
||||
Francisco Gutierrez Muñoz
|
||||
Steve Coley
|
||||
Sean Cull
|
||||
Roberto Orsello
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
##OpenTX Next Branch
|
||||
|
||||
You have found your way to the GitHub repository site for the OpenTX Next Branch. This code branch holds the source code for the ongoing development.
|
||||
|
||||
The stable release code is not here, it is in the master branch.
|
||||
Under no circumstances build and use software from this branch for real world application. At times you will be more or less guaranteed to crash your plane and destroy all your model settings.
|
||||
|
||||
Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.
|
||||
@@ -1 +0,0 @@
|
||||
[to be written]
|
||||
@@ -1,7 +1,7 @@
|
||||
PROJECT( companion )
|
||||
|
||||
SET( C9X_VERSION_MAJOR "1" )
|
||||
SET( C9X_VERSION_MINOR "51" )
|
||||
SET( C9X_VERSION_MINOR "52" )
|
||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
@@ -72,170 +72,135 @@ ELSE( )
|
||||
LINK_DIRECTORIES( /usr/local/lib )
|
||||
ENDIF( )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${XSD_INCLUDE_DIR} )
|
||||
set(RADIO_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/../../radio/src)
|
||||
set(SIMU_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/simulation)
|
||||
set(COMPANION_SRC_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
FIND_PACKAGE( Subversion )
|
||||
SET( C9X_WC_REVISION 0 )
|
||||
IF( Subversion_FOUND )
|
||||
# Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} C9X )
|
||||
ENDIF( )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/../.. ${PROJECT_SOURCE_DIR}/../../radio/src/fonts/std )
|
||||
|
||||
set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
COMMAND make lbm
|
||||
DEPENDS ${RADIO_SRC_DIRECTORY}/bitmaps/sticks_4x1.xbm
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
COMMAND make tra
|
||||
DEPENDS ${RADIO_SRC_DIRECTORY}/translations/en.h.txt
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/../..
|
||||
${SIMU_SRC_DIRECTORY}
|
||||
${RADIO_SRC_DIRECTORY}
|
||||
${RADIO_SRC_DIRECTORY}/fonts/std
|
||||
${RADIO_SRC_DIRECTORY}/lua/src
|
||||
${XSD_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_subdirectory(modeledit)
|
||||
add_subdirectory(simulation)
|
||||
|
||||
SET( companion_SRCS
|
||||
eeprominterface.cpp
|
||||
hexinterface.cpp
|
||||
flashinterface.cpp
|
||||
file.cpp
|
||||
xmlinterface.cpp
|
||||
${PROJECT_BINARY_DIR}/radio.cxx
|
||||
firmwares/th9x/th9xeeprom.cpp
|
||||
firmwares/th9x/th9xinterface.cpp
|
||||
${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
|
||||
firmwares/er9x/er9xeeprom.cpp
|
||||
firmwares/er9x/er9xinterface.cpp
|
||||
${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
|
||||
firmwares/gruvin9x/gruvin9xeeprom.cpp
|
||||
firmwares/gruvin9x/gruvin9xinterface.cpp
|
||||
firmwares/opentx/opentxeeprom.cpp
|
||||
firmwares/opentx/open9xStockeeprom.cpp
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp
|
||||
firmwares/opentx/open9xSky9xeeprom.cpp
|
||||
firmwares/opentx/opentxinterface.cpp
|
||||
firmwares/opentx/opentxTaranisSimulator.cpp
|
||||
firmwares/opentx/opentxSky9xsimulator.cpp
|
||||
firmwares/opentx/opentxGruvin9xsimulator.cpp
|
||||
firmwares/opentx/opentxM128simulator.cpp
|
||||
firmwares/opentx/opentxsimulator.cpp
|
||||
firmwares/ersky9x/ersky9xeeprom.cpp
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
helpers.cpp
|
||||
mdichild.cpp
|
||||
generaledit.cpp
|
||||
modelslist.cpp
|
||||
mountlist.cpp
|
||||
avroutputdialog.cpp
|
||||
preferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
customizesplashdialog.cpp
|
||||
burndialog.cpp
|
||||
printdialog.cpp
|
||||
fusesdialog.cpp
|
||||
logsdialog.cpp
|
||||
downloaddialog.cpp
|
||||
simulatordialog.cpp
|
||||
xsimulatordialog.cpp
|
||||
splashlibrary.cpp
|
||||
mainwindow.cpp
|
||||
main.cpp
|
||||
modelconfigdialog.cpp
|
||||
qcustomplot.cpp
|
||||
set(companion_SRCS
|
||||
eeprominterface.cpp
|
||||
hexinterface.cpp
|
||||
flashinterface.cpp
|
||||
file.cpp
|
||||
xmlinterface.cpp
|
||||
${PROJECT_BINARY_DIR}/radio.cxx
|
||||
firmwares/th9x/th9xeeprom.cpp
|
||||
firmwares/th9x/th9xinterface.cpp
|
||||
firmwares/er9x/er9xeeprom.cpp
|
||||
firmwares/er9x/er9xinterface.cpp
|
||||
firmwares/gruvin9x/gruvin9xeeprom.cpp
|
||||
firmwares/gruvin9x/gruvin9xinterface.cpp
|
||||
firmwares/opentx/opentxeeprom.cpp
|
||||
firmwares/opentx/open9xStockeeprom.cpp
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp
|
||||
firmwares/opentx/open9xSky9xeeprom.cpp
|
||||
firmwares/opentx/opentxinterface.cpp
|
||||
firmwares/opentx/opentxTaranisSimulator.cpp
|
||||
firmwares/opentx/opentxSky9xsimulator.cpp
|
||||
firmwares/opentx/opentxGruvin9xsimulator.cpp
|
||||
firmwares/opentx/opentxM128simulator.cpp
|
||||
firmwares/opentx/opentxsimulator.cpp
|
||||
firmwares/ersky9x/ersky9xeeprom.cpp
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
appdata.cpp
|
||||
helpers.cpp
|
||||
mdichild.cpp
|
||||
generaledit.cpp
|
||||
modelslist.cpp
|
||||
mountlist.cpp
|
||||
avroutputdialog.cpp
|
||||
apppreferencesdialog.cpp
|
||||
fwpreferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
customizesplashdialog.cpp
|
||||
burndialog.cpp
|
||||
printdialog.cpp
|
||||
fusesdialog.cpp
|
||||
logsdialog.cpp
|
||||
downloaddialog.cpp
|
||||
splashlibrary.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
modelconfigdialog.cpp
|
||||
qcustomplot.cpp
|
||||
)
|
||||
|
||||
SET( companion_MOC_HDRS
|
||||
avroutputdialog.h
|
||||
preferencesdialog.h
|
||||
burnconfigdialog.h
|
||||
comparedialog.h
|
||||
printdialog.h
|
||||
fusesdialog.h
|
||||
logsdialog.h
|
||||
contributorsdialog.h
|
||||
customizesplashdialog.h
|
||||
splashlibrary.h
|
||||
splashlabel.h
|
||||
burndialog.h
|
||||
downloaddialog.h
|
||||
cursorwidget.h
|
||||
menuwidget.h
|
||||
simulatordialog.h
|
||||
xcursorwidget.h
|
||||
xmenuwidget.h
|
||||
xsimulatordialog.h
|
||||
generaledit.h
|
||||
modelslist.h
|
||||
mdichild.h
|
||||
mainwindow.h
|
||||
myslider.h
|
||||
modelconfigdialog.h
|
||||
qcustomplot.h
|
||||
helpers.h
|
||||
set(companion_MOC_HDRS
|
||||
avroutputdialog.h
|
||||
apppreferencesdialog.h
|
||||
fwpreferencesdialog.h
|
||||
burnconfigdialog.h
|
||||
comparedialog.h
|
||||
printdialog.h
|
||||
fusesdialog.h
|
||||
logsdialog.h
|
||||
contributorsdialog.h
|
||||
customizesplashdialog.h
|
||||
splashlibrary.h
|
||||
splashlabel.h
|
||||
burndialog.h
|
||||
downloaddialog.h
|
||||
generaledit.h
|
||||
modelslist.h
|
||||
mdichild.h
|
||||
mainwindow.h
|
||||
modelconfigdialog.h
|
||||
qcustomplot.h
|
||||
helpers.h
|
||||
)
|
||||
|
||||
SET( companion_UIS
|
||||
mdichild.ui
|
||||
avroutputdialog.ui
|
||||
comparedialog.ui
|
||||
fusesdialog.ui
|
||||
logsdialog.ui
|
||||
preferencesdialog.ui
|
||||
simulatordialog.ui
|
||||
xsimulatordialog.ui
|
||||
burnconfigdialog.ui
|
||||
downloaddialog.ui
|
||||
generaledit.ui
|
||||
printdialog.ui
|
||||
contributorsdialog.ui
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
burndialog.ui
|
||||
modelconfigdialog.ui
|
||||
set(companion_UIS
|
||||
mdichild.ui
|
||||
avroutputdialog.ui
|
||||
comparedialog.ui
|
||||
fusesdialog.ui
|
||||
logsdialog.ui
|
||||
apppreferencesdialog.ui
|
||||
fwpreferencesdialog.ui
|
||||
burnconfigdialog.ui
|
||||
downloaddialog.ui
|
||||
generaledit.ui
|
||||
printdialog.ui
|
||||
contributorsdialog.ui
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
burndialog.ui
|
||||
modelconfigdialog.ui
|
||||
)
|
||||
|
||||
IF ( SDL_FOUND )
|
||||
SET( companion_SRCS
|
||||
${companion_SRCS}
|
||||
joystick.cpp
|
||||
joystickdialog.cpp
|
||||
)
|
||||
|
||||
SET( companion_MOC_HDRS
|
||||
${companion_MOC_HDRS}
|
||||
joystick.h
|
||||
joystickdialog.h
|
||||
)
|
||||
|
||||
SET( companion_UIS
|
||||
${companion_UIS}
|
||||
joystickdialog.ui
|
||||
)
|
||||
ENDIF( )
|
||||
|
||||
SET( companion_RCS
|
||||
companion.qrc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
|
||||
set(companion_RCS
|
||||
companion.qrc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
|
||||
)
|
||||
|
||||
MACRO (TODAY RESULT)
|
||||
@@ -273,8 +238,6 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc.in ${CMAKE_CURRENT_B
|
||||
# Subversion_WC_INFO( ${PROJECT_SOURCE_DIR}/../${FIRMWARE} G9X )
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${CMAKE_CURRENT_BINARY_DIR}/stamp-opentx.h @ONLY)
|
||||
|
||||
SET( PATCH_FLAGS "--binary" )
|
||||
|
||||
IF( WIN32 )
|
||||
SET( companion_SRCS ${companion_SRCS} icon.rc )
|
||||
IF ( NOT MSVC )
|
||||
@@ -285,8 +248,7 @@ ENDIF( )
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} )
|
||||
|
||||
|
||||
SET( LANGUAGES he pt ru de fr it sv cs )
|
||||
SET( LANGUAGES he pl pt ru de fr it sv cs fi)
|
||||
FOREACH( language ${LANGUAGES} )
|
||||
SET( companion_TS ${companion_TS} translations/companion_${language}.ts )
|
||||
ENDFOREACH( language )
|
||||
@@ -304,11 +266,96 @@ ELSE( )
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
|
||||
ENDIF( )
|
||||
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} )
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit simulation ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} )
|
||||
|
||||
############# Standalone simu ###############
|
||||
|
||||
set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp
|
||||
)
|
||||
|
||||
set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp
|
||||
)
|
||||
|
||||
set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x)
|
||||
add_custom_command(
|
||||
OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY}
|
||||
COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 .
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp
|
||||
)
|
||||
|
||||
set(simu_SRCS
|
||||
eeprominterface.cpp
|
||||
firmwares/th9x/th9xeeprom.cpp # TODO not needed
|
||||
firmwares/th9x/th9xinterface.cpp
|
||||
${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
|
||||
firmwares/er9x/er9xeeprom.cpp # TODO not needed
|
||||
firmwares/er9x/er9xinterface.cpp
|
||||
${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
|
||||
firmwares/gruvin9x/gruvin9xeeprom.cpp # TODO not needed
|
||||
firmwares/gruvin9x/gruvin9xinterface.cpp
|
||||
firmwares/opentx/opentxeeprom.cpp # TODO not needed
|
||||
firmwares/opentx/open9xStockeeprom.cpp # TODO not needed
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp # TODO not needed
|
||||
firmwares/opentx/open9xSky9xeeprom.cpp # TODO not needed
|
||||
firmwares/opentx/opentxinterface.cpp
|
||||
firmwares/opentx/opentxTaranisSimulator.cpp
|
||||
firmwares/opentx/opentxSky9xsimulator.cpp
|
||||
firmwares/opentx/opentxGruvin9xsimulator.cpp
|
||||
firmwares/opentx/opentxM128simulator.cpp
|
||||
firmwares/opentx/opentxsimulator.cpp
|
||||
firmwares/ersky9x/ersky9xeeprom.cpp # TODO not needed
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
file.cpp # TODO not needed
|
||||
modeledit/node.cpp
|
||||
modeledit/edge.cpp # TODO not needed
|
||||
appdata.cpp
|
||||
simulator.cpp
|
||||
)
|
||||
|
||||
set(simu_HDRS
|
||||
modeledit/node.h
|
||||
)
|
||||
|
||||
qt4_wrap_cpp(simu_SRCS ${simu_HDRS} )
|
||||
qt4_add_resources(simu_SRCS companion.qrc) # TODO not needed
|
||||
|
||||
if(WIN32)
|
||||
set(simu_SRCS ${simu_SRCS} icon.rc)
|
||||
endif()
|
||||
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
|
||||
if(SDL_FOUND)
|
||||
target_link_libraries(simulator simulation ${QT_LIBRARIES} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
else()
|
||||
target_link_libraries(simulator simulation ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
endif()
|
||||
|
||||
############# Packaging ####################
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
|
||||
INSTALL( FILES companion.desktop DESTINATION share/applications )
|
||||
INSTALL( FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps )
|
||||
INSTALL( FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps )
|
||||
INSTALL( FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps )
|
||||
INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps )
|
||||
INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps )
|
||||
INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps )
|
||||
@@ -345,7 +392,8 @@ IF( WIN32 )
|
||||
|
||||
ADD_CUSTOM_TARGET( installer
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/companionInstall.exe
|
||||
SOURCES ${PROJECT_BINARY_DIR}/companion.nsi)
|
||||
SOURCES ${PROJECT_BINARY_DIR}/companion.nsi
|
||||
)
|
||||
ENDIF( )
|
||||
|
||||
IF( APPLE )
|
||||
@@ -359,13 +407,13 @@ IF( APPLE )
|
||||
ADD_CUSTOM_TARGET( addframeworks ALL
|
||||
COMMAND mkdir -p companion.app/Contents/Frameworks
|
||||
COMMAND mkdir -p companion.app/Contents/Resources
|
||||
COMMAND mkdir -p companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
|
||||
COMMAND mkdir -p companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
|
||||
COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
|
||||
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/libcrypto.1.0.0.dylib companion.app/Contents/Frameworks
|
||||
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 ${QT_BINARY_DIR}/macdeployqt companion.app
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
DEPENDS ${PROJECT_NAME} )
|
||||
|
||||
|
||||
@@ -0,0 +1,678 @@
|
||||
// Companion Application Data Class Definition.
|
||||
// Author Kjell Kernen
|
||||
|
||||
#include "appdata.h"
|
||||
|
||||
// Global data and storage object
|
||||
AppData g;
|
||||
|
||||
// ** CompStoreObj class********************
|
||||
void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3)
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (tag2.isEmpty())
|
||||
{
|
||||
settings.remove(tag1);
|
||||
}
|
||||
else if (tag3.isEmpty())
|
||||
{
|
||||
settings.beginGroup(tag1);
|
||||
settings.remove(tag2);
|
||||
settings.endGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.beginGroup(tag1);
|
||||
settings.beginGroup(tag2);
|
||||
settings.remove(tag3);
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newArray);
|
||||
array = newArray;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newSList);
|
||||
stringList = newSList;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newString);
|
||||
string = newString;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newTruth);
|
||||
truth = newTruth;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newNumber);
|
||||
number = newNumber;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
// Retrieval functions
|
||||
void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
array = settings.value(tag, def).toByteArray();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
stringList = settings.value(tag, def).toStringList();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
string = settings.value(tag, def).toString();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
truth = settings.value(tag, def).toBool();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
number = settings.value(tag, def).toInt();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
// Retrieve and Store functions
|
||||
void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( array, tag, def, group1, group2);
|
||||
store(array, array, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( stringList, tag, def, group1, group2);
|
||||
store(stringList, stringList, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( string, tag, def, group1, group2);
|
||||
store(string, string, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( truth, tag, def, group1, group2);
|
||||
store(truth, truth, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( number, tag, def, group1, group2);
|
||||
store(number, number, tag, group1, group2);
|
||||
}
|
||||
|
||||
// ** FwRevision class********************
|
||||
int FwRevision::get( const QString fwType )
|
||||
{
|
||||
QString result;
|
||||
retrieve( result, fwType, "", "FwRevisions" );
|
||||
return result.toInt();
|
||||
}
|
||||
|
||||
void FwRevision::set( const QString fwType, const int fwRevision )
|
||||
{
|
||||
QString tempString= QString("%1").arg(fwRevision);
|
||||
store( tempString, tempString, fwType, "FwRevisions" );
|
||||
}
|
||||
|
||||
void FwRevision::remove( const QString tag )
|
||||
{
|
||||
clear( "FwRevisions", tag );
|
||||
}
|
||||
|
||||
// ** JStickData class********************
|
||||
// Get declarations
|
||||
int JStickData::stick_axe() { return _stickAxe; }
|
||||
int JStickData::stick_min() { return _stickMin; }
|
||||
int JStickData::stick_med() { return _stickMed; }
|
||||
int JStickData::stick_max() { return _stickMax; }
|
||||
int JStickData::stick_inv() { return _stickInv; }
|
||||
|
||||
// Set declarations
|
||||
void JStickData::stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_min(const int it) { store( it, _stickMin, QString("stick%1_min").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_med(const int it) { store( it, _stickMed, QString("stick%1_med").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_max(const int it) { store( it, _stickMax, QString("stick%1_max").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );}
|
||||
|
||||
// Constructor
|
||||
JStickData::JStickData()
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
void JStickData::remove()
|
||||
{
|
||||
// Remove all JStickData values from settings file
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
settings.beginGroup( "JsCalibration" );
|
||||
settings.remove( QString( "stick%1_axe").arg(index) );
|
||||
settings.remove( QString( "stick%1_min").arg(index) );
|
||||
settings.remove( QString( "stick%1_med").arg(index) );
|
||||
settings.remove( QString( "stick%1_max").arg(index) );
|
||||
settings.remove( QString( "stick%1_inv").arg(index) );
|
||||
settings.endGroup();
|
||||
|
||||
// Reset all JStickData variables to initial values
|
||||
init(index);
|
||||
}
|
||||
|
||||
bool JStickData::existsOnDisk()
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
settings.beginGroup("JsCalibration");
|
||||
int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt();
|
||||
settings.endGroup();
|
||||
|
||||
return (axe > -1);
|
||||
}
|
||||
|
||||
void JStickData::init(int newIndex)
|
||||
{
|
||||
index = newIndex;
|
||||
_stickAxe = -1;
|
||||
_stickMin = -32767;
|
||||
_stickMed = 0;
|
||||
_stickMax = 0;
|
||||
_stickInv = 0;
|
||||
|
||||
// Do not write empty joystick calibrations to disk.
|
||||
if ( !existsOnDisk() )
|
||||
return;
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
void JStickData::flush()
|
||||
{
|
||||
getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" );
|
||||
getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" );
|
||||
getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" );
|
||||
getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" );
|
||||
getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" );
|
||||
}
|
||||
|
||||
// ** Profile class********************
|
||||
// Get declarations
|
||||
QString Profile::fwName() const { return _fwName; }
|
||||
QString Profile::fwType() const { return _fwType; }
|
||||
QString Profile::name() const { return _name; }
|
||||
QString Profile::sdPath() const { return _sdPath; }
|
||||
QString Profile::splashFile() const { return _splashFile; }
|
||||
bool Profile::burnFirmware() const { return _burnFirmware; }
|
||||
bool Profile::renameFwFiles() const { return _renameFwFiles; }
|
||||
int Profile::channelOrder() const { return _channelOrder; }
|
||||
int Profile::defaultMode() const { return _defaultMode; }
|
||||
|
||||
QString Profile::beeper() const { return _beeper; }
|
||||
QString Profile::countryCode() const { return _countryCode; }
|
||||
QString Profile::display() const { return _display; }
|
||||
QString Profile::haptic() const { return _haptic; }
|
||||
QString Profile::speaker() const { return _speaker; }
|
||||
QString Profile::stickPotCalib() const { return _stickPotCalib; }
|
||||
QString Profile::trainerCalib() const { return _trainerCalib; }
|
||||
int Profile::currentCalib() const { return _currentCalib; }
|
||||
int Profile::gsStickMode() const { return _gsStickMode; }
|
||||
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
|
||||
int Profile::vBatCalib() const { return _vBatCalib; }
|
||||
int Profile::vBatWarn() const { return _vBatWarn; }
|
||||
|
||||
// Set declarations
|
||||
void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
|
||||
void Profile::beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::countryCode (const QString x) { store(x, _countryCode, "countryCode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::display (const QString x) { store(x, _display, "Display" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::currentCalib (const int x) { store(x, _currentCalib, "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));}
|
||||
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
|
||||
|
||||
// Constructor
|
||||
Profile::Profile()
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
// The default copy operator can not be used since the index variable would be destroyed
|
||||
Profile& Profile::operator=(const Profile& rhs)
|
||||
{
|
||||
name ( rhs.name() );
|
||||
fwName ( rhs.fwName() );
|
||||
fwType ( rhs.fwType() );
|
||||
sdPath ( rhs.sdPath() );
|
||||
splashFile ( rhs.splashFile() );
|
||||
burnFirmware ( rhs.burnFirmware() );
|
||||
renameFwFiles( rhs.renameFwFiles() );
|
||||
channelOrder ( rhs.channelOrder() );
|
||||
defaultMode ( rhs.defaultMode() );
|
||||
beeper ( rhs.beeper() );
|
||||
countryCode ( rhs.countryCode() );
|
||||
display ( rhs.display() );
|
||||
haptic ( rhs.haptic() );
|
||||
speaker ( rhs.speaker() );
|
||||
stickPotCalib( rhs.stickPotCalib() );
|
||||
trainerCalib ( rhs.trainerCalib() );
|
||||
currentCalib ( rhs.currentCalib() );
|
||||
gsStickMode ( rhs.gsStickMode() );
|
||||
ppmMultiplier( rhs.ppmMultiplier() );
|
||||
vBatCalib ( rhs.vBatCalib() );
|
||||
vBatWarn ( rhs.vBatWarn() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Profile::remove()
|
||||
{
|
||||
// Remove all profile values from settings file
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
settings.beginGroup("Profiles");
|
||||
settings.remove(QString("profile%1").arg(index));
|
||||
settings.endGroup();
|
||||
|
||||
// Reset all profile variables to initial values
|
||||
init(index);
|
||||
}
|
||||
|
||||
bool Profile::existsOnDisk()
|
||||
{
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
settings.beginGroup("Profiles");
|
||||
settings.beginGroup(QString("profile%1").arg(index));
|
||||
QStringList keyList = settings.allKeys();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
|
||||
return (keyList.length() > 0);
|
||||
}
|
||||
|
||||
void Profile::init(int newIndex)
|
||||
{
|
||||
index = newIndex;
|
||||
|
||||
_fwName = "";
|
||||
_fwType = "";
|
||||
_name = "";
|
||||
_sdPath = "";
|
||||
_splashFile = "";
|
||||
_burnFirmware = false;
|
||||
_renameFwFiles = false;
|
||||
_channelOrder = 0;
|
||||
_defaultMode = 1;
|
||||
|
||||
_beeper = "";
|
||||
_countryCode = "";
|
||||
_display = "";
|
||||
_haptic = "";
|
||||
_speaker = "";
|
||||
_stickPotCalib = "";
|
||||
_trainerCalib = "";
|
||||
|
||||
_currentCalib = 0;
|
||||
_gsStickMode = 0;
|
||||
_ppmMultiplier = 0;
|
||||
_vBatCalib = 0;
|
||||
_vBatWarn = 0;
|
||||
|
||||
// Do not write empty profiles to disk except the default (0) profile.
|
||||
if ( index > 0 && !existsOnDisk())
|
||||
return;
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
void Profile::flush()
|
||||
{
|
||||
// Load and store all variables. Use default values if setting values are missing
|
||||
getset( _fwName, "fwName" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index));
|
||||
|
||||
getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _currentCalib, "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));
|
||||
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
}
|
||||
|
||||
|
||||
// ** AppData class********************
|
||||
|
||||
// Get declarations
|
||||
QStringList AppData::recentFiles() { return _recentFiles; }
|
||||
QByteArray AppData::mainWinGeo() { return _mainWinGeo; }
|
||||
QByteArray AppData::mainWinState() { return _mainWinState; }
|
||||
QByteArray AppData::modelEditGeo() { return _modelEditGeo; }
|
||||
|
||||
QString AppData::armMcu() { return _armMcu; }
|
||||
QString AppData::avrArguments() { return _avrArguments; }
|
||||
QString AppData::avrPort() { return _avrPort; }
|
||||
QString AppData::avrdudeLocation() { return _avrdudeLocation; }
|
||||
QString AppData::compileServer() { return _compileServer; }
|
||||
QString AppData::cpuId() { return _cpuId; }
|
||||
QString AppData::dfuArguments() { return _dfuArguments; }
|
||||
QString AppData::dfuLocation() { return _dfuLocation; }
|
||||
QString AppData::locale() { return _locale; }
|
||||
QString AppData::mcu() { return _mcu; }
|
||||
QString AppData::programmer() { return _programmer; }
|
||||
QString AppData::sambaLocation() { return _sambaLocation; }
|
||||
QString AppData::sambaPort() { return _sambaPort; }
|
||||
|
||||
QString AppData::backupDir() { return _backupDir; }
|
||||
QString AppData::gePath() { return _gePath; }
|
||||
QString AppData::eepromDir() { return _eepromDir; }
|
||||
QString AppData::flashDir() { return _flashDir; }
|
||||
QString AppData::imagesDir() { return _imagesDir; }
|
||||
QString AppData::logDir() { return _logDir; }
|
||||
QString AppData::libDir() { return _libDir; }
|
||||
QString AppData::snapshotDir() { return _snapshotDir; }
|
||||
QString AppData::updatesDir() { return _updatesDir; }
|
||||
|
||||
bool AppData::enableBackup() { return _enableBackup; }
|
||||
bool AppData::backupOnFlash() { return _backupOnFlash; }
|
||||
bool AppData::jsSupport() { return _jsSupport; }
|
||||
bool AppData::rev4aSupport() { return _rev4aSupport; }
|
||||
bool AppData::maximized() { return _maximized; }
|
||||
bool AppData::showSplash() { return _showSplash; }
|
||||
bool AppData::snapToClpbrd() { return _snapToClpbrd; }
|
||||
bool AppData::autoCheckApp() { return _autoCheckApp; }
|
||||
bool AppData::autoCheckFw() { return _autoCheckFw; }
|
||||
bool AppData::simuSW() { return _simuSW; }
|
||||
bool AppData::enableWizard() { return _enableWizard; }
|
||||
|
||||
int AppData::backLight() { return _backLight; }
|
||||
int AppData::embedSplashes() { return _embedSplashes; }
|
||||
int AppData::fwServerFails() { return _fwServerFails; }
|
||||
int AppData::generalEditTab() { return _generalEditTab; }
|
||||
int AppData::iconSize() { return _iconSize; }
|
||||
int AppData::historySize() { return _historySize; }
|
||||
int AppData::jsCtrl() { return _jsCtrl; }
|
||||
int AppData::modelEditTab() { return _modelEditTab; }
|
||||
int AppData::id() { return _id; }
|
||||
int AppData::theme() { return _theme; }
|
||||
int AppData::warningId() { return _warningId; }
|
||||
|
||||
// Set declarations
|
||||
void AppData::recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );}
|
||||
void AppData::mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );}
|
||||
void AppData::mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );}
|
||||
void AppData::modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );}
|
||||
|
||||
void AppData::armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );}
|
||||
void AppData::avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );}
|
||||
void AppData::avrPort (const QString x) { store(x, _avrPort, "avr_port" );}
|
||||
void AppData::avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );}
|
||||
void AppData::compileServer (const QString x) { store(x, _compileServer, "compilation-server" );}
|
||||
void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );}
|
||||
void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
|
||||
void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
|
||||
void AppData::locale (const QString x) { store(x, _locale, "locale" );}
|
||||
void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );}
|
||||
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
|
||||
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
|
||||
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
|
||||
|
||||
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
|
||||
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
|
||||
void AppData::eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );}
|
||||
void AppData::flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );}
|
||||
void AppData::imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );}
|
||||
void AppData::logDir (const QString x) { store(x, _logDir, "lastLogDir" );}
|
||||
void AppData::libDir (const QString x) { store(x, _libDir, "libraryPath" );}
|
||||
void AppData::snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );}
|
||||
void AppData::updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );}
|
||||
|
||||
void AppData::enableBackup (const bool x) { store(x, _enableBackup, "backupEnable" );}
|
||||
void AppData::backupOnFlash (const bool x) { store(x, _backupOnFlash, "backupOnFlash" );}
|
||||
void AppData::maximized (const bool x) { store(x, _maximized, "maximized" );}
|
||||
void AppData::jsSupport (const bool x) { store(x, _jsSupport, "js_support" );}
|
||||
void AppData::rev4aSupport (const bool x) { store(x, _rev4aSupport, "rev4asupport" );}
|
||||
void AppData::showSplash (const bool x) { store(x, _showSplash, "show_splash" );}
|
||||
void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );}
|
||||
void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
|
||||
void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
|
||||
void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
|
||||
void AppData::enableWizard (const bool x) { store(x, _enableWizard, "wizardEnable" );}
|
||||
|
||||
void AppData::backLight (const int x) { store(x, _backLight, "backLight" );}
|
||||
void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
|
||||
void AppData::fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );}
|
||||
void AppData::generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );}
|
||||
void AppData::iconSize (const int x) { store(x, _iconSize, "icon_size" );}
|
||||
void AppData::historySize (const int x) { store(x, _historySize, "history_size" );}
|
||||
void AppData::jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );}
|
||||
void AppData::modelEditTab (const int x) { store(x, _modelEditTab, "modelEditTab" );}
|
||||
void AppData::id (const int x) { store(x, _id, "profileId" );}
|
||||
void AppData::theme (const int x) { store(x, _theme, "theme" );}
|
||||
void AppData::warningId (const int x) { store(x, _warningId, "warningId" );}
|
||||
|
||||
// Constructor
|
||||
AppData::AppData()
|
||||
{
|
||||
//Initialize the profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
|
||||
//Initialize the joysticks
|
||||
for (int i=0; i<MAX_JOYSTICKS; i++)
|
||||
joystick[i].init( i );
|
||||
|
||||
// Import settings from companion9x, but only do it one time.
|
||||
QSettings c9x_settings("companion9x", "companion9x");
|
||||
QSettings settings(PRODUCT, COMPANY);
|
||||
if (profile[0].name().isEmpty() )
|
||||
{
|
||||
// Copy all settings from companion9x to companion
|
||||
QStringList keys = c9x_settings.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, c9x_settings.value(*i));
|
||||
}
|
||||
|
||||
// Store old values in new locations
|
||||
autoCheckApp(settings.value("startup_check_companion9x", true).toBool());
|
||||
|
||||
// Convert and store the firmware type
|
||||
QString fwType = settings.value("firmware", "").toString();
|
||||
fwType.replace("open9x","opentx");
|
||||
fwType.replace("x9da","taranis");
|
||||
profile[0].fwType( fwType );
|
||||
|
||||
// Move the Companion9x profile settings to profile0, the new default profile
|
||||
profile[0].name( settings.value( "Name", "" ).toString());
|
||||
profile[0].sdPath( settings.value( "sdPath", "" ).toString());
|
||||
profile[0].splashFile( settings.value( "SplashFileName", "" ).toString());
|
||||
profile[0].burnFirmware( settings.value( "burnFirmware", false ).toBool());
|
||||
profile[0].renameFwFiles( settings.value( "rename_firmware_files", false ).toBool());
|
||||
profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt());
|
||||
profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt());
|
||||
|
||||
// Ensure that the default profile has a name
|
||||
if ( profile[0].name().isEmpty() )
|
||||
profile[0].name("My Radio");
|
||||
|
||||
// Delete obsolete settings fields
|
||||
settings.remove("ActiveProfile");
|
||||
settings.remove("burnFirmware");
|
||||
settings.remove("custom_id");
|
||||
settings.remove("default_channel_order");
|
||||
settings.remove("default_mode");
|
||||
settings.remove("firmware");
|
||||
settings.remove("lastFw");
|
||||
settings.remove("Name");
|
||||
settings.remove("patchImage");
|
||||
settings.remove("rename_firmware_files");
|
||||
settings.remove("sdPath");
|
||||
settings.remove("SplashFileName");
|
||||
settings.remove("startup_check_companion9x");
|
||||
|
||||
// Select the new default profile as current profile
|
||||
id( 0 );
|
||||
}
|
||||
|
||||
// Load and store all variables. Use default values if setting values are missing
|
||||
getset( _recentFiles, "recentFileList" ,"" );
|
||||
getset( _mainWinGeo, "mainWindowGeometry" ,"" );
|
||||
getset( _mainWinState, "mainWindowState" ,"" );
|
||||
getset( _modelEditGeo, "modelEditGeometry" ,"" );
|
||||
|
||||
getset( _armMcu, "arm_mcu" ,"at91sam3s4-9x" );
|
||||
getset( _avrArguments, "avr_arguments" ,"" );
|
||||
getset( _avrPort, "avr_port" ,"" );
|
||||
getset( _avrdudeLocation, "avrdudeLocation" ,"" );
|
||||
getset( _compileServer, "compilation-server" ,"" );
|
||||
getset( _cpuId, "cpu_id" ,"" );
|
||||
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
|
||||
getset( _dfuLocation, "dfu_location" ,"" );
|
||||
getset( _locale, "locale" ,"" );
|
||||
getset( _mcu, "mcu" ,"m64" );
|
||||
getset( _programmer, "programmer" ,"usbasp" );
|
||||
getset( _sambaLocation, "samba_location" ,"" );
|
||||
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
|
||||
|
||||
getset( _backupDir, "backupPath" ,"" );
|
||||
getset( _gePath, "gePath" ,"" );
|
||||
getset( _eepromDir, "lastDir" ,"" );
|
||||
getset( _flashDir, "lastFlashDir" ,"" );
|
||||
getset( _imagesDir, "lastImagesDir" ,"" );
|
||||
getset( _logDir, "lastLogDir" ,"" );
|
||||
getset( _libDir, "libraryPath" ,"" );
|
||||
getset( _snapshotDir, "snapshotpath" ,"" );
|
||||
getset( _updatesDir, "lastUpdatesDir" ,"" );
|
||||
|
||||
getset( _enableBackup, "backupEnable" ,false );
|
||||
getset( _backupOnFlash, "backupOnFlash" ,true );
|
||||
getset( _jsSupport, "js_support" ,false );
|
||||
getset( _rev4aSupport, "rev4asupport" ,false );
|
||||
getset( _maximized, "maximized" ,false );
|
||||
getset( _showSplash, "show_splash" ,true );
|
||||
getset( _snapToClpbrd, "snapshot_to_clipboard" ,false );
|
||||
getset( _autoCheckApp, "startup_check_companion" ,true );
|
||||
getset( _autoCheckFw, "startup_check_fw" ,true );
|
||||
getset( _simuSW, "simuSW" ,false );
|
||||
getset( _enableWizard, "wizardEnable" ,true );
|
||||
|
||||
getset( _backLight, "backLight" ,0 );
|
||||
getset( _embedSplashes, "embedded_splashes" ,0 );
|
||||
getset( _fwServerFails, "fwserver" ,0 );
|
||||
getset( _generalEditTab, "generalEditTab" ,0 );
|
||||
getset( _iconSize, "icon_size" ,2 );
|
||||
getset( _jsCtrl, "js_ctrl" ,0 );
|
||||
getset( _historySize, "history_size" ,10 );
|
||||
getset( _modelEditTab, "modelEditTab" ,0 );
|
||||
getset( _id, "profileId" ,0 );
|
||||
getset( _theme, "theme" ,1 );
|
||||
getset( _warningId, "warningId" ,0 );
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
// Companion Application Data Class Declaration.
|
||||
// Author Kjell Kernen
|
||||
|
||||
// All temporary and permanent global variables are defined here to make
|
||||
// initialization and storage safe and visible.
|
||||
// Do not access variables in QSettings directly, it is not type safe!
|
||||
|
||||
|
||||
#ifndef COMPANION_APPDATA_H
|
||||
#define COMPANION_APPDATA_H
|
||||
#include <QByteArray>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
|
||||
#define COMPANY "OpenTX Companion"
|
||||
#define PRODUCT "OpenTX"
|
||||
|
||||
#define MAX_PROFILES 15
|
||||
#define MAX_JOYSTICKS 8
|
||||
|
||||
class CompStoreObj
|
||||
{
|
||||
public:
|
||||
void clear (const QString tag1="", const QString tag2="", const QString tag3="");
|
||||
void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" );
|
||||
|
||||
// Retrieval functions
|
||||
void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
|
||||
void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
|
||||
|
||||
// Retrieve and Store functions
|
||||
void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
|
||||
void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
|
||||
};
|
||||
|
||||
class FwRevision: protected CompStoreObj
|
||||
{
|
||||
public:
|
||||
int get( const QString);
|
||||
void set( const QString, const int );
|
||||
void remove( const QString );
|
||||
};
|
||||
|
||||
class JStickData: protected CompStoreObj
|
||||
{
|
||||
private:
|
||||
int index;
|
||||
|
||||
int _stickAxe;
|
||||
int _stickMin;
|
||||
int _stickMed;
|
||||
int _stickMax;
|
||||
int _stickInv;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
int stick_axe();
|
||||
int stick_min();
|
||||
int stick_med();
|
||||
int stick_max();
|
||||
int stick_inv();
|
||||
|
||||
// All the set definitions
|
||||
void stick_axe(const int);
|
||||
void stick_min(const int);
|
||||
void stick_med(const int);
|
||||
void stick_max(const int);
|
||||
void stick_inv(const int);
|
||||
|
||||
JStickData();
|
||||
void remove();
|
||||
bool existsOnDisk();
|
||||
void init(int index);
|
||||
void flush();
|
||||
};
|
||||
|
||||
class Profile: protected CompStoreObj
|
||||
{
|
||||
private:
|
||||
// Class Internal Variable
|
||||
int index;
|
||||
|
||||
// Application Variables
|
||||
QString _fwName;
|
||||
QString _fwType;
|
||||
QString _name;
|
||||
QString _sdPath;
|
||||
QString _splashFile;
|
||||
bool _burnFirmware;
|
||||
bool _renameFwFiles;
|
||||
int _channelOrder;
|
||||
int _defaultMode;
|
||||
|
||||
// Firmware Variables
|
||||
QString _beeper;
|
||||
QString _countryCode;
|
||||
QString _display;
|
||||
QString _haptic;
|
||||
QString _speaker;
|
||||
QString _stickPotCalib;
|
||||
QString _trainerCalib;
|
||||
int _currentCalib;
|
||||
int _gsStickMode;
|
||||
int _ppmMultiplier;
|
||||
int _vBatCalib;
|
||||
int _vBatWarn;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
QString fwName() const;
|
||||
QString fwType() const;
|
||||
QString name() const;
|
||||
QString sdPath() const;
|
||||
QString splashFile() const;
|
||||
bool burnFirmware() const;
|
||||
bool renameFwFiles() const;
|
||||
int channelOrder() const;
|
||||
int defaultMode() const;
|
||||
|
||||
QString beeper() const;
|
||||
QString countryCode() const;
|
||||
QString display() const;
|
||||
QString haptic() const;
|
||||
QString speaker() const;
|
||||
QString stickPotCalib() const;
|
||||
QString trainerCalib() const;
|
||||
int currentCalib() const;
|
||||
int gsStickMode() const;
|
||||
int ppmMultiplier() const;
|
||||
int vBatCalib() const;
|
||||
int vBatWarn() const;
|
||||
|
||||
// All the set definitions
|
||||
void name (const QString);
|
||||
void fwName (const QString);
|
||||
void fwType (const QString);
|
||||
void sdPath (const QString);
|
||||
void splashFile (const QString);
|
||||
void burnFirmware (const bool);
|
||||
void renameFwFiles (const bool);
|
||||
void channelOrder (const int);
|
||||
void defaultMode (const int);
|
||||
|
||||
void beeper (const QString);
|
||||
void countryCode (const QString);
|
||||
void display (const QString);
|
||||
void haptic (const QString);
|
||||
void speaker (const QString);
|
||||
void stickPotCalib (const QString);
|
||||
void trainerCalib (const QString);
|
||||
void currentCalib (const int);
|
||||
void gsStickMode (const int);
|
||||
void ppmMultiplier (const int);
|
||||
void vBatCalib (const int);
|
||||
void vBatWarn (const int);
|
||||
|
||||
Profile();
|
||||
Profile& operator=(const Profile&);
|
||||
void remove();
|
||||
bool existsOnDisk();
|
||||
void init(int newIndex);
|
||||
void flush();
|
||||
};
|
||||
|
||||
class AppData: protected CompStoreObj
|
||||
{
|
||||
// All the global variables
|
||||
public:
|
||||
Profile profile[MAX_PROFILES];
|
||||
JStickData joystick[MAX_JOYSTICKS];
|
||||
FwRevision fwRev;
|
||||
|
||||
private:
|
||||
QStringList _recentFiles;
|
||||
QByteArray _mainWinGeo;
|
||||
QByteArray _mainWinState;
|
||||
QByteArray _modelEditGeo;
|
||||
|
||||
QString _armMcu;
|
||||
QString _avrArguments;
|
||||
QString _avrPort;
|
||||
QString _avrdudeLocation;
|
||||
QString _compileServer;
|
||||
QString _cpuId;
|
||||
QString _dfuArguments;
|
||||
QString _dfuLocation;
|
||||
QString _locale;
|
||||
QString _mcu;
|
||||
QString _programmer;
|
||||
QString _sambaLocation;
|
||||
QString _sambaPort;
|
||||
|
||||
QString _backupDir;
|
||||
QString _gePath;
|
||||
QString _eepromDir;
|
||||
QString _flashDir;
|
||||
QString _imagesDir;
|
||||
QString _logDir;
|
||||
QString _libDir;
|
||||
QString _snapshotDir;
|
||||
QString _updatesDir;
|
||||
|
||||
bool _enableBackup;
|
||||
bool _backupOnFlash;
|
||||
bool _maximized;
|
||||
bool _jsSupport;
|
||||
bool _rev4aSupport;
|
||||
bool _showSplash;
|
||||
bool _snapToClpbrd;
|
||||
bool _autoCheckApp;
|
||||
bool _autoCheckFw;
|
||||
bool _simuSW;
|
||||
bool _enableWizard;
|
||||
|
||||
int _backLight;
|
||||
int _embedSplashes;
|
||||
int _fwServerFails;
|
||||
int _generalEditTab;
|
||||
int _iconSize;
|
||||
int _jsCtrl;
|
||||
int _historySize;
|
||||
int _modelEditTab;
|
||||
int _id;
|
||||
int _theme;
|
||||
int _warningId;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
QStringList recentFiles();
|
||||
QByteArray mainWinGeo();
|
||||
QByteArray mainWinState();
|
||||
QByteArray modelEditGeo();
|
||||
|
||||
QString armMcu();
|
||||
QString avrArguments();
|
||||
QString avrPort();
|
||||
QString avrdudeLocation();
|
||||
QString compileServer();
|
||||
QString cpuId();
|
||||
QString dfuArguments();
|
||||
QString dfuLocation();
|
||||
QString lastFw();
|
||||
QString locale();
|
||||
QString mcu();
|
||||
QString programmer();
|
||||
QString sambaLocation();
|
||||
QString sambaPort();
|
||||
|
||||
QString backupDir();
|
||||
QString gePath();
|
||||
QString eepromDir();
|
||||
QString flashDir();
|
||||
QString imagesDir();
|
||||
QString logDir();
|
||||
QString libDir();
|
||||
QString snapshotDir();
|
||||
QString updatesDir();
|
||||
|
||||
bool enableBackup();
|
||||
bool backupOnFlash();
|
||||
bool jsSupport();
|
||||
bool rev4aSupport();
|
||||
bool maximized();
|
||||
bool showSplash();
|
||||
bool snapToClpbrd();
|
||||
bool autoCheckApp();
|
||||
bool autoCheckFw();
|
||||
bool simuSW();
|
||||
bool enableWizard();
|
||||
|
||||
int backLight();
|
||||
int embedSplashes();
|
||||
int fwServerFails();
|
||||
int generalEditTab();
|
||||
int iconSize();
|
||||
int historySize();
|
||||
int jsCtrl();
|
||||
int modelEditTab(); // This variable is unused an can be removed
|
||||
int id();
|
||||
int theme();
|
||||
int warningId();
|
||||
|
||||
// All the set definitions
|
||||
void recentFiles (const QStringList x);
|
||||
void mainWinGeo (const QByteArray);
|
||||
void mainWinState (const QByteArray);
|
||||
void modelEditGeo (const QByteArray);
|
||||
|
||||
void armMcu (const QString);
|
||||
void avrArguments (const QString);
|
||||
void avrPort (const QString);
|
||||
void avrdudeLocation (const QString);
|
||||
void compileServer (const QString);
|
||||
void cpuId (const QString);
|
||||
void dfuArguments (const QString);
|
||||
void dfuLocation (const QString);
|
||||
void lastFw (const QString);
|
||||
void locale (const QString);
|
||||
void mcu (const QString);
|
||||
void programmer (const QString);
|
||||
void sambaLocation (const QString);
|
||||
void sambaPort (const QString);
|
||||
|
||||
void backupDir (const QString);
|
||||
void gePath (const QString);
|
||||
void eepromDir (const QString);
|
||||
void flashDir (const QString);
|
||||
void imagesDir (const QString);
|
||||
void logDir (const QString);
|
||||
void libDir (const QString);
|
||||
void snapshotDir (const QString);
|
||||
void updatesDir (const QString);
|
||||
|
||||
void enableBackup (const bool);
|
||||
void backupOnFlash (const bool);
|
||||
void maximized (const bool);
|
||||
void jsSupport (const bool);
|
||||
void rev4aSupport (const bool);
|
||||
void showSplash (const bool);
|
||||
void snapToClpbrd (const bool);
|
||||
void autoCheckApp (const bool);
|
||||
void autoCheckFw (const bool);
|
||||
void simuSW (const bool);
|
||||
void enableWizard (const bool);
|
||||
|
||||
void backLight (const int);
|
||||
void embedSplashes (const int);
|
||||
void fwServerFails (const int);
|
||||
void generalEditTab (const int);
|
||||
void iconSize (const int);
|
||||
void historySize (const int);
|
||||
void jsCtrl (const int);
|
||||
void modelEditTab (const int);
|
||||
void id (const int);
|
||||
void theme (const int);
|
||||
void warningId (const int);
|
||||
|
||||
// Constructor
|
||||
AppData();
|
||||
};
|
||||
|
||||
extern AppData g;
|
||||
|
||||
#endif // COMPANION_APPDATA_H
|
||||
@@ -0,0 +1,307 @@
|
||||
#include "apppreferencesdialog.h"
|
||||
#include "ui_apppreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "flashinterface.h"
|
||||
#ifdef JOYSTICKS
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::appPreferencesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("apppreferences.png"));
|
||||
initSettings();
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
#ifndef JOYSTICKS
|
||||
ui->joystickCB->hide();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->hide();
|
||||
ui->joystickChkB->hide();
|
||||
ui->label_11->hide();
|
||||
#endif
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
appPreferencesDialog::~appPreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void appPreferencesDialog::writeValues()
|
||||
{
|
||||
g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
|
||||
g.autoCheckFw(ui->startupCheck_fw->isChecked());
|
||||
g.enableWizard(ui->wizardEnable_ChkB->isChecked());
|
||||
g.showSplash(ui->showSplash->isChecked());
|
||||
g.simuSW(ui->simuSW->isChecked());
|
||||
g.historySize(ui->historySize->value());
|
||||
g.backLight(ui->backLightColor->currentIndex());
|
||||
g.libDir(ui->libraryPath->text());
|
||||
g.gePath(ui->ge_lineedit->text());
|
||||
g.embedSplashes(ui->splashincludeCB->currentIndex());
|
||||
g.enableBackup(ui->backupEnable->isChecked());
|
||||
|
||||
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
|
||||
g.jsSupport(ui->joystickChkB ->isChecked());
|
||||
g.jsCtrl(ui->joystickCB ->currentIndex());
|
||||
}
|
||||
else {
|
||||
g.jsSupport(false);
|
||||
g.jsCtrl(0);
|
||||
}
|
||||
g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex());
|
||||
g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex());
|
||||
g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked());
|
||||
g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked());
|
||||
g.profile[g.id()].sdPath(ui->sdPath->text());
|
||||
g.profile[g.id()].splashFile(ui->SplashFileName->text());
|
||||
|
||||
// The profile name may NEVER be empty
|
||||
if (ui->profileNameLE->text().isEmpty())
|
||||
g.profile[g.id()].name(tr("My Radio"));
|
||||
else
|
||||
g.profile[g.id()].name(ui->profileNameLE->text());
|
||||
|
||||
// If a new radio type has been choosen, several things need to change
|
||||
if ( initialRadioType != ui->radioCB->currentIndex())
|
||||
{
|
||||
g.profile[g.id()].fwName("");
|
||||
g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex()));
|
||||
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_snapshotPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.snapshotDir(fileName);
|
||||
g.snapToClpbrd(false);
|
||||
ui->snapshotPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::initSettings()
|
||||
{
|
||||
ui->snapshotClipboardCKB->setChecked(g.snapToClpbrd());
|
||||
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
|
||||
ui->snapshotPath->setText(g.snapshotDir());
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
if (ui->snapshotClipboardCKB->isChecked())
|
||||
{
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
}
|
||||
ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
|
||||
ui->startupCheck_fw->setChecked(g.autoCheckFw());
|
||||
ui->wizardEnable_ChkB->setChecked(g.enableWizard());
|
||||
ui->showSplash->setChecked(g.showSplash());
|
||||
ui->historySize->setValue(g.historySize());
|
||||
ui->backLightColor->setCurrentIndex(g.backLight());
|
||||
ui->simuSW->setChecked(g.simuSW());
|
||||
ui->libraryPath->setText(g.libDir());
|
||||
ui->ge_lineedit->setText(g.gePath());
|
||||
|
||||
if (!g.backupDir().isEmpty()) {
|
||||
if (QDir(g.backupDir()).exists()) {
|
||||
ui->backupPath->setText(g.backupDir());
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->backupEnable->setChecked(g.enableBackup());
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
ui->joystickChkB->setChecked(g.jsSupport());
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
ui->joystickCB->setCurrentIndex(g.jsCtrl());
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
#endif
|
||||
// Profile Tab Inits
|
||||
ui->channelorderCB->setCurrentIndex(g.profile[g.id()].channelOrder());
|
||||
ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode());
|
||||
ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
|
||||
ui->sdPath->setText(g.profile[g.id()].sdPath());
|
||||
ui->profileNameLE->setText(g.profile[g.id()].name());
|
||||
ui->SplashFileName->setText(g.profile[g.id()].splashFile());
|
||||
|
||||
initialRadioType = getRadioType(g.profile[g.id()].fwType());
|
||||
ui->radioCB->setCurrentIndex(initialRadioType);
|
||||
|
||||
displayImage( g.profile[g.id()].splashFile() );
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_libraryPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.libDir(fileName);
|
||||
ui->libraryPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
|
||||
{
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
g.snapToClpbrd(true);
|
||||
} else {
|
||||
ui->snapshotPath->setEnabled(true);
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
ui->snapshotPathButton->setEnabled(true);
|
||||
g.snapToClpbrd(false);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_backupPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.backupDir(fileName);
|
||||
ui->backupPath->setText(fileName);
|
||||
}
|
||||
ui->backupEnable->setEnabled(true);
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_ge_pathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ge_lineedit->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
void appPreferencesDialog::on_joystickChkB_clicked() {
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_joystickcalButton_clicked() {
|
||||
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
|
||||
jd->exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
// ******** Profile tab functions
|
||||
|
||||
void appPreferencesDialog::on_sdPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), g.profile[g.id()].sdPath());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->sdPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_removeProfileButton_clicked()
|
||||
{
|
||||
if ( g.id() == 0 )
|
||||
QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed."));
|
||||
else
|
||||
{
|
||||
g.profile[g.id()].remove();
|
||||
g.id( 0 );
|
||||
initSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool appPreferencesDialog::displayImage( QString fileName )
|
||||
{
|
||||
// Start by clearing the pixmap
|
||||
ui->imageLabel->setPixmap(QPixmap());
|
||||
|
||||
QImage image(fileName);
|
||||
if (image.isNull())
|
||||
return false;
|
||||
|
||||
// Use the firmware name to determine splash width
|
||||
int width = SPLASH_WIDTH;
|
||||
if (g.profile[g.id()].fwType().contains("taranis"))
|
||||
width = SPLASHX9D_WIDTH;
|
||||
|
||||
ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
|
||||
ui->imageLabel->setFixedSize(width, SPLASH_HEIGHT);
|
||||
return true;
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_SplashSelect_clicked()
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()){
|
||||
g.imagesDir(QFileInfo(fileName).dir().absolutePath());
|
||||
|
||||
displayImage(fileName);
|
||||
ui->SplashFileName->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void appPreferencesDialog::on_clearImageButton_clicked() {
|
||||
ui->imageLabel->clear();
|
||||
ui->SplashFileName->clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef APPPREFERENCESDIALOG_H
|
||||
#define APPPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class appPreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class appPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit appPreferencesDialog(QWidget *parent = 0);
|
||||
~appPreferencesDialog();
|
||||
Joystick *joystick;
|
||||
|
||||
private:
|
||||
int initialRadioType;
|
||||
Ui::appPreferencesDialog *ui;
|
||||
void initSettings();
|
||||
bool displayImage( QString fileName );
|
||||
void loadProfileString(QString profile, QString label);
|
||||
void loadFromProfile();
|
||||
|
||||
private slots:
|
||||
void writeValues();
|
||||
void on_libraryPathButton_clicked();
|
||||
void on_snapshotPathButton_clicked();
|
||||
void on_snapshotClipboardCKB_clicked();
|
||||
void on_backupPathButton_clicked();
|
||||
void on_ge_pathButton_clicked();
|
||||
|
||||
void on_sdPathButton_clicked();
|
||||
void on_removeProfileButton_clicked();
|
||||
void on_SplashSelect_clicked();
|
||||
void on_clearImageButton_clicked();
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
void on_joystickChkB_clicked();
|
||||
void on_joystickcalButton_clicked();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // APPPREFERENCESDIALOG_H
|
||||
@@ -38,7 +38,8 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
|
||||
if (arg.count()<2) {
|
||||
closeOpt = AVR_DIALOG_FORCE_CLOSE;
|
||||
QTimer::singleShot(0, this, SLOT(forceClose()));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sourceFile=arg.at(0);
|
||||
destFile=arg.at(1);
|
||||
if (!displayDetails) {
|
||||
@@ -68,7 +69,6 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
|
||||
efuse = 0;
|
||||
phase=0;
|
||||
currLine.clear();
|
||||
prevLine.clear();
|
||||
if (!displayDetails) {
|
||||
ui->plainTextEdit->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
@@ -132,11 +132,12 @@ void avrOutputDialog::doCopy()
|
||||
char * pointer=buf;
|
||||
QFile source(sourceFile);
|
||||
int blocks=(source.size()/BLKSIZE);
|
||||
ui->progressBar->setMaximum(blocks-1);
|
||||
ui->progressBar->setMaximum(blocks-1);
|
||||
if (!source.open(QIODevice::ReadOnly)) {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot open source file"));
|
||||
hasErrors=true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
source.read(buf,READBUF);
|
||||
source.close();
|
||||
QFile dest(destFile);
|
||||
@@ -183,7 +184,6 @@ void avrOutputDialog::runAgain(QString prog, QStringList arg, int closeBehaviour
|
||||
foreach(QString str, arg) cmdLine.append(" " + str);
|
||||
closeOpt = closeBehaviour;
|
||||
currLine.clear();
|
||||
prevLine.clear();
|
||||
process->start(prog,arg);
|
||||
}
|
||||
|
||||
@@ -194,12 +194,18 @@ void avrOutputDialog::waitForFinish()
|
||||
|
||||
void avrOutputDialog::addText(const QString &text)
|
||||
{
|
||||
int val = ui->plainTextEdit->verticalScrollBar()->maximum();
|
||||
ui->plainTextEdit->insertPlainText(text);
|
||||
if(val!=ui->plainTextEdit->verticalScrollBar()->maximum())
|
||||
ui->plainTextEdit->verticalScrollBar()->setValue(ui->plainTextEdit->verticalScrollBar()->maximum());
|
||||
}
|
||||
QTextCursor cursor(ui->plainTextEdit->textCursor());
|
||||
|
||||
// is the scrollbar at the end?
|
||||
bool atEnd = (ui->plainTextEdit->verticalScrollBar()->value() == ui->plainTextEdit->verticalScrollBar()->maximum());
|
||||
|
||||
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor, 1);
|
||||
cursor.insertText(text);
|
||||
|
||||
if (atEnd) {
|
||||
ui->plainTextEdit->verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
|
||||
}
|
||||
}
|
||||
|
||||
void avrOutputDialog::doAddTextStdOut()
|
||||
{
|
||||
@@ -209,31 +215,30 @@ void avrOutputDialog::doAddTextStdOut()
|
||||
int nlPos, pos, size;
|
||||
|
||||
addText(text);
|
||||
|
||||
currStdLine.append(text);
|
||||
if (currStdLine.contains("size = ")) {
|
||||
pos=currStdLine.lastIndexOf("size = ");
|
||||
temp=currStdLine.mid(pos+7);
|
||||
pos=temp.lastIndexOf("\n");
|
||||
size=temp.left(pos).toInt();
|
||||
pos = currStdLine.lastIndexOf("size = ");
|
||||
temp = currStdLine.mid(pos+7);
|
||||
pos = temp.lastIndexOf("\n");
|
||||
size = temp.left(pos).toInt();
|
||||
ui->progressBar->setMaximum(size/2048);
|
||||
}
|
||||
if (currStdLine.contains("\n")) {
|
||||
nlPos=currStdLine.lastIndexOf("\n");
|
||||
prevStdLine=currStdLine.left(nlPos).trimmed();
|
||||
currStdLine=currStdLine.mid(nlPos+1);
|
||||
nlPos = currStdLine.lastIndexOf("\n");
|
||||
currStdLine = currStdLine.mid(nlPos+1);
|
||||
}
|
||||
if (!currStdLine.isEmpty()) {
|
||||
if (currStdLine.at(0)==QChar('.')) {
|
||||
pos=currStdLine.lastIndexOf(".");
|
||||
if (currStdLine.at(0) == QChar('.')) {
|
||||
pos = currStdLine.lastIndexOf(".");
|
||||
ui->progressBar->setValue(pos);
|
||||
}
|
||||
}
|
||||
if (!currStdLine.isEmpty()) {
|
||||
if (currStdLine.startsWith("Starting upload: [")) {
|
||||
pos=(currStdLine.lastIndexOf("#")-19)/(MAX_FSIZE/204800.0);
|
||||
else if (currStdLine.startsWith("Starting upload: [")) {
|
||||
pos = (currStdLine.lastIndexOf("#")-19)/(MAX_FSIZE/204800.0);
|
||||
ui->progressBar->setValue(pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.contains("Complete ")) {
|
||||
#if !__GNUC__
|
||||
if (kill_timer) {
|
||||
@@ -250,19 +255,15 @@ void avrOutputDialog::doAddTextStdOut()
|
||||
}
|
||||
}
|
||||
|
||||
//addText("\n=====\n" + text + "\n=====\n");
|
||||
|
||||
if(text.contains(":010000")) //contains fuse info
|
||||
{
|
||||
QStringList stl = text.split(":01000000");
|
||||
|
||||
foreach (QString t, stl)
|
||||
{
|
||||
bool ok = false;
|
||||
if(!lfuse) lfuse = t.left(2).toInt(&ok,16);
|
||||
if(!hfuse && !ok) hfuse = t.left(2).toInt(&ok,16);
|
||||
if(!efuse && !ok) efuse = t.left(2).toInt(&ok,16);
|
||||
}
|
||||
if (text.contains(":010000")) {
|
||||
//contains fuse info
|
||||
QStringList stl = text.split(":01000000");
|
||||
foreach (QString t, stl) {
|
||||
bool ok = false;
|
||||
if (!lfuse) lfuse = t.left(2).toInt(&ok,16);
|
||||
if (!hfuse && !ok) hfuse = t.left(2).toInt(&ok,16);
|
||||
if (!efuse && !ok) efuse = t.left(2).toInt(&ok,16);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.contains("-E-")) {
|
||||
@@ -276,9 +277,11 @@ QString avrOutputDialog::getProgrammer()
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
return "DFU Util";
|
||||
} else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
}
|
||||
else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
return "SAM-BA";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return "AVRDUDE";
|
||||
}
|
||||
}
|
||||
@@ -298,25 +301,31 @@ void avrOutputDialog::errorWizard()
|
||||
DeviceStr="Atmega 64";
|
||||
FwStr="\n"+tr("ie: OpenTX for 9X board or OpenTX for 9XR board");
|
||||
fwexist=true;
|
||||
} else if (DeviceId=="0x1e9702") {
|
||||
}
|
||||
else if (DeviceId=="0x1e9702") {
|
||||
DeviceStr="Atmega 128";
|
||||
FwStr="\n"+tr("ie: OpenTX for M128 / 9X board or OpenTX for 9XR board with M128 chip");
|
||||
fwexist=true;
|
||||
} else if (DeviceId=="0x1e9703") {
|
||||
}
|
||||
else if (DeviceId=="0x1e9703") {
|
||||
DeviceStr="Atmega 1280";
|
||||
} else if (DeviceId=="0x1e9704") {
|
||||
}
|
||||
else if (DeviceId=="0x1e9704") {
|
||||
DeviceStr="Atmega 1281";
|
||||
} else if (DeviceId=="0x1e9801") {
|
||||
}
|
||||
else if (DeviceId=="0x1e9801") {
|
||||
DeviceStr="Atmega 2560";
|
||||
FwStr="\n"+tr("ie: OpenTX for Gruvin9X board");
|
||||
fwexist=true;
|
||||
} else if (DeviceId=="0x1e9802") {
|
||||
}
|
||||
else if (DeviceId=="0x1e9802") {
|
||||
DeviceStr="Atmega 2561";
|
||||
}
|
||||
}
|
||||
if (fwexist==false) {
|
||||
QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name));
|
||||
}
|
||||
@@ -333,7 +342,7 @@ void avrOutputDialog::doAddTextStdErr()
|
||||
|
||||
currLine.append(text);
|
||||
if (currLine.contains("#")) {
|
||||
avrphase=currLine.left(1).toLower();
|
||||
avrphase = currLine.left(1).toLower();
|
||||
if (avrphase=="w") {
|
||||
ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #ff0000; text-align:center;}:");
|
||||
phase=1;
|
||||
@@ -344,14 +353,15 @@ void avrOutputDialog::doAddTextStdErr()
|
||||
pbvalue=currLine.count("#")*2;
|
||||
ui->progressBar->setValue(pbvalue);
|
||||
}
|
||||
if (avrphase=="r") {
|
||||
else if (avrphase=="r") {
|
||||
if (phase==0) {
|
||||
ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #00ff00; text-align:center;}:");
|
||||
if(winTitle.isEmpty())
|
||||
setWindowTitle(getProgrammer() + " - " + tr("Reading"));
|
||||
else
|
||||
setWindowTitle(getProgrammer() + " - " + winTitle + " - " + tr("Reading"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #0000ff; text-align:center;}:");
|
||||
phase=2;
|
||||
if(winTitle.isEmpty())
|
||||
@@ -363,11 +373,12 @@ void avrOutputDialog::doAddTextStdErr()
|
||||
ui->progressBar->setValue(pbvalue);
|
||||
}
|
||||
}
|
||||
|
||||
if (currLine.contains("\n")) {
|
||||
nlPos=currLine.lastIndexOf("\n");
|
||||
prevLine=currLine.left(nlPos).trimmed();
|
||||
currLine=currLine.mid(nlPos+1);
|
||||
nlPos = currLine.lastIndexOf("\n");
|
||||
currLine = currLine.mid(nlPos+1);
|
||||
}
|
||||
|
||||
if (text.contains("-E-") && !text.contains("-E- No receive file name")) {
|
||||
hasErrors = true;
|
||||
}
|
||||
@@ -376,6 +387,7 @@ void avrOutputDialog::doAddTextStdErr()
|
||||
}
|
||||
|
||||
#define HLINE_SEPARATOR "================================================================================="
|
||||
|
||||
void avrOutputDialog::doFinished(int code=0)
|
||||
{
|
||||
addText("\n" HLINE_SEPARATOR);
|
||||
@@ -385,17 +397,22 @@ void avrOutputDialog::doFinished(int code=0)
|
||||
if (code) {
|
||||
ui->checkBox->setChecked(true);
|
||||
addText("\n" + getProgrammer() + " " + tr("done - exit code %1").arg(code));
|
||||
} else if (hasErrors) {
|
||||
}
|
||||
else if (hasErrors) {
|
||||
ui->checkBox->setChecked(true);
|
||||
addText("\n" + getProgrammer() + " " + tr("done with errors"));
|
||||
} else if (!cmdLine.isEmpty()) {
|
||||
}
|
||||
else if (!cmdLine.isEmpty()) {
|
||||
addText("\n" + getProgrammer() + " " + tr("done - SUCCESSFUL"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
addText(tr("done - SUCCESSFUL"));
|
||||
}
|
||||
addText("\n" HLINE_SEPARATOR "\n");
|
||||
|
||||
if(lfuse || hfuse || efuse) addReadFuses();
|
||||
if(lfuse || hfuse || efuse) {
|
||||
addReadFuses();
|
||||
}
|
||||
|
||||
switch(closeOpt)
|
||||
{
|
||||
@@ -417,7 +434,8 @@ void avrOutputDialog::doFinished(int code=0)
|
||||
if (!cmdLine.isEmpty()) {
|
||||
if (getProgrammer()!="AVRDUDE") {
|
||||
QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("did not finish correctly"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int res = QMessageBox::question(this, "Companion",getProgrammer() + " " + tr("did not finish correctly!\nDo you want some help ?"),QMessageBox::Yes | QMessageBox::No);
|
||||
if (res != QMessageBox::No) {
|
||||
errorWizard();
|
||||
@@ -427,12 +445,14 @@ void avrOutputDialog::doFinished(int code=0)
|
||||
QMessageBox::critical(this, "Companion", tr("Copy did not finish correctly"));
|
||||
}
|
||||
// reject();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!cmdLine.isEmpty()) {
|
||||
ui->progressBar->setValue(100);
|
||||
ui->progressBar->setValue(ui->progressBar->maximum());
|
||||
QMessageBox::information(this, "Companion", getProgrammer() + " " + tr("finished correctly"));
|
||||
accept();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, "Companion", tr("Copy finished correctly"));
|
||||
accept();
|
||||
}
|
||||
@@ -454,8 +474,6 @@ void avrOutputDialog::doProcessStarted()
|
||||
addText("\n" HLINE_SEPARATOR "\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void avrOutputDialog::addReadFuses()
|
||||
{
|
||||
addText(HLINE_SEPARATOR "\n");
|
||||
@@ -463,19 +481,23 @@ void avrOutputDialog::addReadFuses()
|
||||
addText("\n" HLINE_SEPARATOR "\n");
|
||||
}
|
||||
|
||||
void avrOutputDialog::on_checkBox_toggled(bool checked) {
|
||||
void avrOutputDialog::on_checkBox_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->plainTextEdit->show();
|
||||
} else {
|
||||
ui->plainTextEdit->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
ui->plainTextEdit->show();
|
||||
}
|
||||
else {
|
||||
ui->plainTextEdit->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
}
|
||||
|
||||
void avrOutputDialog::shrink() {
|
||||
void avrOutputDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
void avrOutputDialog::forceClose() {
|
||||
accept();;
|
||||
void avrOutputDialog::forceClose()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -52,9 +52,7 @@ private:
|
||||
quint8 lfuse;
|
||||
quint8 hfuse;
|
||||
quint8 efuse;
|
||||
QString prevLine;
|
||||
QString currLine;
|
||||
QString prevStdLine;
|
||||
QString currStdLine;
|
||||
int phase;
|
||||
QString winTitle;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "ui_burnconfigdialog.h"
|
||||
#include "avroutputdialog.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include <QtGui>
|
||||
|
||||
#if !defined WIN32 && defined __GNUC__
|
||||
@@ -82,33 +84,42 @@ burnConfigDialog::~burnConfigDialog()
|
||||
|
||||
void burnConfigDialog::getSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
avrLoc = g.avrdudeLocation();
|
||||
sambaLoc = g.sambaLocation();
|
||||
dfuLoc = g.dfuLocation();
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
avrLoc = settings.value("avrdude_location", QFileInfo("avrdude.exe").absoluteFilePath()).toString();
|
||||
sambaLoc = settings.value("samba_location", QFileInfo("sam-ba.exe").absoluteFilePath()).toString();
|
||||
dfuLoc = settings.value("dfu_location", QFileInfo("dfu-util.exe").absoluteFilePath()).toString();
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = QFileInfo("avrdude.exe").absoluteFilePath();
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = QFileInfo("sam-ba.exe").absoluteFilePath();
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("dfu-util.exe").absoluteFilePath();
|
||||
#elif defined __APPLE__
|
||||
avrLoc = settings.value("avrdude_location", "/usr/local/bin/avrdude").toString();
|
||||
sambaLoc = settings.value("samba_location", "/usr/local/bin/sam-ba").toString();
|
||||
dfuLoc = settings.value("dfu_location", QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath()).toString();
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = "/usr/local/bin/avrdude";
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = "/usr/local/bin/sam-ba";
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath();
|
||||
#else
|
||||
avrLoc = settings.value("avrdude_location", "/usr/bin/avrdude").toString();
|
||||
sambaLoc = settings.value("samba_location", "/usr/bin/sam-ba").toString();
|
||||
dfuLoc = settings.value("dfu_location", QFileInfo("/usr/bin/dfu-util").absoluteFilePath()).toString();
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = "/usr/bin/avrdude";
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = "/usr/bin/sam-ba";
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("/usr/bin/dfu-util").absoluteFilePath();
|
||||
#endif
|
||||
QString str = settings.value("avr_arguments").toString();
|
||||
avrArgs = str.split(" ", QString::SkipEmptyParts);
|
||||
|
||||
avrProgrammer = settings.value("programmer", QString("usbasp")).toString();
|
||||
|
||||
avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
armMCU = settings.value("arm_mcu", QString("at91sam3s4-9x")).toString();
|
||||
dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts);
|
||||
avrArgs = g.avrArguments().split(" ", QString::SkipEmptyParts);
|
||||
avrProgrammer = g.programmer();
|
||||
avrPort = g.avrPort();
|
||||
avrMCU = g.mcu();
|
||||
armMCU = g.armMcu();
|
||||
sambaPort = g.sambaPort();
|
||||
|
||||
avrPort = settings.value("avr_port", "").toString();
|
||||
sambaPort = settings.value("samba_port", "\\USBserial\\COM23").toString();
|
||||
|
||||
str = settings.value("dfu_arguments", "-a 0").toString();
|
||||
dfuArgs = str.split(" ", QString::SkipEmptyParts);
|
||||
ui->avrdude_location->setText(getAVRDUDE());
|
||||
ui->avrArgs->setText(getAVRArgs().join(" "));
|
||||
|
||||
@@ -136,17 +147,16 @@ void burnConfigDialog::getSettings()
|
||||
|
||||
void burnConfigDialog::putSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
settings.setValue("avrdude_location", avrLoc);
|
||||
settings.setValue("programmer", avrProgrammer);
|
||||
settings.setValue("mcu", avrMCU);
|
||||
settings.setValue("avr_port", avrPort);
|
||||
settings.setValue("avr_arguments", avrArgs.join(" "));
|
||||
settings.setValue("samba_location", sambaLoc);
|
||||
settings.setValue("samba_port", sambaPort);
|
||||
settings.setValue("arm_mcu", armMCU);
|
||||
settings.setValue("dfu_location", dfuLoc);
|
||||
settings.setValue("dfu_arguments", dfuArgs.join(" "));
|
||||
g.avrdudeLocation( avrLoc );
|
||||
g.programmer( avrProgrammer);
|
||||
g.mcu( avrMCU );
|
||||
g.avrPort( avrPort );
|
||||
g.avrArguments( avrArgs.join(" ") );
|
||||
g.sambaLocation( sambaLoc );
|
||||
g.sambaPort( sambaPort );
|
||||
g.armMcu( armMCU );
|
||||
g.dfuLocation( dfuLoc );
|
||||
g.dfuArguments( dfuArgs.join(" ") );
|
||||
}
|
||||
|
||||
void burnConfigDialog::populateProgrammers()
|
||||
@@ -278,8 +288,9 @@ void burnConfigDialog::listProgrammers()
|
||||
QStringList arguments;
|
||||
arguments << "-c?";
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "List available programmers", AVR_DIALOG_KEEP_OPEN, TRUE);
|
||||
ad->setWindowIcon(QIcon(":/images/list.png"));
|
||||
ad->setWindowIcon(CompanionIcon("list.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_pushButton_3_clicked()
|
||||
@@ -295,8 +306,9 @@ void burnConfigDialog::on_pushButton_4_clicked()
|
||||
arguments << "-?";
|
||||
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "Show help", AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
ad->setWindowIcon(QIcon(":/images/configure.png"));
|
||||
ad->setWindowIcon(CompanionIcon("configure.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,8 +324,9 @@ void burnConfigDialog::readFuses()
|
||||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << str;
|
||||
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Read Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
ad->setWindowIcon(QIcon(":/images/fuses.png"));
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
void burnConfigDialog::restFuses(bool eeProtect)
|
||||
@@ -324,7 +337,6 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
//avrdude -c usbasp -p m64 -U efuse:w:<0xFF>:m
|
||||
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
|
||||
ret = QMessageBox::warning(this, tr("Companion"),
|
||||
tr("<b><u>WARNING!</u></b><br>This will reset the fuses of %1 to the factory settings.<br>Writing fuses can mess up your radio.<br>Do this only if you are sure they are wrong!<br>Are you sure you want to continue?").arg(avrMCU),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
@@ -338,7 +350,8 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
QString erStr = eeProtect ? "hfuse:w:0x11:m" : "hfuse:w:0x19:m";
|
||||
str << "-U" << "lfuse:w:0xD7:m" << "-U" << erStr << "-U" << "efuse:w:0xFC:m";
|
||||
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
QString lfuses;
|
||||
@@ -346,8 +359,9 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
QStringList argread;
|
||||
argread << "-c" << avrProgrammer << "-p" << avrMCU << args <<"-U" << "lfuse:r:"+tempFile+":r" ;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, argread, "Reset Fuses",AVR_DIALOG_CLOSE_IF_SUCCESSFUL,FALSE);
|
||||
ad->setWindowIcon(QIcon(":/images/fuses.png"));
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
QFile file(tempFile);
|
||||
if (file.exists() && file.size()==1) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
@@ -355,12 +369,14 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
file.read(bin_flash, 1);
|
||||
if (bin_flash[0]==0x0E) {
|
||||
lfuses="lfuse:w:0x0E:m";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
file.close();
|
||||
unlink(tempFile.toAscii());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
|
||||
@@ -371,12 +387,14 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
QStringList arguments;
|
||||
if (avrMCU=="m2560") {
|
||||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-u" << str;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-B" << "100" << "-u" << str;
|
||||
}
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Reset Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
ad->setWindowIcon(QIcon(":/images/fuses.png"));
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -388,24 +406,29 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->show();
|
||||
ui->dfuArgs->show();
|
||||
} else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
}
|
||||
else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
ui->label_sb2->show();
|
||||
ui->arm_mcu->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->label_av3->show();
|
||||
ui->avrdude_mcu->show();
|
||||
QMessageBox::warning(this, tr("Companion"),
|
||||
tr("<b><u>WARNING!</u></b><br>Normally CPU type is automatically selected according to the chosen firmware.<br>If you change the CPU type the resulting eeprom could be inconsistent."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfuArgs->hide();
|
||||
} else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
}
|
||||
else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
ui->label_sb2->hide();
|
||||
ui->arm_mcu->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->label_av3->hide();
|
||||
ui->avrdude_mcu->hide();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "splashlibrary.h"
|
||||
#include "flashinterface.h"
|
||||
#include "hexinterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
// Type 1 = Burn EEPROM, Type 2= Burn Flash
|
||||
burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * backupEE, QString DocName):
|
||||
QDialog(parent),
|
||||
ui(new Ui::burnDialog),
|
||||
@@ -16,32 +18,37 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||
hexType(Type)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if(!g.profile[g.id()].splashFile().isEmpty()){
|
||||
imageSource=PROFILE;
|
||||
imageFile=g.profile[g.id()].splashFile();
|
||||
}
|
||||
else{
|
||||
ui->useProfileImageCB->setDisabled(true);
|
||||
imageSource=FIRMWARE;
|
||||
imageFile="";
|
||||
}
|
||||
ui->SplashFrame->hide();
|
||||
ui->FramFWInfo->hide();
|
||||
ui->EEbackupCB->hide();
|
||||
ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked);
|
||||
if (Type == 2) {
|
||||
if (Type == FLASH_FILE_TYPE ) {
|
||||
ui->EEpromCB->hide();
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->hide();
|
||||
ui->patchhw_CB->hide();
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
this->setWindowTitle(tr("Write firmware to TX"));
|
||||
setWindowTitle(tr("Write firmware to TX"));
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->hide();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->FlashLoadButton->setText(tr("Browse for file"));
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->hide();
|
||||
ui->patchhw_CB->hide();
|
||||
ui->EEpromCB->hide();
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->FwImage->clear();
|
||||
ui->FWFileName->clear();
|
||||
ui->DateField->clear();
|
||||
ui->SVNField->clear();
|
||||
@@ -51,41 +58,28 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->EEbackupCB->hide();
|
||||
if (DocName.isEmpty()) {
|
||||
this->setWindowTitle(tr("Write Models and Settings to TX"));
|
||||
} else {
|
||||
this->setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
|
||||
setWindowTitle(tr("Write Models and Settings to TX"));
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
settings.beginGroup(profile);
|
||||
QString Name=settings.value("Name","").toString();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
ui->profile_label->setText(tr("Current profile")+QString(": ")+Name);
|
||||
else {
|
||||
setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
|
||||
}
|
||||
ui->profile_label->setText(tr("Current profile")+QString(": ")+g.profile[g.id()].name());
|
||||
}
|
||||
if (!hexfileName->isEmpty()) {
|
||||
ui->FWFileName->setText(*hexfileName);
|
||||
if (Type==2) {
|
||||
if (Type==FLASH_FILE_TYPE) {
|
||||
checkFw(*hexfileName);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
burnraw=false;
|
||||
if (checkeEprom(*hexfileName)) {
|
||||
QSettings settings("companion", "companion");
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
settings.beginGroup(profile);
|
||||
QString Name=settings.value("Name","").toString();
|
||||
QString calib=settings.value("StickPotCalib","").toString();
|
||||
QString trainercalib=settings.value("TrainerCalib","").toString();
|
||||
QString DisplaySet=settings.value("Display","").toString();
|
||||
QString BeeperSet=settings.value("Beeper","").toString();
|
||||
QString HapticSet=settings.value("Haptic","").toString();
|
||||
QString SpeakerSet=settings.value("Speaker","").toString();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
QString Name = g.profile[g.id()].name();
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
QString trainercalib = g.profile[g.id()].trainerCalib();
|
||||
QString DisplaySet = g.profile[g.id()].display();
|
||||
QString BeeperSet = g.profile[g.id()].beeper();
|
||||
QString HapticSet = g.profile[g.id()].haptic();
|
||||
QString SpeakerSet = g.profile[g.id()].speaker();
|
||||
if (!Name.isEmpty()) {
|
||||
ui->profile_label->show();
|
||||
ui->patchcalib_CB->show();
|
||||
@@ -97,12 +91,14 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||
if (!((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6))) {
|
||||
ui->patchhw_CB->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->profile_label->hide();
|
||||
}
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEpromCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEpromCB->setChecked(false);
|
||||
}
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
@@ -112,32 +108,27 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
||||
ui->FlashLoadButton->hide();
|
||||
hexfileName->clear();
|
||||
}
|
||||
else if (Type==2) {
|
||||
QSettings settings("companion", "companion");
|
||||
QString FileName;
|
||||
FileName = settings.value("lastFw").toString();
|
||||
else if (Type==FLASH_FILE_TYPE) {
|
||||
QString FileName = g.profile[g.id()].fwName();
|
||||
QFile file(FileName);
|
||||
if (file.exists()) {
|
||||
checkFw(FileName);
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
burnDialog::~burnDialog() {
|
||||
burnDialog::~burnDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void burnDialog::on_FlashLoadButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->FwImage->clear();
|
||||
ui->FWFileName->clear();
|
||||
ui->DateField->clear();
|
||||
ui->SVNField->clear();
|
||||
@@ -147,11 +138,14 @@ void burnDialog::on_FlashLoadButton_clicked()
|
||||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->EEbackupCB->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
if (hexType==2) {
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
if (hexType==FLASH_FILE_TYPE) {
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if(fileName.isEmpty())
|
||||
return;
|
||||
checkFw(fileName);
|
||||
} else {
|
||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
}
|
||||
else {
|
||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
if (checkeEprom(fileName)) {
|
||||
if (burnraw==false) {
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
@@ -160,10 +154,12 @@ void burnDialog::on_FlashLoadButton_clicked()
|
||||
ui->patchhw_CB->show();
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEpromCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEpromCB->setChecked(false);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->setChecked(false);
|
||||
@@ -174,6 +170,7 @@ void burnDialog::on_FlashLoadButton_clicked()
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::checkFw(QString fileName)
|
||||
@@ -181,10 +178,11 @@ void burnDialog::checkFw(QString fileName)
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEbackupCB->setChecked(false);
|
||||
*backup=false;
|
||||
}
|
||||
@@ -195,57 +193,19 @@ void burnDialog::checkFw(QString fileName)
|
||||
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
|
||||
ui->SVNField->setText(flash.getSvn());
|
||||
ui->ModField->setText(flash.getBuild());
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
ui->BurnFlashButton->setText(tr("Write to TX"));
|
||||
|
||||
ui->SplashFrame->hide();
|
||||
if (flash.hasSplash()) {
|
||||
ui->SplashFrame->show();
|
||||
ui->ImageLoadButton->setEnabled(true);
|
||||
ui->libraryButton->setEnabled(true);
|
||||
ui->FwImage->setFixedSize(flash.getSplashWidth(),flash.getSplashHeight());
|
||||
ui->imageLabel->setFixedSize(flash.getSplashWidth(),flash.getSplashHeight());
|
||||
ui->FwImage->show();
|
||||
ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
QString ImageStr = settings.value("SplashImage", "").toString();
|
||||
bool PatchFwCB = settings.value("patchImage", false).toBool();
|
||||
if (!ImageStr.isEmpty()) {
|
||||
QImage Image = qstring2image(ImageStr);
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat())));
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
ui->PreferredImageCB->setChecked(true);
|
||||
ui->PatchFWCB->setChecked(PatchFwCB);
|
||||
}
|
||||
else {
|
||||
QString fileName=ui->ImageFileName->text();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (!image.isNull()) {
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat())));
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
ui->PatchFWCB->setChecked(PatchFwCB);
|
||||
} else {
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->PreferredImageCB->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->PreferredImageCB->setDisabled(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui->FwImage->hide();
|
||||
ui->ImageFileName->setText("");
|
||||
ui->SplashFrame->hide();
|
||||
ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName));
|
||||
ui->BurnFlashButton->setText(tr("Burn anyway !"));
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fileName));
|
||||
}
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
|
||||
bool burnDialog::checkeEprom(QString fileName)
|
||||
@@ -267,7 +227,8 @@ bool burnDialog::checkeEprom(QString fileName)
|
||||
}
|
||||
QTextStream inputStream(&file);
|
||||
XmlInterface(inputStream).load(radioData);
|
||||
} else if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
|
||||
}
|
||||
else if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString()));
|
||||
return false;
|
||||
@@ -310,7 +271,8 @@ bool burnDialog::checkeEprom(QString fileName)
|
||||
ui->FWFileName->setText(fileName);
|
||||
return true;
|
||||
}
|
||||
} else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
}
|
||||
else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
int eeprom_size = file.size();
|
||||
if (!file.open(QFile::ReadOnly)) { //reading binary file - TODO HEX support
|
||||
QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString()));
|
||||
@@ -336,53 +298,92 @@ bool burnDialog::checkeEprom(QString fileName)
|
||||
return true;
|
||||
}
|
||||
|
||||
void burnDialog::on_ImageLoadButton_clicked()
|
||||
void burnDialog::displaySplash()
|
||||
{
|
||||
QImage image;
|
||||
if (imageSource == FIRMWARE){
|
||||
FlashInterface flash(ui->FWFileName->text());
|
||||
image = flash.getSplash();
|
||||
}
|
||||
else{
|
||||
image.load(imageFile);
|
||||
}
|
||||
if (image.isNull()) {
|
||||
return;
|
||||
}
|
||||
ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
|
||||
}
|
||||
|
||||
void burnDialog::updateUI()
|
||||
{
|
||||
if (hexType==EEPROM_FILE_TYPE)
|
||||
return;
|
||||
|
||||
ui->useProfileImageCB->setChecked( imageSource == PROFILE );
|
||||
ui->useFwImageCB->setChecked( imageSource == FIRMWARE );
|
||||
ui->useLibraryImageCB->setChecked( imageSource == LIBRARY );
|
||||
ui->useAnotherImageCB->setChecked( imageSource == ANOTHER );
|
||||
|
||||
displaySplash();
|
||||
}
|
||||
|
||||
void burnDialog::on_useFwImageCB_clicked()
|
||||
{
|
||||
QString fileName = ui->FWFileName->text();
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.isValid()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr( "The firmware file is not valid." ));
|
||||
}
|
||||
else {
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." ));
|
||||
}
|
||||
else{
|
||||
imageSource = FIRMWARE;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::on_useProfileImageCB_clicked()
|
||||
{
|
||||
QString fileName = g.profile[g.id()].splashFile();
|
||||
if (!fileName.isEmpty()){
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not contain an image.").arg(fileName));
|
||||
}
|
||||
else {
|
||||
imageSource = PROFILE;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::on_useAnotherImageCB_clicked()
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
if (!fileName.isEmpty()){
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
return;
|
||||
QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName));
|
||||
}
|
||||
ui->ImageFileName->setText(fileName);
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
if (ui->imageLabel->width()!=128) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
else{
|
||||
imageSource = ANOTHER;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::on_libraryButton_clicked()
|
||||
void burnDialog::on_useLibraryImageCB_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||
@@ -390,50 +391,26 @@ void burnDialog::on_libraryButton_clicked()
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
return;
|
||||
QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded"));
|
||||
}
|
||||
ui->ImageFileName->setText(fileName);
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
if (ui->imageLabel->width()!=128) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
||||
else{
|
||||
imageSource = LIBRARY;
|
||||
imageFile = fileName;
|
||||
}
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void burnDialog::on_BurnFlashButton_clicked()
|
||||
{
|
||||
if (hexType==2) {
|
||||
if (hexType==FLASH_FILE_TYPE) {
|
||||
QString fileName=ui->FWFileName->text();
|
||||
if (!fileName.isEmpty()) {
|
||||
QSettings settings("companion", "companion");
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
settings.setValue("lastFw", fileName);
|
||||
if (ui->PatchFWCB->isChecked()) {
|
||||
settings.setValue("patchImage", true);
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
if (!ui->useFwImageCB->isChecked()) {
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
||||
if (!image.isNull()) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
if (getFileType(fileName) == FILE_TYPE_HEX)
|
||||
tempFile = tempDir + "/flash.hex";
|
||||
@@ -453,7 +430,6 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
QMessageBox::critical(this, tr("Warning"), tr("Custom image not found"));
|
||||
}
|
||||
} else {
|
||||
settings.setValue("patchImage", false);
|
||||
hexfileName->clear();
|
||||
hexfileName->append(fileName);
|
||||
}
|
||||
@@ -462,27 +438,20 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
hexfileName->clear();
|
||||
}
|
||||
}
|
||||
if (hexType==1) {
|
||||
QSettings settings("companion", "companion");
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
settings.beginGroup(profile);
|
||||
QString calib=settings.value("StickPotCalib","").toString();
|
||||
QString trainercalib=settings.value("TrainerCalib","").toString();
|
||||
if (hexType==EEPROM_FILE_TYPE) {
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
QString trainercalib = g.profile[g.id()].trainerCalib();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
int8_t vBatCalib=(int8_t)settings.value("VbatCalib", radioData.generalSettings.vBatCalib).toInt();
|
||||
int8_t currentCalib=(int8_t)settings.value("currentCalib", radioData.generalSettings.currentCalib).toInt();
|
||||
int8_t PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", radioData.generalSettings.PPM_Multiplier).toInt();
|
||||
uint8_t GSStickMode=(uint8_t)settings.value("GSStickMode", radioData.generalSettings.stickMode).toUInt();
|
||||
uint8_t vBatWarn=(uint8_t)settings.value("vBatWarn",radioData.generalSettings.vBatWarn).toUInt();
|
||||
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
|
||||
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
|
||||
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
|
||||
uint8_t GSStickMode=(uint8_t) g.profile[g.id()].gsStickMode();
|
||||
uint8_t vBatWarn=(uint8_t) g.profile[g.id()].vBatWarn();
|
||||
|
||||
QString DisplaySet=settings.value("Display","").toString();
|
||||
QString BeeperSet=settings.value("Beeper","").toString();
|
||||
QString HapticSet=settings.value("Haptic","").toString();
|
||||
QString SpeakerSet=settings.value("Speaker","").toString();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
QString DisplaySet= g.profile[g.id()].display();
|
||||
QString BeeperSet= g.profile[g.id()].beeper();
|
||||
QString HapticSet= g.profile[g.id()].haptic();
|
||||
QString SpeakerSet= g.profile[g.id()].speaker();
|
||||
bool patch=false;
|
||||
if (ui->patchcalib_CB->isChecked()) {
|
||||
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
|
||||
@@ -618,99 +587,9 @@ void burnDialog::on_cancelButton_clicked()
|
||||
this->close();
|
||||
}
|
||||
|
||||
void burnDialog::on_InvertColorButton_clicked()
|
||||
{
|
||||
if (ui->imageLabel->pixmap()) {
|
||||
QImage image = ui->imageLabel->pixmap()->toImage();
|
||||
image.invertPixels();
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
}
|
||||
}
|
||||
|
||||
void burnDialog::on_EEpromCB_toggled(bool checked)
|
||||
{
|
||||
if (ui->EEpromCB->isChecked()) {
|
||||
*backup=true;
|
||||
} else {
|
||||
*backup=false;
|
||||
}
|
||||
}
|
||||
|
||||
void burnDialog::on_PreferredImageCB_toggled(bool checked)
|
||||
{
|
||||
QString tmpFileName;
|
||||
if (checked) {
|
||||
QSettings settings("companion", "companion");
|
||||
QString ImageStr = settings.value("SplashImage", "").toString();
|
||||
if (!ImageStr.isEmpty()) {
|
||||
QImage Image = qstring2image(ImageStr);
|
||||
if (ui->imageLabel->width()!=128) {
|
||||
Image=Image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = Image.width();
|
||||
int height = Image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = Image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
Image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Image=Image.convertToFormat(QImage::Format_Mono);
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(Image));
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
ui->PreferredImageCB->setChecked(true);
|
||||
ui->ImageFileName->setDisabled(true);
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->imageLabel->clear();
|
||||
ui->ImageLoadButton->setEnabled(true);
|
||||
ui->libraryButton->setEnabled(true);
|
||||
tmpFileName = ui->ImageFileName->text();
|
||||
if (!tmpFileName.isEmpty()) {
|
||||
QImage image(tmpFileName);
|
||||
if (!image.isNull()) {
|
||||
if (ui->imageLabel->width()!=128) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
image=image.convertToFormat(QImage::Format_Mono);
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
||||
ui->InvertColorButton->setEnabled(true);
|
||||
ui->ImageFileName->setEnabled(true);
|
||||
ui->PatchFWCB->setDisabled(false);
|
||||
} else {
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
}
|
||||
} else {
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
}
|
||||
}
|
||||
*backup = ui->EEpromCB->isChecked();
|
||||
}
|
||||
|
||||
void burnDialog::shrink()
|
||||
@@ -720,9 +599,5 @@ void burnDialog::shrink()
|
||||
|
||||
void burnDialog::on_EEbackupCB_clicked()
|
||||
{
|
||||
if (ui->EEbackupCB->isChecked()) {
|
||||
*backup=true;
|
||||
} else {
|
||||
*backup=false;
|
||||
}
|
||||
*backup = ui->EEbackupCB->isChecked();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
|
||||
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
|
||||
#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE"
|
||||
#define EEPROM_FILE_TYPE 1
|
||||
#define FLASH_FILE_TYPE 2
|
||||
|
||||
|
||||
namespace Ui
|
||||
@@ -36,18 +38,22 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_FlashLoadButton_clicked();
|
||||
void on_ImageLoadButton_clicked();
|
||||
void on_libraryButton_clicked();
|
||||
void on_BurnFlashButton_clicked();
|
||||
void on_cancelButton_clicked();
|
||||
void on_InvertColorButton_clicked();
|
||||
void on_EEbackupCB_clicked();
|
||||
void on_PreferredImageCB_toggled(bool checked);
|
||||
void on_EEpromCB_toggled(bool checked);
|
||||
void checkFw(QString fileName);
|
||||
void on_EEpromCB_toggled(bool checked);
|
||||
bool checkeEprom(QString fileName);
|
||||
void on_useProfileImageCB_clicked();
|
||||
void on_useFwImageCB_clicked();
|
||||
void on_useLibraryImageCB_clicked();
|
||||
void on_useAnotherImageCB_clicked();
|
||||
|
||||
void checkFw(QString fileName);
|
||||
void displaySplash();
|
||||
void updateUI();
|
||||
void shrink();
|
||||
|
||||
|
||||
private:
|
||||
Ui::burnDialog *ui;
|
||||
QString * hexfileName;
|
||||
@@ -55,6 +61,9 @@ private:
|
||||
int hexType;
|
||||
RadioData radioData;
|
||||
bool burnraw;
|
||||
enum ImageSource {FIRMWARE, PROFILE, LIBRARY, ANOTHER};
|
||||
ImageSource imageSource;
|
||||
QString imageFile;
|
||||
};
|
||||
|
||||
#endif // BURNDIALOG_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>440</width>
|
||||
<height>418</height>
|
||||
<height>423</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -26,25 +26,12 @@
|
||||
<string>Customize Splash</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>:/images/c_home.png</normaloff>:/images/c_home.png</iconset>
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs2">
|
||||
<property name="orientation">
|
||||
@@ -71,19 +58,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BurnFlashButton">
|
||||
<property name="enabled">
|
||||
@@ -100,19 +74,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs2_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -152,56 +113,22 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="2" rowspan="3">
|
||||
<widget class="QLabel" name="FwImage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>212</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="DateField">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="SVNField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="text">
|
||||
<string>Date & Time</string>
|
||||
<string>Variant</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="SVNField">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="ModField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -214,17 +141,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="ModField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>Date & Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="text">
|
||||
<string>Variant</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="DateField">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -325,17 +252,10 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,1">
|
||||
<item row="0" column="1" rowspan="4">
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="InvertColorButton">
|
||||
<property name="text">
|
||||
<string>Invert Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="SplashLayout" rowstretch="0,0,0,0,0,0,0">
|
||||
<item row="0" column="1" rowspan="7">
|
||||
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@@ -359,7 +279,7 @@
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@@ -369,10 +289,50 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="PreferredImageCB">
|
||||
<widget class="QCheckBox" name="useFwImageCB">
|
||||
<property name="text">
|
||||
<string>Use firmware start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="useAnotherImageCB">
|
||||
<property name="text">
|
||||
<string>Use another start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="useProfileImageCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -380,90 +340,14 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use image in settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="PatchFWCB">
|
||||
<property name="text">
|
||||
<string>Substitute image in firmware</string>
|
||||
<string>Use profile start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ImageFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ImageLoadButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="useLibraryImageCB">
|
||||
<property name="text">
|
||||
<string>Load Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="libraryButton">
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
<string>Use library start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -474,18 +358,37 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>BurnFlashButton</tabstop>
|
||||
<tabstop>FWFileName</tabstop>
|
||||
<tabstop>FlashLoadButton</tabstop>
|
||||
<tabstop>ImageFileName</tabstop>
|
||||
<tabstop>ImageLoadButton</tabstop>
|
||||
<tabstop>libraryButton</tabstop>
|
||||
<tabstop>DateField</tabstop>
|
||||
<tabstop>SVNField</tabstop>
|
||||
<tabstop>ModField</tabstop>
|
||||
<tabstop>useProfileImageCB</tabstop>
|
||||
<tabstop>useFwImageCB</tabstop>
|
||||
<tabstop>useLibraryImageCB</tabstop>
|
||||
<tabstop>useAnotherImageCB</tabstop>
|
||||
<tabstop>EEbackupCB</tabstop>
|
||||
<tabstop>patchcalib_CB</tabstop>
|
||||
<tabstop>patchhw_CB</tabstop>
|
||||
<tabstop>EEpromCB</tabstop>
|
||||
<tabstop>cancelButton</tabstop>
|
||||
<tabstop>BurnFlashButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <QSplashScreen>
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
#include "mainwindow.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
@@ -76,66 +76,52 @@ class MyProxyStyle : public QProxyStyle
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Start by borrowing any left over settings from companion9x
|
||||
QSettings c9x_settings("companion9x", "companion9x");
|
||||
QSettings com_settings("companion", "companion");
|
||||
if (!com_settings.contains("pos")) {
|
||||
QStringList keys = c9x_settings.allKeys();
|
||||
for( QStringList::iterator i = keys.begin(); i != keys.end(); i++ )
|
||||
{
|
||||
com_settings.setValue( *i, c9x_settings.value( *i ) );
|
||||
}
|
||||
}
|
||||
Q_INIT_RESOURCE(companion);
|
||||
QApplication app(argc, argv);
|
||||
app.setApplicationName("OpenTX Companion");
|
||||
app.setOrganizationName("OpenTX");
|
||||
app.setOrganizationDomain("open-tx.org");
|
||||
|
||||
Q_INIT_RESOURCE(companion);
|
||||
QApplication app(argc, argv);
|
||||
app.setApplicationName("OpenTX Companion");
|
||||
#ifdef __APPLE__
|
||||
app.setStyle(new MyProxyStyle);
|
||||
app.setStyle(new MyProxyStyle);
|
||||
#endif
|
||||
QString dir;
|
||||
if(argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QString locale = settings.value("locale",QLocale::system().name()).toString();
|
||||
bool showSplash = settings.value("show_splash", true).toBool();
|
||||
QTranslator companionTranslator;
|
||||
companionTranslator.load(":/companion_" + g.locale());
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&companionTranslator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator companionTranslator;
|
||||
companionTranslator.load(":/companion_" + locale);
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
// qDebug() << locale;
|
||||
// qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&companionTranslator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
if (g.profile[g.id()].fwType().isEmpty()){
|
||||
g.profile[g.id()].fwType(default_firmware_variant.id);
|
||||
g.profile[g.id()].fwName("");
|
||||
}
|
||||
|
||||
|
||||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
firmware_id.replace("open9x", "opentx");
|
||||
firmware_id.replace("x9da", "taranis");
|
||||
QPixmap pixmap;
|
||||
if (firmware_id.contains("taranis"))
|
||||
pixmap = QPixmap(":/images/splasht.png");
|
||||
else
|
||||
pixmap = QPixmap(":/images/splash.png");
|
||||
QSplashScreen *splash = new QSplashScreen(pixmap);
|
||||
QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
|
||||
QSplashScreen *splash = new QSplashScreen(pixmap);
|
||||
|
||||
RegisterFirmwares();
|
||||
RegisterFirmwares();
|
||||
|
||||
settings.setValue("firmware", firmware_id);
|
||||
current_firmware_variant = GetFirmwareVariant(firmware_id);
|
||||
// qDebug() << current_firmware_variant;
|
||||
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
|
||||
|
||||
MainWindow mainWin;
|
||||
|
||||
if (showSplash) {
|
||||
splash->show();
|
||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, &mainWin, SLOT(show()));
|
||||
}
|
||||
else {
|
||||
mainWin.show();
|
||||
}
|
||||
return app.exec();
|
||||
MainWindow *mainWin = new MainWindow();
|
||||
if (g.showSplash()) {
|
||||
splash->show();
|
||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
|
||||
}
|
||||
else {
|
||||
mainWin->show();
|
||||
}
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -29,6 +29,7 @@ compareDialog::compareDialog(QWidget *parent, GeneralSettings *gg) :
|
||||
ui(new Ui::compareDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("compare.png"));
|
||||
g_eeGeneral = gg;
|
||||
eepromInterface = GetEepromInterface();
|
||||
te = ui->textEdit;
|
||||
@@ -48,7 +49,7 @@ compareDialog::compareDialog(QWidget *parent, GeneralSettings *gg) :
|
||||
|
||||
void compareDialog::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("application/x-companion9x")) {
|
||||
if (event->mimeData()->hasFormat("application/x-companion")) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
@@ -58,7 +59,7 @@ void compareDialog::dragMoveEvent(QDragMoveEvent *event)
|
||||
void compareDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
// accept just text/uri-list mime format
|
||||
if (event->mimeData()->hasFormat("application/x-companion9x")) {
|
||||
if (event->mimeData()->hasFormat("application/x-companion")) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
@@ -83,7 +84,6 @@ void compareDialog::printDiff()
|
||||
printCurves();
|
||||
printGvars();
|
||||
printSwitches();
|
||||
printSafetySwitches();
|
||||
printFSwitches();
|
||||
printFrSky();
|
||||
te->scrollToAnchor("1");
|
||||
@@ -95,8 +95,8 @@ void compareDialog::dropEvent(QDropEvent *event)
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
if (child) {
|
||||
if (child->objectName().contains("label_1")) {
|
||||
if(mimeData->hasFormat("application/x-companion9x")) {
|
||||
QByteArray gmData = mimeData->data("application/x-companion9x");
|
||||
if(mimeData->hasFormat("application/x-companion")) {
|
||||
QByteArray gmData = mimeData->data("application/x-companion");
|
||||
DragDropHeader *header = (DragDropHeader *)gmData.data();
|
||||
if (!header->general_settings) {
|
||||
char *gData = gmData.data()+sizeof(DragDropHeader);//new char[gmData.size() + 1];
|
||||
@@ -120,8 +120,8 @@ void compareDialog::dropEvent(QDropEvent *event)
|
||||
}
|
||||
}
|
||||
else if (child->objectName().contains("label_2")) {
|
||||
if(mimeData->hasFormat("application/x-companion9x")) {
|
||||
QByteArray gmData = mimeData->data("application/x-companion9x");
|
||||
if(mimeData->hasFormat("application/x-companion")) {
|
||||
QByteArray gmData = mimeData->data("application/x-companion");
|
||||
DragDropHeader *header = (DragDropHeader *)gmData.data();
|
||||
if (!header->general_settings) {
|
||||
char *gData = gmData.data()+sizeof(DragDropHeader);//new char[gmData.size() + 1];
|
||||
@@ -305,7 +305,7 @@ void compareDialog::printPhases()
|
||||
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
|
||||
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
|
||||
for (i=0; i<4; i++) {
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getStickStr(i)));
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
|
||||
}
|
||||
str.append("</tr>");
|
||||
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
|
||||
@@ -406,7 +406,7 @@ void compareDialog::printPhases()
|
||||
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
|
||||
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
|
||||
for (i=0; i<4; i++) {
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getStickStr(i)));
|
||||
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
|
||||
}
|
||||
str.append("</tr>");
|
||||
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
|
||||
@@ -694,7 +694,7 @@ void compareDialog::printExpos()
|
||||
}
|
||||
}
|
||||
str.append("</table></td>");
|
||||
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getStickStr(i)+"</b></td>");
|
||||
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getInputStr(*g_model2, i)+"</b></td>");
|
||||
str.append("<td width=\"45%\">");
|
||||
str.append("<table border=0 cellspacing=0 cellpadding=0>");
|
||||
for (int j=0; j<C9X_MAX_EXPOS; j++) {
|
||||
@@ -1038,19 +1038,19 @@ void compareDialog::printSwitches()
|
||||
int sc=0;
|
||||
QString color;
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Custom Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomSwitches); i++) {
|
||||
QString sw1 = getCustomSwitchStr(&g_model1->customSw[i], *g_model1);
|
||||
QString sw2 = getCustomSwitchStr(&g_model2->customSw[i], *g_model2);
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
|
||||
QString sw1 = g_model1->customSw[i].toString(*g_model1);
|
||||
QString sw2 = g_model2->customSw[i].toString(*g_model2);
|
||||
if (!(sw1.isEmpty() && sw2.isEmpty())) {
|
||||
str.append("<tr>");
|
||||
color=getColor1(sw1,sw2);
|
||||
str.append(QString("<td width=\"45%\"><font color=%1>").arg(color)+sw1+"</font></td>");
|
||||
if (i<9) {
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("CS")+QString("%1</b></td>").arg(i+1));
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("LS")+QString("%1</b></td>").arg(i+1));
|
||||
} else {
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("CS")+('A'+(i-9))+"</b></td>");
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("LS")+('A'+(i-9))+"</b></td>");
|
||||
}
|
||||
color=getColor2(sw1,sw2);
|
||||
str.append(QString("<td width=\"45%\"><font color=%1>").arg(color)+sw2+"</font></td>");
|
||||
@@ -1069,7 +1069,7 @@ void compareDialog::printFSwitches()
|
||||
QString color2;
|
||||
int sc=0;
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Custom Functions")+"</h2></td></tr>");
|
||||
str.append("<tr><td><h2>"+tr("Switch Assignment")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\"><tr>");
|
||||
str.append("<td width=\"7%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
|
||||
str.append("<td width=\"12%\" align=\"center\"><b>"+tr("Function")+"</b></td>");
|
||||
@@ -1096,8 +1096,8 @@ void compareDialog::printFSwitches()
|
||||
str.append("<tr>");
|
||||
if (g_model1->funcSw[i].swtch.type) {
|
||||
str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1));
|
||||
str.append(doTC(getFuncName(g_model1->funcSw[i].func),color1));
|
||||
str.append(doTC(FuncParam(g_model1->funcSw[i].func,g_model1->funcSw[i].param,g_model1->funcSw[i].paramarm, g_model1->funcSw[i].adjustMode),color1));
|
||||
str.append(doTC(g_model1->funcSw[i].funcToString(),color1));
|
||||
str.append(doTC(g_model1->funcSw[i].paramToString(),color1));
|
||||
int index=g_model1->funcSw[i].func;
|
||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model1->funcSw[i].repeatParam),color1));
|
||||
@@ -1115,8 +1115,8 @@ void compareDialog::printFSwitches()
|
||||
str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true));
|
||||
if (g_model2->funcSw[i].swtch.type) {
|
||||
str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2));
|
||||
str.append(doTC(getFuncName(g_model2->funcSw[i].func),color2));
|
||||
str.append(doTC(FuncParam(g_model2->funcSw[i].func,g_model2->funcSw[i].param,g_model2->funcSw[i].paramarm, g_model2->funcSw[i].adjustMode),color2));
|
||||
str.append(doTC(g_model2->funcSw[i].funcToString(),color2));
|
||||
str.append(doTC(g_model2->funcSw[i].paramToString(),color2));
|
||||
int index=g_model2->funcSw[i].func;
|
||||
if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model2->funcSw[i].repeatParam),color2));
|
||||
@@ -1142,55 +1142,6 @@ void compareDialog::printFSwitches()
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
void compareDialog::printSafetySwitches()
|
||||
{
|
||||
QString color1;
|
||||
QString color2;
|
||||
int sc=0;
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:always;\" width=\"100%\">";
|
||||
str.append("<tr><td><h2>"+tr("Safety Switches")+"</h2></td></tr>");
|
||||
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\"><tr>");
|
||||
str.append("<td width=\"8%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
|
||||
str.append("<td width=\"37%\" align=\"center\"><b>"+tr("Value")+"</b></td>");
|
||||
str.append("<td width=\"10%\"> </td>");
|
||||
str.append("<td width=\"8%\" align=\"center\"><b>"+tr("Switch")+"</b></td>");
|
||||
str.append("<td width=\"37%\" align=\"center\"><b>"+tr("Value")+"</b></td>");
|
||||
str.append("</tr>");
|
||||
for(int i=0; i<GetEepromInterface()->getCapability(Outputs); i++)
|
||||
{
|
||||
if ((g_model1->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)||(g_model2->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)) {
|
||||
if ((g_model1->safetySw[i].swtch!=g_model2->safetySw[i].swtch)||(g_model1->safetySw[i].val!=g_model2->safetySw[i].val)) {
|
||||
color1="green";
|
||||
color2="red";
|
||||
} else {
|
||||
color1="grey";
|
||||
color2="grey";
|
||||
}
|
||||
str.append("<tr>");
|
||||
if (g_model1->safetySw[i].swtch.type) {
|
||||
str.append(doTC(g_model1->safetySw[i].swtch.toString(),color1));
|
||||
str.append(doTC(QString::number(g_model1->safetySw[i].val),color1));
|
||||
}
|
||||
else {
|
||||
str.append("<td> </td><td> </td>");
|
||||
}
|
||||
str.append(doTC(tr("CH")+QString("%1").arg(i+1),"",true));
|
||||
if (g_model2->safetySw[i].swtch.type) {
|
||||
str.append(doTC(g_model2->safetySw[i].swtch.toString(),color2));
|
||||
str.append(doTC(QString::number(g_model2->safetySw[i].val),color2));
|
||||
} else {
|
||||
str.append("<td> </td><td> </td>");
|
||||
}
|
||||
str.append("</tr>");
|
||||
sc++;
|
||||
}
|
||||
}
|
||||
str.append("</table></td></tr></table>");
|
||||
str.append("<br>");
|
||||
if (sc!=0)
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
void compareDialog::printFrSky()
|
||||
{
|
||||
QString color;
|
||||
@@ -1260,6 +1211,7 @@ void compareDialog::printFrSky()
|
||||
color=getColor1(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
|
||||
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd1->rssiAlarms[1].value,10)+"</td>");
|
||||
str.append("</table>");
|
||||
#if 0
|
||||
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
@@ -1300,13 +1252,13 @@ void compareDialog::printFrSky()
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor1(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source);
|
||||
str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd1->screens[0].body.bars[i].source)+"</font></td>");
|
||||
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
|
||||
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
|
||||
// TODO value1 = getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
|
||||
// TODO value2 = getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor1(value1,value2);
|
||||
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td>");
|
||||
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
|
||||
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
|
||||
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
|
||||
// TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor1(value1,value2);
|
||||
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value1)+"</td></tr>");
|
||||
@@ -1315,6 +1267,7 @@ void compareDialog::printFrSky()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
str.append("</td><td width=\"50%\">");
|
||||
str.append("<table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
|
||||
@@ -1377,7 +1330,7 @@ void compareDialog::printFrSky()
|
||||
color=getColor2(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value);
|
||||
str.append("<td align=\"center\"><font color="+color+">"+QString::number(fd2->rssiAlarms[1].value,10)+"</td>");
|
||||
str.append("</table></br>");
|
||||
|
||||
#if 0
|
||||
if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) {
|
||||
int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
|
||||
if (cols==0) cols=2;
|
||||
@@ -1418,13 +1371,13 @@ void compareDialog::printFrSky()
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor2(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source);
|
||||
str.append("<td align=\"Center\"><font color="+color+">"+getFrSkySrc(fd2->screens[0].body.bars[i].source)+"</font></td>");
|
||||
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
|
||||
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
|
||||
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1);
|
||||
// TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2);
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor2(value1,value2);
|
||||
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td>");
|
||||
value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
|
||||
value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
|
||||
// TODO value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1);
|
||||
// TODO value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2);
|
||||
if (fd1->screens[0].type==fd2->screens[0].type)
|
||||
color=getColor2(value1,value2);
|
||||
str.append("<td align=\"Right\"><font color="+color+">"+QString::number(value2)+"</font></td></tr>");
|
||||
@@ -1433,6 +1386,7 @@ void compareDialog::printFrSky()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
str.append("</td></tr></table>");
|
||||
te->append(str);
|
||||
}
|
||||
|
||||
@@ -26,11 +26,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/images/print.png</normaloff>:/images/print.png</iconset>
|
||||
<string>Compare Models</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "contributorsdialog.h"
|
||||
#include "ui_contributorsdialog.h"
|
||||
#include <QtGui>
|
||||
#define CLINESEP "=====================================================\n"
|
||||
#include "helpers.h"
|
||||
|
||||
contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnurl) :
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
@@ -9,45 +9,92 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
|
||||
{
|
||||
ui->setupUi(this);
|
||||
switch (contest) {
|
||||
case 0: {
|
||||
ui->textBrowser->insertPlainText(CLINESEP);
|
||||
ui->textBrowser->insertPlainText(tr("People who have contributed to this project")+"\n");
|
||||
ui->textBrowser->insertPlainText(CLINESEP);
|
||||
QFile file(":/contributors");
|
||||
if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
|
||||
ui->textBrowser->insertPlainText(file.readAll());
|
||||
case 0:
|
||||
{
|
||||
this->setWindowIcon(CompanionIcon("contributors.png"));
|
||||
QFile file(":/DONATIONS.txt");
|
||||
QString str;
|
||||
str.append("<html><head>");
|
||||
str.append("<style type=\"text/css\">\n");
|
||||
str.append(".mycss\n{\nfont-weight:normal;\ncolor:#000000;vertical-align: top;font-size:10px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
|
||||
str.append(".mycssb\n{\nfont-weight:bold;\ncolor:#C00000;vertical-align: top;font-size:10px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
|
||||
str.append(".myhead\n{\nfont-weight:bold;\ncolor:#000000;font-size:14px;text-align:left;font-family:arial, helvetica, sans-serif;\n}\n");
|
||||
str.append("</style>\n</head><body class=\"mycss\"><table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
|
||||
str.append("<tr><td class=\"myhead\">"+tr("People who have contributed to this project")+"</td></tr>");
|
||||
str.append("</table>");
|
||||
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
int columns=6;
|
||||
float cwidth=100.0/columns;
|
||||
while (!file.atEnd()) {
|
||||
str.append("<tr>");
|
||||
for (int i=0; i<columns; i++) {
|
||||
str.append(QString("<td width=\"%1%\" ").arg(cwidth));
|
||||
if (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
if (line.contains("monthly") || line.contains("mensual")) {
|
||||
str.append("class=\"mycssb\">");
|
||||
} else {
|
||||
str.append("class=\"mycss\">");
|
||||
}
|
||||
str.append(line.trimmed()+"</td>");
|
||||
} else {
|
||||
str.append("class=\"mycss\"> </td>");
|
||||
}
|
||||
}
|
||||
str.append("</tr>");
|
||||
}
|
||||
}
|
||||
ui->textBrowser->insertPlainText("\n");
|
||||
ui->textBrowser->insertPlainText(CLINESEP);
|
||||
ui->textBrowser->insertPlainText(tr("Coders")+"\n");
|
||||
ui->textBrowser->insertPlainText(CLINESEP);
|
||||
QFile file2(":/coders");
|
||||
str.append("</table>");
|
||||
QFile file2(":/CREDITS.txt");
|
||||
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
|
||||
str.append("<tr><td class=\"mycss\"> </td></tr>");
|
||||
str.append("<tr><td class=\"myhead\">"+tr("Coders")+"</td></tr>");
|
||||
str.append("</table>");
|
||||
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
|
||||
if(file2.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
|
||||
ui->textBrowser->insertPlainText(file2.readAll());
|
||||
}
|
||||
ui->textBrowser->insertPlainText("\n\n\n");
|
||||
ui->textBrowser->insertPlainText(tr(
|
||||
"Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and the fantastic eePe program \nwhich was the staring point for OpenTX Companion."));
|
||||
ui->textBrowser->insertPlainText("\n\n");
|
||||
ui->textBrowser->insertPlainText(tr("Thank you all !!!"));
|
||||
ui->textBrowser->setReadOnly(true);
|
||||
ui->textBrowser->verticalScrollBar()->setValue(0);
|
||||
this->setWindowTitle(tr("Contributors"));
|
||||
while (!file2.atEnd()) {
|
||||
str.append("<tr>");
|
||||
for (int i=0; i<3; i++) {
|
||||
str.append("<td width=\"33.33%\" class=\"mycss\">");
|
||||
if (!file2.atEnd()) {
|
||||
QByteArray line = file2.readLine();
|
||||
str.append(line.trimmed());
|
||||
} else {
|
||||
str.append(" ");
|
||||
}
|
||||
str.append("</td>");
|
||||
}
|
||||
str.append("</tr>");
|
||||
}
|
||||
}
|
||||
str.append("<tr><td class=\"mycss\"> </td></tr>");
|
||||
str.append("<tr><td colspan=3 class=\"mycss\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>");
|
||||
str.append("<tr><td colspan=3 class=\"mycss\">" + tr("Thank you all !!!") + "</td></tr>");
|
||||
str.append("</table>");
|
||||
str.append("</body></html>");
|
||||
ui->textEditor->setHtml(str);
|
||||
ui->textEditor->scroll(0, 0);
|
||||
setWindowTitle(tr("Contributors"));
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:{
|
||||
QFile file(":/releasenotes");
|
||||
case 1:
|
||||
{
|
||||
this->setWindowIcon(CompanionIcon("changelog.png"));
|
||||
QFile file(":/releasenotes.txt");
|
||||
if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
|
||||
ui->textBrowser->insertHtml(file.readAll());
|
||||
}
|
||||
ui->textBrowser->setReadOnly(true);
|
||||
ui->textBrowser->verticalScrollBar()->setValue(0);
|
||||
this->setWindowTitle(tr("Companion Release Notes"));
|
||||
ui->textEditor->setHtml(file.readAll());
|
||||
}
|
||||
ui->textEditor->scroll(0,0);
|
||||
setWindowTitle(tr("Companion Release Notes"));
|
||||
break;
|
||||
case 2:{
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if (!rnurl.isEmpty()) {
|
||||
this->setWindowIcon(CompanionIcon("changelog.png"));
|
||||
this->setWindowTitle(tr("OpenTX Release Notes"));
|
||||
manager = new QNetworkAccessManager(this);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
||||
@@ -55,7 +102,8 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||
manager->get(request);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QTimer::singleShot(0, this, SLOT(forceClose()));
|
||||
}
|
||||
break;
|
||||
@@ -65,7 +113,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
|
||||
|
||||
void contributorsDialog::showEvent ( QShowEvent * )
|
||||
{
|
||||
ui->textBrowser->verticalScrollBar()->setValue(0);
|
||||
ui->textEditor->scroll(0, 0);
|
||||
}
|
||||
|
||||
contributorsDialog::~contributorsDialog()
|
||||
@@ -75,9 +123,10 @@ contributorsDialog::~contributorsDialog()
|
||||
|
||||
void contributorsDialog::replyFinished(QNetworkReply * reply)
|
||||
{
|
||||
ui->textBrowser->insertHtml(reply->readAll());
|
||||
ui->textEditor->setHtml(reply->readAll());
|
||||
}
|
||||
|
||||
void contributorsDialog::forceClose() {
|
||||
void contributorsDialog::forceClose()
|
||||
{
|
||||
accept();;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>926</width>
|
||||
<height>333</height>
|
||||
<width>788</width>
|
||||
<height>528</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
<widget class="QTextEdit" name="textEditor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -2,186 +2,268 @@
|
||||
#include "ui_customizesplashdialog.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "burndialog.h"
|
||||
#include "splashlibrary.h"
|
||||
#include "flashinterface.h"
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->HowToLabel->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
//*** Side Class ***
|
||||
|
||||
Side::Side(){
|
||||
imageLabel = 0;
|
||||
fileNameEdit = 0;
|
||||
saveButton = 0;
|
||||
loadFwButton=0;
|
||||
loadPictButton = 0;
|
||||
loadProfileButton = 0;
|
||||
saveToFileName = new QString("");
|
||||
source = new Source(UNDEFINED);
|
||||
format = new LCDFormat(LCDTARANIS);
|
||||
}
|
||||
|
||||
customizeSplashDialog::~customizeSplashDialog() {
|
||||
void Side::markSourceButton()
|
||||
{
|
||||
loadFwButton->setChecked(*source == FW ? true : false );
|
||||
loadPictButton->setChecked(*source == PICT ? true : false );
|
||||
loadProfileButton->setChecked(*source == PROFILE ? true : false );
|
||||
}
|
||||
|
||||
void Side::copyImage( Side side )
|
||||
{
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
imageLabel->setPixmap(*side.imageLabel->pixmap());
|
||||
}
|
||||
|
||||
bool Side::displayImage( QString fileName, Source pictSource )
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
|
||||
// Determine which picture format to use
|
||||
if (pictSource == FW ){
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.hasSplash())
|
||||
return false;
|
||||
else
|
||||
image = flash.getSplash();
|
||||
*format = (flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X);
|
||||
}
|
||||
else {
|
||||
image.load(fileName);
|
||||
if (pictSource== PICT)
|
||||
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
|
||||
else if (pictSource == PROFILE)
|
||||
*format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X;
|
||||
}
|
||||
if (image.isNull()) {
|
||||
return false;
|
||||
}
|
||||
// Load image
|
||||
if (*format==LCDTARANIS) {
|
||||
imageLabel->setPixmap( makePixMap( image, "taranis" ));
|
||||
imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
|
||||
}
|
||||
else {
|
||||
imageLabel->setPixmap( makePixMap( image, "9x" ));
|
||||
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
|
||||
}
|
||||
|
||||
switch (pictSource){
|
||||
case FW:
|
||||
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=FW;
|
||||
break;
|
||||
case PICT:
|
||||
fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=PICT;
|
||||
break;
|
||||
case PROFILE:
|
||||
fileNameEdit->setText(QObject::tr("Profile image"));
|
||||
*saveToFileName = fileName;
|
||||
*source=PROFILE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
saveButton->setEnabled(true);
|
||||
libraryButton->setEnabled(true);
|
||||
invertButton->setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Side::refreshImage()
|
||||
{
|
||||
return displayImage( *saveToFileName, *source );
|
||||
}
|
||||
|
||||
bool Side::saveImage()
|
||||
{
|
||||
if (*source == FW )
|
||||
{
|
||||
FlashInterface flash(*saveToFileName);
|
||||
if (!flash.hasSplash()) {
|
||||
return false;
|
||||
}
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
if (flash.setSplash(image) && (flash.saveFlash(*saveToFileName) > 0)) {
|
||||
g.flashDir( QFileInfo(*saveToFileName).dir().absolutePath() );
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PICT) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (image.save(*saveToFileName)) {
|
||||
g.imagesDir( QFileInfo(*saveToFileName).dir().absolutePath() );
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PROFILE) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (!image.save(*saveToFileName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//*** customizeSplashDialog Class ***
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("paint.png"));
|
||||
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
|
||||
left.imageLabel = ui->leftImageLabel;
|
||||
right.imageLabel = ui->rightImageLabel;
|
||||
left.fileNameEdit = ui->leftFileNameEdit;
|
||||
right.fileNameEdit = ui->rightFileNameEdit;
|
||||
left.saveButton = ui->leftSaveButton;
|
||||
right.saveButton = ui->rightSaveButton;
|
||||
left.libraryButton = ui->leftLibraryButton;
|
||||
right.libraryButton = ui->rightLibraryButton;
|
||||
left.invertButton = ui->leftInvertButton;
|
||||
right.invertButton = ui->rightInvertButton;
|
||||
|
||||
left.loadFwButton = ui->leftLoadFwButton;
|
||||
right.loadFwButton = ui->rightLoadFwButton;
|
||||
left.loadPictButton = ui->leftLoadPictButton;
|
||||
right.loadPictButton = ui->rightLoadPictButton;
|
||||
left.loadProfileButton = ui->leftLoadProfileButton;
|
||||
right.loadProfileButton = ui->rightLoadProfileButton;
|
||||
|
||||
loadProfile(left);
|
||||
left.markSourceButton();
|
||||
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
customizeSplashDialog::~customizeSplashDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_FlashLoadButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->SaveFlashButton->setDisabled(true);
|
||||
ui->SaveImageButton->setDisabled(true);
|
||||
ui->ImageFileName->clear();
|
||||
ui->imageLabel->clear();
|
||||
ui->HowToLabel->clear();
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)");
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
QFile file(fileName);
|
||||
if (!file.exists()) {
|
||||
ui->FWFileName->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
return;
|
||||
}
|
||||
if (fileName.isEmpty()) {
|
||||
ui->FWFileName->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->FWFileName->setText(fileName);
|
||||
FlashInterface flash(fileName);
|
||||
if (flash.hasSplash()) {
|
||||
ui->HowToLabel->append("<center>" + tr("Select an image to customize your splash <br />or save actual firmware splash") + "</center>");
|
||||
ui->ImageLoadButton->setEnabled(true);
|
||||
ui->libraryButton->setEnabled(true);
|
||||
ui->SaveImageButton->setEnabled(true);
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
|
||||
} else {
|
||||
QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file"));
|
||||
return;
|
||||
}
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
void customizeSplashDialog::on_copyRightToLeftButton_clicked() {
|
||||
left.copyImage(right);
|
||||
}
|
||||
void customizeSplashDialog::on_copyLeftToRightButton_clicked() {
|
||||
right.copyImage(left);
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_ImageLoadButton_clicked() {
|
||||
|
||||
void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);}
|
||||
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);}
|
||||
void customizeSplashDialog::loadFirmware(Side side)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, FW ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Can not load embedded image from firmware file %1.").arg(fileName));
|
||||
else
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);}
|
||||
void customizeSplashDialog::on_rightLoadPictButton_clicked() {loadPicture(right);}
|
||||
void customizeSplashDialog::loadPicture(Side side)
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
ui->HowToLabel->clear();
|
||||
ui->ImageFileName->setText(fileName);
|
||||
if (ui->imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->SaveFlashButton->setEnabled(true);
|
||||
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
|
||||
if (!side.displayImage( fileName, PICT ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName));
|
||||
else
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_libraryButton_clicked() {
|
||||
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
|
||||
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
|
||||
void customizeSplashDialog::loadProfile(Side side)
|
||||
{
|
||||
QString fileName=g.profile[g.id()].splashFile();
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, PROFILE ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicked(right);}
|
||||
void customizeSplashDialog::libraryButton_clicked( Side side )
|
||||
{
|
||||
QString fileName;
|
||||
|
||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
ui->HowToLabel->clear();
|
||||
ui->ImageFileName->setText(fileName);
|
||||
if (ui->imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
|
||||
} else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->SaveFlashButton->setEnabled(true);
|
||||
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
|
||||
if (!side.displayImage( fileName, UNDEFINED ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the library image %1.").arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_SaveFlashButton_clicked()
|
||||
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
|
||||
void customizeSplashDialog::saveButton_clicked( Side side )
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
ui->HowToLabel->clear();
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER, 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FlashInterface flash(ui->FWFileName->text());
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Error reading file %1").arg(fileName));
|
||||
return;
|
||||
}
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
flash.setSplash(image);
|
||||
if (flash.saveFlash(fileName) > 0) {
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(0,255.0);");
|
||||
ui->HowToLabel->append("<center>" + tr("Firmware correctly saved.") + "</center>");
|
||||
} else {
|
||||
ui->HowToLabel->setStyleSheet("background:rgb(255.0.0);");
|
||||
ui->HowToLabel->append("<center>" + tr("Firmware not saved.") + "</center>");
|
||||
if (side.saveImage()){
|
||||
QMessageBox::information(this, tr("File Saved"), tr("The image was saved to the file %1").arg(*side.saveToFileName));
|
||||
if ( !side.refreshImage()){
|
||||
QMessageBox::critical(this, tr("Image Refresh Error"), tr("Failed to refresh image from file %1").arg(*side.saveToFileName));
|
||||
}
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, tr("File Save Error"), tr("Failed to write image to %1").arg(*side.saveToFileName));
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_InvertColorButton_clicked()
|
||||
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightInvertButton_clicked(){invertButton_clicked(right);}
|
||||
void customizeSplashDialog::invertButton_clicked(Side side)
|
||||
{
|
||||
QImage image = ui->imageLabel->pixmap()->toImage();
|
||||
QImage image = side.imageLabel->pixmap()->toImage();
|
||||
image.invertPixels();
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_SaveImageButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
image.save(fileName, "PNG");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,24 +10,78 @@ namespace Ui
|
||||
class customizeSplashDialog;
|
||||
}
|
||||
|
||||
const int WIDTH_TARANIS = 212;
|
||||
const int HEIGHT_TARANIS = 64;
|
||||
const int WIDTH_9X = 128;
|
||||
const int HEIGHT_9X = 64;
|
||||
|
||||
enum Source {FW, PICT, PROFILE, UNDEFINED};
|
||||
enum LCDFormat {LCD9X, LCDTARANIS};
|
||||
|
||||
class Side
|
||||
{
|
||||
public:
|
||||
Side();
|
||||
void markSourceButton();
|
||||
void copyImage( Side );
|
||||
bool displayImage( QString fileName, Source source );
|
||||
bool saveImage();
|
||||
bool refreshImage();
|
||||
|
||||
QLabel *imageLabel;
|
||||
QLineEdit *fileNameEdit;
|
||||
QPushButton *saveButton;
|
||||
QPushButton *invertButton;
|
||||
QToolButton *libraryButton;
|
||||
QPushButton *loadFwButton;
|
||||
QPushButton *loadPictButton;
|
||||
QPushButton *loadProfileButton;
|
||||
|
||||
QString *saveToFileName;
|
||||
|
||||
private:
|
||||
Source *source;
|
||||
LCDFormat *format;
|
||||
};
|
||||
|
||||
class customizeSplashDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Side left;
|
||||
Side right;
|
||||
|
||||
public:
|
||||
explicit customizeSplashDialog(QWidget *parent = 0);
|
||||
~customizeSplashDialog();
|
||||
|
||||
private slots:
|
||||
void on_FlashLoadButton_clicked();
|
||||
void on_ImageLoadButton_clicked();
|
||||
void on_libraryButton_clicked();
|
||||
void on_SaveFlashButton_clicked();
|
||||
void on_InvertColorButton_clicked();
|
||||
void on_SaveImageButton_clicked();
|
||||
void on_leftLoadFwButton_clicked();
|
||||
void on_leftLoadPictButton_clicked();
|
||||
void on_leftLoadProfileButton_clicked();
|
||||
void on_leftLibraryButton_clicked();
|
||||
void on_leftSaveButton_clicked();
|
||||
void on_leftInvertButton_clicked();
|
||||
|
||||
void on_rightLoadFwButton_clicked();
|
||||
void on_rightLoadPictButton_clicked();
|
||||
void on_rightLoadProfileButton_clicked();
|
||||
void on_rightLibraryButton_clicked();
|
||||
void on_rightSaveButton_clicked();
|
||||
void on_rightInvertButton_clicked();
|
||||
|
||||
void on_copyRightToLeftButton_clicked();
|
||||
void on_copyLeftToRightButton_clicked();
|
||||
|
||||
private:
|
||||
void loadFirmware( Side );
|
||||
void loadPicture( Side );
|
||||
void loadProfile( Side );
|
||||
void libraryButton_clicked( Side );
|
||||
void saveButton_clicked( Side );
|
||||
void invertButton_clicked( Side );
|
||||
|
||||
Ui::customizeSplashDialog *ui;
|
||||
enum sideEnum { LEFT, RIGHT };
|
||||
};
|
||||
|
||||
#endif // CUSTOMIZESPLASHDIALOG_H
|
||||
|
||||
@@ -2,88 +2,513 @@
|
||||
<ui version="4.0">
|
||||
<class>customizeSplashDialog</class>
|
||||
<widget class="QDialog" name="customizeSplashDialog">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>366</width>
|
||||
<height>303</height>
|
||||
<width>1087</width>
|
||||
<height>285</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Customize Splash</string>
|
||||
<string>Transmitter Splash Screen Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>:/images/c_home.png</normaloff>:/images/c_home.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="companion.qrc">:/images/customize.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveImageButton">
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leftFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="leftImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Image</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="leftLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadFwButton">
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyRightToLeftButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::LeftArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyLeftToRightButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::RightArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="Line" name="line_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rightFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rightImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -101,168 +526,134 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="InvertColorButton">
|
||||
<widget class="QToolButton" name="rightLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert Color</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadFwButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="HowToLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:rgb(255, 255, 0);</string>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="FWFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="FlashLoadButton">
|
||||
<property name="text">
|
||||
<string>Load Firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="ImageFileName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="ImageLoadButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="libraryButton">
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="SaveFlashButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save Firmware</string>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>leftFileNameEdit</tabstop>
|
||||
<tabstop>leftInvertButton</tabstop>
|
||||
<tabstop>leftLibraryButton</tabstop>
|
||||
<tabstop>leftLoadProfileButton</tabstop>
|
||||
<tabstop>leftLoadFwButton</tabstop>
|
||||
<tabstop>leftLoadPictButton</tabstop>
|
||||
<tabstop>leftSaveButton</tabstop>
|
||||
<tabstop>copyLeftToRightButton</tabstop>
|
||||
<tabstop>copyRightToLeftButton</tabstop>
|
||||
<tabstop>rightFileNameEdit</tabstop>
|
||||
<tabstop>rightInvertButton</tabstop>
|
||||
<tabstop>rightLibraryButton</tabstop>
|
||||
<tabstop>rightLoadProfileButton</tabstop>
|
||||
<tabstop>rightLoadFwButton</tabstop>
|
||||
<tabstop>rightLoadPictButton</tabstop>
|
||||
<tabstop>rightSaveButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
#include "ui_downloaddialog.h"
|
||||
#include <QMessageBox>
|
||||
#include <QtGui>
|
||||
#include "helpers.h"
|
||||
|
||||
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::downloadDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
ui->progressBar->setValue(1);
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(0);
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>Downloading: </string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
|
||||
@@ -93,6 +93,17 @@ class DataField {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
class ProxyField: public DataField {
|
||||
public:
|
||||
ProxyField():
|
||||
DataField("Proxy")
|
||||
{
|
||||
}
|
||||
|
||||
virtual DataField * getField() = 0;
|
||||
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class UnsignedField: public DataField {
|
||||
public:
|
||||
@@ -273,9 +284,10 @@ class SpareBitsField: public UnsignedField<N> {
|
||||
template<int N>
|
||||
class CharField: public DataField {
|
||||
public:
|
||||
CharField(char *field):
|
||||
CharField(char *field, bool truncate=true):
|
||||
DataField("Char"),
|
||||
field(field)
|
||||
field(field),
|
||||
truncate(truncate)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -283,7 +295,7 @@ class CharField: public DataField {
|
||||
{
|
||||
output.resize(N*8);
|
||||
int b = 0;
|
||||
int len = strlen(field);
|
||||
int len = truncate ? strlen(field) : N;
|
||||
for (int i=0; i<N; i++) {
|
||||
int idx = (i>=len ? 0 : field[i]);
|
||||
for (int j=0; j<8; j++, b++) {
|
||||
@@ -313,6 +325,7 @@ class CharField: public DataField {
|
||||
|
||||
protected:
|
||||
char * field;
|
||||
bool truncate;
|
||||
};
|
||||
|
||||
int8_t char2idx(char c);
|
||||
@@ -637,12 +650,14 @@ class ConversionField: public TransformedField {
|
||||
if (!error.isEmpty())
|
||||
EEPROMWarnings += error + "\n";
|
||||
}
|
||||
else if (shift) {
|
||||
|
||||
if (shift) {
|
||||
if (val < min) _field = min + shift;
|
||||
else if (val > max) _field = max + shift;
|
||||
else _field = val + shift;
|
||||
}
|
||||
else {
|
||||
|
||||
if (exportFunc) {
|
||||
_field = exportFunc(val);
|
||||
}
|
||||
}
|
||||
@@ -653,10 +668,10 @@ class ConversionField: public TransformedField {
|
||||
if (table->importValue(_field, field))
|
||||
return;
|
||||
}
|
||||
else if (shift) {
|
||||
field = _field - shift;
|
||||
}
|
||||
else {
|
||||
|
||||
field = _field - shift;
|
||||
|
||||
if (importFunc) {
|
||||
field = importFunc(_field);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ enum BoardEnum {
|
||||
BOARD_TARANIS_REV4a
|
||||
};
|
||||
|
||||
#define IS_STOCK(board) (board==BOARD_STOCK || board==BOARD_M128)
|
||||
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
|
||||
#define IS_STOCK(board) (board==BOARD_STOCK)
|
||||
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
|
||||
#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
|
||||
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
|
||||
@@ -65,15 +66,15 @@ const uint8_t modn12x3[4][4]= {
|
||||
#define C9X_MAX_MODELS 60
|
||||
#define C9X_MAX_PHASES 9
|
||||
#define C9X_MAX_MIXERS 64
|
||||
#define C9X_MAX_INPUTS 32
|
||||
#define C9X_MAX_EXPOS 64
|
||||
#define C9X_MAX_CURVES 32
|
||||
#define C9X_MAX_POINTS 17
|
||||
#define C9X_MAX_GVARS 9
|
||||
#define C9X_MAX_ENCODERS 2
|
||||
#define NUM_SAFETY_CHNOUT 16
|
||||
#define C9X_NUM_CHNOUT 32 // number of real output channels
|
||||
#define C9X_NUM_CSW 32 // number of custom switches
|
||||
#define C9X_MAX_CUSTOM_FUNCTIONS 32 // number of functions assigned to switches
|
||||
#define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches
|
||||
#define C9X_NUM_MODULES 2
|
||||
|
||||
#define STK_RUD 1
|
||||
@@ -106,10 +107,11 @@ const uint8_t modn12x3[4][4]= {
|
||||
#define DSW_SG2 20
|
||||
|
||||
const uint8_t chout_ar[] = { //First number is 0..23 -> template setup, Second is relevant channel out
|
||||
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
|
||||
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
|
||||
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
|
||||
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1 }; // TODO delete it?
|
||||
1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2,
|
||||
2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1,
|
||||
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
|
||||
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
|
||||
}; // TODO delete it?
|
||||
|
||||
// Beep center bits
|
||||
#define BC_BIT_RUD (0x01)
|
||||
@@ -145,44 +147,6 @@ enum EnumKeys {
|
||||
#endif
|
||||
};
|
||||
|
||||
enum CSFunction {
|
||||
CS_FN_OFF,
|
||||
CS_FN_VPOS,
|
||||
CS_FN_VNEG,
|
||||
CS_FN_APOS,
|
||||
CS_FN_ANEG,
|
||||
CS_FN_AND,
|
||||
CS_FN_OR,
|
||||
CS_FN_XOR,
|
||||
CS_FN_EQUAL,
|
||||
CS_FN_NEQUAL,
|
||||
CS_FN_GREATER,
|
||||
CS_FN_LESS,
|
||||
CS_FN_EGREATER,
|
||||
CS_FN_ELESS,
|
||||
CS_FN_DPOS,
|
||||
CS_FN_DAPOS,
|
||||
CS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
CS_FN_TIM,
|
||||
CS_FN_MAXF
|
||||
};
|
||||
|
||||
enum CSFunctionFamily {
|
||||
CS_FAMILY_VOFS,
|
||||
CS_FAMILY_VBOOL,
|
||||
CS_FAMILY_VCOMP,
|
||||
CS_FAMILY_TIMERS
|
||||
};
|
||||
|
||||
inline CSFunctionFamily getCSFunctionFamily(int fn)
|
||||
{
|
||||
if (fn==CS_FN_TIM) {
|
||||
return (CS_FAMILY_TIMERS);
|
||||
} else {
|
||||
return ((fn<CS_FN_AND || fn>CS_FN_ELESS) ? CS_FAMILY_VOFS : (fn<CS_FN_EQUAL ? CS_FAMILY_VBOOL : CS_FAMILY_VCOMP));
|
||||
}
|
||||
}
|
||||
|
||||
#define CHAR_FOR_NAMES " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-."
|
||||
#define CHAR_FOR_NAMES_REGEX "[ A-Za-z0-9_.-,]*"
|
||||
|
||||
@@ -196,10 +160,8 @@ enum HeliSwashTypes {
|
||||
|
||||
#define NUM_STICKS 4
|
||||
#define BOARD_9X_NUM_POTS 3
|
||||
#define BOARD_X9D_NUM_POTS 4
|
||||
#define C9X_NUM_POTS 4
|
||||
#define C9X_NUM_POTS 5
|
||||
#define NUM_CAL_PPM 4
|
||||
#define NUM_PPM 8
|
||||
#define NUM_CYC 3
|
||||
#define C9X_NUM_SWITCHES 10
|
||||
#define C9X_NUM_KEYS 6
|
||||
@@ -212,10 +174,14 @@ enum TelemetrySource {
|
||||
TELEMETRY_SOURCE_TX_BATT,
|
||||
TELEMETRY_SOURCE_TIMER1,
|
||||
TELEMETRY_SOURCE_TIMER2,
|
||||
TELEMETRY_SOURCE_SWR,
|
||||
TELEMETRY_SOURCE_RSSI_TX,
|
||||
TELEMETRY_SOURCE_RSSI_RX,
|
||||
TELEMETRY_SOURCE_RX_BATT,
|
||||
TELEMETRY_SOURCE_A1,
|
||||
TELEMETRY_SOURCE_A2,
|
||||
TELEMETRY_SOURCE_A3,
|
||||
TELEMETRY_SOURCE_A4,
|
||||
TELEMETRY_SOURCE_ALT,
|
||||
TELEMETRY_SOURCE_RPM,
|
||||
TELEMETRY_SOURCE_FUEL,
|
||||
@@ -235,8 +201,12 @@ enum TelemetrySource {
|
||||
TELEMETRY_SOURCE_ACCZ,
|
||||
TELEMETRY_SOURCE_HDG,
|
||||
TELEMETRY_SOURCE_VERTICAL_SPEED,
|
||||
TELEMETRY_SOURCE_ASPD,
|
||||
TELEMETRY_SOURCE_DTE,
|
||||
TELEMETRY_SOURCE_A1_MIN,
|
||||
TELEMETRY_SOURCE_A2_MIN,
|
||||
TELEMETRY_SOURCE_A3_MIN,
|
||||
TELEMETRY_SOURCE_A4_MIN,
|
||||
TELEMETRY_SOURCE_ALT_MIN,
|
||||
TELEMETRY_SOURCE_ALT_MAX,
|
||||
TELEMETRY_SOURCE_RPM_MAX,
|
||||
@@ -244,14 +214,16 @@ enum TelemetrySource {
|
||||
TELEMETRY_SOURCE_T2_MAX,
|
||||
TELEMETRY_SOURCE_SPEED_MAX,
|
||||
TELEMETRY_SOURCE_DIST_MAX,
|
||||
TELEMETRY_SOURCE_CURRENT_MAX,
|
||||
TELEMETRY_SOURCE_CELL_MIN,
|
||||
TELEMETRY_SOURCE_CELLS_MIN,
|
||||
TELEMETRY_SOURCE_VFAS_MIN,
|
||||
TELEMETRY_SOURCE_POWER_MAX,
|
||||
TELEMETRY_SOURCE_ACC,
|
||||
TELEMETRY_SOURCE_GPS_TIME,
|
||||
TELEMETRY_SOURCES_STATUS_COUNT,
|
||||
TELEMETRY_SOURCES_DISPLAY_COUNT = TELEMETRY_SOURCES_STATUS_COUNT-2,
|
||||
|
||||
TELEMETRY_SOURCES_COUNT = TELEMETRY_SOURCE_VERTICAL_SPEED,
|
||||
TELEMETRY_SOURCES_STATUS_COUNT = TELEMETRY_SOURCE_GPS_TIME+1,
|
||||
TELEMETRY_SOURCES_DISPLAY_COUNT = TELEMETRY_SOURCE_POWER_MAX+1,
|
||||
TELEMETRY_SOURCES_COUNT = TELEMETRY_SOURCE_DTE+1,
|
||||
TELEMETRY_SOURCE_RESERVE = -1
|
||||
};
|
||||
|
||||
#define TM_HASTELEMETRY 0x01
|
||||
@@ -281,23 +253,50 @@ class ModelData;
|
||||
QString AnalogString(int index);
|
||||
QString RotaryEncoderString(int index);
|
||||
|
||||
class RawSourceRange
|
||||
{
|
||||
public:
|
||||
RawSourceRange():
|
||||
decimals(0),
|
||||
min(0.0),
|
||||
max(0.0),
|
||||
step(1.0),
|
||||
offset(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
float getValue(int value) {
|
||||
return min + float(value) * step;
|
||||
}
|
||||
|
||||
int decimals;
|
||||
double min;
|
||||
double max;
|
||||
double step;
|
||||
double offset;
|
||||
|
||||
};
|
||||
|
||||
class RawSource {
|
||||
public:
|
||||
RawSource():
|
||||
type(SOURCE_TYPE_NONE),
|
||||
index(0)
|
||||
index(0),
|
||||
model(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
RawSource(int value):
|
||||
RawSource(int value, const ModelData * model=NULL):
|
||||
type(RawSourceType(abs(value)/65536)),
|
||||
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
|
||||
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536)),
|
||||
model(model)
|
||||
{
|
||||
}
|
||||
|
||||
RawSource(RawSourceType type, int index=0):
|
||||
RawSource(RawSourceType type, int index=0, const ModelData * model=NULL):
|
||||
type(type),
|
||||
index(index)
|
||||
index(index),
|
||||
model(model)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -308,32 +307,31 @@ class RawSource {
|
||||
|
||||
QString toString();
|
||||
|
||||
int getDecimals(const ModelData & Model);
|
||||
double getMin(const ModelData & Model);
|
||||
double getMax(const ModelData & Model);
|
||||
double getStep(const ModelData & Model);
|
||||
double getOffset(const ModelData & Model);
|
||||
int getRawOffset(const ModelData & Model);
|
||||
RawSourceRange getRange(bool singleprec=false);
|
||||
|
||||
bool operator== ( const RawSource& other) {
|
||||
bool operator == ( const RawSource & other) {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
}
|
||||
|
||||
bool operator != ( const RawSource & other) {
|
||||
return (this->type != other.type) || (this->index != other.index);
|
||||
}
|
||||
|
||||
RawSourceType type;
|
||||
int index;
|
||||
const ModelData * model;
|
||||
};
|
||||
|
||||
enum RawSwitchType {
|
||||
SWITCH_TYPE_NONE,
|
||||
SWITCH_TYPE_SWITCH,
|
||||
SWITCH_TYPE_VIRTUAL,
|
||||
SWITCH_TYPE_MOMENT_SWITCH,
|
||||
SWITCH_TYPE_MOMENT_VIRTUAL,
|
||||
SWITCH_TYPE_MULTIPOS_POT,
|
||||
SWITCH_TYPE_TRIM,
|
||||
SWITCH_TYPE_ROTARY_ENCODER,
|
||||
SWITCH_TYPE_ON,
|
||||
SWITCH_TYPE_OFF,
|
||||
SWITCH_TYPE_ONM,
|
||||
SWITCH_TYPE_TRN,
|
||||
SWITCH_TYPE_REA,
|
||||
SWITCH_TYPE_TIMER_MODE
|
||||
};
|
||||
|
||||
class RawSwitch {
|
||||
@@ -403,6 +401,9 @@ enum BeeperMode {
|
||||
class GeneralSettings {
|
||||
public:
|
||||
GeneralSettings();
|
||||
|
||||
RawSource getDefaultSource(unsigned int channel);
|
||||
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
int calibMid[NUM_STICKS+C9X_NUM_POTS];
|
||||
@@ -440,7 +441,7 @@ class GeneralSettings {
|
||||
unsigned int backlightDelay;
|
||||
bool blightinv;
|
||||
bool stickScroll;
|
||||
unsigned int templateSetup; //RETA order according to chout_ar array // TODO enum
|
||||
unsigned int templateSetup; //RETA order according to chout_ar array
|
||||
int PPM_Multiplier;
|
||||
int hapticLength;
|
||||
unsigned int reNavigation;
|
||||
@@ -470,9 +471,14 @@ class GeneralSettings {
|
||||
int beepVolume;
|
||||
int wavVolume;
|
||||
int varioVolume;
|
||||
int varioPitch;
|
||||
int varioRange;
|
||||
int varioRepeat;
|
||||
int backgroundVolume;
|
||||
unsigned int mavbaud;
|
||||
unsigned int switchUnlockStates;
|
||||
unsigned int hw_uartMode;
|
||||
unsigned int potsType[8];
|
||||
};
|
||||
|
||||
class CurveReference {
|
||||
@@ -500,12 +506,19 @@ class CurveReference {
|
||||
QString toString();
|
||||
};
|
||||
|
||||
enum InputMode {
|
||||
INPUT_MODE_NONE,
|
||||
INPUT_MODE_POS,
|
||||
INPUT_MODE_NEG,
|
||||
INPUT_MODE_BOTH
|
||||
};
|
||||
|
||||
class ExpoData {
|
||||
public:
|
||||
ExpoData() { clear(); }
|
||||
RawSource srcRaw;
|
||||
unsigned int scale;
|
||||
unsigned int mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
unsigned int mode;
|
||||
unsigned int chn;
|
||||
RawSwitch swtch;
|
||||
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
|
||||
@@ -552,7 +565,7 @@ class LimitData {
|
||||
bool symetrical;
|
||||
char name[6+1];
|
||||
CurveReference curve;
|
||||
void clear() { memset(this, 0, sizeof(LimitData)); min = -100; max = +100; }
|
||||
void clear() { memset(this, 0, sizeof(LimitData)); min = -1000; max = +1000; }
|
||||
};
|
||||
|
||||
enum MltpxValue {
|
||||
@@ -585,30 +598,64 @@ class MixData {
|
||||
void clear() { memset(this, 0, sizeof(MixData)); }
|
||||
};
|
||||
|
||||
class CustomSwData { // Custom Switches data
|
||||
public:
|
||||
CustomSwData() { clear(); }
|
||||
int val1; //input
|
||||
int val2; //offset
|
||||
unsigned int func;
|
||||
unsigned int delay;
|
||||
unsigned int duration;
|
||||
unsigned int andsw;
|
||||
void clear() { memset(this, 0, sizeof(CustomSwData)); }
|
||||
enum CSFunction {
|
||||
LS_FN_OFF,
|
||||
LS_FN_VPOS,
|
||||
LS_FN_VNEG,
|
||||
LS_FN_APOS,
|
||||
LS_FN_ANEG,
|
||||
LS_FN_AND,
|
||||
LS_FN_OR,
|
||||
LS_FN_XOR,
|
||||
LS_FN_EQUAL,
|
||||
LS_FN_NEQUAL,
|
||||
LS_FN_GREATER,
|
||||
LS_FN_LESS,
|
||||
LS_FN_EGREATER,
|
||||
LS_FN_ELESS,
|
||||
LS_FN_DPOS,
|
||||
LS_FN_DAPOS,
|
||||
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
|
||||
LS_FN_VALMOSTEQUAL,
|
||||
LS_FN_TIMER,
|
||||
LS_FN_STICKY,
|
||||
LS_FN_STAY,
|
||||
// later ... LS_FN_RANGE,
|
||||
LS_FN_MAX
|
||||
};
|
||||
|
||||
class SafetySwData { // Custom Switches data
|
||||
public:
|
||||
SafetySwData() { clear(); }
|
||||
RawSwitch swtch;
|
||||
int val;
|
||||
enum CSFunctionFamily {
|
||||
LS_FAMILY_VOFS,
|
||||
LS_FAMILY_VBOOL,
|
||||
LS_FAMILY_VCOMP,
|
||||
LS_FAMILY_TIMER,
|
||||
LS_FAMILY_STICKY,
|
||||
LS_FAMILY_STAY,
|
||||
};
|
||||
|
||||
void clear() { memset(this, 0, sizeof(SafetySwData)); }
|
||||
class LogicalSwitchData { // Custom Switches data
|
||||
public:
|
||||
LogicalSwitchData(unsigned int func=0)
|
||||
{
|
||||
clear();
|
||||
this->func = func;
|
||||
}
|
||||
unsigned int func;
|
||||
int val1;
|
||||
int val2;
|
||||
int val3;
|
||||
unsigned int delay;
|
||||
unsigned int duration;
|
||||
int andsw;
|
||||
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
|
||||
CSFunctionFamily getFunctionFamily();
|
||||
QString funcToString();
|
||||
QString toString(const ModelData & model);
|
||||
};
|
||||
|
||||
enum AssignFunc {
|
||||
FuncSafetyCh1 = 0,
|
||||
FuncSafetyCh16 = FuncSafetyCh1+15,
|
||||
FuncSafetyCh32 = FuncSafetyCh1+C9X_NUM_CHNOUT-1,
|
||||
FuncTrainer,
|
||||
FuncTrainerRUD,
|
||||
FuncTrainerELE,
|
||||
@@ -618,6 +665,8 @@ enum AssignFunc {
|
||||
FuncPlaySound,
|
||||
FuncPlayHaptic,
|
||||
FuncReset,
|
||||
FuncSetTimer1,
|
||||
FuncSetTimer2,
|
||||
FuncVario,
|
||||
FuncPlayPrompt,
|
||||
FuncPlayBoth,
|
||||
@@ -629,26 +678,32 @@ enum AssignFunc {
|
||||
FuncBackgroundMusicPause,
|
||||
FuncAdjustGV1,
|
||||
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
|
||||
FuncCount
|
||||
FuncCount,
|
||||
FuncReserve = -1
|
||||
};
|
||||
|
||||
class FuncSwData { // Function Switches data
|
||||
public:
|
||||
FuncSwData() { clear(); }
|
||||
FuncSwData(AssignFunc func=FuncSafetyCh1) { clear(); this->func = func; }
|
||||
RawSwitch swtch;
|
||||
AssignFunc func;
|
||||
int param;
|
||||
char paramarm[10];
|
||||
unsigned int enabled; // TODO perhaps not any more the right name
|
||||
unsigned int adjustMode;
|
||||
unsigned int repeatParam;
|
||||
int repeatParam;
|
||||
void clear() { memset(this, 0, sizeof(FuncSwData)); }
|
||||
QString funcToString();
|
||||
QString paramToString();
|
||||
QString repeatToString();
|
||||
QStringList toStringList();
|
||||
};
|
||||
|
||||
class PhaseData {
|
||||
public:
|
||||
PhaseData() { clear(); }
|
||||
int trimRef[NUM_STICKS]; //
|
||||
int trimMode[NUM_STICKS];
|
||||
int trimRef[NUM_STICKS];
|
||||
int trim[NUM_STICKS];
|
||||
RawSwitch swtch;
|
||||
char name[10+1];
|
||||
@@ -656,7 +711,7 @@ class PhaseData {
|
||||
unsigned int fadeOut;
|
||||
int rotaryEncoders[2];
|
||||
int gvars[C9X_MAX_GVARS];
|
||||
void clear() { memset(this, 0, sizeof(PhaseData)); for (int i=0; i<NUM_STICKS; i++) trimRef[i] = -1; }
|
||||
void clear() { memset(this, 0, sizeof(PhaseData)); }
|
||||
};
|
||||
|
||||
class SwashRingData { // Swash Ring data
|
||||
@@ -707,6 +762,14 @@ class FrSkyChannelData {
|
||||
unsigned int multiplier;
|
||||
FrSkyAlarmData alarms[2];
|
||||
|
||||
float getRatio() const
|
||||
{
|
||||
if (type==0 || type==1 || type==2)
|
||||
return float(ratio << multiplier) / 10.0;
|
||||
else
|
||||
return ratio << multiplier;
|
||||
}
|
||||
|
||||
void clear() { memset(this, 0, sizeof(FrSkyChannelData)); }
|
||||
};
|
||||
|
||||
@@ -753,6 +816,9 @@ class FrSkyData {
|
||||
int varioCenterMin; // if increment in 0.2m/s = 3.0m/s max
|
||||
int varioCenterMax;
|
||||
int varioMax;
|
||||
bool mAhPersistent;
|
||||
unsigned int storedMah;
|
||||
int fasOffset;
|
||||
|
||||
void clear() { memset(this, 0, sizeof(FrSkyData)); rssiAlarms[0].clear(2, 45); rssiAlarms[1].clear(3, 42); varioSource = 2/*VARIO*/; }
|
||||
};
|
||||
@@ -765,33 +831,17 @@ class MavlinkData {
|
||||
void clear() { memset(this, 0, sizeof(MavlinkData)); }
|
||||
};
|
||||
|
||||
enum TimerMode {
|
||||
TMRMODE_OFF=0,
|
||||
TMRMODE_ABS,
|
||||
TMRMODE_THs,
|
||||
TMRMODE_THp,
|
||||
TMRMODE_THt,
|
||||
TMRMODE_FIRST_SWITCH,
|
||||
TMRMODE_FIRST_MOMENT_SWITCH = TMRMODE_FIRST_SWITCH+64,
|
||||
TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_MOMENT_SWITCH+64,
|
||||
|
||||
TMRMODE_FIRST_NEG_SWITCH=-TMRMODE_FIRST_SWITCH,
|
||||
TMRMODE_FIRST_NEG_MOMENT_SWITCH=-TMRMODE_FIRST_MOMENT_SWITCH,
|
||||
/* sw/!sw, !m_sw/!m_sw */
|
||||
};
|
||||
|
||||
class TimerData {
|
||||
public:
|
||||
TimerData() { clear(); }
|
||||
TimerMode mode; // timer trigger source -> off, abs, THs, TH%, THt, sw/!sw, !m_sw/!m_sw
|
||||
int8_t modeB;
|
||||
bool minuteBeep;
|
||||
bool countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
RawSwitch mode;
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
unsigned int val;
|
||||
bool persistent;
|
||||
int pvalue;
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); }
|
||||
bool persistent;
|
||||
int pvalue;
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
};
|
||||
|
||||
enum Protocol {
|
||||
@@ -827,16 +877,31 @@ class ModuleData {
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
};
|
||||
|
||||
#define C9X_MAX_SCRIPTS 7
|
||||
#define C9X_MAX_SCRIPT_INPUTS 10
|
||||
class ScriptData {
|
||||
public:
|
||||
ScriptData() { clear(); }
|
||||
char filename[10+1];
|
||||
char name[10+1];
|
||||
int inputs[C9X_MAX_SCRIPT_INPUTS];
|
||||
void clear() { memset(this, 0, sizeof(ScriptData)); }
|
||||
};
|
||||
|
||||
class ModelData {
|
||||
public:
|
||||
ModelData();
|
||||
|
||||
ExpoData * insertInput(const int idx);
|
||||
void removeInput(const int idx);
|
||||
|
||||
bool used;
|
||||
char name[12+1];
|
||||
uint8_t modelVoice;
|
||||
TimerData timers[2];
|
||||
bool thrTrim; // Enable Throttle Trim
|
||||
bool thrExpo; // Enable Throttle Expo
|
||||
unsigned int trimInc; // Trim Increments
|
||||
int trimInc; // Trim Increments
|
||||
bool disableThrottleWarning;
|
||||
|
||||
unsigned int beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
@@ -847,17 +912,22 @@ class ModelData {
|
||||
PhaseData phaseData[C9X_MAX_PHASES];
|
||||
MixData mixData[C9X_MAX_MIXERS];
|
||||
LimitData limitData[C9X_NUM_CHNOUT];
|
||||
|
||||
char inputNames[C9X_MAX_INPUTS][4+1];
|
||||
ExpoData expoData[C9X_MAX_EXPOS];
|
||||
|
||||
CurveData curves[C9X_MAX_CURVES];
|
||||
CustomSwData customSw[C9X_NUM_CSW];
|
||||
LogicalSwitchData customSw[C9X_NUM_CSW];
|
||||
FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS];
|
||||
SafetySwData safetySw[C9X_NUM_CHNOUT];
|
||||
SwashRingData swashRingData;
|
||||
unsigned int thrTraceSrc;
|
||||
int8_t traineron; // 0 disable trainer, 1 allow trainer
|
||||
int8_t t2throttle; // Start timer2 using throttle
|
||||
unsigned int modelId;
|
||||
unsigned int modelId;
|
||||
unsigned int switchWarningStates;
|
||||
unsigned int nSwToWarn;
|
||||
unsigned int nPotsToWarn;
|
||||
int potPosition[C9X_NUM_POTS];
|
||||
bool displayText;
|
||||
// TODO structure
|
||||
char gvars_names[C9X_MAX_GVARS][6+1];
|
||||
bool gvars_popups[C9X_MAX_GVARS];
|
||||
@@ -876,11 +946,15 @@ class ModelData {
|
||||
|
||||
ModuleData moduleData[C9X_NUM_MODULES+1/*trainer*/];
|
||||
|
||||
ScriptData scriptData[C9X_MAX_SCRIPTS];
|
||||
|
||||
void clear();
|
||||
bool isempty();
|
||||
void setDefault(uint8_t id);
|
||||
unsigned int getTrimFlightPhase(uint8_t idx, int8_t phase);
|
||||
void setDefaultMixes(GeneralSettings & settings);
|
||||
void setDefaultValues(unsigned int id, GeneralSettings & settings);
|
||||
|
||||
int getTrimValue(int phaseIdx, int trimIdx);
|
||||
void setTrimValue(int phaseIdx, int trimIdx, int value);
|
||||
ModelData removeGlobalVars();
|
||||
|
||||
void clearMixes();
|
||||
@@ -902,13 +976,10 @@ enum Capability {
|
||||
FlightPhases,
|
||||
FlightModesName,
|
||||
FlightPhasesHaveFades,
|
||||
SimulatorType,
|
||||
Mixes,
|
||||
MixesWithoutExpo,
|
||||
Timers,
|
||||
TimeDivisions,
|
||||
minuteBeep,
|
||||
countdownBeep,
|
||||
CustomFunctions,
|
||||
VoicesAsNumbers,
|
||||
VoicesMaxLength,
|
||||
@@ -918,16 +989,15 @@ enum Capability {
|
||||
Pots,
|
||||
Switches,
|
||||
SwitchesPositions,
|
||||
CustomSwitches,
|
||||
LogicalSwitches,
|
||||
CustomAndSwitches,
|
||||
HasNegAndSwitches,
|
||||
CustomSwitchesExt,
|
||||
LogicalSwitchesExt,
|
||||
RotaryEncoders,
|
||||
Outputs,
|
||||
ChannelsName,
|
||||
ExtraChannels,
|
||||
ExtraInputs,
|
||||
ExtraTrims,
|
||||
ExtendedTrims,
|
||||
HasInputFilter,
|
||||
NumCurves,
|
||||
@@ -972,12 +1042,10 @@ enum Capability {
|
||||
GvarsInCS,
|
||||
GvarsAreNamed,
|
||||
GvarsFlightPhases,
|
||||
GvarsHaveSources,
|
||||
GvarsAsSources,
|
||||
GvarsName,
|
||||
NoTelemetryProtocol,
|
||||
TelemetryCSFields,
|
||||
TelemetryColsCSFields,
|
||||
TelemetryCustomScreens,
|
||||
TelemetryCustomScreensFieldsPerLine,
|
||||
TelemetryRSSIModel,
|
||||
TelemetryAlarm,
|
||||
TelemetryInternalAlarm,
|
||||
@@ -993,7 +1061,6 @@ enum Capability {
|
||||
HasStickScroll,
|
||||
HasSoundMixer,
|
||||
NumModules,
|
||||
FSSwitch,
|
||||
PPMCenter,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
@@ -1008,19 +1075,18 @@ enum Capability {
|
||||
CSFunc,
|
||||
LCDWidth,
|
||||
GetThrSwitch,
|
||||
HasDisplayText,
|
||||
VirtualInputs,
|
||||
TrainerInputs,
|
||||
LuaInputs,
|
||||
LimitsPer1000,
|
||||
EnhancedCurves,
|
||||
TelemetryInternalAlarms
|
||||
};
|
||||
|
||||
enum UseContext {
|
||||
DefaultContext,
|
||||
TimerContext,
|
||||
FlightPhaseContext,
|
||||
MixerContext,
|
||||
ExpoContext,
|
||||
TelemetryInternalAlarms,
|
||||
HasFasOffset,
|
||||
HasMahPersistent,
|
||||
MultiposPots,
|
||||
MultiposPotsPositions,
|
||||
SimulatorVariant,
|
||||
};
|
||||
|
||||
class SimulatorInterface;
|
||||
@@ -1039,7 +1105,7 @@ class EEPROMInterface
|
||||
|
||||
inline BoardEnum getBoard() { return board; }
|
||||
|
||||
virtual bool load(RadioData &radioData, uint8_t *eeprom, int size) = 0;
|
||||
virtual bool load(RadioData &radioData, const uint8_t *eeprom, int size) = 0;
|
||||
|
||||
virtual bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0;
|
||||
|
||||
@@ -1055,11 +1121,7 @@ class EEPROMInterface
|
||||
|
||||
virtual int isAvailable(Protocol proto, int port=0) = 0;
|
||||
|
||||
virtual bool isAvailable(const RawSwitch & swtch, UseContext context) { return true; }
|
||||
|
||||
virtual bool isAvailable(const RawSource & source, UseContext context) { return true; }
|
||||
|
||||
virtual SimulatorInterface * getSimulator() = 0;
|
||||
virtual SimulatorInterface * getSimulator() { return NULL; }
|
||||
|
||||
virtual const int getEEpromSize() = 0;
|
||||
|
||||
@@ -1081,6 +1143,12 @@ extern QString EEPROMWarnings;
|
||||
void setEEPROMString(char *dst, const char *src, int size);
|
||||
void getEEPROMString(char *dst, const char *src, int size);
|
||||
|
||||
float ValToTim(int value);
|
||||
int TimToVal(float value);
|
||||
|
||||
QString getSignedStr(int value);
|
||||
QString getGVarString(int16_t val, bool sign=false);
|
||||
|
||||
inline int applyStickMode(int stick, unsigned int mode)
|
||||
{
|
||||
if (mode == 0 || mode > 4) {
|
||||
@@ -1140,14 +1208,14 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||
// virtual switches
|
||||
for (int i=0; i<C9X_NUM_CSW; i++) {
|
||||
RawSource source;
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (model.customSw[i].getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
source = RawSource(model.customSw[i].val2);
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||
model.customSw[i].val2 = source.toValue();
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
source = RawSource(model.customSw[i].val1);
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
source.index = applyStickMode(source.index + 1, mode) - 1;
|
||||
@@ -1166,7 +1234,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||
void RegisterFirmwares();
|
||||
|
||||
bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
|
||||
bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size);
|
||||
bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
|
||||
bool LoadEepromXml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
struct Option {
|
||||
|
||||
@@ -17,9 +17,9 @@ RawSwitch er9xToSwitch(int8_t sw)
|
||||
else if (sw == -22)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 22+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
}
|
||||
|
||||
t_Er9xTrainerMix::t_Er9xTrainerMix()
|
||||
@@ -269,22 +269,22 @@ RawSource er9xToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Er9xCustomSwData::operator CustomSwData ()
|
||||
Er9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = er9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = er9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -298,14 +298,6 @@ t_Er9xSafetySwData::t_Er9xSafetySwData()
|
||||
memset(this, 0, sizeof(t_Er9xSafetySwData));
|
||||
}
|
||||
|
||||
t_Er9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xFrSkyChannelData::t_Er9xFrSkyChannelData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xFrSkyChannelData));
|
||||
@@ -343,10 +335,11 @@ t_Er9xFrSkyData::operator FrSkyData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
TimerMode getEr9xTimerMode(int mode)
|
||||
RawSwitch getEr9xTimerMode(int mode)
|
||||
{
|
||||
/*
|
||||
if (mode <= -33)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+33));
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+33));
|
||||
else if (mode <= -1)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 16)
|
||||
@@ -354,7 +347,9 @@ TimerMode getEr9xTimerMode(int mode)
|
||||
else if (mode < 16+21)
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16));
|
||||
else
|
||||
return TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-16-21));
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16-21));
|
||||
*/
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
t_Er9xModelData::operator ModelData ()
|
||||
@@ -366,9 +361,7 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.timers[0].mode = getEr9xTimerMode(tmrMode);
|
||||
c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
c9x.timers[0].modeB = tmrModeB;
|
||||
|
||||
switch(protocol) {
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PXX_DJT;
|
||||
break;
|
||||
@@ -383,12 +376,12 @@ t_Er9xModelData::operator ModelData ()
|
||||
break;
|
||||
}
|
||||
c9x.traineron= traineron;
|
||||
c9x.t2throttle = t2throttle;
|
||||
// c9x.t2throttle = t2throttle;
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
@@ -473,8 +466,8 @@ t_Er9xModelData::operator ModelData ()
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
|
||||
@@ -154,21 +154,20 @@ PACK(typedef struct t_Er9xMixData {
|
||||
}) Er9xMixData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Er9xCustomSwData { // Custom Switches data
|
||||
PACK(typedef struct t_Er9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func:4;
|
||||
uint8_t andsw:4;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Er9xCustomSwData() { memset(this, 0, sizeof(t_Er9xCustomSwData)); }
|
||||
}) Er9xCustomSwData;
|
||||
operator LogicalSwitchData();
|
||||
t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData)); }
|
||||
}) Er9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Er9xSafetySwData();
|
||||
}) Er9xSafetySwData;
|
||||
|
||||
@@ -242,7 +241,7 @@ PACK(typedef struct t_Er9xModelData {
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ER9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ER9X_MAX_CURVE9][9];
|
||||
Er9xCustomSwData customSw[ER9X_NUM_CSW];
|
||||
Er9xLogicalSwitchData customSw[ER9X_NUM_CSW];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
int8_t tmrModeB;
|
||||
uint8_t numVoice;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "er9xeeprom.h"
|
||||
#include "er9xsimulator.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -44,8 +45,7 @@ const char * Er9xInterface::getName()
|
||||
|
||||
const int Er9xInterface::getEEpromSize()
|
||||
{
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
}
|
||||
@@ -75,11 +75,11 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||
for (int i=0; i<ER9X_MAX_MIXERS; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -114,7 +114,7 @@ bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying er9x import... ";
|
||||
|
||||
@@ -123,7 +123,7 @@ bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ int Er9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return 12;
|
||||
case CustomAndSwitches:
|
||||
return 5;
|
||||
@@ -281,9 +281,6 @@ int Er9xInterface::getCapability(const Capability capability)
|
||||
case ModelVoice:
|
||||
case Gvars:
|
||||
return 7;
|
||||
case GvarsHaveSources:
|
||||
case GvarsAsSources:
|
||||
return 1;
|
||||
case GetThrSwitch:
|
||||
return DSW_THR;
|
||||
default:
|
||||
@@ -306,7 +303,7 @@ int Er9xInterface::isAvailable(Protocol prot, int port)
|
||||
|
||||
SimulatorInterface * Er9xInterface::getSimulator()
|
||||
{
|
||||
return new Er9xSimulator(this);
|
||||
return NULL; // new Er9xSimulator(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Er9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t * eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
|
||||
extern RawSwitch er9xToSwitch(int8_t sw);
|
||||
|
||||
TimerMode getErSky9xTimerMode(int mode)
|
||||
RawSwitch getErSky9xTimerMode(int mode)
|
||||
{
|
||||
if (mode<4)
|
||||
return TimerMode(mode);
|
||||
else if (mode < 20)
|
||||
return TimerMode(TMRMODE_FIRST_CHPERC+(mode-4));
|
||||
return RawSwitch(SWITCH_TYPE_TIMER_MODE, mode);
|
||||
else
|
||||
return TimerMode(0);
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
RawSwitch ersky9xToSwitch(int8_t sw)
|
||||
@@ -29,9 +27,9 @@ RawSwitch ersky9xToSwitch(int8_t sw)
|
||||
else if (sw == -34)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 34+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
|
||||
@@ -355,22 +353,22 @@ RawSource ersky9xToSource_v11(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Ersky9xCustomSwData_v10::operator CustomSwData ()
|
||||
Ersky9xLogicalSwitchData_v10::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v10(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v10(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -378,22 +376,22 @@ Ersky9xCustomSwData_v10::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Ersky9xCustomSwData_v11::operator CustomSwData ()
|
||||
Ersky9xLogicalSwitchData_v11::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v11(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v11(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -406,27 +404,11 @@ t_Ersky9xSafetySwData_v10::t_Ersky9xSafetySwData_v10()
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v10::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v11::t_Ersky9xSafetySwData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v11::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = ersky9xToSwitch(opt.ss.swtch);
|
||||
c9x.val = opt.ss.val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v10::t_Ersky9xFrSkyChannelData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v10));
|
||||
@@ -508,7 +490,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].modeB = timer[i].tmrModeB;
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
@@ -532,7 +513,7 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
@@ -613,8 +594,8 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
@@ -630,7 +611,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].modeB = timer[i].tmrModeB;
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
@@ -654,7 +634,7 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
@@ -735,8 +715,8 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V11; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<ERSKY9X_NUM_CHNOUT_V11; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
extern TimerMode getEr9xTimerMode(int mode);
|
||||
extern int setEr9xTimerMode(TimerMode mode);
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
//eeprom data
|
||||
#define ERSKY9X_MAX_MIXERS_V10 32
|
||||
@@ -186,31 +185,30 @@ PACK(typedef struct t_Ersky9xMixData_v11 {
|
||||
t_Ersky9xMixData_v11();
|
||||
}) Ersky9xMixData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xCustomSwData_v10 { // Custom Switches data
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v10 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Ersky9xCustomSwData_v10() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v10)); }
|
||||
}) Ersky9xCustomSwData_v10;
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v10() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v10)); }
|
||||
}) Ersky9xLogicalSwitchData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xCustomSwData_v11 { // Custom Switches data
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v11 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t andsw;
|
||||
uint8_t res ;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Ersky9xCustomSwData_v11() { memset(this, 0, sizeof(t_Ersky9xCustomSwData_v11)); }
|
||||
}) Ersky9xCustomSwData_v11;
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v11() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v11)); }
|
||||
}) Ersky9xLogicalSwitchData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Ersky9xSafetySwData_v10();
|
||||
}) Ersky9xSafetySwData_v10;
|
||||
|
||||
@@ -230,7 +228,6 @@ PACK(typedef struct t_Ersky9xSafetySwData_v11 { // Custom Switches data
|
||||
} vs ;
|
||||
} opt ;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Ersky9xSafetySwData_v11();
|
||||
}) Ersky9xSafetySwData_v11;
|
||||
|
||||
@@ -363,7 +360,7 @@ PACK(typedef struct t_Ersky9xModelData_v10 {
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
Ersky9xCustomSwData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
||||
Ersky9xLogicalSwitchData_v10 customSw[ERSKY9X_NUM_CSW_V10];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t res3[2];
|
||||
Ersky9xSafetySwData_v10 safetySw[ERSKY9X_NUM_CHNOUT_V10];
|
||||
@@ -412,7 +409,7 @@ PACK(typedef struct t_Ersky9xModelData_v11 {
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
int8_t curvexy[18];
|
||||
Ersky9xCustomSwData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
||||
Ersky9xLogicalSwitchData_v11 customSw[ERSKY9X_NUM_CSW_V11];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t bt_telemetry;
|
||||
uint8_t numVoice; // 0-16, rest are Safety switches
|
||||
|
||||
@@ -74,11 +74,11 @@ inline void applyStickModeToModel(Ersky9xModelData_v10 & model, unsigned int mod
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -106,11 +106,11 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++) {
|
||||
switch (getCSFunctionFamily(model.customSw[i].func)) {
|
||||
case CS_FAMILY_VCOMP:
|
||||
switch (LogicalSwitchData(model.customSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.customSw[i].v2 = applyStickMode(model.customSw[i].v2, mode);
|
||||
// no break
|
||||
case CS_FAMILY_VOFS:
|
||||
case LS_FAMILY_VOFS:
|
||||
model.customSw[i].v1 = applyStickMode(model.customSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
@@ -151,7 +151,7 @@ bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying ersky9x import... ";
|
||||
|
||||
@@ -160,7 +160,7 @@ bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_SKY9X)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return ERSKY9X_NUM_CSW_V11;
|
||||
case CustomAndSwitches:
|
||||
return 1;
|
||||
@@ -317,9 +317,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
|
||||
return 125;
|
||||
case MaxVolume:
|
||||
return 23;
|
||||
case GvarsHaveSources:
|
||||
case GvarsAsSources:
|
||||
return 1;
|
||||
case TelemetryMaxMultiplier:
|
||||
return 2;
|
||||
case LCDWidth:
|
||||
@@ -346,7 +343,7 @@ int Ersky9xInterface::isAvailable(Protocol prot, int port)
|
||||
|
||||
SimulatorInterface * Ersky9xInterface::getSimulator()
|
||||
{
|
||||
return new Ersky9xSimulator(this);
|
||||
return NULL; // new Ersky9xSimulator(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Ersky9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t * eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
|
||||
@@ -301,22 +301,22 @@ RawSource gruvin9xToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Gruvin9xCustomSwData::operator CustomSwData ()
|
||||
Gruvin9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = gruvin9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = gruvin9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = gruvin9xToSwitch(v1).toValue();
|
||||
c9x.val2 = gruvin9xToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -332,14 +332,6 @@ Gruvin9xFuncSwData::operator FuncSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xSwashRingData));
|
||||
@@ -381,7 +373,7 @@ t_Gruvin9xPhaseData_v106::operator PhaseData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
extern TimerMode getEr9xTimerMode(int mode);
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
t_Gruvin9xTimerData::operator TimerData ()
|
||||
{
|
||||
@@ -458,7 +450,7 @@ t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -489,8 +481,8 @@ t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
@@ -529,7 +521,7 @@ t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -560,8 +552,8 @@ t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
@@ -600,7 +592,7 @@ t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -650,8 +642,8 @@ t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
@@ -691,7 +683,7 @@ t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -734,8 +726,8 @@ t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
|
||||
@@ -186,20 +186,19 @@ PACK(typedef struct t_Gruvin9xMixData {
|
||||
t_Gruvin9xMixData();
|
||||
}) Gruvin9xMixData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xCustomSwData { // Custom Switches data
|
||||
PACK(typedef struct t_Gruvin9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Gruvin9xCustomSwData() { memset(this, 0, sizeof(t_Gruvin9xCustomSwData)); }
|
||||
}) Gruvin9xCustomSwData;
|
||||
operator LogicalSwitchData();
|
||||
t_Gruvin9xLogicalSwitchData() { memset(this, 0, sizeof(t_Gruvin9xLogicalSwitchData)); }
|
||||
}) Gruvin9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Gruvin9xSafetySwData() { memset(this, 0, sizeof(t_Gruvin9xSafetySwData)); }
|
||||
}) Gruvin9xSafetySwData;
|
||||
|
||||
@@ -310,7 +309,7 @@ PACK(typedef struct t_Gruvin9xModelData_v102 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||
@@ -342,7 +341,7 @@ PACK(typedef struct t_Gruvin9xModelData_v103 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xPhaseData_v102 phaseData[G9X_MAX_PHASES];
|
||||
@@ -374,7 +373,7 @@ PACK(typedef struct t_Gruvin9xModelData_v105 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
@@ -406,7 +405,7 @@ PACK(typedef struct t_Gruvin9xModelData_v106 {
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xCustomSwData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xLogicalSwitchData customSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xFuncSwData funcSw[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "gruvin9xinterface.h"
|
||||
#include "gruvin9xeeprom.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -47,8 +48,7 @@ const char * Gruvin9xInterface::getName()
|
||||
const int Gruvin9xInterface::getEEpromSize()
|
||||
{
|
||||
if (board == BOARD_STOCK) {
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return EESIZE_STOCK*2;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ bool Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
}
|
||||
|
||||
|
||||
bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import... ";
|
||||
|
||||
@@ -108,7 +108,7 @@ bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ int Gruvin9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 12;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return 12;
|
||||
case CSFunc:
|
||||
return 13;
|
||||
|
||||
@@ -35,7 +35,7 @@ class Gruvin9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
|
||||
|
||||
|
||||
@@ -293,22 +293,22 @@ RawSource open9xV4209ToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
||||
Open9xGruvin9xLogicalSwitchData_v207::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4207ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xV4207ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -316,22 +316,22 @@ Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Open9xGruvin9xCustomSwData_v209::operator CustomSwData ()
|
||||
Open9xGruvin9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xV4209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -454,7 +454,7 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -538,7 +538,7 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -627,7 +627,7 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -717,7 +717,7 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -804,7 +804,7 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -110,27 +110,27 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
|
||||
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
|
||||
}) Open9xGruvin9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v207 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v207 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xGruvin9xCustomSwData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v207)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v207)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xCustomSwData_v207;
|
||||
}) Open9xGruvin9xLogicalSwitchData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xGruvin9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v209)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v209)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xCustomSwData_v209;
|
||||
}) Open9xGruvin9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
@@ -194,7 +194,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xPhaseData_v207 phaseData[O9X_MAX_PHASES];
|
||||
@@ -228,7 +228,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -267,7 +267,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -307,7 +307,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
@@ -345,7 +345,7 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
|
||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xGruvin9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xGruvin9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xPhaseData_v208 phaseData[O9X_MAX_PHASES];
|
||||
|
||||
@@ -19,13 +19,13 @@ RawSwitch open9xArmToSwitch(int8_t sw)
|
||||
else if (sw == 42)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == 84)
|
||||
return RawSwitch(SWITCH_TYPE_ONM);
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -42)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 42+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-42 : sw+42);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-42 : sw+42);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
|
||||
}
|
||||
|
||||
RawSource open9xArm208ToSource(int8_t value)
|
||||
@@ -124,9 +124,9 @@ RawSource open9xArm210ToSource(int8_t value)
|
||||
t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
|
||||
/*
|
||||
if (mode <= -42)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||
else if (mode <= -1)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 5)
|
||||
@@ -134,8 +134,8 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
else if (mode < 5+41)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||
else
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
||||
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
@@ -268,11 +268,11 @@ t_Open9xArmMixData_v208::operator MixData ()
|
||||
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10-9-O9X_ARM_NUM_CSW);
|
||||
}
|
||||
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
|
||||
else if (srcRaw <= 9+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = open9xArmToSwitch(swtch);
|
||||
@@ -334,11 +334,11 @@ t_Open9xArmMixData_v209::operator MixData ()
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-O9X_ARM_NUM_CSW);
|
||||
}
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
|
||||
@@ -400,11 +400,11 @@ t_Open9xArmMixData_v210::operator MixData ()
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-14-9-O9X_ARM_NUM_CSW);
|
||||
}
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
|
||||
else if (srcRaw <= 13+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
|
||||
@@ -470,11 +470,11 @@ t_Open9xArmMixData_v212::operator MixData ()
|
||||
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-15-9-O9X_ARM_NUM_CSW);
|
||||
}
|
||||
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM) {
|
||||
else if (srcRaw <= 14+9+O9X_ARM_NUM_CSW+NUM_CYC+8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-8);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
|
||||
@@ -501,22 +501,22 @@ t_Open9xArmMixData_v212::operator MixData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm208ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xArm208ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -524,22 +524,22 @@ t_Open9xArmCustomSwData_v208::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xArm209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -547,24 +547,24 @@ t_Open9xArmCustomSwData_v209::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xArmCustomSwData_v210::operator CustomSwData ()
|
||||
t_Open9xArmLogicalSwitchData_v210::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
c9x.delay = delay;
|
||||
c9x.duration = duration;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xArm210ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xArm210ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xArmToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xArmToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -577,7 +577,7 @@ t_Open9xArmFuncSwData_v208::operator FuncSwData ()
|
||||
FuncSwData c9x;
|
||||
c9x.swtch = open9xArmToSwitch(swtch);
|
||||
c9x.func = (AssignFunc)(func);
|
||||
if (c9x.func <= FuncSafetyCh16) {
|
||||
if (c9x.func <= FuncSafetyCh32) {
|
||||
c9x.enabled=param & 0x01;
|
||||
c9x.param = (param>>1)<<1;
|
||||
}
|
||||
@@ -760,7 +760,7 @@ t_Open9xArmModelData_v208::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -849,7 +849,7 @@ t_Open9xArmModelData_v209::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -939,7 +939,7 @@ t_Open9xArmModelData_v210::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -1023,7 +1023,7 @@ t_Open9xArmModelData_v211::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -1110,7 +1110,7 @@ t_Open9xArmModelData_v212::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -190,34 +190,34 @@ PACK(typedef struct t_Open9xArmPhaseData_v212 {
|
||||
t_Open9xArmPhaseData_v212() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v212)); }
|
||||
}) Open9xArmPhaseData_v212;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v208 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v208)); }
|
||||
}) Open9xArmCustomSwData_v208;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v208)); }
|
||||
}) Open9xArmLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v209)); }
|
||||
}) Open9xArmCustomSwData_v209;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v209)); }
|
||||
}) Open9xArmLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomSwData_v210 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v210 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t delay;
|
||||
uint8_t duration;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xArmCustomSwData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v210)); }
|
||||
}) Open9xArmCustomSwData_v210;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v210() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v210)); }
|
||||
}) Open9xArmLogicalSwitchData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
@@ -343,7 +343,7 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
|
||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v208 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v208 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v208 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -382,7 +382,7 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
|
||||
Open9xArmExpoData_v208 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v209 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v209 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v208 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -422,7 +422,7 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
|
||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v210 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -461,7 +461,7 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
|
||||
Open9xArmExpoData_v210 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||
int8_t points[O9X_ARM_NUM_POINTS];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmPhaseData_v208 phaseData[O9X_ARM_MAX_PHASES];
|
||||
@@ -499,7 +499,7 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
|
||||
Open9xArmExpoData_v212 expoData[O9X_ARM_MAX_EXPOS];
|
||||
int16_t curves[O9X_ARM_MAX_CURVES];
|
||||
int8_t points[O9X_ARM_NUM_POINTS];
|
||||
Open9xArmCustomSwData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmLogicalSwitchData_v210 customSw[O9X_ARM_NUM_CSW];
|
||||
Open9xArmFuncSwData_v211 funcSw[O9X_ARM_NUM_FSW];
|
||||
Open9xArmSwashRingData_v210 swashR;
|
||||
Open9xArmPhaseData_v212 phaseData[O9X_ARM_MAX_PHASES];
|
||||
|
||||
@@ -74,13 +74,13 @@ RawSwitch open9xStockToSwitch(int8_t sw)
|
||||
else if (sw == 22)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == 44)
|
||||
return RawSwitch(SWITCH_TYPE_ONM);
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -22)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 22+9)
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
}
|
||||
|
||||
t_Open9xExpoData_v201::operator ExpoData ()
|
||||
@@ -518,22 +518,22 @@ RawSource open9xStock209ToSource(int8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
Open9xCustomSwData_v208::operator CustomSwData ()
|
||||
Open9xLogicalSwitchData_v208::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9x208ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9x208ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -541,22 +541,22 @@ Open9xCustomSwData_v208::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Open9xCustomSwData_v209::operator CustomSwData ()
|
||||
Open9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xStock209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xStock209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
@@ -593,7 +593,7 @@ enum Functions {
|
||||
#endif
|
||||
FUNC_BACKLIGHT,
|
||||
#if defined(DEBUG)
|
||||
FUNC_TEST, // should remain the last before MAX as not added in companion9x
|
||||
FUNC_TEST, // should remain the last before MAX as not added in companion
|
||||
#endif
|
||||
FUNC_MAX
|
||||
};
|
||||
@@ -662,14 +662,6 @@ t_Open9xFuncSwData_v210::operator FuncSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xSafetySwData::operator SafetySwData ()
|
||||
{
|
||||
SafetySwData c9x;
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xSwashRingData_v208::operator SwashRingData ()
|
||||
{
|
||||
SwashRingData c9x;
|
||||
@@ -709,7 +701,7 @@ t_Open9xPhaseData_v201::operator PhaseData ()
|
||||
t_Open9xTimerData_v201::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
c9x.mode = TMRMODE_OFF;
|
||||
// c9x.mode = TMRMODE_OFF;
|
||||
c9x.val = val;
|
||||
c9x.persistent = persistent;
|
||||
c9x.dir = dir;
|
||||
@@ -719,9 +711,9 @@ t_Open9xTimerData_v201::operator TimerData ()
|
||||
t_Open9xTimerData_v202::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
|
||||
/*
|
||||
if (mode <= -22)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22));
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22));
|
||||
else if (mode <= -1)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 5)
|
||||
@@ -729,8 +721,8 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||
else if (mode < 5+21)
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5));
|
||||
else
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21));
|
||||
|
||||
c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21));
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
@@ -950,7 +942,7 @@ t_Open9xModelData_v201::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -993,8 +985,8 @@ t_Open9xModelData_v201::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
@@ -1024,7 +1016,7 @@ t_Open9xModelData_v202::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter,
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1067,8 +1059,8 @@ t_Open9xModelData_v202::operator ModelData ()
|
||||
c9x.customSw[i] = customSw[i];
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.funcSw[i] = funcSw[i];
|
||||
for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
c9x.safetySw[i] = safetySw[i];
|
||||
// for (int i=0; i<O9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
@@ -1100,7 +1092,7 @@ t_Open9xModelData_v203::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1174,7 +1166,7 @@ t_Open9xModelData_v204::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1253,7 +1245,7 @@ t_Open9xModelData_v205::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1339,7 +1331,7 @@ t_Open9xModelData_v208::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1432,7 +1424,7 @@ t_Open9xModelData_v209::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1526,7 +1518,7 @@ t_Open9xModelData_v210::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
@@ -1614,7 +1606,7 @@ t_Open9xModelData_v211::operator ModelData ()
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
|
||||
@@ -221,30 +221,29 @@ PACK(typedef struct t_Open9xMixData_v211 {
|
||||
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
|
||||
}) Open9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomSwData_v208 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xCustomSwData_v208)); }
|
||||
t_Open9xCustomSwData_v208(CustomSwData&);
|
||||
}) Open9xCustomSwData_v208;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v208)); }
|
||||
t_Open9xLogicalSwitchData_v208(LogicalSwitchData&);
|
||||
}) Open9xLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomSwData_v209 { // Custom Switches data
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Open9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xCustomSwData_v209)); }
|
||||
}) Open9xCustomSwData_v209;
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v209)); }
|
||||
}) Open9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
operator SafetySwData();
|
||||
t_Open9xSafetySwData() { memset(this, 0, sizeof(t_Open9xSafetySwData)); }
|
||||
}) Open9xSafetySwData;
|
||||
|
||||
@@ -517,7 +516,7 @@ PACK(typedef struct t_Open9xModelData_v201 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||
Open9xFuncSwData_v201 funcSw[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
@@ -548,7 +547,7 @@ PACK(typedef struct t_Open9xModelData_v202 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xSafetySwData safetySw[O9X_NUM_CHNOUT];
|
||||
Open9xFuncSwData_v201 funcSw[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
@@ -582,7 +581,7 @@ PACK(typedef struct t_Open9xModelData_v203 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -615,7 +614,7 @@ PACK(typedef struct t_Open9xModelData_v204 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -648,7 +647,7 @@ PACK(typedef struct t_Open9xModelData_v205 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -683,7 +682,7 @@ PACK(typedef struct t_Open9xModelData_v208 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v208 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -722,7 +721,7 @@ PACK(typedef struct t_Open9xModelData_v209 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves5[O9X_209_MAX_CURVE5][5];
|
||||
int8_t curves9[O9X_209_MAX_CURVE9][9];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v203 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -762,7 +761,7 @@ PACK(typedef struct t_Open9xModelData_v210 {
|
||||
Open9xExpoData_v201 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
@@ -800,7 +799,7 @@ PACK(typedef struct t_Open9xModelData_v211 {
|
||||
Open9xExpoData_v211 expoData[O9X_MAX_EXPOS];
|
||||
int8_t curves[O9X_MAX_CURVES];
|
||||
int8_t points[O9X_NUM_POINTS];
|
||||
Open9xCustomSwData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xLogicalSwitchData_v209 customSw[O9X_NUM_CSW];
|
||||
Open9xFuncSwData_v210 funcSw[O9X_NUM_FSW];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xPhaseData_v201 phaseData[O9X_MAX_PHASES];
|
||||
|
||||
@@ -105,7 +105,7 @@ uint8_t getStickMode()
|
||||
|
||||
using namespace Open9xGruvin9x;
|
||||
|
||||
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(Open9xInterface * open9xInterface):
|
||||
Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(OpenTxInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
}
|
||||
@@ -128,15 +128,23 @@ bool Open9xGruvin9xSimulator::lcdChanged(bool & lightEnable)
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void Open9xGruvin9xSimulator::start(RadioData &radioData, bool tests)
|
||||
void Open9xGruvin9xSimulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
g_rotenc[0] = 0;
|
||||
g_rotenc[1] = 0;
|
||||
open9xInterface->save(&eeprom[0], radioData, SIMU_GRUVIN9X_VARIANTS);
|
||||
memcpy(Open9xGruvin9x::eeprom, eeprom.data(), std::min<int>(sizeof(Open9xGruvin9x::eeprom), eeprom.size()));
|
||||
StartEepromThread(NULL);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xGruvin9xSimulator::start(const char * filename, bool tests)
|
||||
{
|
||||
g_rotenc[0] = 0;
|
||||
g_rotenc[1] = 0;
|
||||
StartEepromThread(filename);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xGruvin9xSimulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
class RadioData;
|
||||
class Open9xInterface;
|
||||
class OpenTxInterface;
|
||||
|
||||
class Open9xGruvin9xSimulator : public SimulatorInterface {
|
||||
|
||||
public:
|
||||
|
||||
Open9xGruvin9xSimulator(Open9xInterface *);
|
||||
Open9xGruvin9xSimulator(OpenTxInterface *);
|
||||
|
||||
virtual void start(RadioData & radioData, bool tests);
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
virtual void stop();
|
||||
|
||||
@@ -54,7 +56,7 @@ class Open9xGruvin9xSimulator : public SimulatorInterface {
|
||||
|
||||
protected:
|
||||
|
||||
Open9xInterface * open9xInterface;
|
||||
OpenTxInterface * open9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -103,7 +103,7 @@ uint8_t getStickMode()
|
||||
|
||||
using namespace Open9xM128;
|
||||
|
||||
Open9xM128Simulator::Open9xM128Simulator(Open9xInterface * open9xInterface):
|
||||
Open9xM128Simulator::Open9xM128Simulator(OpenTxInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
}
|
||||
@@ -126,13 +126,19 @@ bool Open9xM128Simulator::lcdChanged(bool & lightEnable)
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void Open9xM128Simulator::start(RadioData &radioData, bool tests)
|
||||
void Open9xM128Simulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
open9xInterface->save(&eeprom[0], radioData, SIMU_M128_VARIANTS);
|
||||
memcpy(Open9xM128::eeprom, eeprom.data(), std::min<int>(sizeof(Open9xM128::eeprom), eeprom.size()));
|
||||
StartEepromThread(NULL);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xM128Simulator::start(const char * filename, bool tests)
|
||||
{
|
||||
StartEepromThread(filename);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xM128Simulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
class RadioData;
|
||||
class Open9xInterface;
|
||||
class OpenTxInterface;
|
||||
|
||||
class Open9xM128Simulator : public SimulatorInterface {
|
||||
|
||||
public:
|
||||
|
||||
Open9xM128Simulator(Open9xInterface *);
|
||||
Open9xM128Simulator(OpenTxInterface *);
|
||||
|
||||
virtual void start(RadioData & radioData, bool tests);
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
virtual void stop();
|
||||
|
||||
@@ -54,7 +56,7 @@ class Open9xM128Simulator : public SimulatorInterface {
|
||||
|
||||
protected:
|
||||
|
||||
Open9xInterface * open9xInterface;
|
||||
OpenTxInterface * open9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "opentxSky9xsimulator.h"
|
||||
#include "opentxinterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define SIMU
|
||||
#define SIMU_EXCEPTIONS
|
||||
@@ -132,11 +133,10 @@ uint8_t getStickMode()
|
||||
|
||||
using namespace Open9xSky9x;
|
||||
|
||||
Open9xSky9xSimulator::Open9xSky9xSimulator(Open9xInterface * open9xInterface):
|
||||
Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString path=settings.value("sdPath", ".").toString()+"/";
|
||||
QString path=g.profile[g.id()].sdPath()+"/";
|
||||
int i=0;
|
||||
for (i=0; i< std::min(path.length(),1022); i++) {
|
||||
simuSdDirectory[i]=path.at(i).toAscii();
|
||||
@@ -162,14 +162,21 @@ bool Open9xSky9xSimulator::lcdChanged(bool & lightEnable)
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void Open9xSky9xSimulator::start(RadioData &radioData, bool tests)
|
||||
void Open9xSky9xSimulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
g_rotenc[0] = 0;
|
||||
open9xInterface->save(&eeprom[0], radioData);
|
||||
memcpy(Open9xSky9x::eeprom, eeprom.data(), std::min<int>(sizeof(Open9xSky9x::eeprom), eeprom.size()));
|
||||
StartEepromThread(NULL);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xSky9xSimulator::start(const char * filename, bool tests)
|
||||
{
|
||||
g_rotenc[0] = 0;
|
||||
StartEepromThread(filename);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xSky9xSimulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
class RadioData;
|
||||
class Open9xInterface;
|
||||
class OpenTxInterface;
|
||||
|
||||
class Open9xSky9xSimulator : public SimulatorInterface {
|
||||
|
||||
public:
|
||||
|
||||
Open9xSky9xSimulator(Open9xInterface *);
|
||||
Open9xSky9xSimulator(OpenTxInterface *);
|
||||
|
||||
virtual void start(RadioData & radioData, bool tests);
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
virtual void stop();
|
||||
|
||||
@@ -54,7 +56,7 @@ class Open9xSky9xSimulator : public SimulatorInterface {
|
||||
|
||||
protected:
|
||||
|
||||
Open9xInterface * open9xInterface;
|
||||
OpenTxInterface * open9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "opentxTaranisSimulator.h"
|
||||
#include "opentxinterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define SIMU
|
||||
#define SIMU_EXCEPTIONS
|
||||
@@ -35,6 +36,8 @@
|
||||
#define AUDIO
|
||||
#define VOICE
|
||||
#define PXX
|
||||
#define DSM2
|
||||
#define DSM2_PPM
|
||||
#define DBLKEYS
|
||||
#define AUTOSWITCH
|
||||
#define GRAPHICS
|
||||
@@ -47,6 +50,8 @@
|
||||
#define PPM_CENTER_ADJUSTABLE
|
||||
#define PPM_LIMITS_SYMETRICAL
|
||||
#define FAI_CHOICE
|
||||
#define LUA
|
||||
#define LUA_MODEL_SCRIPTS
|
||||
#define EEPROM_VARIANT 3
|
||||
|
||||
#undef min
|
||||
@@ -65,6 +70,7 @@ inline int geteepromsize() {
|
||||
#include "radio/src/targets/taranis/board_taranis.cpp"
|
||||
#include "radio/src/protocols/ppm_arm.cpp"
|
||||
#include "radio/src/protocols/pxx_arm.cpp"
|
||||
#include "radio/src/protocols/dsm2_arm.cpp"
|
||||
#include "radio/src/targets/taranis/pwr_driver.cpp"
|
||||
#include "radio/src/eeprom_common.cpp"
|
||||
#include "radio/src/eeprom_conversions.cpp"
|
||||
@@ -73,6 +79,7 @@ inline int geteepromsize() {
|
||||
#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/uart3_driver.cpp"
|
||||
#include "radio/src/protocols/pulses_arm.cpp"
|
||||
#include "radio/src/stamp.cpp"
|
||||
#include "radio/src/maths.cpp"
|
||||
@@ -110,8 +117,38 @@ inline int geteepromsize() {
|
||||
#include "radio/src/translations/tts_pt.cpp"
|
||||
#include "radio/src/translations/tts_sk.cpp"
|
||||
#include "radio/src/translations/tts_pl.cpp"
|
||||
|
||||
#include "radio/src/lua.cpp"
|
||||
#include "radio/src/lua/src/lapi.c"
|
||||
#include "radio/src/lua/src/lcode.c"
|
||||
#include "radio/src/lua/src/lctype.c"
|
||||
#include "radio/src/lua/src/ldebug.c"
|
||||
#include "radio/src/lua/src/ldo.c"
|
||||
#include "radio/src/lua/src/ldump.c"
|
||||
#include "radio/src/lua/src/lfunc.c"
|
||||
#include "radio/src/lua/src/lgc.c"
|
||||
#include "radio/src/lua/src/llex.c"
|
||||
#include "radio/src/lua/src/lmem.c"
|
||||
#include "radio/src/lua/src/lobject.c"
|
||||
#include "radio/src/lua/src/lopcodes.c"
|
||||
#include "radio/src/lua/src/lparser.c"
|
||||
#include "radio/src/lua/src/lstate.c"
|
||||
#include "radio/src/lua/src/lstring.c"
|
||||
#include "radio/src/lua/src/ltable.c"
|
||||
#include "radio/src/lua/src/ltm.c"
|
||||
#include "radio/src/lua/src/lundump.c"
|
||||
#include "radio/src/lua/src/lvm.c"
|
||||
#include "radio/src/lua/src/lzio.c"
|
||||
#include "radio/src/lua/src/lbaselib.c"
|
||||
#include "radio/src/lua/src/linit.c"
|
||||
#include "radio/src/lua/src/lmathlib.c"
|
||||
#include "radio/src/lua/src/loadlib.c"
|
||||
#include "radio/src/lua/src/lauxlib.c"
|
||||
#include "radio/src/lua/src/ltablib.c"
|
||||
#include "radio/src/lua/src/lcorolib.c"
|
||||
|
||||
|
||||
int16_t g_anas[NUM_STICKS+BOARD_X9D_NUM_POTS];
|
||||
int16_t g_anas[NUM_STICKS+5];
|
||||
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
@@ -141,12 +178,11 @@ void resetTrims()
|
||||
|
||||
using namespace Open9xX9D;
|
||||
|
||||
OpentxTaranisSimulator::OpentxTaranisSimulator(Open9xInterface * open9xInterface):
|
||||
OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
taranisSimulatorBoard = GetEepromInterface()->getBoard();
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString path=settings.value("sdPath", ".").toString()+"/";
|
||||
QString path=g.profile[g.id()].sdPath()+"/";
|
||||
int i=0;
|
||||
for (i=0; i< std::min(path.length(),1022); i++) {
|
||||
simuSdDirectory[i]=path.at(i).toAscii();
|
||||
@@ -172,13 +208,19 @@ bool OpentxTaranisSimulator::lcdChanged(bool & lightEnable)
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void OpentxTaranisSimulator::start(RadioData &radioData, bool tests)
|
||||
void OpentxTaranisSimulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
open9xInterface->save(Open9xX9D::eeprom, radioData);
|
||||
memcpy(Open9xX9D::eeprom, eeprom.data(), std::min<int>(sizeof(Open9xX9D::eeprom), eeprom.size()));
|
||||
StartEepromThread(NULL);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void OpentxTaranisSimulator::start(const char * filename, bool tests)
|
||||
{
|
||||
StartEepromThread(filename);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void OpentxTaranisSimulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
class RadioData;
|
||||
class Open9xInterface;
|
||||
class OpenTxInterface;
|
||||
|
||||
class OpentxTaranisSimulator : public SimulatorInterface {
|
||||
|
||||
public:
|
||||
|
||||
OpentxTaranisSimulator(Open9xInterface *);
|
||||
OpentxTaranisSimulator(OpenTxInterface *);
|
||||
|
||||
virtual void start(RadioData & radioData, bool tests);
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
virtual void stop();
|
||||
|
||||
@@ -54,7 +56,7 @@ class OpentxTaranisSimulator : public SimulatorInterface {
|
||||
|
||||
protected:
|
||||
|
||||
Open9xInterface * open9xInterface;
|
||||
OpenTxInterface * open9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT)
|
||||
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
|
||||
#define SIMU_GRUVIN9X_VARIANTS (0)
|
||||
#define SIMU_ARM_VARIANTS (0)
|
||||
|
||||
#define O9X_MAX_TIMERS 2
|
||||
#define O9X_MAX_PHASES 5
|
||||
@@ -53,9 +51,9 @@
|
||||
#define O9X_ARM_MAX_CSFUNCOLD 13
|
||||
#define O9X_ARM_MAX_CSFUNC 15
|
||||
|
||||
class Open9xGeneralDataNew: public TransformedField {
|
||||
class OpenTxGeneralData: public TransformedField {
|
||||
public:
|
||||
Open9xGeneralDataNew(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);
|
||||
OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);
|
||||
|
||||
protected:
|
||||
virtual void beforeExport();
|
||||
@@ -64,6 +62,7 @@ class Open9xGeneralDataNew: public TransformedField {
|
||||
StructField internalField;
|
||||
GeneralSettings & generalData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
int inputsCount;
|
||||
unsigned int chkSum;
|
||||
};
|
||||
@@ -74,8 +73,9 @@ class ProtocolsConversionTable: public ConversionTable
|
||||
ProtocolsConversionTable(BoardEnum board)
|
||||
{
|
||||
int val = 0;
|
||||
if (IS_TARANIS(board))
|
||||
if (IS_TARANIS(board)) {
|
||||
addConversion(OFF, val++);
|
||||
}
|
||||
addConversion(PPM, val++);
|
||||
if (!IS_ARM(board)) {
|
||||
addConversion(PPM16, val++);
|
||||
@@ -86,9 +86,13 @@ class ProtocolsConversionTable: public ConversionTable
|
||||
addConversion(PXX_XJT_D8, val);
|
||||
addConversion(PXX_XJT_LR12, val++);
|
||||
}
|
||||
addConversion(PXX_DJT, val++);
|
||||
else {
|
||||
addConversion(PXX_DJT, val++);
|
||||
}
|
||||
if (IS_TARANIS(board)) {
|
||||
addConversion(DSM2, val++);
|
||||
addConversion(LP45, val);
|
||||
addConversion(DSM2, val);
|
||||
addConversion(DSMX, val++);
|
||||
}
|
||||
else {
|
||||
addConversion(LP45, val++);
|
||||
@@ -109,9 +113,9 @@ class ChannelsConversionTable: public ConversionTable
|
||||
};
|
||||
|
||||
|
||||
class Open9xModelDataNew: public TransformedField {
|
||||
class OpenTxModelData: public TransformedField {
|
||||
public:
|
||||
Open9xModelDataNew(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant);
|
||||
OpenTxModelData(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant);
|
||||
|
||||
const char * getName() { return name; }
|
||||
|
||||
@@ -122,11 +126,12 @@ class Open9xModelDataNew: public TransformedField {
|
||||
StructField internalField;
|
||||
ModelData & modelData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
|
||||
private:
|
||||
char name[256];
|
||||
signed int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
||||
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
||||
ProtocolsConversionTable protocolsConversionTable;
|
||||
ChannelsConversionTable channelsConversionTable;
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "opentxSky9xsimulator.h"
|
||||
#include "opentxTaranisSimulator.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -42,42 +43,38 @@ size_t SizeOfArray( T(&)[ N ] )
|
||||
return N;
|
||||
}
|
||||
|
||||
QStringList o9xservers;
|
||||
|
||||
Open9xInterface::Open9xInterface(BoardEnum board):
|
||||
OpenTxInterface::OpenTxInterface(BoardEnum board):
|
||||
EEPROMInterface(board),
|
||||
efile(new EFile())
|
||||
{
|
||||
o9xservers.clear();
|
||||
o9xservers << "93.51.182.154" << "open9x.9xforums.com";
|
||||
}
|
||||
|
||||
Open9xInterface::~Open9xInterface()
|
||||
OpenTxInterface::~OpenTxInterface()
|
||||
{
|
||||
delete efile;
|
||||
}
|
||||
|
||||
const char * Open9xInterface::getName()
|
||||
const char * OpenTxInterface::getName()
|
||||
{
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
return "openTx for 9X board";
|
||||
return "OpenTX for 9X board";
|
||||
case BOARD_M128:
|
||||
return "openTx for M128 / 9X board";
|
||||
return "OpenTX for M128 / 9X board";
|
||||
case BOARD_GRUVIN9X:
|
||||
return "openTx for Gruvin9x board / 9X";
|
||||
return "OpenTX for Gruvin9x board / 9X";
|
||||
case BOARD_TARANIS:
|
||||
return "openTx for FrSky Taranis";
|
||||
return "OpenTX for FrSky Taranis";
|
||||
case BOARD_TARANIS_REV4a:
|
||||
return "openTx for FrSky Taranis Rev4a";
|
||||
return "OpenTX for FrSky Taranis Rev4a";
|
||||
case BOARD_SKY9X:
|
||||
return "openTx for Sky9x board / 9X";
|
||||
return "OpenTX for Sky9x board / 9X";
|
||||
default:
|
||||
return "openTx for an unknown board";
|
||||
return "OpenTX for an unknown board";
|
||||
}
|
||||
}
|
||||
|
||||
const int Open9xInterface::getEEpromSize()
|
||||
const int OpenTxInterface::getEEpromSize()
|
||||
{
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
@@ -97,7 +94,7 @@ const int Open9xInterface::getEEpromSize()
|
||||
}
|
||||
}
|
||||
|
||||
const int Open9xInterface::getMaxModels()
|
||||
const int OpenTxInterface::getMaxModels()
|
||||
{
|
||||
if (IS_ARM(board))
|
||||
return 60;
|
||||
@@ -110,7 +107,7 @@ const int Open9xInterface::getMaxModels()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Open9xInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
|
||||
bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
|
||||
{
|
||||
T _model;
|
||||
|
||||
@@ -143,7 +140,7 @@ bool Open9xInterface::loadModel(ModelData &model, uint8_t *data, int index, unsi
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Open9xInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
|
||||
bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant)
|
||||
{
|
||||
T open9xModel(model, board, version, variant);
|
||||
|
||||
@@ -170,7 +167,7 @@ bool Open9xInterface::loadModelVariant(unsigned int index, ModelData &model, uin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Open9xInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
|
||||
bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
|
||||
{
|
||||
if (version == 201) {
|
||||
return loadModel<Open9xModelData_v201>(model, data, index, stickMode);
|
||||
@@ -239,11 +236,11 @@ bool Open9xInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data
|
||||
return loadModel<Open9xArmModelData_v212>(model, data, index);
|
||||
}
|
||||
else {
|
||||
return loadModelVariant<Open9xModelDataNew>(index, model, data, version, variant);
|
||||
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
|
||||
}
|
||||
}
|
||||
else if (version >= 213) {
|
||||
return loadModelVariant<Open9xModelDataNew>(index, model, data, version, variant);
|
||||
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
|
||||
}
|
||||
|
||||
std::cout << " ko\n";
|
||||
@@ -251,7 +248,7 @@ bool Open9xInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Open9xInterface::loadGeneral(GeneralSettings &settings, unsigned int version)
|
||||
bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int version)
|
||||
{
|
||||
QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct
|
||||
T open9xSettings(settings, board, version);
|
||||
@@ -267,7 +264,7 @@ bool Open9xInterface::loadGeneral(GeneralSettings &settings, unsigned int versio
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Open9xInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant)
|
||||
bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant)
|
||||
{
|
||||
T open9xSettings(settings, board, version, variant);
|
||||
// open9xSettings.Dump();
|
||||
@@ -278,7 +275,7 @@ bool Open9xInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, ui
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Open9xInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
|
||||
bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
|
||||
{
|
||||
T open9xModel(model, board, version, variant);
|
||||
// open9xModel.Dump();
|
||||
@@ -288,12 +285,12 @@ bool Open9xInterface::saveModel(unsigned int index, ModelData &model, unsigned i
|
||||
return (sz == eeprom.size());
|
||||
}
|
||||
|
||||
bool Open9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import...";
|
||||
|
||||
@@ -308,8 +305,9 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
if (notnull) {
|
||||
std::cout << " wrong size (" << size << ")\n";
|
||||
return false;
|
||||
} else {
|
||||
QMessageBox::warning(NULL,"companion9x", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(NULL, "companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
size=2048;
|
||||
}
|
||||
} else {
|
||||
@@ -318,7 +316,7 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
}
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, board)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) {
|
||||
std::cout << " wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
@@ -338,7 +336,7 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!loadGeneral<Open9xGeneralDataNew>(radioData.generalSettings, version)) {
|
||||
if (!loadGeneral<OpenTxGeneralData>(radioData.generalSettings, version)) {
|
||||
std::cout << " ko\n";
|
||||
return false;
|
||||
}
|
||||
@@ -354,7 +352,7 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return true;
|
||||
}
|
||||
|
||||
int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
{
|
||||
EEPROMWarnings.clear();
|
||||
|
||||
@@ -385,14 +383,14 @@ int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
|
||||
variant |= M128_VARIANT;
|
||||
}
|
||||
|
||||
int result = saveGeneral<Open9xGeneralDataNew>(radioData.generalSettings, board, version, variant);
|
||||
int result = saveGeneral<OpenTxGeneralData>(radioData.generalSettings, board, version, variant);
|
||||
if (!result) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
if (!radioData.models[i].isempty()) {
|
||||
result = saveModel<Open9xModelDataNew>(i, radioData.models[i], version, variant);
|
||||
result = saveModel<OpenTxModelData>(i, radioData.models[i], version, variant);
|
||||
if (!result) {
|
||||
return 0;
|
||||
}
|
||||
@@ -407,7 +405,7 @@ int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
|
||||
return size;
|
||||
}
|
||||
|
||||
int Open9xInterface::getSize(ModelData &model)
|
||||
int OpenTxInterface::getSize(ModelData &model)
|
||||
{
|
||||
if (board == BOARD_SKY9X)
|
||||
return 0;
|
||||
@@ -419,7 +417,7 @@ int Open9xInterface::getSize(ModelData &model)
|
||||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
|
||||
|
||||
Open9xModelDataNew open9xModel(model, board, 255, GetCurrentFirmwareVariant());
|
||||
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmwareVariant());
|
||||
|
||||
QByteArray eeprom;
|
||||
open9xModel.Export(eeprom);
|
||||
@@ -430,7 +428,7 @@ int Open9xInterface::getSize(ModelData &model)
|
||||
return efile->size(0);
|
||||
}
|
||||
|
||||
int Open9xInterface::getSize(GeneralSettings &settings)
|
||||
int OpenTxInterface::getSize(GeneralSettings &settings)
|
||||
{
|
||||
if (board == BOARD_SKY9X)
|
||||
return 0;
|
||||
@@ -438,7 +436,7 @@ int Open9xInterface::getSize(GeneralSettings &settings)
|
||||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
|
||||
|
||||
Open9xGeneralDataNew open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
|
||||
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
|
||||
// open9xGeneral.Dump();
|
||||
|
||||
QByteArray eeprom;
|
||||
@@ -450,7 +448,7 @@ int Open9xInterface::getSize(GeneralSettings &settings)
|
||||
return efile->size(0);
|
||||
}
|
||||
|
||||
int Open9xInterface::getCapability(const Capability capability)
|
||||
int OpenTxInterface::getCapability(const Capability capability)
|
||||
{
|
||||
switch (capability) {
|
||||
case OwnerName:
|
||||
@@ -460,11 +458,6 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
case SimulatorType:
|
||||
if (IS_TARANIS(board))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
case HasBeeper:
|
||||
if (IS_ARM(board))
|
||||
return 0;
|
||||
@@ -517,24 +510,20 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
case minuteBeep:
|
||||
return 1;
|
||||
case countdownBeep:
|
||||
return 1;
|
||||
case Pots:
|
||||
return (IS_TARANIS(board) ? 4 : 3);
|
||||
return (IS_TARANIS(board) ? 5 : 3);
|
||||
case Switches:
|
||||
return (IS_TARANIS(board) ? 8 : 7);
|
||||
case SwitchesPositions:
|
||||
return (IS_TARANIS(board) ? 22 : 9);
|
||||
case CustomFunctions:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
return 64;
|
||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||
return 24;
|
||||
else
|
||||
return 16;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||
@@ -543,10 +532,10 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 12;
|
||||
case CustomAndSwitches:
|
||||
if (IS_ARM(board))
|
||||
return getCapability(CustomSwitches);
|
||||
return getCapability(LogicalSwitches);
|
||||
else
|
||||
return 15/*4bits*/-9/*sw positions*/;
|
||||
case CustomSwitchesExt:
|
||||
case LogicalSwitchesExt:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
case RotaryEncoders:
|
||||
if (board == BOARD_GRUVIN9X)
|
||||
@@ -562,7 +551,7 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
case VoicesAsNumbers:
|
||||
return (IS_ARM(board) ? 0 : 1);
|
||||
case VoicesMaxLength:
|
||||
return (IS_ARM(board) ? (IS_TARANIS(board) ? 10 : 6) : 0);
|
||||
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : 0);
|
||||
case MultiLangVoice:
|
||||
return (IS_ARM(board) ? 1 : 0);
|
||||
case SoundPitch:
|
||||
@@ -598,14 +587,10 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 1;
|
||||
case ExtendedTrims:
|
||||
return 500;
|
||||
case ExtraTrims:
|
||||
return 1;
|
||||
case Simulation:
|
||||
return 1;
|
||||
case DSM2Indexes:
|
||||
return 1;
|
||||
case FSSwitch:
|
||||
return 1;
|
||||
case MixesWithoutExpo:
|
||||
return 1;
|
||||
case NumCurves:
|
||||
@@ -622,24 +607,12 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
|
||||
case TelemetryBars:
|
||||
return 1;
|
||||
case TelemetryCSFields:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 36;
|
||||
} else {
|
||||
return IS_ARM(board) ? 24 : 16;
|
||||
}
|
||||
case TelemetryColsCSFields:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 3;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
case TelemetryCustomScreens:
|
||||
return IS_TARANIS(board) ? 3 : 2;
|
||||
case TelemetryCustomScreensFieldsPerLine:
|
||||
return IS_TARANIS(board) ? 3 : 2;
|
||||
case NoTelemetryProtocol:
|
||||
if (IS_TARANIS(board)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return IS_TARANIS(board) ? 1 : 0;
|
||||
case TelemetryUnits:
|
||||
return 0;
|
||||
case TelemetryBlades:
|
||||
@@ -695,18 +668,37 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return (IS_TARANIS(board) ? 212 : 128) ;
|
||||
case GetThrSwitch:
|
||||
return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ;
|
||||
case HasDisplayText:
|
||||
case VirtualInputs:
|
||||
return IS_TARANIS(board) ? 32 : 0;
|
||||
case TrainerInputs:
|
||||
return IS_ARM(board) ? 16 : 8;
|
||||
case LuaInputs:
|
||||
case LimitsPer1000:
|
||||
case EnhancedCurves:
|
||||
case TelemetryInternalAlarms:
|
||||
return IS_TARANIS(board);
|
||||
case HasFasOffset:
|
||||
return (IS_STOCK(board) ? false : true);
|
||||
case HasMahPersistent:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
case MultiposPots:
|
||||
return IS_TARANIS(board) ? 3 : 0;
|
||||
case MultiposPotsPositions:
|
||||
return IS_TARANIS(board) ? 6 : 0;
|
||||
case SimulatorVariant:
|
||||
if (board == BOARD_STOCK)
|
||||
return SIMU_STOCK_VARIANTS;
|
||||
else if (board == BOARD_M128)
|
||||
return SIMU_M128_VARIANTS;
|
||||
else
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Open9xInterface::isAvailable(Protocol proto, int port)
|
||||
int OpenTxInterface::isAvailable(Protocol proto, int port)
|
||||
{
|
||||
if (IS_TARANIS(board)) {
|
||||
switch (port) {
|
||||
@@ -791,7 +783,7 @@ int Open9xInterface::isAvailable(Protocol proto, int port)
|
||||
}
|
||||
}
|
||||
|
||||
SimulatorInterface * Open9xInterface::getSimulator()
|
||||
SimulatorInterface * OpenTxInterface::getSimulator()
|
||||
{
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
@@ -803,7 +795,6 @@ SimulatorInterface * Open9xInterface::getSimulator()
|
||||
case BOARD_SKY9X:
|
||||
return new Open9xSky9xSimulator(this);
|
||||
case BOARD_TARANIS:
|
||||
return new OpentxTaranisSimulator(this);
|
||||
case BOARD_TARANIS_REV4a:
|
||||
return new OpentxTaranisSimulator(this);
|
||||
default:
|
||||
@@ -816,7 +807,7 @@ size_t getSizeA(T (&)[SIZE]) {
|
||||
return SIZE;
|
||||
}
|
||||
|
||||
bool Open9xInterface::checkVersion(unsigned int version)
|
||||
bool OpenTxInterface::checkVersion(unsigned int version)
|
||||
{
|
||||
switch(version) {
|
||||
case 201:
|
||||
@@ -882,7 +873,7 @@ bool Open9xInterface::checkVersion(unsigned int version)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Open9xInterface::checkVariant(unsigned int version, unsigned int variant)
|
||||
bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant)
|
||||
{
|
||||
if (board == BOARD_M128 && !(variant & 0x8000)) {
|
||||
if (version == 212) {
|
||||
@@ -904,7 +895,7 @@ bool Open9xInterface::checkVariant(unsigned int version, unsigned int variant)
|
||||
}
|
||||
}
|
||||
|
||||
bool Open9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::cout << "trying " << getName() << " backup import...";
|
||||
|
||||
@@ -947,14 +938,11 @@ bool Open9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
|
||||
|
||||
QString geturl( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
int server = settings.value("fwserver", 0).toInt();
|
||||
if (server >= o9xservers.count()) {
|
||||
server = 0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url= OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
@@ -975,27 +963,24 @@ QString geturl( int board)
|
||||
|
||||
QString getstamp( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
int server = settings.value("fwserver",0).toInt();
|
||||
if (server >=o9xservers.count()) {
|
||||
server=0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
url.append("/binaries/stamp-opentx-");
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url= OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
url.append("/stamp-opentx-");
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
url.append("stock.txt");
|
||||
url.append("9x.txt");
|
||||
break;
|
||||
case BOARD_M128:
|
||||
url.append("stock128.txt");
|
||||
url.append("9x128.txt");
|
||||
break;
|
||||
case BOARD_GRUVIN9X:
|
||||
url.append("v4.txt");
|
||||
url.append("gruvin9x.txt");
|
||||
break;
|
||||
case BOARD_SKY9X:
|
||||
url.append("arm.txt");
|
||||
url.append("sky9x.txt");
|
||||
break;
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_REV4a:
|
||||
@@ -1010,16 +995,13 @@ QString getstamp( int board)
|
||||
|
||||
QString getrnurl( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
int server = settings.value("fwserver",0).toInt();
|
||||
if (server >=o9xservers.count()) {
|
||||
server=0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
url.append("/docs/releasenotes-");
|
||||
switch(board) {
|
||||
QString url = g.compileServer();
|
||||
if (url.isEmpty()){
|
||||
url= OPENTX_FIRMWARE_DOWNLOADS;
|
||||
g.compileServer(url);
|
||||
}
|
||||
url.append("/releasenotes-");
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
case BOARD_GRUVIN9X:
|
||||
@@ -1046,7 +1028,7 @@ void RegisterOpen9xFirmwares()
|
||||
Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
|
||||
/* 9x board */
|
||||
open9x = new Open9xFirmware("opentx-stock", QObject::tr("openTx for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1078,11 +1060,12 @@ void RegisterOpen9xFirmwares()
|
||||
open9x->addOption("novario", QObject::tr("No vario support"));
|
||||
open9x->addOption("nogps", QObject::tr("No GPS support"));
|
||||
open9x->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
|
||||
open9x->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
|
||||
open9x->addOptions(fai_options);
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
open9x = new Open9xFirmware("opentx-stock128", QObject::tr("openTx for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1114,7 +1097,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9XR board */
|
||||
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("openTx for 9XR"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false);
|
||||
open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false);
|
||||
open9x->addOptions(extr_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1148,7 +1131,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9XR board with M128 chip */
|
||||
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("openTx for 9XR with M128 chip"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x->addOptions(extr_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1178,7 +1161,7 @@ void RegisterOpen9xFirmwares()
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
/* Gruvin9x board */
|
||||
open9x = new Open9xFirmware("opentx-v4", QObject::tr("openTx for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new OpenTxInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x->setVariantBase(FRSKY_VARIANT);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1208,7 +1191,7 @@ void RegisterOpen9xFirmwares()
|
||||
|
||||
#ifndef __APPLE__
|
||||
/* SKY9X board */
|
||||
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("openTx for Sky9x board / 9X"), new Open9xInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true);
|
||||
open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new OpenTxInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true);
|
||||
open9x->setVariantBase(FRSKY_VARIANT);
|
||||
open9x->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1233,7 +1216,7 @@ void RegisterOpen9xFirmwares()
|
||||
#endif
|
||||
|
||||
/* Taranis board */
|
||||
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("openTx for FrSky Taranis"), new Open9xInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true);
|
||||
open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new OpenTxInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true);
|
||||
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
|
||||
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
@@ -1242,10 +1225,8 @@ void RegisterOpen9xFirmwares()
|
||||
open9x->addOptions(fai_options);
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
int rev4a = settings.value("rev4asupport",0).toInt();
|
||||
if (rev4a) {
|
||||
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("openTx for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
|
||||
if (g.rev4aSupport()) {
|
||||
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new OpenTxInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
|
||||
open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu"));
|
||||
open9x->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
|
||||
@@ -18,15 +18,18 @@
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads.open-tx.org/companion"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads.open-tx.org/firmware"
|
||||
|
||||
class EFile;
|
||||
|
||||
class Open9xInterface : public EEPROMInterface
|
||||
class OpenTxInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
Open9xInterface(BoardEnum board);
|
||||
OpenTxInterface(BoardEnum board);
|
||||
|
||||
virtual ~Open9xInterface();
|
||||
virtual ~OpenTxInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
@@ -34,7 +37,7 @@ class Open9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
@@ -91,6 +94,7 @@ class Open9xFirmware: public FirmwareInfo {
|
||||
addLanguage("se");
|
||||
addLanguage("cz");
|
||||
addLanguage("es");
|
||||
addLanguage("pl");
|
||||
addLanguage("pt");
|
||||
|
||||
addTTSLanguage("en");
|
||||
@@ -100,6 +104,7 @@ class Open9xFirmware: public FirmwareInfo {
|
||||
addTTSLanguage("se");
|
||||
addTTSLanguage("cz");
|
||||
addTTSLanguage("sk");
|
||||
addTTSLanguage("pl");
|
||||
addTTSLanguage("pt");
|
||||
addTTSLanguage("es");
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ uint8_t getStickMode()
|
||||
|
||||
using namespace Open9x;
|
||||
|
||||
Open9xSimulator::Open9xSimulator(Open9xInterface * open9xInterface):
|
||||
Open9xSimulator::Open9xSimulator(OpenTxInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
#define INIT_IMPORT
|
||||
@@ -132,13 +132,20 @@ bool Open9xSimulator::lcdChanged(bool & lightEnable)
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void Open9xSimulator::start(RadioData &radioData, bool tests)
|
||||
void Open9xSimulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS);
|
||||
memcpy(&Open9x::eeprom[0], eeprom.data(), 2048);
|
||||
StartEepromThread(NULL);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xSimulator::start(const char * filename, bool tests)
|
||||
{
|
||||
// open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS);
|
||||
StartEepromThread(filename);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void Open9xSimulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
|
||||
@@ -19,15 +19,17 @@
|
||||
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
class Open9xInterface;
|
||||
class OpenTxInterface;
|
||||
|
||||
class Open9xSimulator : public SimulatorInterface {
|
||||
|
||||
public:
|
||||
|
||||
Open9xSimulator(Open9xInterface *);
|
||||
Open9xSimulator(OpenTxInterface *);
|
||||
|
||||
virtual void start(RadioData &radioData, bool tests);
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
virtual void stop();
|
||||
|
||||
@@ -53,7 +55,7 @@ class Open9xSimulator : public SimulatorInterface {
|
||||
|
||||
protected:
|
||||
|
||||
Open9xInterface * open9xInterface;
|
||||
OpenTxInterface * open9xInterface;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Automatically generated file (CMake) - do not edit
|
||||
#define DATE_STR "@DATE@"
|
||||
#define TIME_STR "@TIME@"
|
||||
#define VERS_STR "c9x"
|
||||
#define SVN_STR "@FIRMWARE@-r@G9X_WC_REVISION@"
|
||||
#define VERS_STR "@C9X_VERSION@"
|
||||
#define MOD_STR "FH"
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
#include "helpers.h"
|
||||
#include "th9xeeprom.h"
|
||||
|
||||
int8_t th9xFromSwitch(const RawSwitch & sw)
|
||||
{
|
||||
switch (sw.type) {
|
||||
case SWITCH_TYPE_SWITCH:
|
||||
return sw.index;
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return sw.index > 0 ? (9 + sw.index) : (-9 -sw.index);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
RawSwitch th9xToSwitch(int8_t sw)
|
||||
{
|
||||
if (sw == 0)
|
||||
@@ -181,22 +169,22 @@ t_Th9xMixData::operator MixData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xCustomSwData::operator CustomSwData ()
|
||||
t_Th9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
CustomSwData c9x;
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = opCmp;
|
||||
c9x.val1 = val1;
|
||||
c9x.val2 = val2;
|
||||
|
||||
if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = toSource(val1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_EQUAL) {
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = toSource(val2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = th9xToSwitch(val1).toValue();
|
||||
c9x.val2 = th9xToSwitch(val2).toValue();
|
||||
}
|
||||
@@ -204,7 +192,7 @@ t_Th9xCustomSwData::operator CustomSwData ()
|
||||
return c9x;
|
||||
}
|
||||
|
||||
int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
||||
int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||
{
|
||||
int v1 = 0;
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
@@ -228,7 +216,7 @@ int8_t t_Th9xCustomSwData::fromSource(RawSource source)
|
||||
return v1;
|
||||
}
|
||||
|
||||
RawSource t_Th9xCustomSwData::toSource(int8_t value)
|
||||
RawSource t_Th9xLogicalSwitchData::toSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
@@ -266,7 +254,7 @@ t_Th9xModelData::operator ModelData ()
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
switch(tmrMode) {
|
||||
/*switch(tmrMode) {
|
||||
case 1:
|
||||
c9x.timers[0].mode = TMRMODE_ABS;
|
||||
break;
|
||||
@@ -279,7 +267,7 @@ t_Th9xModelData::operator ModelData ()
|
||||
default:
|
||||
c9x.timers[0].mode = TMRMODE_OFF;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
// c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
/*c9x.protocol = (Protocol)protocol;
|
||||
|
||||
@@ -138,18 +138,18 @@ PACK(typedef struct t_Th9xMixData {
|
||||
t_Th9xMixData();
|
||||
}) Th9xMixData;
|
||||
|
||||
PACK(typedef struct t_Th9xCustomSwData {
|
||||
PACK(typedef struct t_Th9xLogicalSwitchData {
|
||||
uint8_t sw:3; // 0..7
|
||||
uint8_t opCmp:2; // < & | ^
|
||||
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
|
||||
int8_t val1;
|
||||
int8_t val2;
|
||||
|
||||
operator CustomSwData();
|
||||
t_Th9xCustomSwData() { memset(this, 0, sizeof(t_Th9xCustomSwData)); }
|
||||
operator LogicalSwitchData();
|
||||
t_Th9xLogicalSwitchData() { memset(this, 0, sizeof(t_Th9xLogicalSwitchData)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Th9xCustomSwData;
|
||||
}) Th9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Th9xTrimData {
|
||||
int8_t itrim:6; //trim index
|
||||
@@ -173,7 +173,7 @@ PACK(typedef struct t_Th9xModelData {
|
||||
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
|
||||
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
|
||||
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
|
||||
Th9xCustomSwData switchTab[TH9X_MAX_SWITCHES];//
|
||||
Th9xLogicalSwitchData switchTab[TH9X_MAX_SWITCHES];//
|
||||
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
|
||||
operator ModelData();
|
||||
t_Th9xModelData();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "th9xeeprom.h"
|
||||
#include "th9xsimulator.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -44,8 +45,7 @@ const char * Th9xInterface::getName()
|
||||
|
||||
const int Th9xInterface::getEEpromSize()
|
||||
{
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ bool Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying th9x import... ";
|
||||
|
||||
@@ -71,7 +71,7 @@ bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) {
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ int Th9xInterface::getCapability(const Capability capability)
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
return 0;
|
||||
case CustomSwitches:
|
||||
case LogicalSwitches:
|
||||
return TH9X_MAX_SWITCHES;
|
||||
case Outputs:
|
||||
return 8;
|
||||
@@ -202,5 +202,5 @@ int Th9xInterface::isAvailable(Protocol proto, int port)
|
||||
|
||||
SimulatorInterface * Th9xInterface::getSimulator()
|
||||
{
|
||||
return new Th9xSimulator(this);
|
||||
return NULL; // new Th9xSimulator(this);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Th9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, uint8_t *eeprom, int size);
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ FlashInterface::FlashInterface(QString fileName)
|
||||
char * bin_flash = (char *)malloc(MAX_FSIZE);
|
||||
flash_size = file.read(bin_flash, MAX_FSIZE);
|
||||
flash = QByteArray(bin_flash, flash_size);
|
||||
free(bin_flash);
|
||||
free(bin_flash);
|
||||
}
|
||||
else {
|
||||
flash = QByteArray(temp, flash_size);
|
||||
@@ -413,7 +413,7 @@ bool FlashInterface::setSplash(const QImage & newsplash)
|
||||
}
|
||||
}
|
||||
|
||||
uint FlashInterface::getSplashWidth()
|
||||
int FlashInterface::getSplashWidth()
|
||||
{
|
||||
return splash_width;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
QImage getSplash();
|
||||
bool setSplash(const QImage & newsplash);
|
||||
bool hasSplash();
|
||||
uint getSplashWidth();
|
||||
int getSplashWidth();
|
||||
uint getSplashHeight();
|
||||
uint getSplashColors();
|
||||
QImage::Format getSplashFormat();
|
||||
@@ -92,5 +92,5 @@ private:
|
||||
protected:
|
||||
bool isValidFlag;
|
||||
};
|
||||
#endif /* FLASHINTERFACE_H */
|
||||
#endif /* FLASHINTERFACE_H */
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#include "fusesdialog.h"
|
||||
#include "ui_fusesdialog.h"
|
||||
|
||||
#include "burnconfigdialog.h"
|
||||
#include "helpers.h"
|
||||
|
||||
fusesDialog::fusesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::fusesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
}
|
||||
|
||||
fusesDialog::~fusesDialog()
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>Fuses</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/images/fuses.png</normaloff>:/images/fuses.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="readFuses">
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
#include "fwpreferencesdialog.h"
|
||||
#include "ui_fwpreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::fwPreferencesDialog),
|
||||
updateLock(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
|
||||
QCheckBox * OptionCheckBox[]= {
|
||||
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
|
||||
ui->optionCheckBox_8, ui->optionCheckBox_9, ui->optionCheckBox_10, ui->optionCheckBox_11, ui->optionCheckBox_12, ui->optionCheckBox_13, ui->optionCheckBox_14,
|
||||
ui->optionCheckBox_15,ui->optionCheckBox_16, ui->optionCheckBox_17, ui->optionCheckBox_18, ui->optionCheckBox_19, ui->optionCheckBox_20, ui->optionCheckBox_21,
|
||||
ui->optionCheckBox_22, ui->optionCheckBox_23, ui->optionCheckBox_24, ui->optionCheckBox_25, ui->optionCheckBox_26, ui->optionCheckBox_27, ui->optionCheckBox_28,
|
||||
ui->optionCheckBox_29, ui->optionCheckBox_30, ui->optionCheckBox_31, ui->optionCheckBox_32, ui->optionCheckBox_33, ui->optionCheckBox_34, ui->optionCheckBox_35,
|
||||
ui->optionCheckBox_36, ui->optionCheckBox_37, ui->optionCheckBox_38, ui->optionCheckBox_39, ui->optionCheckBox_40, ui->optionCheckBox_41, ui->optionCheckBox_42,
|
||||
NULL };
|
||||
|
||||
voice=NULL;
|
||||
|
||||
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
|
||||
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
|
||||
|
||||
for (int i=0; OptionCheckBox[i]; i++) {
|
||||
optionsCheckBoxes.push_back(OptionCheckBox[i]);
|
||||
connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
|
||||
}
|
||||
|
||||
initSettings();
|
||||
|
||||
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
|
||||
shrink();
|
||||
}
|
||||
|
||||
|
||||
fwPreferencesDialog::~fwPreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::showVoice(bool show)
|
||||
{
|
||||
if (show)
|
||||
showVoice();
|
||||
else
|
||||
hideVoice();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::showVoice()
|
||||
{
|
||||
ui->voiceLine->show();
|
||||
ui->voiceLabel->show();
|
||||
ui->voiceCombo->show();
|
||||
ui->voice_dnld->show();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::hideVoice()
|
||||
{
|
||||
ui->voiceLine->hide();
|
||||
ui->voiceLabel->hide();
|
||||
ui->voiceCombo->hide();
|
||||
ui->voice_dnld->hide();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::baseFirmwareChanged()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
voice=NULL;
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
showVoice(firmware->voice);
|
||||
populateFirmwareOptions(firmware);
|
||||
break;
|
||||
}
|
||||
}
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
bool voice=false;
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
QString id = firmware->id;
|
||||
foreach(QCheckBox *cb, optionsCheckBoxes) {
|
||||
if (cb->isChecked()) {
|
||||
if (cb->text()=="voice" && cb->isChecked())
|
||||
voice=true;
|
||||
id += QString("-") + cb->text();
|
||||
}
|
||||
}
|
||||
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) {
|
||||
if (ui->voiceCombo->count() && (voice || firmware->voice))
|
||||
id += QString("-tts") + ui->voiceCombo->currentText();
|
||||
}
|
||||
if (ui->langCombo->count())
|
||||
id += QString("-") + ui->langCombo->currentText();
|
||||
|
||||
return GetFirmwareVariant(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Should never occur...
|
||||
return default_firmware_variant;
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareOptionChanged(bool state)
|
||||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
FirmwareInfo * firmware=NULL;
|
||||
if (cb && state) {
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
foreach(firmware, firmwares) {
|
||||
if (firmware->id == selected_firmware) {
|
||||
foreach(QList<Option> opts, firmware->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (cb->text() == opt.name) {
|
||||
foreach(Option other, opts) {
|
||||
if (other.name != opt.name) {
|
||||
foreach(QCheckBox *ocb, optionsCheckBoxes) {
|
||||
if (ocb->text() == other.name)
|
||||
ocb->setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (voice) {
|
||||
showVoice(voice->isChecked());
|
||||
}
|
||||
|
||||
return firmwareChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (cb && !state) {
|
||||
if (cb->text()=="voice") {
|
||||
hideVoice();
|
||||
}
|
||||
}
|
||||
if (voice) {
|
||||
showVoice(voice->isChecked());
|
||||
} else if (firmware) {
|
||||
if (firmware->voice) {
|
||||
showVoice();
|
||||
}
|
||||
}
|
||||
return firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareLangChanged()
|
||||
{
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::firmwareChanged()
|
||||
{
|
||||
if (updateLock)
|
||||
return;
|
||||
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
QString stamp;
|
||||
stamp.append(variant.firmware->stamp);
|
||||
ui->fw_dnld->setEnabled(!variant.firmware->getUrl(variant.id).isNull());
|
||||
QString url=variant.firmware->getUrl(variant.id);
|
||||
// B-Plan
|
||||
if (false) {
|
||||
ui->CPU_ID_LE->show();
|
||||
ui->CPU_ID_LABEL->show();
|
||||
} else {
|
||||
ui->CPU_ID_LE->hide();
|
||||
ui->CPU_ID_LABEL->hide();
|
||||
}
|
||||
int fwrev = g.fwRev.get(variant.id);
|
||||
if (fwrev != 0) {
|
||||
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
|
||||
if (!stamp.isEmpty()) {
|
||||
ui->checkFWUpdates->show();
|
||||
} else {
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ui->fw_dnld->isEnabled()) {
|
||||
ui->FwInfo->setText(tr("The selected firmware has never been downloaded by Companion."));
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
else {
|
||||
ui->FwInfo->setText(tr("The selected firmware cannot be downloaded by Companion."));
|
||||
ui->checkFWUpdates->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::writeValues()
|
||||
{
|
||||
g.cpuId( ui->CPU_ID_LE->text() );
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
g.profile[g.id()].fwType( current_firmware_variant.id );
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
|
||||
{
|
||||
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware;
|
||||
|
||||
updateLock = true;
|
||||
|
||||
ui->langCombo->clear();
|
||||
foreach(const char *lang, parent->languages) {
|
||||
ui->langCombo->addItem(lang);
|
||||
if (current_firmware_variant.id.endsWith(lang))
|
||||
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
|
||||
}
|
||||
ui->voiceCombo->clear();
|
||||
foreach(const char *lang, parent->ttslanguages) {
|
||||
ui->voiceCombo->addItem(lang);
|
||||
if (current_firmware_variant.id.contains(QString("-tts%1").arg(lang)))
|
||||
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
|
||||
}
|
||||
|
||||
showVoice(ui->langCombo->count()!=0);
|
||||
|
||||
int index = 0;
|
||||
foreach(QList<Option> opts, parent->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (index >= optionsCheckBoxes.size()) {
|
||||
qDebug() << "This firmware needs more options checkboxes!";
|
||||
}
|
||||
else {
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index++);
|
||||
if (cb) {
|
||||
cb->show();
|
||||
cb->setText(opt.name);
|
||||
cb->setToolTip(opt.tooltip);
|
||||
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
if (opt.name==QString("voice")) {
|
||||
voice=cb;
|
||||
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; index<optionsCheckBoxes.size(); index++) {
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index);
|
||||
cb->hide();
|
||||
cb->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
updateLock = false;
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::initSettings()
|
||||
{
|
||||
ui->CPU_ID_LE->setText(g.cpuId());
|
||||
FirmwareInfo * current_firmware = GetCurrentFirmware();
|
||||
|
||||
foreach(FirmwareInfo * firmware, firmwares) {
|
||||
ui->downloadVerCB->addItem(firmware->name, firmware->id);
|
||||
if (current_firmware == firmware) {
|
||||
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
baseFirmwareChanged();
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_checkFWUpdates_clicked()
|
||||
{
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
if (g.profile[g.id()].burnFirmware()) {
|
||||
current_firmware_variant = variant;
|
||||
g.profile[g.id()].fwType( variant.id );
|
||||
}
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->checkForUpdates(true, variant.id);
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_fw_dnld_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
writeValues();
|
||||
if (!variant.firmware->getUrl(variant.id).isNull()) {
|
||||
if (g.profile[g.id()].burnFirmware()) {
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
g.profile[g.id()].fwType( current_firmware_variant.id );
|
||||
}
|
||||
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
|
||||
}
|
||||
firmwareChanged();
|
||||
}
|
||||
|
||||
void fwPreferencesDialog::on_voice_dnld_clicked()
|
||||
{
|
||||
QString url="http://fw.opentx.it/voices/";
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
url.append(QString("%1/%2/").arg(variant.firmware->id).arg(ui->voiceCombo->currentText()));
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef FWPREFERENCESDIALOG_H
|
||||
#define FWPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class fwPreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class fwPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit fwPreferencesDialog(QWidget *parent = 0);
|
||||
~fwPreferencesDialog();
|
||||
|
||||
private:
|
||||
Ui::fwPreferencesDialog *ui;
|
||||
QList<QCheckBox *> optionsCheckBoxes;
|
||||
bool updateLock;
|
||||
|
||||
void showVoice(bool);
|
||||
void showVoice();
|
||||
void hideVoice();
|
||||
void populateLocale();
|
||||
void populateFirmwareOptions(const FirmwareInfo *);
|
||||
FirmwareVariant getFirmwareVariant();
|
||||
void initSettings();
|
||||
QCheckBox * voice;
|
||||
|
||||
private slots:
|
||||
void shrink();
|
||||
void writeValues();
|
||||
void firmwareLangChanged();
|
||||
void baseFirmwareChanged();
|
||||
void firmwareOptionChanged(bool state);
|
||||
void firmwareChanged();
|
||||
void on_fw_dnld_clicked();
|
||||
void on_voice_dnld_clicked();
|
||||
void on_checkFWUpdates_clicked();
|
||||
};
|
||||
|
||||
#endif // FWPREFERENCESDIALOG_H
|
||||
@@ -0,0 +1,833 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>fwPreferencesDialog</class>
|
||||
<widget class="QDialog" name="fwPreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>620</width>
|
||||
<height>437</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Downloads</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="38" column="5">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_14">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_32">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_16">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="langLabel">
|
||||
<property name="text">
|
||||
<string>Menu Language</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_37">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_29">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_12">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="downloadVerCB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QComboBox" name="langCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="CPU_ID_LE"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmware Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_28">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_42">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_17">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_35">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_36">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_13">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_26">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_41">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_18">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_21">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_20">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_33">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_24">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_23">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_22">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_38">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_34">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_31">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_30">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_27">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QPushButton" name="checkFWUpdates">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0">
|
||||
<widget class="QLabel" name="voiceLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Voice Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="2">
|
||||
<widget class="QComboBox" name="voiceCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set language of voice.
|
||||
May be different from firmware language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="5">
|
||||
<widget class="QPushButton" name="voice_dnld">
|
||||
<property name="text">
|
||||
<string>Download Voice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="3">
|
||||
<widget class="QCheckBox" name="optionCheckBox_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="5">
|
||||
<widget class="QPushButton" name="fw_dnld">
|
||||
<property name="text">
|
||||
<string>Download FW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_19">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2">
|
||||
<widget class="QCheckBox" name="optionCheckBox_25">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="CPU_ID_LABEL">
|
||||
<property name="text">
|
||||
<string>Processor ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="4">
|
||||
<widget class="QCheckBox" name="optionCheckBox_39">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" colspan="4">
|
||||
<widget class="QLabel" name="FwInfo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FwInfo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="5">
|
||||
<widget class="QCheckBox" name="optionCheckBox_40">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1" colspan="5">
|
||||
<widget class="Line" name="voiceLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="37" column="1" colspan="5">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>downloadVerCB</tabstop>
|
||||
<tabstop>CPU_ID_LE</tabstop>
|
||||
<tabstop>langCombo</tabstop>
|
||||
<tabstop>optionCheckBox_2</tabstop>
|
||||
<tabstop>optionCheckBox_1</tabstop>
|
||||
<tabstop>optionCheckBox_3</tabstop>
|
||||
<tabstop>optionCheckBox_4</tabstop>
|
||||
<tabstop>optionCheckBox_5</tabstop>
|
||||
<tabstop>optionCheckBox_6</tabstop>
|
||||
<tabstop>optionCheckBox_7</tabstop>
|
||||
<tabstop>optionCheckBox_8</tabstop>
|
||||
<tabstop>optionCheckBox_9</tabstop>
|
||||
<tabstop>optionCheckBox_10</tabstop>
|
||||
<tabstop>optionCheckBox_11</tabstop>
|
||||
<tabstop>optionCheckBox_12</tabstop>
|
||||
<tabstop>optionCheckBox_13</tabstop>
|
||||
<tabstop>optionCheckBox_14</tabstop>
|
||||
<tabstop>optionCheckBox_15</tabstop>
|
||||
<tabstop>optionCheckBox_16</tabstop>
|
||||
<tabstop>optionCheckBox_17</tabstop>
|
||||
<tabstop>optionCheckBox_18</tabstop>
|
||||
<tabstop>optionCheckBox_19</tabstop>
|
||||
<tabstop>optionCheckBox_20</tabstop>
|
||||
<tabstop>optionCheckBox_21</tabstop>
|
||||
<tabstop>optionCheckBox_22</tabstop>
|
||||
<tabstop>optionCheckBox_23</tabstop>
|
||||
<tabstop>optionCheckBox_24</tabstop>
|
||||
<tabstop>optionCheckBox_25</tabstop>
|
||||
<tabstop>optionCheckBox_26</tabstop>
|
||||
<tabstop>optionCheckBox_27</tabstop>
|
||||
<tabstop>optionCheckBox_28</tabstop>
|
||||
<tabstop>optionCheckBox_29</tabstop>
|
||||
<tabstop>optionCheckBox_30</tabstop>
|
||||
<tabstop>optionCheckBox_31</tabstop>
|
||||
<tabstop>optionCheckBox_32</tabstop>
|
||||
<tabstop>optionCheckBox_33</tabstop>
|
||||
<tabstop>optionCheckBox_34</tabstop>
|
||||
<tabstop>optionCheckBox_35</tabstop>
|
||||
<tabstop>optionCheckBox_36</tabstop>
|
||||
<tabstop>optionCheckBox_37</tabstop>
|
||||
<tabstop>optionCheckBox_38</tabstop>
|
||||
<tabstop>optionCheckBox_39</tabstop>
|
||||
<tabstop>optionCheckBox_40</tabstop>
|
||||
<tabstop>optionCheckBox_41</tabstop>
|
||||
<tabstop>optionCheckBox_42</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>fwPreferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>370</x>
|
||||
<y>49</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>fwPreferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>390</x>
|
||||
<y>55</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "generaledit.h"
|
||||
#include "ui_generaledit.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include <QtGui>
|
||||
|
||||
#define MAX_PROFILES 10
|
||||
#define BIT_WARN_THR ( 0x01 )
|
||||
#define BIT_WARN_SW ( 0x02 )
|
||||
#define BIT_WARN_MEM ( 0x04 )
|
||||
@@ -18,20 +18,14 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
g_eeGeneral(radioData.generalSettings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":/icon.png"));
|
||||
this->setWindowIcon(CompanionIcon("open.png"));
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
ui->tabWidget->setCurrentIndex(settings.value("generalEditTab", 0).toInt());
|
||||
int profile_id=settings.value("profileId", 0).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profile_id);
|
||||
settings.beginGroup(profile);
|
||||
QString name=settings.value("Name","").toString();
|
||||
QString firmware_id = g.profile[g.id()].fwType();
|
||||
ui->tabWidget->setCurrentIndex( g.generalEditTab() );
|
||||
QString name=g.profile[g.id()].name();
|
||||
if (name.isEmpty()) {
|
||||
ui->calstore_PB->setDisabled(true);
|
||||
}
|
||||
settings.endGroup();
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL};
|
||||
QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
||||
@@ -64,7 +58,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
}
|
||||
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (int i=0; pmsl[i]; i++) {
|
||||
pmsl[i]->hide();
|
||||
}
|
||||
@@ -75,18 +70,14 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
}
|
||||
ui->profile_CB->clear();
|
||||
for ( int i = 0; i < MAX_PROFILES; ++i) {
|
||||
QString profile=QString("profile%1").arg(i+1);
|
||||
settings.beginGroup(profile);
|
||||
QString name=settings.value("Name","").toString();
|
||||
QString name=g.profile[i].name();
|
||||
if (!name.isEmpty()) {
|
||||
ui->profile_CB->addItem(name, i+1);
|
||||
if ((i+1)==profile_id) {
|
||||
ui->profile_CB->addItem(name, i);
|
||||
if (i==g.id()) {
|
||||
ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1);
|
||||
}
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
ui->ownerNameLE->setValidator(new QRegExpValidator(rx, this));
|
||||
@@ -373,6 +364,18 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
||||
for (int i=0; tpmsld[i]; i++) {
|
||||
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(MultiposPots)) {
|
||||
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
|
||||
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
|
||||
}
|
||||
else {
|
||||
ui->potsTypeSeparator->hide();
|
||||
ui->pot1Type->hide();
|
||||
ui->pot1TypeLabel->hide();
|
||||
ui->pot2Type->hide();
|
||||
ui->pot2TypeLabel->hide();
|
||||
}
|
||||
}
|
||||
|
||||
GeneralEdit::~GeneralEdit()
|
||||
@@ -380,6 +383,18 @@ GeneralEdit::~GeneralEdit()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GeneralEdit::on_pot1Type_currentIndexChanged(int index)
|
||||
{
|
||||
g_eeGeneral.potsType[0] = index;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
|
||||
{
|
||||
g_eeGeneral.potsType[1] = index;
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void GeneralEdit::unlockSwitchEdited()
|
||||
{
|
||||
int i=0;
|
||||
@@ -945,9 +960,7 @@ void GeneralEdit::on_PPM4_editingFinished()
|
||||
|
||||
void GeneralEdit::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
// TODO why er9x here
|
||||
QSettings settings("companion", "companion");
|
||||
settings.setValue("generalEditTab",index);//ui->tabWidget->currentIndex());
|
||||
g.generalEditTab(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -1195,31 +1208,23 @@ void GeneralEdit::on_swGEAChkB_stateChanged(int )
|
||||
|
||||
void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profile_id);
|
||||
settings.beginGroup(profile);
|
||||
QString calib=settings.value("StickPotCalib","").toString();
|
||||
QString calib=g.profile[profile_id].stickPotCalib();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
if (calib.isEmpty()) {
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
return;
|
||||
} else {
|
||||
QString trainercalib=settings.value("TrainerCalib","").toString();
|
||||
int8_t vBatCalib=(int8_t)settings.value("VbatCalib", g_eeGeneral.vBatCalib).toInt();
|
||||
int8_t currentCalib=(int8_t)settings.value("currentCalib", g_eeGeneral.currentCalib).toInt();
|
||||
int8_t PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", g_eeGeneral.PPM_Multiplier).toInt();
|
||||
uint8_t GSStickMode=(uint8_t)settings.value("GSStickMode", g_eeGeneral.stickMode).toUInt();
|
||||
uint8_t vBatWarn=(uint8_t)settings.value("vBatWarn",g_eeGeneral.vBatWarn).toUInt();
|
||||
QString DisplaySet=settings.value("Display","").toString();
|
||||
QString BeeperSet=settings.value("Beeper","").toString();
|
||||
QString HapticSet=settings.value("Haptic","").toString();
|
||||
QString SpeakerSet=settings.value("Speaker","").toString();
|
||||
QString CountrySet=settings.value("countryCode","").toString();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
QString trainercalib = g.profile[profile_id].trainerCalib();
|
||||
int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib();
|
||||
int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib();
|
||||
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
|
||||
uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
|
||||
uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
|
||||
QString DisplaySet = g.profile[profile_id].display();
|
||||
QString BeeperSet = g.profile[profile_id].beeper();
|
||||
QString HapticSet = g.profile[profile_id].haptic();
|
||||
QString SpeakerSet = g.profile[profile_id].speaker();
|
||||
QString CountrySet = g.profile[profile_id].countryCode();
|
||||
|
||||
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
|
||||
QString Byte;
|
||||
@@ -1312,27 +1317,20 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
|
||||
void GeneralEdit::on_calstore_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profile_id);
|
||||
settings.beginGroup(profile);
|
||||
QString name=settings.value("Name","").toString();
|
||||
|
||||
QString name=g.profile[profile_id].name();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
if (name.isEmpty()) {
|
||||
ui->calstore_PB->setDisabled(true);
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
return;
|
||||
} else {
|
||||
QString calib=settings.value("StickPotCalib","").toString();
|
||||
QString calib=g.profile[profile_id].stickPotCalib();
|
||||
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) ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::No) {
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1342,24 +1340,22 @@ void GeneralEdit::on_calstore_PB_clicked()
|
||||
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanNeg[i], 4, 16, QChar('0')));
|
||||
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanPos[i], 4, 16, QChar('0')));
|
||||
}
|
||||
settings.setValue("StickPotCalib",calib);
|
||||
g.profile[profile_id].stickPotCalib( calib );
|
||||
calib.clear();
|
||||
for (int i=0; i< 4; i++) {
|
||||
calib.append(QString("%1").arg((uint16_t)g_eeGeneral.trainer.calib[i], 4, 16, QChar('0')));
|
||||
}
|
||||
settings.setValue("TrainerCalib",calib);
|
||||
settings.setValue("VbatCalib",g_eeGeneral.vBatCalib);
|
||||
settings.setValue("currentCalib",g_eeGeneral.currentCalib);
|
||||
settings.setValue("vBatWarn",g_eeGeneral.vBatWarn);
|
||||
settings.setValue("PPM_Multiplier",g_eeGeneral.PPM_Multiplier);
|
||||
settings.setValue("GSStickMode",g_eeGeneral.stickMode);
|
||||
settings.setValue("Display",QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')));
|
||||
settings.setValue("Beeper",QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0')));
|
||||
settings.setValue("Haptic",QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
|
||||
settings.setValue("Speaker",QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
|
||||
settings.setValue("countryCode",QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
g.profile[profile_id].trainerCalib( calib );
|
||||
g.profile[profile_id].vBatCalib( g_eeGeneral.vBatCalib );
|
||||
g.profile[profile_id].currentCalib( g_eeGeneral.currentCalib );
|
||||
g.profile[profile_id].vBatWarn( g_eeGeneral.vBatWarn );
|
||||
g.profile[profile_id].ppmMultiplier( g_eeGeneral.PPM_Multiplier );
|
||||
g.profile[profile_id].gsStickMode( g_eeGeneral.stickMode );
|
||||
g.profile[profile_id].display( QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')) );
|
||||
g.profile[profile_id].beeper( QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0')));
|
||||
g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
|
||||
g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
|
||||
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
|
||||
QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,9 @@ private slots:
|
||||
void on_varioVolume_SL_valueChanged();
|
||||
void on_wavVolume_SL_valueChanged();
|
||||
|
||||
void on_pot1Type_currentIndexChanged(int index);
|
||||
void on_pot2Type_currentIndexChanged(int index);
|
||||
|
||||
void on_stickmodeCB_currentIndexChanged(int index);
|
||||
void on_channelorderCB_currentIndexChanged(int index);
|
||||
void on_beeperCB_currentIndexChanged(int index);
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>General Edit</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -110,7 +106,7 @@
|
||||
These will be relevant for all models in the same EEPROM.</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabSetup">
|
||||
<attribute name="title">
|
||||
@@ -759,122 +755,122 @@ This is used by the templated to determine which channel goes to what number out
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R E T A</string>
|
||||
<string>R E T A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R E A T</string>
|
||||
<string>R E A T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R T E A</string>
|
||||
<string>R T E A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R T A E</string>
|
||||
<string>R T A E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R A E T</string>
|
||||
<string>R A E T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">R A T E</string>
|
||||
<string>R A T E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E R T A</string>
|
||||
<string>E R T A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E R A T</string>
|
||||
<string>E R A T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E T R A</string>
|
||||
<string>E T R A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E T A R</string>
|
||||
<string>E T A R</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E A R T</string>
|
||||
<string>E A R T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">E A T R</string>
|
||||
<string>E A T R</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T R E A</string>
|
||||
<string>T R E A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T R A E</string>
|
||||
<string>T R A E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T E R A</string>
|
||||
<string>T E R A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T E A R</string>
|
||||
<string>T E A R</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T A R E</string>
|
||||
<string>T A R E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">T A E R</string>
|
||||
<string>T A E R</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A R E T</string>
|
||||
<string>A R E T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A R T E</string>
|
||||
<string>A R T E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A E R T</string>
|
||||
<string>A E R T</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A E T R</string>
|
||||
<string>A E T R</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A T R E</string>
|
||||
<string>A T R E</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">A T E R</string>
|
||||
<string>A T E R</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@@ -1559,10 +1555,10 @@ Acceptable values are 5v..10v</string>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
@@ -3494,6 +3490,91 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="4">
|
||||
<widget class="Line" name="potsTypeSeparator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="pot1Type">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Beeper volume
|
||||
|
||||
0 - Quiet. No beeps at all.
|
||||
1 - No Keys. Normal beeps but menu keys do not beep.
|
||||
2 - Normal.
|
||||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="pot1TypeLabel">
|
||||
<property name="text">
|
||||
<string>S1 Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="pot2Type">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Beeper volume
|
||||
|
||||
0 - Quiet. No beeps at all.
|
||||
1 - No Keys. Normal beeps but menu keys do not beep.
|
||||
2 - Normal.
|
||||
3 - Loud.
|
||||
4 - Extra loud.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="pot2TypeLabel">
|
||||
<property name="text">
|
||||
<string>S2 Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QtGui>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(CustomSwitches)-1)
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(LogicalSwitches)-1)
|
||||
|
||||
//convert from mode 1 to mode generalSettings.stickMode
|
||||
//NOTICE! => 1..4 -> 1..4
|
||||
@@ -23,12 +23,41 @@
|
||||
#define TRIM_OFF 1
|
||||
#define TRIM_OFFSET 2
|
||||
|
||||
#define TRIM_MODE_NONE 0x1F // 0b11111
|
||||
|
||||
void populateGvSourceCB(QComboBox *b, int value);
|
||||
void populateVoiceLangCB(QComboBox *b, QString language);
|
||||
void populateTTraceCB(QComboBox *b, int value);
|
||||
void populateRotEncCB(QComboBox *b, int value, int renumber);
|
||||
void populateBacklightCB(QComboBox *b, const uint8_t value);
|
||||
|
||||
QString getTheme();
|
||||
|
||||
class CompanionIcon: public QIcon {
|
||||
public:
|
||||
CompanionIcon(QString baseimage);
|
||||
};
|
||||
|
||||
class GVarGroup : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags=0);
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
void valuesChanged();
|
||||
|
||||
protected:
|
||||
QCheckBox *weightGV;
|
||||
QSpinBox *weightSB;
|
||||
QComboBox *weightCB;
|
||||
int & weight;
|
||||
const unsigned int flags;
|
||||
bool lock;
|
||||
};
|
||||
|
||||
class CurveGroup : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
@@ -53,47 +82,33 @@ class CurveGroup : public QObject {
|
||||
};
|
||||
|
||||
#define POPULATE_ONOFF 0x01
|
||||
#define POPULATE_MSWITCHES 0x02
|
||||
#define POPULATE_AND_SWITCHES 0x04
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0, UseContext context=DefaultContext);
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateRepeatCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
QString FuncParam(uint function, int value, QString paramT="",unsigned int adjustmode=0);
|
||||
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamArmTCB(QComboBox *b, ModelData * g_model, char * value, QStringList & paramsList);
|
||||
#define POPULATE_TIMER_MODES 0x02
|
||||
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0);
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateTrimUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
|
||||
void populateTimerSwitchCB(QComboBox *b, int value);
|
||||
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model);
|
||||
QString getProtocolStr(const int proto);
|
||||
QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||
|
||||
#define POPULATE_SOURCES 1
|
||||
#define POPULATE_TRIMS 2
|
||||
#define POPULATE_SWITCHES 4
|
||||
#define POPULATE_GVARS 8
|
||||
#define POPULATE_TELEMETRY 16
|
||||
#define POPULATE_TELEMETRYEXT 32
|
||||
#define POPULATE_SOURCES 1
|
||||
#define POPULATE_TRIMS 2
|
||||
#define POPULATE_SWITCHES 4
|
||||
#define POPULATE_GVARS 8
|
||||
#define POPULATE_TELEMETRY 16
|
||||
#define POPULATE_TELEMETRYEXT 32
|
||||
#define POPULATE_VIRTUAL_INPUTS 64
|
||||
|
||||
#define GVARS_VARIANT 0x0001
|
||||
#define FRSKY_VARIANT 0x0002
|
||||
|
||||
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
|
||||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, unsigned int flags);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
||||
void populateCSWCB(QComboBox *b, int value);
|
||||
QString getTimerMode(int tm);
|
||||
QString getTimerModeB(int tm);
|
||||
QString getPhaseName(int val, char * phasename=NULL);
|
||||
QString getStickStr(int index);
|
||||
QString getCSWFunc(int val);
|
||||
QString getFuncName(unsigned int val);
|
||||
QString getRepeatString(unsigned int val);
|
||||
QString getSignedStr(int value);
|
||||
QString getGVarString(int16_t val, bool sign=false);
|
||||
QString getInputStr(ModelData & model, int index);
|
||||
QString image2qstring(QImage image);
|
||||
QImage qstring2image(QString imagestr);
|
||||
int findmult(float value, float base);
|
||||
@@ -110,9 +125,16 @@ QString getFrSkyUnits(int units);
|
||||
QString getFrSkyProtocol(int protocol);
|
||||
QString getFrSkyMeasure(int units);
|
||||
QString getFrSkySrc(int index);
|
||||
float getBarValue(int barId, int value, FrSkyData *fd);
|
||||
float c9xexpou(float point, float coeff);
|
||||
float ValToTim(int value);
|
||||
int TimToVal(float value);
|
||||
|
||||
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
|
||||
|
||||
// Format a pixmap to fit on the radio using a specific firmware
|
||||
QPixmap makePixMap( QImage image, QString firmwareType );
|
||||
|
||||
// Return a radio type derived from a firmware type string
|
||||
int getRadioType(QString firmwareType);
|
||||
|
||||
// Return the default firmware string for a specified radio
|
||||
QString getDefaultFwType( int radioType );
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
||||
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 477 B |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 831 B After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.4 KiB |