Compare commits
394 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b324d076a | |||
| 91c922d5fb | |||
| eac918c2da | |||
| b5f9c0ec84 | |||
| d1f54b099b | |||
| 7b98ad55c0 | |||
| d2cb7cb3dd | |||
| be190b8bb1 | |||
| 4b2c02b2c5 | |||
| 142d3fee1a | |||
| 6a5e938ead | |||
| 2d9ae108ff | |||
| bae84e4e8c | |||
| f4944eefdb | |||
| 5d598cc6a1 | |||
| 945808d69b | |||
| dbe512e45a | |||
| 11efb5121e | |||
| f6274f38aa | |||
| cd1f20b8a0 | |||
| e61b931ddb | |||
| a7a9b61234 | |||
| 5ee95673d1 | |||
| 98c5b5e7bd | |||
| 6d434c0bf9 | |||
| ade7151796 | |||
| a7cd1f9aa0 | |||
| cb2c922542 | |||
| 8159a559da | |||
| ed826d8c62 | |||
| b57f5ab2ce | |||
| 8fbafa6f05 | |||
| 9243a59426 | |||
| ccf66831c7 | |||
| 06792b5696 | |||
| 6d4d871849 | |||
| 5a634a7991 | |||
| 69e504212e | |||
| 03e049c360 | |||
| 4ca893da1f | |||
| 66670cf713 | |||
| 271bb4a82e | |||
| e0eab648ef | |||
| 3235f43db9 | |||
| c12b0cfebe | |||
| 3e590d44f0 | |||
| 1f6d1799af | |||
| 8c813a87c9 | |||
| 5bdeedbd0e | |||
| e33f4cf415 | |||
| 61d745011a | |||
| 3e269a04ae | |||
| 341feaf78f | |||
| 19ddf6fc23 | |||
| 9b4b0d3c83 | |||
| dc1eebf40d | |||
| 752e13b9ab | |||
| b988bec5bd | |||
| 3c72afed20 | |||
| e7586f47c3 | |||
| f126b149f0 | |||
| 6b15c0c985 | |||
| db85f39ebc | |||
| dee1e4ce8d | |||
| df96504a85 | |||
| 0112a1e3e9 | |||
| 36481471a3 | |||
| dd08886f2c | |||
| 76ef4b5948 | |||
| eaa247f46d | |||
| 3ada9f7cf5 | |||
| 10a5e4dc89 | |||
| 50e4850745 | |||
| a92de216ac | |||
| 3f3708f0f1 | |||
| 72c433ce9d | |||
| f123b69521 | |||
| 80369f0e8f | |||
| 8cd67bf31e | |||
| 34ef060e16 | |||
| 1f07f88dce | |||
| 4db5bdd486 | |||
| 05ac0682f0 | |||
| f12c3072b5 | |||
| 35aea83c89 | |||
| cf9b5d05a8 | |||
| d5393be5cb | |||
| 10c9936fa0 | |||
| 7a74d3ac85 | |||
| 39edaff669 | |||
| c5aed5f79b | |||
| 9b07a77e14 | |||
| 380fe5e44d | |||
| 8bd2c120d6 | |||
| 741ef45f3e | |||
| 4103adf75d | |||
| c0e612531d | |||
| 55cb5dce87 | |||
| 12ba27247e | |||
| 1e33e99655 | |||
| 50acd1fd92 | |||
| c3626225aa | |||
| b71a96ed55 | |||
| d2fcd544d8 | |||
| 50997721e2 | |||
| 828372ab29 | |||
| 21ae270c0e | |||
| 1b2efd1121 | |||
| 8d6a7c9495 | |||
| 189becfbb2 | |||
| 5a19e147fd | |||
| 062f93ae38 | |||
| 9861a08150 | |||
| de15d0a5a4 | |||
| 1e77bb3c02 | |||
| adadbe06ad | |||
| 92f2c48de9 | |||
| 1d4fa2a8b0 | |||
| 5493776b9c | |||
| b166b77c3e | |||
| 0ecb978364 | |||
| c8d792d3d8 | |||
| e9663e40e2 | |||
| a7e906dea9 | |||
| 685ab3d101 | |||
| 77564d74a4 | |||
| a0142d65be | |||
| 662bf15562 | |||
| 79b928af56 | |||
| 8c28f4bc48 | |||
| 7a4d6c89a1 | |||
| 38347becca | |||
| 49036dbb40 | |||
| abf36de157 | |||
| 32afbf5a5a | |||
| cba4a02cc1 | |||
| 4062555605 | |||
| 9cb38ce839 | |||
| 905090ef09 | |||
| 62e5820082 | |||
| 2d21e16201 | |||
| 07303f4301 | |||
| 91228f803c | |||
| e5d7e1f7c2 | |||
| 81573537eb | |||
| 7a85328b86 | |||
| fd84c62ff4 | |||
| 13e0b21656 | |||
| 5949be30fa | |||
| 0117c2da68 | |||
| 943f70c599 | |||
| 52a48fc4b1 | |||
| 2712ffabb0 | |||
| fa8c8a7094 | |||
| 5907193571 | |||
| 45abfb872f | |||
| 4d5962b15b | |||
| eea1c3a84c | |||
| deed7fc20f | |||
| 62fca3f8b6 | |||
| 9377e58407 | |||
| 9b53f69038 | |||
| 3680149b52 | |||
| 93faeeafbe | |||
| 2d5d1cb357 | |||
| 2a5364dc8c | |||
| 7f47a4fe10 | |||
| a0cc428228 | |||
| 61985f7d6a | |||
| 3baf64f123 | |||
| 4fd40c154e | |||
| 3c360618b9 | |||
| 1d96731ad5 | |||
| 9d1d31d26a | |||
| 0b52ccfaf1 | |||
| 484566083e | |||
| 0f33dc6113 | |||
| 7f3778fc3c | |||
| 0a9dcc5ce6 | |||
| 2f01f139cc | |||
| fb3e615008 | |||
| ce6d0807fa | |||
| cab8f3db71 | |||
| 399a8b2e35 | |||
| 3d4a791940 | |||
| 7373ce2cae | |||
| 5da1e35efe | |||
| fe5b7bee8c | |||
| 2da1134796 | |||
| 83e47d9e35 | |||
| f0c76efaf7 | |||
| 2fe7d856c3 | |||
| a7c1f22b36 | |||
| d92620919b | |||
| 94bb21886b | |||
| 5db98a3fef | |||
| 763c7fbb7d | |||
| b2d1a4ed22 | |||
| e7211065ab | |||
| 68b8b0e38f | |||
| 644c833311 | |||
| 30b1f62e99 | |||
| 03aa787c8e | |||
| 79592d3b00 | |||
| 7ed527a328 | |||
| 3e0766f2bf | |||
| 71e7926045 | |||
| 8c3d47deac | |||
| 197f31d5a1 | |||
| 1a198c35ad | |||
| 2934fc4d23 | |||
| 4ae9585080 | |||
| 161016a02a | |||
| 559bb83864 | |||
| 9a37c3027e | |||
| 6548afcad3 | |||
| ee31c51275 | |||
| 63aadad10c | |||
| 30958a9a65 | |||
| 995183bf22 | |||
| 99fedb081e | |||
| cc934c3ac0 | |||
| c1d789d004 | |||
| 4d945b5d95 | |||
| 28c900e3f7 | |||
| b41ba50b53 | |||
| 2d22c18758 | |||
| 8ce05b3284 | |||
| 6d18820b53 | |||
| 58ed329ac2 | |||
| 2e0858bc0c | |||
| 7c9636c58c | |||
| 9dbd1326da | |||
| 4c82d12c1a | |||
| 972685bc15 | |||
| 00f8b97ee4 | |||
| 0b7bbbbdbd | |||
| 47bc3e896c | |||
| 904249b2dc | |||
| 3700047d2c | |||
| d44e851648 | |||
| 1be75735be | |||
| 7da72240a3 | |||
| 9357c951f1 | |||
| 1afeb9f977 | |||
| 000e55725c | |||
| 38e342b27b | |||
| 3e9064e2e2 | |||
| 2d764e73fd | |||
| f8efcf420a | |||
| cf546a2341 | |||
| 87a4f3526b | |||
| 6b49119af7 | |||
| 4c6314331d | |||
| 55ab067a0c | |||
| 3fc18b1cf7 | |||
| f2f8419da1 | |||
| 365c2f9e34 | |||
| 01fde3db27 | |||
| d743ed9645 | |||
| dd67811638 | |||
| ebe4f6a365 | |||
| b4e816b784 | |||
| 2798fa7ba9 | |||
| ee077a06e6 | |||
| 8f73e9bde0 | |||
| 45d8fca125 | |||
| 2bc6c1e754 | |||
| 39a0feae3b | |||
| ad7da779c7 | |||
| 23cafa84f2 | |||
| a20e5aee3b | |||
| fa3c50df8e | |||
| 81eb9326eb | |||
| 7c71d56383 | |||
| 5109a2d7c1 | |||
| 82cc799afe | |||
| 88bb28e3f1 | |||
| f4fdc233c0 | |||
| 7130e48089 | |||
| ed094f89e8 | |||
| 58f81b193b | |||
| 50122d4ee1 | |||
| f66388c1d3 | |||
| 838190ce80 | |||
| 1bc04db9cd | |||
| 30a68cf170 | |||
| ec8c207631 | |||
| 9337080307 | |||
| 8200164797 | |||
| 7d85d40f68 | |||
| 5d23135b0d | |||
| be6f1587ed | |||
| c184ddd996 | |||
| c903bbcb13 | |||
| 9b008ded21 | |||
| 6f79de6cae | |||
| 711b54c98e | |||
| 6876718d72 | |||
| 4ffb9f69c6 | |||
| b8a6548686 | |||
| 8c010277c9 | |||
| f30e3db1ef | |||
| d675ab1578 | |||
| b6cbde48be | |||
| 1fef79ce80 | |||
| 4f03ae75c5 | |||
| 34850fb73d | |||
| ee05f7f80e | |||
| 83614359aa | |||
| 17a2865070 | |||
| e3866fda45 | |||
| 81ed325830 | |||
| 36e78b9315 | |||
| 6716482ae4 | |||
| 7e758ce7ad | |||
| 63fe996ebc | |||
| 038365e639 | |||
| c3aebfa239 | |||
| e6370ebb2a | |||
| 1e25e368d2 | |||
| 645350a1a2 | |||
| dd927e6761 | |||
| 713b2e2cf5 | |||
| 7a02e57dcf | |||
| 724949b8fc | |||
| 1f5295db9c | |||
| 72ef865c10 | |||
| be0ebe833c | |||
| 57b08fb064 | |||
| 7162ab5399 | |||
| 4eb44837f3 | |||
| 194a635800 | |||
| e4314004a8 | |||
| 74534b74c2 | |||
| 59eb020eb1 | |||
| 1d1a815ef7 | |||
| 4088abaafb | |||
| 9333f3778f | |||
| 070a133cd5 | |||
| 74f4f99280 | |||
| 66848156a8 | |||
| 74dfd64e29 | |||
| ef0b81cd2d | |||
| 09842fe531 | |||
| 3c93699f8f | |||
| a9dd0d0dfb | |||
| 013e6925dc | |||
| 591ccfd25f | |||
| b0bdaf6b65 | |||
| f77e6370cf | |||
| ce70efa31d | |||
| 3a7fe01950 | |||
| 3f39352d95 | |||
| d38c02f847 | |||
| 2dddd76320 | |||
| 391e6a867f | |||
| 1df8b5f5c1 | |||
| 6913c8e7e5 | |||
| aab03a2b9f | |||
| a83c6c8a0c | |||
| b5cdd60367 | |||
| 5453ff5678 | |||
| 7b69fb2f79 | |||
| 19ac5d3038 | |||
| 4b64862cf2 | |||
| f643f0be85 | |||
| 0e0b1792e4 | |||
| f81c31510b | |||
| 5c3bd1faf9 | |||
| 90cf98465b | |||
| 1dd47484d4 | |||
| bd4a85c6a7 | |||
| b6520e2db6 | |||
| 0ea114b219 | |||
| e36f54eda5 | |||
| d983404656 | |||
| 677b50d39c | |||
| e5ae504bae | |||
| ce302aae60 | |||
| b0869fccfc | |||
| 17ab12f7bf | |||
| 816f9ce8a0 | |||
| 5fb41eb32f | |||
| c687e20fff | |||
| c5aa691467 | |||
| a3d7c694ef | |||
| 2c8b51c9d6 | |||
| a518a34055 | |||
| 4d3ca7e82e | |||
| 98c756a6d2 | |||
| 84d5c6c4b0 | |||
| 935458caa4 | |||
| dcec97411e |
@@ -500,3 +500,96 @@ Emay Toha
|
||||
Kamco Enterprises
|
||||
Peter Mueller
|
||||
Giovanni Trentini
|
||||
Cecil Porter
|
||||
Robert Canavan
|
||||
Greg Higginbottom
|
||||
Tim Walker
|
||||
Thos. O'Meara Photography
|
||||
Spis Ltd/TurboNote
|
||||
Patricia Cox
|
||||
Matthew Lukes
|
||||
Sabine Witte
|
||||
Phillip Perry
|
||||
Beat Zurflueh
|
||||
Russell Stutzman
|
||||
Dietmar Drees
|
||||
Kenneth Ward
|
||||
Jens Lochmüller
|
||||
Anthony Witham
|
||||
Peter Hauke
|
||||
Arizona Action Photos
|
||||
Francis F Dale
|
||||
Willie Swanepoel
|
||||
Edward Hauser
|
||||
Adilson Oliveira
|
||||
Joseph Ordille
|
||||
Michael Shellim
|
||||
Teddie Holmes
|
||||
Alexandre Rault
|
||||
Eric Albin
|
||||
Lukas Kliment
|
||||
Bernard Philippe
|
||||
Bernard Delpy
|
||||
Didier Klein
|
||||
Arnaldo Guedes
|
||||
Cyberauto Systems
|
||||
John Alsbrooks
|
||||
John Kearney
|
||||
Christopher Borden
|
||||
Marc Virgilio Ricci
|
||||
Frederick Davie
|
||||
Jürgen Enders
|
||||
Terrence Pitts
|
||||
Thomas Sandner
|
||||
Marco Coltorti
|
||||
Harald Wilczak
|
||||
Rodney Lorimor
|
||||
Richard Davis
|
||||
Stephen Palmer
|
||||
Michael Napolitan
|
||||
Joshua Bardwell
|
||||
Fred Dawson
|
||||
Jim Wagner
|
||||
Peter Johnson
|
||||
Fredrik Lewerth
|
||||
Arvin Stenersen
|
||||
Daniel Morgan
|
||||
Roy Nixon
|
||||
Joachim Blunck
|
||||
Karl-Heinz Gansel
|
||||
Monrovia Mountain Enterprises
|
||||
Alessandro Villa
|
||||
Jan-Åke Nilsson
|
||||
Matthias Rei
|
||||
DVR Solutions BV
|
||||
Bertrand Condevaux Lanloy
|
||||
Henri Mirra
|
||||
Aurélien Planiol
|
||||
Kevin Caldwell
|
||||
Andrew Garello
|
||||
Tomasz Maziarz
|
||||
Russell Flack
|
||||
Fernando Rimoldi
|
||||
Greg Reid
|
||||
Dietmar Drees
|
||||
Holger Landwehr
|
||||
Arno Loehdorf
|
||||
Boon Sripattha
|
||||
Patrik Åkerfeldt
|
||||
Alonzo Fretwell
|
||||
Renjith Chandrasekharan
|
||||
Ruben Gomez Hernandez
|
||||
Michael Gardner
|
||||
Judith Green
|
||||
Timo Ruppell
|
||||
John Lipscomb
|
||||
Norbert Wenke
|
||||
Erik Frieberg
|
||||
Raimo Ruotsalainen
|
||||
Brian Harris
|
||||
Sebastian Blüml
|
||||
Efisio Maxia
|
||||
Jeff Theobald
|
||||
Anthony Rizzo
|
||||
Rodney Huddleston
|
||||
Dietmar Drees
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
##OpenTX Next Branch
|
||||
##OpenTX Master 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.
|
||||
You have found your way to the GitHub repository site for the OpenTX Master Branch. This code branch holds the source code for the latest stable release.
|
||||
|
||||
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.
|
||||
The ongoing development is not done in this branch. It is performed in the branch called next.
|
||||
|
||||
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,3 +1,38 @@
|
||||
<h2>Version 2.0.11</h2>
|
||||
<ul>
|
||||
<li>Limits EEPROM export was broken (all boards except Taranis)</li>
|
||||
<li>Fix issue when a GVAR was used as Offset</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.10</h2>
|
||||
<ul>
|
||||
<li>Taranis is now the default board in General Settings</li>
|
||||
<li>GVARS allowed in Limits min/max/offset</li>
|
||||
<li>Limits displayed in us when ppmus option selected
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.8</h2>
|
||||
<ul>
|
||||
<li>Compare dialog bugfixes</li>
|
||||
<li>Curve index correctly resetted when type changed</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.7</h2>
|
||||
<ul>
|
||||
<li>SafetyCH function was missing in simulator</li>
|
||||
<li>EEPROM export warning when exporting logical switches > L12 on 9X128</li>
|
||||
<li>FAS offset was not exported on 9X/9XR boards</li>
|
||||
<li>Trims modes bugfix on non Taranis boards</li>
|
||||
<li>It was impossible to open a backuped model from the Tx</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.6</h2>
|
||||
<ul>
|
||||
<li>Fix Mix curves bug on Sky9x boards</li>
|
||||
<li>Channels 17-32 are displayed in the simulator</li>
|
||||
<li>Backlight simulation bugfix</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.5</h2>
|
||||
<ul>
|
||||
<li>Fix crash on startup</li>
|
||||
|
||||
@@ -2,7 +2,7 @@ PROJECT( companion )
|
||||
|
||||
SET( C9X_VERSION_MAJOR "2" )
|
||||
SET( C9X_VERSION_MINOR "0" )
|
||||
SET( C9X_VERSION_REVISION "5" )
|
||||
SET( C9X_VERSION_REVISION "11" )
|
||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
@@ -87,6 +87,13 @@ add_custom_command(
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
COMMAND make lua_exports.cpp
|
||||
DEPENDS ${RADIO_SRC_DIRECTORY}/myeeprom.h
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/../..
|
||||
@@ -112,6 +119,7 @@ set(common_SRCS
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
firmwares/opentx/opentxeeprom.cpp
|
||||
firmwares/opentx/open9xStockeeprom.cpp
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp
|
||||
@@ -312,6 +320,7 @@ set(simu_SRCS
|
||||
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
modeledit/node.cpp
|
||||
modeledit/edge.cpp # TODO not needed
|
||||
simulator.cpp
|
||||
@@ -329,7 +338,11 @@ if(WIN32)
|
||||
set(simu_SRCS ${simu_SRCS} icon.rc)
|
||||
endif()
|
||||
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
if(APPLE)
|
||||
add_executable(simulator MACOSX_BUNDLE ${simu_SRCS})
|
||||
else()
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
endif()
|
||||
|
||||
if(SDL_FOUND)
|
||||
target_link_libraries(simulator simulation common ${QT_LIBRARIES} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
@@ -418,9 +431,15 @@ ADD_CUSTOM_TARGET( stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/version.h ${CMAKE_SOURCE_DIR}/../companion.stamp
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/version.h )
|
||||
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
IF(WIN32)
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND lupdate ${CMAKE_SOURCE_DIR} -ts ${companion_TS} )
|
||||
ELSE( )
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND lupdate-qt4 ${CMAKE_SOURCE_DIR} -ts ${companion_TS} )
|
||||
ENDIF( )
|
||||
|
||||
SET(CPACK_PACKAGE_NAME "COMPANION")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
|
||||
|
||||
@@ -156,11 +156,11 @@ void avrOutputDialog::doCopy()
|
||||
dest.close();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot write destination") + ": " + dest.errorString());
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot write destination") + ": " + dest.fileName() + ", " + tr("reason") + ": " + dest.errorString());
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot open source file") + ": " + source.errorString());
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot open source file") + ": " + source.fileName() + ", " + tr("reason") + ": " + source.errorString());
|
||||
}
|
||||
|
||||
source.close();
|
||||
|
||||
@@ -354,10 +354,8 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
|
||||
}
|
||||
else {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
QString lfuses;
|
||||
tempFile = tempDir + "/ftemp.bin";
|
||||
QString tempFile = generateProcessUniqueTempFileName("ftemp.bin");
|
||||
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);
|
||||
@@ -376,7 +374,7 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
file.close();
|
||||
unlink(tempFile.toAscii());
|
||||
qunlink(tempFile);
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
|
||||
@@ -418,12 +418,11 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
image = pixmap->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
||||
}
|
||||
if (!image.isNull()) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
if (getFileType(fileName) == FILE_TYPE_HEX)
|
||||
tempFile = tempDir + "/flash.hex";
|
||||
tempFile = generateProcessUniqueTempFileName("flash.hex");
|
||||
else
|
||||
tempFile = tempDir + "/flash.bin";
|
||||
tempFile = generateProcessUniqueTempFileName("flash.bin");
|
||||
FlashInterface flash(fileName);
|
||||
flash.setSplash(image);
|
||||
if (flash.saveFlash(tempFile) > 0) {
|
||||
@@ -556,8 +555,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
}
|
||||
|
||||
if (patch) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString fileName = tempDir + "/temp.bin";
|
||||
QString fileName = generateProcessUniqueTempFileName("temp.bin");
|
||||
QFile file(fileName);
|
||||
|
||||
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
|
||||
|
||||
@@ -156,16 +156,12 @@ void CompareDialog::dropEvent(QDropEvent *event)
|
||||
|
||||
void CompareDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QByteArray ba = curvefile5.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
ba = curvefile9.toLatin1();
|
||||
name = ba.data();
|
||||
unlink(name);
|
||||
}
|
||||
|
||||
CompareDialog::~CompareDialog()
|
||||
{
|
||||
qunlink(curvefile5);
|
||||
qunlink(curvefile9);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -256,17 +252,14 @@ void CompareDialog::printSetup()
|
||||
str.append(fv(tr("Timer2"), getTimerStr(g_model1->timers[1]), color)); //value, mode, count up/down
|
||||
color=getColor1(getProtocol(g_model1),getProtocol(g_model2));
|
||||
str.append(fv(tr("Protocol"), getProtocol(g_model1), color)); //proto, numch, delay,
|
||||
color=getColor1(g_model1->moduleData[0].ppmPulsePol,g_model2->moduleData[0].ppmPulsePol);
|
||||
str.append(fv(tr("Pulse Polarity"), g_model1->moduleData[0].ppmPulsePol ? "NEG" : "POS", color));
|
||||
color=getColor1(g_model1->moduleData[0].ppmPulsePol, g_model2->moduleData[0].ppmPulsePol);
|
||||
str.append(fv(tr("Pulse Polarity"), g_model1->moduleData[0].polarityToString(), color));
|
||||
color=getColor1(g_model1->thrTrim,g_model2->thrTrim);
|
||||
str.append(fv(tr("Throttle Trim"), g_model1->thrTrim ? tr("Enabled") : tr("Disabled"), color));
|
||||
color=getColor1(g_model1->thrExpo,g_model2->thrExpo);
|
||||
str.append(fv(tr("Throttle Expo"), g_model1->thrExpo ? tr("Enabled") : tr("Disabled"),color));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
color=getColor1(getTrimInc(g_model1),getTrimInc(g_model2));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model1),color));
|
||||
color=getColor1(getCenterBeep(g_model1),getCenterBeep(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model1),color)); // specify which channels beep
|
||||
color = getColor1(getCenterBeepStr(g_model1), getCenterBeepStr(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model1), color)); // specify which channels beep
|
||||
str.append("</table></td>");
|
||||
str.append("<td><table border=0 cellspacing=0 cellpadding=3 width=\"50%\">");
|
||||
color=getColor2(g_model1->name,g_model2->name);
|
||||
@@ -279,17 +272,14 @@ void CompareDialog::printSetup()
|
||||
str.append(fv(tr("Timer2"), getTimerStr(g_model2->timers[1]),color)); //value, mode, count up/down
|
||||
color=getColor2(getProtocol(g_model1),getProtocol(g_model2));
|
||||
str.append(fv(tr("Protocol"), getProtocol(g_model2), color)); //proto, numch, delay,
|
||||
color=getColor2(g_model1->moduleData[0].ppmPulsePol,g_model2->moduleData[0].ppmPulsePol);
|
||||
str.append(fv(tr("Pulse Polarity"), g_model2->moduleData[0].ppmPulsePol ? "NEG" : "POS", color));
|
||||
color=getColor2(g_model1->moduleData[0].ppmPulsePol, g_model2->moduleData[0].ppmPulsePol);
|
||||
str.append(fv(tr("Pulse Polarity"), g_model2->moduleData[0].polarityToString(), color));
|
||||
color=getColor2(g_model1->thrTrim,g_model2->thrTrim);
|
||||
str.append(fv(tr("Throttle Trim"), g_model2->thrTrim ? tr("Enabled") : tr("Disabled"), color));
|
||||
color=getColor2(g_model1->thrExpo,g_model2->thrExpo);
|
||||
str.append(fv(tr("Throttle Expo"), g_model2->thrExpo ? tr("Enabled") : tr("Disabled"),color));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
color=getColor2(getTrimInc(g_model1),getTrimInc(g_model2));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model2),color));
|
||||
color=getColor2(getCenterBeep(g_model1),getCenterBeep(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model2),color)); // specify which channels beep
|
||||
color = getColor2(getCenterBeepStr(g_model1),getCenterBeepStr(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model2), color)); // specify which channels beep
|
||||
str.append("</td></tr></table></td></tr></table>");
|
||||
te->append(str);
|
||||
}
|
||||
@@ -506,11 +496,11 @@ void CompareDialog::printLimits()
|
||||
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
|
||||
}
|
||||
color=getColor1(g_model1->limitData[i].offset,g_model2->limitData[i].offset);
|
||||
str.append(doTR(QString::number((qreal)g_model1->limitData[i].offset/10, 'f', 1),color));
|
||||
str.append(doTR(g_model1->limitData[i].offsetToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].min,g_model2->limitData[i].min);
|
||||
str.append(doTR(QString::number(g_model1->limitData[i].min),color));
|
||||
str.append(doTR(g_model1->limitData[i].minToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].max,g_model2->limitData[i].max);
|
||||
str.append(doTR(QString::number(g_model1->limitData[i].max),color));
|
||||
str.append(doTR(g_model1->limitData[i].maxToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].revert,g_model2->limitData[i].revert);
|
||||
str.append(doTR(QString(g_model1->limitData[i].revert ? tr("INV") : tr("NOR")),color));
|
||||
str.append("</tr>");
|
||||
@@ -533,11 +523,11 @@ void CompareDialog::printLimits()
|
||||
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
|
||||
}
|
||||
color=getColor2(g_model1->limitData[i].offset,g_model2->limitData[i].offset);
|
||||
str.append(doTR(QString::number((qreal)g_model2->limitData[i].offset/10, 'f', 1),color));
|
||||
str.append(doTR(g_model2->limitData[i].offsetToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].min,g_model2->limitData[i].min);
|
||||
str.append(doTR(QString::number(g_model2->limitData[i].min),color));
|
||||
str.append(doTR(g_model2->limitData[i].minToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].max,g_model2->limitData[i].max);
|
||||
str.append(doTR(QString::number(g_model2->limitData[i].max),color));
|
||||
str.append(doTR(g_model2->limitData[i].maxToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].revert,g_model2->limitData[i].revert);
|
||||
str.append(doTR(QString(g_model2->limitData[i].revert ? tr("INV") : tr("NOR")),color));
|
||||
str.append("</tr>");
|
||||
@@ -807,7 +797,7 @@ void CompareDialog::printMixers()
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
str += md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
|
||||
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
|
||||
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
|
||||
@@ -885,8 +875,7 @@ void CompareDialog::printMixers()
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
// TODO if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential));
|
||||
// TODO if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">"));
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
|
||||
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
|
||||
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
|
||||
|
||||
@@ -505,7 +505,7 @@ class ConversionTable {
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=internalTable.begin(); it!=internalTable.end(); it++) {
|
||||
for (std::list<ConversionTuple>::iterator it=exportTable.begin(); it!=exportTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.a) {
|
||||
after = tuple.b;
|
||||
@@ -520,7 +520,7 @@ class ConversionTable {
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=internalTable.begin(); it!=internalTable.end(); it++) {
|
||||
for (std::list<ConversionTuple>::iterator it=importTable.begin(); it!=importTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.b) {
|
||||
after = tuple.a;
|
||||
@@ -547,10 +547,23 @@ class ConversionTable {
|
||||
|
||||
void addConversion(const int a, const int b)
|
||||
{
|
||||
internalTable.push_back(ConversionTuple(a, b));
|
||||
ConversionTuple conversion(a, b);
|
||||
importTable.push_back(conversion);
|
||||
exportTable.push_back(conversion);
|
||||
}
|
||||
|
||||
std::list<ConversionTuple> internalTable;
|
||||
void addImportConversion(const int a, const int b)
|
||||
{
|
||||
importTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
void addExportConversion(const int a, const int b)
|
||||
{
|
||||
exportTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
std::list<ConversionTuple> importTable;
|
||||
std::list<ConversionTuple> exportTable;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -648,7 +661,7 @@ class ConversionField: public TransformedField {
|
||||
if (table->exportValue(_field, _field))
|
||||
return;
|
||||
if (!error.isEmpty())
|
||||
EEPROMWarnings += error + "\n";
|
||||
EEPROMWarnings.push_back(error);
|
||||
}
|
||||
|
||||
if (shift) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "helpers.h"
|
||||
#include "wizarddata.h"
|
||||
|
||||
QString EEPROMWarnings;
|
||||
std::list<QString> EEPROMWarnings;
|
||||
|
||||
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
|
||||
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
|
||||
@@ -186,6 +186,20 @@ RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSetting
|
||||
break;
|
||||
case TELEMETRY_SOURCE_ASPEED:
|
||||
case TELEMETRY_SOURCE_ASPEED_MAX:
|
||||
result.decimals = 1;
|
||||
result.step = singleprec ? 2.0 : 0.1;
|
||||
result.max = singleprec ? (2*255) : 2000;
|
||||
if (firmware->getCapability(Imperial) || settings.imperial) {
|
||||
result.step *= 1.150779;
|
||||
result.max *= 1.150779;
|
||||
result.unit = QObject::tr("mph");
|
||||
}
|
||||
else {
|
||||
result.step *= 1.852;
|
||||
result.max *= 1.852;
|
||||
result.unit = QObject::tr("km/h");
|
||||
}
|
||||
break;
|
||||
case TELEMETRY_SOURCE_SPEED:
|
||||
case TELEMETRY_SOURCE_SPEED_MAX:
|
||||
result.step = singleprec ? 2 : 1;
|
||||
@@ -698,98 +712,19 @@ QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettin
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
QStringList FuncSwData::toStringList()
|
||||
void FuncSwData::clear()
|
||||
{
|
||||
QStringList result;
|
||||
QStringList qs;
|
||||
|
||||
result << swtch.toString();
|
||||
result << funcToString();
|
||||
|
||||
if (func < FuncInstantTrim) {
|
||||
result << QString("%1").arg(param);
|
||||
memset(this, 0, sizeof(FuncSwData));
|
||||
if (!GetCurrentFirmware()->getCapability(SafetyChannelCustomFunction)) {
|
||||
func = FuncTrainer;
|
||||
}
|
||||
else if (func==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
result << qs.at(param);
|
||||
else
|
||||
result << QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
|
||||
RawSource item(param);
|
||||
result << item.toString();
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
result << QString("%1").arg(param);
|
||||
} else {
|
||||
result << paramarm;
|
||||
}
|
||||
}
|
||||
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
result << QObject::tr("Value ")+QString("%1").arg(param);
|
||||
break;
|
||||
case 1:
|
||||
result << RawSource(param).toString();
|
||||
break;
|
||||
case 2:
|
||||
result << RawSource(param).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (param==0) {
|
||||
result << QObject::tr("Decr:")+QString(" -1");
|
||||
}
|
||||
else {
|
||||
result << QObject::tr("Incr:")+QString(" +1");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) {
|
||||
str.append(doTC(QString("%1").arg(g_model->funcSw[i].repeatParam),"green"));
|
||||
} else {
|
||||
str.append(doTC( " ","green"));
|
||||
}
|
||||
if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) {
|
||||
str.append(doTC((g_model->funcSw[i].enabled ? "ON" : "OFF"),"green"));
|
||||
} else {
|
||||
str.append(doTC( "---","green"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString FuncSwData::funcToString()
|
||||
{
|
||||
ModelData model;
|
||||
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
|
||||
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
else if (func == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
else if (func == FuncTrainerRUD)
|
||||
@@ -916,6 +851,28 @@ QString FuncSwData::repeatToString()
|
||||
}
|
||||
}
|
||||
|
||||
QString LimitData::minToString()
|
||||
{
|
||||
return QString::number((qreal)min/10);
|
||||
}
|
||||
|
||||
QString LimitData::maxToString()
|
||||
{
|
||||
return QString::number((qreal)max/10);
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString()
|
||||
{
|
||||
return QString::number((qreal)offset/10, 'f', 1);
|
||||
}
|
||||
|
||||
void LimitData::clear()
|
||||
{
|
||||
memset(this, 0, sizeof(LimitData));
|
||||
min = -1000;
|
||||
max = +1000;
|
||||
}
|
||||
|
||||
GeneralSettings::GeneralSettings()
|
||||
{
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
@@ -1201,6 +1158,8 @@ void ModelData::clear()
|
||||
expoData[i].clear();
|
||||
for (int i=0; i<C9X_NUM_CSW; i++)
|
||||
customSw[i].clear();
|
||||
for (int i=0; i<C9X_MAX_CUSTOM_FUNCTIONS; i++)
|
||||
funcSw[i].clear();
|
||||
for (int i=0; i<C9X_MAX_CURVES; i++)
|
||||
curves[i].clear(5);
|
||||
for (int i=0; i<2; i++)
|
||||
|
||||
@@ -526,6 +526,8 @@ class GeneralSettings {
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
unsigned int mAhUsed;
|
||||
unsigned int globalTimer;
|
||||
unsigned int btBaudrate;
|
||||
unsigned int sticksGain;
|
||||
unsigned int rotarySteps;
|
||||
@@ -631,7 +633,10 @@ class LimitData {
|
||||
bool symetrical;
|
||||
char name[6+1];
|
||||
CurveReference curve;
|
||||
void clear() { memset(this, 0, sizeof(LimitData)); min = -1000; max = +1000; }
|
||||
QString minToString();
|
||||
QString maxToString();
|
||||
QString offsetToString();
|
||||
void clear();
|
||||
};
|
||||
|
||||
enum MltpxValue {
|
||||
@@ -760,7 +765,7 @@ class FuncSwData { // Function Switches data
|
||||
unsigned int enabled; // TODO perhaps not any more the right name
|
||||
unsigned int adjustMode;
|
||||
int repeatParam;
|
||||
void clear() { memset(this, 0, sizeof(FuncSwData)); }
|
||||
void clear();
|
||||
QString funcToString();
|
||||
QString paramToString();
|
||||
QString repeatToString();
|
||||
@@ -916,9 +921,8 @@ class TimerData {
|
||||
RawSwitch mode;
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
unsigned int val;
|
||||
bool persistent;
|
||||
unsigned int persistent;
|
||||
int pvalue;
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
};
|
||||
@@ -954,6 +958,7 @@ class ModuleData {
|
||||
bool ppmPulsePol; // false = positive
|
||||
int ppmFrameLength;
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
QString polarityToString() { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); }
|
||||
};
|
||||
|
||||
#define C9X_MAX_SCRIPTS 7
|
||||
@@ -982,7 +987,6 @@ class ModelData {
|
||||
char name[12+1];
|
||||
TimerData timers[2];
|
||||
bool thrTrim; // Enable Throttle Trim
|
||||
bool thrExpo; // Enable Throttle Expo
|
||||
int trimInc; // Trim Increments
|
||||
bool disableThrottleWarning;
|
||||
|
||||
@@ -1063,6 +1067,7 @@ enum Capability {
|
||||
Timers,
|
||||
TimeDivisions,
|
||||
CustomFunctions,
|
||||
SafetyChannelCustomFunction,
|
||||
VoicesAsNumbers,
|
||||
VoicesMaxLength,
|
||||
ModelVoice,
|
||||
@@ -1126,6 +1131,7 @@ enum Capability {
|
||||
HasSoundMixer,
|
||||
NumModules,
|
||||
PPMCenter,
|
||||
PPMUnitMicroseconds,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
HasVolume,
|
||||
@@ -1196,7 +1202,7 @@ class EEPROMInterface
|
||||
|
||||
};
|
||||
|
||||
extern QString EEPROMWarnings;
|
||||
extern std::list<QString> EEPROMWarnings;
|
||||
|
||||
/* EEPROM string conversion functions */
|
||||
void setEEPROMString(char *dst, const char *src, int size);
|
||||
|
||||
@@ -344,6 +344,57 @@ unsigned int RleFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)src.data();
|
||||
unsigned int len = src.size();
|
||||
uint8_t zeroes = 0;
|
||||
uint8_t bRlc = 0;
|
||||
|
||||
dst.resize(0);
|
||||
|
||||
for( ; 1; ) {
|
||||
for (int i=0; i<zeroes; i++)
|
||||
dst.append((char)0);
|
||||
zeroes = 0;
|
||||
|
||||
if (len == 0)
|
||||
return dst.size();
|
||||
|
||||
for (int i=0; i<bRlc; i++) {
|
||||
dst.append(*buf++);
|
||||
if (--len == 0)
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
bRlc = *buf++;
|
||||
--len;
|
||||
|
||||
if (!(bRlc & 0x7f)) {
|
||||
qDebug() << "RLC decoding error!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rlcVersion == 2) {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = (bRlc>>4) & 0x07;
|
||||
bRlc = bRlc & 0x0f;
|
||||
}
|
||||
else if (bRlc&0x40){
|
||||
zeroes = bRlc & 0x3f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = bRlc & 0x7f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
unsigned int RleFile::write1(uint8_t b)
|
||||
{
|
||||
return write(&b, 1);
|
||||
|
||||
@@ -146,4 +146,6 @@ public:
|
||||
unsigned int get_current_block_number(unsigned int block_no, uint16_t *p_size);
|
||||
};
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion=2);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -138,8 +138,8 @@ t_Er9xLimitData::t_Er9xLimitData()
|
||||
t_Er9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -358,7 +358,6 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0].mode = getEr9xTimerMode(tmrMode);
|
||||
c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
@@ -377,7 +376,6 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
|
||||
@@ -147,8 +147,8 @@ t_Ersky9xLimitData::t_Ersky9xLimitData()
|
||||
t_Ersky9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -489,7 +489,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].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
@@ -509,7 +508,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
@@ -607,7 +605,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].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
@@ -627,7 +624,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
|
||||
@@ -201,8 +201,8 @@ t_Gruvin9xLimitData::t_Gruvin9xLimitData()
|
||||
t_Gruvin9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -378,7 +378,6 @@ t_Gruvin9xTimerData::operator TimerData ()
|
||||
TimerData c9x;
|
||||
c9x.mode = getEr9xTimerMode(mode);
|
||||
c9x.val = val;
|
||||
c9x.dir = dir;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -447,7 +446,6 @@ t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -518,7 +516,6 @@ t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -589,7 +586,6 @@ t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -680,7 +676,6 @@ t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -138,7 +138,6 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -149,7 +148,7 @@ t_Open9xArmExpoData_v208::operator ExpoData ()
|
||||
c9x.chn = chn;
|
||||
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
@@ -179,7 +178,7 @@ t_Open9xArmExpoData_v210::operator ExpoData ()
|
||||
c9x.chn = chn;
|
||||
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
|
||||
@@ -89,7 +89,7 @@ t_Open9xExpoData_v201::operator ExpoData ()
|
||||
c9x.mode = mode;
|
||||
c9x.chn = chn;
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
@@ -129,8 +129,8 @@ t_Open9xExpoData_v211::operator ExpoData ()
|
||||
t_Open9xLimitData_v201::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -139,8 +139,8 @@ t_Open9xLimitData_v201::operator LimitData ()
|
||||
t_Open9xLimitData_v211::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
c9x.symetrical=symetrical;
|
||||
@@ -573,8 +573,8 @@ t_Open9xFuncSwData_v201::operator FuncSwData ()
|
||||
}
|
||||
|
||||
enum Functions {
|
||||
FUNC_SAFETY_CH1,
|
||||
FUNC_SAFETY_CH16=FUNC_SAFETY_CH1+15,
|
||||
FUNC_OVERRIDE_CH1,
|
||||
FUNC_OVERRIDE_CH16=FUNC_OVERRIDE_CH1+15,
|
||||
FUNC_TRAINER,
|
||||
FUNC_TRAINER_RUD,
|
||||
FUNC_TRAINER_ELE,
|
||||
@@ -704,7 +704,6 @@ t_Open9xTimerData_v201::operator TimerData ()
|
||||
// c9x.mode = TMRMODE_OFF;
|
||||
c9x.val = val;
|
||||
c9x.persistent = persistent;
|
||||
c9x.dir = dir;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -725,7 +724,6 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -939,7 +937,6 @@ t_Open9xModelData_v201::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define EEPROM_VARIANT 3
|
||||
|
||||
@@ -76,9 +77,10 @@ namespace Open9xGruvin9x {
|
||||
#include "radio/src/gui/view_main.cpp"
|
||||
#include "radio/src/gui/view_statistics.cpp"
|
||||
#include "radio/src/gui/view_telemetry.cpp"
|
||||
#include "radio/src/lcd.cpp"
|
||||
#include "radio/src/lcd_common.cpp"
|
||||
#include "radio/src/lcd_default.cpp"
|
||||
#include "radio/src/keys.cpp"
|
||||
#include "radio/src/simpgmspace.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/templates.cpp"
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/fonts.cpp"
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define FRSKY_STICKS
|
||||
#define DSM2
|
||||
#define DSM2_PPM
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define EEPROM_VARIANT SIMU_M128_VARIANTS
|
||||
#define GAUGES
|
||||
@@ -77,9 +78,10 @@ namespace OpenTxM128 {
|
||||
#include "radio/src/gui/view_main.cpp"
|
||||
#include "radio/src/gui/view_statistics.cpp"
|
||||
#include "radio/src/gui/view_telemetry.cpp"
|
||||
#include "radio/src/lcd.cpp"
|
||||
#include "radio/src/lcd_common.cpp"
|
||||
#include "radio/src/lcd_default.cpp"
|
||||
#include "radio/src/keys.cpp"
|
||||
#include "radio/src/simpgmspace.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/templates.cpp"
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/fonts.cpp"
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
#define FAS_OFFSET
|
||||
|
||||
#define EEPROM_VARIANT SIMU_STOCK_VARIANTS
|
||||
#define GAUGES
|
||||
@@ -81,9 +83,10 @@ namespace OpenTxM64 {
|
||||
#include "radio/src/gui/view_main.cpp"
|
||||
#include "radio/src/gui/view_statistics.cpp"
|
||||
#include "radio/src/gui/view_telemetry.cpp"
|
||||
#include "radio/src/lcd.cpp"
|
||||
#include "radio/src/lcd_common.cpp"
|
||||
#include "radio/src/lcd_default.cpp"
|
||||
#include "radio/src/keys.cpp"
|
||||
#include "radio/src/simpgmspace.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/telemetry/frsky.cpp"
|
||||
#include "radio/src/telemetry/frsky_d.cpp"
|
||||
#include "radio/src/templates.cpp"
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define NUM_POTS 3
|
||||
#define EEPROM_VARIANT 3
|
||||
@@ -92,11 +93,12 @@ namespace Open9xSky9x {
|
||||
#include "radio/src/gui/view_telemetry.cpp"
|
||||
#include "radio/src/gui/view_about.cpp"
|
||||
#include "radio/src/gui/view_text.cpp"
|
||||
#include "radio/src/lcd.cpp"
|
||||
#include "radio/src/lcd_common.cpp"
|
||||
#include "radio/src/lcd_default.cpp"
|
||||
#include "radio/src/logs.cpp"
|
||||
#include "radio/src/targets/sky9x/keys_driver.cpp"
|
||||
#include "radio/src/keys.cpp"
|
||||
#include "radio/src/simpgmspace.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/templates.cpp"
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/fonts.cpp"
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define EEPROM_VARIANT 3
|
||||
#define HAPTIC
|
||||
#define REVPLUS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define NUM_POTS 5
|
||||
|
||||
@@ -99,7 +100,8 @@ inline int geteepromsize() {
|
||||
#include "radio/src/gui/view_telemetry.cpp"
|
||||
#include "radio/src/gui/view_text.cpp"
|
||||
#include "radio/src/gui/view_about.cpp"
|
||||
#include "radio/src/lcd.cpp"
|
||||
#include "radio/src/lcd_common.cpp"
|
||||
#include "radio/src/lcd_taranis.cpp"
|
||||
#include "radio/src/logs.cpp"
|
||||
#include "radio/src/rtc.cpp"
|
||||
#include "radio/src/targets/taranis/keys_driver.cpp"
|
||||
@@ -109,7 +111,7 @@ inline int geteepromsize() {
|
||||
#include "radio/src/targets/taranis/haptic_driver.cpp"
|
||||
// TODO Because FatFS in not C++ there cannot be namespaces there and the functions are defined several times!
|
||||
#undef SDCARD
|
||||
#include "radio/src/simpgmspace.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#define SDCARD
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/fonts.cpp"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define MAX_MIXERS(board, version) (IS_ARM(board) ? 64 : 32)
|
||||
#define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16)
|
||||
#define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14))
|
||||
#define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 15 : 12))
|
||||
#define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : ((IS_DBLEEPROM(board, version) && version<217) ? 15 : 12))
|
||||
#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? (version >= 216 ? 64 : 32) : (IS_DBLEEPROM(board, version) ? 24 : 16))
|
||||
#define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES)
|
||||
#define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
|
||||
@@ -40,11 +40,11 @@ inline int switchIndex(int i, BoardEnum board, unsigned int version)
|
||||
class SwitchesConversionTable: public ConversionTable {
|
||||
|
||||
public:
|
||||
SwitchesConversionTable(BoardEnum board, unsigned int version, unsigned long flags=0)
|
||||
SwitchesConversionTable(BoardEnum board, unsigned int version, bool timer=false)
|
||||
{
|
||||
int val=0;
|
||||
int offset=0;
|
||||
if (flags & POPULATE_TIMER_MODES) {
|
||||
if (timer) {
|
||||
offset = 4;
|
||||
for (int i=0; i<5; i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TIMER_MODE, i), val++);
|
||||
@@ -56,8 +56,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
|
||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
||||
int s = switchIndex(i, board, version);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val);
|
||||
if (IS_TARANIS(board) && s>=21/*SHup/SHdown*/) {
|
||||
addImportConversion(RawSwitch(SWITCH_TYPE_SWITCH, 21+22-s), -val+offset);
|
||||
addExportConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
}
|
||||
else {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
}
|
||||
val++;
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
@@ -86,17 +93,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
|
||||
}
|
||||
|
||||
if (!(flags & POPULATE_TIMER_MODES)) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||
if (version >= 216) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, -1), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, 1), val++);
|
||||
if (IS_ARM(board)) {
|
||||
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
||||
}
|
||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||
if (version >= 216) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, -1), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, 1), val++);
|
||||
if (IS_ARM(board)) {
|
||||
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,6 +129,16 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
ConversionTable::addConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
void addImportConversion(const RawSwitch & sw, const int b)
|
||||
{
|
||||
ConversionTable::addImportConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
void addExportConversion(const RawSwitch & sw, const int b)
|
||||
{
|
||||
ConversionTable::addExportConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
class Cache {
|
||||
public:
|
||||
Cache(BoardEnum board, unsigned int version, unsigned long flags, SwitchesConversionTable * table):
|
||||
@@ -235,8 +250,9 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_SWITCH, i), val++);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++)
|
||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i), val++);
|
||||
}
|
||||
}
|
||||
|
||||
if (!afterrelease21March2013) {
|
||||
@@ -369,7 +385,8 @@ template <int N>
|
||||
class SwitchField: public ConversionField< SignedField<N> > {
|
||||
public:
|
||||
SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0):
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch"),
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch",
|
||||
"Switch "+ sw.toString()+" cannot be exported on this board!"),
|
||||
sw(sw),
|
||||
_switch(0)
|
||||
{
|
||||
@@ -503,7 +520,8 @@ template <int N>
|
||||
class SourceField: public ConversionField< UnsignedField<N> > {
|
||||
public:
|
||||
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
|
||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags), "Source"),
|
||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
|
||||
"Source", "Source "+ source.toString(ModelData())+" cannot be exported on this board!"),
|
||||
source(source),
|
||||
_source(0)
|
||||
{
|
||||
@@ -867,8 +885,8 @@ class MixField: public TransformedField {
|
||||
internalField.Append(new SpareBitsField<8>());
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<4>(_destCh));
|
||||
internalField.Append(new UnsignedField<4>(mix.mixWarn));
|
||||
internalField.Append(new UnsignedField<5>(_destCh));
|
||||
internalField.Append(new UnsignedField<3>(mix.mixWarn));
|
||||
internalField.Append(new UnsignedField<16>(mix.phases));
|
||||
internalField.Append(new BoolField<1>(_curveMode));
|
||||
internalField.Append(new BoolField<1>(mix.noExpo));
|
||||
@@ -1016,11 +1034,13 @@ class MixField: public TransformedField {
|
||||
|
||||
if (mix.srcRaw.type != SOURCE_TYPE_NONE) {
|
||||
mix.destCh = _destCh + 1;
|
||||
if (!IS_ARM(board) || version < 216) {
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (!_curveMode)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarToC9x(_curveParam));
|
||||
else if (_curveParam > 6)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
|
||||
else if (_curveParam < 0)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam);
|
||||
else
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
|
||||
}
|
||||
@@ -1080,7 +1100,7 @@ class InputField: public TransformedField {
|
||||
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
|
||||
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
|
||||
internalField.Append(new ZCharField<8>(expo.name));
|
||||
internalField.Append(new SignedField<8>(expo.offset, "Offset"));
|
||||
internalField.Append(new SignedField<8>(_offset, "Offset"));
|
||||
internalField.Append(new CurveReferenceField(expo.curve, board, version));
|
||||
internalField.Append(new SpareBitsField<8>());
|
||||
}
|
||||
@@ -1133,7 +1153,11 @@ class InputField: public TransformedField {
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
_offset = smallGvarToEEPROM(expo.offset);
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||
@@ -1166,6 +1190,10 @@ class InputField: public TransformedField {
|
||||
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
expo.offset = smallGvarToC9x(_offset);
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (!_curveMode)
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
|
||||
@@ -1183,24 +1211,49 @@ class InputField: public TransformedField {
|
||||
unsigned int version;
|
||||
bool _curveMode;
|
||||
int _weight;
|
||||
int _offset;
|
||||
int _curveParam;
|
||||
};
|
||||
|
||||
class LimitField: public StructField {
|
||||
public:
|
||||
template <int shift>
|
||||
static int exportLimitValue(int value)
|
||||
{
|
||||
if (value > 10000)
|
||||
return 4095 + value - 10000;
|
||||
else if (value < -10000)
|
||||
return -4096 + value + 10000;
|
||||
else
|
||||
return value + shift;
|
||||
}
|
||||
|
||||
template <int shift>
|
||||
static int importLimitValue(int value)
|
||||
{
|
||||
if (value > 4095)
|
||||
return 10000 + value - 4095;
|
||||
else if (value < -4096)
|
||||
return -10000 + value + 4096;
|
||||
else
|
||||
return value - shift;
|
||||
}
|
||||
|
||||
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
|
||||
StructField("Limit")
|
||||
{
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, +1000));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||
}
|
||||
else {
|
||||
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
||||
Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new SignedField<14>(limit.offset));
|
||||
}
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new SignedField<14>(limit.offset));
|
||||
Append(new BoolField<1>(limit.symetrical));
|
||||
Append(new BoolField<1>(limit.revert));
|
||||
if (HAS_LARGE_LCD(board)) {
|
||||
@@ -1255,14 +1308,14 @@ class CurvesField: public TransformedField {
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count);
|
||||
if (offset > maxPoints) {
|
||||
EEPROMWarnings += ::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints) + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count) - 5;
|
||||
if (offset > maxPoints - 5 * maxCurves) {
|
||||
EEPROMWarnings += ::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints) + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints));
|
||||
break;
|
||||
}
|
||||
_curves[i] = offset;
|
||||
@@ -1544,9 +1597,25 @@ class LogicalSwitchField: public TransformedField {
|
||||
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
RawSource val1(csw.val1);
|
||||
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
|
||||
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
|
||||
}
|
||||
RawSource val2(csw.val2);
|
||||
if (val2.type == SOURCE_TYPE_STICK && val2.index < NUM_STICKS) {
|
||||
csw.val2 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val2.index).toValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (csw.func != LS_FN_OFF) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
RawSource val1(csw.val1);
|
||||
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
|
||||
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
|
||||
}
|
||||
}
|
||||
csw.val2 = v2;
|
||||
RawSource val1(csw.val1);
|
||||
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
|
||||
@@ -2061,6 +2130,10 @@ class AvrCustomFunctionField: public TransformedField {
|
||||
if (version >= 216) {
|
||||
fn.func = AssignFunc(fn.func + (_union_param >> 2));
|
||||
fn.adjustMode = (_union_param & 0x03);
|
||||
if (fn.adjustMode == 1)
|
||||
sourcesConversionTable->importValue(_param, (int &)fn.param);
|
||||
else if (fn.adjustMode == 2)
|
||||
fn.param = RawSource(SOURCE_TYPE_GVAR, _param).toValue();
|
||||
}
|
||||
else if (version >= 213) {
|
||||
fn.adjustMode = ((_active >> 1) & 0x03);
|
||||
@@ -2331,10 +2404,9 @@ class FrskyField: public StructField {
|
||||
Append(new UnsignedField<3>(frsky.varioSource));
|
||||
Append(new SignedField<5>(frsky.varioCenterMin));
|
||||
Append(new ConversionField< UnsignedField<3> >(frsky.currentSource, &telemetryCurrentSourceConversionTable, "Current Source"));
|
||||
Append(new SignedField<8>(frsky.varioCenterMax));
|
||||
Append(new SignedField<5>(frsky.varioCenterMax));
|
||||
if (version >= 216) {
|
||||
// TODO int8_t fasOffset;
|
||||
Append(new SpareBitsField<8>());
|
||||
Append(new SignedField<8>(frsky.fasOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2390,13 +2462,13 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
}
|
||||
|
||||
for (int i=0; i<O9X_MAX_TIMERS; i++) {
|
||||
internalField.Append(new SwitchField<8>(modelData.timers[i].mode, board, version, POPULATE_TIMER_MODES));
|
||||
internalField.Append(new SwitchField<8>(modelData.timers[i].mode, board, version, true));
|
||||
if ((IS_ARM(board) || IS_2560(board)) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
|
||||
internalField.Append(new UnsignedField<2>(modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<4>());
|
||||
internalField.Append(new UnsignedField<2>(modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<3>());
|
||||
internalField.Append(new SignedField<16>(modelData.timers[i].pvalue));
|
||||
}
|
||||
else if (afterrelease21March2013) {
|
||||
@@ -2404,7 +2476,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
internalField.Append(new BoolField<1>((bool &)modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
|
||||
if (HAS_PERSISTENT_TIMERS(board)) {
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new UnsignedField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<1>());
|
||||
internalField.Append(new SignedField<16>(modelData.timers[i].pvalue));
|
||||
}
|
||||
@@ -2415,7 +2487,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
else {
|
||||
internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
|
||||
if (HAS_PERSISTENT_TIMERS(board)) {
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new UnsignedField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<15>());
|
||||
}
|
||||
}
|
||||
@@ -2424,7 +2496,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
if (IS_ARM(board))
|
||||
internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol));
|
||||
else
|
||||
internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this telemetry protocol")));
|
||||
|
||||
internalField.Append(new BoolField<1>(modelData.thrTrim));
|
||||
|
||||
@@ -2528,12 +2600,12 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
|
||||
if (IS_TARANIS(board)) {
|
||||
modulesCount = 3;
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
|
||||
internalField.Append(new UnsignedField<8>(modelData.trainerMode));
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 216) {
|
||||
modulesCount = 3;
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
|
||||
}
|
||||
|
||||
if (IS_ARM(board) && version >= 215) {
|
||||
@@ -2753,8 +2825,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
if (version >= 213) {
|
||||
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
|
||||
internalField.Append(new SpareBitsField<16>()); // mAhUsed
|
||||
internalField.Append(new SpareBitsField<32>()); // globalTimer
|
||||
internalField.Append(new UnsignedField<16>(generalData.mAhUsed));
|
||||
internalField.Append(new UnsignedField<32>(generalData.globalTimer));
|
||||
internalField.Append(new SignedField<8>(generalData.temperatureCalib)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(generalData.btBaudrate)); // TODO
|
||||
internalField.Append(new BoolField<8>(generalData.optrexDisplay)); //TODO
|
||||
@@ -2800,10 +2872,12 @@ void OpenTxGeneralData::beforeExport()
|
||||
sum += generalData.calibSpanPos[i];
|
||||
if (++count == 12) break;
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
potsType[i] = generalData.potsType[i];
|
||||
if (i<2 && potsType[i] == 1)
|
||||
potsType[i] = 0;
|
||||
if (IS_TARANIS(board)) {
|
||||
for (int i=0; i<4; i++) {
|
||||
potsType[i] = generalData.potsType[i];
|
||||
if (i<2 && potsType[i] == 1)
|
||||
potsType[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2817,9 +2891,11 @@ void OpenTxGeneralData::beforeExport()
|
||||
|
||||
void OpenTxGeneralData::afterImport()
|
||||
{
|
||||
for (int i=0; i<4; i++) {
|
||||
generalData.potsType[i] = potsType[i];
|
||||
if (i<2 && potsType[i] == 0)
|
||||
generalData.potsType[i] = 1;
|
||||
if (IS_TARANIS(board)) {
|
||||
for (int i=0; i<4; i++) {
|
||||
generalData.potsType[i] = potsType[i];
|
||||
if (i<2 && potsType[i] == 0)
|
||||
generalData.potsType[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +163,20 @@ bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &mode
|
||||
}
|
||||
else {
|
||||
// load from SD Backup, size is stored in index
|
||||
QByteArray eepromData((char *)data, index);
|
||||
open9xModel.Import(eepromData);
|
||||
QByteArray backupData((char *)data, index);
|
||||
QByteArray modelData;
|
||||
if (IS_SKY9X(board))
|
||||
modelData = backupData;
|
||||
else
|
||||
importRlc(modelData, backupData);
|
||||
if (modelData.size()) {
|
||||
open9xModel.Import(modelData);
|
||||
// open9xModel.Dump();
|
||||
model.used = true;
|
||||
}
|
||||
else {
|
||||
model.clear();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -369,10 +381,10 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
break;
|
||||
case BOARD_GRUVIN9X:
|
||||
case BOARD_MEGA2560:
|
||||
version = 216;
|
||||
version = 217;
|
||||
break;
|
||||
case BOARD_M128:
|
||||
version = 216;
|
||||
version = 217;
|
||||
break;
|
||||
case BOARD_STOCK:
|
||||
version = 216;
|
||||
@@ -402,10 +414,21 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
}
|
||||
}
|
||||
|
||||
if (!EEPROMWarnings.isEmpty())
|
||||
if (!EEPROMWarnings.empty()) {
|
||||
QString msg;
|
||||
int noErrorsToDisplay = std::min((int)EEPROMWarnings.size(),10);
|
||||
for (int n = 0; n < noErrorsToDisplay; n++) {
|
||||
msg += "-" + EEPROMWarnings.front() + "\n";
|
||||
EEPROMWarnings.pop_front();
|
||||
}
|
||||
if (!EEPROMWarnings.empty()) {
|
||||
msg = QObject::tr("(displaying only first 10 warnings)") + "\n" + msg;
|
||||
}
|
||||
EEPROMWarnings.clear();
|
||||
QMessageBox::warning(NULL,
|
||||
QObject::tr("Warning"),
|
||||
QObject::tr("EEPROM saved with these warnings:") + "\n- " + EEPROMWarnings.remove(EEPROMWarnings.length()-1, 1).replace("\n", "\n- "));
|
||||
QObject::tr("EEPROM saved with these warnings:") + "\n" + msg);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -556,11 +579,11 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
return 24;
|
||||
else
|
||||
return 16;
|
||||
case SafetyChannelCustomFunction:
|
||||
return id.contains("noovveridech") ? 0 : 1;
|
||||
case LogicalSwitches:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
else if (board==BOARD_GRUVIN9X||board==BOARD_M128)
|
||||
return 15;
|
||||
else
|
||||
return 12;
|
||||
case CustomAndSwitches:
|
||||
@@ -621,7 +644,10 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case HasCvNames:
|
||||
return (IS_TARANIS(board) ? 1 : 0);
|
||||
case Telemetry:
|
||||
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
|
||||
if (board == BOARD_GRUVIN9X || IS_ARM(board) || id.contains("frsky") || id.contains("telemetrez"))
|
||||
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
|
||||
else
|
||||
return 0;
|
||||
case TelemetryBars:
|
||||
return 1;
|
||||
case TelemetryCustomScreens:
|
||||
@@ -637,7 +663,9 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case TelemetryMaxMultiplier:
|
||||
return (IS_ARM(board) ? 32 : 8);
|
||||
case PPMCenter:
|
||||
return 1;
|
||||
return (IS_TARANIS(board) || id.contains("ppmca")) ? 1 : 0;
|
||||
case PPMUnitMicroseconds:
|
||||
return id.contains("ppmus") ? 1 : 0;
|
||||
case SYMLimits:
|
||||
return 1;
|
||||
case OptrexDisplay:
|
||||
@@ -871,6 +899,9 @@ bool OpenTxEepromInterface::checkVersion(unsigned int version)
|
||||
case 216:
|
||||
// A lot of things (first github release)
|
||||
break;
|
||||
case 217:
|
||||
// 3 logical switches removed on M128 / gruvin9x boards
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -904,11 +935,32 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
|
||||
{
|
||||
std::cout << "trying " << getName() << " backup import...";
|
||||
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0 || eeprom[3] != 0x30+board) {
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) {
|
||||
std::cout << " no\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
BoardEnum backupBoard = (BoardEnum)-1;
|
||||
switch (eeprom[3]) {
|
||||
case 0x33:
|
||||
backupBoard = BOARD_TARANIS;
|
||||
break;
|
||||
case 0x32:
|
||||
backupBoard = BOARD_SKY9X;
|
||||
break;
|
||||
case 0x31:
|
||||
backupBoard = BOARD_GRUVIN9X;
|
||||
break;
|
||||
default:
|
||||
std::cout << " unknown board\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backupBoard != board) {
|
||||
std::cout << " not right board\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t version = eeprom[4];
|
||||
uint8_t bcktype = eeprom[5];
|
||||
uint16_t size = ((uint16_t)eeprom[7] << 8) + eeprom[6];
|
||||
@@ -997,6 +1049,15 @@ SimulatorInterface * OpenTxFirmware::getSimulator()
|
||||
}
|
||||
}
|
||||
|
||||
void addOpenTxCommonOptions(OpenTxFirmware * firmware)
|
||||
{
|
||||
firmware->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
firmware->addOption("nooverridech", QObject::tr("No OverrideCH functions available"));
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE (no telemetry) at field") }, { "faimode", QObject::tr("FAI MODE (no telemetry) always enabled") }, { NULL } };
|
||||
firmware->addOptions(fai_options);
|
||||
}
|
||||
|
||||
void registerOpenTxFirmwares()
|
||||
{
|
||||
OpenTxFirmware * openTx;
|
||||
@@ -1004,7 +1065,6 @@ void registerOpenTxFirmwares()
|
||||
Option ext_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "telemetrez", QObject::tr("Support for telemetry easy board"), 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 nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } };
|
||||
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 */
|
||||
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK);
|
||||
@@ -1020,7 +1080,6 @@ void registerOpenTxFirmwares()
|
||||
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
|
||||
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOptions(nav_options);
|
||||
@@ -1031,7 +1090,6 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
|
||||
openTx->addOption("pgbar", QObject::tr("EEprom write progress bar"));
|
||||
openTx->addOption("imperial", QObject::tr("Imperial units"));
|
||||
@@ -1041,7 +1099,7 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
|
||||
openTx->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
|
||||
openTx->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
@@ -1058,7 +1116,6 @@ void registerOpenTxFirmwares()
|
||||
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
|
||||
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOptions(nav_options);
|
||||
@@ -1069,11 +1126,10 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
|
||||
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
|
||||
openTx->addOption("imperial", QObject::tr("Imperial units"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* 9XR board */
|
||||
@@ -1090,7 +1146,6 @@ void registerOpenTxFirmwares()
|
||||
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
|
||||
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
@@ -1099,7 +1154,6 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
|
||||
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
|
||||
openTx->addOption("imperial", QObject::tr("Imperial units"));
|
||||
@@ -1108,7 +1162,7 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nogps", QObject::tr("No GPS support"));
|
||||
openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
|
||||
openTx->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* 9XR board with M128 chip */
|
||||
@@ -1125,7 +1179,6 @@ void registerOpenTxFirmwares()
|
||||
// NOT TESTED openTx->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
|
||||
openTx->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
@@ -1134,11 +1187,10 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
|
||||
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
|
||||
openTx->addOption("imperial", QObject::tr("Imperial units"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* Gruvin9x board */
|
||||
@@ -1153,7 +1205,6 @@ void registerOpenTxFirmwares()
|
||||
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
|
||||
openTx->addOptions(dsm2_options);
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
@@ -1163,10 +1214,9 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
|
||||
openTx->addOption("imperial", QObject::tr("Imperial units"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* Sky9x board */
|
||||
@@ -1176,7 +1226,6 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nofp", QObject::tr("No flight modes"));
|
||||
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
@@ -1186,10 +1235,8 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR"));
|
||||
openTx->addOption("bluetooth", QObject::tr("Bluetooth interface"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* 9XR-Pro */
|
||||
@@ -1199,20 +1246,16 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nofp", QObject::tr("No flight modes"));
|
||||
openTx->addOption("nocurves", QObject::tr("Disable curves menus"));
|
||||
openTx->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
openTx->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
openTx->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
openTx->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
|
||||
openTx->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
|
||||
openTx->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
|
||||
openTx->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
openTx->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
openTx->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOption("tsticks", QObject::tr("Use FrSky Taranis sticks in a 9X/9XR"));
|
||||
openTx->addOption("bluetooth", QObject::tr("Bluetooth interface"));
|
||||
openTx->addOptions(fai_options);
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* Taranis board */
|
||||
@@ -1221,9 +1264,8 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
openTx->addOption("haptic", QObject::tr("Haptic module installed"));
|
||||
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOptions(fai_options);
|
||||
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
/* Taranis Plus board */
|
||||
@@ -1231,12 +1273,11 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
openTx->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
openTx->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
openTx->addOptions(fai_options);
|
||||
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
default_firmware_variant = GetFirmware("opentx-9x-heli-templates-en");
|
||||
default_firmware_variant = GetFirmware("opentx-taranis-en");
|
||||
current_firmware_variant = default_firmware_variant;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-20.open-tx.org/companion"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-20.open-tx.org/firmware"
|
||||
|
||||
class RleFile;
|
||||
|
||||
@@ -124,8 +124,8 @@ t_Th9xLimitData::t_Th9xLimitData()
|
||||
t_Th9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -197,7 +197,7 @@ int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
v1 = 1+source.index;
|
||||
else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
|
||||
EEPROMWarnings += ::QObject::tr("th9x on this board doesn't have Rotary Encoders") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("th9x on this board doesn't have Rotary Encoders"));
|
||||
v1 = 5+source.index;
|
||||
}
|
||||
else if (source.type == SOURCE_TYPE_MAX)
|
||||
@@ -272,7 +272,6 @@ t_Th9xModelData::operator ModelData ()
|
||||
/*c9x.protocol = (Protocol)protocol;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncTrims2Offsets;
|
||||
|
||||
@@ -219,21 +219,13 @@ bool FlashInterface::setSplash(const QImage & newsplash)
|
||||
QColor color;
|
||||
QByteArray splash;
|
||||
if (splash_format == QImage::Format_Indexed8) {
|
||||
unsigned int idx = 0;
|
||||
for (unsigned int y=0; y<splash_height; y+=8) {
|
||||
for (unsigned int x=0; x<splash_width; x++) {
|
||||
unsigned int values[] = { 255, 255, 255, 255 };
|
||||
for (unsigned int z=0; z<8; z++) {
|
||||
if (y+z < splash_height) {
|
||||
QRgb gray = qGray(newsplash.pixel(x, y+z));
|
||||
for (unsigned int i=0; i<4; i++) {
|
||||
if (gray & (1<<(4+i)))
|
||||
values[i] -= 1 << z;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<4; i++)
|
||||
b[idx++] = values[i];
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
unsigned int idx = (y/2)*splash_width;
|
||||
for (unsigned int x=0; x<splash_width; x++, idx++) {
|
||||
QRgb gray = qGray(newsplash.pixel(x, y));
|
||||
uint8_t z = ((255-gray)*15)/255;
|
||||
if (y & 1) z <<= 4;
|
||||
b[idx] |= z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +235,7 @@ bool FlashInterface::setSplash(const QImage & newsplash)
|
||||
for (uint y=0; y<splash_height; y++) {
|
||||
for (uint x=0; x<splash_width; x++) {
|
||||
color = QColor(blackNwhite.pixel(x,y));
|
||||
b[splash_width*(y/8) + x] |=((color==black ? 1: 0)<<(y % 8));
|
||||
b[splash_width*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -278,10 +270,10 @@ QImage FlashInterface::getSplash()
|
||||
QImage image(splash_width, splash_height, QImage::Format_RGB888);
|
||||
if (splash_offset > 0) {
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
unsigned int idx = (y/8)*splash_width*4;
|
||||
unsigned int mask = (1 << (y%8));
|
||||
for (unsigned int x=0; x<splash_width; x++, idx+=4) {
|
||||
unsigned int z = ((flash.at(splash_offset+idx) & mask) ? 0x1 : 0) + ((flash.at(splash_offset+idx+1) & mask) ? 0x2 : 0) + ((flash.at(splash_offset+idx+2) & mask) ? 0x4 : 0) + ((flash.at(splash_offset+idx+3) & mask) ? 0x8 : 0);
|
||||
unsigned int idx = (y/2)*splash_width;
|
||||
for (unsigned int x=0; x<splash_width; x++, idx++) {
|
||||
uint8_t byte = flash.at(splash_offset+idx);
|
||||
unsigned int z = (y & 1) ? (byte >> 4) : (byte & 0x0F);
|
||||
z = 255-(z*255)/15;
|
||||
QRgb rgb = qRgb(z, z, z);
|
||||
image.setPixel(x, y, rgb);
|
||||
@@ -293,9 +285,11 @@ QImage FlashInterface::getSplash()
|
||||
else {
|
||||
QImage image(splash_width, splash_height, QImage::Format_Mono);
|
||||
if (splash_offset > 0) {
|
||||
for (unsigned int y=0; y<splash_height; y++)
|
||||
for(unsigned int x=0; x<splash_width; x++)
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
for(unsigned int x=0; x<splash_width; x++) {
|
||||
image.setPixel(x, y, (flash.at(splash_offset+(splash_width*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,10 @@ These will be relevant for all models in the same EEPROM.</string>
|
||||
<item>
|
||||
<widget class="QSlider" name="backlightColor_SL">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -3195,7 +3198,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3203,6 +3206,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
@@ -3236,7 +3244,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3244,6 +3252,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
@@ -3284,7 +3297,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3292,6 +3305,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
#include <QtGui>
|
||||
#if defined WIN32
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if !defined WIN32 && defined __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "simulatordialog.h"
|
||||
@@ -140,18 +147,18 @@ void populatePhasesCB(QComboBox *b, int value)
|
||||
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
||||
}
|
||||
|
||||
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
|
||||
GVarGroup::GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
|
||||
QObject(),
|
||||
weightGV(weightGV),
|
||||
weightSB(weightSB),
|
||||
sb(dynamic_cast<QSpinBox *>(weightSB)),
|
||||
dsb(dynamic_cast<QDoubleSpinBox *>(weightSB)),
|
||||
weightCB(weightCB),
|
||||
weight(weight),
|
||||
flags(flags),
|
||||
lock(false)
|
||||
step(step),
|
||||
lock(true)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(Gvars)) {
|
||||
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
|
||||
populateGVCB(weightCB, weight);
|
||||
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
@@ -163,21 +170,32 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||
}
|
||||
}
|
||||
|
||||
weightSB->setMinimum(mini);
|
||||
weightSB->setMaximum(maxi);
|
||||
int val;
|
||||
|
||||
if (weight>maxi || weight<mini) {
|
||||
val = deflt;
|
||||
weightGV->setChecked(true);
|
||||
weightSB->hide();
|
||||
weightCB->show();
|
||||
}
|
||||
else {
|
||||
val = weight;
|
||||
weightGV->setChecked(false);
|
||||
weightSB->setValue(weight);
|
||||
weightSB->show();
|
||||
weightCB->hide();
|
||||
}
|
||||
|
||||
if (sb) {
|
||||
sb->setMinimum(mini);
|
||||
sb->setMaximum(maxi);
|
||||
sb->setValue(val);
|
||||
}
|
||||
else {
|
||||
dsb->setMinimum(mini*step);
|
||||
dsb->setMaximum(maxi*step);
|
||||
dsb->setValue(val*step);
|
||||
}
|
||||
|
||||
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
|
||||
lock = false;
|
||||
@@ -186,16 +204,23 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||
void GVarGroup::gvarCBChanged(int state)
|
||||
{
|
||||
weightCB->setVisible(state);
|
||||
weightSB->setVisible(!state);
|
||||
if (weightSB)
|
||||
weightSB->setVisible(!state);
|
||||
else
|
||||
weightSB->setVisible(!state);
|
||||
valuesChanged();
|
||||
}
|
||||
|
||||
void GVarGroup::valuesChanged()
|
||||
{
|
||||
if (weightGV->isChecked())
|
||||
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
||||
else
|
||||
weight = weightSB->value();
|
||||
if (!lock) {
|
||||
if (weightGV->isChecked())
|
||||
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
||||
else if (sb)
|
||||
weight = sb->value();
|
||||
else
|
||||
weight = dsb->value()/step;
|
||||
}
|
||||
}
|
||||
|
||||
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
|
||||
@@ -216,7 +241,7 @@ CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox
|
||||
|
||||
curveValueCB->setMaxVisibleItems(10);
|
||||
|
||||
connect(curveTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(curveTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
|
||||
connect(curveGVarCB, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||
connect(curveValueCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(curveValueSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
@@ -300,6 +325,28 @@ void CurveGroup::gvarCBChanged(int state)
|
||||
}
|
||||
}
|
||||
|
||||
void CurveGroup::typeChanged(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_DIFF, 0);
|
||||
break;
|
||||
case 1:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_EXPO, 0);
|
||||
break;
|
||||
case 2:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_FUNC, 0);
|
||||
break;
|
||||
case 3:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void CurveGroup::valuesChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
@@ -349,13 +396,13 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context)
|
||||
{
|
||||
RawSwitch item;
|
||||
|
||||
b->clear();
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
if (context != MixesContext) {
|
||||
// !FMx
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
||||
@@ -364,14 +411,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
// !One
|
||||
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
// OFF
|
||||
item = RawSwitch(SWITCH_TYPE_OFF);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
|
||||
@@ -404,11 +443,15 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
|
||||
for (int i=-GetCurrentFirmware()->getCapability(SwitchesPositions); i<0; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
//hide up and down for !SH and !SF, because they are redundant (!SFup == SFdown)
|
||||
if (item.toString().contains("H") || item.toString().contains("F")) continue;
|
||||
}
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_TIMER_MODES) {
|
||||
if (context == TimersContext) {
|
||||
for (int i=0; i<5; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_TIMER_MODE, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
@@ -455,7 +498,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
if (context == CustomFunctionsContext) {
|
||||
// ON
|
||||
item = RawSwitch(SWITCH_TYPE_ON);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
@@ -464,7 +507,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
// FMx
|
||||
}
|
||||
|
||||
// FMx
|
||||
if (context != MixesContext) {
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||
@@ -756,19 +802,35 @@ QString getFrSkySrc(int index)
|
||||
|
||||
QString getTrimInc(ModelData * g_model)
|
||||
{
|
||||
switch (g_model->trimInc) {
|
||||
case (1): return QObject::tr("Extra Fine");
|
||||
case (2): return QObject::tr("Fine");
|
||||
case (3): return QObject::tr("Medium");
|
||||
case (4): return QObject::tr("Coarse");
|
||||
default: return QObject::tr("Exponential");
|
||||
}
|
||||
switch (g_model->trimInc) {
|
||||
case -2:
|
||||
return QObject::tr("Exponential");
|
||||
case -1:
|
||||
return QObject::tr("Extra Fine");
|
||||
case 0:
|
||||
return QObject::tr("Fine");
|
||||
case 1:
|
||||
return QObject::tr("Medium");
|
||||
case 2:
|
||||
return QObject::tr("Coarse");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString getTimerStr(TimerData & timer)
|
||||
{
|
||||
QString str = ", " + (timer.dir ? QObject::tr("Count Up") : QObject::tr("Count Down"));
|
||||
return QObject::tr("%1:%2, ").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0')) + timer.mode.toString() + str;
|
||||
QString result = QObject::tr("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
|
||||
result += QString(", ") + timer.mode.toString();
|
||||
if (timer.persistent)
|
||||
result += QObject::tr(", Persistent");
|
||||
if (timer.minuteBeep)
|
||||
result += QObject::tr(", MinuteBeep");
|
||||
if (timer.countdownBeep == 1)
|
||||
result += QObject::tr(", CountDown(Beeps)");
|
||||
else if (timer.countdownBeep == 2)
|
||||
result += QObject::tr(", CountDown(Voice)");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getProtocol(ModelData * g_model)
|
||||
@@ -809,18 +871,37 @@ QString getPhasesStr(unsigned int phases, ModelData & model)
|
||||
}
|
||||
}
|
||||
|
||||
QString getCenterBeep(ModelData * g_model)
|
||||
QString getCenterBeepStr(ModelData * g_model)
|
||||
{
|
||||
//RETA123
|
||||
QStringList strl;
|
||||
if(g_model->beepANACenter & 0x01) strl << QObject::tr("Rudder");
|
||||
if(g_model->beepANACenter & 0x02) strl << QObject::tr("Elevator");
|
||||
if(g_model->beepANACenter & 0x04) strl << QObject::tr("Throttle");
|
||||
if(g_model->beepANACenter & 0x08) strl << QObject::tr("Aileron");
|
||||
if(g_model->beepANACenter & 0x10) strl << "P1";
|
||||
if(g_model->beepANACenter & 0x20) strl << "P2";
|
||||
if(g_model->beepANACenter & 0x40) strl << "P3";
|
||||
if(g_model->beepANACenter & 0x80) strl << "LS";
|
||||
if (g_model->beepANACenter & 0x01)
|
||||
strl << QObject::tr("Rudder");
|
||||
if (g_model->beepANACenter & 0x02)
|
||||
strl << QObject::tr("Elevator");
|
||||
if (g_model->beepANACenter & 0x04)
|
||||
strl << QObject::tr("Throttle");
|
||||
if (g_model->beepANACenter & 0x08)
|
||||
strl << QObject::tr("Aileron");
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "S1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "S2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "S3";
|
||||
if (g_model->beepANACenter & 0x80)
|
||||
strl << "LS";
|
||||
if (g_model->beepANACenter & 0x100)
|
||||
strl << "RS";
|
||||
}
|
||||
else {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "P1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "P2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "P3";
|
||||
}
|
||||
return strl.join(", ");
|
||||
}
|
||||
|
||||
@@ -938,3 +1019,16 @@ QString index2version(int index)
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
int qunlink(const QString & fileName)
|
||||
{
|
||||
QByteArray ba = fileName.toLatin1();
|
||||
return unlink(ba.constData());
|
||||
}
|
||||
|
||||
QString generateProcessUniqueTempFileName(const QString & fileName)
|
||||
{
|
||||
QString sanitizedFileName = fileName;
|
||||
sanitizedFileName.remove('/');
|
||||
return QDir::tempPath() + QString("/%1-").arg(QCoreApplication::applicationPid()) + sanitizedFileName;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
extern const QColor colors[C9X_MAX_CURVES];
|
||||
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
|
||||
#define TMR_NUM_OPTION (TMRMODE_COUNT+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
|
||||
|
||||
//convert from mode 1 to mode generalSettings.stickMode
|
||||
//NOTICE! => 1..4 -> 1..4
|
||||
@@ -37,12 +37,12 @@ class CompanionIcon: public QIcon {
|
||||
CompanionIcon(QString baseimage);
|
||||
};
|
||||
|
||||
class GVarGroup : public QObject {
|
||||
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);
|
||||
GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
@@ -50,10 +50,12 @@ class GVarGroup : public QObject {
|
||||
|
||||
protected:
|
||||
QCheckBox *weightGV;
|
||||
QSpinBox *weightSB;
|
||||
QAbstractSpinBox *weightSB;
|
||||
QSpinBox *sb;
|
||||
QDoubleSpinBox *dsb;
|
||||
QComboBox *weightCB;
|
||||
int & weight;
|
||||
const unsigned int flags;
|
||||
double step;
|
||||
bool lock;
|
||||
};
|
||||
|
||||
@@ -67,6 +69,7 @@ class CurveGroup : public QObject {
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
void typeChanged(int);
|
||||
void valuesChanged();
|
||||
|
||||
protected:
|
||||
@@ -80,9 +83,15 @@ class CurveGroup : public QObject {
|
||||
int lastType;
|
||||
};
|
||||
|
||||
#define POPULATE_ONOFF 0x01
|
||||
#define POPULATE_TIMER_MODES 0x02
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
CustomFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context);
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
@@ -113,7 +122,7 @@ int findmult(float value, float base);
|
||||
QString getTrimInc(ModelData * g_model);
|
||||
QString getTimerStr(TimerData & timer);
|
||||
QString getProtocol(ModelData * g_model);
|
||||
QString getCenterBeep(ModelData * g_model);
|
||||
QString getCenterBeepStr(ModelData * g_model);
|
||||
|
||||
/* FrSky helpers */
|
||||
QString getFrSkyAlarmType(int alarm);
|
||||
@@ -138,4 +147,8 @@ class QTimeS : public QTime
|
||||
int seconds() const { return hour()*3600 + minute()*60 + second(); };
|
||||
};
|
||||
|
||||
int qunlink(const QString & fileName);
|
||||
|
||||
QString generateProcessUniqueTempFileName(const QString & fileName);
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
||||
@@ -239,13 +239,13 @@ void logsDialog::on_mapsButton_clicked() {
|
||||
itemSelected=n-1;
|
||||
}
|
||||
|
||||
QString geFilename = QDir::tempPath() + "/track0.png";
|
||||
if (QFile::exists(geFilename)) {
|
||||
QFile::remove(geFilename);
|
||||
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
|
||||
if (QFile::exists(geIconFilename)) {
|
||||
QFile::remove(geIconFilename);
|
||||
}
|
||||
QFile::copy(":/images/track0.png", geFilename);
|
||||
QFile::copy(":/images/track0.png", geIconFilename);
|
||||
|
||||
geFilename = QDir::tempPath() + "/flight.kml";
|
||||
QString geFilename = generateProcessUniqueTempFileName("flight.kml");
|
||||
if (QFile::exists(geFilename)) {
|
||||
QFile::remove(geFilename);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void logsDialog::on_mapsButton_clicked() {
|
||||
QTextStream outputStream(&geFile);
|
||||
outputStream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">\n";
|
||||
outputStream << "\t<Document>\n\t\t<name>" << logFilename << "</name>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_n\">\n\t\t\t<IconStyle>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << QDir::tempPath() << "/track0.png</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_n\">\n\t\t\t<IconStyle>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << geIconFilename << "</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_h\">\n\t\t\t<IconStyle>\n\t\t\t\t<scale>0</scale>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << QDir::tempPath() << "/track0.png</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>8</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<StyleMap id=\"multiTrack\">\n\t\t\t<Pair>\n\t\t\t\t<key>normal</key>\n\t\t\t\t<styleUrl>#multiTrack_n</styleUrl>\n\t\t\t</Pair>\n\t\t\t<Pair>\n\t\t\t\t<key>highlight</key>\n\t\t\t\t<styleUrl>#multiTrack_h</styleUrl>\n\t\t\t</Pair>\n\t\t</StyleMap>\n";
|
||||
outputStream << "\t\t<Style id=\"lineStyle\">\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "radionotfound.h"
|
||||
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-20.open-tx.org/companion"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -632,7 +632,6 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW!
|
||||
int profnum=action->data().toInt();
|
||||
g.id( profnum );
|
||||
|
||||
// TODO Get rid of this global variable - The profile.firmware is the real source
|
||||
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
|
||||
|
||||
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
|
||||
@@ -805,9 +804,9 @@ QStringList MainWindow::GetSambaArguments(const QString &tcl)
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
QString tclFilename = QDir::tempPath() + "/temp.tcl";
|
||||
QString tclFilename = generateProcessUniqueTempFileName("temp.tcl");
|
||||
if (QFile::exists(tclFilename)) {
|
||||
unlink(tclFilename.toAscii());
|
||||
qunlink(tclFilename);
|
||||
}
|
||||
QFile tclFile(tclFilename);
|
||||
if (!tclFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
@@ -947,21 +946,23 @@ QString MainWindow::FindMassstoragePath(QString filename)
|
||||
|
||||
void MainWindow::readEeprom()
|
||||
{
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
|
||||
if (IS_ARM(eepromInterface->getBoard()))
|
||||
tempFile = tempDir + "/temp.bin";
|
||||
tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
else
|
||||
tempFile = tempDir + "/temp.hex";
|
||||
tempFile += generateProcessUniqueTempFileName("temp.hex");
|
||||
|
||||
qDebug() << "MainWindow::readEeprom(): using temp file: " << tempFile;
|
||||
|
||||
if (readEepromFromRadio(tempFile, tr("Read Models and Settings From Radio"))) {
|
||||
MdiChild *child = createMdiChild();
|
||||
child->newFile();
|
||||
child->loadFile(tempFile, false);
|
||||
child->show();
|
||||
qunlink(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,7 +1044,10 @@ bool MainWindow::readEepromFromRadio(const QString filename, const QString messa
|
||||
|
||||
QFile file(filename);
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
if (!file.remove()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Could not delete temporary file: %1").arg(filename));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
@@ -1166,13 +1170,12 @@ void MainWindow::writeBackup()
|
||||
return;
|
||||
}
|
||||
int oldrev = getEpromVersion(fileName);
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFlash = tempDir + "/flash.bin";
|
||||
QString tempFlash = generateProcessUniqueTempFileName("flash.bin");
|
||||
|
||||
if (!readFirmwareFromRadio(tempFlash))
|
||||
return;
|
||||
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("compat.bin");
|
||||
if (!convertEEPROM(fileName, restoreFile, tempFlash)) {
|
||||
int ret = QMessageBox::question(this, "Error", tr("Cannot check Models and Settings compatibility! Continue anyway?") ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
@@ -1189,9 +1192,7 @@ void MainWindow::writeBackup()
|
||||
}
|
||||
fileName = restoreFile;
|
||||
}
|
||||
QByteArray ba = tempFlash.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
qunlink(tempFlash);
|
||||
}
|
||||
else {
|
||||
if (backupEnable) {
|
||||
@@ -1305,8 +1306,7 @@ void MainWindow::writeFlash(QString fileToFlash)
|
||||
if (!fileName.isEmpty()) {
|
||||
g.backupOnFlash(backup);
|
||||
if (backup) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString backupFile = tempDir + "/backup.bin";
|
||||
QString backupFile = generateProcessUniqueTempFileName("backup.bin");
|
||||
bool backupEnable=g.enableBackup();
|
||||
QString backupPath=g.backupDir();
|
||||
if (!backupPath.isEmpty() && !IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
@@ -1328,15 +1328,15 @@ void MainWindow::writeFlash(QString fileToFlash)
|
||||
}
|
||||
|
||||
if (readEepromFromRadio(backupFile, tr("Backup Models and Settings From Radio"))) {
|
||||
sleep(1);
|
||||
sleep(2);
|
||||
int res = writeFirmwareToRadio(fileName);
|
||||
if (res) {
|
||||
QString restoreFile = tempDir + "/restore.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("restore.bin");
|
||||
if (!convertEEPROM(backupFile, restoreFile, fileName)) {
|
||||
QMessageBox::warning(this, tr("Conversion failed"), tr("Cannot convert Models and Settings for use with this firmware, original data will be used"));
|
||||
restoreFile = backupFile;
|
||||
}
|
||||
sleep(1);
|
||||
sleep(2);
|
||||
if (!writeEepromToRadio(restoreFile, tr("Restore Models and Settings To Radio"))) {
|
||||
QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to Radio. The models and settings data file can be found at: %1").arg(backupFile));
|
||||
}
|
||||
@@ -1362,6 +1362,7 @@ void MainWindow::writeFlash(QString fileToFlash)
|
||||
QDateTime datetime;
|
||||
QString backupFile = backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin";
|
||||
readEepromFromRadio(backupFile, tr("Backup Models and Settings From Radio"));
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
writeFirmwareToRadio(fileName);
|
||||
@@ -1596,7 +1597,7 @@ void MainWindow::createActions()
|
||||
writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Radio"), tr("Write Models and Settings to Radio"), SLOT(writeEeprom()));
|
||||
readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Radio"), tr("Read Models and Settings from Radio"), SLOT(readEeprom()));
|
||||
burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the Radio"), SLOT(burnConfig()));
|
||||
writeBackupToRadioAct = addAct("write_eeprom_file.png", tr("Write Backup to Radio"), tr("Write Backup from file to to Radio"), SLOT(writeBackup()));
|
||||
writeBackupToRadioAct = addAct("write_eeprom_file.png", tr("Write Backup to Radio"), tr("Write Backup from file to Radio"), SLOT(writeBackup()));
|
||||
readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup()));
|
||||
contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors()));
|
||||
|
||||
|
||||
@@ -531,8 +531,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
}
|
||||
QString stickCal=g.profile[g.id()].stickPotCalib();
|
||||
burnConfigDialog bcd;
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile = tempDir + "/temp.bin";
|
||||
QString tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
saveFile(tempFile, false);
|
||||
if(!QFileInfo(tempFile).exists()) {
|
||||
QMessageBox::critical(this,tr("Error"), tr("Cannot write temporary file!"));
|
||||
@@ -550,12 +549,12 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
return;
|
||||
}
|
||||
int oldrev=((MainWindow *)this->parent())->getEpromVersion(tempFile);
|
||||
QString tempFlash=tempDir + "/flash.bin";
|
||||
QString tempFlash = generateProcessUniqueTempFileName("flash.bin");
|
||||
|
||||
if (!((MainWindow *)this->parent())->readFirmwareFromRadio(tempFlash))
|
||||
return;
|
||||
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("compat.bin");
|
||||
if (!((MainWindow *)this->parent())->convertEEPROM(tempFile, restoreFile, tempFlash)) {
|
||||
int ret = QMessageBox::question(this, tr("Error"), tr("Cannot check eeprom compatibility! Continue anyway?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::No)
|
||||
@@ -571,9 +570,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
}
|
||||
tempFile=restoreFile;
|
||||
}
|
||||
QByteArray ba = tempFlash.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
qunlink(tempFlash);
|
||||
}
|
||||
else {
|
||||
if (backupEnable) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "channels.h"
|
||||
#include "helpers.h"
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
@@ -6,6 +7,70 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
LimitsGroup::LimitsGroup(FirmwareInterface * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
firmware(firmware),
|
||||
spinbox(new QDoubleSpinBox()),
|
||||
value(value),
|
||||
displayStep(0.1)
|
||||
{
|
||||
bool allowGVars = false;
|
||||
int internalStep = 1;
|
||||
|
||||
spinbox->setProperty("index", row);
|
||||
spinbox->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spinbox->setAccelerated(true);
|
||||
|
||||
if (firmware->getCapability(PPMUnitMicroseconds)) {
|
||||
displayStep = 0.512;
|
||||
spinbox->setDecimals(1);
|
||||
spinbox->setSuffix("us");
|
||||
}
|
||||
else {
|
||||
spinbox->setDecimals(0);
|
||||
spinbox->setSuffix("%");
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard()) || deflt == 0 /*it's the offset*/) {
|
||||
spinbox->setDecimals(1);
|
||||
allowGVars = true;
|
||||
}
|
||||
else {
|
||||
internalStep *= 10;
|
||||
}
|
||||
|
||||
spinbox->setSingleStep(displayStep*internalStep);
|
||||
|
||||
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||
QCheckBox * gv = new QCheckBox(QObject::tr("GV"));
|
||||
horizontalLayout->addWidget(gv);
|
||||
QComboBox * cb = new QComboBox();
|
||||
horizontalLayout->addWidget(cb);
|
||||
horizontalLayout->addWidget(spinbox);
|
||||
gridLayout->addLayout(horizontalLayout, row, col, 1, 1);
|
||||
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
|
||||
}
|
||||
|
||||
LimitsGroup::~LimitsGroup()
|
||||
{
|
||||
delete gvarGroup;
|
||||
}
|
||||
|
||||
void LimitsGroup::updateMinMax(int max)
|
||||
{
|
||||
if (spinbox->maximum() == 0) {
|
||||
spinbox->setMinimum(-max*displayStep);
|
||||
if (value < -max) {
|
||||
value = -max;
|
||||
}
|
||||
}
|
||||
if (spinbox->minimum() == 0) {
|
||||
spinbox->setMaximum(max*displayStep);
|
||||
if (value > max) {
|
||||
value = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
@@ -13,8 +78,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
bool minimize = false;
|
||||
|
||||
int col = 1;
|
||||
if (firmware->getCapability(ChannelsName))
|
||||
{
|
||||
if (firmware->getCapability(ChannelsName)) {
|
||||
minimize=true;
|
||||
addLabel(gridLayout, tr("Name"), col++);
|
||||
}
|
||||
@@ -52,44 +116,13 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
}
|
||||
|
||||
// Channel offset
|
||||
QDoubleSpinBox * offset = new QDoubleSpinBox(this);
|
||||
offset->setProperty("index", i);
|
||||
offset->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
offset->setAccelerated(true);
|
||||
offset->setDecimals(1);
|
||||
offset->setMinimum(-100);
|
||||
offset->setSingleStep(0.1);
|
||||
offset->setValue(float(model.limitData[i].offset) / 10);
|
||||
connect(offset, SIGNAL(editingFinished()), this, SLOT(offsetEdited()));
|
||||
gridLayout->addWidget(offset, i+1, col++, 1, 1);
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0);
|
||||
|
||||
// Channel min
|
||||
QDoubleSpinBox * minSB = new QDoubleSpinBox(this);
|
||||
minSB->setProperty("index", i);
|
||||
minSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
minSB->setAccelerated(true);
|
||||
minSB->setDecimals(1);
|
||||
minSB->setMinimum(-model.getChannelsMax());
|
||||
minSB->setSingleStep(0.1);
|
||||
minSB->setMaximum(0);
|
||||
minSB->setValue(float(model.limitData[i].min) / 10);
|
||||
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
|
||||
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
|
||||
minSpins << minSB;
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
|
||||
|
||||
// Channel max
|
||||
QDoubleSpinBox * maxSB = new QDoubleSpinBox(this);
|
||||
maxSB->setProperty("index", i);
|
||||
maxSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
maxSB->setAccelerated(true);
|
||||
maxSB->setDecimals(1);
|
||||
maxSB->setMinimum(0);
|
||||
maxSB->setSingleStep(0.1);
|
||||
maxSB->setMaximum(model.getChannelsMax());
|
||||
maxSB->setValue(float(model.limitData[i].max) / 10);
|
||||
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
|
||||
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
|
||||
maxSpins << maxSB;
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
|
||||
|
||||
// Channel inversion
|
||||
QComboBox * invCB = new QComboBox(this);
|
||||
@@ -117,6 +150,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
QSpinBox * center = new QSpinBox(this);
|
||||
center->setProperty("index", i);
|
||||
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
center->setSuffix("us");
|
||||
center->setMinimum(1375);
|
||||
center->setMaximum(1625);
|
||||
center->setValue(1500);
|
||||
@@ -134,6 +168,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Push the rows up
|
||||
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
||||
|
||||
@@ -142,6 +177,9 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
|
||||
Channels::~Channels()
|
||||
{
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
delete group;
|
||||
}
|
||||
}
|
||||
|
||||
void Channels::symlimitsEdited()
|
||||
@@ -164,43 +202,14 @@ void Channels::nameEdited()
|
||||
}
|
||||
}
|
||||
|
||||
void Channels::offsetEdited()
|
||||
{
|
||||
QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = dsb->property("index").toInt();
|
||||
model.limitData[index].offset = round(dsb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::minEdited()
|
||||
{
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].min = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::maxEdited()
|
||||
{
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].max = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::refreshExtendedLimits()
|
||||
{
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
QDoubleSpinBox * minDSB = minSpins[i];
|
||||
QDoubleSpinBox * maxDSB = maxSpins[i];
|
||||
|
||||
minDSB->setMinimum(-model.getChannelsMax());
|
||||
maxDSB->setMaximum(model.getChannelsMax());
|
||||
int channelMax = model.getChannelsMax();
|
||||
|
||||
//reset any limit that is bigger than current maximum (dependent on extended limits setting)
|
||||
if ( model.limitData[i].min < -model.getChannelsMax() ) model.limitData[i].min = -model.getChannelsMax();
|
||||
if ( model.limitData[i].max > +model.getChannelsMax() ) model.limitData[i].max = +model.getChannelsMax();
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
group->updateMinMax(10*channelMax);
|
||||
}
|
||||
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,24 @@
|
||||
#include "modelpanel.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
class GVarGroup;
|
||||
|
||||
class LimitsGroup
|
||||
{
|
||||
public:
|
||||
LimitsGroup(FirmwareInterface * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
~LimitsGroup();
|
||||
|
||||
void updateMinMax(int max);
|
||||
|
||||
protected:
|
||||
FirmwareInterface * firmware;
|
||||
QDoubleSpinBox * spinbox;
|
||||
GVarGroup * gvarGroup;
|
||||
int & value;
|
||||
double displayStep;
|
||||
};
|
||||
|
||||
class Channels : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -13,8 +31,7 @@ class Channels : public ModelPanel
|
||||
~Channels();
|
||||
|
||||
private:
|
||||
QVector<QDoubleSpinBox *> minSpins;
|
||||
QVector<QDoubleSpinBox *> maxSpins;
|
||||
QVector<LimitsGroup *> limitsGroups;
|
||||
|
||||
public slots:
|
||||
void refreshExtendedLimits();
|
||||
@@ -22,9 +39,6 @@ class Channels : public ModelPanel
|
||||
private slots:
|
||||
void symlimitsEdited();
|
||||
void nameEdited();
|
||||
void offsetEdited();
|
||||
void minEdited();
|
||||
void maxEdited();
|
||||
void invEdited();
|
||||
void curveEdited();
|
||||
void ppmcenterEdited();
|
||||
|
||||
@@ -147,6 +147,13 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
|
||||
}
|
||||
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
spnx[i] = new QSpinBox(this);
|
||||
spnx[i]->setProperty("index", i);
|
||||
spnx[i]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spnx[i]->setAccelerated(true);
|
||||
connect(spnx[i], SIGNAL(valueChanged(int)), this, SLOT(onPointEdited()));
|
||||
ui->pointsLayout->addWidget(spnx[i], i, 0, 1, 1);
|
||||
|
||||
spny[i] = new QSpinBox(this);
|
||||
spny[i]->setProperty("index", i);
|
||||
spny[i]->setMinimum(-100);
|
||||
@@ -154,14 +161,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
|
||||
spny[i]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spny[i]->setAccelerated(true);
|
||||
connect(spny[i], SIGNAL(valueChanged(int)), this, SLOT(onPointEdited()));
|
||||
ui->pointsLayout->addWidget(spny[i], i, 0, 1, 1);
|
||||
|
||||
spnx[i] = new QSpinBox(this);
|
||||
spnx[i]->setProperty("index", i);
|
||||
spnx[i]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spnx[i]->setAccelerated(true);
|
||||
connect(spnx[i], SIGNAL(valueChanged(int)), this, SLOT(onPointEdited()));
|
||||
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
|
||||
ui->pointsLayout->addWidget(spny[i], i, 1, 1, 1);
|
||||
|
||||
bool insert;
|
||||
if (firmware->getCapability(EnhancedCurves)) {
|
||||
|
||||
@@ -506,7 +506,7 @@ void CustomFunctionsPanel::update()
|
||||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
|
||||
if (!initialized) {
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
@@ -527,7 +527,7 @@ void CustomFunctionsPanel::fswPaste()
|
||||
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
||||
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
populateGVmodeCB(fswtchGVmode[selectedFunction], model.funcSw[selectedFunction].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[selectedFunction], model, model.funcSw[selectedFunction].func, model.funcSw[selectedFunction].param, model.funcSw[selectedFunction].adjustMode);
|
||||
@@ -543,7 +543,7 @@ void CustomFunctionsPanel::fswDelete()
|
||||
model.funcSw[selectedFunction].clear();
|
||||
// TODO update switch and func
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
lock = false;
|
||||
@@ -590,7 +590,8 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
b->clear();
|
||||
for (unsigned int i=0; i<FuncCount; i++) {
|
||||
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
|
||||
if (((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
|
||||
if (((i>=FuncSafetyCh1 && i<=FuncSafetyCh32) && !firmware->getCapability(SafetyChannelCustomFunction)) ||
|
||||
((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
|
||||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
|
||||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
|
||||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
|
||||
|
||||
@@ -33,7 +33,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
||||
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings);
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
||||
|
||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
|
||||
// Phase switch
|
||||
if (phaseIdx > 0) {
|
||||
populateSwitchCB(ui->swtch, phase.swtch, generalSettings);
|
||||
populateSwitchCB(ui->swtch, phase.swtch, generalSettings, MixesContext);
|
||||
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
||||
}
|
||||
else {
|
||||
@@ -63,19 +63,25 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
trimsValue << ui->trim1Value << ui->trim2Value << ui->trim3Value << ui->trim4Value;
|
||||
trimsSlider << ui->trim1Slider << ui->trim2Slider << ui->trim3Slider << ui->trim4Slider;
|
||||
|
||||
BoardEnum board = firmware->getBoard();
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
trimsLabel[i]->setText(labels[CONVERT_MODE(i+1)-1]);
|
||||
|
||||
QComboBox * cb = trimsUse[i];
|
||||
cb->setProperty("index", i);
|
||||
cb->addItem(QObject::tr("Trim disabled"), -1);
|
||||
if (IS_TARANIS(board)) {
|
||||
cb->addItem(QObject::tr("Trim disabled"), -1);
|
||||
}
|
||||
for (int m=0; m<modesCount; m++) {
|
||||
if (m == phaseIdx) {
|
||||
cb->addItem(QObject::tr("Own Trim"), m*2);
|
||||
}
|
||||
else if (phaseIdx > 0) {
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1").arg(m), m*2);
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m*2+1);
|
||||
if (IS_TARANIS(board)) {
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m*2+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseTrimUse_currentIndexChanged(int)));
|
||||
@@ -157,7 +163,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
gvLayout->addWidget(gvValues[i], i, col++, 1, 1);
|
||||
|
||||
// Popups
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()) && (phaseIdx == 0)) {
|
||||
if (IS_TARANIS(board) && phaseIdx == 0) {
|
||||
gvPopups[i] = new QCheckBox(ui->gvGB);
|
||||
gvPopups[i]->setProperty("index", i);
|
||||
gvPopups[i]->setText(tr("Popup enabled"));
|
||||
@@ -270,7 +276,11 @@ void FlightModePanel::trimUpdate(unsigned int trim)
|
||||
trimsSlider[trim]->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||
BoardEnum board = firmware->getBoard();
|
||||
if (IS_TARANIS(board))
|
||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||
else
|
||||
trimsUse[trim]->setCurrentIndex(phase.trimRef[chn]);
|
||||
trimsValue[trim]->setEnabled(true);
|
||||
trimsSlider[trim]->setEnabled(true);
|
||||
}
|
||||
@@ -305,10 +315,10 @@ void FlightModePanel::phaseGVUse_currentIndexChanged(int index)
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int gvar = comboBox->property("index").toInt();
|
||||
if (index == 0) {
|
||||
phase.gvars[gvar]=0;
|
||||
phase.gvars[gvar] = 0;
|
||||
}
|
||||
else {
|
||||
phase.gvars[gvar] = 1024+index+(index>phaseIdx?1:0);
|
||||
phase.gvars[gvar] = 1024 + index;
|
||||
}
|
||||
update();
|
||||
emit modified();
|
||||
@@ -364,8 +374,15 @@ void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
|
||||
phase.trim[chn] = 0;
|
||||
}
|
||||
else {
|
||||
phase.trimMode[chn] = data % 2;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
BoardEnum board = firmware->getBoard();
|
||||
if (IS_TARANIS(board)) {
|
||||
phase.trimMode[chn] = data % 2;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
}
|
||||
else {
|
||||
phase.trimMode[chn] = 0;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
}
|
||||
phase.trim[chn] = 0;
|
||||
}
|
||||
trimUpdate(trim);
|
||||
|
||||
@@ -7,6 +7,10 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
expoInserted(false)
|
||||
{
|
||||
inputsCount = firmware->getCapability(VirtualInputs);
|
||||
if (inputsCount == 0)
|
||||
inputsCount = NUM_STICKS;
|
||||
|
||||
QGridLayout * exposLayout = new QGridLayout(this);
|
||||
|
||||
ExposlistWidget = new MixersList(this, true);
|
||||
@@ -47,10 +51,6 @@ void InputsPanel::update()
|
||||
{
|
||||
lock = true;
|
||||
|
||||
int inputsCount = firmware->getCapability(VirtualInputs);
|
||||
if (inputsCount == 0)
|
||||
inputsCount = NUM_STICKS;
|
||||
|
||||
// curDest -> destination channel
|
||||
// i -> mixer number
|
||||
QByteArray qba;
|
||||
@@ -446,6 +446,7 @@ void InputsPanel::expolistWidget_KeyPress(QKeyEvent *event)
|
||||
|
||||
int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up
|
||||
{
|
||||
|
||||
if(idx>C9X_MAX_EXPOS || (idx==C9X_MAX_EXPOS && dir)) return idx;
|
||||
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
@@ -456,22 +457,27 @@ int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up
|
||||
if (!dir && tdx<0 && src.chn>0) {
|
||||
src.chn--;
|
||||
return idx;
|
||||
} else if (!dir && tdx<0) {
|
||||
}
|
||||
else if (!dir && tdx<0) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
if(memcmp(&src,&temp,sizeof(ExpoData))==0) return idx;
|
||||
bool tgtempty=(memcmp(&tgt,&temp,sizeof(ExpoData))==0 ? 1:0);
|
||||
if(tgt.chn!=src.chn || tgtempty) {
|
||||
if ((dir) && (src.chn<(NUM_STICKS-1))) src.chn++;
|
||||
if ((!dir) && (src.chn>0)) src.chn--;
|
||||
return idx;
|
||||
if (memcmp(&src, &temp, sizeof(ExpoData)) == 0) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
//flip between idx and tgt
|
||||
memcpy(&temp,&src,sizeof(ExpoData));
|
||||
memcpy(&src,&tgt,sizeof(ExpoData));
|
||||
memcpy(&tgt,&temp,sizeof(ExpoData));
|
||||
bool tgtempty = (memcmp(&tgt, &temp, sizeof(ExpoData)) == 0);
|
||||
|
||||
if (tgt.chn!=src.chn || tgtempty) {
|
||||
if ((dir) && (src.chn<unsigned(inputsCount-1))) src.chn++;
|
||||
if ((!dir) && (src.chn>0)) src.chn--;
|
||||
return idx;
|
||||
}
|
||||
|
||||
// flip between idx and tgt
|
||||
memcpy(&temp, &src, sizeof(ExpoData));
|
||||
memcpy(&src, &tgt, sizeof(ExpoData));
|
||||
memcpy(&tgt, &temp, sizeof(ExpoData));
|
||||
return tdx;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class InputsPanel : public ModelPanel
|
||||
bool expoInserted;
|
||||
MixersList *ExposlistWidget;
|
||||
bool firstLine;
|
||||
int inputsCount;
|
||||
|
||||
int getExpoIndex(unsigned int dch);
|
||||
bool gm_insertExpo(int idx);
|
||||
|
||||
@@ -167,16 +167,20 @@ void LogicalSwitchesPanel::andEdited(int value)
|
||||
|
||||
void LogicalSwitchesPanel::durationEdited(double duration)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].duration = (uint8_t)round(duration*10);
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].duration = (uint8_t)round(duration*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::delayEdited(double delay)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].delay = (uint8_t)round(delay*10);
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].delay = (uint8_t)round(delay*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::edited()
|
||||
@@ -184,19 +188,25 @@ void LogicalSwitchesPanel::edited()
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
int i = sender()->property("index").toInt();
|
||||
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
bool chAr = (model.customSw[i].getFunctionFamily() != LogicalSwitchData(newFunc).getFunctionFamily());
|
||||
model.customSw[i].func = newFunc;
|
||||
if (chAr) {
|
||||
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_TIMER) {
|
||||
CSFunctionFamily oldFuncFamily = model.customSw[i].getFunctionFamily();
|
||||
model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
CSFunctionFamily newFuncFamily = model.customSw[i].getFunctionFamily();
|
||||
|
||||
if (oldFuncFamily != newFuncFamily) {
|
||||
if (newFuncFamily == LS_FAMILY_TIMER) {
|
||||
model.customSw[i].val1 = -119;
|
||||
model.customSw[i].val2 = -119;
|
||||
}
|
||||
else if (model.customSw[i].getFunctionFamily() == LS_FAMILY_STAY) {
|
||||
else if (newFuncFamily == LS_FAMILY_STAY) {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = -129;
|
||||
model.customSw[i].val3 = 0;
|
||||
}
|
||||
else if (newFuncFamily == LS_FAMILY_STICKY) {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = 0;
|
||||
model.customSw[i].delay = 0;
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = 0;
|
||||
@@ -207,7 +217,7 @@ void LogicalSwitchesPanel::edited()
|
||||
|
||||
RawSource source;
|
||||
|
||||
switch (model.customSw[i].getFunctionFamily())
|
||||
switch (newFuncFamily)
|
||||
{
|
||||
case LS_FAMILY_VOFS:
|
||||
{
|
||||
@@ -229,6 +239,7 @@ void LogicalSwitchesPanel::edited()
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.1);
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (sender() == cswitchOffset[i]) {
|
||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
|
||||
@@ -236,10 +247,12 @@ void LogicalSwitchesPanel::edited()
|
||||
else {
|
||||
model.customSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.customSw[i].val2;
|
||||
}
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
if (model.customSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
cswitchOffset2[i]->clear();
|
||||
cswitchOffset2[i]->setSuffix("(release)");
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -264,7 +277,6 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, doubl
|
||||
else
|
||||
sb->setSingleStep(0.1);
|
||||
sb->setValue(value);
|
||||
sb->setSuffix("");
|
||||
}
|
||||
|
||||
#define SOURCE1_VISIBLE 0x1
|
||||
@@ -273,12 +285,13 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, doubl
|
||||
#define VALUE2_VISIBLE 0x8
|
||||
#define VALUE3_VISIBLE 0x10
|
||||
#define VALUE_TO_VISIBLE 0x20
|
||||
#define DELAY_ENABLED 0x40
|
||||
|
||||
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
unsigned int mask = 0;
|
||||
unsigned int mask = DELAY_ENABLED;
|
||||
RawSource source = RawSource(model.customSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model.customSw[i].getRangeFlags());
|
||||
|
||||
@@ -308,20 +321,25 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_VBOOL:
|
||||
case LS_FAMILY_STICKY:
|
||||
// no break
|
||||
case LS_FAMILY_VBOOL:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings);
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings, LogicalSwitchesContext);
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||
mask &= ~DELAY_ENABLED;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (model.customSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
cswitchOffset2[i]->clear();
|
||||
cswitchOffset2[i]->setSuffix(tr("(release)"));
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
@@ -342,6 +360,11 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchOffset[i]->setVisible(mask & VALUE2_VISIBLE);
|
||||
cswitchOffset2[i]->setVisible(mask & VALUE3_VISIBLE);
|
||||
cswitchTOffset[i]->setVisible(mask & VALUE_TO_VISIBLE);
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
cswitchDelay[i]->setEnabled(mask & DELAY_ENABLED);
|
||||
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -392,7 +415,7 @@ void LogicalSwitchesPanel::populateCSWCB(QComboBox *b, int value)
|
||||
void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
||||
{
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
populateSwitchCB(b, value, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(b, value, generalSettings, LogicalSwitchesContext);
|
||||
}
|
||||
else {
|
||||
RawSwitch item;
|
||||
@@ -425,10 +448,6 @@ void LogicalSwitchesPanel::updateLine(int i)
|
||||
setSwitchWidgetVisibility(i);
|
||||
lock = true;
|
||||
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
}
|
||||
}
|
||||
|
||||
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
|
||||
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings, MixesContext);
|
||||
ui->warningCB->setCurrentIndex(md->mixWarn);
|
||||
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
||||
int scale=firmware->getCapability(SlowScale);
|
||||
|
||||
@@ -15,7 +15,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
lock = true;
|
||||
|
||||
// Mode
|
||||
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
|
||||
populateSwitchCB(ui->mode, timer.mode, generalSettings, TimersContext);
|
||||
|
||||
if (!firmware->getCapability(PermTimers)) {
|
||||
ui->persistent->hide();
|
||||
@@ -25,8 +25,14 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
ui->countdownBeep->setField(&timer.countdownBeep, this);
|
||||
ui->countdownBeep->addItem(tr("Silent"), 0);
|
||||
ui->countdownBeep->addItem(tr("Beeps"), 1);
|
||||
if (IS_ARM(GetEepromInterface()->getBoard()) || IS_2560(GetEepromInterface()->getBoard()))
|
||||
if (IS_ARM(GetEepromInterface()->getBoard()) || IS_2560(GetEepromInterface()->getBoard())) {
|
||||
ui->countdownBeep->addItem(tr("Voice"), 2);
|
||||
}
|
||||
|
||||
ui->persistent->setField(&timer.persistent, this);
|
||||
ui->persistent->addItem(tr("Not persistent"), 0);
|
||||
ui->persistent->addItem(tr("Persistent (flight)"), 1);
|
||||
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
@@ -55,7 +61,6 @@ void TimerPanel::update()
|
||||
pvalue -= hours * 3600;
|
||||
int minutes = pvalue / 60;
|
||||
int seconds = pvalue % 60;
|
||||
ui->persistent->setChecked(timer.persistent);
|
||||
ui->persistentValue->setText(QString(" %1(%2:%3:%4)").arg(sign<0 ? "-" :" ").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
@@ -76,12 +81,6 @@ void TimerPanel::on_mode_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void TimerPanel::on_persistent_toggled(bool checked)
|
||||
{
|
||||
timer.persistent = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||
{
|
||||
timer.minuteBeep = checked;
|
||||
@@ -211,8 +210,8 @@ void ModulePanel::update()
|
||||
|
||||
ui->label_protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_RX_NUMBER);
|
||||
ui->rxNumber->setVisible(mask & MASK_RX_NUMBER);
|
||||
ui->rxNumber->setValue(model.modelId);
|
||||
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
ui->channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
|
||||
@@ -28,7 +28,6 @@ class TimerPanel : public ModelPanel
|
||||
private slots:
|
||||
void on_mode_currentIndexChanged(int index);
|
||||
void on_value_editingFinished();
|
||||
void on_persistent_toggled(bool checked);
|
||||
void on_minuteBeep_toggled(bool checked);
|
||||
|
||||
private:
|
||||
|
||||
@@ -51,11 +51,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="persistent">
|
||||
<property name="text">
|
||||
<string>Persistent</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QUnsignedAutoComboBox" name="persistent"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="persistentValue">
|
||||
|
||||
@@ -28,7 +28,7 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, Mod
|
||||
update();
|
||||
|
||||
ui->UnitCB->setCurrentIndex(analog.type);
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
|
||||
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
|
||||
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
|
||||
@@ -198,12 +198,14 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
|
||||
}
|
||||
if (alarm2value<calib) {
|
||||
alarm2value=calib;
|
||||
} else if (alarm2value>(ratio+calib)) {
|
||||
}
|
||||
else if (alarm2value>(ratio+calib)) {
|
||||
alarm2value=ratio+calib;
|
||||
}
|
||||
analog.alarms[0].value=round(((alarm1value-calib)*255)/ratio);
|
||||
analog.alarms[1].value=round(((alarm2value-calib)*255)/ratio);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
analog.offset=0;
|
||||
analog.alarms[0].value=0;
|
||||
analog.alarms[1].value=0;
|
||||
@@ -434,9 +436,11 @@ void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
|
||||
|
||||
void TelemetryCustomScreen::customFieldChanged(int value)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
screen.body.lines[index/256].source[index%256] = value;
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
screen.body.lines[index/256].source[index%256] = value;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryCustomScreen::barSourceChanged(int index)
|
||||
@@ -485,6 +489,11 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
}
|
||||
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
ui->telemetryProtocol->addItem(tr("FrSky S.PORT"), 0);
|
||||
ui->telemetryProtocol->addItem(tr("FrSky D"), 1);
|
||||
if (IS_9XRPRO(firmware->getBoard())) {
|
||||
ui->telemetryProtocol->addItem(tr("FrSky D (cable)"), 2);
|
||||
}
|
||||
ui->telemetryProtocol->setCurrentIndex(model.telemetryProtocol);
|
||||
}
|
||||
else {
|
||||
@@ -500,7 +509,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
ui->A2Layout->addWidget(analogs[1]);
|
||||
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
analogs[2] = new TelemetryAnalog(this, model.frsky.channels[2], model, generalSettings, firmware);
|
||||
ui->A3Layout->addWidget(analogs[2]);
|
||||
connect(analogs[2], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
@@ -520,7 +529,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
telemetryCustomScreens[i] = tab;
|
||||
}
|
||||
|
||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
ui->bladesCount->setMinimum(1);
|
||||
ui->bladesCount->setMaximum(128);
|
||||
}
|
||||
@@ -535,6 +544,19 @@ TelemetryPanel::~TelemetryPanel()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TelemetryPanel::update()
|
||||
{
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (model.moduleData[0].protocol == OFF && model.moduleData[1].protocol == PPM) {
|
||||
ui->telemetryProtocol->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
ui->telemetryProtocol->setEnabled(false);
|
||||
ui->telemetryProtocol->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::setup()
|
||||
{
|
||||
QString firmware_id = g.profile[g.id()].fwType();
|
||||
@@ -543,7 +565,7 @@ void TelemetryPanel::setup()
|
||||
|
||||
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
|
||||
ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value);
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
|
||||
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ class TelemetryPanel : public ModelPanel
|
||||
public:
|
||||
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
||||
virtual ~TelemetryPanel();
|
||||
virtual void update();
|
||||
|
||||
private slots:
|
||||
void on_telemetryProtocol_currentIndexChanged(int index);
|
||||
|
||||
@@ -46,16 +46,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FrSky S.PORT</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FrSky D</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -668,10 +658,10 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.500000000000000</double>
|
||||
<double>-12.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.500000000000000</double>
|
||||
<double>12.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
|
||||
@@ -31,12 +31,12 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
||||
te->clear();
|
||||
QString modelname=g_model->name;
|
||||
if (modelname.isEmpty()) {
|
||||
curvefile5=QString("%1/curve5.png").arg(qd->tempPath());
|
||||
curvefile9=QString("%1/curve9.png").arg(qd->tempPath());
|
||||
curvefile5=generateProcessUniqueTempFileName("curve5.png");
|
||||
curvefile9=generateProcessUniqueTempFileName("curve9.png");
|
||||
}
|
||||
else {
|
||||
curvefile5=QString("%1/%2-curve5.png").arg(qd->tempPath()).arg(modelname);
|
||||
curvefile9=QString("%1/%2-curve9.png").arg(qd->tempPath()).arg(modelname);
|
||||
curvefile5=generateProcessUniqueTempFileName(QString("%1-curve5.png").arg(modelname));
|
||||
curvefile9=generateProcessUniqueTempFileName(QString("%1-curve9.png").arg(modelname));
|
||||
}
|
||||
printSetup();
|
||||
if (gvars) {
|
||||
@@ -60,19 +60,14 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
||||
|
||||
void PrintDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (printfilename.isEmpty()) {
|
||||
QByteArray ba = curvefile5.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
ba = curvefile9.toLatin1();
|
||||
name = ba.data();
|
||||
unlink(name);
|
||||
}
|
||||
}
|
||||
|
||||
PrintDialog::~PrintDialog()
|
||||
{
|
||||
delete ui;
|
||||
// notice PrintDialog::closeEvent() is not called if user clicks on Close button
|
||||
qunlink(curvefile5);
|
||||
qunlink(curvefile9);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString doTC(const QString s, const QString color="", bool bold=false)
|
||||
@@ -119,12 +114,10 @@ void PrintDialog::printSetup()
|
||||
str.append(fv(tr("Timer1"), getTimerStr(g_model->timers[0]))); //value, mode, count up/down
|
||||
str.append(fv(tr("Timer2"), getTimerStr(g_model->timers[1]))); //value, mode, count up/down
|
||||
str.append(fv(tr("Protocol"), getProtocol(g_model))); //proto, numch, delay,
|
||||
str.append(fv(tr("Pulse Polarity"), g_model->moduleData[0].ppmPulsePol ? "NEG" : "POS"));
|
||||
str.append(fv(tr("Pulse Polarity"), g_model->moduleData[0].polarityToString()));
|
||||
str.append(fv(tr("Throttle Trim"), g_model->thrTrim ? tr("Enabled") : tr("Disabled")));
|
||||
str.append(fv(tr("Throttle Expo"), g_model->thrExpo ? tr("Enabled") : tr("Disabled")));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model)));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model))); // specify which channels beep
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model))); // specify which channels beep
|
||||
str.append("</td></tr></table></td>");
|
||||
if (!gvars) {
|
||||
str.append("<td width=\"380\">");
|
||||
@@ -340,7 +333,6 @@ void PrintDialog::printMixes()
|
||||
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
|
||||
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
|
||||
|
||||
int scale = firmware->getCapability(SlowScale);
|
||||
if (scale == 0)
|
||||
@@ -379,22 +371,22 @@ void PrintDialog::printLimits()
|
||||
if (firmware->getCapability(HasChNames)) {
|
||||
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(g_model->limitData[i].name,"green"));
|
||||
str.append(doTR(g_model->limitData[i].name, "green"));
|
||||
}
|
||||
}
|
||||
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
|
||||
str.append(doTR(g_model->limitData[i].offsetToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].min/10),"green"));
|
||||
str.append(doTR(g_model->limitData[i].minToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].max/10),"green"));
|
||||
str.append(doTR(g_model->limitData[i].maxToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
|
||||
|
||||
@@ -59,16 +59,18 @@ class lcdWidget : public QWidget {
|
||||
QPixmap buffer(2*lcdWidth, 2*lcdHeight);
|
||||
QPainter p(&buffer);
|
||||
doPaint(p);
|
||||
bool toclipboard=g.snapToClpbrd();
|
||||
QApplication::clipboard()->setPixmap( buffer );
|
||||
if (!toclipboard) {
|
||||
QString Path=g.snapshotDir();
|
||||
if (Path.isEmpty() || !QDir(Path).exists()) {
|
||||
Path=".";
|
||||
bool toclipboard = g.snapToClpbrd();
|
||||
if (toclipboard) {
|
||||
QApplication::clipboard()->setPixmap( buffer );
|
||||
}
|
||||
else {
|
||||
QString path = g.snapshotDir();
|
||||
if (path.isEmpty() || !QDir(path).exists()) {
|
||||
path = ".";
|
||||
}
|
||||
Path.append(QDir::separator()+fileName);
|
||||
qDebug() << "Screenshot" << Path;
|
||||
buffer.toImage().save(Path);
|
||||
path.append(QDir::separator() + fileName);
|
||||
qDebug() << "Screenshot" << path;
|
||||
buffer.toImage().save(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,18 +122,18 @@ class lcdWidget : public QWidget {
|
||||
}
|
||||
|
||||
unsigned int previousDepth = 0xFF;
|
||||
const int planSize = (lcdWidth * ((lcdHeight+7) / 8));
|
||||
|
||||
for (int y=0; y<lcdHeight; y++) {
|
||||
unsigned int idx = (y/8)*lcdWidth;
|
||||
unsigned int idx = (y*lcdDepth/8)*lcdWidth;
|
||||
unsigned int mask = (1 << (y%8));
|
||||
for (int x=0; x<lcdWidth; x++, idx++) {
|
||||
if (lcdDepth == 1) {
|
||||
if (lcdBuf[idx] & mask)
|
||||
if (lcdBuf[idx] & mask) {
|
||||
p.drawRect(2*x, 2*y, 1, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned int z = (((lcdBuf[idx] & mask) ? 0x1 : 0) + ((lcdBuf[planSize+idx] & mask) ? 0x2 : 0) + ((lcdBuf[2*planSize+idx] & mask) ? 0x4 : 0) + ((lcdBuf[3*planSize+idx] & mask) ? 0x8 : 0));
|
||||
unsigned int z = (y & 1) ? (lcdBuf[idx] >> 4) : (lcdBuf[idx] & 0x0F);
|
||||
if (z) {
|
||||
if (z != previousDepth) {
|
||||
previousDepth = z;
|
||||
|
||||
@@ -1232,7 +1232,7 @@ QPushButton:checked {
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="simu">
|
||||
<attribute name="title">
|
||||
@@ -1440,6 +1440,19 @@ QPushButton:checked {
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="outputs2">
|
||||
<attribute name="title">
|
||||
<string>Outputs2</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="logicalSwitchesLayout2"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="channelsLayout2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Gvars</string>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="simu">
|
||||
<attribute name="title">
|
||||
@@ -240,6 +240,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="outputs2">
|
||||
<attribute name="title">
|
||||
<string>Outputs2</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="logicalSwitchesLayout2"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="channelsLayout2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="misc">
|
||||
<attribute name="title">
|
||||
<string>Gvars</string>
|
||||
|
||||
@@ -282,9 +282,6 @@ void SimulatorDialog::initUi(T * ui)
|
||||
trimHRight = ui->trimHRight;
|
||||
trimVRight = ui->trimVRight;
|
||||
tabWidget = ui->tabWidget;
|
||||
logicalSwitchesLayout = ui->logicalSwitchesLayout;
|
||||
channelsLayout = ui->channelsLayout;
|
||||
gvarsLayout = ui->gvarsLayout;
|
||||
leftXPerc = ui->leftXPerc;
|
||||
leftYPerc = ui->leftYPerc;
|
||||
rightXPerc = ui->rightXPerc;
|
||||
@@ -356,14 +353,28 @@ void SimulatorDialog::initUi(T * ui)
|
||||
|
||||
setTrims();
|
||||
|
||||
int outputs = std::min(16, GetCurrentFirmware()->getCapability(Outputs));
|
||||
int outputs = std::min(32,GetCurrentFirmware()->getCapability(Outputs));
|
||||
if (outputs <= 16) {
|
||||
// hide second Outputs tab
|
||||
tabWidget->removeTab(tabWidget->indexOf(ui->outputs2));
|
||||
}
|
||||
else {
|
||||
tabWidget->setTabText(tabWidget->indexOf(ui->outputs), tr("Outputs") + QString(" 1-%1").arg(16));
|
||||
tabWidget->setTabText(tabWidget->indexOf(ui->outputs2), tr("Outputs") + QString(" 17-%1").arg(outputs));
|
||||
}
|
||||
for (int i=0; i<outputs; i++) {
|
||||
int column = i / (outputs/2);
|
||||
int line = i % (outputs/2);
|
||||
QGridLayout * outputTab = ui->channelsLayout;
|
||||
int column = i / (std::min(16,outputs)/2);
|
||||
int line = i % (std::min(16,outputs)/2);
|
||||
if (i >= 16 ) {
|
||||
outputTab = ui->channelsLayout2;
|
||||
column = (i-16) / (std::min(16,outputs-16)/2);
|
||||
line = (i-16) % (std::min(16,outputs-16)/2);
|
||||
}
|
||||
QLabel * label = new QLabel(tabWidget);
|
||||
ModelData model;
|
||||
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(model));
|
||||
channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
|
||||
outputTab->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
|
||||
|
||||
QSlider * slider = new QSlider(tabWidget);
|
||||
slider->setEnabled(false);
|
||||
@@ -389,30 +400,24 @@ void SimulatorDialog::initUi(T * ui)
|
||||
slider->setInvertedAppearance(false);
|
||||
slider->setTickPosition(QSlider::TicksBelow);
|
||||
channelSliders << slider;
|
||||
channelsLayout->addWidget(slider, line, column == 0 ? 1 : 4, 1, 1);
|
||||
outputTab->addWidget(slider, line, column == 0 ? 1 : 4, 1, 1);
|
||||
|
||||
QLabel * value = new QLabel(tabWidget);
|
||||
value->setMinimumSize(QSize(50, 0));
|
||||
value->setAlignment(Qt::AlignCenter);
|
||||
channelValues << value;
|
||||
channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
|
||||
outputTab->addWidget(value, line, column == 0 ? 2 : 3, 1, 1);
|
||||
}
|
||||
|
||||
int switches = GetCurrentFirmware()->getCapability(LogicalSwitches);
|
||||
for (int i=0; i<switches; i++) {
|
||||
QFrame * swtch = new QFrame(tabWidget);
|
||||
swtch->setAutoFillBackground(true);
|
||||
swtch->setFrameShape(QFrame::Panel);
|
||||
swtch->setFrameShadow(QFrame::Raised);
|
||||
swtch->setLineWidth(2);
|
||||
QVBoxLayout * layout = new QVBoxLayout(swtch);
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
QLabel * label = new QLabel(swtch);
|
||||
label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, i+1).toString());
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
logicalSwitchLabels << label;
|
||||
layout->addWidget(label);
|
||||
logicalSwitchesLayout->addWidget(swtch, i / (switches/2), i % (switches/2), 1, 1);
|
||||
QFrame * swtch = createLogicalSwitch(tabWidget, i, logicalSwitchLabels);
|
||||
ui->logicalSwitchesLayout->addWidget(swtch, i / (switches/2), i % (switches/2), 1, 1);
|
||||
if (outputs > 16) {
|
||||
// repeat logical switches on second outputs tab
|
||||
swtch = createLogicalSwitch(tabWidget, i, logicalSwitchLabels2);
|
||||
ui->logicalSwitchesLayout2->addWidget(swtch, i / (switches/2), i % (switches/2), 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int fmodes = GetCurrentFirmware()->getCapability(FlightModes);
|
||||
@@ -421,16 +426,16 @@ void SimulatorDialog::initUi(T * ui)
|
||||
for (int fm=0; fm<fmodes; fm++) {
|
||||
QLabel * label = new QLabel(tabWidget);
|
||||
label->setText(QString("FM%1").arg(fm));
|
||||
gvarsLayout->addWidget(label, 0, fm+1);
|
||||
ui->gvarsLayout->addWidget(label, 0, fm+1);
|
||||
}
|
||||
for (int i=0; i<gvars; i++) {
|
||||
QLabel * label = new QLabel(tabWidget);
|
||||
label->setText(QString("GV%1").arg(i+1));
|
||||
gvarsLayout->addWidget(label, i+1, 0);
|
||||
ui->gvarsLayout->addWidget(label, i+1, 0);
|
||||
for (int fm=0; fm<fmodes; fm++) {
|
||||
QLabel * value = new QLabel(tabWidget);
|
||||
gvarValues << value;
|
||||
gvarsLayout->addWidget(value, i+1, fm+1);
|
||||
ui->gvarsLayout->addWidget(value, i+1, fm+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,6 +448,23 @@ void SimulatorDialog::initUi(T * ui)
|
||||
}
|
||||
}
|
||||
|
||||
QFrame * SimulatorDialog::createLogicalSwitch(QWidget * parent, int switchNo, QVector<QLabel *> & labels)
|
||||
{
|
||||
QFrame * swtch = new QFrame(parent);
|
||||
swtch->setAutoFillBackground(true);
|
||||
swtch->setFrameShape(QFrame::Panel);
|
||||
swtch->setFrameShadow(QFrame::Raised);
|
||||
swtch->setLineWidth(2);
|
||||
QVBoxLayout * layout = new QVBoxLayout(swtch);
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
QLabel * label = new QLabel(swtch);
|
||||
label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, switchNo+1).toString());
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
labels << label;
|
||||
layout->addWidget(label);
|
||||
return swtch;
|
||||
}
|
||||
|
||||
void SimulatorDialog::onButtonPressed(int value)
|
||||
{
|
||||
if (value == Qt::Key_Print) {
|
||||
@@ -814,9 +836,11 @@ void SimulatorDialog::setValues()
|
||||
Trims trims;
|
||||
simulator->getTrims(trims);
|
||||
|
||||
for (int i=0; i<std::min(16, GetCurrentFirmware()->getCapability(Outputs)); i++) {
|
||||
channelSliders[i]->setValue(chVal(outputs.chans[i]));
|
||||
channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
|
||||
if (i < channelSliders.size()) {
|
||||
channelSliders[i]->setValue(chVal(outputs.chans[i]));
|
||||
channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1));
|
||||
}
|
||||
}
|
||||
|
||||
leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0));
|
||||
@@ -830,6 +854,9 @@ void SimulatorDialog::setValues()
|
||||
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
|
||||
logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
|
||||
if (!logicalSwitchLabels2.isEmpty()) {
|
||||
logicalSwitchLabels2[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int gv=0; gv<numGvars; gv++) {
|
||||
|
||||
@@ -51,10 +51,8 @@ class SimulatorDialog : public QDialog
|
||||
mySlider * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
|
||||
QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc;
|
||||
QTabWidget * tabWidget;
|
||||
QGridLayout * logicalSwitchesLayout;
|
||||
QGridLayout * channelsLayout;
|
||||
QGridLayout * gvarsLayout;
|
||||
QVector<QLabel *> logicalSwitchLabels;
|
||||
QVector<QLabel *> logicalSwitchLabels2;
|
||||
QVector<QSlider *> channelSliders;
|
||||
QVector<QLabel *> channelValues;
|
||||
QVector<QLabel *> gvarValues;
|
||||
@@ -91,6 +89,7 @@ class SimulatorDialog : public QDialog
|
||||
int getValue(qint8 i);
|
||||
bool getSwitch(int swtch, bool nc, qint8 level=0);
|
||||
void setTrims();
|
||||
QFrame * createLogicalSwitch(QWidget * parent, int switchNo, QVector<QLabel *> & labels);
|
||||
|
||||
int beepVal;
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ int main(int argc, char *argv[])
|
||||
QAbstractButton *taranisButton = msgBox.addButton("Taranis", QMessageBox::ActionRole);
|
||||
QAbstractButton *sky9xButton = msgBox.addButton("9X-Sky9X", QMessageBox::ActionRole);
|
||||
QAbstractButton *gruvinButton = msgBox.addButton("9X-Gruvin9X", QMessageBox::ActionRole);
|
||||
QAbstractButton *proButton = msgBox.addButton("9XR-Pro", QMessageBox::ActionRole);
|
||||
msgBox.addButton("9X-M128", QMessageBox::ActionRole);
|
||||
QPushButton *exitButton = msgBox.addButton(QMessageBox::Close);
|
||||
|
||||
@@ -149,6 +150,13 @@ int main(int argc, char *argv[])
|
||||
eepromFileName = path.data();
|
||||
dialog = new SimulatorDialog9X();
|
||||
}
|
||||
else if (msgBox.clickedButton() == proButton) {
|
||||
current_firmware_variant = GetFirmware("opentx-9xrpro-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-en");
|
||||
fileName = eedir.filePath("eeprom-9xrpro.bin");
|
||||
path = fileName.toAscii();
|
||||
eepromFileName = path.data();
|
||||
dialog = new SimulatorDialog9X();
|
||||
}
|
||||
else {
|
||||
current_firmware_variant = GetFirmware("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
|
||||
fileName = eedir.filePath("eeprom-9x128.bin");
|
||||
|
||||
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 876 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 975 B After Width: | Height: | Size: 975 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 877 B After Width: | Height: | Size: 877 B |
|
Before Width: | Height: | Size: 961 B After Width: | Height: | Size: 961 B |
|
Before Width: | Height: | Size: 947 B After Width: | Height: | Size: 947 B |
|
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 792 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1015 B After Width: | Height: | Size: 1015 B |
|
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 1020 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 924 B After Width: | Height: | Size: 924 B |
|
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 998 B |
|
Before Width: | Height: | Size: 891 B After Width: | Height: | Size: 891 B |
|
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 739 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 423 B |
|
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 1001 B |
|
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 665 B |
|
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 911 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 812 B |
|
Before Width: | Height: | Size: 873 B After Width: | Height: | Size: 873 B |
|
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 935 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 1003 B After Width: | Height: | Size: 1003 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 904 B After Width: | Height: | Size: 904 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |