Compare commits
382 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cca7180834 | |||
| 104ab8c7f3 | |||
| e4d273aa0e | |||
| df61a1ab4e | |||
| 1dcd8cc419 | |||
| b55b68f191 | |||
| 2c2339e229 | |||
| d7645252bb | |||
| dc89bb1dfc | |||
| 47383fd053 | |||
| f80406c7cb | |||
| 75b382e619 | |||
| 566c616abb | |||
| 59d2ef8aa1 | |||
| 977262232a | |||
| fa5895de39 | |||
| f2fb788eac | |||
| c8c3b79f2d | |||
| 1c7012726a | |||
| e3bbbdcecf | |||
| 4e8867c819 | |||
| cffb5e767f | |||
| 204711d313 | |||
| e43807540e | |||
| eb79d4f774 | |||
| e80b63f66f | |||
| ada0712e1a | |||
| 0a7aece40f | |||
| 63bcb4693d | |||
| dec630efa0 | |||
| 2a0984408f | |||
| 8e5027dcb2 | |||
| f489742c9e | |||
| bcc6e3c67d | |||
| 12ad7b0d9c | |||
| a6044a684d | |||
| 9c27947345 | |||
| c96a30aea0 | |||
| 934578118b | |||
| 81dbebb663 | |||
| afd3103506 | |||
| 8b34c96a2d | |||
| ec2c4302cb | |||
| 23eeccec9c | |||
| 421f16d0dd | |||
| cb73261c60 | |||
| 6bc02fd838 | |||
| a7e4b0b062 | |||
| 4b75c42218 | |||
| 4a187699fa | |||
| b4710f0f0c | |||
| 99c4c4a0ef | |||
| adb9a55719 | |||
| 078748243d | |||
| eaa5c7a7b0 | |||
| 8dafd4680b | |||
| 6c6fc2d7db | |||
| 3eccbc2963 | |||
| d90ac05d6e | |||
| bdf0983642 | |||
| 16f219d6d3 | |||
| ba1073ace6 | |||
| 1d5c06ccd6 | |||
| afeba0d07e | |||
| 4ad2bbdf2c | |||
| 0faee13bc3 | |||
| e74349e36c | |||
| 2c2bbdd912 | |||
| d772cd39ea | |||
| 13f364d96a | |||
| 779b39e237 | |||
| 0f34bf3850 | |||
| f085f11ea8 | |||
| 1c1624b8a6 | |||
| caa9cd3060 | |||
| b8042c9da1 | |||
| 478411bf82 | |||
| 49a63d43b3 | |||
| 5b4dc4ee08 | |||
| 2cf2603155 | |||
| 462e5f05e6 | |||
| 3caf83e920 | |||
| 58df785d70 | |||
| 4c0526ce0c | |||
| 6c2de17229 | |||
| d649420212 | |||
| 7f53f340ad | |||
| c4c5516315 | |||
| 8662de39f5 | |||
| f2cf444a64 | |||
| 1634d81e4a | |||
| 9c74cc215c | |||
| 659f506e5f | |||
| 7df776e7ed | |||
| 5762fd61e9 | |||
| 39ea315c97 | |||
| 6fc40cb7cb | |||
| 0658b2a2c4 | |||
| 6064d3222b | |||
| d13fb8918f | |||
| d11618eb3f | |||
| 3b4f5e0882 | |||
| 01f5c65eb9 | |||
| 94bdeb6929 | |||
| f36615f1e2 | |||
| ab4b159d06 | |||
| 90e58e4a5f | |||
| 7759403f3e | |||
| 18aa849cc7 | |||
| a9c25d1935 | |||
| 7f4daf3f5b | |||
| f7828ad4a3 | |||
| 2631ad00bd | |||
| d4a00dec3b | |||
| 46e8474e77 | |||
| c8dfccc365 | |||
| 2e14773f1a | |||
| 968fbd4c60 | |||
| 37b7b25208 | |||
| a2c6d60782 | |||
| 808e44388a | |||
| f8ff44c78f | |||
| 7e29932072 | |||
| c1b0e9fea3 | |||
| df91e93034 | |||
| fd265eccbb | |||
| 57d53abd6e | |||
| c62e0cc7d1 | |||
| e5b2b8ef64 | |||
| e6542a78d0 | |||
| 084680b5fd | |||
| bdfcc5d181 | |||
| 2d6962d937 | |||
| d8210b832f | |||
| ac22e33cec | |||
| 7f05df2627 | |||
| 9d7dab724b | |||
| b8b67ba864 | |||
| f6309138f6 | |||
| 7ca3f60999 | |||
| f0f3e35bf6 | |||
| c30ff28f85 | |||
| 5a121bfcb8 | |||
| 613b2edf49 | |||
| 8e9d370770 | |||
| 69afa9d0f8 | |||
| 955d5775cb | |||
| 6c7e4b5597 | |||
| ff8f4a3a92 | |||
| 2e248e7bc0 | |||
| f9d5201b0c | |||
| baa3938f06 | |||
| 12a0d6d5bc | |||
| 0f8c868d6b | |||
| 761b0e0cfa | |||
| 5bb759a0e7 | |||
| 1ef1109b5f | |||
| 36789bff3f | |||
| d8f1ad3a82 | |||
| f197aa52ac | |||
| fdec738485 | |||
| e2858dbb03 | |||
| 8d75f9c991 | |||
| 8c6b5717f7 | |||
| 63536b9819 | |||
| 8780339c72 | |||
| 90542b189c | |||
| 83766bc3f6 | |||
| 6a61a911de | |||
| 7b074305af | |||
| 973716fbfa | |||
| b153cdec93 | |||
| c63ad89a8c | |||
| 9a95b47c96 | |||
| b4cf7315a5 | |||
| d775a09095 | |||
| 318d77e863 | |||
| 1962336316 | |||
| 3fed1aa157 | |||
| 176845047d | |||
| 62662159e1 | |||
| c932090ed5 | |||
| 24b8ead576 | |||
| cb2e9be6cd | |||
| 6ff301bf27 | |||
| fe3a7babcc | |||
| f611942f61 | |||
| 979e93c7be | |||
| 83383df4dd | |||
| a54c0a435e | |||
| 3d8f1c4780 | |||
| 64a4f10ec7 | |||
| 380adaad3b | |||
| 69118a96be | |||
| 6a14fe728e | |||
| b58be017f4 | |||
| 408a44110f | |||
| aa527fc6bd | |||
| cbd824eb10 | |||
| a1c0aafc16 | |||
| fd782538d8 | |||
| 710e6ddc4c | |||
| 3ce754137d | |||
| f4ea92d1fc | |||
| 24917a9952 | |||
| f60ea00fb8 | |||
| 851da15bc7 | |||
| f6e7b4e291 | |||
| a502a99768 | |||
| 39386676d8 | |||
| f48d6bba35 | |||
| fcbb23af92 | |||
| 7f7dfeab12 | |||
| 450ba42558 | |||
| 76f27ae452 | |||
| 6bb7ba3795 | |||
| 509df44c4f | |||
| 9cb4b782e1 | |||
| 6f3577c9a5 | |||
| 06f5e408ee | |||
| 0402c37a07 | |||
| 7ae9bfef0f | |||
| 1bfcdb5dfa | |||
| 2983cfc531 | |||
| d80861db37 | |||
| 23ceb830b3 | |||
| 4c5f0ca83c | |||
| 1b370076b6 | |||
| 9415b3086d | |||
| e7fcc71d8e | |||
| 7e21e13ec9 | |||
| 360a521f11 | |||
| 53d4547918 | |||
| 2d0c14c3c0 | |||
| b9fd1b01d1 | |||
| 45213124dd | |||
| 76371d6087 | |||
| 37c0589a27 | |||
| da71f4cbbc | |||
| 093034f9e7 | |||
| a7b9b30108 | |||
| 6a2a730cdc | |||
| 97b777ae4f | |||
| 09f257026e | |||
| e59afb6ec1 | |||
| b7acee5723 | |||
| 2910488a30 | |||
| 67817918f4 | |||
| 390342af78 | |||
| 653273f82e | |||
| b33a88a69f | |||
| 7cd7869d6a | |||
| 9ae429e03b | |||
| 0053412f87 | |||
| 63baa76cba | |||
| bd6bd4deeb | |||
| 5b5c88fb4e | |||
| fdacf83ad0 | |||
| 8e04a6e2e4 | |||
| 5791645877 | |||
| 6cc40c65b2 | |||
| 1bb8aab866 | |||
| 13b566746d | |||
| 4b5bd10aa2 | |||
| 251e83b1a4 | |||
| d4f108a849 | |||
| 19219bf8f8 | |||
| 74db7dafa7 | |||
| 9bc8fc493d | |||
| abe857225a | |||
| 9c46b9afa0 | |||
| a41d2af10d | |||
| 42cbc56880 | |||
| 9ba843d82f | |||
| 81589d22f8 | |||
| 576be96935 | |||
| f487cdd581 | |||
| bf177d6cce | |||
| e16b48db30 | |||
| 8e84724c62 | |||
| 2f7694dee7 | |||
| 019e2aee1b | |||
| 8cb7031cf6 | |||
| a167e9f751 | |||
| 824f39330f | |||
| bf600140d3 | |||
| 871302a1b1 | |||
| 5a8a074f0c | |||
| 0e139fd0d6 | |||
| de00d223c4 | |||
| 8d8fef23c9 | |||
| 51be7b000e | |||
| 87295776ff | |||
| b3e9d8d97d | |||
| 96f1a16744 | |||
| 7d386e7821 | |||
| ee258b8ec8 | |||
| 0641adc5f4 | |||
| 045294d53b | |||
| 169df7130b | |||
| 49e252337e | |||
| 7906107d6c | |||
| e3d881be76 | |||
| bd968bd60f | |||
| 541aa459cf | |||
| c82c7ee5db | |||
| 76e72c8a86 | |||
| 6304f0daf6 | |||
| e00efb1566 | |||
| 258347fbd1 | |||
| 7434e330c8 | |||
| b55070f939 | |||
| a7524ba74d | |||
| 3436273fdf | |||
| 4dcd49a516 | |||
| 2f4ed3b35f | |||
| b814f997f8 | |||
| e37872398e | |||
| 3b7c3fb217 | |||
| e04aa4b3cc | |||
| 1bb6a82cf3 | |||
| 022f7121b4 | |||
| cc19c8027a | |||
| 7dfb5b6a28 | |||
| 397b78fe06 | |||
| 1e2f4d6c0c | |||
| 387cd98efe | |||
| 7eddd662e7 | |||
| 21f61fe498 | |||
| 0437314ae3 | |||
| 21e8551787 | |||
| 129bbe2198 | |||
| cfcac8c51d | |||
| eaeb90dc07 | |||
| ae68dea923 | |||
| 1ae8e40a3f | |||
| 779aecfbee | |||
| 1c62b19f9f | |||
| c00775b2d1 | |||
| b7b7c48d8e | |||
| 76ffd4fcb4 | |||
| 9ad5094909 | |||
| 0fd23d3e61 | |||
| a587f8b825 | |||
| fb1098c16e | |||
| 97ef444648 | |||
| c672d2544b | |||
| 72ca1b021a | |||
| 044b3a706c | |||
| 4c40aec8b3 | |||
| 4226e9cc45 | |||
| f659e98a52 | |||
| 97b2aa804d | |||
| 8e07f9b0f4 | |||
| 656daa75fa | |||
| 547606b44e | |||
| 15a29f3a43 | |||
| ab81838d87 | |||
| 854ce93c07 | |||
| 08ae9ddedb | |||
| 3f5a3995cc | |||
| 2a86918508 | |||
| f50ee3fb39 | |||
| bae44d2812 | |||
| 2e4775b19a | |||
| 655e2f9010 | |||
| a4008a2550 | |||
| 9e39dfa9d7 | |||
| 94ee3c65b3 | |||
| d609d37798 | |||
| d0a57d4c47 | |||
| 726b989f6c | |||
| 5f76e61240 | |||
| 42d66bb2c1 | |||
| e4135a9adb | |||
| fe1146b62c | |||
| 7956bd6bab | |||
| 32142e25ea | |||
| 85bb6ea3a7 | |||
| d5e42992d2 | |||
| fbdcef3733 | |||
| a13c857b53 |
@@ -18,6 +18,7 @@ env:
|
||||
# - QT_BASE=57
|
||||
#- GCC_ARM=/opt/gcc-arm-none-eabi/bin
|
||||
- AVR_FLAVORS="AVR9X 9X GRUVIN9X MEGA2560"
|
||||
- PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages
|
||||
matrix:
|
||||
#
|
||||
# ALL will build every individual board & DEFAULT, sequentially.
|
||||
@@ -72,5 +73,21 @@ install:
|
||||
fi
|
||||
- sudo apt-get install --yes --force-yes -qq qt${QT_BASE}base qt${QT_BASE}multimedia qt${QT_BASE}svg qt${QT_BASE}tools; source /opt/qt${QT_BASE}/bin/qt${QT_BASE}-env.sh
|
||||
|
||||
addons:
|
||||
sonarcloud:
|
||||
organization: "opentx-github"
|
||||
token:
|
||||
secure: "BuQrGRijNpL2V/IQNcOxvjChj8PScfCdiv403EE73Nqb4+sB8YL92Fnzrnw9bC8wF7BVSDJVpYF0gbdaTzuCmaeZfM8NJK0TOJAbH6+B8bhIrU/V1SBuVjHQnndV/wysieruKnK/KxYJZqItgSlnPo+PmiFxtXJNlas0Kstb2O4="
|
||||
# github_token:
|
||||
# secure: "Qkmp4VrQJtKgZ/pz65SNnCDiF4slgFfQS/3whyLXLcDbFb1Hv1oj7Hqz9EVDUSO2eEhgQGaOKkRc0CfAAOBwW6OvhE0xh7P1CJEjzOp6+3gI/LyZUNsqa+awVRZTsfm1YZaOPaPWJ7cI0uz3/OoSUeIecs4PDWPrQMGRlsrq7Q8="
|
||||
branches:
|
||||
- "2.2"
|
||||
|
||||
script:
|
||||
- ./tools/commit-tests.sh
|
||||
- build-wrapper-linux-x86-64 --out-dir bw_output ./tools/commit-tests.sh
|
||||
- sonar-scanner
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- '$HOME/.sonar/cache'
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ project(OpenTX)
|
||||
|
||||
set(VERSION_MAJOR "2")
|
||||
set(VERSION_MINOR "2")
|
||||
set(VERSION_REVISION "0")
|
||||
set(VERSION_REVISION "1")
|
||||
set(VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
set(VERSION_FAMILY ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFIX})
|
||||
set(SDCARD_REVISION "0010")
|
||||
set(SDCARD_REVISION "0013")
|
||||
set(SDCARD_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}V${SDCARD_REVISION})
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
@@ -62,6 +62,16 @@ if(WIN32)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${WIN_EXTRA_LIBS_PATH}" "${WIN_EXTRA_LIBS_PATH}/SDL") # hints for FindSDL
|
||||
endif()
|
||||
|
||||
# Python check
|
||||
find_package("PythonInterp")
|
||||
if(PYTHONINTERP_FOUND)
|
||||
message(STATUS "Python found, version: ${PYTHON_VERSION_STRING}")
|
||||
get_filename_component(PYTHON_DIRECTORY ${PYTHON_EXECUTABLE} DIRECTORY)
|
||||
else()
|
||||
message(WARNING "Python not found! Most firmware and simu flavors not buildable.")
|
||||
set(LUA NO)
|
||||
endif()
|
||||
|
||||
find_package(Qt5Core)
|
||||
find_package(Qt5Widgets)
|
||||
find_package(Qt5Xml)
|
||||
|
||||
@@ -39,6 +39,7 @@ Michael Byrne
|
||||
<a href="http://rcstudio.cz">RC Studio (monthly)</a>
|
||||
<a href="http://www.craftandtheoryllc.com">Craft & Theory (monthly)</a>
|
||||
<a href="http://alofthobbies.com/taranis-q-x7--opentx-user-manual.html">OpenTX Manuals by Lothar Thole</a>
|
||||
<a href="http://www.team-blacksheep.com">Team BlackSheep</a>
|
||||
|
||||
[People who have donated to OpenTX]
|
||||
Mario Sette
|
||||
@@ -665,7 +666,7 @@ Volkov Victor
|
||||
Bryan Anderson
|
||||
Daniel Garber
|
||||
Pavel Stein
|
||||
Ravi Gupta
|
||||
RCdiy
|
||||
Patrick Tuxbury
|
||||
Mark Deverell
|
||||
John Capell
|
||||
@@ -843,7 +844,6 @@ Luke Mole
|
||||
NorthSide
|
||||
Hannes Mössler
|
||||
James Kaufman
|
||||
Ravi Gupta
|
||||
Lexington S Morley
|
||||
Ralph Segar
|
||||
Frédéric Devillard
|
||||
@@ -978,7 +978,6 @@ Ulf Reinhardt
|
||||
Wolfgang Renisch
|
||||
Trevor Hinze
|
||||
Mohammad Zargari
|
||||
Dr. Willutzki
|
||||
Jean Pierre Bernard
|
||||
Patrick Castellan
|
||||
Udo Tödter
|
||||
@@ -1220,3 +1219,85 @@ Vakhrushev Andrey
|
||||
Jörgen Norman
|
||||
Chen Zhongzhong
|
||||
Eddie Ehlin
|
||||
Evening Shade Pottery
|
||||
Michel Vanaken
|
||||
Forgues Research
|
||||
Hike For Happiness
|
||||
Vegar Elde
|
||||
Anindya Mukerjee
|
||||
Fabrice Debonnet
|
||||
Darko Perković
|
||||
Leonard MacKey
|
||||
James A Davey
|
||||
Matthias Häusel
|
||||
Thierry Laligand
|
||||
Pascal Gelis
|
||||
Christelle Boudet
|
||||
Damir Pooshs
|
||||
Bertrand Brunner
|
||||
Alexander Mathis
|
||||
Jean-Luc Le Goff
|
||||
Allan Abbott
|
||||
Paul Elstob
|
||||
Mark Levine
|
||||
K L Wolfbrandt
|
||||
Jeffrey Horton
|
||||
Erlendur Konradsson
|
||||
Dennis Miller
|
||||
Шарлаимов Константин
|
||||
Philippe Roussely
|
||||
Michel Gutierrez
|
||||
Joel Meziere
|
||||
Widco Us
|
||||
Marcos Guimaraes
|
||||
Olivier Petri
|
||||
Alfredo Mac Donald
|
||||
Erich Strebel
|
||||
Robert Goillandeau
|
||||
Joel Lopez
|
||||
Morten Myklebust
|
||||
Ferenc Kunkli
|
||||
Josh Kraker
|
||||
Roger Bergevin
|
||||
Geoff Sim
|
||||
Arthur Reynolds
|
||||
David Dalley
|
||||
Colin Macdonald
|
||||
Charles Wilson
|
||||
Walter Daser
|
||||
CG Tech Inc
|
||||
Alexander Röhlich
|
||||
Peter Goodrich
|
||||
Randy Melton
|
||||
Paul Pridday
|
||||
Jörgen Norman
|
||||
Peter Glassey
|
||||
Carlos Vicente
|
||||
Nael Bishtawi
|
||||
Paul Dr. Willutzki
|
||||
Heart of NM LLC
|
||||
Ulf Hedlund
|
||||
Meinolph Kaufmann
|
||||
Bill Keenan
|
||||
Ralf Kosel
|
||||
Lukas Hucik
|
||||
Uwe Jordt
|
||||
Tuan Le
|
||||
Burt Pickard-Richardson
|
||||
Robert Rubio
|
||||
Merv Dale
|
||||
Michel Garbarino
|
||||
Geoff Graham
|
||||
Georges Pezet
|
||||
Robert Wilhelm
|
||||
Francis Herzog
|
||||
Bo Hjeresen
|
||||
Danny Koch
|
||||
John Eppling
|
||||
Thierry Malosse
|
||||
Johann Antretter
|
||||
Jan Kaiser
|
||||
Rachel Berkhahn
|
||||
Luca Massimiliano Comolli
|
||||
Mario Wesierski
|
||||
Evening Shade Pottery
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## OpenTX 2.2 Branch
|
||||
|
||||
[](https://travis-ci.org/opentx/opentx)
|
||||
[](https://scan.coverity.com/projects/opentx-opentx)
|
||||
[](https://travis-ci.org/opentx/opentx)
|
||||
[](https://sonarcloud.io/dashboard?id=OpenTX:2.2)
|
||||
[](https://opentx.rocket.chat)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
|
||||
|
||||
|
||||
@@ -1,5 +1,74 @@
|
||||
<h2>Version 2.2.0 / 2017-05-30</h2>
|
||||
|
||||
Major release! Please see <a href=http://www.open-tx.org/2017/05/30/opentx-2.2.0>this page</a> for details.
|
||||
|
||||
<h2>Version 2.1.9 / 2016-09-14</h2>
|
||||
|
||||
<ul>
|
||||
<li>SD sync fixes (<a href=https://github.com/opentx/opentx/issues/3351>#3351</a>)</li>
|
||||
<li>Fixed: Telemetry mode "FrSky D (cable)" choice was missing for Taranis (<a href=https://github.com/opentx/opentx/issues/3372>#3372</a>)</li>
|
||||
<li>Show persistent option only for calculated sensors (<a href=https://github.com/opentx/opentx/issues/3454>#3454</a>)</li>
|
||||
<li>Fixed Flight mode clear command (<a href=https://github.com/opentx/opentx/issues/3214>#3214</a>)</li>
|
||||
<li>Fixed a problem with Rotary encoders linked to flight mode (could freeze Companion) (<a href=https://github.com/opentx/opentx/issues/3459>#3459</a>, <a href=https://github.com/opentx/opentx/issues/3470>#3470</a>)</li>
|
||||
<li>Telemetry simulator improvements: added fuel quantity sensor, increased RPM range (<a href=https://github.com/opentx/opentx/issues/3505>#3505</a>, <a href=https://github.com/opentx/opentx/issues/3506>#3506</a>)</li>
|
||||
<li>Implemented minimal support for the DYI Multimodule (<a href=https://github.com/opentx/opentx/issues/3526>#3526</a>)</li>
|
||||
<li>Fixed: GVar combo-box not being refreshed when GV check-box (re-)selected (<a href=https://github.com/opentx/opentx/issues/3518>#3518</a>)</li>
|
||||
<li>Fixed: Heli inversion not correctly shown/saved from Companion on Radios without virtual inputs (<a href=https://github.com/opentx/opentx/issues/3510>#3510</a>)</li>
|
||||
<li>Implemented print functions for the Heli setup screen (<a href=https://github.com/opentx/opentx/issues/3554>#3554</a>)</li>
|
||||
<li>Fixed: Flight modes linked trims display value (<a href=https://github.com/opentx/opentx/issues/3547>#3547</a>, <a href=https://github.com/opentx/opentx/issues/3568>#3568</a>)</li>
|
||||
<li>Fixed: New model global variables and rotary encoders initialisation (<a href=https://github.com/opentx/opentx/issues/3473>#3473</a>)</li>
|
||||
<li>Fixed: Prevent circular linked global variables and rotary encoders (<a href=https://github.com/opentx/opentx/issues/3472>#3472</a>)</li>
|
||||
<li>Fixed wrong log replay speed issue in Telemetry simulator (<a href=https://github.com/opentx/opentx/issues/3708>#3708</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.8 / 2016-04-14</h2>
|
||||
|
||||
<ul>
|
||||
<li>Telemetry Simulator sensor instance number fixed (<a href=https://github.com/opentx/opentx/issues/3207>#3207</a>)</li>
|
||||
<li>Fixed: Throttle Source combo-box was populated multiple times (<a href=https://github.com/opentx/opentx/issues/3222>#3222</a>)</li>
|
||||
<li>RTC option tool-tip corrected (<a href=https://github.com/opentx/opentx/issues/3225>#3225</a>)</li>
|
||||
<li>Fixed: Companion was looking for custom scripts at the wrong place (<a href=https://github.com/opentx/opentx/issues/3237>#3237</a>)</li>
|
||||
<li>Offset displayed in inputs screen (<a href=https://github.com/opentx/opentx/issues/3248>#3248</a>)</li>
|
||||
<li>Import/export handling was broken for Average formula telemetry sensors (<a href=https://github.com/opentx/opentx/issues/3262>#3262</a>)</li>
|
||||
<li>Fixed: Hardware Setup control types and names were not stored in profile (<a href=https://github.com/opentx/opentx/issues/3260>#3260</a>)</li>
|
||||
<li>Fixed voice language list (<a href=https://github.com/opentx/opentx/issues/3338>#3338</a>)</li>
|
||||
<li>Fixed data overflow in Special Functions Override Channel (<a href=https://github.com/opentx/opentx/issues/3347>#3347</a>)</li>
|
||||
<li>Fixed: Sync dialog new line problem (only present for some UI languages) (<a href=https://github.com/opentx/opentx/issues/3350>#3350</a>)</li>
|
||||
<li>Removed a few legacy timer limitations, fix non-working limit (<a href=https://github.com/opentx/opentx/issues/3301>#3301</a>)</li>
|
||||
<li>Default AVR fuse settings changed to disable JTAG interface (<a href=https://github.com/opentx/opentx/issues/3379>#3379</a>)</li>
|
||||
<li>Channel range fix (Start, Channels) in Model Settings, Setup page, int/ext module settings</li>
|
||||
<li>Use friendly GVAR names in dialogs (if available) (<a href=https://github.com/opentx/opentx/issues/3353>#3353</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.7 / 2016-01-04</h2>
|
||||
|
||||
<ul>
|
||||
<li>Lua 'execute' failed in non-root directory (in Simulator) (<a href=https://github.com/opentx/opentx/issues/3024>#3024</a>)</li>
|
||||
<!-- this is disabled until the speed problem is fixed <li>Header line always visible in Outputs, Logical Switches and Special Functions (<a href=https://github.com/opentx/opentx/issues/2861>#2861</a>)</li> -->
|
||||
<li>LR12 changes: removed option for remote failsafe configuration, added in EU firmware variant</li>
|
||||
<li>Added Clear option to the flight mode context menu (right click on the Name label) (<a href=https://github.com/opentx/opentx/issues/3026>#3026</a>)</li>
|
||||
<li>New features for Telemetry Simulator: log replay, user friendly sensor values (<a href=https://github.com/opentx/opentx/issues/3124>#3124</a>)</li>
|
||||
<li>Added F7 key to reload LUA permanent scripts in radio simulator (<a href=https://github.com/opentx/opentx/issues/3141>#3141</a>)</li>
|
||||
<li>AR9X firmware flashing fall-back was wrong</li>
|
||||
<li>Command line options support added to standalone simulator (try "./simulator21 --help" on Linux and "simulator.exe /help" on Windows for usage) (<a href=https://github.com/opentx/opentx/issues/3160>#3160</a>)</li>
|
||||
<li>Various rounding problem fixed: Telemetry sensor Ratio parameter (<a href=https://github.com/opentx/opentx/issues/3117>#3117</a>),
|
||||
Outputs Sub-trim, Min and Max values (<a href=https://github.com/opentx/opentx/issues/3156>#3156</a>)</li>
|
||||
<li>Fixed: telemetry sensors Ratio and Offset value increment/decrement step (<a href=https://github.com/opentx/opentx/issues/3121>#3121</a>)</li>
|
||||
<li>Hardware/Calibration tab split int two tabs (<a href=https://github.com/opentx/opentx/issues/2974>#2974</a>)</li>
|
||||
<li>Fixed Fahrenheit temperature conversion error (if PREC was not 0) (<a href=https://github.com/opentx/opentx/issues/3146>#3146</a>)</li>
|
||||
<li>Application Setting 'Enable automatic backup before writing firmware' was not saved (<a href=https://github.com/opentx/opentx/issues/3040>#3040</a>)</li>
|
||||
<li>Fixed RPM package problem on Fedora (<a href=https://github.com/opentx/opentx/issues/3130>#3130</a>)</li>
|
||||
<li>Fixed conversion errors when loading 2.0.x EEPE (<a href=https://github.com/opentx/opentx/issues/3177>#3177</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.6 / 2015-11-11</h2>
|
||||
[Taranis]
|
||||
|
||||
<ul>
|
||||
<li>Telemetry custom screen changes didn't emit modified signal (<a href=https://github.com/opentx/opentx/issues/3029>#3029</a>)</li>
|
||||
<li>Hide D8/LR12 when eu firmware option is selected</li>
|
||||
|
||||
@@ -25,6 +25,7 @@ set(COMPANION_OSX_APP_BUNDLE_NAME "OpenTX Companion ${VERSION_MAJOR}.${VERSION_M
|
||||
# the binary (default homebrew path)
|
||||
set(DFU_UTIL_PATH "/usr/local/bin/dfu-util")
|
||||
set(AVRDUDE_PATH "/usr/local/bin/avrdude")
|
||||
set(AVRDUDE_CONF "/usr/local/etc/avrdude.conf")
|
||||
|
||||
option(ALLOW_NIGHTLY_BUILDS "Allow nightly builds download / update") # Disabled by default
|
||||
if(ALLOW_NIGHTLY_BUILDS)
|
||||
@@ -350,6 +351,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(FILES images/linuxicons/512x512/companion.png DESTINATION ${INSTALL_TEMP_SHR_PFX}share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/scalable/companion.svg DESTINATION ${INSTALL_TEMP_SHR_PFX}share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg)
|
||||
install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION ${INSTALL_TEMP_LIB_PFX}lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
|
||||
install(FILES ../targets/linux/45-usbasp.rules DESTINATION ${INSTALL_TEMP_LIB_PFX}lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-usbasp.rules)
|
||||
# Linux specific code
|
||||
set(OperatingSystem "Linux")
|
||||
|
||||
@@ -523,8 +525,12 @@ IF(APPLE)
|
||||
# Copy dfu-util and avrdude, resolve symlink first
|
||||
get_filename_component(DFU_UTIL_ABSOLUTE_PATH ${DFU_UTIL_PATH} REALPATH)
|
||||
get_filename_component(AVRDUDE_ABSOLUTE_PATH ${AVRDUDE_PATH} REALPATH)
|
||||
get_filename_component(AVRDUDECONF_ABSOLUTE_PATH ${AVRDUDE_CONF} REALPATH)
|
||||
install(PROGRAMS ${DFU_UTIL_ABSOLUTE_PATH} ${AVRDUDE_ABSOLUTE_PATH} DESTINATION ${companion_res_dir} COMPONENT Runtime)
|
||||
install(FILES ${AVRDUDECONF_ABSOLUTE_PATH} DESTINATION ${companion_res_dir} COMPONENT Runtime)
|
||||
|
||||
set(bundle_tools_path "\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/dfu-util;\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/avrdude")
|
||||
|
||||
|
||||
# Include depencies (adding frameworks, fixing the embbeded libraries)
|
||||
# I get write errors without setting BU_CHMOD_BUNDLE_ITEMS even though it is
|
||||
@@ -553,6 +559,7 @@ if(DPKG_PROGRAM)
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_DEBIAN_ARCHITECTURE $(CMAKE_SYSTEM_PROCESSOR))
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5multimedia5-plugins")
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
elseif(APPLE)
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "appdebugmessagehandler.h"
|
||||
|
||||
#include <QFileDevice>
|
||||
|
||||
AppDebugMessageHandler::AppDebugMessageHandler(QObject * parent) :
|
||||
QObject(parent),
|
||||
m_appDebugOutputLevel(APP_DBG_HANDLER_DEFAULT_LEVEL),
|
||||
@@ -55,6 +57,25 @@ void AppDebugMessageHandler::setShowFunctionDeclarations(bool showFunctionDeclar
|
||||
m_showFunctionDeclarations = showFunctionDeclarations;
|
||||
}
|
||||
|
||||
void AppDebugMessageHandler::addOutputDevice(QIODevice * device)
|
||||
{
|
||||
if (device && !m_outputDevices.contains(device))
|
||||
m_outputDevices.append(device);
|
||||
}
|
||||
|
||||
void AppDebugMessageHandler::removeOutputDevice(QIODevice * device)
|
||||
{
|
||||
if (device) {
|
||||
// no QVector::removeAll() in Qt < 5.4
|
||||
int i = 0;
|
||||
foreach (QIODevice * d, m_outputDevices) {
|
||||
if (d == device)
|
||||
m_outputDevices.remove(i);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppDebugMessageHandler::installAppMessageHandler()
|
||||
{
|
||||
m_defaultHandler = qInstallMessageHandler(g_appDebugMessageHandler);
|
||||
@@ -98,7 +119,7 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
|
||||
|
||||
qSetMessagePattern(msgPattern);
|
||||
|
||||
if (!m_defaultHandler || receivers(SIGNAL(messageOutput(quint8, const QString &)))) {
|
||||
if (!m_defaultHandler || m_outputDevices.size() || receivers(SIGNAL(messageOutput(quint8, const QString &)))) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
|
||||
msgPattern = qFormatLogMessage(type, context, msg);
|
||||
#else
|
||||
@@ -112,6 +133,14 @@ void AppDebugMessageHandler::messageHandler(QtMsgType type, const QMessageLogCon
|
||||
#endif
|
||||
|
||||
emit messageOutput(lvl, msgPattern);
|
||||
|
||||
foreach (QIODevice * d, m_outputDevices) {
|
||||
if (d && d->isWritable() && (!d->property("level").isValid() || d->property("level").toInt() <= lvl)) {
|
||||
d->write(qPrintable(msgPattern % "\n"));
|
||||
if (QFileDevice * fd = qobject_cast<QFileDevice *>(d))
|
||||
fd->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (QThread::currentThread() == qApp->thread()) // gui thread
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
#include <QMessageLogContext>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
@@ -94,7 +95,7 @@
|
||||
#else
|
||||
#define qInfo qDebug
|
||||
#endif
|
||||
#define QtInfoMsg 4
|
||||
#define QtInfoMsg QtMsgType(4)
|
||||
#endif
|
||||
|
||||
class AppDebugMessageHandler : public QObject
|
||||
@@ -110,6 +111,8 @@ class AppDebugMessageHandler : public QObject
|
||||
void setAppDebugOutputLevel(const quint8 & appDebugOutputLevel);
|
||||
void setShowSourcePath(bool showSourcePath);
|
||||
void setShowFunctionDeclarations(bool showFunctionDeclarations);
|
||||
void addOutputDevice(QIODevice * device);
|
||||
void removeOutputDevice(QIODevice * device);
|
||||
|
||||
void installAppMessageHandler();
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString & msg);
|
||||
@@ -123,6 +126,7 @@ class AppDebugMessageHandler : public QObject
|
||||
QRegularExpression m_srcPathFilter;
|
||||
QRegularExpression m_functionFilter;
|
||||
quint8 m_appDebugOutputLevel;
|
||||
QVector<QIODevice *> m_outputDevices;
|
||||
bool m_showSourcePath;
|
||||
bool m_showFunctionDeclarations;
|
||||
|
||||
|
||||
@@ -23,13 +23,10 @@
|
||||
#include "mainwindow.h"
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "firmwareinterface.h"
|
||||
#ifdef JOYSTICKS
|
||||
#if defined(JOYSTICKS)
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
AppPreferencesDialog::AppPreferencesDialog(QWidget * parent) :
|
||||
QDialog(parent),
|
||||
@@ -41,6 +38,8 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget * parent) :
|
||||
|
||||
initSettings();
|
||||
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
|
||||
connect(ui->opt_appDebugLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
connect(ui->opt_fwTraceLog, &QCheckBox::toggled, this, &AppPreferencesDialog::toggleAppLogSettings);
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
|
||||
#if !defined(JOYSTICKS)
|
||||
@@ -61,9 +60,8 @@ AppPreferencesDialog::~AppPreferencesDialog()
|
||||
|
||||
void AppPreferencesDialog::writeValues()
|
||||
{
|
||||
g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
|
||||
g.autoCheckApp(ui->autoCheckCompanion->isChecked());
|
||||
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
|
||||
g.OpenTxBranch(DownloadBranchType(ui->OpenTxBranch->currentIndex()));
|
||||
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
|
||||
g.showSplash(ui->showSplash->isChecked());
|
||||
g.simuSW(ui->simuSW->isChecked());
|
||||
@@ -77,6 +75,10 @@ void AppPreferencesDialog::writeValues()
|
||||
g.embedSplashes(ui->splashincludeCB->currentIndex());
|
||||
g.enableBackup(ui->backupEnable->isChecked());
|
||||
|
||||
g.appDebugLog(ui->opt_appDebugLog->isChecked());
|
||||
g.fwTraceLog(ui->opt_fwTraceLog->isChecked());
|
||||
g.appLogsDir(ui->appLogsDir->text());
|
||||
|
||||
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
|
||||
g.jsSupport(ui->joystickChkB ->isChecked());
|
||||
g.jsCtrl(ui->joystickCB ->currentIndex());
|
||||
@@ -131,13 +133,10 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
}
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
|
||||
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
|
||||
#else
|
||||
ui->useCompanionNightlyBuilds->hide();
|
||||
ui->useFirmwareNightlyBuilds->hide();
|
||||
#if !defined(ALLOW_NIGHTLY_BUILDS)
|
||||
// TODO should we gray out nightly builds here?
|
||||
#endif
|
||||
ui->OpenTxBranch->setCurrentIndex(g.OpenTxBranch());
|
||||
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
|
||||
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
|
||||
ui->showSplash->setChecked(g.showSplash());
|
||||
@@ -168,10 +167,15 @@ void AppPreferencesDialog::initSettings()
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
|
||||
|
||||
ui->opt_appDebugLog->setChecked(g.appDebugLog());
|
||||
ui->opt_fwTraceLog->setChecked(g.fwTraceLog());
|
||||
ui->appLogsDir->setText(g.appLogsDir());
|
||||
toggleAppLogSettings();
|
||||
|
||||
#if defined(JOYSTICKS)
|
||||
ui->joystickChkB->setChecked(g.jsSupport());
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
@@ -286,6 +290,15 @@ void AppPreferencesDialog::on_ProfilebackupPathButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AppPreferencesDialog::on_btn_appLogsDir_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this, tr("Select a folder for application logs"), ui->appLogsDir->text());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->appLogsDir->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_ge_pathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
|
||||
@@ -458,6 +471,14 @@ void AppPreferencesDialog::firmwareOptionChanged(bool state)
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::toggleAppLogSettings()
|
||||
{
|
||||
bool vis = (ui->opt_appDebugLog->isChecked() || ui->opt_fwTraceLog->isChecked());
|
||||
ui->appLogsDir->setVisible(vis);
|
||||
ui->lbl_appLogsDir->setVisible(vis);
|
||||
ui->btn_appLogsDir->setVisible(vis);
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::populateFirmwareOptions(const Firmware * firmware)
|
||||
{
|
||||
const Firmware * parent = firmware->getFirmwareBase();
|
||||
@@ -539,4 +560,3 @@ void AppPreferencesDialog::shrink()
|
||||
{
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ class AppPreferencesDialog : public QDialog
|
||||
void shrink();
|
||||
void baseFirmwareChanged();
|
||||
void firmwareOptionChanged(bool state);
|
||||
void toggleAppLogSettings();
|
||||
|
||||
void writeValues();
|
||||
void on_libraryPathButton_clicked();
|
||||
@@ -74,6 +75,7 @@ class AppPreferencesDialog : public QDialog
|
||||
void on_sdPathButton_clicked();
|
||||
void on_SplashSelect_clicked();
|
||||
void on_clearImageButton_clicked();
|
||||
void on_btn_appLogsDir_clicked();
|
||||
|
||||
#if defined(JOYSTICKS)
|
||||
void on_joystickChkB_clicked();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>623</width>
|
||||
<height>537</height>
|
||||
<width>863</width>
|
||||
<height>673</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -26,9 +26,6 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
@@ -763,189 +760,459 @@ Mode 4:
|
||||
<attribute name="title">
|
||||
<string>Application Settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="autoCheckCompanion">
|
||||
<property name="text">
|
||||
<string>Automatic check for Companion updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="showSplash">
|
||||
<property name="text">
|
||||
<string>Show splash screen when Companion starts</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="historySize">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>40</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="useFirmwareNightlyBuilds">
|
||||
<property name="text">
|
||||
<string>Use OpenTX firmware nightly builds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLineEdit" name="backupPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Only show user splash images</string>
|
||||
</property>
|
||||
<item row="7" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="autoCheckFirmware">
|
||||
<property name="text">
|
||||
<string>Automatic check for OpenTX firmware updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="autoCheckCompanion">
|
||||
<property name="text">
|
||||
<string>Automatic check for Companion updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="OpenTxBranch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Use releases (stable)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Use releases and release candidates (testing)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Use nightly builds (unstable)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show user and companion splash images</string>
|
||||
</property>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="0,1">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="historySize">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>40</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>most recently used files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</widget>
|
||||
<item row="6" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Startup Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="ge_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Google Earth Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" rowspan="2" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remember</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="showSplash">
|
||||
<property name="text">
|
||||
<string>Show splash screen when Companion starts</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="backupPath">
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="backupPathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="libraryPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="23" column="0">
|
||||
<widget class="QLabel" name="lbl_appLogsDir">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output Logs Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" rowspan="2" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="opt_removeBlankSlots">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove empty model slots when deleting models (only applies for radios w/out categories)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useWizard">
|
||||
<property name="text">
|
||||
<string>Use model wizard</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useEditor">
|
||||
<property name="text">
|
||||
<string>Open model editor</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useNone">
|
||||
<property name="text">
|
||||
<string>Just create the model</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="backupEnable">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable automatic backup before writing firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Debug Output Logging</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0" rowspan="2" colspan="2">
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Only show user splash images</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show user and companion splash images</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" rowspan="2" colspan="2">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ge_lineedit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ge_pathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="23" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="appLogsDir">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_appLogsDir">
|
||||
<property name="text">
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="22" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_appDebugLog">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Keep a log of all debugging messages generated by the desktop Companion/Simulator applications. An OpenTX developer may request this to help diagnose an issue.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Application (Companion/Simulator)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_fwTraceLog">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Keep a log of all messages generated by the radio firmware when running in Simulator. This is the same information one would also see in the Simulator <span style=" font-style:italic;">Debug Output</span> window.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Radio Firmware (in Simulator)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Splash Screen Library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0" colspan="2">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>User Splash Screens</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Action on New Model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Files to keep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="autoCheckFirmware">
|
||||
<property name="text">
|
||||
<string>Automatic check for OpenTX firmware updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="backupPathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Splash Screen Library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ge_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Google Earth Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -958,155 +1225,6 @@ Mode 4:
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="backupEnable">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable automatic backup before writing firmware</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QLineEdit" name="libraryPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="3">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>User Splash Screens</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="useCompanionNightlyBuilds">
|
||||
<property name="text">
|
||||
<string>Use Companion nightly builds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="ge_lineedit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="ge_pathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Action on New Model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="opt_removeBlankSlots">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove empty model slots when deleting models (only applies for radios w/out categories)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useWizard">
|
||||
<property name="text">
|
||||
<string>Use model wizard</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useEditor">
|
||||
<property name="text">
|
||||
<string>Open model editor</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="opt_newMdl_useNone">
|
||||
<property name="text">
|
||||
<string>Just create the model</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">btnGrp_newModelActions</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="simulatorTab">
|
||||
@@ -1181,7 +1299,7 @@ Mode 4:
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simulator capture folder</string>
|
||||
<string>Screenshot capture folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1363,18 +1481,7 @@ Mode 4:
|
||||
<tabstop>channelorderCB</tabstop>
|
||||
<tabstop>renameFirmware</tabstop>
|
||||
<tabstop>burnFirmware</tabstop>
|
||||
<tabstop>ge_lineedit</tabstop>
|
||||
<tabstop>ge_pathButton</tabstop>
|
||||
<tabstop>historySize</tabstop>
|
||||
<tabstop>showSplash</tabstop>
|
||||
<tabstop>autoCheckFirmware</tabstop>
|
||||
<tabstop>autoCheckCompanion</tabstop>
|
||||
<tabstop>backupPath</tabstop>
|
||||
<tabstop>backupPathButton</tabstop>
|
||||
<tabstop>backupEnable</tabstop>
|
||||
<tabstop>splashincludeCB</tabstop>
|
||||
<tabstop>libraryPath</tabstop>
|
||||
<tabstop>libraryPathButton</tabstop>
|
||||
<tabstop>snapshotPath</tabstop>
|
||||
<tabstop>snapshotPathButton</tabstop>
|
||||
<tabstop>snapshotClipboardCKB</tabstop>
|
||||
|
||||
@@ -99,6 +99,7 @@ const int Boards::getFlashSize(Type board)
|
||||
case BOARD_TARANIS_X9D:
|
||||
case BOARD_TARANIS_X9DP:
|
||||
case BOARD_TARANIS_X9E:
|
||||
case BOARD_TARANIS_X7:
|
||||
case BOARD_FLAMENCO:
|
||||
return FSIZE_TARANIS;
|
||||
case BOARD_X12S:
|
||||
@@ -151,10 +152,10 @@ const SwitchInfo Boards::getSwitchInfo(Board::Type board, unsigned index)
|
||||
}
|
||||
else {
|
||||
const Board::SwitchInfo switches[] = {
|
||||
{SWITCH_3POS, "3POS"},
|
||||
{SWITCH_2POS, "THR"},
|
||||
{SWITCH_2POS, "RUD"},
|
||||
{SWITCH_2POS, "ELE"},
|
||||
{SWITCH_3POS, "3POS"},
|
||||
{SWITCH_2POS, "AIL"},
|
||||
{SWITCH_2POS, "GEA"},
|
||||
{SWITCH_TOGGLE, "TRN"}
|
||||
@@ -171,37 +172,29 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
switch (capability) {
|
||||
case Sticks:
|
||||
return 4;
|
||||
|
||||
case Pots:
|
||||
if (IS_HORUS(board))
|
||||
return 3;
|
||||
else if (IS_TARANIS_X7(board))
|
||||
if (IS_TARANIS_X7(board))
|
||||
return 2;
|
||||
else if (IS_TARANIS_X9E(board))
|
||||
return 4;
|
||||
else if (IS_TARANIS(board))
|
||||
return 3;
|
||||
else
|
||||
return 3;
|
||||
|
||||
case Sliders:
|
||||
if (IS_HORUS(board))
|
||||
if (IS_HORUS_X12S(board) || IS_TARANIS_X9E(board))
|
||||
return 4;
|
||||
else if (IS_TARANIS_X7(board))
|
||||
return 0;
|
||||
else if (IS_TARANIS_X9E(board))
|
||||
return 4;
|
||||
else if (IS_TARANIS(board))
|
||||
else if (IS_TARANIS_X9D(board) || IS_HORUS_X10(board))
|
||||
return 2;
|
||||
else
|
||||
return 0;
|
||||
|
||||
case MouseAnalogs:
|
||||
if (IS_HORUS(board))
|
||||
if (IS_HORUS_X12S(board))
|
||||
return 2;
|
||||
else
|
||||
return 0;
|
||||
case FactoryInstalledSwitches:
|
||||
if (IS_TARANIS_X9E(board))
|
||||
return 8;
|
||||
// no break
|
||||
|
||||
case Switches:
|
||||
if (IS_TARANIS_X9E(board))
|
||||
return 18;
|
||||
@@ -211,16 +204,25 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
return 8;
|
||||
else
|
||||
return 7;
|
||||
|
||||
case FactoryInstalledSwitches:
|
||||
if (IS_TARANIS_X9E(board))
|
||||
return 8;
|
||||
else
|
||||
return getCapability(board, Switches);
|
||||
|
||||
case SwitchPositions:
|
||||
if (IS_HORUS_OR_TARANIS(board))
|
||||
return getCapability(board, Switches) * 3;
|
||||
else
|
||||
return 9;
|
||||
|
||||
case NumTrims:
|
||||
if (IS_HORUS(board))
|
||||
return 6;
|
||||
else
|
||||
return 4;
|
||||
|
||||
case NumTrimSwitches:
|
||||
return getCapability(board, NumTrims) * 2;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,18 @@ burnConfigDialog::~burnConfigDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QStringList burnConfigDialog::getAvrdudeArgs()
|
||||
{
|
||||
QStringList args = avrArgs;
|
||||
if (!avrPort.isEmpty())
|
||||
args << "-P" << avrPort;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
args << "-C" << QFileInfo(QApplication::applicationDirPath() + "/../Resources/avrdude.conf").absoluteFilePath();
|
||||
#endif
|
||||
return args;
|
||||
}
|
||||
|
||||
void burnConfigDialog::getSettings()
|
||||
{
|
||||
avrLoc = g.avrdudeLocation();
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
QString getAVRDUDE() {return avrLoc;}
|
||||
QString getSAMBA() {return sambaLoc;}
|
||||
QString getDFU() {return dfuLoc;}
|
||||
QStringList getAvrdudeArgs() { QStringList args = avrArgs; if (!avrPort.isEmpty()) args << "-P" << avrPort; return args; }
|
||||
QStringList getAvrdudeArgs();
|
||||
QStringList getDFUArgs() {return dfuArgs;}
|
||||
QString getProgrammer() {return avrProgrammer;}
|
||||
QString getMCU() {return avrMCU;}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QSplashScreen>
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
#include <SDL.h>
|
||||
@@ -68,6 +71,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
CustomDebug::setFilterRules();
|
||||
|
||||
if (!g.hasCurrentSettings()) {
|
||||
QString previousVersion;
|
||||
if (g.findPreviousVersionSettings(&previousVersion)) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QObject::tr("We have found existing settings for Companion version: %1.\nDo you want to import them?").arg(previousVersion));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == QMessageBox::Yes)
|
||||
g.importSettings(previousVersion);
|
||||
}
|
||||
}
|
||||
g.init();
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
@@ -77,14 +94,21 @@ int main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
QFile dbgLog;
|
||||
if (AppDebugMessageHandler::instance() && g.appDebugLog() && !g.appLogsDir().isEmpty() && QDir().mkpath(g.appLogsDir())) {
|
||||
QString fn = g.appLogsDir() % "/CompanionDebug_" % QDateTime::currentDateTime().toString("yy-MM-dd_HH-mm-ss") % ".log";
|
||||
dbgLog.setFileName(fn);
|
||||
if (dbgLog.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
AppDebugMessageHandler::instance()->addOutputDevice(&dbgLog);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
app.setStyle(new MyProxyStyle);
|
||||
#endif
|
||||
|
||||
Translations::installTranslators();
|
||||
|
||||
// QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
uint32_t sdlFlags = 0;
|
||||
#ifdef JOYSTICKS
|
||||
@@ -139,5 +163,11 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
qDebug() << "COMPANION EXIT" << result;
|
||||
|
||||
if (dbgLog.isOpen()) {
|
||||
AppDebugMessageHandler::instance()->removeOutputDevice(&dbgLog);
|
||||
dbgLog.close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -47,21 +47,32 @@
|
||||
<file>images/simulator/icons/svg/trainer-active.svg</file>
|
||||
<file>images/simulator/icons/svg/word_wrap.svg</file>
|
||||
<file>images/simulator/icons/svg/word_wrap-on.svg</file>
|
||||
<file>images/simulator/Horus/middle.png</file>
|
||||
<file>images/simulator/Horus/left.png</file>
|
||||
<file>images/simulator/Horus/right.png</file>
|
||||
<file>images/simulator/Horus/top.png</file>
|
||||
<file>images/simulator/Horus/bottom.png</file>
|
||||
<file>images/simulator/Horus/led.png</file>
|
||||
<file>images/simulator/Horus/border-right.png</file>
|
||||
<file>images/simulator/Horus/left_btn1.png</file>
|
||||
<file>images/simulator/Horus/left_btn2.png</file>
|
||||
<file>images/simulator/Horus/left_scrnsht.png</file>
|
||||
<file>images/simulator/Horus/right_btnU.png</file>
|
||||
<file>images/simulator/Horus/right_btnL.png</file>
|
||||
<file>images/simulator/Horus/right_btnD.png</file>
|
||||
<file>images/simulator/Horus/right_btnR.png</file>
|
||||
<file>images/simulator/Horus/right_ent.png</file>
|
||||
<file>images/simulator/X12/middle.png</file>
|
||||
<file>images/simulator/X12/left.png</file>
|
||||
<file>images/simulator/X12/right.png</file>
|
||||
<file>images/simulator/X12/top.png</file>
|
||||
<file>images/simulator/X12/bottom.png</file>
|
||||
<file>images/simulator/X12/led.png</file>
|
||||
<file>images/simulator/X12/border-right.png</file>
|
||||
<file>images/simulator/X12/left_btn1.png</file>
|
||||
<file>images/simulator/X12/left_btn2.png</file>
|
||||
<file>images/simulator/X12/left_scrnsht.png</file>
|
||||
<file>images/simulator/X12/right_btnU.png</file>
|
||||
<file>images/simulator/X12/right_btnL.png</file>
|
||||
<file>images/simulator/X12/right_btnD.png</file>
|
||||
<file>images/simulator/X12/right_btnR.png</file>
|
||||
<file>images/simulator/X12/right_ent.png</file>
|
||||
<file>images/simulator/X10/left.png</file>
|
||||
<file>images/simulator/X10/right.png</file>
|
||||
<file>images/simulator/X10/top.png</file>
|
||||
<file>images/simulator/X10/bottom.png</file>
|
||||
<file>images/simulator/X10/left_mdl.png</file>
|
||||
<file>images/simulator/X10/left_page.png</file>
|
||||
<file>images/simulator/X10/left_scrnsht.png</file>
|
||||
<file>images/simulator/X10/left_rtn.png</file>
|
||||
<file>images/simulator/X10/left_sys.png</file>
|
||||
<file>images/simulator/X10/left_tele.png</file>
|
||||
<file>images/simulator/X10/right_ent.png</file>
|
||||
<file>images/simulator/9X/9xdb.png</file>
|
||||
<file>images/simulator/9X/9xdl.png</file>
|
||||
<file>images/simulator/9X/9xdr.png</file>
|
||||
|
||||
@@ -68,4 +68,12 @@
|
||||
#define CPN_STR_SW_INDICATOR_NEUT QCoreApplication::translate("RawSwitch", "-") // Switch neutral (middle) position indicator.
|
||||
#define CPN_STR_SW_INDICATOR_REV QCoreApplication::translate("RawSwitch", "!") // Switch reversed logic (NOT) indicator.
|
||||
|
||||
enum DownloadBranchType {
|
||||
BRANCH_RELEASE_STABLE,
|
||||
BRANCH_RC_TESTING,
|
||||
BRANCH_NIGHTLY_UNSTABLE
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(DownloadBranchType)
|
||||
|
||||
#endif // _CONSTANTS_H_
|
||||
|
||||
@@ -114,6 +114,23 @@ void getEEPROMZString(char *dst, const char *src, int size)
|
||||
}
|
||||
}
|
||||
|
||||
QString getElementName(const QString & prefix, unsigned int index, const char * name = NULL, bool padding = false)
|
||||
{
|
||||
QString result = prefix;
|
||||
if (padding)
|
||||
result += QString("%1").arg(index, 2, 10, QChar('0'));
|
||||
else
|
||||
result += QString("%1").arg(index);
|
||||
if (name) {
|
||||
QString trimmed = QString(name).trimmed();
|
||||
if (trimmed.length() > 0) {
|
||||
result += ":" + QString(name).trimmed();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
float ValToTim(int value)
|
||||
{
|
||||
return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0);
|
||||
@@ -508,10 +525,12 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
||||
int genAryIdx = 0;
|
||||
switch (type) {
|
||||
case SOURCE_TYPE_VIRTUAL_INPUT:
|
||||
result = QObject::tr("[I%1]").arg(index+1, 2, 10, QChar('0'));
|
||||
if (model && model->inputNames[index][0])
|
||||
result.append(/*":" + */QString(model->inputNames[index]).trimmed());
|
||||
return result;
|
||||
{
|
||||
const char * name = NULL;
|
||||
if (model)
|
||||
name = model->inputNames[index];
|
||||
return getElementName(QCoreApplication::translate("Input", "I"), index + 1, name);
|
||||
}
|
||||
|
||||
case SOURCE_TYPE_LUA_OUTPUT:
|
||||
return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16));
|
||||
@@ -550,13 +569,15 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
||||
return QObject::tr("CYC%1").arg(index+1);
|
||||
|
||||
case SOURCE_TYPE_PPM:
|
||||
return QObject::tr("TR%1").arg(index+1, 2, 10, QChar('0'));
|
||||
return getElementName(QCoreApplication::translate("Trainer", "TR"), index + 1);
|
||||
|
||||
case SOURCE_TYPE_CH:
|
||||
result = QObject::tr("CH%1").arg(index+1, 2, 10, QChar('0'));
|
||||
if (getCurrentFirmware()->getCapability(ChannelsName) && model && model->limitData[index].name[0])
|
||||
result.append(":" + QString(model->limitData[index].name).trimmed());
|
||||
return result;
|
||||
{
|
||||
const char * name = NULL;
|
||||
if (getCurrentFirmware()->getCapability(ChannelsName) && model)
|
||||
name = model->limitData[index].name;
|
||||
return getElementName(QCoreApplication::translate("Channel", "CH"), index + 1, name);
|
||||
}
|
||||
|
||||
case SOURCE_TYPE_SPECIAL:
|
||||
return CHECK_IN_ARRAY(special, index);
|
||||
@@ -564,7 +585,7 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
||||
case SOURCE_TYPE_TELEMETRY:
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
div_t qr = div(index, 3);
|
||||
result = model ? QString(model->sensorData[qr.quot].label) : QString("[T%1]").arg(qr.quot+1, 2, 10, QChar('0'));
|
||||
result = getElementName(QCoreApplication::translate("Telemetry", "TELE"), qr.quot+1, model ? model->sensorData[qr.quot].label : NULL);
|
||||
if (qr.rem)
|
||||
result += (qr.rem == 1 ? "-" : "+");
|
||||
return result;
|
||||
@@ -574,10 +595,12 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
||||
}
|
||||
|
||||
case SOURCE_TYPE_GVAR:
|
||||
result = QObject::tr("GV%1").arg(index+1, 2, 10, QChar('0'));
|
||||
if (getCurrentFirmware()->getCapability(GvarsName) && model && model->gvars_names[index][0])
|
||||
result.append(":" + QString(model->gvars_names[index]).trimmed());
|
||||
return result;
|
||||
{
|
||||
const char * name = NULL;
|
||||
if (getCurrentFirmware()->getCapability(GvarsName) && model)
|
||||
name = model->gvarData[index].name;
|
||||
return getElementName(QCoreApplication::translate("Global Variable", "GV"), index + 1, name);
|
||||
}
|
||||
|
||||
default:
|
||||
return QObject::tr("----");
|
||||
@@ -622,7 +645,7 @@ bool RawSource::isSlider(int * sliderIndex) const
|
||||
* RawSwitch
|
||||
*/
|
||||
|
||||
QString RawSwitch::toString(Board::Type board, const GeneralSettings * const generalSettings) const
|
||||
QString RawSwitch::toString(Board::Type board, const GeneralSettings * const generalSettings, const ModelData * const modelData) const
|
||||
{
|
||||
if (board == Board::BOARD_UNKNOWN) {
|
||||
board = getCurrentBoard();
|
||||
@@ -634,10 +657,6 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
||||
QString("AIL"), QString("GEA"), QString("TRN")
|
||||
};
|
||||
|
||||
static const QString flightModes[] = {
|
||||
QObject::tr("FM0"), QObject::tr("FM1"), QObject::tr("FM2"), QObject::tr("FM3"), QObject::tr("FM4"), QObject::tr("FM5"), QObject::tr("FM6"), QObject::tr("FM7"), QObject::tr("FM8")
|
||||
};
|
||||
|
||||
static const QString trimsSwitches[] = {
|
||||
QObject::tr("RudTrim Left"), QObject::tr("RudTrim Right"),
|
||||
QObject::tr("EleTrim Down"), QObject::tr("EleTrim Up"),
|
||||
@@ -662,7 +681,7 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
||||
<< CPN_STR_SW_INDICATOR_DN;
|
||||
|
||||
if (index < 0) {
|
||||
return CPN_STR_SW_INDICATOR_REV % RawSwitch(type, -index).toString(board, generalSettings);
|
||||
return CPN_STR_SW_INDICATOR_REV % RawSwitch(type, -index).toString(board, generalSettings, modelData);
|
||||
}
|
||||
else {
|
||||
QString swName;
|
||||
@@ -682,7 +701,7 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
||||
}
|
||||
|
||||
case SWITCH_TYPE_VIRTUAL:
|
||||
return QObject::tr("L%1").arg(index, 2, 10, QChar('0'));
|
||||
return getElementName(QCoreApplication::translate("Logic Switch", "L"), index, NULL, true);
|
||||
|
||||
case SWITCH_TYPE_MULTIPOS_POT:
|
||||
if (!getCurrentFirmware()->getCapability(MultiposPotsPositions))
|
||||
@@ -710,7 +729,7 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
||||
return QObject::tr("One");
|
||||
|
||||
case SWITCH_TYPE_FLIGHT_MODE:
|
||||
return CHECK_IN_ARRAY(flightModes, index-1);
|
||||
return getElementName(QCoreApplication::translate("Flight mode", "FM"), index - 1, modelData ? modelData->flightModeData[index-1].name : NULL);
|
||||
|
||||
case SWITCH_TYPE_NONE:
|
||||
return QObject::tr("----");
|
||||
@@ -718,6 +737,12 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
||||
case SWITCH_TYPE_TIMER_MODE:
|
||||
return CHECK_IN_ARRAY(timerModes, index);
|
||||
|
||||
case SWITCH_TYPE_SENSOR:
|
||||
return getElementName(QCoreApplication::translate("Telemetry", "TELE"), index, modelData ? modelData->sensorData[index-1].label : NULL);
|
||||
|
||||
case SWITCH_TYPE_TELEMETRY:
|
||||
return QObject::tr("Telemetry");
|
||||
|
||||
default:
|
||||
return QObject::tr("???");
|
||||
}
|
||||
@@ -1086,10 +1111,7 @@ bool CurveData::isEmpty() const
|
||||
|
||||
QString CurveData::nameToString(const int idx) const
|
||||
{
|
||||
QString ret = QCoreApplication::translate("CurveData", "CV%1").arg(idx+1, 2, 10, QChar('0'));
|
||||
if (name[0])
|
||||
ret.append(":" + QString(name).trimmed());
|
||||
return ret;
|
||||
return getElementName(QCoreApplication::translate("Curve", "CV"), idx + 1, name);
|
||||
}
|
||||
|
||||
QString LimitData::minToString() const
|
||||
@@ -1156,7 +1178,6 @@ GeneralSettings::GeneralSettings()
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
|
||||
contrast = 25;
|
||||
vBatWarn = 90;
|
||||
|
||||
for (int i=0; i < CPN_MAX_ANALOGS; ++i) {
|
||||
calibMid[i] = 0x200;
|
||||
@@ -1167,7 +1188,29 @@ GeneralSettings::GeneralSettings()
|
||||
Firmware * firmware = Firmware::getCurrentVariant();
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
for (int i=0; i<getBoardCapability(board, Board::FactoryInstalledSwitches); i++) {
|
||||
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset, vBatMax has a -12V offset
|
||||
vBatWarn = 90;
|
||||
if (IS_TARANIS_X9E(board) || IS_HORUS_X12S(board)) {
|
||||
// NI-MH 9.6V
|
||||
vBatWarn = 87;
|
||||
vBatMin = -5; //8,5V
|
||||
vBatMax = -5; //11,5V
|
||||
}
|
||||
else if (IS_HORUS_X10(board)) {
|
||||
// Lipo 2V
|
||||
vBatWarn = 66;
|
||||
vBatMin = -28; // 6.2V
|
||||
vBatMax = -38; // 8.2V
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
// NI-MH 7.2V, X9D, X9D+ and X7
|
||||
vBatWarn = 65;
|
||||
vBatMin = -30; //6V
|
||||
vBatMax = -40; //8V
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i<getBoardCapability(board, Board::FactoryInstalledSwitches); i++) {
|
||||
switchConfig[i] = Boards::getSwitchInfo(board, i).config;
|
||||
}
|
||||
|
||||
@@ -1197,13 +1240,13 @@ GeneralSettings::GeneralSettings()
|
||||
potConfig[2] = Board::POT_WITHOUT_DETENT;
|
||||
}
|
||||
|
||||
if (IS_HORUS(board) || IS_TARANIS_X9E(board)) {
|
||||
if (IS_HORUS_X12S(board) || IS_TARANIS_X9E(board)) {
|
||||
sliderConfig[0] = Board::SLIDER_WITH_DETENT;
|
||||
sliderConfig[1] = Board::SLIDER_WITH_DETENT;
|
||||
sliderConfig[2] = Board::SLIDER_WITH_DETENT;
|
||||
sliderConfig[3] = Board::SLIDER_WITH_DETENT;
|
||||
}
|
||||
else if (IS_TARANIS(board) && !IS_TARANIS_X7(board)) {
|
||||
else if (IS_TARANIS_X9(board) || IS_HORUS_X10(board)) {
|
||||
sliderConfig[0] = Board::SLIDER_WITH_DETENT;
|
||||
sliderConfig[1] = Board::SLIDER_WITH_DETENT;
|
||||
}
|
||||
@@ -1212,7 +1255,7 @@ GeneralSettings::GeneralSettings()
|
||||
speakerVolume = 12;
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(board)) {
|
||||
if (IS_HORUS(board) || IS_TARANIS_X9E(board) || IS_TARANIS_X7(board)) {
|
||||
strcpy(bluetoothName, "Taranis");
|
||||
}
|
||||
|
||||
@@ -1392,8 +1435,6 @@ void FrSkyData::clear()
|
||||
mAhPersistent = 0;
|
||||
storedMah = 0;
|
||||
fasOffset = 0;
|
||||
rssiAlarms[0].clear(2, 45);
|
||||
rssiAlarms[1].clear(3, 42);
|
||||
for (int i=0; i<4; i++)
|
||||
screens[i].clear();
|
||||
varioSource = 2/*VARIO*/;
|
||||
@@ -1544,6 +1585,9 @@ void ModelData::clear()
|
||||
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
|
||||
flightModeData[i].clear(i);
|
||||
}
|
||||
for (int i=0; i<CPN_MAX_GVARS; i++) {
|
||||
gvarData[i].clear();
|
||||
}
|
||||
clearInputs();
|
||||
clearMixes();
|
||||
for (int i=0; i<CPN_MAX_CHNOUT; i++)
|
||||
@@ -1560,6 +1604,7 @@ void ModelData::clear()
|
||||
timers[i].clear();
|
||||
swashRingData.clear();
|
||||
frsky.clear();
|
||||
rssiAlarms.clear();
|
||||
for (int i=0; i<CPN_MAX_SENSORS; i++)
|
||||
sensorData[i].clear();
|
||||
|
||||
@@ -1676,8 +1721,8 @@ bool ModelData::isGVarLinked(int phaseIdx, int gvarIdx)
|
||||
int ModelData::getGVarFieldValue(int phaseIdx, int gvarIdx)
|
||||
{
|
||||
int idx = flightModeData[phaseIdx].gvars[gvarIdx];
|
||||
for (int i=0; idx>1024 && i<CPN_MAX_FLIGHT_MODES; i++) {
|
||||
int nextPhase = idx - 1025;
|
||||
for (int i=0; idx>GVAR_MAX_VALUE && i<CPN_MAX_FLIGHT_MODES; i++) {
|
||||
int nextPhase = idx - GVAR_MAX_VALUE - 1;
|
||||
if (nextPhase >= phaseIdx) nextPhase += 1;
|
||||
phaseIdx = nextPhase;
|
||||
idx = flightModeData[phaseIdx].gvars[gvarIdx];
|
||||
@@ -1746,6 +1791,29 @@ int ModelData::getChannelsMax(bool forceExtendedLimits) const
|
||||
return 100;
|
||||
}
|
||||
|
||||
bool ModelData::isAvailable(const RawSwitch & swtch) const
|
||||
{
|
||||
unsigned index = abs(swtch.index) - 1;
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_VIRTUAL) {
|
||||
return logicalSw[index].func != LS_FN_OFF;
|
||||
}
|
||||
else if (swtch.type == SWITCH_TYPE_FLIGHT_MODE) {
|
||||
return index == 0 || flightModeData[index].swtch.type != SWITCH_TYPE_NONE;
|
||||
}
|
||||
else if (swtch.type == SWITCH_TYPE_SENSOR) {
|
||||
return strlen(sensorData[index].label) > 0;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
float ModelData::getGVarFieldValuePrec(int phaseIdx, int gvarIdx)
|
||||
{
|
||||
return getGVarFieldValue(phaseIdx, gvarIdx) * gvarData[gvarIdx].multiplierGet();
|
||||
}
|
||||
|
||||
QList<EEPROMInterface *> eepromInterfaces;
|
||||
|
||||
void unregisterEEpromInterfaces()
|
||||
@@ -1797,7 +1865,7 @@ void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long err
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
QStringList warningsList;
|
||||
if (errors.test(WARNING_WRONG_FIRMWARE)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
|
||||
if (errors.test(OLD_VERSION)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your eeprom is from an old version of OpenTX, upgrading!\n You should 'save as' to keep the old file as a backup."); }
|
||||
if (errors.test(OLD_VERSION)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your eeprom is from an old version of OpenTX, upgrading!\n To keep your original file as a backup, please choose File -> Save As specifying a different name."); }
|
||||
|
||||
QMessageBox msgBox(parent);
|
||||
msgBox.setWindowTitle(title);
|
||||
@@ -1880,3 +1948,67 @@ void FlightModeData::clear(const int phase)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString GVarData::unitToString() const
|
||||
{
|
||||
switch (unit) {
|
||||
case GVAR_UNIT_NUMBER:
|
||||
return QObject::tr("");
|
||||
case GVAR_UNIT_PERCENT:
|
||||
return QObject::tr("%");
|
||||
default:
|
||||
return QObject::tr("?"); // highlight unknown value
|
||||
}
|
||||
}
|
||||
|
||||
QString GVarData::precToString() const
|
||||
{
|
||||
switch (prec) {
|
||||
case GVAR_PREC_MUL10:
|
||||
return QObject::tr("0._");
|
||||
case GVAR_PREC_MUL1:
|
||||
return QObject::tr("0.0");
|
||||
default:
|
||||
return QObject::tr("?.?"); // highlight unknown value
|
||||
}
|
||||
}
|
||||
|
||||
int GVarData::multiplierSet()
|
||||
{
|
||||
return (prec == 0 ? 1 : 10);
|
||||
}
|
||||
|
||||
float GVarData::multiplierGet() const
|
||||
{
|
||||
return (prec == 0 ? 1 : 0.1);
|
||||
}
|
||||
|
||||
void GVarData::setMin(float val)
|
||||
{
|
||||
min = (val * multiplierSet()) - GVAR_MIN_VALUE;
|
||||
}
|
||||
|
||||
void GVarData::setMax(float val)
|
||||
{
|
||||
max = GVAR_MAX_VALUE - (val * multiplierSet());
|
||||
}
|
||||
|
||||
int GVarData::getMin() const
|
||||
{
|
||||
return GVAR_MIN_VALUE + min;
|
||||
}
|
||||
|
||||
int GVarData::getMax() const
|
||||
{
|
||||
return GVAR_MAX_VALUE - max;
|
||||
}
|
||||
|
||||
float GVarData::getMinPrec() const
|
||||
{
|
||||
return getMin() * multiplierGet();
|
||||
}
|
||||
|
||||
float GVarData::getMaxPrec() const
|
||||
{
|
||||
return getMax() * multiplierGet();
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ enum Capability {
|
||||
SoundMod,
|
||||
SoundPitch,
|
||||
MaxVolume,
|
||||
MaxContrast,
|
||||
MinContrast,
|
||||
Haptic,
|
||||
HasBeeper,
|
||||
ModelTrainerEnable,
|
||||
|
||||
@@ -95,7 +95,6 @@ Er9xGeneral::operator GeneralSettings ()
|
||||
|
||||
result.view = std::min((uint8_t)4, view);
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = disableSwitchWarning ? 0 : -1;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
|
||||
switch (beeperVal) {
|
||||
|
||||
@@ -82,7 +82,9 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||
#if 0
|
||||
unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying er9x xml import... ";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying er9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
@@ -94,7 +96,7 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
}
|
||||
else {
|
||||
radioData.generalSettings=er9xGeneral;
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
dbg << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
}
|
||||
for (int i=0; i<getCapability(Models); i++) {
|
||||
Er9xModelData er9xModel;
|
||||
@@ -104,7 +106,7 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
radioData.models[i] = er9xModel;
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
dbg << "ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -112,18 +114,20 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
|
||||
unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying er9x import... ";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying er9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != Boards::getEEpromSize(Board::BOARD_STOCK)) {
|
||||
std::cout << "wrong size\n";
|
||||
dbg << "wrong size";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, Board::BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
dbg << "wrong file system";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -132,16 +136,16 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
|
||||
Er9xGeneral er9xGeneral;
|
||||
|
||||
if (efile->readRlc1((uint8_t*)&er9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
dbg << "no";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
dbg << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
|
||||
switch(er9xGeneral.myVers) {
|
||||
case 3:
|
||||
std::cout << "(old gruvin9x) ";
|
||||
dbg << "(old gruvin9x) ";
|
||||
case 4:
|
||||
// case 5:
|
||||
case 6:
|
||||
@@ -151,14 +155,14 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
|
||||
case 10:
|
||||
break;
|
||||
default:
|
||||
std::cout << "not er9x\n";
|
||||
dbg << "not er9x";
|
||||
errors.set(NOT_ER9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc1((uint8_t*)&er9xGeneral, sizeof(Er9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
dbg << "ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
|
||||
@@ -177,7 +181,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
dbg << "ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,6 @@ Ersky9xGeneral::operator GeneralSettings ()
|
||||
result.trainer = trainer;
|
||||
result.view = std::min((uint8_t)4, view);
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = disableSwitchWarning ? 0 : -1;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
|
||||
switch (beeperVal) {
|
||||
|
||||
@@ -116,7 +116,9 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
|
||||
#if 0
|
||||
unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying ersky9x xml import... ";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying ersky9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
@@ -128,25 +130,25 @@ unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
}
|
||||
else {
|
||||
radioData.generalSettings=ersky9xGeneral;
|
||||
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
dbg << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
}
|
||||
for(int i=0; i<getCapability(Models); i++) {
|
||||
if (ersky9xGeneral.myVers == 10) {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v10>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
dbg << "ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v11>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
dbg << "ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
dbg << "ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -154,18 +156,20 @@ unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
|
||||
unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying ersky9x import... ";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying ersky9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != Boards::getEEpromSize(Board::BOARD_SKY9X)) {
|
||||
std::cout << "wrong size\n";
|
||||
dbg << "wrong size";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, Board::BOARD_SKY9X)) {
|
||||
std::cout << "wrong file system\n";
|
||||
dbg << "wrong file system";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -174,12 +178,12 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
|
||||
Ersky9xGeneral ersky9xGeneral;
|
||||
|
||||
if (efile->readRlc2((uint8_t*)&ersky9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
dbg << "no";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
dbg << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
|
||||
switch(ersky9xGeneral.myVers) {
|
||||
case 10:
|
||||
@@ -187,13 +191,13 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
|
||||
case 11:
|
||||
break;
|
||||
default:
|
||||
std::cout << "not ersky9x\n";
|
||||
dbg << "not ersky9x";
|
||||
errors.set(NOT_ERSKY9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc2((uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
dbg << "ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -225,7 +229,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
dbg << "ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
|
||||
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++);
|
||||
@@ -144,6 +145,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ARM(board) && version >= 218) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TELEMETRY, -1), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TELEMETRY, 1), val++);
|
||||
for (int i=1; i<=CPN_MAX_SENSORS; i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SENSOR, -i), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SENSOR, i), val++);
|
||||
}
|
||||
}
|
||||
|
||||
if (version < 216) {
|
||||
// previous "moment" switches
|
||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board, version); i++) {
|
||||
@@ -616,7 +626,7 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
||||
};
|
||||
|
||||
|
||||
int smallGvarToEEPROM(int gvar)
|
||||
int smallGvarImport(int gvar)
|
||||
{
|
||||
if (gvar < -10000) {
|
||||
gvar = 128 + gvar + 10000;
|
||||
@@ -627,7 +637,7 @@ int smallGvarToEEPROM(int gvar)
|
||||
return gvar;
|
||||
}
|
||||
|
||||
int smallGvarToC9x(int gvar)
|
||||
int smallGvarExport(int gvar)
|
||||
{
|
||||
if (gvar > 110) {
|
||||
gvar = gvar - 128 - 10000;
|
||||
@@ -754,7 +764,7 @@ class CurveReferenceField: public TransformedField {
|
||||
{
|
||||
if (curve.value != 0) {
|
||||
_curve_type = (unsigned int)curve.type;
|
||||
_curve_value = smallGvarToEEPROM(curve.value);
|
||||
_curve_value = smallGvarImport(curve.value);
|
||||
}
|
||||
else {
|
||||
_curve_type = 0;
|
||||
@@ -765,7 +775,7 @@ class CurveReferenceField: public TransformedField {
|
||||
virtual void afterImport()
|
||||
{
|
||||
curve.type = (CurveReference::CurveRefType)_curve_type;
|
||||
curve.value = smallGvarToC9x(_curve_value);
|
||||
curve.value = smallGvarExport(_curve_value);
|
||||
qCDebug(eepromImport) << QString("imported CurveReference(%1)").arg(curve.toString());
|
||||
}
|
||||
|
||||
@@ -996,7 +1006,7 @@ class MixField: public TransformedField {
|
||||
else
|
||||
internalField.Append(new ZCharField<6>(this, mix.name));
|
||||
}
|
||||
else if (IS_TARANIS(board) && version >= 217) {
|
||||
else if (IS_TARANIS(board) && version == 217) {
|
||||
internalField.Append(new UnsignedField<8>(this, _destCh));
|
||||
internalField.Append(new UnsignedField<9>(this, mix.flightModes));
|
||||
internalField.Append(new UnsignedField<2>(this, (unsigned int &)mix.mltpx));
|
||||
@@ -1013,7 +1023,7 @@ class MixField: public TransformedField {
|
||||
internalField.Append(new UnsignedField<8>(this, mix.speedDown));
|
||||
internalField.Append(new ZCharField<8>(this, mix.name));
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 217) {
|
||||
else if (IS_ARM(board) && version == 217) {
|
||||
internalField.Append(new UnsignedField<5>(this, _destCh));
|
||||
internalField.Append(new UnsignedField<3>(this, mix.mixWarn));
|
||||
internalField.Append(new UnsignedField<9>(this, mix.flightModes));
|
||||
@@ -1172,7 +1182,7 @@ class MixField: public TransformedField {
|
||||
}
|
||||
else if (mix.curve.type == CurveReference::CURVE_REF_DIFF) {
|
||||
_curveMode = 0;
|
||||
_curveParam = smallGvarToEEPROM(mix.curve.value);
|
||||
_curveParam = smallGvarImport(mix.curve.value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1209,7 +1219,7 @@ class MixField: public TransformedField {
|
||||
mix.destCh = _destCh + 1;
|
||||
if (!IS_ARM(board) || (!IS_STM32(board) && version < 218) || version < 216) {
|
||||
if (!_curveMode)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarToC9x(_curveParam));
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarExport(_curveParam));
|
||||
else if (_curveParam > 6)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
|
||||
else if (_curveParam < 0)
|
||||
@@ -1369,13 +1379,13 @@ class InputField: public TransformedField {
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
_weight = smallGvarImport(expo.weight);
|
||||
|
||||
if (IS_HORUS_OR_TARANIS(board) && version >= 216) {
|
||||
_offset = smallGvarToEEPROM(expo.offset);
|
||||
if ((IS_HORUS_OR_TARANIS(board) && version >= 216) || (IS_ARM(board) && version >= 218)) {
|
||||
_offset = smallGvarImport(expo.offset);
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (!IS_ARM(board) || (!IS_TARANIS(board) && version < 218) || version < 216) {
|
||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||
_curveMode = true;
|
||||
_curveParam = expo.curve.value;
|
||||
@@ -1386,33 +1396,26 @@ class InputField: public TransformedField {
|
||||
}
|
||||
else {
|
||||
_curveMode = false;
|
||||
_curveParam = smallGvarToEEPROM(expo.curve.value);
|
||||
_curveParam = smallGvarImport(expo.curve.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
if (IS_STM32(board)) {
|
||||
if (version < 216) {
|
||||
if (expo.mode) {
|
||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (expo.mode) {
|
||||
if ((IS_STM32(board) && version < 216 )|| (!IS_STM32(board) && expo.mode)) {
|
||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||
}
|
||||
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
expo.weight = smallGvarExport(_weight);
|
||||
|
||||
if (IS_STM32(board) && version >= 216) {
|
||||
expo.offset = smallGvarToC9x(_offset);
|
||||
if ((IS_STM32(board) && version >= 216) || (IS_ARM(board) && version >= 218)) {
|
||||
expo.offset = smallGvarExport(_offset);
|
||||
}
|
||||
|
||||
if (!IS_ARM(board) || (!IS_STM32(board) && version < 218) || version < 216) {
|
||||
if (!IS_ARM(board) || (!IS_TARANIS(board) && version < 218) || version < 216) {
|
||||
if (!_curveMode)
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarExport(_curveParam));
|
||||
else if (_curveParam > 6)
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
|
||||
else
|
||||
@@ -2580,13 +2583,13 @@ class FrskyScreenField: public DataField {
|
||||
bars.Append(new SourceField<16>(this, screen.body.bars[i].source, board, version, variant));
|
||||
else
|
||||
bars.Append(new SourceField<8>(this, screen.body.bars[i].source, board, version, variant));
|
||||
bars.Append(new UnsignedField<16>(this, screen.body.bars[i].barMin));
|
||||
bars.Append(new UnsignedField<16>(this, screen.body.bars[i].barMax));
|
||||
bars.Append(new SignedField<16>(this, screen.body.bars[i].barMin));
|
||||
bars.Append(new SignedField<16>(this, screen.body.bars[i].barMax));
|
||||
}
|
||||
else {
|
||||
bars.Append(new TelemetrySourceField<8>(this, screen.body.bars[i].source, board, version));
|
||||
bars.Append(new UnsignedField<8>(this, screen.body.bars[i].barMin));
|
||||
bars.Append(new UnsignedField<8>(this, screen.body.bars[i].barMax));
|
||||
bars.Append(new UnsignedField<8>(this, (unsigned &)screen.body.bars[i].barMin));
|
||||
bars.Append(new UnsignedField<8>(this, (unsigned &)screen.body.bars[i].barMax));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2777,7 +2780,7 @@ class TelemetryCurrentSourceConversionTable: public ConversionTable
|
||||
|
||||
class FrskyField: public StructField {
|
||||
public:
|
||||
FrskyField(DataField * parent, FrSkyData & frsky, Board::Type board, unsigned int version, unsigned int variant):
|
||||
FrskyField(DataField * parent, FrSkyData & frsky, RSSIAlarmData & rssiAlarms, Board::Type board, unsigned int version, unsigned int variant):
|
||||
StructField(parent, "FrSky"),
|
||||
telemetryVarioSourceConversionTable(board, version),
|
||||
screenTypesConversionTable(board, version),
|
||||
@@ -2849,10 +2852,12 @@ class FrskyField: public StructField {
|
||||
Append(new SignedField<8>(this, frsky.varioCenterMin));
|
||||
Append(new SignedField<8>(this, frsky.varioMin));
|
||||
Append(new SignedField<8>(this, frsky.varioMax));
|
||||
for (int i=0; i<2; i++) {
|
||||
Append(new ConversionField< UnsignedField<2> >(this, frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI"));
|
||||
Append(new ConversionField< SignedField<6> >(this, frsky.rssiAlarms[i].value, -45+i*3));
|
||||
}
|
||||
Append(new BoolField<1>(this, rssiAlarms.disabled));
|
||||
Append(new SpareBitsField<1>(this));
|
||||
Append(new ConversionField<SignedField<6> >(this, rssiAlarms.warning, -45));
|
||||
Append(new SpareBitsField<2>(this));
|
||||
Append(new ConversionField<SignedField<6> >(this, rssiAlarms.critical, -42));
|
||||
|
||||
if (version == 216) {
|
||||
Append(new BoolField<1>(this, frsky.mAhPersistent));
|
||||
Append(new UnsignedField<15>(this, frsky.storedMah));
|
||||
@@ -2881,8 +2886,8 @@ class FrskyField: public StructField {
|
||||
Append(new SignedField<4>(this, frsky.varioMin, "Vario Min"));
|
||||
Append(new SignedField<4>(this, frsky.varioMax));
|
||||
for (int i=0; i<2; i++) {
|
||||
Append(new ConversionField< UnsignedField<2> >(this, frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
|
||||
Append(new ConversionField< SignedField<6> >(this, frsky.rssiAlarms[i].value, -45+i*3, 0, 0, 100, "RSSI value"));
|
||||
Append(new ConversionField< UnsignedField<2> >(this, rssiAlarms.level[i], &rssiConversionTable[i], "RSSI level"));
|
||||
Append(new ConversionField< SignedField<6> >(this, i ==0 ? rssiAlarms.warning : rssiAlarms.critical, -45+i*3, 0, 0, 100, "RSSI value"));
|
||||
}
|
||||
for (int i=0; i<2; i++) {
|
||||
Append(new FrskyScreenField(this, frsky.screens[i], board, version, variant));
|
||||
@@ -3221,18 +3226,19 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
||||
if (board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) {
|
||||
for (int i=0; i<MAX_GVARS(board, version); i++) {
|
||||
if (version >= 218) {
|
||||
internalField.Append(new ZCharField<3>(this, modelData.gvars_names[i], "GVar name"));
|
||||
internalField.Append(new SpareBitsField<12>(this)); // TODO min
|
||||
internalField.Append(new SpareBitsField<12>(this)); // TODO max
|
||||
internalField.Append(new BoolField<1>(this, modelData.gvars_popups[i]));
|
||||
internalField.Append(new SpareBitsField<1>(this));
|
||||
internalField.Append(new SpareBitsField<2>(this));
|
||||
internalField.Append(new ZCharField<3>(this, modelData.gvarData[i].name, "GVar name"));
|
||||
internalField.Append(new UnsignedField<12>(this, (unsigned &)modelData.gvarData[i].min));
|
||||
internalField.Append(new UnsignedField<12>(this, (unsigned &)modelData.gvarData[i].max));
|
||||
internalField.Append(new BoolField<1>(this, modelData.gvarData[i].popup));
|
||||
internalField.Append(new UnsignedField<1>(this, modelData.gvarData[i].prec));
|
||||
internalField.Append(new UnsignedField<2>(this, modelData.gvarData[i].unit));
|
||||
internalField.Append(new SpareBitsField<4>(this));
|
||||
}
|
||||
else {
|
||||
internalField.Append(new ZCharField<6>(this, modelData.gvars_names[i], "GVar name"));
|
||||
internalField.Append(new ZCharField<3>(this, modelData.gvarData[i].name, "GVar name"));
|
||||
internalField.Append(new SpareBitsField<3*8>(this));
|
||||
if (version >= 216) {
|
||||
internalField.Append(new BoolField<1>(this, modelData.gvars_popups[i]));
|
||||
internalField.Append(new BoolField<1>(this, modelData.gvarData[i].popup));
|
||||
internalField.Append(new SpareBitsField<7>(this));
|
||||
}
|
||||
}
|
||||
@@ -3246,7 +3252,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
||||
}
|
||||
|
||||
if ((board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) || (variant & FRSKY_VARIANT)) {
|
||||
internalField.Append(new FrskyField(this, modelData.frsky, board, version, variant));
|
||||
internalField.Append(new FrskyField(this, modelData.frsky, modelData.rssiAlarms, board, version, variant));
|
||||
}
|
||||
else if ((board == BOARD_STOCK || board == BOARD_M128) && (variant & MAVLINK_VARIANT)) {
|
||||
internalField.Append(new MavlinkField(this, modelData.mavlink, board, version));
|
||||
@@ -3423,8 +3429,18 @@ void OpenTxModelData::beforeExport()
|
||||
// qDebug() << QString("before export model") << modelData.name;
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) {
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
||||
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||
if (! (modelData.moduleData[module].protocol == PULSES_PXX_R9M)) {
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
||||
}
|
||||
int pxxByte = (modelData.moduleData[module].pxx.power & 0x03)
|
||||
| modelData.moduleData[module].pxx.receiver_telem_off << 4
|
||||
| modelData.moduleData[module].pxx.receiver_channel_9_16 << 5;
|
||||
modelData.moduleData[module].ppm.delay = 300 + 50 * pxxByte;
|
||||
modelData.moduleData[module].ppm.pulsePol = modelData.moduleData[module].pxx.external_antenna;
|
||||
modelData.moduleData[module].ppm.outputType = modelData.moduleData[module].pxx.sport_out;
|
||||
|
||||
}
|
||||
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX) {
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
|
||||
@@ -3499,6 +3515,17 @@ void OpenTxModelData::afterImport()
|
||||
modelData.moduleData[module].multi.lowPowerMode = modelData.moduleData[module].ppm.outputType;
|
||||
modelData.moduleData[module].multi.autoBindMode = modelData.moduleData[module].ppm.pulsePol;
|
||||
}
|
||||
|
||||
if ((modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12) ||
|
||||
modelData.moduleData[module].protocol == PULSES_PXX_R9M) {
|
||||
// Do the same for pxx
|
||||
unsigned int pxxByte = (unsigned int)((modelData.moduleData[module].ppm.delay - 300) / 50);
|
||||
modelData.moduleData[module].pxx.power = pxxByte & 0x03;
|
||||
modelData.moduleData[module].pxx.receiver_telem_off = static_cast<bool>(pxxByte & (1 << 4));
|
||||
modelData.moduleData[module].pxx.receiver_channel_9_16 = static_cast<bool>(pxxByte & (1 << 5));
|
||||
modelData.moduleData[module].pxx.sport_out = modelData.moduleData[module].ppm.outputType;
|
||||
modelData.moduleData[module].pxx.external_antenna = modelData.moduleData[module].ppm.pulsePol;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
|
||||
@@ -3656,22 +3683,25 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.backlightBright));
|
||||
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.txCurrentCalibration));
|
||||
if (version >= 213) {
|
||||
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.temperatureWarn)); // TODO
|
||||
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.temperatureWarn));
|
||||
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.mAhWarn));
|
||||
if (version < 218) internalField.Append(new UnsignedField<16>(this, generalData.mAhUsed));
|
||||
internalField.Append(new UnsignedField<32>(this, generalData.globalTimer));
|
||||
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.temperatureCalib)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.btBaudrate)); // TODO
|
||||
if (version < 218) internalField.Append(new BoolField<8>(this, generalData.optrexDisplay)); //TODO
|
||||
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.sticksGain)); // TODO
|
||||
if (version < 218) internalField.Append(new SignedField<8>(this, generalData.temperatureCalib));
|
||||
internalField.Append(new UnsignedField<4>(this, generalData.bluetoothBaudrate));
|
||||
internalField.Append(new UnsignedField<4>(this, generalData.bluetoothMode));
|
||||
if (version < 218) internalField.Append(new BoolField<8>(this, generalData.optrexDisplay));
|
||||
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.sticksGain));
|
||||
}
|
||||
if (version >= 214) {
|
||||
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.rotarySteps)); // TODO
|
||||
if (version < 218) internalField.Append(new UnsignedField<8>(this, generalData.rotarySteps));
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.countryCode));
|
||||
internalField.Append(new UnsignedField<1>(this, generalData.imperial));
|
||||
if (version >= 218) {
|
||||
internalField.Append(new BoolField<1>(this, generalData.jitterFilter));
|
||||
internalField.Append(new SpareBitsField<6>(this));
|
||||
internalField.Append(new BoolField<1>(this, generalData.disableRssiPoweroffAlarm));
|
||||
internalField.Append(new UnsignedField<2>(this, generalData.usbMode));
|
||||
internalField.Append(new SpareBitsField<3>(this));
|
||||
}
|
||||
else {
|
||||
internalField.Append(new SpareBitsField<7>(this));
|
||||
@@ -3741,6 +3771,16 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.backlightColor));
|
||||
}
|
||||
}
|
||||
else if (IS_SKY9X(board) && version >= 218) {
|
||||
internalField.Append(new SignedField<8>(this, generalData.txCurrentCalibration));
|
||||
internalField.Append(new SignedField<8>(this, generalData.temperatureWarn));
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.mAhWarn));
|
||||
internalField.Append(new UnsignedField<16>(this, generalData.mAhUsed));
|
||||
internalField.Append(new SignedField<8>(this, generalData.temperatureCalib));
|
||||
internalField.Append(new BoolField<8>(this, generalData.optrexDisplay));
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.sticksGain));
|
||||
internalField.Append(new UnsignedField<8>(this, generalData.rotarySteps));
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(board))
|
||||
internalField.Append(new SpareBitsField<64>(this)); // switchUnlockStates
|
||||
@@ -3790,7 +3830,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
}
|
||||
|
||||
if (IS_HORUS(board)) {
|
||||
internalField.Append(new BoolField<1>(this, generalData.bluetoothEnable));
|
||||
internalField.Append(new SpareBitsField<1>(this));
|
||||
internalField.Append(new UnsignedField<7>(this, generalData.backlightOffBright));
|
||||
internalField.Append(new ZCharField<10>(this, generalData.bluetoothName, "Bluetooth name"));
|
||||
}
|
||||
|
||||
@@ -98,13 +98,11 @@ class ProtocolsConversionTable: public ConversionTable
|
||||
addConversion(PULSES_DSM2, val++);
|
||||
addConversion(PULSES_DSMX, val++);
|
||||
}
|
||||
if (IS_HORUS_OR_TARANIS(board)) {
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(PULSES_CROSSFIRE, val++);
|
||||
addConversion(PULSES_MULTIMODULE, val++);
|
||||
}
|
||||
else if (IS_ARM(board)) {
|
||||
val++;
|
||||
addConversion(PULSES_MULTIMODULE, val++);
|
||||
addConversion(PULSES_PXX_R9M, val++);
|
||||
addConversion(PULSES_SBUS, val++);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,8 +30,11 @@
|
||||
|
||||
using namespace Board;
|
||||
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-22.open-tx.org/firmware"
|
||||
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-22.open-tx.org/nightly/firmware"
|
||||
const char * const OPENTX_FIRMWARE_DOWNLOAD_URL[] = {
|
||||
"https://downloads.open-tx.org/2.2/release/firmware",
|
||||
"https://downloads.open-tx.org/2.2/rc/firmware",
|
||||
"https://downloads.open-tx.org/2.2/nightlies/firmware"
|
||||
};
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
@@ -107,7 +110,7 @@ bool OpenTxEepromInterface::loadRadioSettingsFromRLE(GeneralSettings & settings,
|
||||
return checkVariant(settings.version, settings.variant);
|
||||
}
|
||||
else {
|
||||
std::cout << " error when loading general settings";
|
||||
qWarning() << " error when loading general settings";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +183,9 @@ bool OpenTxEepromInterface::loadFromByteArray(T & dest, const QByteArray & data)
|
||||
|
||||
unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t * eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import...";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying " << getName() << " import...";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
@@ -193,7 +198,7 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
||||
}
|
||||
}
|
||||
if (notnull) {
|
||||
std::cout << " wrong size (" << size << ")\n";
|
||||
dbg << " wrong size (" << size << ")";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -204,14 +209,14 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << " wrong size (" << size << "/" << Boards::getEEpromSize(board) << ")\n";
|
||||
dbg << " wrong size (" << size << "/" << Boards::getEEpromSize(board) << ")";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *) eeprom, size, board)) {
|
||||
std::cout << " wrong file system\n";
|
||||
dbg << " wrong file system";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -220,12 +225,12 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
||||
|
||||
uint8_t version;
|
||||
if (efile->readRlc2(&version, 1) != 1) {
|
||||
std::cout << " no\n";
|
||||
dbg << " no";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " version " << (unsigned int) version;
|
||||
dbg << " version " << (unsigned int) version;
|
||||
|
||||
EepromLoadErrors version_error = checkVersion(version);
|
||||
if (version_error == OLD_VERSION) {
|
||||
@@ -234,24 +239,24 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
||||
ShowEepromWarnings(NULL, QObject::tr("Warning"), errors.to_ulong());
|
||||
}
|
||||
else if (version_error == NOT_OPENTX) {
|
||||
std::cout << " not open9x\n";
|
||||
dbg << " not open9x";
|
||||
errors.set(version_error);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!loadRadioSettingsFromRLE(radioData.generalSettings, efile, version)) {
|
||||
std::cout << " ko\n";
|
||||
dbg << " ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " variant " << radioData.generalSettings.variant;
|
||||
dbg << " variant " << radioData.generalSettings.variant;
|
||||
if (getCurrentFirmware()->getCapability(Models) == 0) {
|
||||
radioData.models.resize(firmware->getCapability(Models));
|
||||
}
|
||||
for (int i = 0; i < firmware->getCapability(Models); i++) {
|
||||
if (i < (int)radioData.models.size() && !loadModelFromRLE(radioData.models[i], efile, i, version, radioData.generalSettings.variant)) {
|
||||
std::cout << " ko\n";
|
||||
dbg << " ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
if (getCurrentFirmware()->getCapability(Models) == 0) {
|
||||
radioData.models.resize(i);
|
||||
@@ -259,7 +264,7 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
std::cout << " ok\n";
|
||||
dbg << " ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -332,7 +337,7 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
|
||||
}
|
||||
|
||||
for (int i = 0; i < getCurrentFirmware()->getCapability(Models); i++) {
|
||||
if (!radioData.models[i].isEmpty()) {
|
||||
if (i < (int)radioData.models.size() && !radioData.models[i].isEmpty()) {
|
||||
OpenTxModelData generator((ModelData &)radioData.models[i], board, version, variant);
|
||||
// generator.Dump();
|
||||
QByteArray data;
|
||||
@@ -538,6 +543,16 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
return 0;
|
||||
case MaxVolume:
|
||||
return (IS_ARM(board) ? 23 : 7);
|
||||
case MaxContrast:
|
||||
if (IS_TARANIS_X7(board))
|
||||
return 30;
|
||||
else
|
||||
return 45;
|
||||
case MinContrast:
|
||||
if (IS_TARANIS_X9(board))
|
||||
return 0;
|
||||
else
|
||||
return 10;
|
||||
case HasSoundMixer:
|
||||
return (IS_ARM(board) ? 1 : 0);
|
||||
case ExtraInputs:
|
||||
@@ -559,7 +574,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
case ChannelsName:
|
||||
return (IS_ARM(board) ? (HAS_LARGE_LCD(board) ? 6 : 4) : 0);
|
||||
case HasCvNames:
|
||||
return (IS_HORUS_OR_TARANIS(board) ? 1 : 0);
|
||||
return (IS_ARM(board) ? 1 : 0);
|
||||
case Telemetry:
|
||||
if (IS_2560(board) || IS_ARM(board) || id.contains("frsky") || id.contains("telemetrez"))
|
||||
return TM_HASTELEMETRY | TM_HASOFFSET | TM_HASWSHH;
|
||||
@@ -744,7 +759,7 @@ QString OpenTxFirmware::getAnalogInputName(unsigned int index)
|
||||
};
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else if (IS_HORUS(board)) {
|
||||
else if (IS_HORUS_X12S(board)) {
|
||||
const QString pots[] = {
|
||||
QObject::tr("S1"),
|
||||
QObject::tr("6P"),
|
||||
@@ -758,6 +773,16 @@ QString OpenTxFirmware::getAnalogInputName(unsigned int index)
|
||||
};
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else if (IS_HORUS_X10(board)) {
|
||||
const QString pots[] = {
|
||||
QObject::tr("S1"),
|
||||
QObject::tr("6P"),
|
||||
QObject::tr("S2"),
|
||||
QObject::tr("LS"),
|
||||
QObject::tr("RS")
|
||||
};
|
||||
return CHECK_IN_ARRAY(pots, index);
|
||||
}
|
||||
else {
|
||||
return "???";
|
||||
}
|
||||
@@ -798,11 +823,13 @@ int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_PXX_R9M:
|
||||
//case PULSES_PXX_DJT: // Unavailable for now
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
case PULSES_CROSSFIRE:
|
||||
case PULSES_SBUS:
|
||||
return 1;
|
||||
case PULSES_MULTIMODULE:
|
||||
return id.contains("multimodule") ? 1 : 0;
|
||||
@@ -830,9 +857,11 @@ int OpenTxFirmware::isAvailable(PulsesProtocol proto, int port)
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_PXX_R9M:
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
case PULSES_SBUS:
|
||||
return 1;
|
||||
case PULSES_MULTIMODULE:
|
||||
return id.contains("multimodule") ? 1 : 0;
|
||||
@@ -939,29 +968,29 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
|
||||
efile->openRd(i);
|
||||
int sz = efile->readRlc2(tmp, sizeof(tmp));
|
||||
if (sz == 849) {
|
||||
std::cout << " warning: M128 variant not set (but model size seems ok)";
|
||||
qWarning() << " warning: M128 variant not set (but model size seems ok)";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << " wrong variant (" << variant << ")";
|
||||
qWarning() << " wrong variant (" << variant << ")";
|
||||
return false;
|
||||
}
|
||||
else if (IS_TARANIS_X9E(board)) {
|
||||
if (variant != TARANIS_X9E_VARIANT) {
|
||||
std::cout << " wrong variant (" << variant << ")";
|
||||
qWarning() << " wrong variant (" << variant << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS_X7(board)) {
|
||||
if (variant != TARANIS_X7_VARIANT) {
|
||||
std::cout << " wrong variant (" << variant << ")";
|
||||
qWarning() << " wrong variant (" << variant << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
if (variant != 0) {
|
||||
std::cout << " wrong variant (" << variant << ")";
|
||||
qWarning() << " wrong variant (" << variant << ")";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -994,10 +1023,12 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
std::cout << "trying " << getName() << " backup import...";
|
||||
QDebug dbg = qDebug();
|
||||
dbg.setAutoInsertSpaces(false);
|
||||
dbg << "trying " << getName() << " backup import...";
|
||||
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) {
|
||||
std::cout << " no\n";
|
||||
dbg << " no\n";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -1014,13 +1045,13 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
|
||||
backupBoard = BOARD_GRUVIN9X;
|
||||
break;
|
||||
default:
|
||||
std::cout << " unknown board\n";
|
||||
dbg << " unknown board";
|
||||
errors.set(UNKNOWN_BOARD);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (backupBoard != board) {
|
||||
std::cout << " not right board\n";
|
||||
dbg << " not right board";
|
||||
errors.set(WRONG_BOARD);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
@@ -1030,7 +1061,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
|
||||
uint16_t size = ((uint16_t) eeprom[7] << 8) + eeprom[6];
|
||||
uint16_t variant = ((uint16_t) eeprom[9] << 8) + eeprom[8];
|
||||
|
||||
std::cout << " version " << (unsigned int) version << " ";
|
||||
dbg << " version " << (unsigned int) version << " ";
|
||||
|
||||
EepromLoadErrors version_error = checkVersion(version);
|
||||
if (version_error == OLD_VERSION) {
|
||||
@@ -1038,42 +1069,38 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, const uint
|
||||
errors.set(HAS_WARNINGS);
|
||||
}
|
||||
else if (version_error == NOT_OPENTX) {
|
||||
std::cout << " not open9x\n";
|
||||
dbg << " not open9x";
|
||||
errors.set(version_error);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (size > esize - 8) {
|
||||
std::cout << " wrong size\n";
|
||||
dbg << " wrong size";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (bcktype == 'M') {
|
||||
if (!loadModelFromBackup(radioData.models[index], &eeprom[8], size, version, variant)) {
|
||||
std::cout << " ko\n";
|
||||
dbg << " ko";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << " backup type not supported\n";
|
||||
dbg << " backup type not supported";
|
||||
errors.set(BACKUP_NOT_SUPPORTED);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " ok\n";
|
||||
dbg << " ok";
|
||||
errors.set(ALL_OK);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getFirmwareBaseUrl()
|
||||
{
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
return (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
|
||||
#else
|
||||
return OPENTX_FIRMWARE_DOWNLOADS;
|
||||
#endif
|
||||
return OPENTX_FIRMWARE_DOWNLOAD_URL[g.boundedOpenTxBranch()];
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getFirmwareUrl()
|
||||
@@ -1124,13 +1151,8 @@ void addOpenTxFrskyOptions(OpenTxFirmware * firmware)
|
||||
addOpenTxArmOptions(firmware);
|
||||
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
firmware->addOption("lua", QObject::tr("Enable Lua custom scripts screen"));
|
||||
firmware->addOption("luac", QObject::tr("Enable Lua compiler"));
|
||||
firmware->addOption("bindopt", QObject::tr("Enable bindings options"));
|
||||
Option usb_options[] = {{"massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)")},
|
||||
{"cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface")},
|
||||
{NULL}};
|
||||
firmware->addOptions(usb_options);
|
||||
}
|
||||
|
||||
void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
|
||||
@@ -1217,26 +1239,24 @@ void registerOpenTxFirmwares()
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X7 board */
|
||||
firmware = new OpenTxFirmware("opentx-x7", QObject::tr("FrSky Taranis X7"), BOARD_TARANIS_X7);
|
||||
firmware = new OpenTxFirmware("opentx-x7", QObject::tr("FrSky Taranis X7 / X7S"), BOARD_TARANIS_X7);
|
||||
// No mixersmon for now
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
|
||||
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X10 board */
|
||||
firmware = new OpenTxFirmware("opentx-x10", QObject::tr("FrSky Horus X10 / X10S"), BOARD_X10);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky Horus board */
|
||||
firmware = new OpenTxFirmware("opentx-x12s", QObject::tr("FrSky Horus"), BOARD_X12S);
|
||||
firmware = new OpenTxFirmware("opentx-x12s", QObject::tr("FrSky Horus X12S"), BOARD_X12S);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
firmware->addOption("pcbdev", QObject::tr("Use ONLY with first DEV pcb version"));
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
|
||||
/* FrSky X10 board */
|
||||
/* Disabled for now
|
||||
firmware = new OpenTxFirmware("opentx-x10", QObject::tr("FrSky X10"), BOARD_X10);
|
||||
addOpenTxFrskyOptions(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
*/
|
||||
/* 9XR-Pro */
|
||||
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
#include "fwpreferencesdialog.h"
|
||||
#include "ui_fwpreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
|
||||
const char * const OPENTX_SDCARD_DOWNLOAD_URL[] = {
|
||||
"https://downloads.open-tx.org/2.2/release/sdcard/",
|
||||
"https://downloads.open-tx.org/2.2/rc/sdcard/",
|
||||
"https://downloads.open-tx.org/2.2/nightlies/sdcard/"
|
||||
};
|
||||
|
||||
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget * parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FirmwarePreferencesDialog)
|
||||
{
|
||||
@@ -52,26 +55,26 @@ void FirmwarePreferencesDialog::initSettings()
|
||||
|
||||
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
||||
mw->checkForFirmwareUpdate();
|
||||
initSettings();
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
MainWindow * mw = qobject_cast<MainWindow *>(this->parent());
|
||||
mw->dowloadLastFirmwareUpdate();
|
||||
initSettings();
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_sd_dnld_clicked()
|
||||
{
|
||||
QString url = "http://downloads.open-tx.org/2.2/sdcard/";
|
||||
QString url = OPENTX_SDCARD_DOWNLOAD_URL[g.boundedOpenTxBranch()];
|
||||
QString fwType = g.profile[g.id()].fwType();
|
||||
QStringList list = fwType.split("-");
|
||||
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]);
|
||||
url.append(QString("%1/").arg(firmware));
|
||||
if (g.boundedOpenTxBranch() != BRANCH_NIGHTLY_UNSTABLE) {
|
||||
url.append(QString("%1/").arg(firmware));
|
||||
}
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,11 +27,10 @@ ui(new Ui::GeneralSetup)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL};
|
||||
QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
||||
QLabel *pmsl[] = {ui->ro_label, ui->ro1_label, ui->ro2_label, ui->ro3_label, ui->ro4_label, ui->ro5_label, ui->ro6_label, ui->ro7_label, ui->ro8_label, NULL};
|
||||
QSlider *tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->contrastSB->setMinimum(0);
|
||||
if (firmware->getId().contains("readonly")) {
|
||||
uint16_t switchstate = generalSettings.switchUnlockStates;
|
||||
ui->chkSA->setValue(switchstate & 0x3);
|
||||
@@ -44,27 +43,27 @@ ui(new Ui::GeneralSetup)
|
||||
switchstate >>= 2;
|
||||
ui->chkSE->setValue(switchstate & 0x3);
|
||||
switchstate >>= 2;
|
||||
ui->chkSF->setValue((switchstate & 0x3)/2);
|
||||
ui->chkSF->setValue((switchstate & 0x3) / 2);
|
||||
switchstate >>= 2;
|
||||
ui->chkSG->setValue(switchstate & 0x3);
|
||||
switchstate >>= 2;
|
||||
ui->chkSH->setValue(switchstate & 0x3);
|
||||
}
|
||||
else {
|
||||
for (int i=0; pmsl[i]; i++) {
|
||||
for (int i = 0; pmsl[i]; i++) {
|
||||
pmsl[i]->hide();
|
||||
}
|
||||
for (int i=0; tpmsld[i]; i++) {
|
||||
for (int i = 0; tpmsld[i]; i++) {
|
||||
tpmsld[i]->hide();
|
||||
}
|
||||
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i=0; pmsl[i]; i++) {
|
||||
for (int i = 0; pmsl[i]; i++) {
|
||||
pmsl[i]->hide();
|
||||
}
|
||||
for (int i=0; tpmsld[i]; i++) {
|
||||
for (int i = 0; tpmsld[i]; i++) {
|
||||
tpmsld[i]->hide();
|
||||
}
|
||||
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
|
||||
@@ -112,10 +111,10 @@ ui(new Ui::GeneralSetup)
|
||||
ui->varioVolume_SL->setValue(generalSettings.varioVolume);
|
||||
ui->bgVolume_SL->setValue(generalSettings.backgroundVolume);
|
||||
ui->wavVolume_SL->setValue(generalSettings.wavVolume);
|
||||
ui->varioP0_SB->setValue(700+(generalSettings.varioPitch*10));
|
||||
ui->varioP0_SB->setValue(700 + (generalSettings.varioPitch * 10));
|
||||
updateVarioPitchRange();
|
||||
ui->varioPMax_SB->setValue(700+(generalSettings.varioPitch*10)+1000+(generalSettings.varioRange*10));
|
||||
ui->varioR0_SB->setValue(500+(generalSettings.varioRepeat*10));
|
||||
ui->varioPMax_SB->setValue(700 + (generalSettings.varioPitch * 10) + 1000 + (generalSettings.varioRange * 10));
|
||||
ui->varioR0_SB->setValue(500 + (generalSettings.varioRepeat * 10));
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(HasFAIMode)) {
|
||||
@@ -152,11 +151,22 @@ ui(new Ui::GeneralSetup)
|
||||
ui->adjustRTC->hide();
|
||||
}
|
||||
|
||||
if (IS_STM32(firmware->getBoard())){
|
||||
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
|
||||
}
|
||||
else {
|
||||
ui->usbModeLabel->hide();
|
||||
ui->usbModeCB->hide();
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(OptrexDisplay)) {
|
||||
ui->label_displayType->hide();
|
||||
ui->displayTypeCB->setDisabled(true);
|
||||
ui->displayTypeCB->hide();
|
||||
}
|
||||
else {
|
||||
ui->displayTypeCB->setCurrentIndex(generalSettings.optrexDisplay);
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(HasVolume)) {
|
||||
ui->volume_SB->hide();
|
||||
@@ -197,7 +207,7 @@ ui(new Ui::GeneralSetup)
|
||||
}
|
||||
|
||||
int reCount = firmware->getCapability(RotaryEncoders);
|
||||
if (reCount==0) {
|
||||
if (reCount == 0) {
|
||||
ui->re_label->hide();
|
||||
ui->re_CB->hide();
|
||||
}
|
||||
@@ -205,13 +215,23 @@ ui(new Ui::GeneralSetup)
|
||||
populateRotEncCB(reCount);
|
||||
}
|
||||
|
||||
ui->contrastSB->setMinimum(firmware->getCapability(MinContrast));
|
||||
ui->contrastSB->setMaximum(firmware->getCapability(MaxContrast));
|
||||
ui->contrastSB->setValue(generalSettings.contrast);
|
||||
|
||||
ui->battwarningDSB->setValue((double)generalSettings.vBatWarn/10);
|
||||
ui->backlightautoSB->setValue(generalSettings.backlightDelay*5);
|
||||
ui->inactimerSB->setValue(generalSettings.inactivityTimer);
|
||||
|
||||
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //Default is zero=checked
|
||||
ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning);//Default is zero=checked
|
||||
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); // Default is zero=checked
|
||||
ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning); // Default is zero=checked
|
||||
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
ui->rssiPowerOffWarnChkB->setChecked(!generalSettings.disableRssiPoweroffAlarm); // Default is zero=checked
|
||||
}
|
||||
else {
|
||||
ui->rssiPowerOffWarnChkB->hide();
|
||||
}
|
||||
|
||||
if (IS_HORUS(firmware->getBoard())) {
|
||||
ui->splashScreenChkB->hide();
|
||||
@@ -325,6 +345,14 @@ void GeneralSetupPanel::on_backlightswCB_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_usbModeCB_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
generalSettings.usbMode = ui->usbModeCB->currentIndex();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_backlightColor_SL_valueChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
@@ -607,18 +635,24 @@ void GeneralSetupPanel::on_inactimerSB_editingFinished()
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int )
|
||||
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int)
|
||||
{
|
||||
generalSettings.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int )
|
||||
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int)
|
||||
{
|
||||
generalSettings.disableAlarmWarning = ui->alarmwarnChkB->isChecked() ? 0 : 1;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_rssiPowerOffWarnChkB_stateChanged(int)
|
||||
{
|
||||
generalSettings.disableRssiPoweroffAlarm = ui->rssiPowerOffWarnChkB->isChecked() ? 0 : 1;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
|
||||
{
|
||||
generalSettings.beeperMode = (GeneralSettings::BeeperMode)(index-2);
|
||||
|
||||
@@ -40,6 +40,7 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_splashScreenChkB_stateChanged(int);
|
||||
void on_splashScreenDuration_currentIndexChanged(int index);
|
||||
void on_alarmwarnChkB_stateChanged(int);
|
||||
void on_rssiPowerOffWarnChkB_stateChanged(int);
|
||||
void on_gpsFormatCB_currentIndexChanged(int index);
|
||||
void on_displayTypeCB_currentIndexChanged(int index);
|
||||
void on_BLBright_SB_editingFinished();
|
||||
@@ -58,6 +59,7 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_hapticmodeCB_currentIndexChanged(int index);
|
||||
void on_hapticLengthCB_currentIndexChanged(int index);
|
||||
void on_backlightswCB_currentIndexChanged(int index);
|
||||
void on_usbModeCB_currentIndexChanged(int index);
|
||||
void on_backlightColor_SL_valueChanged();
|
||||
void on_mavbaud_CB_currentIndexChanged(int index);
|
||||
void on_voiceLang_CB_currentIndexChanged(int index);
|
||||
|
||||
@@ -404,84 +404,6 @@ void Helpers::getFileComboBoxValue(QComboBox * b, char * dest, int length)
|
||||
}
|
||||
}
|
||||
|
||||
void Helpers::addRawSwitchItems(QStandardItemModel * itemModel, const RawSwitchType & type, int count, const GeneralSettings * const generalSettings)
|
||||
{
|
||||
// Most RawSwitch() indices are one-based (vs. typical zero); these are exceptions to the rule:
|
||||
const static QVector<int> rawSwitchIndexBaseZeroTypes = QVector<int>() << SWITCH_TYPE_NONE << SWITCH_TYPE_ON << SWITCH_TYPE_OFF << SWITCH_TYPE_TIMER_MODE;
|
||||
|
||||
int rawIdxAdj = 0;
|
||||
const Board::Type board = getCurrentBoard();
|
||||
int i = (count < 0 ? count : 1);
|
||||
const int maxCount = (i < 0 ? 0 : count + i);
|
||||
|
||||
// handle exceptions in RawSwitch() index values
|
||||
if (rawSwitchIndexBaseZeroTypes.contains(type))
|
||||
rawIdxAdj = -1;
|
||||
|
||||
for ( ; i < maxCount; ++i) {
|
||||
if (generalSettings) {
|
||||
if (type == SWITCH_TYPE_SWITCH && IS_HORUS_OR_TARANIS(board) && !generalSettings->switchPositionAllowedTaranis(abs(i)))
|
||||
continue;
|
||||
if (type == SWITCH_TYPE_MULTIPOS_POT) {
|
||||
int pot = div(abs(i) - 1, getCurrentFirmware()->getCapability(MultiposPotsPositions)).quot;
|
||||
if (!generalSettings->isPotAvailable(pot) || generalSettings->potConfig[pot] != Board::POT_MULTIPOS_SWITCH)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
RawSwitch rs(type, i + rawIdxAdj);
|
||||
QStandardItem * modelItem = new QStandardItem(rs.toString(board, generalSettings));
|
||||
modelItem->setData(rs.toValue(), Qt::UserRole);
|
||||
itemModel->appendRow(modelItem);
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItemModel * Helpers::getRawSwitchItemModel(const GeneralSettings * const generalSettings, SwitchContext context)
|
||||
{
|
||||
QStandardItemModel * itemModel = new QStandardItemModel();
|
||||
Boards board = Boards(getCurrentBoard());
|
||||
Board::Type btype = board.getBoardType();
|
||||
Firmware * fw = getCurrentFirmware();
|
||||
|
||||
// Descending switch direction: NOT (!) switches
|
||||
|
||||
if (context != MixesContext && context != GlobalFunctionsContext && IS_ARM(btype)) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_FLIGHT_MODE, -fw->getCapability(FlightModes), generalSettings);
|
||||
}
|
||||
if (context != GlobalFunctionsContext) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_VIRTUAL, -fw->getCapability(LogicalSwitches), generalSettings);
|
||||
}
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_ROTARY_ENCODER, -fw->getCapability(RotaryEncoders), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_TRIM, -board.getCapability(Board::NumTrimSwitches), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_MULTIPOS_POT, -(fw->getCapability(MultiposPots) * fw->getCapability(MultiposPotsPositions)), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_SWITCH, -board.getCapability(Board::SwitchPositions), generalSettings);
|
||||
|
||||
// Ascending switch direction (including zero)
|
||||
|
||||
if (context == TimersContext) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_TIMER_MODE, 5, generalSettings);
|
||||
}
|
||||
else {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_NONE, 1);
|
||||
}
|
||||
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_SWITCH, board.getCapability(Board::SwitchPositions), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_MULTIPOS_POT, fw->getCapability(MultiposPots) * fw->getCapability(MultiposPotsPositions), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_TRIM, board.getCapability(Board::NumTrimSwitches), generalSettings);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_ROTARY_ENCODER, fw->getCapability(RotaryEncoders), generalSettings);
|
||||
if (context != GlobalFunctionsContext) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_VIRTUAL, fw->getCapability(LogicalSwitches), generalSettings);
|
||||
}
|
||||
if (context != MixesContext && context != GlobalFunctionsContext && IS_ARM(btype)) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_FLIGHT_MODE, fw->getCapability(FlightModes), generalSettings);
|
||||
}
|
||||
if (context == SpecialFunctionsContext || context == GlobalFunctionsContext) {
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_ON, 1);
|
||||
addRawSwitchItems(itemModel, SWITCH_TYPE_ONE, 1);
|
||||
}
|
||||
|
||||
return itemModel;
|
||||
}
|
||||
|
||||
void Helpers::addRawSourceItems(QStandardItemModel * itemModel, const RawSourceType & type, int count, const GeneralSettings * const generalSettings,
|
||||
const ModelData * const model, const int start, const QList<int> exclude)
|
||||
{
|
||||
@@ -778,10 +700,19 @@ QPixmap makePixMap(const QImage & image)
|
||||
int version2index(const QString & version)
|
||||
{
|
||||
int result = 999;
|
||||
QStringList parts = version.split("N");
|
||||
if (parts.size() > 1)
|
||||
result = parts[1].toInt(); // nightly build
|
||||
parts = parts[0].split('.');
|
||||
QStringList parts;
|
||||
QString mainVersion = version;
|
||||
if (version.contains("RC")) {
|
||||
parts = version.split("RC");
|
||||
result = parts[1].toInt() + 900; // RC0 = 900; RC1=901,..
|
||||
mainVersion = parts[0];
|
||||
}
|
||||
else if (version.contains("N")) {
|
||||
parts = version.split("N");
|
||||
result = parts[1].toInt(); // nightly build up to 899
|
||||
mainVersion = parts[0];
|
||||
}
|
||||
parts = mainVersion.split('.');
|
||||
if (parts.size() > 2)
|
||||
result += 1000 * parts[2].toInt();
|
||||
if (parts.size() > 1)
|
||||
@@ -803,9 +734,12 @@ const QString index2version(int index)
|
||||
int minor = index % 100;
|
||||
int major = index / 100;
|
||||
result = templt.arg(major).arg(minor).arg(revision);
|
||||
if (nightly > 0 && nightly < 999) {
|
||||
if (nightly > 0 && nightly < 900) {
|
||||
result += "N" + QString::number(nightly);
|
||||
}
|
||||
else if (nightly >= 900 && nightly < 1000) {
|
||||
result += "RC" + QString::number(nightly-900);
|
||||
}
|
||||
}
|
||||
else if (index >= 19900) {
|
||||
int revision = index % 100;
|
||||
|
||||
@@ -129,18 +129,6 @@ class CurveGroup : public QObject {
|
||||
|
||||
namespace Helpers
|
||||
{
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
SpecialFunctionsContext,
|
||||
GlobalFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
void addRawSwitchItems(QStandardItemModel * itemModel, const RawSwitchType & type, int count, const GeneralSettings * const generalSettings = NULL);
|
||||
QStandardItemModel * getRawSwitchItemModel(const GeneralSettings * const generalSettings = NULL, SwitchContext context = LogicalSwitchesContext);
|
||||
|
||||
void addRawSourceItems(QStandardItemModel * itemModel, const RawSourceType & type, int count, const GeneralSettings * const generalSettings = NULL,
|
||||
const ModelData * const model = NULL, const int start = 0, const QList<int> exclude = QList<int>());
|
||||
QStandardItemModel * getRawSourceItemModel(const GeneralSettings * const generalSettings = NULL, const ModelData * const model = NULL, unsigned int flags = 0);
|
||||
|
||||
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 965 B |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -100,6 +100,8 @@ LogsDialog::LogsDialog(QWidget *parent) :
|
||||
ui->mapsButton->hide();
|
||||
}
|
||||
|
||||
ui->SaveSession_PB->setEnabled(false);
|
||||
|
||||
// connect slot that ties some axis selections together (especially opposite axes):
|
||||
connect(ui->customPlot, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
|
||||
// connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
|
||||
@@ -116,6 +118,7 @@ LogsDialog::LogsDialog(QWidget *parent) :
|
||||
connect(ui->FieldsTW, SIGNAL(itemSelectionChanged()), this, SLOT(plotLogs()));
|
||||
connect(ui->logTable, SIGNAL(itemSelectionChanged()), this, SLOT(plotLogs()));
|
||||
connect(ui->Reset_PB, SIGNAL(clicked()), this, SLOT(plotLogs()));
|
||||
connect(ui->SaveSession_PB, SIGNAL(clicked()), this, SLOT(on_saveSession_BT_clicked()));
|
||||
}
|
||||
|
||||
LogsDialog::~LogsDialog()
|
||||
@@ -610,6 +613,48 @@ void LogsDialog::on_fileOpen_BT_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void LogsDialog::on_saveSession_BT_clicked()
|
||||
{
|
||||
int index = ui->sessions_CB->currentIndex();
|
||||
// ignore index 0 is its all sessions combined
|
||||
if(index > 0) {
|
||||
int n = csvlog.count();
|
||||
QList<QStringList> sessionCsvLog;
|
||||
// add CSV headers from first row of source file
|
||||
sessionCsvLog.push_back(csvlog[0]);
|
||||
// find session breaks
|
||||
int currentSession = 0;
|
||||
QDateTime lastvalue;
|
||||
for (int i = 1; i < n; i++) {
|
||||
QDateTime tmp = getRecordTimeStamp(i);
|
||||
if (!lastvalue.isValid() || lastvalue.secsTo(tmp) > 60) {
|
||||
currentSession++;
|
||||
}
|
||||
lastvalue = tmp;
|
||||
if(currentSession == index) {
|
||||
// add records to filtered list
|
||||
sessionCsvLog.push_back(csvlog[i]);
|
||||
}
|
||||
else if (currentSession > index) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// save the filtered records to a new file
|
||||
QString newFilename = logFilename;
|
||||
newFilename.append(QString("-Session%1.csv").arg(index));
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Save log", newFilename, "CSV files (.csv);", 0, 0); // getting the filename (full path)
|
||||
QFile data(filename);
|
||||
if(data.open(QFile::WriteOnly |QFile::Truncate)) {
|
||||
QTextStream output(&data);
|
||||
int numRecords = sessionCsvLog.count();
|
||||
for(int i = 0; i < numRecords; i++){
|
||||
output << sessionCsvLog[i].join(",") << '\n';
|
||||
}
|
||||
}
|
||||
sessionCsvLog.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool LogsDialog::cvsFileParse()
|
||||
{
|
||||
QFile file(ui->FileName_LE->text());
|
||||
@@ -697,6 +742,7 @@ QString LogsDialog::generateDuration(const QDateTime & start, const QDateTime &
|
||||
void LogsDialog::setFlightSessions()
|
||||
{
|
||||
ui->sessions_CB->clear();
|
||||
ui->SaveSession_PB->setEnabled(false);
|
||||
|
||||
int n = csvlog.count();
|
||||
// qDebug() << "records" << n;
|
||||
@@ -756,6 +802,11 @@ void LogsDialog::on_sessions_CB_currentIndexChanged(int index)
|
||||
|
||||
QItemSelection selection(topLeft, bottomRight);
|
||||
ui->logTable->selectionModel()->select(selection, QItemSelectionModel::Select);
|
||||
|
||||
ui->SaveSession_PB->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
ui->SaveSession_PB->setEnabled(false);
|
||||
}
|
||||
|
||||
plotLock = false;
|
||||
|
||||
@@ -78,6 +78,7 @@ private slots:
|
||||
void removeAllGraphs();
|
||||
void plotLogs();
|
||||
void on_fileOpen_BT_clicked();
|
||||
void on_saveSession_BT_clicked();
|
||||
void on_sessions_CB_currentIndexChanged(int index);
|
||||
void on_mapsButton_clicked();
|
||||
void yAxisChangeRanges(QCPRange range);
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveSession_PB">
|
||||
<property name="text">
|
||||
<string>Save session CSV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include <QDesktopServices>
|
||||
|
||||
#define OPENTX_DOWNLOADS_PAGE_URL "http://www.open-tx.org/downloads"
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/companion"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -69,12 +68,16 @@
|
||||
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
|
||||
#else
|
||||
#define COMPANION_STAMP "companion-linux.stamp"
|
||||
#define COMPANION_INSTALLER "" // no automatated updates for linux
|
||||
#define COMPANION_INSTALLER "" // no automated updates for linux
|
||||
#define COMPANION_FILEMASK "*.*"
|
||||
#define COMPANION_INSTALL_QUESTION tr("Would you like to launch the installer?")
|
||||
#endif
|
||||
|
||||
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/nightlies/companion"
|
||||
const char * const OPENTX_COMPANION_DOWNLOAD_URL[] = {
|
||||
"https://downloads.open-tx.org/2.2/release/companion",
|
||||
"https://downloads.open-tx.org/2.2/rc/companion",
|
||||
"https://downloads.open-tx.org/2.2/nightlies/companion"
|
||||
};
|
||||
|
||||
MainWindow::MainWindow():
|
||||
downloadDialog_forWait(NULL),
|
||||
@@ -241,11 +244,7 @@ void MainWindow::dowloadLastFirmwareUpdate()
|
||||
|
||||
QString MainWindow::getCompanionUpdateBaseUrl()
|
||||
{
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
return g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS;
|
||||
#else
|
||||
return OPENTX_COMPANION_DOWNLOADS;
|
||||
#endif
|
||||
return OPENTX_COMPANION_DOWNLOAD_URL[g.boundedOpenTxBranch()];
|
||||
}
|
||||
|
||||
void MainWindow::checkForUpdates()
|
||||
@@ -562,6 +561,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
g.mainWinGeo(saveGeometry());
|
||||
g.mainWinState(saveState());
|
||||
g.tabbedMdi(actTabbedWindows->isChecked());
|
||||
QApplication::closeAllWindows();
|
||||
mdiArea->closeAllSubWindows();
|
||||
if (mdiArea->currentSubWindow()) {
|
||||
event->ignore();
|
||||
|
||||
@@ -1414,11 +1414,11 @@ void MdiChild::setCurrentFile(const QString & fileName)
|
||||
isUntitled = false;
|
||||
setWindowModified(false);
|
||||
updateTitle();
|
||||
int MaxRecentFiles = g.historySize();
|
||||
|
||||
QStringList files = g.recentFiles();
|
||||
files.removeAll(fileName);
|
||||
files.prepend(fileName);
|
||||
while (files.size() > MaxRecentFiles)
|
||||
files.removeAll(curFile);
|
||||
files.prepend(curFile);
|
||||
while (files.size() > g.historySize())
|
||||
files.removeLast();
|
||||
g.recentFiles(files);
|
||||
}
|
||||
|
||||
@@ -12,9 +12,11 @@ set(modeledit_NAMES
|
||||
telemetry
|
||||
expodialog
|
||||
mixerdialog
|
||||
checklistdialog
|
||||
)
|
||||
|
||||
set(modeledit_SRCS
|
||||
switchitemmodel.cpp
|
||||
flightmodes.cpp
|
||||
inputs.cpp
|
||||
mixes.cpp
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "checklistdialog.h"
|
||||
#include "ui_checklistdialog.h"
|
||||
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
extern AppData g;
|
||||
|
||||
ChecklistDialog::ChecklistDialog(QWidget *parent, const QString modelName):
|
||||
QDialog(parent),
|
||||
ui(new Ui::ChecklistDialog),
|
||||
mDirty(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("edit.png"));
|
||||
|
||||
mChecklistFolder = g.profile[g.id()].sdPath() + "/MODELS/";
|
||||
QString name = modelName;
|
||||
name.replace(" ", "_");
|
||||
mModelChecklist = QDir::toNativeSeparators(mChecklistFolder + name + ".txt");
|
||||
ui->file->setText("File: " + mModelChecklist);
|
||||
ui->pteCheck->setPlainText(readFile(mModelChecklist,QFile::exists(mModelChecklist)));
|
||||
|
||||
connect(ui->pteCheck, SIGNAL(textChanged()), this, SLOT(changed()));
|
||||
connect(ui->pbImport, SIGNAL(clicked()), this, SLOT(import()));
|
||||
connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
connect(ui->pbOK, SIGNAL(clicked()), this, SLOT(update()));
|
||||
}
|
||||
|
||||
ChecklistDialog::~ChecklistDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ChecklistDialog::changed()
|
||||
{
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
void ChecklistDialog::import()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Open Checklist"), mChecklistFolder, tr("Checklist Files (*.txt)"));
|
||||
if (!filename.isNull())
|
||||
ui->pteCheck->setPlainText(readFile(filename,true));
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
void ChecklistDialog::update()
|
||||
{
|
||||
if (mDirty) {
|
||||
QFile file(mModelChecklist);
|
||||
if (!file.open(QFile::WriteOnly | QFile::Text)) {
|
||||
QMessageBox::critical(this, tr("Model Checklist"), tr("Cannot open file for writing %1:\n%2.").arg(mModelChecklist, file.errorString()));
|
||||
}
|
||||
else {
|
||||
QTextStream out(&file);
|
||||
if (out.status()==QTextStream::Ok) {
|
||||
out << ui->pteCheck->toPlainText();
|
||||
if (!(out.status()==QTextStream::Ok)) {
|
||||
QMessageBox::critical(this, tr("Model Checklist"), tr("Cannot write to file %1:\n%2.").arg(mModelChecklist, file.errorString()));
|
||||
if (!file.flush()) {
|
||||
QMessageBox::critical(this, tr("Model Checklist"), tr("Cannot write file %1:\n%2.").arg(mModelChecklist, file.errorString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
emit accept();
|
||||
}
|
||||
|
||||
QString ChecklistDialog::readFile(const QString & filepath, const bool exists)
|
||||
{
|
||||
QString data = "";
|
||||
if (!filepath.isNull()) {
|
||||
QFile file(filepath);
|
||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
if (exists) {
|
||||
QMessageBox::critical(this, tr("Model Checklist"), tr("Cannot open file %1:\n%2.").arg(QDir::toNativeSeparators(filepath), file.errorString()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
QTextStream in(&file);
|
||||
if (in.status()==QTextStream::Ok) {
|
||||
data = in.readAll();
|
||||
if (!(in.status()==QTextStream::Ok)) {
|
||||
QMessageBox::critical(this, tr("Model Checklist"), tr("Cannot read file %1:\n%2.").arg(QDir::toNativeSeparators(filepath), file.errorString()));
|
||||
data = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _CHECKLISTDIALOG_H_
|
||||
#define _CHECKLISTDIALOG_H_
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
namespace Ui {
|
||||
class ChecklistDialog;
|
||||
}
|
||||
|
||||
class ChecklistDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChecklistDialog(QWidget *parent, const QString modelName);
|
||||
~ChecklistDialog();
|
||||
|
||||
private slots:
|
||||
void import();
|
||||
void update();
|
||||
void changed();
|
||||
|
||||
private:
|
||||
Ui::ChecklistDialog *ui;
|
||||
QString mModelChecklist;
|
||||
QString mChecklistFolder;
|
||||
QString readFile(const QString & filepath, const bool exists);
|
||||
bool mDirty;
|
||||
};
|
||||
|
||||
#endif // _CHECKLISTDIALOG_H_
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChecklistDialog</class>
|
||||
<widget class="QDialog" name="ChecklistDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>630</width>
|
||||
<height>373</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit Checklist</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPlainTextEdit" name="pteCheck">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbImport">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Import...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbOK">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Please note, the maximum width displayable is radio model limited. Also, renaming the model will break the link to this checklist file.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="file">
|
||||
<property name="text">
|
||||
<string>File: unknown</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>pteCheck</tabstop>
|
||||
<tabstop>pbOK</tabstop>
|
||||
<tabstop>pbCancel</tabstop>
|
||||
<tabstop>pbImport</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -143,8 +143,10 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
|
||||
palette.setBrush(QPalette::Active, QPalette::ButtonText, QBrush(Qt::white));
|
||||
#ifdef __APPLE__
|
||||
edit->setStyleSheet(QString("color: %1;").arg(colors[i].name()));
|
||||
#else
|
||||
#elif defined WIN32 || !defined __GNUC__
|
||||
edit->setStyleSheet(QString("background-color: %1; color: white;").arg(colors[i].name()));
|
||||
#else
|
||||
edit->setStyleSheet(QString("background-color: %1; color: white; padding: 2px 3px; border-style: outset; border-width: 1px; border-radius: 2px; border-color: inherit;").arg(colors[i].name()));
|
||||
#endif
|
||||
edit->setPalette(palette);
|
||||
edit->setText(tr("Curve %1").arg(i+1));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "customfunctions.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
|
||||
@@ -73,8 +74,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
lock = true;
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
|
||||
rawSwitchItemModel = Helpers::getRawSwitchItemModel(&generalSettings, model ? Helpers::SpecialFunctionsContext : Helpers::GlobalFunctionsContext);
|
||||
rawSwitchItemModel->setParent(this);
|
||||
rawSwitchItemModel = new RawSwitchFilterItemModel(&generalSettings, model, model ? SpecialFunctionsContext : GlobalFunctionsContext);
|
||||
rawSrcInputsItemModel = Helpers::getRawSourceItemModel(&generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||
rawSrcInputsItemModel->setParent(this);
|
||||
rawSrcAllItemModel = Helpers::getRawSourceItemModel(&generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT|POPULATE_SCRIPT_OUTPUTS);
|
||||
@@ -411,23 +411,28 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
|
||||
}
|
||||
else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) {
|
||||
int gvidx = func - FuncAdjustGV1;
|
||||
if (modified)
|
||||
cfn.adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE;
|
||||
if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) {
|
||||
if (modified)
|
||||
cfn.param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
cfn.param = fswtchParam[i]->value() * model->gvarData[gvidx].multiplierSet();
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
fswtchParam[i]->setMinimum(-500);
|
||||
fswtchParam[i]->setMaximum(500);
|
||||
fswtchParam[i]->setDecimals(model->gvarData[gvidx].prec);
|
||||
fswtchParam[i]->setSingleStep(model->gvarData[gvidx].multiplierGet());
|
||||
fswtchParam[i]->setSuffix(model->gvarData[gvidx].unitToString());
|
||||
fswtchParam[i]->setMinimum(model->gvarData[gvidx].getMinPrec());
|
||||
fswtchParam[i]->setMaximum(model->gvarData[gvidx].getMaxPrec());
|
||||
fswtchParam[i]->setValue(cfn.param * model->gvarData[gvidx].multiplierGet());
|
||||
}
|
||||
else {
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(-125);
|
||||
fswtchParam[i]->setMaximum(125);
|
||||
fswtchParam[i]->setValue(cfn.param);
|
||||
}
|
||||
fswtchParam[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
|
||||
}
|
||||
else {
|
||||
@@ -584,6 +589,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
|
||||
void CustomFunctionsPanel::update()
|
||||
{
|
||||
rawSwitchItemModel->update();
|
||||
|
||||
lock = true;
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
@@ -650,10 +657,10 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-fsw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(fswCopy()));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(fswCut()));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(fswPaste()))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(fswDelete()));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
@@ -668,16 +675,14 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
|
||||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
|
||||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
|
||||
((i==FuncSetTimer1 || i==FuncSetTimer2) && !IS_ARM(firmware->getBoard())) ||
|
||||
((i==FuncSetTimer3) && firmware->getCapability(Timers) < 3) ||
|
||||
((i==FuncScreenshot) && IS_HORUS(firmware->getBoard())) ||
|
||||
((i==FuncScreenshot) && !IS_TARANIS(firmware->getBoard())) ||
|
||||
((i>=FuncRangeCheckInternalModule && i<=FuncBindExternalModule) && (!model || !firmware->getCapability(DangerousFunctions))) ||
|
||||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
|
||||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && (!model || !firmware->getCapability(Gvars)))
|
||||
) {
|
||||
// skipped
|
||||
// b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
|
||||
// QModelIndex index = b->model()->index(i, 0);
|
||||
// QVariant v(0);
|
||||
// b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(model), i);
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#ifndef _CUSTOMFUNCTIONS_H_
|
||||
#define _CUSTOMFUNCTIONS_H_
|
||||
|
||||
#include <QMediaPlayer>
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
#include <QMediaPlayer>
|
||||
|
||||
class RawSwitchFilterItemModel;
|
||||
|
||||
class RepeatComboBox: public QComboBox
|
||||
{
|
||||
@@ -74,7 +76,7 @@ class CustomFunctionsPanel : public GenericPanel
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
QStandardItemModel * rawSwitchItemModel;
|
||||
RawSwitchFilterItemModel * rawSwitchItemModel;
|
||||
QStandardItemModel * rawSrcInputsItemModel;
|
||||
QStandardItemModel * rawSrcAllItemModel;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "expodialog.h"
|
||||
#include "ui_expodialog.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
|
||||
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings,
|
||||
@@ -45,7 +46,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
setWindowTitle(tr("Edit %1").arg(RawSource(srcType, ed->chn).toString(&model, &generalSettings)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100);
|
||||
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
|
||||
}
|
||||
@@ -61,7 +62,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, model,
|
||||
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||
|
||||
ui->switchesCB->setModel(Helpers::getRawSwitchItemModel(&generalSettings, Helpers::MixesContext));
|
||||
ui->switchesCB->setModel(new RawSwitchFilterItemModel(&generalSettings, &model, MixesContext));
|
||||
ui->switchesCB->setCurrentIndex(ui->switchesCB->findData(ed->swtch.toValue()));
|
||||
|
||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
|
||||
#include "flightmodes.h"
|
||||
#include "ui_flightmode.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
#include "customdebug.h"
|
||||
|
||||
FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
@@ -28,7 +30,8 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
phaseIdx(phaseIdx),
|
||||
phase(model.flightModeData[phaseIdx]),
|
||||
reCount(firmware->getCapability(RotaryEncoders)),
|
||||
gvCount(firmware->getCapability(Gvars))
|
||||
gvCount(firmware->getCapability(Gvars)),
|
||||
rawSwitchItemModel(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -50,7 +53,8 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
|
||||
// Phase switch
|
||||
if (phaseIdx > 0) {
|
||||
ui->swtch->setModel(Helpers::getRawSwitchItemModel(&generalSettings, Helpers::MixesContext));
|
||||
rawSwitchItemModel = new RawSwitchFilterItemModel(&generalSettings, &model, MixesContext);
|
||||
ui->swtch->setModel(rawSwitchItemModel);
|
||||
ui->swtch->setCurrentIndex(ui->swtch->findData(phase.swtch.toValue()));
|
||||
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
||||
}
|
||||
@@ -153,26 +157,56 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
// GVars
|
||||
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes) || phaseIdx == 0) ) {
|
||||
QGridLayout *gvLayout = new QGridLayout(ui->gvGB);
|
||||
|
||||
|
||||
// Column headers
|
||||
int headerCol = 1;
|
||||
QLabel *nameLabel = new QLabel(ui->gvGB);
|
||||
nameLabel->setText(tr("Name"));
|
||||
gvLayout->addWidget(nameLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
if (firmware->getCapability(GvarsName)) {
|
||||
QLabel *nameLabel = new QLabel(ui->gvGB);
|
||||
nameLabel->setText(tr("Name"));
|
||||
gvLayout->addWidget(nameLabel, 0, headerCol++, 1, 1);
|
||||
}
|
||||
|
||||
if (phaseIdx > 0) {
|
||||
QLabel *sourceLabel = new QLabel(ui->gvGB);
|
||||
sourceLabel->setText(tr("Value source"));
|
||||
gvLayout->addWidget(sourceLabel, 0, headerCol++, 1, 1);
|
||||
}
|
||||
|
||||
QLabel *valueLabel = new QLabel(ui->gvGB);
|
||||
valueLabel->setText(tr("Value"));
|
||||
gvLayout->addWidget(valueLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
|
||||
if (IS_HORUS_OR_TARANIS(board) && phaseIdx == 0) {
|
||||
QLabel *unitLabel = new QLabel(ui->gvGB);
|
||||
unitLabel->setText(tr("Unit"));
|
||||
gvLayout->addWidget(unitLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
QLabel *precLabel = new QLabel(ui->gvGB);
|
||||
precLabel->setText(tr("Prec"));
|
||||
gvLayout->addWidget(precLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
QLabel *minLabel = new QLabel(ui->gvGB);
|
||||
minLabel->setText(tr("Min"));
|
||||
gvLayout->addWidget(minLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
QLabel *maxLabel = new QLabel(ui->gvGB);
|
||||
maxLabel->setText(tr("Max"));
|
||||
gvLayout->addWidget(maxLabel, 0, headerCol++, 1, 1);
|
||||
|
||||
QLabel *popupLabel = new QLabel(ui->gvGB);
|
||||
popupLabel->setText(tr("Popup enabled"));
|
||||
gvLayout->addWidget(popupLabel, 0, headerCol++, 1, 1);
|
||||
}
|
||||
|
||||
for (int i=0; i<gvCount; i++) {
|
||||
int col = 0;
|
||||
// GVar label
|
||||
QLabel *label = new QLabel(ui->gvGB);
|
||||
label->setText(tr("GVAR%1").arg(i+1));
|
||||
label->setProperty("index", i);
|
||||
label->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(label, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(gvLabel_customContextMenuRequested(const QPoint &)));
|
||||
gvLayout->addWidget(label, i+1, col++, 1, 1);
|
||||
// GVar name
|
||||
int nameLen = firmware->getCapability(GvarsName);
|
||||
@@ -188,25 +222,49 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
gvUse[i] = new QComboBox(ui->gvGB);
|
||||
gvUse[i]->setProperty("index", i);
|
||||
Helpers::populateGvarUseCB(gvUse[i], phaseIdx);
|
||||
if (phase.gvars[i] > 1024) {
|
||||
gvUse[i]->setCurrentIndex(phase.gvars[i] - 1024);
|
||||
if (phase.gvars[i] > GVAR_MAX_VALUE) {
|
||||
gvUse[i]->setCurrentIndex(phase.gvars[i] - GVAR_MAX_VALUE);
|
||||
}
|
||||
connect(gvUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUse_currentIndexChanged(int)));
|
||||
gvLayout->addWidget(gvUse[i], i+1, col++, 1, 1);
|
||||
}
|
||||
// GVar value
|
||||
gvValues[i] = new QSpinBox(ui->gvGB);
|
||||
gvValues[i] = new QDoubleSpinBox(ui->gvGB);
|
||||
gvValues[i]->setProperty("index", i);
|
||||
connect(gvValues[i], SIGNAL(editingFinished()), this, SLOT(phaseGVValue_editingFinished()));
|
||||
gvValues[i]->setMinimum(-1024);
|
||||
gvValues[i]->setMaximum(1024);
|
||||
gvLayout->addWidget(gvValues[i], i+1, col++, 1, 1);
|
||||
|
||||
// Popups
|
||||
if (IS_TARANIS(board) && phaseIdx == 0) {
|
||||
if (IS_HORUS_OR_TARANIS(board) && phaseIdx == 0) {
|
||||
// GVar unit
|
||||
gvUnit[i] = new QComboBox(ui->gvGB);
|
||||
gvUnit[i]->setProperty("index", i);
|
||||
populateGvarUnitCB(gvUnit[i]);
|
||||
connect(gvUnit[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVUnit_currentIndexChanged(int)));
|
||||
gvLayout->addWidget(gvUnit[i], i+1, col++, 1, 1);
|
||||
|
||||
// GVar precision
|
||||
gvPrec[i] = new QComboBox(ui->gvGB);
|
||||
gvPrec[i]->setProperty("index", i);
|
||||
populateGvarPrecCB(gvPrec[i]);
|
||||
connect(gvPrec[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseGVPrec_currentIndexChanged(int)));
|
||||
gvLayout->addWidget(gvPrec[i], i+1, col++, 1, 1);
|
||||
|
||||
// GVar min
|
||||
gvMin[i] = new QDoubleSpinBox(ui->gvGB);
|
||||
gvMin[i]->setProperty("index", i);
|
||||
connect(gvMin[i], SIGNAL(editingFinished()), this, SLOT(phaseGVMin_editingFinished()));
|
||||
gvLayout->addWidget(gvMin[i], i+1, col++, 1, 1);
|
||||
|
||||
// GVar max
|
||||
gvMax[i] = new QDoubleSpinBox(ui->gvGB);
|
||||
gvMax[i]->setProperty("index", i);
|
||||
connect(gvMax[i], SIGNAL(editingFinished()), this, SLOT(phaseGVMax_editingFinished()));
|
||||
gvLayout->addWidget(gvMax[i], i+1, col++, 1, 1);
|
||||
|
||||
// Popups
|
||||
gvPopups[i] = new QCheckBox(ui->gvGB);
|
||||
gvPopups[i]->setProperty("index", i);
|
||||
gvPopups[i]->setText(tr("Popup enabled"));
|
||||
//gvPopups[i]->setText(tr("Popup enabled"));
|
||||
connect(gvPopups[i], SIGNAL(toggled(bool)), this, SLOT(phaseGVPopupToggled(bool)));
|
||||
gvLayout->addWidget(gvPopups[i], i+1, col++, 1, 1);
|
||||
}
|
||||
@@ -214,6 +272,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
}
|
||||
else {
|
||||
ui->gvGB->hide();
|
||||
gvCount = 0;
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
@@ -228,6 +287,10 @@ FlightModePanel::~FlightModePanel()
|
||||
|
||||
void FlightModePanel::update()
|
||||
{
|
||||
if (rawSwitchItemModel) {
|
||||
rawSwitchItemModel->update();
|
||||
}
|
||||
|
||||
ui->name->setText(phase.name);
|
||||
|
||||
int scale = firmware->getCapability(SlowScale);
|
||||
@@ -247,17 +310,8 @@ void FlightModePanel::update()
|
||||
trimUpdate(i);
|
||||
}
|
||||
|
||||
if (ui->gvGB->isVisible()) {
|
||||
for (int i=0; i<gvCount; i++) {
|
||||
if (firmware->getCapability(GvarsName) > 0) {
|
||||
gvNames[i]->setText(model->gvars_names[i]);
|
||||
}
|
||||
gvValues[i]->setDisabled(model->isGVarLinked(phaseIdx, i));
|
||||
gvValues[i]->setValue(model->getGVarFieldValue(phaseIdx, i));
|
||||
if (IS_TARANIS(getCurrentBoard()) && phaseIdx == 0) {
|
||||
gvPopups[i]->setChecked(model->gvars_popups[i]);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<gvCount; i++) {
|
||||
updateGVar(i);
|
||||
}
|
||||
|
||||
for (int i=0; i<reCount; i++) {
|
||||
@@ -274,6 +328,49 @@ void FlightModePanel::update()
|
||||
reValues[i]->setValue(phasere->rotaryEncoders[i]);
|
||||
}
|
||||
}
|
||||
void FlightModePanel::updateGVar(int index)
|
||||
{
|
||||
lock = true;
|
||||
if (firmware->getCapability(GvarsName) > 0) {
|
||||
gvNames[index]->setText(model->gvarData[index].name);
|
||||
}
|
||||
gvValues[index]->setDisabled(model->isGVarLinked(phaseIdx, index));
|
||||
setGVSB(gvValues[index], model->gvarData[index].getMin(), model->gvarData[index].getMax(), model->getGVarFieldValue(phaseIdx, index));
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard()) && phaseIdx == 0) {
|
||||
gvUnit[index]->setCurrentIndex(model->gvarData[index].unit);
|
||||
gvPrec[index]->setCurrentIndex(model->gvarData[index].prec);
|
||||
setGVSB(gvMin[index], GVAR_MIN_VALUE, model->gvarData[index].getMax(), model->gvarData[index].getMin());
|
||||
setGVSB(gvMax[index], model->gvarData[index].getMin(), GVAR_MAX_VALUE, model->gvarData[index].getMax());
|
||||
gvPopups[index]->setChecked(model->gvarData[index].popup);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void FlightModePanel::setGVSB(QDoubleSpinBox * sb, int min, int max, int val)
|
||||
{
|
||||
int idx = sb->property("index").toInt();
|
||||
float mul = model->gvarData[idx].multiplierGet();
|
||||
sb->setDecimals(model->gvarData[idx].prec);
|
||||
sb->setSingleStep(mul);
|
||||
sb->setSuffix(model->gvarData[idx].unitToString());
|
||||
sb->setMinimum(min * mul);
|
||||
sb->setMaximum(max * mul);
|
||||
sb->setValue(val * mul);
|
||||
}
|
||||
|
||||
void FlightModePanel::populateGvarUnitCB(QComboBox * cb)
|
||||
{
|
||||
cb->clear();
|
||||
cb->addItem(QObject::tr(""));
|
||||
cb->addItem(QObject::tr("%"));
|
||||
}
|
||||
|
||||
void FlightModePanel::populateGvarPrecCB(QComboBox * cb)
|
||||
{
|
||||
cb->clear();
|
||||
cb->addItem(QObject::tr("0._"));
|
||||
cb->addItem(QObject::tr("0.0"));
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseName_editingFinished()
|
||||
{
|
||||
@@ -341,9 +438,9 @@ void FlightModePanel::trimUpdate(unsigned int trim)
|
||||
void FlightModePanel::phaseGVValue_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender());
|
||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int gvar = spinBox->property("index").toInt();
|
||||
phase.gvars[gvar] = spinBox->value();
|
||||
phase.gvars[gvar] = spinBox->value() * model->gvarData[gvar].multiplierSet();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -353,8 +450,8 @@ void FlightModePanel::GVName_editingFinished()
|
||||
if (!lock) {
|
||||
QLineEdit *lineedit = qobject_cast<QLineEdit*>(sender());
|
||||
int gvar = lineedit->property("index").toInt();
|
||||
memset(&model->gvars_names[gvar], 0, sizeof(model->gvars_names[gvar]));
|
||||
strcpy(model->gvars_names[gvar], lineedit->text().toLatin1());
|
||||
memset(&model->gvarData[gvar].name, 0, sizeof(model->gvarData[gvar].name));
|
||||
strcpy(model->gvarData[gvar].name, lineedit->text().toLatin1());
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -369,28 +466,98 @@ void FlightModePanel::phaseGVUse_currentIndexChanged(int index)
|
||||
phase.gvars[gvar] = 0;
|
||||
}
|
||||
else {
|
||||
phase.gvars[gvar] = 1024 + index;
|
||||
phase.gvars[gvar] = GVAR_MAX_VALUE + index;
|
||||
}
|
||||
update();
|
||||
updateGVar(gvar);
|
||||
emit modified();
|
||||
lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseGVUnit_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int gvar = comboBox->property("index").toInt();
|
||||
model->gvarData[gvar].unit = index;
|
||||
emit modified();
|
||||
updateGVar(gvar);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseGVPrec_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int gvar = comboBox->property("index").toInt();
|
||||
model->gvarData[gvar].prec = index;
|
||||
emit modified();
|
||||
updateGVar(gvar);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseGVMin_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int gvar = spinBox->property("index").toInt();
|
||||
model->gvarData[gvar].setMin(spinBox->value());
|
||||
if (!model->isGVarLinked(phaseIdx, gvar)) {
|
||||
if (model->getGVarFieldValuePrec(phaseIdx, gvar) < spinBox->value()) {
|
||||
phase.gvars[gvar] = model->gvarData[gvar].getMin();
|
||||
}
|
||||
}
|
||||
for (int x=1; x<firmware->getCapability(FlightModes); x++) {
|
||||
if (!model->isGVarLinked(x, gvar)) {
|
||||
if (model->flightModeData[x].gvars[gvar] < model->gvarData[gvar].getMin()) {
|
||||
model->flightModeData[x].gvars[gvar] = model->gvarData[gvar].getMin();
|
||||
}
|
||||
}
|
||||
}
|
||||
emit modified();
|
||||
updateGVar(gvar);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseGVMax_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int gvar = spinBox->property("index").toInt();
|
||||
model->gvarData[gvar].setMax(spinBox->value());
|
||||
if (!model->isGVarLinked(phaseIdx, gvar)) {
|
||||
if (model->getGVarFieldValuePrec(phaseIdx, gvar) > spinBox->value()) {
|
||||
phase.gvars[gvar] = model->gvarData[gvar].getMax();
|
||||
}
|
||||
}
|
||||
for (int x=1; x<firmware->getCapability(FlightModes); x++) {
|
||||
if (!model->isGVarLinked(x, gvar)) {
|
||||
if (model->flightModeData[x].gvars[gvar] > model->gvarData[gvar].getMax()) {
|
||||
model->flightModeData[x].gvars[gvar] = model->gvarData[gvar].getMax();
|
||||
}
|
||||
}
|
||||
}
|
||||
emit modified();
|
||||
updateGVar(gvar);
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseGVPopupToggled(bool checked)
|
||||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
int gvar = cb->property("index").toInt();
|
||||
model->gvars_popups[gvar] = checked;
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
int gvar = cb->property("index").toInt();
|
||||
model->gvarData[gvar].popup = checked;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::phaseREValue_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
QSpinBox *spinBox = qobject_cast<QSpinBox*>(sender());
|
||||
int gvar = spinBox->property("index").toInt();
|
||||
phase.rotaryEncoders[gvar] = spinBox->value();
|
||||
int re = spinBox->property("index").toInt();
|
||||
phase.rotaryEncoders[re] = spinBox->value();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -474,11 +641,11 @@ void FlightModePanel::phaseTrimSlider_valueChanged()
|
||||
|
||||
void FlightModePanel::name_customContextMenuRequested(const QPoint & pos)
|
||||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Clear"),this,SLOT(fmClear()),tr("Clear"));
|
||||
contextMenu.exec(globalPos);
|
||||
QLabel *label = (QLabel *)sender();
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Clear"),this,SLOT(fmClear()),tr("Clear"));
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void FlightModePanel::fmClear()
|
||||
@@ -489,8 +656,7 @@ void FlightModePanel::fmClear()
|
||||
if (phaseIdx == 0) {
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
for (int i=0; i < gvCount; ++i) {
|
||||
memset(&model->gvars_names[i], 0, sizeof(model->gvars_names[i]));
|
||||
model->gvars_popups[i] = 0;
|
||||
model->gvarData[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,11 +667,11 @@ void FlightModePanel::fmClear()
|
||||
pswtch->setCurrentIndex(pswtch->findText(item.toString()));
|
||||
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes))) {
|
||||
for (int i=0; i<gvCount; i++) {
|
||||
gvUse[i]->setCurrentIndex((phase.gvars[i] > 1024 ? (phase.gvars[i] - 1024) : 0));
|
||||
gvUse[i]->setCurrentIndex((phase.gvars[i] > GVAR_MAX_VALUE ? (phase.gvars[i] - GVAR_MAX_VALUE) : 0));
|
||||
}
|
||||
}
|
||||
for (int i=0; i<reCount; i++) {
|
||||
reUse[i]->setCurrentIndex((phase.rotaryEncoders[i] > 1024 ? (phase.rotaryEncoders[i] - 1024) : 0));
|
||||
reUse[i]->setCurrentIndex((phase.rotaryEncoders[i] > GVAR_MAX_VALUE ? (phase.rotaryEncoders[i] - GVAR_MAX_VALUE) : 0));
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
@@ -515,6 +681,36 @@ void FlightModePanel::fmClear()
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::gvLabel_customContextMenuRequested(const QPoint & pos)
|
||||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
gvIdx = label->property("index").toInt();
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Clear"),this,SLOT(gvClear()),tr("Clear"));
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void FlightModePanel::gvClear()
|
||||
{
|
||||
if (phaseIdx == 0) {
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
model->gvarData[gvIdx].clear();
|
||||
phase.gvars[gvIdx] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lock = true;
|
||||
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes))) {
|
||||
phase.gvars[gvIdx] = GVAR_MAX_VALUE + 1;
|
||||
gvUse[gvIdx]->setCurrentIndex(1);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
@@ -524,7 +720,7 @@ FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralS
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
tabWidget = new QTabWidget(this);
|
||||
for (int i=0; i<modesCount; i++) {
|
||||
FlightModePanel *tab = new FlightModePanel(tabWidget, model, i, generalSettings, firmware);
|
||||
FlightModePanel * tab = new FlightModePanel(tabWidget, model, i, generalSettings, firmware);
|
||||
tab->setProperty("index", i);
|
||||
panels << tab;
|
||||
connect(tab, SIGNAL(modified()), this, SLOT(onPhaseModified()));
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class RawSwitchFilterItemModel;
|
||||
|
||||
namespace Ui {
|
||||
class FlightMode;
|
||||
}
|
||||
@@ -53,10 +55,16 @@ class FlightModePanel : public ModelPanel
|
||||
void phaseGVValue_editingFinished();
|
||||
void phaseGVUse_currentIndexChanged(int index);
|
||||
void phaseGVPopupToggled(bool checked);
|
||||
void phaseGVUnit_currentIndexChanged(int index);
|
||||
void phaseGVPrec_currentIndexChanged(int index);
|
||||
void phaseGVMin_editingFinished();
|
||||
void phaseGVMax_editingFinished();
|
||||
void phaseREValue_editingFinished();
|
||||
void phaseREUse_currentIndexChanged(int index);
|
||||
void name_customContextMenuRequested(const QPoint & pos);
|
||||
void fmClear();
|
||||
void gvLabel_customContextMenuRequested(const QPoint & pos);
|
||||
void gvClear();
|
||||
|
||||
private:
|
||||
Ui::FlightMode *ui;
|
||||
@@ -64,19 +72,28 @@ class FlightModePanel : public ModelPanel
|
||||
FlightModeData & phase;
|
||||
int reCount;
|
||||
int gvCount;
|
||||
int gvIdx;
|
||||
QVector<QLabel *> trimsLabel;
|
||||
QLineEdit * gvNames[CPN_MAX_GVARS];
|
||||
QSpinBox * gvValues[CPN_MAX_GVARS];
|
||||
QDoubleSpinBox * gvValues[CPN_MAX_GVARS];
|
||||
QCheckBox * gvPopups[CPN_MAX_GVARS];
|
||||
QComboBox * gvUse[CPN_MAX_GVARS];
|
||||
QComboBox * gvUnit[CPN_MAX_GVARS];
|
||||
QComboBox * gvPrec[CPN_MAX_GVARS];
|
||||
QDoubleSpinBox * gvMin[CPN_MAX_GVARS];
|
||||
QDoubleSpinBox * gvMax[CPN_MAX_GVARS];
|
||||
QSpinBox * reValues[CPN_MAX_ENCODERS];
|
||||
QComboBox * reUse[CPN_MAX_ENCODERS];
|
||||
QVector<QComboBox *> trimsUse;
|
||||
QVector<QSpinBox *> trimsValue;
|
||||
QVector<QSlider *> trimsSlider;
|
||||
RawSwitchFilterItemModel * rawSwitchItemModel;
|
||||
|
||||
void trimUpdate(unsigned int trim);
|
||||
|
||||
void updateGVar(int index);
|
||||
void setGVSB(QDoubleSpinBox * spinBox, int min, int max, int val);
|
||||
void populateGvarUnitCB(QComboBox * cb);
|
||||
void populateGvarPrecCB(QComboBox * cb);
|
||||
};
|
||||
|
||||
class FlightModesPanel : public ModelPanel
|
||||
|
||||
@@ -75,27 +75,24 @@ void InputsPanel::update()
|
||||
// i -> mixer number
|
||||
QByteArray qba;
|
||||
ExposlistWidget->clear();
|
||||
firstLine = true;
|
||||
int curDest = -1;
|
||||
|
||||
for (int i=0; i<CPN_MAX_EXPOS; i++) {
|
||||
ExpoData *md = &model->expoData[i];
|
||||
|
||||
if (md->mode==0) break;
|
||||
if (!md->mode)
|
||||
break;
|
||||
|
||||
QString str;
|
||||
|
||||
while (curDest<(int)md->chn-1) {
|
||||
while (curDest < (int)md->chn-1) {
|
||||
curDest++;
|
||||
AddInputLine(-curDest-1);
|
||||
}
|
||||
if (AddInputLine(i)) {
|
||||
curDest++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while (curDest<inputsCount-1) {
|
||||
while (curDest < inputsCount-1) {
|
||||
curDest++;
|
||||
AddInputLine(-curDest-1);
|
||||
}
|
||||
@@ -122,20 +119,17 @@ bool InputsPanel::AddInputLine(int dest)
|
||||
QString str = getInputText(dest, &new_ch);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
QByteArray qba(1, (quint8)dest);
|
||||
unsigned destId = abs(dest);
|
||||
bool hasSibs = false;
|
||||
if (dest >= 0) {
|
||||
//add input data
|
||||
ExpoData *md = &model->expoData[dest];
|
||||
qba.append((const char*)md, sizeof(ExpoData));
|
||||
destId = md->chn + 1;
|
||||
hasSibs = (dest < CPN_MAX_EXPOS && model->expoData[dest+1].chn == md->chn);
|
||||
}
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
#if MIX_ROW_HEIGHT_INCREASE > 0
|
||||
if (new_ch && !firstLine) {
|
||||
//increase size of this row
|
||||
itm->setData(GroupHeaderRole, 1);
|
||||
}
|
||||
#endif
|
||||
ExposlistWidget->addItem(itm);
|
||||
firstLine = false;
|
||||
ExposlistWidget->addItem(itm, destId, new_ch, hasSibs);
|
||||
//qDebug() << "InputsPanel::AddInputLine(): dest" << dest << "text" << str;
|
||||
return new_ch;
|
||||
}
|
||||
@@ -300,13 +294,17 @@ void InputsPanel::exposCopy()
|
||||
|
||||
void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropAction action)
|
||||
{
|
||||
int idx = ExposlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
int idx = ExposlistWidget->item(index)->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (action==Qt::CopyAction) {
|
||||
pasteExpoMimeData(data, idx);
|
||||
}
|
||||
else if (action==Qt::MoveAction) {
|
||||
QList<int> list = createExpoListFromSelected();
|
||||
exposDeleteList(list);
|
||||
foreach (const int del, list) {
|
||||
if (del < idx)
|
||||
--idx;
|
||||
}
|
||||
pasteExpoMimeData(data, idx);
|
||||
}
|
||||
}
|
||||
@@ -391,6 +389,7 @@ void InputsPanel::expoAdd()
|
||||
if (!gm_insertExpo(index))
|
||||
return;
|
||||
model->expoData[index].chn = model->expoData[index-1].chn;
|
||||
expoInserted=true;
|
||||
}
|
||||
gm_openExpo(index);
|
||||
}
|
||||
@@ -416,6 +415,8 @@ void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos)
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addActions(ExposlistWidget->actions());
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ class InputsPanel : public ModelPanel
|
||||
private:
|
||||
bool expoInserted;
|
||||
MixersListWidget *ExposlistWidget;
|
||||
bool firstLine;
|
||||
int inputsCount;
|
||||
ModelPrinter modelPrinter;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "logicalswitches.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
|
||||
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
@@ -28,8 +29,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
Stopwatch s1("LogicalSwitchesPanel");
|
||||
|
||||
int channelsMax = model.getChannelsMax(true);
|
||||
rawSwitchItemModel = Helpers::getRawSwitchItemModel(&generalSettings, Helpers::LogicalSwitchesContext);
|
||||
rawSwitchItemModel->setParent(this);
|
||||
rawSwitchItemModel = new RawSwitchFilterItemModel(&generalSettings, &model, LogicalSwitchesContext);
|
||||
int srcFlags = POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0);
|
||||
rawSourceItemModel = Helpers::getRawSourceItemModel(&generalSettings, &model, srcFlags);
|
||||
rawSourceItemModel->setParent(this);
|
||||
@@ -510,6 +510,7 @@ void LogicalSwitchesPanel::cswPaste()
|
||||
LogicalSwitchData *csw = &model->logicalSw[selectedSwitch];
|
||||
memcpy(csw, cswData.constData(), sizeof(LogicalSwitchData));
|
||||
emit modified();
|
||||
rawSwitchItemModel->update();
|
||||
updateLine(selectedSwitch);
|
||||
}
|
||||
}
|
||||
@@ -549,10 +550,10 @@ void LogicalSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-csw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(cswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(cswCopy()));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(cswCut()));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(cswPaste()))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(cswDelete()));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#define _LOGICALSWITCHES_H_
|
||||
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "radiodata.h"
|
||||
|
||||
class RawSwitchFilterItemModel;
|
||||
|
||||
class LogicalSwitchesPanel : public ModelPanel
|
||||
{
|
||||
@@ -58,7 +60,7 @@ class LogicalSwitchesPanel : public ModelPanel
|
||||
QDoubleSpinBox * cswitchDelay[CPN_MAX_LOGICAL_SWITCHES];
|
||||
QComboBox * cswitchSource1[CPN_MAX_LOGICAL_SWITCHES];
|
||||
QComboBox * cswitchSource2[CPN_MAX_LOGICAL_SWITCHES];
|
||||
QStandardItemModel * rawSwitchItemModel;
|
||||
RawSwitchFilterItemModel * rawSwitchItemModel;
|
||||
QStandardItemModel * rawSourceItemModel;
|
||||
void setSwitchWidgetVisibility(int i);
|
||||
int selectedSwitch;
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
|
||||
#include "mixerdialog.h"
|
||||
#include "ui_mixerdialog.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "radiodata.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
|
||||
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings, Firmware * firmware) :
|
||||
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData * mixdata, GeneralSettings & generalSettings, Firmware * firmware) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MixerDialog),
|
||||
model(model),
|
||||
@@ -103,7 +104,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
}
|
||||
}
|
||||
|
||||
ui->switchesCB->setModel(Helpers::getRawSwitchItemModel(&generalSettings, Helpers::MixesContext));
|
||||
ui->switchesCB->setModel(new RawSwitchFilterItemModel(&generalSettings, &model, MixesContext));
|
||||
ui->switchesCB->setCurrentIndex(ui->switchesCB->findData(md->swtch.toValue()));
|
||||
ui->warningCB->setCurrentIndex(md->mixWarn);
|
||||
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
||||
|
||||
@@ -20,140 +20,256 @@
|
||||
|
||||
#include "mixerslistwidget.h"
|
||||
|
||||
#define GRP_IS_PARENT 0x01
|
||||
#define GRP_HAS_SIBLING 0x02
|
||||
#define GRP_HAS_DATA 0x04
|
||||
|
||||
#define GroupIdRole (Qt::UserRole+1) // destination Input/Channel, for alternate row colors
|
||||
#define GroupHeaderRole (Qt::UserRole+2) // bitfield of row metadata (see addItem())
|
||||
|
||||
static QFont defaultFont;
|
||||
static bool fontInit = false;
|
||||
|
||||
MixersListWidget::MixersListWidget(QWidget * parent, bool expo) :
|
||||
QListWidget(parent),
|
||||
expo(expo)
|
||||
QListWidget(parent),
|
||||
expo(expo)
|
||||
{
|
||||
setFont(QFont("Courier New",12));
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDropIndicatorShown(true);
|
||||
setItemDelegate(new MixersDelegate(parent)); //set custom paint handler
|
||||
if (!fontInit) {
|
||||
fontInit = true;
|
||||
defaultFont = font();
|
||||
defaultFont.setFamily("Courier");
|
||||
defaultFont.setStyleHint(QFont::TypeWriter);
|
||||
defaultFont.setPointSize(defaultFont.pointSize() + 3);
|
||||
}
|
||||
|
||||
setFont(defaultFont);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setDropIndicatorShown(true);
|
||||
setItemDelegate(new MixersDelegate(this)); // set custom paint handler
|
||||
setStyle(new MixerItemViewProxyStyle(style())); // custom element style painter
|
||||
|
||||
itemMimeFmt = (expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
|
||||
|
||||
QAction * zin = new QAction(tr("Increase font size"), this);
|
||||
zin->setShortcut(QKeySequence::ZoomIn);
|
||||
zin->setData(1);
|
||||
addAction(zin);
|
||||
QAction * zout = new QAction(tr("Decrease font size"), this);
|
||||
zout->setShortcut(QKeySequence::ZoomOut);
|
||||
zout->setData(-1);
|
||||
addAction(zout);
|
||||
QAction * zrst = new QAction(tr("Default font size"), this);
|
||||
zrst->setShortcut(tr("Ctrl+0"));
|
||||
zrst->setData(0);
|
||||
addAction(zrst);
|
||||
connect(zin, &QAction::triggered, this, &MixersListWidget::zoomView);
|
||||
connect(zout, &QAction::triggered, this, &MixersListWidget::zoomView);
|
||||
connect(zrst, &QAction::triggered, this, &MixersListWidget::zoomView);
|
||||
}
|
||||
|
||||
void MixersListWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
emit keyWasPressed(event);
|
||||
emit keyWasPressed(event);
|
||||
}
|
||||
|
||||
void MixersListWidget::addItem(QListWidgetItem * item, const unsigned & rowId, bool topLevel, bool hasSib)
|
||||
{
|
||||
Qt::ItemFlags f = item->flags();
|
||||
f |= Qt::ItemIsDropEnabled;
|
||||
|
||||
quint8 hdrRole = 0;
|
||||
if (topLevel)
|
||||
hdrRole |= GRP_IS_PARENT;
|
||||
if (hasSib)
|
||||
hdrRole |= GRP_HAS_SIBLING;
|
||||
if (item->data(Qt::UserRole).toByteArray().at(0) > -1)
|
||||
hdrRole |= GRP_HAS_DATA;
|
||||
else
|
||||
f &= ~Qt::ItemIsDragEnabled; // prevent drag of empty items
|
||||
|
||||
item->setData(GroupIdRole, rowId);
|
||||
item->setData(GroupHeaderRole, hdrRole);
|
||||
item->setFlags(f);
|
||||
|
||||
QListWidget::addItem(item);
|
||||
//qDebug() << rowId << topLevel << hasSib << item->data(GroupHeaderRole).toUInt();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Override to give us different mime type for mixers and inputs
|
||||
*/
|
||||
QStringList MixersListWidget::mimeTypes () const
|
||||
{
|
||||
QStringList types;
|
||||
if (expo) types << "application/x-companion-expo-item";
|
||||
else types << "application/x-companion-mix-item";
|
||||
return types;
|
||||
return QStringList() << itemMimeFmt;
|
||||
}
|
||||
|
||||
void MixersListWidget::dropEvent(QDropEvent * event)
|
||||
{
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx >= 0) list << idx;
|
||||
if (event->proposedAction() == Qt::IgnoreAction)
|
||||
return;
|
||||
|
||||
if (event->mimeData() && event->mimeData()->hasFormat(itemMimeFmt)) {
|
||||
if (event->source() != this) {
|
||||
// force a copy action if dragging from another window
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
}
|
||||
if (list.count()<1) return;
|
||||
event->acceptProposedAction();
|
||||
dropMimeData(indexAt(event->pos()).row(),event->mimeData(),event->dropAction());
|
||||
else {
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
dropMimeData(indexAt(event->pos()).row(), event->mimeData(), event->dropAction());
|
||||
}
|
||||
}
|
||||
|
||||
bool MixersListWidget::dropMimeData(int index, const QMimeData * data, Qt::DropAction action )
|
||||
{
|
||||
// qDebug() << "MixersListWidget::dropMimeData() index:" << index << "formats" << data->formats();
|
||||
QByteArray dropData = data->data(expo ? "application/x-companion-expo-item" : "application/x-companion-mix-item");
|
||||
if (dropData.isNull() ) return false;
|
||||
QDataStream stream(&dropData, QIODevice::ReadOnly);
|
||||
QByteArray qba;
|
||||
// qDebug() << "index:" << index << action << "formats" << data->formats();
|
||||
QByteArray dropData = data->data(itemMimeFmt);
|
||||
if (dropData.isEmpty() )
|
||||
return false;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
int r,c;
|
||||
QMap<int, QVariant> v;
|
||||
stream >> r >> c >> v;
|
||||
QList<QVariant> lsVars;
|
||||
lsVars = v.values();
|
||||
qba.append(lsVars.at(1).toByteArray().mid(1));
|
||||
// qDebug() << "MixersListWidget::dropMimeData() added" << lsVars.count() << "items, data:" << lsVars;
|
||||
}
|
||||
QDataStream stream(&dropData, QIODevice::ReadOnly);
|
||||
QByteArray qba;
|
||||
|
||||
if(qba.length()>0) {
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData(expo ? "application/x-companion-expo" : "application/x-companion-mix", qba);
|
||||
emit mimeDropped(index, mimeData, action);
|
||||
delete mimeData; //is this correct? is mimeData freed elswere??
|
||||
}
|
||||
while (!stream.atEnd()) {
|
||||
int r,c;
|
||||
QMap<int, QVariant> v;
|
||||
stream >> r >> c >> v;
|
||||
qba.append(v.values().at(1).toByteArray().mid(1));
|
||||
}
|
||||
|
||||
return true;
|
||||
if(qba.size()) {
|
||||
QMimeData mimeData;
|
||||
mimeData.setData(QString(itemMimeFmt).remove("-item"), qba);
|
||||
emit mimeDropped(index, &mimeData, action);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MixersListWidget::zoomView()
|
||||
{
|
||||
static int origSz = QFontInfo(font()).pixelSize();
|
||||
int fsz = origSz;
|
||||
int step = qobject_cast<QAction *>(sender())->data().toInt();
|
||||
if (step)
|
||||
fsz = QFontInfo(font()).pixelSize() + step;
|
||||
if (fsz < 8)
|
||||
return;
|
||||
|
||||
QFont fnt(font());
|
||||
fnt.setPixelSize(fsz);
|
||||
setFont(fnt);
|
||||
defaultFont = fnt;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MixersDelegate
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief Paints our HTML formated list item text
|
||||
*/
|
||||
void MixersDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QStyleOptionViewItem options = option;
|
||||
initStyleOption(&options, index);
|
||||
QStyleOptionViewItem options = option;
|
||||
initStyleOption(&options, index);
|
||||
|
||||
painter->save();
|
||||
QTextDocument doc;
|
||||
SetupDocument(doc, options, index);
|
||||
options.text.clear();
|
||||
|
||||
//setup html document
|
||||
QTextDocument doc;
|
||||
SetupDocument(doc, options);
|
||||
QAbstractTextDocumentLayout::PaintContext ctx;
|
||||
if (options.widget)
|
||||
ctx.palette = options.widget->palette();
|
||||
|
||||
options.text = "";
|
||||
options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter);
|
||||
QBrush brush = ((index.data(GroupIdRole).toUInt() % 2) ? ctx.palette.base() : ctx.palette.alternateBase());
|
||||
options.backgroundBrush = brush;
|
||||
|
||||
if ( index.model()->data(index, GroupHeaderRole).toInt() > 0 ) {
|
||||
//paint with added space
|
||||
painter->translate(options.rect.left(), options.rect.top() + MIX_ROW_HEIGHT_INCREASE);
|
||||
QRect clip(0, 0, options.rect.width(), options.rect.height() - MIX_ROW_HEIGHT_INCREASE);
|
||||
doc.drawContents(painter, clip);
|
||||
}
|
||||
else {
|
||||
painter->translate(options.rect.left(), options.rect.top());
|
||||
QRect clip(0, 0, options.rect.width(), options.rect.height());
|
||||
doc.drawContents(painter, clip);
|
||||
}
|
||||
painter->restore();
|
||||
if (!(index.model()->data(index, GroupHeaderRole).toUInt() & GRP_HAS_DATA)) {
|
||||
// lighter text for empty lines
|
||||
ctx.palette.setBrush(QPalette::Text, ctx.palette.mid());
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
// Linux and OS X show a solid dark blue color on selected items
|
||||
else if ((options.state & QStyle::State_Selected)) {
|
||||
ctx.palette.setBrush(QPalette::Text, ctx.palette.highlightedText());
|
||||
}
|
||||
#endif
|
||||
|
||||
QStyle * style = (options.widget ? options.widget->style() : QApplication::style());
|
||||
style->drawControl(QStyle::CE_ItemViewItem, &options, painter, options.widget);
|
||||
|
||||
QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &options);
|
||||
QRectF clipRect = textRect.translated(-textRect.topLeft());
|
||||
ctx.clip = clipRect;
|
||||
painter->save();
|
||||
painter->translate(textRect.topLeft());
|
||||
painter->setClipRect(clipRect);
|
||||
doc.documentLayout()->draw(painter, ctx);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Returns needed size for our HTML formated list item text
|
||||
*/
|
||||
QSize MixersDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
|
||||
QSize MixersDelegate::sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
{
|
||||
QStyleOptionViewItem options = option;
|
||||
initStyleOption(&options, index);
|
||||
QStyleOptionViewItem options = option;
|
||||
initStyleOption(&options, index);
|
||||
|
||||
//setup html document
|
||||
QTextDocument doc;
|
||||
SetupDocument(doc, options);
|
||||
|
||||
//qDebug() << "MixersDelegate::sizeHint() UserRole-> " << index.model()->data(index, Qt::UserRole + 2);
|
||||
int height = doc.size().height();
|
||||
if ( index.model()->data(index, Qt::UserRole + 2).toInt() > 0 ) {
|
||||
//qDebug() << "MixersDelegate::sizeHint() detected channel head";
|
||||
height = doc.size().height() + MIX_ROW_HEIGHT_INCREASE;
|
||||
}
|
||||
//qDebug() << "MixersDelegate::sizeHint() options.rect " << options.rect;
|
||||
//qDebug() << "MixersDelegate::sizeHint() result " << QSize(doc.idealWidth(), height) << options.rect.width();
|
||||
return QSize(doc.idealWidth(), height);
|
||||
QTextDocument doc;
|
||||
SetupDocument(doc, options, index);
|
||||
return QSize(doc.idealWidth(), doc.size().height());
|
||||
}
|
||||
|
||||
void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const
|
||||
void MixersDelegate::SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options, const QModelIndex & index) const
|
||||
{
|
||||
//setup html document
|
||||
doc.setHtml(options.text);
|
||||
doc.setDefaultFont(options.font);
|
||||
//setup html document
|
||||
quint8 hdrRole = index.model()->data(index, GroupHeaderRole).toUInt();
|
||||
|
||||
//minimize margins (default margins look ugly)
|
||||
QTextFrame *tf = doc.rootFrame();
|
||||
QTextFrameFormat tff = tf->frameFormat();
|
||||
tff.setMargin(0);
|
||||
tf->setFrameFormat(tff);
|
||||
doc.setDefaultFont(options.font);
|
||||
doc.setHtml(options.text);
|
||||
|
||||
// adjust margins to visually group items per input/channel
|
||||
QTextFrame *tf = doc.rootFrame();
|
||||
QTextFrameFormat tff = tf->frameFormat();
|
||||
|
||||
if (!(hdrRole & GRP_HAS_DATA)) {
|
||||
tff.setTopMargin(0.75f);
|
||||
tff.setBottomMargin(0.75f);
|
||||
}
|
||||
else {
|
||||
if (!(hdrRole & GRP_IS_PARENT))
|
||||
tff.setTopMargin(0.5f);
|
||||
if (hdrRole & GRP_HAS_SIBLING)
|
||||
tff.setBottomMargin(0.5f);
|
||||
}
|
||||
tf->setFrameFormat(tff);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MixerItemViewProxyStyle
|
||||
*/
|
||||
|
||||
void MixerItemViewProxyStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget) const
|
||||
{
|
||||
painter->save();
|
||||
if (element == QStyle::PE_IndicatorItemViewItemDrop) {
|
||||
painter->setRenderHint(QPainter::HighQualityAntialiasing, true);
|
||||
// set a wider stroke for the drop indicator
|
||||
QPen pen(painter->pen());
|
||||
pen.setWidthF(2.25f);
|
||||
painter->setPen(pen);
|
||||
}
|
||||
QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#define _MIXERSLISTWIDGET_H_
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled
|
||||
const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item
|
||||
#include <QProxyStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class MixersListWidget : public QListWidget
|
||||
{
|
||||
@@ -40,13 +40,15 @@ class MixersListWidget : public QListWidget
|
||||
void keyWasPressed(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
void addItem(QListWidgetItem *item, const unsigned & rowId, bool topLevel = false, bool hasSib = false);
|
||||
bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
|
||||
void zoomView();
|
||||
|
||||
protected:
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
private:
|
||||
QPoint dragStartPosition;
|
||||
QString itemMimeFmt;
|
||||
bool expo;
|
||||
|
||||
};
|
||||
@@ -60,14 +62,25 @@ class MixersDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
inline MixersDelegate(QObject *parent) : QStyledItemDelegate(parent) {};
|
||||
inline MixersDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
|
||||
|
||||
private:
|
||||
void SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options) const;
|
||||
void SetupDocument(QTextDocument & doc, const QStyleOptionViewItem & options, const QModelIndex & index) const;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Provides custom painting of items on a per-element basis, eg. to change style of drop indicator
|
||||
*/
|
||||
class MixerItemViewProxyStyle: public QProxyStyle
|
||||
{
|
||||
public:
|
||||
explicit MixerItemViewProxyStyle(QStyle * style = 0) : QProxyStyle(style) {}
|
||||
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0) const;
|
||||
};
|
||||
|
||||
#endif // _MIXERSLISTWIDGET_H_
|
||||
|
||||
@@ -109,20 +109,17 @@ bool MixesPanel::AddMixerLine(int dest)
|
||||
QString str = getMixerText(dest, &new_ch);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
QByteArray qba(1, (quint8)dest);
|
||||
unsigned destId = abs(dest);
|
||||
bool hasSibs = false;
|
||||
if (dest >= 0) {
|
||||
//add mix data
|
||||
MixData * md = &model->mixData[dest];
|
||||
qba.append((const char*)md, sizeof(MixData));
|
||||
destId = md->destCh;
|
||||
hasSibs = (dest < CPN_MAX_MIXERS && model->mixData[dest+1].destCh == md->destCh);
|
||||
}
|
||||
itm->setData(Qt::UserRole, qba);
|
||||
#if MIX_ROW_HEIGHT_INCREASE > 0
|
||||
// TODO why?
|
||||
if (new_ch && mixersListWidget->count() == 0) {
|
||||
// increase size of this row
|
||||
itm->setData(GroupHeaderRole, 1);
|
||||
}
|
||||
#endif
|
||||
mixersListWidget->addItem(itm);
|
||||
mixersListWidget->addItem(itm, destId, new_ch, hasSibs);
|
||||
return new_ch;
|
||||
}
|
||||
|
||||
@@ -140,11 +137,11 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
QString str;
|
||||
bool newChannel = false;
|
||||
if (dest < 0) {
|
||||
str = modelPrinter.printChannelName(abs(dest)-1);
|
||||
dest = abs(dest);
|
||||
str = modelPrinter.printChannelName(dest-1);
|
||||
//highlight channel if needed
|
||||
if (-dest == (int)highlightedSource) {
|
||||
if (dest == (int)highlightedSource)
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
newChannel = true;
|
||||
}
|
||||
else {
|
||||
@@ -155,9 +152,8 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
|
||||
newChannel = true;
|
||||
//highlight channel if needed
|
||||
if (mix.destCh == highlightedSource) {
|
||||
if (mix.destCh == highlightedSource)
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
str.fill(' ');
|
||||
@@ -165,7 +161,8 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
|
||||
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
|
||||
}
|
||||
if (new_ch) *new_ch = newChannel;
|
||||
if (new_ch)
|
||||
*new_ch = newChannel;
|
||||
return str.replace(" ", " ");
|
||||
}
|
||||
|
||||
@@ -446,21 +443,27 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(moveMixUp()), tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveMixDown()), tr("Ctrl+Down"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addActions(mixersListWidget->actions());
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction action)
|
||||
{
|
||||
int idx= mixersListWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
int idx = mixersListWidget->item(index)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
if (action==Qt::CopyAction) {
|
||||
pasteMixerMimeData(data, idx);
|
||||
if (action == Qt::CopyAction) {
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
else if (action==Qt::MoveAction) {
|
||||
QList<int> list = createMixListFromSelected();
|
||||
mixersDeleteList(list);
|
||||
pasteMixerMimeData(data, idx);
|
||||
else if (action == Qt::MoveAction) {
|
||||
QList<int> list = createMixListFromSelected();
|
||||
mixersDeleteList(createMixListFromSelected());
|
||||
foreach (const int del, list) {
|
||||
if (del < idx)
|
||||
--idx;
|
||||
}
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include "ui_setup.h"
|
||||
#include "ui_setup_timer.h"
|
||||
#include "ui_setup_module.h"
|
||||
#include "switchitemmodel.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "modelprinter.h"
|
||||
#include "multiprotocols.h"
|
||||
#include "checklistdialog.h"
|
||||
|
||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget * prevFocus):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
@@ -49,7 +51,8 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
}
|
||||
|
||||
// Mode
|
||||
ui->mode->setModel(Helpers::getRawSwitchItemModel(&generalSettings, Helpers::TimersContext));
|
||||
rawSwitchItemModel = new RawSwitchFilterItemModel(&generalSettings, &model, TimersContext);
|
||||
ui->mode->setModel(rawSwitchItemModel);
|
||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
||||
|
||||
if (!firmware->getCapability(PermTimers)) {
|
||||
@@ -90,6 +93,8 @@ TimerPanel::~TimerPanel()
|
||||
|
||||
void TimerPanel::update()
|
||||
{
|
||||
rawSwitchItemModel->update();
|
||||
|
||||
int hour = timer.val / 3600;
|
||||
int min = (timer.val - (hour * 3600)) / 60;
|
||||
int sec = (timer.val - (hour * 3600)) % 60;
|
||||
@@ -165,6 +170,9 @@ void TimerPanel::on_name_editingFinished()
|
||||
#define MASK_MULTIMODULE 128
|
||||
#define MASK_ANTENNA 256
|
||||
#define MASK_MULTIOPTION 512
|
||||
#define MASK_R9M 1024
|
||||
#define MASK_SBUSPPM_FIELDS 2048
|
||||
#define MASK_SUBTYPES 4096
|
||||
|
||||
quint8 ModulePanel::failsafesValueDisplayType = ModulePanel::FAILSAFE_DISPLAY_PERCENT;
|
||||
|
||||
@@ -256,7 +264,8 @@ ModulePanel::~ModulePanel()
|
||||
|
||||
bool ModulePanel::moduleHasFailsafes()
|
||||
{
|
||||
return ((PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_XJT_X16 && firmware->getCapability(HasFailsafe));;
|
||||
return (((PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_XJT_X16 || (PulsesProtocol)module.protocol == PulsesProtocol::PULSES_PXX_R9M)
|
||||
&& firmware->getCapability(HasFailsafe));;
|
||||
}
|
||||
|
||||
void ModulePanel::setupFailsafes()
|
||||
@@ -360,12 +369,14 @@ void ModulePanel::update()
|
||||
if (moduleIdx >= 0) {
|
||||
mask |= MASK_PROTOCOL;
|
||||
switch (protocol) {
|
||||
case PULSES_PXX_R9M:
|
||||
mask |= MASK_R9M | MASK_SUBTYPES;
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_PXX_DJT:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12)
|
||||
if (protocol==PULSES_PXX_XJT_X16 || protocol==PULSES_PXX_XJT_LR12 || protocol==PULSES_PXX_R9M)
|
||||
mask |= MASK_RX_NUMBER;
|
||||
if (IS_HORUS(firmware->getBoard()) && moduleIdx==0)
|
||||
mask |= MASK_ANTENNA;
|
||||
@@ -382,13 +393,17 @@ void ModulePanel::update()
|
||||
module.channelsCount = 16;
|
||||
break;
|
||||
case PULSES_PPM:
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
|
||||
mask |= MASK_PPM_FIELDS | MASK_SBUSPPM_FIELDS| MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
|
||||
if (IS_9XRPRO(firmware->getBoard())) {
|
||||
mask |= MASK_OPEN_DRAIN;
|
||||
}
|
||||
break;
|
||||
case PULSES_SBUS:
|
||||
module.channelsCount = 16;
|
||||
mask |= MASK_SBUSPPM_FIELDS| MASK_CHANNELS_RANGE;
|
||||
break;
|
||||
case PULSES_MULTIMODULE:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER | MASK_MULTIMODULE;
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER | MASK_MULTIMODULE | MASK_SUBTYPES;
|
||||
max_rx_num = 15;
|
||||
if (module.multi.rfProtocol == MM_RF_PROTO_DSM2)
|
||||
mask |= MASK_CHANNELS_COUNT;
|
||||
@@ -396,6 +411,8 @@ void ModulePanel::update()
|
||||
module.channelsCount = 16;
|
||||
if (multiProtocols.getProtocol(module.multi.rfProtocol).optionsstr != nullptr)
|
||||
mask |= MASK_MULTIOPTION;
|
||||
if (multiProtocols.getProtocol(module.multi.rfProtocol).hasFailsafe)
|
||||
mask |= MASK_FAILSAFES;
|
||||
break;
|
||||
case PULSES_OFF:
|
||||
break;
|
||||
@@ -432,8 +449,8 @@ void ModulePanel::update()
|
||||
ui->channelsCount->setSingleStep(firmware->getCapability(HasPPMStart) ? 1 : 2);
|
||||
|
||||
// PPM settings fields
|
||||
ui->label_ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmPolarity->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->label_ppmPolarity->setVisible(mask & MASK_SBUSPPM_FIELDS);
|
||||
ui->ppmPolarity->setVisible(mask & MASK_SBUSPPM_FIELDS);
|
||||
ui->ppmPolarity->setCurrentIndex(module.ppm.pulsePol);
|
||||
ui->label_ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
|
||||
ui->ppmOutputType->setVisible(mask & MASK_OPEN_DRAIN);
|
||||
@@ -441,8 +458,8 @@ void ModulePanel::update()
|
||||
ui->label_ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmDelay->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmDelay->setValue(module.ppm.delay);
|
||||
ui->label_ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->ppmFrameLength->setVisible(mask & MASK_PPM_FIELDS);
|
||||
ui->label_ppmFrameLength->setVisible(mask & MASK_SBUSPPM_FIELDS);
|
||||
ui->ppmFrameLength->setVisible(mask & MASK_SBUSPPM_FIELDS);
|
||||
ui->ppmFrameLength->setMinimum(module.channelsCount*(model->extendedLimits ? 2.250 : 2)+3.5);
|
||||
ui->ppmFrameLength->setMaximum(firmware->getCapability(PPMFrameLength));
|
||||
ui->ppmFrameLength->setValue(22.5+((double)module.ppm.frameLength)*0.5);
|
||||
@@ -450,29 +467,51 @@ void ModulePanel::update()
|
||||
// Antenna slection on Horus
|
||||
ui->label_antenna->setVisible(mask & MASK_ANTENNA);
|
||||
ui->antennaMode->setVisible(mask & MASK_ANTENNA);
|
||||
ui->antennaMode->setCurrentIndex(module.ppm.pulsePol);
|
||||
ui->antennaMode->setCurrentIndex(module.pxx.external_antenna);
|
||||
|
||||
// R9M options
|
||||
ui->sportOut->setVisible(mask & MASK_R9M);
|
||||
ui->r9mPower->setVisible((mask & MASK_R9M) && module.subType == 0);
|
||||
ui->label_r9mPower->setVisible((mask & MASK_R9M) && module.subType == 0);
|
||||
if (mask & MASK_R9M) {
|
||||
if (model->moduleData[0].protocol >= PULSES_PXX_XJT_X16 && model->moduleData[0].protocol <= PULSES_PXX_XJT_LR12) {
|
||||
module.pxx.sport_out = false;
|
||||
ui->sportOut->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
ui->sportOut->setEnabled(true);
|
||||
}
|
||||
ui->sportOut->setChecked(module.pxx.sport_out);
|
||||
ui->r9mPower->setCurrentIndex(module.pxx.power);
|
||||
}
|
||||
|
||||
// module subtype
|
||||
ui->label_multiSubType->setVisible(mask & MASK_SUBTYPES);
|
||||
ui->multiSubType->setVisible(mask & MASK_SUBTYPES);
|
||||
if (mask & MASK_SUBTYPES) {
|
||||
unsigned numEntries = 2; // R9M FCC/EU
|
||||
if (mask & MASK_MULTIMODULE)
|
||||
numEntries = (module.multi.customProto ? 8 : multiProtocols.getProtocol(module.multi.rfProtocol).numSubytes());
|
||||
|
||||
const QSignalBlocker blocker(ui->multiSubType);
|
||||
ui->multiSubType->clear();
|
||||
for (unsigned i=0; i < numEntries; i++)
|
||||
ui->multiSubType->addItem(ModelPrinter::printModuleSubType(protocol, i, module.multi.rfProtocol, module.multi.customProto), i);
|
||||
ui->multiSubType->setCurrentIndex(module.subType);
|
||||
}
|
||||
|
||||
// Multi settings fields
|
||||
ui->label_multiProtocol->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->multiProtocol->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->multiProtocol->setCurrentIndex(module.multi.rfProtocol);
|
||||
ui->label_multiSubType->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->multiSubType->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->label_option->setVisible(mask & MASK_MULTIOPTION);
|
||||
ui->optionValue->setVisible(mask & MASK_MULTIOPTION);
|
||||
ui->autoBind->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->lowPower->setVisible(mask & MASK_MULTIMODULE);
|
||||
|
||||
if (mask & MASK_MULTIMODULE) {
|
||||
int numEntries = multiProtocols.getProtocol(module.multi.rfProtocol).numSubytes();
|
||||
if (module.multi.customProto)
|
||||
numEntries=8;
|
||||
// Removes extra items
|
||||
ui->multiSubType->setMaxCount(numEntries);
|
||||
for (int i=0; i < numEntries; i++) {
|
||||
if (i < ui->multiSubType->count())
|
||||
ui->multiSubType->setItemText(i, ModelPrinter::printMultiSubType(module.multi.rfProtocol, module.multi.customProto, i));
|
||||
else
|
||||
ui->multiSubType->addItem(ModelPrinter::printMultiSubType(module.multi.rfProtocol, module.multi.customProto, i), (QVariant) i);
|
||||
}
|
||||
ui->multiProtocol->setCurrentIndex(module.multi.rfProtocol);
|
||||
ui->autoBind->setChecked(module.multi.autoBindMode ? Qt::Checked : Qt::Unchecked);
|
||||
ui->lowPower->setChecked(module.multi.lowPowerMode ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
if (mask & MASK_MULTIOPTION) {
|
||||
@@ -482,14 +521,8 @@ void ModulePanel::update()
|
||||
ui->optionValue->setValue(module.multi.optionValue);
|
||||
ui->label_option->setText(qApp->translate("Multiprotocols", qPrintable(pdef.optionsstr)));
|
||||
}
|
||||
ui->multiSubType->setCurrentIndex(module.subType);
|
||||
|
||||
ui->autoBind->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->autoBind->setChecked(module.multi.autoBindMode ? Qt::Checked : Qt::Unchecked);
|
||||
ui->lowPower->setVisible(mask & MASK_MULTIMODULE);
|
||||
ui->lowPower->setChecked(module.multi.lowPowerMode ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
|
||||
// Failsafes
|
||||
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
|
||||
@@ -554,7 +587,21 @@ void ModulePanel::on_ppmPolarity_currentIndexChanged(int index)
|
||||
|
||||
void ModulePanel::on_antennaMode_currentIndexChanged(int index)
|
||||
{
|
||||
module.ppm.pulsePol = index;
|
||||
module.pxx.external_antenna = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void ModulePanel::on_sportOut_toggled(bool checked)
|
||||
{
|
||||
if (module.pxx.sport_out != checked) {
|
||||
module.pxx.sport_out = checked;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::on_r9mPower_currentIndexChanged(int index)
|
||||
{
|
||||
module.pxx.power = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -891,6 +938,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
|
||||
if (!firmware->getCapability(HasDisplayText)) {
|
||||
ui->displayText->hide();
|
||||
ui->editText->hide();
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(GlobalFunctions)) {
|
||||
@@ -1306,3 +1354,9 @@ void SetupPanel::onBeepCenterToggled(bool checked)
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void SetupPanel::on_editText_clicked()
|
||||
{
|
||||
ChecklistDialog *g = new ChecklistDialog(this, ui->name->text());
|
||||
g->exec();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class RawSwitchFilterItemModel;
|
||||
|
||||
namespace Ui {
|
||||
class Setup;
|
||||
class Timer;
|
||||
@@ -49,7 +51,8 @@ class TimerPanel : public ModelPanel
|
||||
|
||||
private:
|
||||
TimerData & timer;
|
||||
Ui::Timer *ui;
|
||||
Ui::Timer * ui;
|
||||
RawSwitchFilterItemModel * rawSwitchItemModel;
|
||||
};
|
||||
|
||||
class ModulePanel : public ModelPanel
|
||||
@@ -85,6 +88,8 @@ class ModulePanel : public ModelPanel
|
||||
void on_multiSubType_currentIndexChanged(int index);
|
||||
void on_autoBind_stateChanged(int state);
|
||||
void on_lowPower_stateChanged(int state);
|
||||
void on_sportOut_toggled(bool checked);
|
||||
void on_r9mPower_currentIndexChanged(int index);
|
||||
void setChannelFailsafeValue(const int channel, const int value, quint8 updtSb = 0);
|
||||
void onFailsafeComboIndexChanged(int index);
|
||||
void onFailsafeUsecChanged(int value);
|
||||
@@ -140,6 +145,7 @@ class SetupPanel : public ModelPanel
|
||||
void startupSwitchToggled(bool checked);
|
||||
void potWarningToggled(bool checked);
|
||||
void on_potWarningMode_currentIndexChanged(int index);
|
||||
void on_editText_clicked();
|
||||
|
||||
private:
|
||||
Ui::Setup *ui;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>840</width>
|
||||
<height>371</height>
|
||||
<width>893</width>
|
||||
<height>405</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -343,16 +343,6 @@
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="extendedTrims">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Trims</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCheckBox" name="displayText">
|
||||
<property name="layoutDirection">
|
||||
@@ -363,40 +353,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="extendedLimits">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Limits</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="throttleReverse">
|
||||
<property name="whatsThis">
|
||||
<string>Reverse throttle operation.
|
||||
If this is checked the throttle will be reversed. Idle will be forward, trim will also be reversed and the throttle warning will be reversed as well.
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reverse Throttle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="throttleSource">
|
||||
<item row="2" column="0">
|
||||
<widget class="AutoComboBox" name="trimsDisplay">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On change</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -409,6 +388,13 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="gfEnabled">
|
||||
<property name="text">
|
||||
<string>Global Functions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="throttleWarning">
|
||||
<property name="layoutDirection">
|
||||
@@ -419,18 +405,15 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="throttleSource">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="trimIncrement">
|
||||
@@ -467,38 +450,68 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="AutoComboBox" name="trimsDisplay">
|
||||
<item row="0" column="3">
|
||||
<widget class="QCheckBox" name="throttleReverse">
|
||||
<property name="whatsThis">
|
||||
<string>Reverse throttle operation.
|
||||
If this is checked the throttle will be reversed. Idle will be forward, trim will also be reversed and the throttle warning will be reversed as well.
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reverse Throttle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="editText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On change</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QCheckBox" name="gfEnabled">
|
||||
<property name="text">
|
||||
<string>Global Functions</string>
|
||||
<string>Edit Checklist...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="extendedTrims">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Trims</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="extendedLimits">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extended Limits</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>674</width>
|
||||
<height>229</height>
|
||||
<width>708</width>
|
||||
<height>259</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
@@ -147,22 +150,43 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_multiSubType">
|
||||
<widget class="QLabel" name="label_rxNumber">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SubType</string>
|
||||
<string>Receiver No.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="multiSubType">
|
||||
<widget class="QSpinBox" name="rxNumber">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>63</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -206,87 +230,53 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_antenna">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_r9mPower">
|
||||
<property name="text">
|
||||
<string>Antenna</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<string>RF Output Power</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="antennaMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<widget class="QComboBox" name="r9mPower">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Internal</string>
|
||||
<string>10 mW</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ext. + Int.</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_ppmOutputType">
|
||||
<property name="text">
|
||||
<string>Output type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="ppmOutputType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open Drain</string>
|
||||
<string>100 mW</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Push Pull</string>
|
||||
<string>500 mW</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1000 mW</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="optionValue">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_option">
|
||||
<property name="text">
|
||||
<string>Option value</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoBind">
|
||||
<property name="text">
|
||||
<string>Bind on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lowPower">
|
||||
<property name="text">
|
||||
<string>Low Power</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -352,61 +342,6 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_rxNumber">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Receiver No.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="rxNumber">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>63</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="autoBind">
|
||||
<property name="text">
|
||||
<string>Bind on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="lowPower">
|
||||
<property name="text">
|
||||
<string>Low Power</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_ppmDelay">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -422,7 +357,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="ppmDelay">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -450,7 +385,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_ppmFrameLength">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -466,7 +401,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ppmFrameLength">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -494,6 +429,89 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_antenna">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Antenna</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="antennaMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Internal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ext. + Int.</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_ppmOutputType">
|
||||
<property name="text">
|
||||
<string>Output type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="ppmOutputType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open Drain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Push Pull</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_option">
|
||||
<property name="text">
|
||||
<string>Option value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="optionValue">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -560,6 +578,26 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_multiSubType">
|
||||
<property name="text">
|
||||
<string>Sub Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="multiSubType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_failsafeMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -575,7 +613,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="failsafeMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -613,7 +651,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_trainerMode">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -629,7 +667,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="trainerMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -667,6 +705,19 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="sportOut">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Module Telemetry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "switchitemmodel.h"
|
||||
#include "eeprominterface.h"
|
||||
|
||||
RawSwitchItemModel::RawSwitchItemModel(const GeneralSettings * const generalSettings, const ModelData * const modelData):
|
||||
generalSettings(generalSettings),
|
||||
modelData(modelData)
|
||||
{
|
||||
Boards board = Boards(getCurrentBoard());
|
||||
Board::Type btype = board.getBoardType();
|
||||
Firmware * fw = getCurrentFirmware();
|
||||
|
||||
// Descending switch direction: NOT (!) switches
|
||||
if (IS_ARM(btype)) {
|
||||
add(SWITCH_TYPE_SENSOR, -CPN_MAX_SENSORS);
|
||||
add(SWITCH_TYPE_TELEMETRY, -1);
|
||||
add(SWITCH_TYPE_FLIGHT_MODE, -fw->getCapability(FlightModes));
|
||||
}
|
||||
add(SWITCH_TYPE_VIRTUAL, -fw->getCapability(LogicalSwitches));
|
||||
add(SWITCH_TYPE_ROTARY_ENCODER, -fw->getCapability(RotaryEncoders));
|
||||
add(SWITCH_TYPE_TRIM, -board.getCapability(Board::NumTrimSwitches));
|
||||
add(SWITCH_TYPE_MULTIPOS_POT, -(fw->getCapability(MultiposPots) * fw->getCapability(MultiposPotsPositions)));
|
||||
add(SWITCH_TYPE_SWITCH, -board.getCapability(Board::SwitchPositions));
|
||||
|
||||
// Ascending switch direction (including zero)
|
||||
add(SWITCH_TYPE_TIMER_MODE, 5);
|
||||
add(SWITCH_TYPE_NONE, 1);
|
||||
add(SWITCH_TYPE_SWITCH, board.getCapability(Board::SwitchPositions));
|
||||
add(SWITCH_TYPE_MULTIPOS_POT, fw->getCapability(MultiposPots) * fw->getCapability(MultiposPotsPositions));
|
||||
add(SWITCH_TYPE_TRIM, board.getCapability(Board::NumTrimSwitches));
|
||||
add(SWITCH_TYPE_ROTARY_ENCODER, fw->getCapability(RotaryEncoders));
|
||||
add(SWITCH_TYPE_VIRTUAL, fw->getCapability(LogicalSwitches));
|
||||
if (IS_ARM(btype)) {
|
||||
add(SWITCH_TYPE_FLIGHT_MODE, fw->getCapability(FlightModes));
|
||||
add(SWITCH_TYPE_TELEMETRY, 1);
|
||||
add(SWITCH_TYPE_SENSOR, CPN_MAX_SENSORS);
|
||||
}
|
||||
add(SWITCH_TYPE_ON, 1);
|
||||
add(SWITCH_TYPE_ONE, 1);
|
||||
}
|
||||
|
||||
void RawSwitchItemModel::add(const RawSwitchType & type, int count)
|
||||
{
|
||||
// Most RawSwitch() indices are one-based (vs. typical zero); these are exceptions to the rule:
|
||||
const static QVector<int> rawSwitchIndexBaseZeroTypes = QVector<int>() << SWITCH_TYPE_NONE << SWITCH_TYPE_ON << SWITCH_TYPE_OFF << SWITCH_TYPE_TIMER_MODE;
|
||||
|
||||
int rawIdxAdj = 0;
|
||||
const Board::Type board = getCurrentBoard();
|
||||
int i = (count < 0 ? count : 1);
|
||||
const int maxCount = (i < 0 ? 0 : count + i);
|
||||
|
||||
// handle exceptions in RawSwitch() index values
|
||||
if (rawSwitchIndexBaseZeroTypes.contains(type))
|
||||
rawIdxAdj = -1;
|
||||
|
||||
for ( ; i < maxCount; ++i) {
|
||||
if (generalSettings) {
|
||||
if (type == SWITCH_TYPE_SWITCH && IS_HORUS_OR_TARANIS(board) && !generalSettings->switchPositionAllowedTaranis(abs(i)))
|
||||
continue;
|
||||
if (type == SWITCH_TYPE_MULTIPOS_POT) {
|
||||
int pot = div(abs(i) - 1, getCurrentFirmware()->getCapability(MultiposPotsPositions)).quot;
|
||||
if (!generalSettings->isPotAvailable(pot) || generalSettings->potConfig[pot] != Board::POT_MULTIPOS_SWITCH)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
RawSwitch rs(type, i + rawIdxAdj);
|
||||
QStandardItem * modelItem = new QStandardItem(rs.toString(board, generalSettings, modelData));
|
||||
modelItem->setData(rs.toValue(), Qt::UserRole);
|
||||
appendRow(modelItem);
|
||||
}
|
||||
}
|
||||
|
||||
void RawSwitchItemModel::update()
|
||||
{
|
||||
for (int i=0; i<rowCount(); i++) {
|
||||
QStandardItem * modelItem = item(i, 0);
|
||||
RawSwitch swtch(modelItem->data(Qt::UserRole).toInt());
|
||||
modelItem->setText(swtch.toString(getCurrentBoard(), generalSettings, modelData));
|
||||
}
|
||||
}
|
||||
|
||||
RawSwitchFilterItemModel::RawSwitchFilterItemModel(const GeneralSettings * const generalSettings, const ModelData * const modelData, SwitchContext context):
|
||||
generalSettings(generalSettings),
|
||||
modelData(modelData),
|
||||
context(context),
|
||||
parent(new RawSwitchItemModel(generalSettings, modelData))
|
||||
{
|
||||
setSourceModel(parent);
|
||||
setDynamicSortFilter(false);
|
||||
}
|
||||
|
||||
bool RawSwitchFilterItemModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
RawSwitch swtch(sourceModel()->data(index, Qt::UserRole).toInt());
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_FLIGHT_MODE && (context == MixesContext || context == GlobalFunctionsContext))
|
||||
return false;
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_VIRTUAL && context == GlobalFunctionsContext)
|
||||
return false;
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_TIMER_MODE && context != TimersContext)
|
||||
return false;
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_NONE && context == TimersContext)
|
||||
return false;
|
||||
|
||||
if (swtch.type == SWITCH_TYPE_SENSOR && context == GlobalFunctionsContext)
|
||||
return false;
|
||||
|
||||
if ((swtch.type == SWITCH_TYPE_ON || swtch.type == SWITCH_TYPE_ONE) && (context != SpecialFunctionsContext && context != GlobalFunctionsContext))
|
||||
return false;
|
||||
|
||||
if (!modelData->isAvailable(swtch))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RawSwitchFilterItemModel::update()
|
||||
{
|
||||
parent->update();
|
||||
invalidate();
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "radiodata.h"
|
||||
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
SpecialFunctionsContext,
|
||||
GlobalFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
class RawSwitchItemModel: public QStandardItemModel {
|
||||
public:
|
||||
RawSwitchItemModel(const GeneralSettings * const generalSettings, const ModelData * const modelData);
|
||||
void update();
|
||||
|
||||
protected:
|
||||
void add(const RawSwitchType & type, int count);
|
||||
|
||||
const GeneralSettings * generalSettings;
|
||||
const ModelData * modelData;
|
||||
};
|
||||
|
||||
class RawSwitchFilterItemModel: public QSortFilterProxyModel {
|
||||
public:
|
||||
RawSwitchFilterItemModel(const GeneralSettings * const generalSettings = NULL, const ModelData * const modelData = NULL, SwitchContext context = LogicalSwitchesContext);
|
||||
void update();
|
||||
|
||||
protected:
|
||||
const GeneralSettings * generalSettings;
|
||||
const ModelData * modelData;
|
||||
SwitchContext context;
|
||||
RawSwitchItemModel * parent;
|
||||
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const override;
|
||||
};
|
||||
@@ -829,24 +829,26 @@ void TelemetryPanel::setup()
|
||||
}
|
||||
ui->telemetryProtocol->setCurrentIndex(model->telemetryProtocol);
|
||||
ui->ignoreSensorIds->setField(model->frsky.ignoreSensorIds, this);
|
||||
ui->disableTelemetryAlarms->setField(model->rssiAlarms.disabled);
|
||||
}
|
||||
else {
|
||||
ui->telemetryProtocolLabel->hide();
|
||||
ui->telemetryProtocol->hide();
|
||||
ui->ignoreSensorIds->hide();
|
||||
ui->disableTelemetryAlarms->hide();
|
||||
}
|
||||
|
||||
ui->rssiAlarm1SB->setValue(model->frsky.rssiAlarms[0].value);
|
||||
ui->rssiAlarm2SB->setValue(model->frsky.rssiAlarms[1].value);
|
||||
if (!IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
ui->rssiAlarm1CB->setCurrentIndex(model->frsky.rssiAlarms[0].level);
|
||||
ui->rssiAlarm2CB->setCurrentIndex(model->frsky.rssiAlarms[1].level);
|
||||
ui->rssiAlarmWarningSB->setValue(model->rssiAlarms.warning);
|
||||
ui->rssiAlarmCriticalSB->setValue(model->rssiAlarms.critical);
|
||||
if (!IS_ARM(firmware->getBoard())) {
|
||||
ui->rssiAlarmWarningCB->setCurrentIndex(model->rssiAlarms.level[0]);
|
||||
ui->rssiAlarmCriticalCB->setCurrentIndex(model->rssiAlarms.level[1]);
|
||||
}
|
||||
else {
|
||||
ui->rssiAlarm1CB->hide();
|
||||
ui->rssiAlarm2CB->hide();
|
||||
ui->rssiAlarm1Label->setText(tr("Low Alarm"));
|
||||
ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
|
||||
ui->rssiAlarmWarningCB->hide();
|
||||
ui->rssiAlarmCriticalCB->hide();
|
||||
ui->rssiAlarmWarningLabel->setText(tr("Low Alarm"));
|
||||
ui->rssiAlarmCriticalLabel->setText(tr("Critical Alarm"));
|
||||
}
|
||||
|
||||
/*if (IS_ARM(firmware->getBoard())) {
|
||||
@@ -1001,27 +1003,27 @@ void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm1CB_currentIndexChanged(int index)
|
||||
void TelemetryPanel::on_rssiAlarmWarningCB_currentIndexChanged(int index)
|
||||
{
|
||||
model->frsky.rssiAlarms[0].level = index;
|
||||
model->rssiAlarms.level[0] = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2CB_currentIndexChanged(int index)
|
||||
void TelemetryPanel::on_rssiAlarmCriticalCB_currentIndexChanged(int index)
|
||||
{
|
||||
model->frsky.rssiAlarms[1].level = index;
|
||||
model->rssiAlarms.level[1] = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm1SB_editingFinished()
|
||||
void TelemetryPanel::on_rssiAlarmWarningSB_editingFinished()
|
||||
{
|
||||
model->frsky.rssiAlarms[0].value = ui->rssiAlarm1SB->value();
|
||||
model->rssiAlarms.warning= ui->rssiAlarmWarningSB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_rssiAlarm2SB_editingFinished()
|
||||
void TelemetryPanel::on_rssiAlarmCriticalSB_editingFinished()
|
||||
{
|
||||
model->frsky.rssiAlarms[1].value = ui->rssiAlarm2SB->value();
|
||||
model->rssiAlarms.critical = ui->rssiAlarmCriticalSB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
@@ -138,10 +138,10 @@ class TelemetryPanel : public ModelPanel
|
||||
void onModified();
|
||||
void on_frskyProtoCB_currentIndexChanged(int index);
|
||||
void on_bladesCount_editingFinished();
|
||||
void on_rssiAlarm1CB_currentIndexChanged(int index);
|
||||
void on_rssiAlarm2CB_currentIndexChanged(int index);
|
||||
void on_rssiAlarm1SB_editingFinished();
|
||||
void on_rssiAlarm2SB_editingFinished();
|
||||
void on_rssiAlarmWarningCB_currentIndexChanged(int index);
|
||||
void on_rssiAlarmCriticalCB_currentIndexChanged(int index);
|
||||
void on_rssiAlarmWarningSB_editingFinished();
|
||||
void on_rssiAlarmCriticalSB_editingFinished();
|
||||
void on_varioLimitMin_DSB_editingFinished();
|
||||
void on_varioLimitMax_DSB_editingFinished();
|
||||
void on_varioLimitCenterMin_DSB_editingFinished();
|
||||
|
||||
@@ -74,8 +74,38 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="rssiAlarmWarningCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>----</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="rssiAlarm1Label">
|
||||
<widget class="QLabel" name="rssiAlarmWarningLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -96,8 +126,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="rssiAlarm1CB">
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="rssiAlarmCriticalCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -126,36 +156,8 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="rssiAlarm1SB">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="rssiAlarm2Label">
|
||||
<widget class="QLabel" name="rssiAlarmCriticalLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -173,38 +175,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="rssiAlarm2CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>----</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yellow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Orange</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Red</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="rssiAlarm2SB">
|
||||
<widget class="QSpinBox" name="rssiAlarmCriticalSB">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -231,7 +203,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="rssiAlarmWarningSB">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="rssiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RSSI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -244,16 +257,10 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="rssiLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="AutoCheckBox" name="disableTelemetryAlarms">
|
||||
<property name="text">
|
||||
<string>RSSI</string>
|
||||
<string>Disable telemetry audio warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1024,10 +1031,10 @@
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>telemetryProtocol</tabstop>
|
||||
<tabstop>rssiAlarm1CB</tabstop>
|
||||
<tabstop>rssiAlarm1SB</tabstop>
|
||||
<tabstop>rssiAlarm2CB</tabstop>
|
||||
<tabstop>rssiAlarm2SB</tabstop>
|
||||
<tabstop>rssiAlarmWarningCB</tabstop>
|
||||
<tabstop>rssiAlarmWarningSB</tabstop>
|
||||
<tabstop>rssiAlarmCriticalCB</tabstop>
|
||||
<tabstop>rssiAlarmCriticalSB</tabstop>
|
||||
<tabstop>varioSource</tabstop>
|
||||
<tabstop>varioLimitMin_DSB</tabstop>
|
||||
<tabstop>varioLimitCenterMin_DSB</tabstop>
|
||||
|
||||
@@ -45,6 +45,14 @@ ModelPrinter::~ModelPrinter()
|
||||
{
|
||||
}
|
||||
|
||||
QString ModelPrinter::printBoolean(bool val)
|
||||
{
|
||||
if (val)
|
||||
return tr("Y");
|
||||
else
|
||||
return tr("N");
|
||||
}
|
||||
|
||||
void debugHtml(const QString & html)
|
||||
{
|
||||
QFile file("foo.html");
|
||||
@@ -119,7 +127,9 @@ QString ModelPrinter::printModuleProtocol(unsigned int protocol)
|
||||
"PPM16", "PPMsim",
|
||||
"FrSky XJT (D16)", "FrSky XJT (D8)", "FrSky XJT (LR12)", "FrSky DJT",
|
||||
"Crossfire",
|
||||
"DIY Multiprotocol Module"
|
||||
"DIY Multiprotocol Module",
|
||||
"FrSky R9M Module",
|
||||
"SBUS output at VBat"
|
||||
};
|
||||
|
||||
return CHECK_IN_ARRAY(strings, protocol);
|
||||
@@ -130,7 +140,7 @@ QString ModelPrinter::printMultiRfProtocol(int rfProtocol, bool custom)
|
||||
static const char *strings[] = {
|
||||
"FlySky", "Hubsan", "FrSky", "Hisky", "V2x2", "DSM", "Devo", "YD717", "KN", "SymaX", "SLT", "CX10", "CG023",
|
||||
"Bayang", "ESky", "MT99XX", "MJXQ", "Shenqi", "FY326", "SFHSS", "J6 PRO","FQ777","Assan","Hontai","OLRS",
|
||||
"FlySky AFHDS2A", "Q2x2", "Walkera", "Q303", "GW008", "DM002"
|
||||
"FlySky AFHDS2A", "Q2x2", "Walkera", "Q303", "GW008", "DM002", "CABELL", "Esky 150", "H8 3D"
|
||||
};
|
||||
if (custom)
|
||||
return "Custom - proto " + QString::number(rfProtocol);
|
||||
@@ -138,7 +148,7 @@ QString ModelPrinter::printMultiRfProtocol(int rfProtocol, bool custom)
|
||||
return CHECK_IN_ARRAY(strings, rfProtocol);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printMultiSubType(int rfProtocol, bool custom, unsigned int subType) {
|
||||
QString ModelPrinter::printMultiSubType(unsigned rfProtocol, bool custom, unsigned int subType) {
|
||||
/* custom protocols */
|
||||
|
||||
if (custom)
|
||||
@@ -152,6 +162,39 @@ QString ModelPrinter::printMultiSubType(int rfProtocol, bool custom, unsigned in
|
||||
return "???";
|
||||
}
|
||||
|
||||
QString ModelPrinter::printR9MPowerValue(unsigned subType, unsigned val, bool telem)
|
||||
{
|
||||
static const QStringList strFTC = QStringList() << tr("10mW") << tr("100mW") << tr("500mW") << tr("1W");
|
||||
static const QStringList strLBT = QStringList() << tr("25mW") << tr("500mW");
|
||||
|
||||
|
||||
if (subType == 0 && (int)val < strFTC.size())
|
||||
return strFTC.at(val);
|
||||
else if (subType == 1)
|
||||
return (telem ? strLBT.at(0) : strLBT.at(1));
|
||||
else
|
||||
return "???";
|
||||
}
|
||||
|
||||
QString ModelPrinter::printModuleSubType(unsigned protocol, unsigned subType, unsigned rfProtocol, bool custom)
|
||||
{
|
||||
static const char * strings[] = {
|
||||
"FCC",
|
||||
"LBT(EU)"
|
||||
};
|
||||
|
||||
switch (protocol) {
|
||||
case PULSES_MULTIMODULE:
|
||||
return printMultiSubType(rfProtocol, custom, subType);
|
||||
|
||||
case PULSES_PXX_R9M:
|
||||
return CHECK_IN_ARRAY(strings, subType);
|
||||
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printModule(int idx) {
|
||||
const ModuleData &module = model.moduleData[idx];
|
||||
if (module.protocol == PULSES_OFF)
|
||||
@@ -165,6 +208,8 @@ QString ModelPrinter::printModule(int idx) {
|
||||
}
|
||||
if (module.protocol == PULSES_MULTIMODULE)
|
||||
result += " " + tr("radio Protocol %1, subType %2, option value %3").arg(printMultiRfProtocol(module.multi.rfProtocol, module.multi.customProto)).arg(printMultiSubType(module.multi.rfProtocol, module.multi.customProto, module.subType)).arg(module.multi.optionValue);
|
||||
else if (module.protocol == PULSES_PXX_R9M)
|
||||
result += " " + tr("Module Type: %1, Power: %2, Telemetry Enabled: %3").arg(printModuleSubType(module.protocol, module.subType)).arg(printR9MPowerValue(module.subType, module.pxx.power, module.pxx.sport_out)).arg(printBoolean(module.pxx.sport_out));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +348,8 @@ QString ModelPrinter::printGlobalVar(int flightModeIndex, int gvarIndex)
|
||||
const FlightModeData & fm = model.flightModeData[flightModeIndex];
|
||||
|
||||
if (fm.gvars[gvarIndex] <= 1024) {
|
||||
return QString("%1").arg(fm.gvars[gvarIndex]);
|
||||
//double val = fm.gvars[gvarIndex] * model.gvarData[gvarIndex].multiplierGet();
|
||||
return QString("%1").arg(fm.gvars[gvarIndex] * model.gvarData[gvarIndex].multiplierGet());
|
||||
}
|
||||
else {
|
||||
int num = fm.gvars[gvarIndex] - 1025;
|
||||
@@ -683,3 +729,80 @@ QString ModelPrinter::createCurveImage(int idx, QTextDocument * document)
|
||||
// qDebug() << "ModelPrinter::createCurveImage()" << idx << filename;
|
||||
return filename;
|
||||
}
|
||||
|
||||
QString ModelPrinter::printGlobalVarUnit(int idx)
|
||||
{
|
||||
return model.gvarData[idx].unitToString().toHtmlEscaped();
|
||||
}
|
||||
|
||||
QString ModelPrinter::printGlobalVarPrec(int idx)
|
||||
{
|
||||
return model.gvarData[idx].precToString().toHtmlEscaped();
|
||||
}
|
||||
|
||||
QString ModelPrinter::printGlobalVarMin(int idx)
|
||||
{
|
||||
return QString::number(model.gvarData[idx].getMinPrec());
|
||||
}
|
||||
|
||||
QString ModelPrinter::printGlobalVarMax(int idx)
|
||||
{
|
||||
return QString::number(model.gvarData[idx].getMaxPrec());
|
||||
}
|
||||
|
||||
QString ModelPrinter::printGlobalVarPopup(int idx)
|
||||
{
|
||||
return printBoolean(model.gvarData[idx].popup);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputValueGVar(int val)
|
||||
{
|
||||
QString result = "";
|
||||
if (abs(val) > 10000) {
|
||||
if (val < 0)
|
||||
result = "-";
|
||||
result.append(RawSource(SOURCE_TYPE_GVAR, abs(val)-10001).toString(&model));
|
||||
}
|
||||
else {
|
||||
if (val >= 0)
|
||||
result = "+";
|
||||
result.append(QString::number((qreal)val/10, 'f', 1) + "%");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputOffset(int idx)
|
||||
{
|
||||
return printOutputValueGVar(model.limitData[idx].offset);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputMin(int idx)
|
||||
{
|
||||
return printOutputValueGVar(model.limitData[idx].min);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputMax(int idx)
|
||||
{
|
||||
return printOutputValueGVar(model.limitData[idx].max);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputRevert(int idx)
|
||||
{
|
||||
return model.limitData[idx].revertToString();
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputPpmCenter(int idx)
|
||||
{
|
||||
return QString::number(model.limitData[idx].ppmCenter + 1500);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputCurve(int idx)
|
||||
{
|
||||
return CurveReference(CurveReference::CURVE_REF_CUSTOM, model.limitData[idx].curve.value).toString(&model, false);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printOutputSymetrical(int idx)
|
||||
{
|
||||
return printBoolean(model.limitData[idx].symetrical);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,15 @@ class ModelPrinter: public QObject
|
||||
ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model);
|
||||
virtual ~ModelPrinter();
|
||||
|
||||
QString printBoolean(bool val);
|
||||
QString printEEpromSize();
|
||||
QString printTrimIncrementMode();
|
||||
QString printThrottleTrimMode();
|
||||
static QString printModuleProtocol(unsigned int protocol);
|
||||
static QString printMultiRfProtocol(int rfProtocol, bool custom);
|
||||
static QString printMultiSubType(int rfProtocol, bool custom, unsigned int subType);
|
||||
static QString printR9MPowerValue(unsigned subType, unsigned val, bool telem);
|
||||
static QString printMultiSubType(unsigned rfProtocol, bool custom, unsigned int subType);
|
||||
static QString printModuleSubType(unsigned protocol, unsigned subType, unsigned rfProtocol = 0, bool custom = false);
|
||||
QString printFlightModeSwitch(const RawSwitch & swtch);
|
||||
QString printFlightModeName(int index);
|
||||
QString printFlightModes(unsigned int flightModes);
|
||||
@@ -82,6 +85,19 @@ class ModelPrinter: public QObject
|
||||
QString printCurveName(int idx);
|
||||
QString printCurve(int idx);
|
||||
QString createCurveImage(int idx, QTextDocument * document);
|
||||
QString printGlobalVarUnit(int idx);
|
||||
QString printGlobalVarPrec(int idx);
|
||||
QString printGlobalVarMin(int idx);
|
||||
QString printGlobalVarMax(int idx);
|
||||
QString printGlobalVarPopup(int idx);
|
||||
QString printOutputValueGVar(int val);
|
||||
QString printOutputOffset(int idx);
|
||||
QString printOutputMin(int idx);
|
||||
QString printOutputMax(int idx);
|
||||
QString printOutputRevert(int idx);
|
||||
QString printOutputCurve(int idx);
|
||||
QString printOutputPpmCenter(int idx);
|
||||
QString printOutputSymetrical(int idx);
|
||||
|
||||
private:
|
||||
Firmware * firmware;
|
||||
|
||||
@@ -162,7 +162,7 @@ QString MultiModelPrinter::print(QTextDocument * document)
|
||||
str += printFlightModes();
|
||||
str += printInputs();
|
||||
str += printMixers();
|
||||
str += printLimits();
|
||||
str += printOutputs();
|
||||
str += printCurves(document);
|
||||
if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes))
|
||||
str += printGvars();
|
||||
@@ -307,18 +307,64 @@ QString MultiModelPrinter::printFlightModes()
|
||||
if ((gvars && firmware->getCapability(GvarsFlightModes)) || firmware->getCapability(RotaryEncoders)) {
|
||||
MultiColumns columns(modelPrinterMap.size());
|
||||
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
|
||||
columns.append("<tr><td><b>" + tr("Flight mode") + "</b></td>");
|
||||
columns.append("<tr><td><b>" + tr("Global variables") + "</b></td>");
|
||||
if (firmware->getCapability(GvarsFlightModes)) {
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td><b>" + tr("GV%1").arg(i+1) + "</b><br/>");
|
||||
COMPARE(model->gvars_names[i]);
|
||||
columns.append("</td>");
|
||||
columns.append("<td><b>" + tr("GV%1").arg(i+1) + "</b></td>");
|
||||
}
|
||||
}
|
||||
for (int i=0; i<firmware->getCapability(RotaryEncoders); i++) {
|
||||
columns.append("<td><b>" + tr("RE%1").arg(i+1) + "</b></td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
|
||||
if (firmware->getCapability(GvarsFlightModes)) {
|
||||
columns.append("<tr><td><b>Name</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(model->gvarData[i].name);
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
columns.append("<tr><td><b>Unit</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printGlobalVarUnit(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
columns.append("<tr><td><b>Prec</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printGlobalVarPrec(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
columns.append("<tr><td><b>Min</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printGlobalVarMin(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
columns.append("<tr><td><b>Max</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printGlobalVarMax(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
columns.append("<tr><td><b>Popup</b></td>");
|
||||
for (int i=0; i<gvars; i++) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printGlobalVarPopup(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
}
|
||||
|
||||
columns.append("<tr><td><b>" + tr("Flight mode") + "</b></td></tr>");
|
||||
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
columns.append("<tr><td><b>" + tr("FM%1").arg(i) + "</b> ");
|
||||
COMPARE(model->flightModeData[i].name);
|
||||
@@ -344,18 +390,24 @@ QString MultiModelPrinter::printFlightModes()
|
||||
return str;
|
||||
}
|
||||
|
||||
QString MultiModelPrinter::printLimits()
|
||||
QString MultiModelPrinter::printOutputs()
|
||||
{
|
||||
QString str = printTitle(tr("Limits"));
|
||||
QString str = printTitle(tr("Outputs"));
|
||||
MultiColumns columns(modelPrinterMap.size());
|
||||
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>" \
|
||||
"<tr>" \
|
||||
" <td><b>" + tr("Channel") + "</b></td>" \
|
||||
" <td><b>" + tr("Offset") + "</b></td>" \
|
||||
" <td><b>" + tr("Min") + "</b></td>" \
|
||||
" <td><b>" + tr("Max") + "</b></td>" \
|
||||
" <td><b>" + tr("Invert") + "</b></td>" \
|
||||
"</tr>");
|
||||
"<td><b>" + tr("Channel") + "</b></td>" \
|
||||
"<td><b>" + tr("Subtrim") + "</b></td>" \
|
||||
"<td><b>" + tr("Min") + "</b></td>" \
|
||||
"<td><b>" + tr("Max") + "</b></td>" \
|
||||
"<td><b>" + tr("Direct") + "</b></td>");
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard()))
|
||||
columns.append(" <td><b>" + tr("Curve") + "</b></td>");
|
||||
if (firmware->getCapability(PPMCenter))
|
||||
columns.append(" <td><b>" + tr("PPM") + "</b></td>");
|
||||
if (firmware->getCapability(SYMLimits))
|
||||
columns.append(" <td><b>" + tr("Linear") + "</b></td>");
|
||||
columns.append("</tr>");
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
int count = 0;
|
||||
for (int k=0; k < modelPrinterMap.size(); k++)
|
||||
@@ -365,15 +417,30 @@ QString MultiModelPrinter::printLimits()
|
||||
columns.append("<tr><td><b>");
|
||||
COMPARE(modelPrinter->printChannelName(i));
|
||||
columns.append("</td><td>");
|
||||
COMPARE(model->limitData[i].offsetToString());
|
||||
COMPARE(modelPrinter->printOutputOffset(i));
|
||||
columns.append("</td><td>");
|
||||
COMPARE(model->limitData[i].minToString());
|
||||
COMPARE(modelPrinter->printOutputMin(i));
|
||||
columns.append("</td><td>");
|
||||
COMPARE(model->limitData[i].maxToString());
|
||||
COMPARE(modelPrinter->printOutputMax(i));
|
||||
columns.append("</td><td>");
|
||||
COMPARE(model->limitData[i].revertToString());
|
||||
columns.append("</td></tr>");
|
||||
|
||||
COMPARE(modelPrinter->printOutputRevert(i));
|
||||
columns.append("</td>");
|
||||
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printOutputCurve(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
if (firmware->getCapability(PPMCenter)) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printOutputPpmCenter(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
if (firmware->getCapability(SYMLimits)) {
|
||||
columns.append("<td>");
|
||||
COMPARE(modelPrinter->printOutputSymetrical(i));
|
||||
columns.append("</td>");
|
||||
}
|
||||
columns.append("</tr>");
|
||||
}
|
||||
columns.append("</table>");
|
||||
str.append(columns.print());
|
||||
@@ -572,14 +639,19 @@ QString MultiModelPrinter::printTelemetry()
|
||||
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>");
|
||||
for (int i=0; i<2; i++) {
|
||||
columns.append("<tr><td><b>" + QString(i==0 ? tr("RSSI Alarms") : "") + "</b></td><td>");
|
||||
if (IS_HORUS_OR_TARANIS(getCurrentBoard())) {
|
||||
if (IS_ARM(getCurrentBoard())) {
|
||||
COMPARE(i==0 ? tr("Low Alarm") : tr("Critical Alarm"));
|
||||
}
|
||||
else {
|
||||
COMPARE(getFrSkyAlarmType(model->frsky.rssiAlarms[i].level));
|
||||
COMPARE(getFrSkyAlarmType(model->rssiAlarms.level[i]));
|
||||
}
|
||||
columns.append("</td><td><</td><td>");
|
||||
COMPARE(QString::number(model->frsky.rssiAlarms[i].value, 10));
|
||||
if (i == 0) {
|
||||
COMPARE(QString::number(model->rssiAlarms.warning, 10));
|
||||
}
|
||||
else {
|
||||
COMPARE(QString::number(model->rssiAlarms.critical, 10));
|
||||
}
|
||||
columns.append("</td></tr>");
|
||||
}
|
||||
columns.append("</table><br/>");
|
||||
|
||||
@@ -66,7 +66,7 @@ class MultiModelPrinter: public QObject
|
||||
QString printSetup();
|
||||
QString printHeliSetup();
|
||||
QString printFlightModes();
|
||||
QString printLimits();
|
||||
QString printOutputs();
|
||||
QString printInputs();
|
||||
QString printMixers();
|
||||
QString printCurves(QTextDocument * document);
|
||||
|
||||
@@ -45,8 +45,8 @@ static const QStringList STR_SUBTYPE_YD717 {"YD717", "Skywalker", "Syma X2", "
|
||||
static const QStringList STR_SUBTYPE_SYMAX {"Standard", "Syma X5C"};
|
||||
static const QStringList STR_SUBTYPE_SLT {"SLT", "Vista"};
|
||||
static const QStringList STR_SUBTYPE_CX10 {"Green", "Blue", "DM007", "-", "JC3015a", "JC3015b", "MK33041", "Q242"};
|
||||
static const QStringList STR_SUBTYPE_CG023 {"CG023", "YD829", "H8 3D"};
|
||||
static const QStringList STR_SUBTYPE_BAYANG {"Bayang", "H8S3D"};
|
||||
static const QStringList STR_SUBTYPE_CG023 {"CG023", "YD829"};
|
||||
static const QStringList STR_SUBTYPE_BAYANG {"Bayang", "H8S3D", "X16 AH", "IRDRONE"};
|
||||
static const QStringList STR_SUBTYPE_KN {"WLtoys", "FeiLun"};
|
||||
static const QStringList STR_SUBTYPE_MT99 {"MT99", "H7", "YZ", "LS", "FY805"};
|
||||
static const QStringList STR_SUBTYPE_MJXQ {"WLH08", "X600", "X800", "H26D", "E010", "H26WH"};
|
||||
@@ -56,39 +56,43 @@ static const QStringList STR_SUBTYPE_AFHDS2A {"PWM and IBUS", "PPM and IBUS", "P
|
||||
static const QStringList STR_SUBTYPE_Q2X2 {"Q222", "Q242", "Q282"};
|
||||
static const QStringList STR_SUBTYPE_WK2x01 {"WK2801", "WK2401", "W6_5_1", "W6_6_1", "W6_HEL", "W6_HEL_I"};
|
||||
static const QStringList STR_SUBTYPE_Q303 {"Q303", "CX35", "CX10D", "CX10WD"};
|
||||
static const QStringList STR_SUBTYPE_CABELL {"CABELL V3","C TELEM","-","-","-","-","F_SAFE","UNBIND"};
|
||||
static const QStringList STR_SUBTYPE_H83D {"H8_3D","H20H","H20Mini","H30Mini"};
|
||||
static const QStringList NO_SUBTYPE {STR_MULTI_DEFAULT};
|
||||
|
||||
|
||||
// Table is designed to be shared with gui_common_arm.cpp
|
||||
|
||||
const Multiprotocols multiProtocols {
|
||||
{ MM_RF_PROTO_FLYSKY, STR_SUBTYPE_FLYSKY, 4, nullptr },
|
||||
{ MM_RF_PROTO_HUBSAN, NO_SUBTYPE, 0, STR_MULTI_VIDFREQ },
|
||||
{ MM_RF_PROTO_FRSKY, STR_SUBTYPE_FRSKY, 5, STR_MULTI_RFTUNE },
|
||||
{ MM_RF_PROTO_HISKY, STR_SUBTYPE_HISKY, 1, nullptr },
|
||||
{ MM_RF_PROTO_V2X2, STR_SUBTYPE_V2X2, 1, nullptr },
|
||||
{ MM_RF_PROTO_DSM2, STR_SUBTYPE_DSM, 3, nullptr },
|
||||
{ MM_RF_PROTO_YD717, STR_SUBTYPE_YD717, 4, nullptr },
|
||||
{ MM_RF_PROTO_KN, STR_SUBTYPE_KN, 1, nullptr },
|
||||
{ MM_RF_PROTO_SYMAX, STR_SUBTYPE_SYMAX, 1, nullptr },
|
||||
{ MM_RF_PROTO_SLT, STR_SUBTYPE_SLT, 1, nullptr },
|
||||
{ MM_RF_PROTO_CX10, STR_SUBTYPE_CX10, 7, nullptr },
|
||||
{ MM_RF_PROTO_CG023, STR_SUBTYPE_CG023, 2, nullptr },
|
||||
{ MM_RF_PROTO_BAYANG, STR_SUBTYPE_BAYANG, 1, STR_MULTI_TELEMETRY },
|
||||
{ MM_RF_PROTO_MT99XX, STR_SUBTYPE_MT99, 4, nullptr },
|
||||
{ MM_RF_PROTO_MJXQ, STR_SUBTYPE_MJXQ, 5, nullptr },
|
||||
{ MM_RF_PROTO_FY326, STR_SUBTYPE_FY326, 1, nullptr },
|
||||
{ MM_RF_PROTO_SFHSS, NO_SUBTYPE, 0, STR_MULTI_RFTUNE },
|
||||
{ MM_RF_PROTO_HONTAI, STR_SUBTYPE_HONTAI, 2, nullptr },
|
||||
{ MM_RF_PROTO_OLRS, NO_SUBTYPE, 0, STR_MULTI_RFPOWER },
|
||||
{ MM_RF_PROTO_FS_AFHDS2A, STR_SUBTYPE_AFHDS2A, 3, STR_MULTI_SERVOFREQ },
|
||||
{ MM_RF_PROTO_Q2X2, STR_SUBTYPE_Q2X2, 2, nullptr },
|
||||
{ MM_RF_PROTO_WK_2X01, STR_SUBTYPE_WK2x01, 5, nullptr },
|
||||
{ MM_RF_PROTO_Q303, STR_SUBTYPE_Q303, 3, nullptr },
|
||||
{ MM_RF_CUSTOM_SELECTED, STR_SUBTYPE_CUSTOM, 7, STR_MULTI_OPTION },
|
||||
{MM_RF_PROTO_FLYSKY, 4, false, STR_SUBTYPE_FLYSKY, nullptr},
|
||||
{MM_RF_PROTO_HUBSAN, 0, false, NO_SUBTYPE, STR_MULTI_VIDFREQ},
|
||||
{MM_RF_PROTO_FRSKY, 5, false, STR_SUBTYPE_FRSKY, STR_MULTI_RFTUNE},
|
||||
{MM_RF_PROTO_HISKY, 1, false, STR_SUBTYPE_HISKY, nullptr},
|
||||
{MM_RF_PROTO_V2X2, 1, false, STR_SUBTYPE_V2X2, nullptr},
|
||||
{MM_RF_PROTO_DSM2, 3, false, STR_SUBTYPE_DSM, nullptr},
|
||||
{MM_RF_PROTO_YD717, 4, false, STR_SUBTYPE_YD717, nullptr},
|
||||
{MM_RF_PROTO_KN, 1, false, STR_SUBTYPE_KN, nullptr},
|
||||
{MM_RF_PROTO_SYMAX, 1, false, STR_SUBTYPE_SYMAX, nullptr},
|
||||
{MM_RF_PROTO_SLT, 1, false, STR_SUBTYPE_SLT, nullptr},
|
||||
{MM_RF_PROTO_CX10, 7, false, STR_SUBTYPE_CX10, nullptr},
|
||||
{MM_RF_PROTO_CG023, 1, false, STR_SUBTYPE_CG023, nullptr},
|
||||
{MM_RF_PROTO_BAYANG, 3, false, STR_SUBTYPE_BAYANG, STR_MULTI_TELEMETRY},
|
||||
{MM_RF_PROTO_MT99XX, 4, false, STR_SUBTYPE_MT99, nullptr},
|
||||
{MM_RF_PROTO_MJXQ, 5, false, STR_SUBTYPE_MJXQ, nullptr},
|
||||
{MM_RF_PROTO_FY326, 1, false, STR_SUBTYPE_FY326, nullptr},
|
||||
{MM_RF_PROTO_SFHSS, 0, true, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MM_RF_PROTO_HONTAI, 2, false, STR_SUBTYPE_HONTAI, nullptr},
|
||||
{MM_RF_PROTO_OLRS, 0, false, NO_SUBTYPE, STR_MULTI_RFPOWER},
|
||||
{MM_RF_PROTO_FS_AFHDS2A, 3, true, STR_SUBTYPE_AFHDS2A, STR_MULTI_SERVOFREQ},
|
||||
{MM_RF_PROTO_Q2X2, 2, false, STR_SUBTYPE_Q2X2, nullptr},
|
||||
{MM_RF_PROTO_WK_2X01, 5, false, STR_SUBTYPE_WK2x01, nullptr},
|
||||
{MM_RF_PROTO_Q303, 3, false, STR_SUBTYPE_Q303, nullptr},
|
||||
{MM_RF_PROTO_CABELL, 7, false, STR_SUBTYPE_CABELL, STR_MULTI_OPTION},
|
||||
{MM_RF_PROTO_H83D, 3, false, STR_SUBTYPE_H83D, nullptr},
|
||||
{MM_RF_CUSTOM_SELECTED, 7, true, STR_SUBTYPE_CUSTOM, STR_MULTI_OPTION},
|
||||
|
||||
//Sential and default for protocols not listed above (MM_RF_CUSTOM is 0xff()
|
||||
{ 0xfe, NO_SUBTYPE, 0, nullptr }
|
||||
// Sentinel and default for protocols not listed above (MM_RF_CUSTOM is 0xff)
|
||||
{ 0xfe, 0, false, NO_SUBTYPE, nullptr}
|
||||
};
|
||||
|
||||
int Multiprotocols::MultiProtocolDefinition::getOptionMin() const {
|
||||
|
||||
@@ -34,13 +34,15 @@ class Multiprotocols
|
||||
|
||||
struct radio_mm_definition {
|
||||
int protocol;
|
||||
QStringList protocols;
|
||||
unsigned int maxSubtype;
|
||||
bool hasFailsafe;
|
||||
QStringList protocols;
|
||||
QString optionsstr;
|
||||
};
|
||||
|
||||
struct MultiProtocolDefinition {
|
||||
const int protocol;
|
||||
const bool hasFailsafe;
|
||||
const QStringList subTypeStrings;
|
||||
const QString optionsstr;
|
||||
|
||||
@@ -55,6 +57,7 @@ class Multiprotocols
|
||||
|
||||
MultiProtocolDefinition(const radio_mm_definition &rd) :
|
||||
protocol(rd.protocol),
|
||||
hasFailsafe(rd.hasFailsafe),
|
||||
subTypeStrings(rd.protocols),
|
||||
optionsstr(rd.optionsstr)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ RawSource RawSource::convert(Board::Type before, Board::Type after)
|
||||
}
|
||||
|
||||
if (IS_HORUS(after)) {
|
||||
if (IS_TARANIS_X9D(before) || IS_TARANIS_X7(before)) {
|
||||
if (IS_TARANIS_X9D(before)) {
|
||||
if (type == SOURCE_TYPE_STICK && index >= 7) {
|
||||
// LS and RS on Horus are after sliders L1 and L2
|
||||
index += 2;
|
||||
@@ -46,15 +46,33 @@ RawSource RawSource::convert(Board::Type before, Board::Type after)
|
||||
}
|
||||
}
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if (IS_TARANIS_X7(after)) {
|
||||
if (IS_TARANIS_X9(before) || IS_HORUS(before)) {
|
||||
if (type == SOURCE_TYPE_SWITCH && index >= 6) {
|
||||
index -= 2;
|
||||
// No S3, LS and RS on X7 board
|
||||
if (type == SOURCE_TYPE_STICK && index >= 6) {
|
||||
index = 5;
|
||||
}
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if ((IS_TARANIS_X9(before) || IS_HORUS(before)) && type == SOURCE_TYPE_SWITCH) {
|
||||
if (index == 4 || index == 6) {
|
||||
index = 3; // SG and SE to SD
|
||||
}
|
||||
else if (type == SOURCE_TYPE_SWITCH && index >= 4) {
|
||||
index -= 1;
|
||||
else if (index == 5) {
|
||||
index = 4; // SF to SF
|
||||
}
|
||||
else if (index == 7) {
|
||||
index = 5; // SH to SH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compensate for SE and SG on X9/Horus board if converting from X7
|
||||
if ((IS_TARANIS_X9(after) || IS_HORUS(after)) && IS_TARANIS_X7(before) && type == SOURCE_TYPE_SWITCH) {
|
||||
if (index == 4) {
|
||||
index = 5; // SF to SF
|
||||
}
|
||||
else if (index == 5) {
|
||||
index = 7; // SH to SH
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,30 +81,55 @@ RawSource RawSource::convert(Board::Type before, Board::Type after)
|
||||
|
||||
RawSwitch RawSwitch::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
if (!index || type != SWITCH_TYPE_SWITCH) {
|
||||
return *this; // no changes
|
||||
}
|
||||
|
||||
// SWI to SWR don't exist on !X9E board
|
||||
if (!IS_TARANIS_X9E(after) && IS_TARANIS_X9E(before)) {
|
||||
if (type == SWITCH_TYPE_SWITCH && index >= 24) {
|
||||
if (abs(index) > 24) {
|
||||
index = index % 24;
|
||||
}
|
||||
}
|
||||
|
||||
int srcIdx = div(abs(index)-1, 3).quot; // raw source index
|
||||
int delta = 0;
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if (IS_TARANIS_X7(after)) {
|
||||
if (IS_TARANIS_X9(before) || IS_HORUS(before)) {
|
||||
if (type == SWITCH_TYPE_SWITCH && index >= 18) {
|
||||
index -= 6;
|
||||
}
|
||||
else if (type == SWITCH_TYPE_SWITCH && index >= 12) {
|
||||
index -= 3;
|
||||
}
|
||||
if (IS_TARANIS_X7(after) && (IS_TARANIS_X9(before) || IS_HORUS(before))) {
|
||||
if (srcIdx == 4 || srcIdx == 5) {
|
||||
delta = 3; // SE to SD & SF to SF
|
||||
}
|
||||
else if (srcIdx == 6) {
|
||||
delta = 9; // SG to SD
|
||||
}
|
||||
else if (srcIdx == 7) {
|
||||
delta = 6; // SH to SH
|
||||
}
|
||||
}
|
||||
|
||||
// Compensate for SE and SG on X9/Horus board if converting from X7
|
||||
if ((IS_TARANIS_X9(after) || IS_HORUS(after)) && IS_TARANIS_X7(before)) {
|
||||
if (srcIdx == 4) {
|
||||
delta = -3; // SF to SF
|
||||
}
|
||||
else if (srcIdx == 5) {
|
||||
delta = -6; // SH to SH
|
||||
}
|
||||
}
|
||||
|
||||
if (index < 0) {
|
||||
delta = -delta; // invert for !switch
|
||||
}
|
||||
|
||||
index -= delta;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ExpoData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
srcRaw.convert(before, after);
|
||||
swtch.convert(before, after);
|
||||
}
|
||||
|
||||
@@ -125,6 +168,8 @@ void LogicalSwitchData::convert(Board::Type before, Board::Type after)
|
||||
void CustomFunctionData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
swtch.convert(before, after);
|
||||
if (func == FuncVolume || func == FuncPlayValue || (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast && adjustMode == 1))
|
||||
param = RawSource(param).convert(before, after).toValue();
|
||||
}
|
||||
|
||||
void FlightModeData::convert(Board::Type before, Board::Type after)
|
||||
@@ -160,6 +205,10 @@ void GeneralSettings::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
// Here we can add explicit conversions when moving from one board to another
|
||||
|
||||
for (int i=0; i<CPN_MAX_SPECIAL_FUNCTIONS; i++) {
|
||||
customFn[i].convert(before, after);
|
||||
}
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if (IS_TARANIS_X7(after)) {
|
||||
if (IS_TARANIS_X9(before) || IS_HORUS(before)) {
|
||||
@@ -169,6 +218,16 @@ void GeneralSettings::convert(Board::Type before, Board::Type after)
|
||||
memcpy(switchName[5], switchName[7], sizeof(switchName[5]));
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(after)) {
|
||||
unsigned int min_contrast = getCurrentFirmware()->getCapability(MinContrast);
|
||||
unsigned int max_contrast = getCurrentFirmware()->getCapability(MaxContrast);
|
||||
|
||||
if (contrast < min_contrast)
|
||||
contrast = min_contrast;
|
||||
else if (contrast > max_contrast)
|
||||
contrast = max_contrast;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,4 +313,9 @@ void RadioData::convert(Board::Type before, Board::Type after)
|
||||
if (IS_HORUS(after)) {
|
||||
fixModelFilenames();
|
||||
}
|
||||
|
||||
// ensure proper number of model slots
|
||||
if (getCurrentFirmware()->getCapability(Models) && getCurrentFirmware()->getCapability(Models) != (int)models.size()) {
|
||||
models.resize(getCurrentFirmware()->getCapability(Models));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,9 @@ enum RawSwitchType {
|
||||
SWITCH_TYPE_OFF,
|
||||
SWITCH_TYPE_ONE,
|
||||
SWITCH_TYPE_FLIGHT_MODE,
|
||||
SWITCH_TYPE_TIMER_MODE
|
||||
SWITCH_TYPE_TIMER_MODE,
|
||||
SWITCH_TYPE_TELEMETRY,
|
||||
SWITCH_TYPE_SENSOR,
|
||||
};
|
||||
|
||||
class RawSwitch {
|
||||
@@ -278,7 +280,7 @@ class RawSwitch {
|
||||
return index >= 0 ? (type * 256 + index) : -(type * 256 - index);
|
||||
}
|
||||
|
||||
QString toString(Board::Type board = Board::BOARD_UNKNOWN, const GeneralSettings * const generalSettings = NULL) const;
|
||||
QString toString(Board::Type board = Board::BOARD_UNKNOWN, const GeneralSettings * const generalSettings = NULL, const ModelData * const modelData = NULL) const;
|
||||
|
||||
bool operator== ( const RawSwitch& other) {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
@@ -591,12 +593,20 @@ class FrSkyAlarmData {
|
||||
void clear() { memset(this, 0, sizeof(FrSkyAlarmData)); }
|
||||
};
|
||||
|
||||
class FrSkyRSSIAlarm {
|
||||
class RSSIAlarmData {
|
||||
public:
|
||||
FrSkyRSSIAlarm() { clear(0, 50); }
|
||||
unsigned int level;
|
||||
int value;
|
||||
void clear(unsigned int level, int value) { this->level = level; this->value = value;}
|
||||
RSSIAlarmData() { clear(); }
|
||||
unsigned int level[2]; // AVR Only
|
||||
int warning;
|
||||
int critical;
|
||||
bool disabled;
|
||||
void clear() {
|
||||
this->level[0] = 2;
|
||||
this->level[1] = 3;
|
||||
this->warning = 45;
|
||||
this->critical = 42;
|
||||
this->disabled = false;
|
||||
}
|
||||
};
|
||||
|
||||
class FrSkyChannelData {
|
||||
@@ -615,8 +625,8 @@ class FrSkyChannelData {
|
||||
|
||||
struct FrSkyBarData {
|
||||
RawSource source;
|
||||
unsigned int barMin; // minimum for bar display
|
||||
unsigned int barMax; // ditto for max display (would usually = ratio)
|
||||
int barMin; // minimum for bar display
|
||||
int barMax; // ditto for max display (would usually = ratio)
|
||||
};
|
||||
|
||||
struct FrSkyLineData {
|
||||
@@ -703,7 +713,6 @@ class FrSkyData {
|
||||
unsigned int altitudeSource;
|
||||
unsigned int currentSource;
|
||||
FrSkyScreenData screens[4];
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
unsigned int varioSource;
|
||||
bool varioCenterSilent;
|
||||
int varioMin;
|
||||
@@ -765,6 +774,8 @@ enum PulsesProtocol {
|
||||
PULSES_PXX_DJT,
|
||||
PULSES_CROSSFIRE,
|
||||
PULSES_MULTIMODULE,
|
||||
PULSES_PXX_R9M,
|
||||
PULSES_SBUS,
|
||||
PULSES_PROTOCOL_LAST
|
||||
};
|
||||
|
||||
@@ -801,7 +812,10 @@ enum MultiModuleRFProtocols {
|
||||
MM_RF_PROTO_Q303,
|
||||
MM_RF_PROTO_GW008,
|
||||
MM_RF_PROTO_DM002,
|
||||
MM_RF_PROTO_LAST=MM_RF_PROTO_DM002
|
||||
MM_RF_PROTO_CABELL,
|
||||
MM_RF_PROTO_ESKY150,
|
||||
MM_RF_PROTO_H83D,
|
||||
MM_RF_PROTO_LAST=MM_RF_PROTO_H83D
|
||||
};
|
||||
|
||||
enum TrainerProtocol {
|
||||
@@ -840,6 +854,13 @@ class ModuleData {
|
||||
int optionValue;
|
||||
} multi;
|
||||
|
||||
struct {
|
||||
int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
|
||||
bool receiver_telem_off; // false = receiver telem enabled
|
||||
bool receiver_channel_9_16; // false = pwm out 1-8, true 9-16
|
||||
bool external_antenna; // false = internal antenna, true = external antenna
|
||||
bool sport_out;
|
||||
} pxx;
|
||||
|
||||
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
@@ -1006,6 +1027,44 @@ typedef char CustomScreenData[610+1];
|
||||
typedef char TopbarData[216+1];
|
||||
#endif
|
||||
|
||||
#define GVAR_NAME_LEN 3
|
||||
#define GVAR_MAX_VALUE 1024
|
||||
#define GVAR_MIN_VALUE -GVAR_MAX_VALUE
|
||||
|
||||
class GVarData {
|
||||
public:
|
||||
GVarData() { clear(); }
|
||||
|
||||
enum {
|
||||
GVAR_UNIT_NUMBER,
|
||||
GVAR_UNIT_PERCENT
|
||||
};
|
||||
|
||||
enum {
|
||||
GVAR_PREC_MUL10,
|
||||
GVAR_PREC_MUL1
|
||||
};
|
||||
|
||||
char name[GVAR_NAME_LEN+1];
|
||||
int min;
|
||||
int max;
|
||||
bool popup;
|
||||
unsigned int prec; // 0 0._ 1 0.0
|
||||
unsigned int unit; // 0 _ 1 %
|
||||
|
||||
void clear() {memset(this, 0, sizeof(GVarData)); }
|
||||
QString unitToString() const;
|
||||
QString precToString() const;
|
||||
int multiplierSet();
|
||||
float multiplierGet() const;
|
||||
void setMin(float val);
|
||||
void setMax(float val);
|
||||
int getMin() const;
|
||||
int getMax() const;
|
||||
float getMinPrec() const;
|
||||
float getMaxPrec() const;
|
||||
};
|
||||
|
||||
class ModelData {
|
||||
public:
|
||||
ModelData();
|
||||
@@ -1060,12 +1119,11 @@ class ModelData {
|
||||
bool potsWarningEnabled[CPN_MAX_POTS];
|
||||
int potPosition[CPN_MAX_POTS];
|
||||
bool displayChecklist;
|
||||
// TODO structure
|
||||
char gvars_names[CPN_MAX_GVARS][6+1];
|
||||
bool gvars_popups[CPN_MAX_GVARS];
|
||||
GVarData gvarData[CPN_MAX_GVARS];
|
||||
MavlinkData mavlink;
|
||||
unsigned int telemetryProtocol;
|
||||
FrSkyData frsky;
|
||||
RSSIAlarmData rssiAlarms;
|
||||
|
||||
char bitmap[10+1];
|
||||
|
||||
@@ -1094,6 +1152,7 @@ class ModelData {
|
||||
|
||||
bool isGVarLinked(int phaseIdx, int gvarIdx);
|
||||
int getGVarFieldValue(int phaseIdx, int gvarIdx);
|
||||
float getGVarFieldValuePrec(int phaseIdx, int gvarIdx);
|
||||
|
||||
ModelData removeGlobalVars();
|
||||
|
||||
@@ -1102,6 +1161,8 @@ class ModelData {
|
||||
|
||||
int getChannelsMax(bool forceExtendedLimits=false) const;
|
||||
|
||||
bool isAvailable(const RawSwitch & swtch) const;
|
||||
|
||||
protected:
|
||||
void removeGlobalVar(int & var);
|
||||
};
|
||||
@@ -1160,11 +1221,11 @@ class GeneralSettings {
|
||||
unsigned int view; // main screen view // TODO enum
|
||||
bool disableThrottleWarning;
|
||||
bool fai;
|
||||
int switchWarning; // -1=down, 0=off, 1=up
|
||||
bool disableMemoryWarning;
|
||||
BeeperMode beeperMode;
|
||||
bool disableAlarmWarning;
|
||||
bool enableTelemetryAlarm;
|
||||
bool disableRssiPoweroffAlarm;
|
||||
unsigned int usbMode;
|
||||
BeeperMode hapticMode;
|
||||
unsigned int stickMode; // TODO enum
|
||||
int timezone;
|
||||
@@ -1199,7 +1260,8 @@ class GeneralSettings {
|
||||
unsigned int globalTimer;
|
||||
bool bluetoothEnable;
|
||||
char bluetoothName[10+1];
|
||||
unsigned int btBaudrate;
|
||||
unsigned int bluetoothBaudrate;
|
||||
unsigned int bluetoothMode;
|
||||
unsigned int sticksGain;
|
||||
unsigned int rotarySteps;
|
||||
unsigned int countryCode;
|
||||
|
||||