Compare commits

..

382 Commits

Author SHA1 Message Date
3djc cca7180834 Release prep 2017-12-17 10:07:54 +01:00
Bertrand Songis 104ab8c7f3 Typo fix
Because omeone asked to to explain what means LDC today ...
2017-12-16 22:09:38 +01:00
Bertrand Songis e4d273aa0e Update CREDITS.txt 2017-12-16 17:12:32 +01:00
Bertrand Songis df61a1ab4e Update CREDITS.txt 2017-12-16 17:11:01 +01:00
Raphael Coeffic 1dcd8cc419 small fixes for french translation (#5517)
* fixed VKEYS french

fixes #5481

* fix french confirmation popup

fixes #5475
2017-12-16 15:42:26 +01:00
Max Paperno b55b68f191 [Companion] Fix incorrect Settings dialog tab shown by default (closes #5511). 2017-12-15 19:15:14 -05:00
3djc 2c2339e229 Merge pull request #5514 from opentx/bsongis/r9m_navigation_issue
R9M navigation issue (when external module is R9M-EU and internal mod…
2017-12-14 15:35:40 +01:00
Bertrand Songis d7645252bb Power issue with R9M (always max power) (#5513) 2017-12-14 15:34:14 +01:00
3djc dc89bb1dfc Fix SHUTDOWN_CONFIRMATION compile 2017-12-14 07:58:31 +01:00
Bertrand Songis 47383fd053 Update CREDITS.txt 2017-12-13 22:15:32 +01:00
Bertrand Songis f80406c7cb R9M navigation issue (when external module is R9M-EU and internal module is OFF) 2017-12-13 22:13:40 +01:00
3djc 75b382e619 Simply hide unavailable choices (#5509) 2017-12-13 12:51:01 +01:00
Bertrand Songis 566c616abb Update CREDITS.txt 2017-12-13 09:18:47 +01:00
Arne Schwabe 59d2ef8aa1 Rework rssi code a bit (#5507)
* Switch backlight on when displaying a warning.

This is especially visible on the power off RSSI warning. This will also show the other warnings at start with backlight, even when blocklight is set to always off. But my X9D+ will switch its backlight on after boot once even with backlight on, so backlight=off is not so off as it seems.

* Rework power rssi code a bit

- Cleanup shutdown_confirm code
- allow x9d+ to be compiled as power button too to be able to test these things on the x9d+
- Fix shutoff after 10s in warning dialog on x9d
- Make warning dialog always turn on backlight

* Revert CMakeLists.txt
2017-12-12 22:01:32 +01:00
3djc 977262232a Better handle interactions with internal module telemetry (#5506) 2017-12-12 20:32:53 +01:00
Bertrand Songis fa5895de39 Update CREDITS.txt 2017-12-11 19:27:40 +01:00
Sebastien Charpentier f2fb788eac Fixed some typo. (#5499) 2017-12-11 18:12:04 +01:00
Max Paperno c8c3b79f2d [X10] Accept old OTX_FOURCC for X12 as valid when reading data. (#5497) 2017-12-11 13:05:40 +01:00
Bertrand Songis 1c7012726a FourCC added for X10 (last minute change, not tested at all (#5495)
FourCC added for X10
2017-12-10 20:23:59 +01:00
Arne Schwabe e3bbbdcecf Fix compiler warning is Russian tts 2017-12-10 13:00:03 +01:00
Max Paperno 4e8867c819 [Companion] Include global functions and function source types in conversions. 2017-12-10 06:21:17 -05:00
Max Paperno cffb5e767f [Companion] Ensure proper number of model slots after radio data conversion. 2017-12-10 06:10:26 -05:00
Max Paperno 204711d313 [Companion] Fix possible out-of-bounds array access crash. 2017-12-10 06:05:41 -05:00
Max Paperno e43807540e [Companion] Adjust X10/S hardware options to match radio (no L1/L2/JSx/JSy). Fixes #5488 (#5493) 2017-12-10 10:09:24 +01:00
Bertrand Songis eb79d4f774 Update CREDITS.txt 2017-12-10 10:02:05 +01:00
Bertrand Songis e80b63f66f Update CREDITS.txt 2017-12-09 22:09:04 +01:00
Kilrah ada0712e1a French translations 2017-12-09 11:53:35 +01:00
3djc 0a7aece40f Inc SDCard version for RC2 2017-12-09 10:32:26 +01:00
3djc 63bcb4693d Merge pull request #5485 from opentx/LapinFou/Update_Wizard
Updated Wizard
2017-12-09 10:30:46 +01:00
Max Paperno dec630efa0 [X9] Allow LSs 33-64 in main view & fix X9E view of channels 17-32 (#5486)
* [212x64] Main view toggle LS groups 1-32 and 33-64 with +/-/encoder. Closes #5476

* [212x64] Also allow encoder events in channels view for switching channels range (fix for X9E).

* Pad LS range numerals to 2 digits.
2017-12-09 10:20:07 +01:00
Sebastien Charpentier 2a0984408f Updated French Translation (#5484)
* Initial version

* Updated French Translation.
2017-12-09 10:19:06 +01:00
3djc 8e5027dcb2 Better support for R9M EU (#5487)
* POC for X9, requires -DBINDING_OPTIONS=YES

* There are apparently 4 valid choices

* - make BINDING_OPTIONS part of standard code
- adapt R9M EU LBT dialog to choice on bind

* - remove option from Companion
- cosmetics

* Compilation fixes
2017-12-09 10:17:56 +01:00
3djc f489742c9e Fix German compilation 2017-12-09 09:23:54 +01:00
LapinFou bcc6e3c67d Updated Wizard: reduced mixers name to 6 caracters. 2017-12-08 16:53:18 +01:00
3djc 12ad7b0d9c Reorganize ana display for X7 (#5482) 2017-12-08 11:27:37 +01:00
Bertrand Songis a6044a684d Bsongis/r9 m fixes (#5406)
R9M support
2017-12-08 11:26:46 +01:00
Max Paperno 9c27947345 [Companion] Ensure no duplicates in recent files menu (thanks capitaineflam25). Fixes #5336 (#5478) 2017-12-08 09:26:01 +01:00
Max Paperno c96a30aea0 [Companion] Fix GVar min corrupted when upgrading from firmware <= v217 (fixes #5466). (#5477) 2017-12-08 09:25:22 +01:00
Raphael Coeffic 934578118b added support for min/max contrast to eeprom interface and use it (#5473)
Added support for min/max contrast to eeprom interface and use it. Fixes #5468
2017-12-07 22:10:24 +01:00
3djc 81dbebb663 Show multi failsafe to x7 UI (#5471)
* Show multi failsafe to x7 UI

* Cosmetics

* Fix also horus ui and remove useless ifs
2017-12-07 18:49:55 +01:00
Arne Schwabe afd3103506 Update multi protocols (#5461)
* Update multi protocols

* SFHSS also has failsafe implemented

* Show failsafe setting in Companion

* Fix missing protocol names

* Update failsafe format and only show bind when module reports to support it
2017-12-07 18:48:10 +01:00
Raphael Coeffic 8b34c96a2d fixed switch direction in X10 simulator (#5472) 2017-12-07 18:41:49 +01:00
Bertrand Songis ec2c4302cb Update CREDITS.txt 2017-12-07 18:12:07 +01:00
Alexander Novikov 23eeccec9c Ru tts (#5456)
Russian TTS
2017-12-05 20:02:10 +01:00
Bertrand Songis 421f16d0dd Update CREDITS.txt 2017-12-05 18:08:35 +01:00
Bertrand Songis cb73261c60 Update CREDITS.txt 2017-12-04 23:18:10 +01:00
Arne Schwabe 6bc02fd838 Add sane defaults for X10/X12. Also set battery warnings when creating general settings in simulator/companion (#5465) 2017-12-04 21:17:02 +01:00
3djc a7e4b0b062 Post RC1 fixes 2017-12-04 16:53:10 +01:00
3djc 4b75c42218 Fix 2017-12-04 07:50:45 +01:00
3djc 4a187699fa Fix for rc on strech 2017-12-04 07:45:58 +01:00
Bertrand Songis b4710f0f0c Update CREDITS.txt 2017-12-02 21:30:18 +01:00
Arne Schwabe 99c4c4a0ef add cgi build script 2017-12-01 19:51:21 +01:00
Sebastien Charpentier adb9a55719 Fr translation (#5451)
Fr translation.
2017-12-01 19:47:02 +01:00
3djc 078748243d RC auto increment 2017-12-01 19:45:29 +01:00
3djc eaa5c7a7b0 Suffix handling for RC builds 2017-12-01 19:41:59 +01:00
3djc 8dafd4680b Fix 2017-12-01 19:32:12 +01:00
3djc 6c6fc2d7db Workaround 2017-12-01 16:29:34 +01:00
3djc 3eccbc2963 Allow RC type version number ( translated 900 to 999) (#5450)
Allow RC type version number (translated 900 to 999)
2017-12-01 15:59:29 +01:00
3djc d90ac05d6e One settings to rule them all ! (#5449) 2017-12-01 11:54:30 +01:00
Bertrand Songis bdf0983642 Update CREDITS.txt 2017-11-30 23:39:26 +01:00
Neil Horne 16f219d6d3 Various model print fixes (#5433)
* Fixes #5411 print curve
Rename Limits to Outputs for consistency with radio and Companion
Fix gvars printed as values
Print PPM Center and Linear Subtrims

* code formatting
2017-11-30 19:14:02 +01:00
Max Paperno ba1073ace6 [Lua] Allow global functions to play scripts. (#5440) 2017-11-30 19:10:11 +01:00
Sebastien Charpentier 1d5c06ccd6 Fixed #5443 & Updated French translation (#5444)
* Initial version

* Updated French Translation.
Fixed and enhanced X7 Wizard.
2017-11-30 19:03:03 +01:00
Bertrand Songis afeba0d07e Update CREDITS.txt 2017-11-30 18:30:23 +01:00
3djc 4ad2bbdf2c Fix some server side build path 2017-11-30 12:02:53 +01:00
Bertrand Songis 0faee13bc3 A 3rd branch for RC compilation (#5441)
A 3rd branch for RC compilation
2017-11-30 11:51:22 +01:00
3djc e74349e36c Prep work 2017-11-29 18:05:51 +01:00
Bertrand Songis 2c2bbdd912 Update .travis.yml
Stop Sonar PR check
2017-11-29 12:58:13 +01:00
3djc d772cd39ea Allow RC builds 2017-11-29 10:17:28 +01:00
3djc 13f364d96a Add American time format to lua getDateTime() (#5431)
Add American time format to lua getDateTime()
2017-11-29 09:18:50 +01:00
3djc 779b39e237 Use X10 picture during X10 calibration (#5435)
* Use X10 picture during X10 calibration

* Scale down radio picture a little

* last x10 change requires a sd version bump

* Differentiate X10 and X10S
2017-11-29 09:17:33 +01:00
Max Paperno 0f34bf3850 [Companion] Fix crash when closing main window while model/radio editor is open and cursor is in a field which has editingFinished() event handler. 2017-11-27 07:05:18 -05:00
Max Paperno f085f11ea8 [Companion] Fix custom functions availability: set timer was available on AVR and screenshot on non-Taranis. 2017-11-27 06:18:11 -05:00
Kilrah 1c1624b8a6 [companion] Adjust GVAR not possible in global functions (fix #5425) 2017-11-26 23:03:43 +01:00
Max Paperno caa9cd3060 [Companion] Telemetry screen bar range limits were unsigned (but are signed on ARM radios), didn't allow negative values. 2017-11-25 14:56:49 -05:00
Max Paperno b8042c9da1 [Companion] Default RSSI low and critical alarm values were reversed (fixes #5407). 2017-11-25 14:36:46 -05:00
Bertrand Songis 478411bf82 [Sonar] Condition always evaluated to false 2017-11-24 09:27:45 +01:00
Damjan Adamic 49a63d43b3 Fix some bugs found by Sonar (#5392)
* Fix some bugs found by Sonar

* Different syntax for NOSONAR

* Switch Sonar badge to proper branch
2017-11-23 23:28:36 +01:00
Neil Horne 5b4dc4ee08 Fixes 4944 Skeleton input after cancel of add (#5397) 2017-11-23 23:27:26 +01:00
Max Paperno 2cf2603155 [Companion] Fix conversion of switches between X7 and X9/10/12 radios. (#5415)
* [Companion] Fix conversion of switches between X7 and X9/10/12 radios.

* [Companion] Also convert raw sources in ExpoData (inputs) when switching radio types.
2017-11-23 23:26:22 +01:00
3djc 462e5f05e6 Also play model name on model changes (#5416)
Fixes #5414
2017-11-23 23:25:38 +01:00
Max Paperno 3caf83e920 [Companion] Fix crash when editing model with gvars but no GvarsFlightModes (most AVR radios); Always show value label; Update unit/prec/min/max fields for Horus. (#5417) 2017-11-23 23:25:18 +01:00
Bertrand Songis 58df785d70 Revert ... 2017-11-23 14:25:13 +01:00
Bertrand Songis 4c0526ce0c Sonar fix - test
use `[[fallthrough]];` instead of `// no break`
2017-11-23 13:59:03 +01:00
Bertrand Songis 6c2de17229 Update README.md 2017-11-23 13:31:54 +01:00
Bertrand Songis d649420212 Fixes #5402 (#5405) 2017-11-22 21:08:13 +01:00
Sebastien Charpentier 7f53f340ad French Translation (#5409)
* Initial version before translation.

* Updated French translation.
2017-11-22 21:08:00 +01:00
3djc c4c5516315 fix typo 2017-11-22 20:15:39 +01:00
Andre Bernet 8662de39f5 USB modes cleanup (#5396)
* USB modes cleanup

* Forgot a couple

* Exclude joystick code from bootloader
2017-11-22 10:41:19 +01:00
Bertrand Songis f2cf444a64 Update CREDITS.txt 2017-11-22 10:35:49 +01:00
Max Paperno 1634d81e4a Fix brackets in MEGA2560 isBacklightEnabled() macro (caused comparison warning in simpgmspace.cpp). 2017-11-21 13:21:00 -05:00
Max Paperno 9c74cc215c Fix gvars build error on libsimulator for PCBSTD. 2017-11-21 11:54:55 -05:00
Kilrah 659f506e5f Build libsimulator on commit tests instead of simu 2017-11-21 17:48:32 +01:00
Kilrah 7df776e7ed Typo 2017-11-21 17:34:22 +01:00
Kilrah 5762fd61e9 Add GVARs option to commit tests 2017-11-21 17:28:56 +01:00
Andre Bernet 39ea315c97 Fix X10 power loop (fix #5270) (#5391)
* Fix X10 power loop (fix #5270)

* "EMERGENCY MODE" text wasn't visible anymore since d4a00dec3b
2017-11-21 07:25:38 +01:00
3djc 6fc40cb7cb Move to simple menu to prevent the need for dual RTN when scroll wheel is used (#5390) 2017-11-20 19:04:02 +01:00
Kilrah 0658b2a2c4 UI speedup 2017-11-20 12:47:32 +01:00
3djc 6064d3222b Cosmetics on companion radio names 2017-11-20 08:37:01 +01:00
3djc d13fb8918f - X7S option removed (#5388)
- runtime detection of bluetooth chip
2017-11-19 23:49:38 +01:00
Martin Hotar d11618eb3f x10 simulator skin fixes (#5389) 2017-11-19 17:47:08 +01:00
Bertrand Songis 3b4f5e0882 Update README.md 2017-11-19 16:49:26 +01:00
Bertrand Songis 01f5c65eb9 Update README.md 2017-11-19 16:38:10 +01:00
Bertrand Songis 94bdeb6929 Update README.md 2017-11-19 16:37:05 +01:00
Bertrand Songis f36615f1e2 Update README.md 2017-11-19 16:34:00 +01:00
Sonar agent ab4b159d06 Bsongis/sonar (#5382)
Sonar integration
2017-11-19 15:27:49 +01:00
Max Paperno 90e58e4a5f [Simulator] Fix coordinate of X10 skin encoder button. (#5387) 2017-11-19 14:31:23 +01:00
Max Paperno 7759403f3e [Simulator] Quick fix for showing gvars with precision and unit in Radio Outputs view (fixes #5360). (#5384) 2017-11-19 11:21:20 +01:00
Kilrah 18aa849cc7 Trainer detect on X10 is inverted compared to X12 (fix #5378) 2017-11-19 10:54:33 +01:00
Harpalyke a9c25d1935 Adding a button to the log viewer to save the currently selected session to its own CSV log file (#5379) 2017-11-18 12:14:55 +01:00
Andre Bernet 7f4daf3f5b Lua themes with no options wouldn't load anymore (got broken in b4939… (#5351)
* Lua themes with no options wouldn't load anymore (got broken in b493973d7d)

* Keep protection

* Changes according to PR comments
2017-11-18 11:59:59 +01:00
Neil Horne f7828ad4a3 Companion gvar refactor for special functions to match radio (#5361) 2017-11-18 11:25:46 +01:00
Raphael Coeffic 2631ad00bd allow additional cake params to be passed via env variables (#5371)
This allows for non-standard paths and the likes (helps a lot on OSX).
2017-11-18 11:24:16 +01:00
Raphael Coeffic d4a00dec3b small cosmetic colour changes (#5367)
Small cosmetic colour changes

This allows the RSSI/Tx-Battery/Volume display to be displayed with the proper background colour when changing the main theme colour. Also puts the background colour at some use, as I could not see it used anywhere.
2017-11-18 11:23:34 +01:00
Bertrand Songis 46e8474e77 Update CREDITS.txt 2017-11-18 09:24:17 +01:00
Martin Hotar c8dfccc365 X10 simu (#5376)
* X10 simu images

* X10 simu UI
2017-11-16 21:49:39 +01:00
3djc 2e14773f1a Make stat bottom bar text more V centered 2017-11-16 10:35:16 +01:00
Bertrand Songis 968fbd4c60 Update CREDITS.txt 2017-11-16 07:43:58 +01:00
Arne Schwabe 37b7b25208 Use IS_PXX instead of IS_XJT for failsafe, closes #5373 2017-11-15 22:19:47 +01:00
Bertrand Songis a2c6d60782 Update CREDITS.txt 2017-11-15 19:21:23 +01:00
Kilrah 808e44388a Update AND switch list on paste (fix #5365) 2017-11-15 10:22:10 +01:00
Kilrah f8ff44c78f No copy/paste on SF/LS (fix #5366) 2017-11-15 10:01:39 +01:00
3djc 7e29932072 Shift 3rd column a bit right (#5364) 2017-11-15 09:52:09 +01:00
Bertrand Songis c1b0e9fea3 Update CREDITS.txt 2017-11-14 18:17:21 +01:00
3djc df91e93034 Tiny cosmetic 2017-11-14 10:37:02 +01:00
Harpalyke fd265eccbb Adding regex check for crossfire gps format when reading logs in tele… (#5347)
* Adding regex check for crossfire gps format when reading logs in telemetry simulator

Adding a regex check when the telemetry simulator parses gps cords from a log file to see if the if the cords are in the crossfire gps log format. 
The GPS telemetry sensor from crossfire logs the coordinates as latitude with a precision of six decimal places followed by a space and then longitude also to six decimal places. e.g. "53.279969 -7.701416"
When the cords are already in this format their is no need to call convertDegMin on the values

* Fixing code styling

* Updating code style

* Updating code style

* Checking the gps coordinates format once before the full file is processed instead of evaluating the regex for every line of the file.

Optimize regex by removing surrounding parenthesis
2017-11-13 22:21:22 +01:00
Bertrand Songis 57d53abd6e Fixes #5300 (#5353) 2017-11-13 22:18:07 +01:00
Sebastien Charpentier c62e0cc7d1 Updated French Translation (#5356)
* Starting point before translation.

* Updated French translation.
2017-11-13 22:17:48 +01:00
Bertrand Songis e5b2b8ef64 Bsongis/issue 5311 (#5354)
Fixes #5311
2017-11-13 22:17:13 +01:00
Neil Horne e6542a78d0 Fix displayed file path for Windows OS (#5355) 2017-11-13 15:30:15 +01:00
Arne Schwabe 084680b5fd Fix custom string in multiprotocols companion 2017-11-13 11:11:41 +01:00
3djc bdfcc5d181 Improve commit tests 2017-11-13 10:55:19 +01:00
Arne Schwabe 2d6962d937 Also fix compiler warning on sky9x 2017-11-13 10:52:33 +01:00
Arne Schwabe d8210b832f Fix multi build on Sky9X 2017-11-13 10:42:25 +01:00
Kilrah ac22e33cec Missing def 2017-11-13 09:41:55 +01:00
Kilrah 7f05df2627 Only apply theme option changes when exiting edit mode for color type options (fix #3799) 2017-11-13 00:17:35 +01:00
Bertrand Songis 9d7dab724b Bsongis/issue 5338 (#5344)
Fixes #5338
2017-11-12 14:15:19 +01:00
3djc b8b67ba864 Push model name audio after hello (#5350) 2017-11-12 14:07:26 +01:00
Bertrand Songis f6309138f6 Fixes #5312 (#5345) 2017-11-11 22:20:05 +01:00
Sebastien Charpentier 7ca3f60999 Updated Wizard for X9 radios. (#4910) 2017-11-11 09:46:38 +01:00
Damjan Adamic f0f3e35bf6 Lua memory (de)allocation tracer: (#5191)
* Lua memory (de)allocation tracer:

Usage:
 * turn on: `cmake -DLUA=YES -DLUA_ALLOCATOR_TRACER=YES -DDEBUG=YES -DNANO=NO`
 * get debug output and make plot data: `./simu 2>&1 | grep "^LT" | ../radio/util/lua_trace2plot.py > data.plot`
 * plot: `gnuplot  -e 'set xtics rotate;  plot "data.plot" using 2:xtic(1) ; pause mouse close'`

* Changes based on Bertrand comments
2017-11-11 09:41:05 +01:00
3djc c30ff28f85 Replace S6R text by SxR since it handles both S6R and S8R 2017-11-11 09:38:10 +01:00
Bertrand Songis 5a121bfcb8 License dates changed and contents converted to UTF-8 2017-11-11 09:33:14 +01:00
Arne Schwabe 613b2edf49 Multi improvements (#5322)
* implementing syncing with multi

* Send config command

* Implement setting failsafe for multimodule

* Fix

* Fix last bugs. Multi sync now working as expected.

* Add eww multi protocol
2017-11-11 08:57:04 +01:00
Neil Horne 8e9d370770 Companion global variables refactor (#5328)
* Companion Global Variables refactor to support changes to radio in 2.2

* Update model print for global variables refactor

* Check and if necessary update all flight modes gvar after updating min or max

* Fix loop limit

* Add clear single gvar context menu
Add gvar popup values to model print
Minor fixes
2017-11-11 08:56:30 +01:00
Damjan Adamic 69afa9d0f8 Fixes #5302: added zesty (Ubuntu 17.04) and artful (Ubuntu 17.10) and removed yakkety (Ubuntu 16.10) 2017-11-10 19:23:01 +01:00
Damjan Adamic 955d5775cb Add Lua getUsage() function that returns percent of already used up i… (#5313)
* Add Lua getUsage() function that returns percent of already used up instructions in current script execution cycle. It can be used to avoid script being killed when doing long lasting tasks (like telemetry logs loading and parsing)

* Compilation fixes

* Doc fix

* Disable Lua script instructions limit in DEBUG mode
2017-11-10 17:23:37 +01:00
Damjan Adamic 6c7e4b5597 Debug Timers: add 10ms period measurement, delete unused timer debugT… (#5319)
* Debug Timers: add 10ms period measurement, delete unused timer debugTimerPerMainPeriod

* Typo in drawSplash() if MENUS_LOCK == 1
2017-11-10 17:23:09 +01:00
3djc ff8f4a3a92 Reassigns stats icon to better match actual screen content (#5339) 2017-11-10 17:22:32 +01:00
Arne Schwabe 2e248e7bc0 Do double pythrogoras if altitude is involved (fixes #5280) (#5341) 2017-11-10 16:41:52 +01:00
Arne Schwabe f9d5201b0c Only set telemetry to streaming when receiving rssi from RX on crossfire (closes #5340) 2017-11-10 10:48:57 +01:00
Kilrah baa3938f06 [companion] Edit checklist always available 2017-11-10 10:16:36 +01:00
Kilrah 12a0d6d5bc [companion] LCD type was not read (fix #5337) 2017-11-10 10:12:27 +01:00
Bertrand Songis 0f8c868d6b Update CREDITS.txt 2017-11-10 07:20:31 +01:00
Kilrah 761b0e0cfa Simu compilation fix 2017-11-08 22:01:35 +01:00
Neil Horne 5bb759a0e7 Replace spaces in model name with underscores for file name (#5335) 2017-11-08 21:33:12 +01:00
Kilrah 1ef1109b5f Add some saves (related to #5137) 2017-11-08 13:57:56 +01:00
Kilrah 36789bff3f 128x64 telemetry page was out of sync (fix #5166) 2017-11-08 13:49:42 +01:00
Kilrah d8f1ad3a82 Flight mode 0 value of a Global Variable should not be able to refer to another FM (fix #5310) 2017-11-08 13:30:28 +01:00
Bertrand Songis f197aa52ac Update CREDITS.txt 2017-11-08 13:06:29 +01:00
Kilrah fdec738485 Prevent lockup on boot in case of 32kHz oscillator failure (fix #5294) 2017-11-08 13:02:32 +01:00
Kilrah e2858dbb03 [companion] Some fields missing for Sky9x (fix #5326) 2017-11-08 12:55:31 +01:00
3djc 8d75f9c991 Merge pull request #5318 from opentx/3djc/more-datetime-fixes
Fix datetime
2017-11-07 08:30:23 +01:00
Bertrand Songis 8c6b5717f7 Update CREDITS.txt 2017-11-05 19:25:22 +01:00
Kilrah 63536b9819 Cosmetics 2017-11-04 10:15:56 +01:00
Kilrah 8780339c72 Crossfire baudrate selection for X10 (fix #5315) 2017-11-04 10:14:22 +01:00
Kilrah 90542b189c Cosmetics 2017-11-04 10:14:22 +01:00
Kilrah 83766bc3f6 Simu Debug compile fix 2017-11-04 10:14:22 +01:00
Bertrand Songis 6a61a911de Update CREDITS.txt 2017-11-02 17:45:15 +01:00
3djc 7b074305af Instead off dealing with individual exception, rule out all 'internal' sensors 2017-11-01 09:05:46 +01:00
RCdiy 973716fbfa Companion Build Option Lua Toot Tip change wording from "model" to "custom" (#5277)
* Companion Build Option Lua Toot Tip Change model to custom
2017-10-31 21:56:54 +01:00
Damjan Adamic b153cdec93 Fixes #5266: Lua docs updated: radio type has different names for the various radios in 2.2.0 2017-10-31 18:04:21 +01:00
Bertrand Songis c63ad89a8c Update CREDITS.txt 2017-10-29 22:42:53 +01:00
3djc 9a95b47c96 Prevent negative values in DMAFillRect (#5308) 2017-10-29 16:28:51 +01:00
Kilrah b4cf7315a5 X10 sport connector support 2017-10-29 16:22:31 +01:00
Kilrah d775a09095 Fix X10 backlight (min level of 46 to prevent display interference, must be hardware problem, FrOS uses same lower limit) 2017-10-29 16:02:51 +01:00
Arne Schwabe 318d77e863 Show telemetry UART errors in statistics debug page (#5185)
* Show telemetry errors in Debug statistics

This introduces a second debug page on X7 and X9 platform since the original page is almost full.
Also fix the X7 menu navigation to be able to go back and forth

* Fix compile error on platforms without key_page

* avr-gcc bails on missing eolf

* Fix navigation

* Just keep pushing ....

* compile fixes of 9x and use chainMenu

* Fixes

* Align x9 behavior to x7 (for once !)

* Allow total timer reset on both long menu and long enter

* Improve 9x handling
2017-10-29 09:06:17 +01:00
Florent Martel 1962336316 Add access to vBatWarn from luaGetGeneralSettings() (#5293) 2017-10-29 08:38:50 +01:00
3djc 3fed1aa157 Fix timer display (is DATETIME but no date available) (#5299) 2017-10-29 08:36:30 +01:00
Bertrand Songis 176845047d Update CREDITS.txt 2017-10-27 08:06:13 +02:00
Bertrand Songis 62662159e1 Update CREDITS.txt 2017-10-26 22:14:36 +02:00
Bertrand Songis c932090ed5 Update CREDITS.txt 2017-10-26 21:28:57 +02:00
Bertrand Songis 24b8ead576 Update CREDITS.txt 2017-10-25 22:20:12 +02:00
Bertrand Songis cb2e9be6cd Update CREDITS.txt 2017-10-25 19:25:32 +02:00
Bertrand Songis 6ff301bf27 Update CREDITS.txt 2017-10-15 21:22:07 +02:00
3djc fe3a7babcc Fix NL compîle with heli mode 2017-10-14 11:19:20 +02:00
Bertrand Songis f611942f61 Update CREDITS.txt 2017-10-11 16:36:22 +02:00
Bertrand Songis 979e93c7be Update CREDITS.txt 2017-10-11 09:45:10 +02:00
Bertrand Songis 83383df4dd Update CREDITS.txt 2017-10-09 18:00:29 +02:00
Kilrah a54c0a435e Remove unused files 2017-10-09 13:43:31 +02:00
Kilrah 3d8f1c4780 Fix gtests 2017-10-09 10:20:27 +02:00
Kilrah 64a4f10ec7 X10 simu upright and working 2017-10-09 09:56:37 +02:00
Kilrah 380adaad3b Fix X10 simu crash 2017-10-09 09:41:18 +02:00
Kilrah 69118a96be Python not just for Windows... 2017-10-08 21:14:02 +02:00
Kilrah 6a14fe728e Bundle OpenSSL libs in Windows installer (fix #5217) and image format plugins the app loads 2017-10-08 20:06:18 +02:00
Bertrand Songis b58be017f4 Update CREDITS.txt 2017-10-07 09:17:58 +02:00
Bertrand Songis 408a44110f Update CREDITS.txt 2017-10-03 20:05:57 +02:00
3djc aa527fc6bd GPS datetime display fixes (#5254)
* Fix x9

* Fix x7

* Apparently - is standard separator for dates

* Consistency
2017-10-03 07:45:40 +02:00
Bertrand Songis cbd824eb10 [X10S] PWM sticks support - with autodetection (#5251)
[X10S] PWM sticks support - with autodetection
2017-10-01 09:07:07 +02:00
Bertrand Songis a1c0aafc16 Update CREDITS.txt 2017-09-30 19:49:20 +02:00
Arne Schwabe fd782538d8 Implement SBUS output for external module bay. (#5225)
* Implement SBUS output for external module bay.

* Bugfixes and Companion support
2017-09-29 18:29:39 +02:00
Arne Schwabe 710e6ddc4c Also use https for nightlies 2017-09-28 15:05:57 +02:00
Sebastien Charpentier 3ce754137d French translation (#5244)
* Comparison point before translation.

* Updated French translation.

* Match radio strings
2017-09-28 11:29:18 +02:00
3djc f4ea92d1fc move to https (#5247) 2017-09-28 11:25:09 +02:00
Kilrah 24917a9952 Adjust SD card download folder for firmware nightlies 2017-09-28 08:28:25 +02:00
Bertrand Songis f60ea00fb8 Update CREDITS.txt 2017-09-26 17:57:26 +02:00
Bertrand Songis 851da15bc7 Update CREDITS.txt 2017-09-25 18:08:28 +02:00
Kilrah f6e7b4e291 Hide F000 sensor from GRX8 2017-09-25 09:53:45 +02:00
Arne Schwabe a502a99768 Fix logic mistake I made earlier (closes #5229) 2017-09-23 19:17:51 +02:00
Bertrand Songis 39386676d8 External module on X10 now tested OK 2017-09-21 23:15:50 +02:00
Bertrand Songis f48d6bba35 Update CREDITS.txt 2017-09-21 16:47:35 +02:00
Bertrand Songis fcbb23af92 Update CREDITS.txt 2017-09-21 07:36:23 +02:00
Bertrand Songis 7f7dfeab12 Compilation fix 2017-09-20 21:09:49 +02:00
Bertrand Songis 450ba42558 External module not working on X10 2017-09-20 09:16:11 +02:00
Bertrand Songis 76f27ae452 Update CREDITS.txt 2017-09-20 07:18:31 +02:00
Kilrah 6bb7ba3795 Fix typo 2017-09-18 18:02:00 +02:00
Bertrand Songis 509df44c4f X10 fixes (#5221)
1. BackLight < 42 was bad
2. SWB D E F direction inverted
3. Wrong battery voltage
2017-09-17 21:40:51 +02:00
Roderick Taylor 9cb4b782e1 Fix FrSky D cable telementry for 9XR PRO and DJT module. (#5220)
* Fix FrSky D cable telementry for 9XR PRO and DJT module.

* Revert a breaking change.
2017-09-17 19:10:45 +02:00
3djc 6f3577c9a5 x9e with horus bt module (#5214)
* Basics to allow Horus BT module on X9E

* wip

* Temporary hack to prevent X9E to enter reset loop

* The wait game starts :)

* Temporary compil fixes

* More sensibles defines
2017-09-16 16:08:21 +02:00
Bertrand Songis 06f5e408ee Update CREDITS.txt 2017-09-16 12:03:25 +02:00
Arne Schwabe 0402c37a07 Shorten a too long string in German translation 2017-09-14 18:13:01 +02:00
3djc 7ae9bfef0f Remove Visual C++ warning 2017-09-14 08:15:54 +02:00
3djc 1bfcdb5dfa Fix compilation server 2017-09-13 20:23:44 +02:00
3djc 2983cfc531 Merge pull request #5212 from opentx/bsongis/nightly_warning_setup
Nightly build enabled when suffix starts with 'N'
2017-09-13 19:02:41 +02:00
Bertrand Songis d80861db37 Nightly build enabled when suffix starts with 'N' 2017-09-13 18:43:01 +02:00
Arne Schwabe 23ceb830b3 Translate nightly warning (#5211)
* Translate nightly warning

* Oops, move define to right place
2017-09-13 15:44:01 +02:00
Arne Schwabe 4c5f0ca83c Let other python Qt scripts also fallback to Qt5 2017-09-13 14:18:17 +02:00
Bertrand Songis 1b370076b6 Update CREDITS.txt 2017-09-13 13:12:49 +02:00
3djc 9415b3086d More nightly prep 2017-09-12 19:55:42 +02:00
3djc e7fcc71d8e Prep for nightly 2017-09-12 19:14:41 +02:00
Arne Schwabe 7e21e13ec9 Disallow writing running firmware (#5208)
Overwriting running firmware leads to crash and incompletely written firmware
2017-09-12 18:49:40 +02:00
Arne Schwabe 360a521f11 Improve German translations (#5207)
- No different menu heading than other languages (also in NL)
- Fix a few strings
- also don't shorten two strings in English where we have the space
2017-09-12 18:49:01 +02:00
3djc 53d4547918 x7 rssi indicator (#5205)
Draw horizontal bars next to Batt (only for FRSKY Telem)
2017-09-12 18:48:37 +02:00
Kilrah 2d0c14c3c0 String lengths 2017-09-12 08:24:46 +02:00
Bertrand Songis b9fd1b01d1 Update CREDITS.txt 2017-09-12 07:32:07 +02:00
Arne Schwabe 45213124dd Remove unused CASE_PWM_BACKLIGHT entires
212x64 does not even have the ITEM_BACKLIGHT entries for it
2017-09-11 22:52:28 +02:00
Kilrah 76371d6087 Cosmetics 2017-09-11 22:47:24 +02:00
Kilrah 37c0589a27 Menu navigation was broken by USB setting addition 2017-09-11 22:46:22 +02:00
3djc da71f4cbbc Make Horus widgets 'shadow' effect an option (#5203)
* Add shadows to c++ widgets

* Add BOOL zone option to Horus LUA

* LUA widgets too
2017-09-11 07:34:49 +02:00
Arne Schwabe 093034f9e7 German translations for USB 2017-09-11 03:30:17 +02:00
Kilrah a7b9b30108 Fix DEBUG=YES build for sky9x family (better fix would be to implement rtcGetTime on the platform) 2017-09-10 22:36:55 +02:00
Kilrah 6a2a730cdc X7 simu compilation 2017-09-10 21:48:33 +02:00
Kilrah 97b777ae4f String cosmetics 2017-09-10 21:44:23 +02:00
Kilrah 09f257026e Disable Serial USB choice if !DEBUG (no function currently) 2017-09-10 21:23:36 +02:00
Kilrah e59afb6ec1 Enum was misaligned with UI text... 2017-09-10 20:50:05 +02:00
Arne Schwabe b7acee5723 Allow USB mode selection on USB connect (#5193)
Allow all USB modes to be compiled in at the same time
2017-09-10 17:28:08 +02:00
3djc 2910488a30 Add nightly warning (#5202)
Nightly build Warning
2017-09-10 17:25:04 +02:00
3djc 67817918f4 Add SQT5 that was missing in 2.2 (#5179)
Add SQT5 that was missing in 2.2
2017-09-10 17:17:23 +02:00
sirPerna 390342af78 Crossfire baudrate selection for X7 support ( fixes #4922 ) (#5194)
* Crossfire baudrate selection for X7 support ( fixes #4922 )

* Moved baurate selection to general settings

* renamed mavbaud to telemetryBaudrate for ARM targets
translation added

* typo fixed
2017-09-10 17:10:47 +02:00
3djc 653273f82e X7 and X9E have been left out ! (#5199) 2017-09-09 15:42:39 +02:00
3djc b33a88a69f Do not display blank space when switch is not available (#5183) 2017-09-09 15:11:06 +02:00
NiklasVoigt 7cd7869d6a Taranis Q X7 optimized wizard (#5198)
* Redesigned Wizard for the X7

Check this out:
https://www.youtube.com/watch?v=86H1YKcVyB4

* Removed the developers name

* Rendering issue fix

* Removed bottom bar & removed Heli

uncommented Heli for easier implementing in the future
2017-09-09 13:47:05 +02:00
3djc 9ae429e03b Shouldn't copyright be there too ? (#5200) 2017-09-09 13:43:38 +02:00
Bertrand Songis 0053412f87 Update CREDITS.txt 2017-09-06 18:11:01 +02:00
Arne Schwabe 63baa76cba Remove dead code (from pre 2.1 telemetry) 2017-09-05 18:58:36 +02:00
Bertrand Songis bd6bd4deeb Bluetooth fixes (reconnection issues, telemetry mode not working) (#5186)
Bluetooth fixes (reconnection issues, telemetry mode not working)
2017-09-05 18:21:29 +02:00
Arne Schwabe 5b5c88fb4e Switch to nano version of newlib (#5180)
* Switch to nano version of newlib

save about 50k of flash and 2k of RAM on Taranis

* Make nano optional, default=off and use bin_alloc for it
2017-09-01 18:37:30 +02:00
3djc fdacf83ad0 Improve pilotPosition when internal GPS is available (#5187)
* Update pilotposition when internal GPS does have a fix *** UNTESTED YET ***

* Cosmetics, tested OK
2017-08-31 19:11:44 +02:00
3djc 8e04a6e2e4 Horus : improve add widgets (#5189)
* Go automatically to widget setup after adding a widget

* Cosmetics
2017-08-31 19:11:04 +02:00
IdefixRC 5791645877 Crossfire LUA for Horus (#5190)
* First iteration of the Horus Crossfire LUA

Under development.
- crossfire.lua working and tested with micro TX and micro RX
- devices.lua basic layout working. Work in process:
     - getLastPos which is not available in Horus hard-coded currently. needs to be adjusted
     - Taranis page method replaced by Horus single page approach with 22 lines in 2 columns. Still throws an error message and unclear if 22 lines of settings are enough for all devices and whether different approach will work better.
    - Save menu not tested.

* Working script (tested with MicroTX)

- updated getlastpos and concenated strings instead
- went back to single column and implemented scrolling
- still need to figure out speed (fields are sometimes populated very slowly)
2017-08-31 19:10:37 +02:00
Damjan Adamic 6cc40c65b2 Lua docs update (CrossfireTelemetryPush and crossfireTelemetryPop and some small spelling fixes) 2017-08-27 16:45:56 +02:00
Bertrand Songis 1bb8aab866 Update CREDITS.txt 2017-08-25 08:22:32 +02:00
Bertrand Songis 13b566746d Update CREDITS.txt 2017-08-24 21:00:49 +02:00
Bertrand Songis 4b5bd10aa2 Update CREDITS.txt 2017-08-23 16:17:15 +02:00
3djc 251e83b1a4 Looks like FRSKY_STICKS option was missing in 2.2 (#5177) 2017-08-22 13:07:21 +02:00
OhmEye d4f108a849 Add TBS Crossfire lua scripts or X7 SDCard (#5176)
I edited the scripts for X9D to change the input events for the rotary wheel and the drawing coordinates for the smaller LCD. Tested by a handful of volunteers and myself on X7's with working CRSF.
2017-08-22 13:07:00 +02:00
Bertrand Songis 19219bf8f8 Update CREDITS.txt 2017-08-22 02:37:54 -07:00
3djc 74db7dafa7 Merge pull request #5173 from opentx/3djc/build-fixes
Fix currently known compile errors
2017-08-22 08:28:31 +02:00
Arne Schwabe 9bc8fc493d Fix German multi protocol string 2017-08-21 20:59:03 +02:00
Arne Schwabe abe857225a Fix assert in multiprotocol 2017-08-20 19:30:51 +02:00
3djc 9c46b9afa0 Fix currently know compile errors 2017-08-20 16:55:25 +02:00
Bertrand Songis a41d2af10d Update CREDITS.txt 2017-08-20 07:06:33 -07:00
Bertrand Songis 42cbc56880 Comment added 2017-08-18 18:02:22 +02:00
Kilrah 9ba843d82f Enable X10 2017-08-18 14:50:44 +02:00
3djc 81589d22f8 B&W LCD receiver ID improvement (#5018)
* - Use @schwabe int/ext matching
- Display model name where the receiver in currently used

* French colom doesn't seem to be standard (wonder why :D)

* Implement showing multiple names

* Another way

* Improvement suggested by @schwabe (thx m8!)

* let's say it's a typo ..

* By unanimous vote of participants

* Updates based on Bertrtand's comments

* Colon right this time ?

* Cosmetics
2017-08-16 23:27:04 -07:00
Bertrand Songis 576be96935 Update CREDITS.txt 2017-08-16 11:59:47 -07:00
Bertrand Songis f487cdd581 Update CREDITS.txt 2017-08-16 11:01:03 -07:00
Sebastien Charpentier bf177d6cce French translation update (#5163)
* Initial version.

* French translation.
2017-08-16 10:08:19 -07:00
Arne Schwabe e16b48db30 Reduce RF_PROTO_OFF logic, disable R9M Sport out when internal telemetry is on (#5159)
* Remove most of the special logic associated with RF_PROTO_OFF

This simplifies code in many areas since the internal module does not require special handling and also fixes a few bugs with INTERNAL_PPM

* Disable R9M sport option if internal module has telemetry

* Fix X12s build

* Use macros instead of direct comparisions

* Fix sport bit sent the wrong way. Rename S.port out to Telemetry

* Compile fix
2017-08-15 21:47:45 -07:00
Arne Schwabe 8e84724c62 Implement R9M Companion support (#5157)
also implement (like with multi) own pxx struct for pxx options
2017-08-15 21:45:15 -07:00
3djc 2f7694dee7 3djc/horus chan mon fix (#5152)
* Fixes : #5124

* Adjust display accordingly
2017-08-15 21:44:45 -07:00
3djc 019e2aee1b Merge pull request #5161 from opentx/3djc/Timer-name-handling
Timer name handling
2017-08-15 17:27:16 +02:00
3djc 8cb7031cf6 Cosmetics based on Bertrand's commments 2017-08-15 17:02:51 +02:00
Damjan Adamic a167e9f751 Fixes #5055: infinite loop in lcdDrawFilledRect() when h parameter is bigger than 127. Similar fixes in other places. (#5058) 2017-08-15 06:57:29 -07:00
Arne Schwabe 824f39330f Reorder mm_protocol struct and remove pack to silence compiler warnings (#5158)
Since chance costs 48 byte of flash space
2017-08-15 06:51:21 -07:00
3djc bf600140d3 480x272 2017-08-15 10:55:15 +02:00
3djc 871302a1b1 128x64 and 212x64 2017-08-15 10:49:59 +02:00
3djc 5a8a074f0c Neutralise BT on X9E, unless DEBUG is defined (#5148)
* Neutralise BT on X9E, unless DEBUG is defined

* Adjust to Bertrand comments
2017-08-14 22:03:26 -07:00
Bertrand Songis 0e139fd0d6 X10 HAL update
- ADC OK
2017-08-12 16:15:40 +02:00
Bertrand Songis de00d223c4 X10 HAL update
- LCD OK
 - Backlight OK
 - Sound OK
 - Keys OK
 - Haptic OK

 - ADC KO
2017-08-12 10:48:38 +02:00
Bertrand Songis 8d8fef23c9 Bsongis/x7 bluetooth (#5068)
* Trainer Bluetooth support added
X7S board added (X7 has no bluetooth while X7S has)
X10 HAL updated

* Bluetooth Telemetry

* En fix
Add all languages

* Temporary test for @bsongis

* Missing translations
2017-08-12 00:49:54 +02:00
Arne Schwabe 51be7b000e Add support for R9M module (#5101)
* Implement R9M protocol according to PXX spec 1.7

Some of the things here are guesswork as I don’t have a R9M at hand. Also Companion support for the extra R9M options is not implemented yet.

* Fix build errors
2017-08-12 00:27:23 +02:00
Arne Schwabe 87295776ff Fix issue #4961 (#5009)
* Fix issue #4961

Fix yet another reference to HORUS_OR_TARANIS that should be IS_ARM
Also rename C9X function to export/import to be inline with the rest

* Another two IS_ARM/HORUS_TARANIS mixups

* Fix condition

* Simplify/fix two if statements

* Really fix if statement
2017-08-12 00:26:28 +02:00
Andre Bernet b3e9d8d97d Improve settings migration and management (#5107)
* Settings can now be optionally removed during uninstall (didn't find how to translate)

* Settings import from previous versions now optional

* Hopefully cleaner implementation

* This crashes (already on 2.2)

* Translation

* Remove broken settings import from companion9x

* Fixes for MainWindow
2017-08-11 17:42:30 +02:00
Bertrand Songis 96f1a16744 Avoid repeat i.e. Telemetry Lost / Trainer Lost until prompts fifo is… (#5121)
* Avoid repeat i.e. Telemetry Lost / Trainer Lost until prompts fifo is full ...

* Rename functions

* Belt and braces
2017-08-09 11:59:13 +02:00
Kilrah 7d386e7821 Merge branch 'bsongis/companion_sensor_switches' into 2.2 2017-08-09 11:37:56 +02:00
Bertrand Songis ee258b8ec8 Curves buttons broken on Linux 2017-08-09 11:02:57 +02:00
Bertrand Songis 0641adc5f4 Segfault fixed 2017-08-09 10:47:01 +02:00
Bertrand Songis 045294d53b Unify element names 2017-08-09 10:29:33 +02:00
Bertrand Songis 169df7130b Update CREDITS.txt 2017-08-08 20:39:47 +02:00
Bertrand Songis 49e252337e Sensors names changed to "SensorX:YYYY" 2017-08-08 20:38:29 +02:00
Bertrand Songis 7906107d6c Update CREDITS.txt 2017-08-06 22:15:35 +02:00
Bertrand Songis e3d881be76 Update CREDITS.txt 2017-08-05 20:46:15 +02:00
Arne Schwabe bd968bd60f Bundle and use avrdude.conf on OS X (closes #5050) (#5127) 2017-08-04 12:19:27 +02:00
Bertrand Songis 541aa459cf Lua drawBitmap on X7 2017-08-04 12:08:10 +02:00
Kilrah c82c7ee5db No serial debug on X7 2017-08-04 11:22:42 +02:00
Bertrand Songis 76e72c8a86 RssiPowerOff alarm enabled by default (#5129)
* RssiPowerOff alarm enabled by default
+ Companion support

* Fix continuously toggling RSSI on shutdown setting on X9
2017-08-04 11:01:52 +02:00
Bertrand Songis 6304f0daf6 Sleep bitmap on X7 (#5125) 2017-08-04 10:41:36 +02:00
Bertrand Songis e00efb1566 Cosmetics 2017-08-03 21:50:26 +02:00
Bertrand Songis 258347fbd1 Warning fix 2017-08-01 17:04:20 +02:00
Bertrand Songis 7434e330c8 3djc/rssi poweroff safety (#5126)
Shutdown RSSI Alert
2017-08-01 14:13:25 +02:00
Bertrand Songis b55070f939 [Companion] Sensor switches support added
+ some refactoring to hide irrelevant switches in the combobox

More refactoring to come:
 - have only one SwitchModel per model instead of one per tab
 - only do the update work if something has changed
2017-07-30 12:12:27 +02:00
Arne Schwabe a7524ba74d Fix clang warnings (#4988)
* Fix clang warnings

- signed char on AVR vs unsigned char on ARM
- use references instead of points in calculation (same code size)
- Ignore packed address warning for mavlink includes
- Turn error on packed addresses to warning for Horus (Cannot fix that without major refactoring, might even need eeprom change)

* Revert fixes for clang on AVR as the old AVR gcc does not like them
2017-07-30 09:59:15 +02:00
Damjan Adamic 3436273fdf Fixes #5090: periodically update sensor ratios from the radio when the telemetry simulator is running. (#5110) 2017-07-30 09:56:16 +02:00
Damjan Adamic 4dcd49a516 Fixes #5093: usbasp udev were rules missing from the installation package (#5111) 2017-07-30 09:55:16 +02:00
Sebastien Charpentier 2f4ed3b35f Updated Fr Translation (#5115)
* Initial version

* Update French translation.
2017-07-30 09:52:06 +02:00
Bertrand Songis b814f997f8 Update CREDITS.txt 2017-07-27 16:17:44 +02:00
Bertrand Songis e37872398e Fixes #5100 2017-07-27 12:22:24 +02:00
Kilrah 3b7c3fb217 Clarify upgrade text (fix #2967) 2017-07-24 12:41:42 +02:00
Kilrah e04aa4b3cc Revert "Add sam-ba location to list of settings that must not be imported"
This reverts commit 1bb6a82cf3.
2017-07-24 11:51:26 +02:00
Kilrah 1bb6a82cf3 Add sam-ba location to list of settings that must not be imported 2017-07-24 11:43:02 +02:00
Kilrah 022f7121b4 Fix unneeded conversions between 9XR-Pro and AR9X/Sky9x 2017-07-24 11:33:13 +02:00
Bertrand Songis cc19c8027a Update CREDITS.txt 2017-07-22 19:14:00 +02:00
Sebastien Charpentier 7dfb5b6a28 Updated French translation (#5074)
* Starting point.

* French translation.
2017-07-21 11:06:51 +02:00
Bertrand Songis 397b78fe06 Update CREDITS.txt 2017-07-21 11:02:05 +02:00
3djc 1e2f4d6c0c - Add 'quick' mode compatibility (#5099)
- Add compatibility with previous receiver firmware
- rename S6R to SxR to acknowledge S8R is supported too
2017-07-20 13:38:30 +02:00
Bertrand Songis 387cd98efe Update CREDITS.txt 2017-07-19 14:08:02 +02:00
Bertrand Songis 7eddd662e7 Update CREDITS.txt 2017-07-18 20:00:30 +02:00
Bertrand Songis 21f61fe498 Update CREDITS.txt 2017-07-13 07:25:39 +02:00
Bertrand Songis 0437314ae3 Update CREDITS.txt 2017-07-10 07:34:43 +02:00
Bertrand Songis 21e8551787 Update CREDITS.txt 2017-07-09 21:35:48 +02:00
Arne Schwabe 129bbe2198 Fix getcurve reporting 0 as first x value instead of -100 2017-07-07 23:44:23 +02:00
Bertrand Songis cfcac8c51d Update CREDITS.txt 2017-07-04 18:18:40 +02:00
Bertrand Songis eaeb90dc07 Update CREDITS.txt 2017-07-01 23:01:20 +02:00
Bertrand Songis ae68dea923 Update CREDITS.txt 2017-07-01 12:06:37 +02:00
Arne Schwabe 1ae8e40a3f Fix setCurve not probably working for custom curves
ypoints used for x instead of xpoints
2017-07-01 01:55:31 +02:00
3djc 779aecfbee Add mechanics for x9 IMAGES import into sd card file 2017-06-29 15:56:18 +02:00
3djc 1c62b19f9f Fully adjustable splash timer on x7, matching x9 implementation (#5008)
* Fully adjustable splash timer on x7, matching x9 implementation

* Make splash adjustable for all ARM, and just check box for AVR
2017-06-28 22:10:40 +02:00
Neil Horne c00775b2d1 Add model checklist edit to Companion (#5047)
* Add model checklist edit to Companion

* minor fix

* Add only write file if text changed.
Add @bsongis feedback.
Minor code changes.
2017-06-28 22:09:47 +02:00
3djc b7b7c48d8e x7/x9 GPS datetime fix (#5051)
* Fix x7 display in telemetry widget (only time is displayed)

* rename drawDate to a more specific name, since it is not generic
fix for x9

* Travis build fix

* Introduce time FONTSIZE_MASK macro

* Cosmetics based on Bertrand's last feedbacks
2017-06-28 20:28:57 +02:00
3djc 76ffd4fcb4 Do not display popup menu on last line (cpy trim -> sub for all chan) (#5061) 2017-06-28 13:22:37 +02:00
Arne Schwabe 9ad5094909 Display XJT version in analogs (#5039)
* Display XJT version

* On Horus too
2017-06-26 21:28:30 +02:00
3djc 0fd23d3e61 Fix COLORLCD compile for PT (#5063) 2017-06-26 18:05:53 +02:00
Andre Bernet a587f8b825 Edge detection only on "Reset Flight", commit 6bc6e074e17e28138fcb23b1e6a3e91eef0b406a introduced unnecessary change in behavior for Reset Timer (fix #5036) 2017-06-25 17:40:54 +02:00
Bertrand Songis fb1098c16e Update CREDITS.txt 2017-06-25 16:47:45 +02:00
Damjan Adamic 97ef444648 Travis build fix 2017-06-24 19:17:51 +02:00
Bertrand Songis c672d2544b Update CREDITS.txt 2017-06-19 22:30:02 +02:00
Sebastien Charpentier 72ca1b021a Fixed Typo. (#5046) 2017-06-19 16:09:34 +02:00
Sebastien Charpentier 044b3a706c French Translation (#5045)
* Starting point for French translation.

* Updated French translation.
2017-06-19 15:10:05 +02:00
3djc 4c40aec8b3 x7/x9e startup review (#5033)
* Turn on X7 like it is done on X9

* 4 squares like shutdown + prep for firmware option to disable

* Compile option

* - rollback firmware option
- fast one second power on
- unchanged power off
- animation added for x7 power on
- animation for power off changed to 'removing' quarter instead of adding (ie the power on anim fills in, the power down fills out)

* Cosmetics

* Cosmetics
2017-06-18 20:55:49 +02:00
Bertrand Songis 4226e9cc45 Update CREDITS.txt 2017-06-18 19:29:25 +02:00
3djc f659e98a52 Improve default voice tempo (pith remains untouched) 2017-06-18 10:01:53 +02:00
Bertrand Songis 97b2aa804d Crossfire parsing script updated 2017-06-17 09:12:13 +02:00
Arne Schwabe 8e07f9b0f4 Allow to disable telemetry alarams (#4981)
* Allow to disable telemetry alarams

This mainly useful for cheap transceivers that have telemetry but no power amplifier and very limited range of often 10-20 meters. This includes fishpepper's tinyFISH FC (and its legal/illegal clones) and also Spektrum BNF models.

* Always disable a warning when RSSI Warnings are disabled

* Compile fix

* Fix typos, also mute sensor lost

Refactor the FrskyRSSIAlarm[2] into a EEPROM compatible RssiAlarm struct

* Compile fixes

* Also refactor Companion

* Cleanup unused datastruct on ARM

* Compile fix for AVR

* Change int to uin8_t for avr

* Fix strings
2017-06-14 23:34:27 +02:00
3djc 656daa75fa Fix SDcard size and format issue (#5004)
* - fix overflow in SDcard size computation
- fix format function
- implement more informative format error handling

* Move to a function
2017-06-14 23:33:31 +02:00
3djc 547606b44e Cleanup unused (#5027) 2017-06-14 23:27:35 +02:00
3djc 15a29f3a43 Adjust audio for X9E hardware (#5028) 2017-06-14 23:27:02 +02:00
3djc ab81838d87 Merge pull request #5020 from opentx/3djc/isSwitchAvailable-fix
Review isSwitchAvailable for correct context detection
2017-06-11 10:00:12 +02:00
3djc 854ce93c07 Missed indent 2017-06-11 09:36:14 +02:00
Bertrand Songis 08ae9ddedb Update CREDITS.txt 2017-06-10 23:38:22 +02:00
Max Paperno 3f5a3995cc [Companion] Inputs and Mixes lists formatting & DnD fixes: (#4919)
* Fix/improve margin/padding issues, consistent between inp/mix views, better x-platform and older Qt (closes #4599, closes #4341);
    * Allow dropping onto lines instead of only between them;
    * Fix dropped data always going to line above the actual drop target (closes #4622);
    * Always force DnD move operations between windows to copy instead (fixes deletion of any selected line in target window, and source line was never actually removed but looked like it was);
    * Add alternate-row coloring for each Input/Mixer group;
    * Fix non-contrasting selected row font color on Linux & OS X (was black on blue);
    * Add actions to change font size (size persists until app close);
    * Show inactive lines with dimmer font for input/channel name;
    * Make drop indicator more obvious;
    * Restore mouse hover highlight (Win), which also helps indicate actual drop target (also re: #4622);
    * cosmetics: Code indentation in MixersListWidget.
2017-06-10 23:35:16 +02:00
3djc 2a86918508 Add varioCenterSilent option to x7 and rework telem screen accordingly (#4923) 2017-06-10 23:34:33 +02:00
Max Paperno f50ee3fb39 [Companion] Add optional logging of all debug output. (#4974)
* [AppDebugMessageHandler] Add ability to write debug output to any number of QIODevices.

* [Simulator][DebugOutput] Use new QIODevice hook in AppDebugMessageHandler instead of signal/slot.

* [AppData] Add new settings for debug logging; Refactor property creation macro to work with any data type and add varName_init() method to set default; Refactor all boolean settings to use new macro (others to be migrated later).

* [AppPreferencesDialog] Add UI for appDebugLog, fwTraceLog, & appLogsDir settings; Clean up layout on application prefs. tab, move and re-label a couple items.

* [Companion][Simulator] Enable optional application debug output logging.

* [Simulator] Enable optional logging of firmware debug output to file.

* [EEPROMInterface] Use qDebug() instead of std::cout so that now all debug output can be routed via custom message handler/logger.

* [Companion][Simulator] Add missing #include.
2017-06-10 23:33:03 +02:00
3djc bae44d2812 Review handling is global function detection.
Fixes !sensor been selectable in global scripts

Thanks to @Max for his help
2017-06-09 09:47:34 +02:00
Bertrand Songis 2e4775b19a Create CREDITS.txt 2017-06-09 08:05:25 +02:00
Max Paperno 655e2f9010 [Companion][AppData] Fix possible crash when importing settings from Companion < v2.1 (fixes #5016). 2017-06-07 10:49:48 -04:00
3djc a4008a2550 Enable FAI Choice for Horus (#4994)
* Test a different approach

* Implement jump over

* Much better implementation (and fixing an existing bug on top of that :))
2017-06-03 12:08:12 +02:00
Andre Bernet 9e39dfa9d7 Fix #4997 2017-06-03 11:46:22 +02:00
Bertrand Songis 94ee3c65b3 Update CREDITS.txt 2017-06-02 20:25:15 +02:00
Arne Schwabe d609d37798 Ignore UNIX dotfiles (#4973)
* Ignore UNIX dotfiles

This has the advantage of hiding all the stupid .DS_STORE and ._foo.lua attributes files from Mac OS X

* Do not ignore ..
2017-06-02 16:37:35 +02:00
3djc d0a57d4c47 Align Taranis 128*64 stats to its larger sister (#4985)
* Align Taranis 128*64 stats to it's larger sister

* Make it for all ARM
2017-06-02 16:37:12 +02:00
3djc 726b989f6c Horus Shadowed (#4979)
* Introduce SHADOWED and use it for BattCheck

* numbers too

* For drawTimer too

* Compilation fix
2017-06-02 16:36:27 +02:00
3djc 5f76e61240 Handle tinsize dot blinking (#4986) 2017-06-01 23:22:09 +02:00
Bertrand Songis 42d66bb2c1 Compilation fix (PCB=9X CURVES=NO HELI=NO TEMPLATES=YES) (#4983)
* Compilation fix (PCB=9X CURVES=NO HELI=NO TEMPLATES=YES)

* String length fixes
2017-06-01 23:21:47 +02:00
3djc e4135a9adb Merge pull request #4984 from cprinos/patch-1
drawComboBox luadoc fix
2017-06-01 07:08:22 +02:00
Chris Prinos fe1146b62c drawComboBox luadoc fix
remove extraneous 'page' param
2017-05-31 21:17:46 -04:00
Damjan Adamic 7956bd6bab Launchpad files for 2.2.0 release:
* updated changelogs
 * use suffix only for nightly builds
2017-05-31 23:31:16 +02:00
Arne Schwabe 32142e25ea add multimedia libs depency (#4982) 2017-05-31 22:31:28 +02:00
3djc 85bb6ea3a7 This fixes #4980 2017-05-31 10:47:20 +02:00
3djc d5e42992d2 2.2.1Nxx pre prep 2017-05-31 10:24:07 +02:00
Andre Bernet fbdcef3733 Release notes updated (a bit late) 2017-05-30 21:42:41 +02:00
Andre Bernet a13c857b53 Release notes updated (a bit late) 2017-05-30 21:40:32 +02:00
411 changed files with 17918 additions and 7811 deletions
+18 -1
View File
@@ -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'
+12 -2
View File
@@ -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)
+84 -3
View File
@@ -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
+2 -2
View File
@@ -1,7 +1,7 @@
## OpenTX 2.2 Branch
[![Build Status](https://travis-ci.org/opentx/opentx.svg?branch=next)](https://travis-ci.org/opentx/opentx)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/11787/badge.svg)](https://scan.coverity.com/projects/opentx-opentx)
[![Travis build Status](https://travis-ci.org/opentx/opentx.svg?branch=2.2)](https://travis-ci.org/opentx/opentx)
[![Quality Gate](https://sonarcloud.io/api/badges/gate?key=OpenTX:2.2)](https://sonarcloud.io/dashboard?id=OpenTX:2.2)
[![Join the chat at https://opentx.rocket.chat](https://camo.githubusercontent.com/3d659054abd6ce21c0e47cf3b83a51bda69ca282/68747470733a2f2f64656d6f2e726f636b65742e636861742f696d616765732f6a6f696e2d636861742e737667)](https://opentx.rocket.chat)
[![Donate using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
+70 -1
View File
@@ -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>
+7
View File
@@ -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")
+30 -1
View File
@@ -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
+5 -1
View File
@@ -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;
+34 -14
View File
@@ -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();
}
+2
View File
@@ -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();
+452 -345
View File
@@ -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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. &lt;/p&gt;&lt;p&gt;When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Application (Companion/Simulator)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="opt_fwTraceLog">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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 &lt;span style=&quot; font-style:italic;&quot;&gt;Debug Output&lt;/span&gt; window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. &lt;/p&gt;&lt;p&gt;When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>
+19 -17
View File
@@ -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;
}
+12
View File
@@ -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();
+1 -1
View File
@@ -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;}
+32 -2
View File
@@ -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;
}
+26 -15
View File
@@ -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>
+8
View 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_
+168 -36
View File
@@ -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();
}
+2
View File
@@ -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) {
+16 -12
View File
@@ -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();
}
+96 -56
View File
@@ -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"));
+13 -10
View File
@@ -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);
}
+50 -16
View File
@@ -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);
+2
View File
@@ -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);
File diff suppressed because it is too large Load Diff
+17 -83
View File
@@ -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;
-12
View File
@@ -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);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

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

+51
View File
@@ -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;
+1
View File
@@ -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);
+7
View File
@@ -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">
+8 -8
View File
@@ -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();
+4 -4
View File
@@ -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);
}
+2
View File
@@ -12,9 +12,11 @@ set(modeledit_NAMES
telemetry
expodialog
mixerdialog
checklistdialog
)
set(modeledit_SRCS
switchitemmodel.cpp
flightmodes.cpp
inputs.cpp
mixes.cpp
+118
View File
@@ -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;
}
+50
View File
@@ -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_
+156
View File
@@ -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>&amp;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>&amp;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>&amp;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>
+3 -1
View File
@@ -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));
+23 -18
View File
@@ -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);
+4 -2
View File
@@ -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;
+3 -2
View File
@@ -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);
+244 -48
View File
@@ -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()));
+19 -2
View File
@@ -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
+17 -16
View File
@@ -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);
}
-1
View File
@@ -54,7 +54,6 @@ class InputsPanel : public ModelPanel
private:
bool expoInserted;
MixersListWidget *ExposlistWidget;
bool firstLine;
int inputsCount;
ModelPrinter modelPrinter;
+7 -6
View File
@@ -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);
}
+4 -2
View File
@@ -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;
+4 -3
View File
@@ -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);
+203 -87
View File
@@ -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();
}
+19 -6
View File
@@ -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_
+24 -21
View File
@@ -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(" ", "&nbsp;");
}
@@ -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);
}
}
+86 -32
View File
@@ -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();
}
+7 -1
View File
@@ -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;
+87 -74
View File
@@ -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">
+181 -130
View File
@@ -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">
+144
View File
@@ -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();
}
+58
View File
@@ -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;
};
+19 -17
View File
@@ -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();
}
+4 -4
View File
@@ -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();
+84 -77
View File
@@ -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>
+127 -4
View File
@@ -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);
}
+17 -1
View File
@@ -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;
+94 -22
View File
@@ -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>&nbsp;");
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>&lt;</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/>");
+1 -1
View File
@@ -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);
+32 -28
View File
@@ -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 {
+4 -1
View File
@@ -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)
{
+80 -16
View File
@@ -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));
}
}
+79 -17
View File
@@ -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;

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