Compare commits

...

475 Commits

Author SHA1 Message Date
Andre Bernet b46bb9b5cf Companion translations 2015-09-09 11:07:37 +02:00
Bertrand Songis 2d4db9604a Translations problem in print model functions 2015-09-09 11:02:45 +02:00
Andre Bernet b65d716029 Release notes updated 2015-09-09 10:51:39 +02:00
Bertrand Songis 259a42bfdc Fixes #2855 2015-09-09 09:33:25 +02:00
Bertrand Songis 562c879751 Jenkins commit tests now stored in the repo 2015-09-09 09:03:33 +02:00
Bertrand Songis 746dbe22b8 Inversion between TIMER_MIN and TIMER_MAX!!! 2015-09-08 20:34:10 +02:00
Bertrand Songis 2a49e98a80 Update DONATIONS.txt 2015-09-08 20:15:04 +02:00
Bertrand Songis 20ee2318cd Fixes #2851 2015-09-08 20:13:17 +02:00
Bertrand Songis 21ac2eca88 Should fix #2848 - Worst case fixes a warning. 2015-09-08 19:29:11 +02:00
Bertrand Songis afdff355de Switch to 2.1.3 2015-09-08 19:22:16 +02:00
Bertrand Songis 3f14a25852 Warning removed 2015-09-08 19:19:38 +02:00
Bertrand Songis abc48390ca Fixes #2847 2015-09-08 19:09:16 +02:00
Andre Bernet 8dd5ebf053 Release notes updated Added note about throttle source 2015-09-08 10:03:06 +02:00
Bertrand Songis 65c9ae6bfd Merge pull request #2846 from opentx/MicheleVilla/FW_IT_Translations
Update it.h.txt
2015-09-07 22:29:12 +02:00
Andre Bernet 5188645313 Remove duplicate option 2015-09-07 22:28:29 +02:00
Michele 2260cde321 Update it.h.txt 2015-09-07 22:20:24 +02:00
Andre Bernet f76f7a6ad4 Companion translations 2015-09-07 22:11:07 +02:00
Andre Bernet 33c694f5a3 Release notes updated 2015-09-07 22:06:51 +02:00
Bertrand Songis a8890b11e0 [Companion] CLI option added 2015-09-07 21:54:07 +02:00
Bertrand Songis c8525b311f Fixes #2844 2015-09-07 21:46:12 +02:00
Bertrand Songis 99d3afbe1a Warning removed 2015-09-07 21:46:12 +02:00
Andre Bernet 1f1a88a06c Release notes updated 2015-09-07 21:06:29 +02:00
Andre Bernet bf6b5cc389 Release notes updated 2015-09-07 20:56:41 +02:00
Bertrand Songis 9967aab3dd Update DONATIONS.txt 2015-09-06 23:02:53 +02:00
mhotar 2fef5f3e78 CZ translation 2015-09-06 22:46:10 +02:00
Bertrand Songis d3edecb133 Merge pull request #2842 from opentx/driver33/PL_TR
Fixes in traslations
2015-09-06 21:04:52 +02:00
driver33 6ecf4ec6a0 Fixes in traslations 2015-09-06 20:58:07 +02:00
mhotar 57bc32edf5 Logo added to the lib 2015-09-06 20:56:23 +02:00
mhotar 5beeb208be CZ translation 2015-09-06 20:33:05 +02:00
Andre Bernet 2bf3f80364 Merge pull request #2834 from opentx/jtaylor2/issue_-2762
Telemetry simulator improvements (fix #2762)
2015-09-06 19:42:03 +02:00
Andre Bernet 3c0ed1350a Remove obsolete code 2015-09-06 19:34:56 +02:00
Bertrand Songis 2625e05953 Merge pull request #2841 from opentx/kilrah/ar9x
Support for AR9X board
2015-09-06 19:27:18 +02:00
Andre Bernet 461d994dea Cosmetics 2015-09-06 18:15:37 +02:00
Andre Bernet c2ee6d2eaf Disable volume/rtc options for now, not implemented yet 2015-09-06 16:51:02 +02:00
Bertrand Songis ebad326256 [9X] Model not stored on EEPROM upon creation
When TEMPLATES option disabled...
2015-09-06 16:39:16 +02:00
Bertrand Songis 3dc47f39ea Update DONATIONS.txt 2015-09-06 16:27:43 +02:00
Bertrand Songis aaacfb0888 [9XR-PRO] Navigation problem in Modelsel screen 2015-09-06 16:26:52 +02:00
Andre Bernet 45d22c83d4 AR9X simu added 2015-09-06 16:03:08 +02:00
Andre Bernet 45801a89ea Merge branch 'master' into kilrah/ar9x 2015-09-06 14:47:26 +02:00
Bertrand Songis 1a1f175ac1 Bars display problem on 9XR-PRO 2015-09-06 13:41:25 +02:00
Bertrand Songis 922ff5622f Merge pull request #2840 from opentx/driver33/polish_translation_2.1.x
Translation fixes for new features in 2.1.2
2015-09-06 13:25:54 +02:00
driver33 b4a8caba1c Translation fixes for new features in 2.1.2 2015-09-06 12:57:47 +02:00
Andre Bernet bab02ce9f7 French translations 2015-09-06 12:54:54 +02:00
Andre Bernet 3a09fb3777 NL translations (fix #2839) 2015-09-06 12:45:26 +02:00
Andre Bernet 7caa7f8144 French translations 2015-09-06 12:31:19 +02:00
Andre Bernet 1d9e2b7ad0 Merge remote-tracking branch 'origin/bsongis/refactoring_putsSwitches' 2015-09-06 12:16:58 +02:00
Andre Bernet 2a3e690373 Merge branch 'issue2780' 2015-09-06 12:14:42 +02:00
Andre Bernet 3f48f28079 Merge remote-tracking branch 'origin/bsongis/issue2418_better_fix' 2015-09-06 12:09:48 +02:00
Bertrand Songis 9083b1f35c Fixes #2805 2015-09-06 12:00:58 +02:00
Bertrand Songis a18ff7b502 Fixes #2800 2015-09-06 12:00:30 +02:00
Andre Bernet 0460b892d8 Companion translations updated for translators without build environment 2015-09-06 11:44:59 +02:00
Andre Bernet 4b9fcdaf9f Merge pull request #2832 from opentx/bsongis/#2810_reject_new_sensors
Fixes #2810 - Reject new sensor option
Fixes #2730 - Delete all sensors
2015-09-06 11:25:32 +02:00
Andre Bernet 91bd3f0cdb Delete all sensors (fix #2730) 2015-09-06 11:24:10 +02:00
Andre Bernet c96f8aef36 Translations weren't updated 2015-09-06 10:50:05 +02:00
Bertrand Songis bd48c4770b #2635 - Missing strings 2015-09-05 22:08:03 +02:00
Bertrand Songis 0a616cee36 Merge pull request #2751 from opentx/bsongis/issue2635_timer_haptic_countdown
Fixes #2635 - Not tested yet
2015-09-05 20:33:54 +02:00
Bertrand Songis b8923b1411 Merge pull request #2831 from opentx/bsongis/arm_tasks_refactoring
Bsongis/arm tasks refactoring
2015-09-05 20:29:20 +02:00
Bertrand Songis 57e26f4b5e Automatic tests fix 2015-09-05 14:34:34 +02:00
Bertrand Songis ffd49691f5 #2810 - Other possibility (no EEPROM change, discover button added) 2015-09-05 13:36:58 +02:00
Bertrand Songis f956563444 Merge pull request #2829 from tmrttmrt/tmrtmrt/Fixes#2825_MEGA_2560_audio_output_not_working
tmrtmrt/Fixes#2825_MEGA_2560_audio_output_not_working
2015-09-05 11:53:50 +02:00
Bertrand Songis b54123f8a3 Fixes #2810 - Reject new sensor option 2015-09-05 11:44:26 +02:00
Bertrand Songis 976c01051d Compilation fix 2015-09-05 11:37:09 +02:00
Bertrand Songis d14931f77f [ARM] Tasks stack class created
New taskinfo command added to the CLI. CLI stack size increased as it
was too short for the ls command (the CLI did hang!)
2015-09-05 11:10:18 +02:00
Bertrand Songis 2a2650376c Cosmetics 2015-09-04 18:23:54 +02:00
Bertrand Songis 17302fb6e0 [Companion] Current calibration masked on Taranis 2015-09-04 18:21:47 +02:00
jtaylor2 54cc9e0545 Cosmetic, fix line indent. 2015-09-04 06:18:46 -04:00
Bertrand Songis ff2c2d41ad Update DONATIONS.txt 2015-09-04 06:35:30 +02:00
jtaylor2 db6a68e8ed Remove printf left over from testing and correct spacing. 2015-09-03 19:03:34 -04:00
jtaylor2 967ac584a4 Add ability to set sensor instance to telemetry simulator so that it can send data to existing sensors (D sensors with instance 25).
Add default sensor values to RSSI, SWR, A1, A2, RXBat so that
alarms set with LS/SF don't constantly alarm.
2015-09-03 18:02:51 -04:00
Bertrand Songis 50b080cf61 Update DONATIONS.txt 2015-09-03 22:05:12 +02:00
Tomaz Mertelj a975d40ceb tmrtmrt/Fixes#2825_MEGA_2560_audio_output_not_working 2015-09-03 20:50:38 +02:00
David S. Beach e1b1342655 using pre-allocated table space via lua_createtable() for GPS, DATETIME, and CELLS 2015-09-03 14:41:18 -04:00
Damjan Adamic 4acebc3186 Fixes #2815: some languages were not completelly disabled and caused Companion crash 2015-09-03 12:50:35 +02:00
Damjan Adamic bd206cbbd2 Readme updated 2015-09-03 12:23:35 +02:00
Bertrand Songis c846cc582a Missing bits on 9XRPRO 2015-09-02 21:57:29 +02:00
Bertrand Songis be7b4e5064 Warning removed 2015-09-02 21:05:24 +02:00
David S. Beach 61b701f930 uncommented call to isAvailable() that was used for testing 2015-09-02 14:09:50 -04:00
David S. Beach 8b83911017 Added getValue() support for UNIT_DATETIME and UNIT_CELLS 2015-09-02 13:52:25 -04:00
Bertrand Songis 2274e6395d Issue #2806 fix start 2015-09-02 19:32:41 +02:00
Bertrand Songis f7c9da6826 Fixes #2809 2015-09-02 18:12:38 +02:00
mhotar bf6c6ac0c4 CZ translations 2015-09-01 21:18:41 +02:00
Bertrand Songis 405d83b539 Compilation fix 2015-09-01 19:38:48 +02:00
Bertrand Songis 362e7c67db Cosmetics 2015-09-01 19:35:30 +02:00
Bertrand Songis 29e2ce7bd1 Fixes #2754 2015-09-01 19:24:46 +02:00
Bertrand Songis a985d021b6 Fixes #2754 2015-09-01 18:55:44 +02:00
Bertrand Songis c907c20705 Compilation fix for Visual Studio 2015-09-01 07:29:07 +02:00
Bertrand Songis 5b4d9cd7d7 Missing #ifdef 2015-08-31 23:24:59 +02:00
Bertrand Songis 6ae59ab67c Update DONATIONS.txt 2015-08-31 21:54:07 +02:00
Bertrand Songis 6374f52585 Fixes #2418 2015-08-31 21:37:41 +02:00
Bertrand Songis 398d32821e Refactoring putsSwitches
Will simplify things when we have 64 logical switches ...
2015-08-31 20:48:32 +02:00
Damjan Adamic 771206e1b2 Merge pull request #2696 from opentx/bsongis/issue2595_cli
Fixes #2595 and #2598: USB serial port and CLI added
2015-08-31 11:06:04 +02:00
Damjan Adamic c47a43e5ce Re #2595: buffer full check got stuck (volatile was missing) 2015-08-31 10:47:28 +02:00
Damjan Adamic 62edfbb651 Merge pull request #2814 from opentx/driver33/PL_TR
Fix Polish gramar error on thousands
2015-08-30 22:04:33 +02:00
driver33 b17f697f69 Sound gramar fixes 2015-08-30 21:56:02 +02:00
driver33 8b00509cb2 Sound gramar fixes 2015-08-30 21:49:06 +02:00
Damjan Adamic ac9e9665dc Merge pull request #2813 from opentx/projectkk2glider/issue_2808_multiplex_format
Fixes #2808: Mixes multiplex representation now the same as on the radio
2015-08-30 21:39:05 +02:00
Damjan Adamic 89bb1226ac Fixes #2808: Mixes multiplex representation now the same as on the radio 2015-08-30 21:35:53 +02:00
Damjan Adamic 94cc359c9f Release notes fixed 2015-08-30 21:10:04 +02:00
Damjan Adamic 8999839538 Fixes #2807: Telemetry sensor names were not displayed 2015-08-30 21:09:35 +02:00
Damjan Adamic 09b2cd7b46 Release notes updated 2015-08-30 20:49:24 +02:00
Damjan Adamic 4b1bd9bfd5 Utility to convert issue numbers into changelog strings 2015-08-30 20:49:03 +02:00
Bertrand Songis 468b5520bd Update DONATIONS.txt 2015-08-30 19:52:08 +02:00
Damjan Adamic c0dee366c0 Merge pull request #2773 from dsbeach/issue2758
Fixes #2758: added Lua support for Latitude and Longitude
2015-08-30 17:15:55 +02:00
Damjan Adamic c767ed7159 Fixes #2811: Anomaly in Dutch Translation 2015-08-30 16:01:18 +02:00
Bertrand Songis 10e72cc214 Compilation fix 2015-08-29 09:49:27 +02:00
Bertrand Songis 7e6e709031 Merge pull request #2802 from opentx/driver33/PL_TR
fixes
2015-08-29 09:44:05 +02:00
driver33 a2514545f4 fixes 2015-08-29 00:14:00 +02:00
Bertrand Songis 57e8fc1cb1 Update DONATIONS.txt 2015-08-28 21:41:47 +02:00
Bertrand Songis 6d0d0f9b0b Merge pull request #2801 from opentx/projectkk2glider/issue_2790_power_loop
Fixes #2790: power on/off lop if big VCC capcitor was used
2015-08-28 21:34:47 +02:00
Andre Bernet 88aea7f780 Fix #2738 2015-08-28 19:25:48 +02:00
Damjan Adamic e4f7fd910c Fixes #2790: power on/off lop if big VCC capcitor was used 2015-08-28 18:07:24 +02:00
Andre Bernet 7befb457f2 Improve mixer screen layout (fix #2785) 2015-08-28 15:58:53 +02:00
Andre Bernet c22784d5a4 Fix #2796 2015-08-28 15:35:59 +02:00
Bertrand Songis 404cab2548 Bootloader compilation fix 2015-08-28 14:58:44 +02:00
Bertrand Songis ef56bf3cb4 New type swsrc_t introduced 2015-08-28 14:47:07 +02:00
Andre Bernet 3920cc6919 Fix #2794
French translations
2015-08-28 12:49:40 +02:00
Damjan Adamic 5a049857f5 Fixes #2798: Dutch translations fixed 2015-08-28 10:23:04 +02:00
Bertrand Songis 97a9c91baf Cosmetics 2015-08-28 09:53:33 +02:00
Bertrand Songis 55b5acb62e Constants renamed 2015-08-28 09:19:02 +02:00
Andre Bernet 34f7c3a463 Fix #2787 2015-08-27 23:00:02 +02:00
Andre Bernet 3002c0a478 Cosmetics 2015-08-27 22:12:54 +02:00
Andre Bernet 433983e2ca Should solve #2787, but doesn't... 2015-08-27 21:05:41 +02:00
Bertrand Songis 0a33883d49 Companion compilation fix 2015-08-27 14:42:35 +02:00
Bertrand Songis 5d7f55fa97 Remark from projectkk2glider taken into account
Serial2 connection and USB CDC output now waits there is some free space
before adding anything to the buffer
2015-08-27 14:38:47 +02:00
Bertrand Songis acad63f838 Update DONATIONS.txt 2015-08-27 13:54:54 +02:00
Andre Bernet ed2ae75c8a Fix #2774 (out of bounds access to trim array when the source of an input is not a stick) 2015-08-27 12:01:01 +02:00
Bertrand Songis dbca85c0e8 3DR removed from the blacklist
I received some excuses, and a small 1000€ donation which I shared with
Mike
2015-08-27 11:03:07 +02:00
Bertrand Songis 78a55507cd Update DONATIONS.txt 2015-08-27 10:36:23 +02:00
Bertrand Songis c3e16dac92 Fix for ARM boards without Haptic (Taranis non plus) 2015-08-27 10:34:01 +02:00
Bertrand Songis 6412361680 Merge pull request #2771 from opentx/driver33/PL_TR
Sound gramar fixes
2015-08-26 19:29:37 +02:00
Bertrand Songis 3b3fe4d946 Merge pull request #2772 from opentx/projectkk2glider/issue_2681_watchdog_fix
Projectkk2glider/issue 2681 watchdog fix
2015-08-26 19:28:12 +02:00
Bertrand Songis d1d8a32cff Update DONATIONS.txt 2015-08-26 19:19:09 +02:00
David S. Beach 8739bd8ad9 fix for issue 2758 lua support for latitude and longitude' 2015-08-25 15:48:08 -04:00
Damjan Adamic 77d3eae4d6 Re #2681 and #2626: Power off refactoring, the 9XE RTC reset prevention code now active 2015-08-25 20:36:51 +02:00
Damjan Adamic e83b7c3a69 Fixes #2681: the PWR pin was not turned on correctly in _bootStart(). Watchdog reset now works on 9XE, the Bootloader exit also works.
Trim switch pull up not enabled for 9XE in _bootStart().
Added watchdog test option in DEBUG screen (long press MENU key), use WATCHDOG_TEST=YES compile option to enable it.
2015-08-25 20:35:07 +02:00
Kjell Kernen f4e55f9d45 Merge branch 'master' of https://github.com/opentx/opentx 2015-08-25 20:21:57 +02:00
Kjell Kernen 8bde8ca7b4 Swedish Companion translation 2015-08-25 20:20:35 +02:00
driver33 d00b9eb8ec Sound gramar fixes 2015-08-25 19:26:37 +02:00
Andre Bernet 2f5682e25a Typo, removed dead code 2015-08-25 16:57:00 +02:00
Andre Bernet 0d6907c76c Preliminary ar9x board support 2015-08-25 16:20:08 +02:00
Andre Bernet 710ed9c5d1 PXX wasn't enabled on sky9x 2015-08-25 16:18:20 +02:00
Andre Bernet c53ba92139 Sky9x platform fixes 2015-08-25 16:16:45 +02:00
Bertrand Songis 5e2fe112b0 Merge pull request #2729 from opentx/projectkk2glider/issue_2728_edge_bug
Fixes #2728: edge switch could trigger right after the logicalSwitche…
2015-08-25 10:00:36 +02:00
Bertrand Songis 001c400f47 Merge branch 'master' into projectkk2glider/issue_2728_edge_bug
# Conflicts:
#	radio/releasenotes.txt
2015-08-25 09:59:24 +02:00
Bertrand Songis 983a4da111 Merge pull request #2760 from opentx/driver33/PL_TR
Companioen pl translation fixes
2015-08-25 09:53:58 +02:00
driver33 d42a29570c Companioen pl translation fixes 2015-08-24 20:36:26 +02:00
Bertrand Songis c2e35ddd9c Update DONATIONS.txt 2015-08-24 18:22:06 +02:00
Damjan Adamic 0f91d66b49 Merge pull request #2752 from opentx/bsongis/comparedialog_printdialog_refactoring
PrintDialog / CompareDialog refactoring. Fixes #2737 and #2576. I also completes some of the tasks in #1063.
2015-08-23 22:31:39 +02:00
Damjan Adamic 6ac811076e Fixes #2576: display receiver number in model print/compare 2015-08-23 22:17:27 +02:00
Damjan Adamic 2530caa16e Flight mode representation reverted back (additional fix), unneeded condition removed 2015-08-23 21:56:51 +02:00
Damjan Adamic a1a50041dd Flight mode representation reverted back 2015-08-23 21:03:48 +02:00
Damjan Adamic 65bdd25173 Various fixes: modelPrinter free, mixer crash, trims display, channel names, monospace font 2015-08-23 16:00:37 +02:00
Bertrand Songis 096b3c98a4 Update DONATIONS.txt 2015-08-23 15:55:46 +02:00
Bertrand Songis fbd7fa4464 Update DONATIONS.txt 2015-08-23 15:41:00 +02:00
Damjan Adamic 0c7e545b42 Cosmetics 2015-08-23 15:33:09 +02:00
Bertrand Songis ed05174fc8 PrintDialog / CompareDialog refactoring 2015-08-23 09:54:15 +02:00
Bertrand Songis a8db4c4fa5 Fixes #2635 - Not tested yet 2015-08-23 09:21:45 +02:00
Damjan Adamic ab1ce7515c Removal of unneeded LUA_EXPORT_TELEMETRY() macro 2015-08-22 20:52:08 +02:00
Damjan Adamic 34090a1d3e Fix: former Lua telemetry fields were not exported correctly (tx-voltage, clock and timers1-3) 2015-08-22 20:44:11 +02:00
Damjan Adamic 60c925a721 Fixes #2733: Minor tweaks to Dutch Translation 2015-08-21 20:55:26 +02:00
Damjan Adamic 36d5f42b66 Merge pull request #2727 from opentx/MicheleVilla/FW_IT_Translations
Update it.h.txt
2015-08-21 20:36:06 +02:00
Damjan Adamic 3075ad857e Fixes #2734: fixed endless loop in model compare (varable i was used both in outer and inner for loops) 2015-08-19 22:23:37 +02:00
Damjan Adamic 4056287d3d Re #2728: Release notes updated 2015-08-18 20:12:54 +02:00
Damjan Adamic 537d7e089f Fixes #2728: edge switch could trigger right after the logicalSwitchesReset() was called 2015-08-18 20:03:54 +02:00
Damjan Adamic b10276bb34 Added missing keys initialization for simu 2015-08-18 19:54:25 +02:00
Damjan Adamic e685528fd3 Re #2623: fixed f_getcwd() on Windows 2015-08-18 17:31:49 +02:00
Michele 7498ab9957 Update it.h.txt 2015-08-17 21:11:16 +02:00
Bertrand Songis 9f19deb1e2 Update DONATIONS.txt 2015-08-17 13:57:39 +02:00
Bertrand Songis 616741888e Merge pull request #2701 from opentx/projectkk2glider/issue_2671_battery_bars
Re #2671: fixes difference between top and main LCD TX battery bars, …
2015-08-17 13:56:14 +02:00
Damjan Adamic 5b4f0a0bbb Re #2671: fixes difference between top and main LCD TX battery bars, code made more readable with macros 2015-08-17 13:55:41 +02:00
Bertrand Songis 00a5437dde Merge pull request #2721 from opentx/MicheleVilla/FW_IT_Translations
Update it.h.txt
2015-08-17 13:52:03 +02:00
Bertrand Songis 379d432365 Merge pull request #2691 from opentx/projectkk2glider/issue_2623_sd_manager_fixes
Fixes #2623: several fixes:
2015-08-17 13:51:35 +02:00
Damjan Adamic 744c560255 Fixes #2623: macro for node type introduced, cosmetics 2015-08-17 13:40:28 +02:00
Damjan Adamic 28b9a70e6b Fixes #2623: several fixes:
Disable menu for [..],
Refresh file list after delete,
Copy destination can be a directory,
Prevent copy/paste into the same directory,
Enabled renaming of directories and files without extension,
Removed delete menu option for directories,
Several simulator filesystem functions improved
2015-08-17 13:40:27 +02:00
Bertrand Songis f5f1a052ca Fixes #2580 2015-08-17 13:37:26 +02:00
Michele e8f28cc681 Update it.h.txt
update Italian translation
2015-08-16 13:30:34 +02:00
Damjan Adamic 23c985ffd6 Fixes #2719: Dutch translations by fraternl 2015-08-16 11:10:07 +02:00
Damjan Adamic 3dc781c89c Re #2714: more Italian translations fixed (changes ported from en.h.txt) 2015-08-16 11:03:10 +02:00
Damjan Adamic 4d7f456be5 Re #2714: Italian translations fixed 2015-08-16 10:25:32 +02:00
Damjan Adamic 154572e547 Separate context menu for "General Settings", cosmetics 2015-08-16 09:28:43 +02:00
Damjan Adamic 3469fa5c93 Release notes updated 2015-08-16 09:04:34 +02:00
Damjan Adamic dcce01fa9c Merge pull request #2712 from opentx/griebd/model_wizard_issue_2711
Griebd/model wizard issue 2711
2015-08-16 09:02:13 +02:00
Grieb 56bc0d817f Fix #2091 2015-08-15 11:14:37 -03:00
Grieb 71706d5e93 Cosmetcs. (editor save removes trailing spaces) 2015-08-15 11:13:57 -03:00
Damjan Adamic b8c51c9bf0 Release notes updated 2015-08-15 14:03:40 +02:00
Damjan Adamic e68b421de3 Release notes updated 2015-08-15 14:00:39 +02:00
Damjan Adamic 32ca88dbf8 Release notes updated 2015-08-15 13:16:56 +02:00
Damjan Adamic 4d83dd2c24 Fixes #2684: Lua model scripts outputs not working in a simulator 2015-08-15 12:59:35 +02:00
Damjan Adamic 330a91441a Compilation fixes for Bin Allocator 2015-08-15 12:39:27 +02:00
Bertrand Songis affda2d8fe Update DONATIONS.txt 2015-08-15 11:23:43 +02:00
Bertrand Songis e7f3c280f0 Update DONATIONS.txt 2015-08-15 11:06:14 +02:00
Bertrand Songis 89c27cfcca Fixes #2704 2015-08-14 11:45:09 +02:00
Bertrand Songis 9303361d6b Fixes #2702 2015-08-13 18:14:54 +02:00
Bertrand Songis 82c8246c25 Merge pull request #2703 from opentx/MicheleVilla/Fix_FW_IT_Translations
Some Fix for it.h.txt
2015-08-13 13:26:43 +02:00
Bertrand Songis c0f2dddfa1 Create DONATIONS.txt 2015-08-13 13:25:11 +02:00
Michele db8ee18b5d Update it.h.txt 2015-08-13 10:12:05 +02:00
Bertrand Songis e3c9ecd26e Merge pull request #2698 from opentx/driver33/PL_TR
companion translation fix
2015-08-12 10:24:28 +02:00
driver33 5df19e1c3d companion translation fix 2015-08-12 10:18:38 +02:00
Bertrand Songis 3384ad2235 Update DONATIONS.txt 2015-08-12 07:36:19 +02:00
Damjan Adamic d693ccd4f0 Top part of the 9XE startup graphics was not shown, lcdRefreshWait() was in wrong place 2015-08-11 23:33:41 +02:00
Bertrand Songis 47547e2397 Merge pull request #2697 from opentx/projectkk2glider/issue_2671_lcd_fixes
Projectkk2glider/issue 2671 lcd fixes
2015-08-11 22:49:34 +02:00
Bertrand Songis 51f46d9a69 Compilation fix 2015-08-11 22:26:43 +02:00
Damjan Adamic 04a8570d48 Re #2671: added TX battery blinking on batter warning, fixed display problem when battery voltage lower than batlow value. 2015-08-11 22:22:18 +02:00
Damjan Adamic 806c343b80 Re #2671: voltage symbol changed to upper case in putsVolts(). 2015-08-11 22:18:35 +02:00
Bertrand Songis 17cb8f9459 Cli fixes 2015-08-11 22:06:30 +02:00
Bertrand Songis 1fdecd1ad4 Gtests false positive error 2015-08-11 19:15:12 +02:00
Bertrand Songis 900b53f165 Fixes #2693 2015-08-11 19:00:01 +02:00
Bertrand Songis 6356fbb2f4 Comments from projectkk2glider addressed 2015-08-11 18:15:43 +02:00
Bertrand Songis 979ece9208 Update DONATIONS.txt 2015-08-11 18:07:13 +02:00
Bertrand Songis a1df80a7f7 Ignore list updated 2015-08-11 06:58:27 +02:00
Bertrand Songis a5bb41a31b Cosmetics 2015-08-11 06:56:02 +02:00
Bertrand Songis 9b527b1810 First compilation fixes, thanks to Jenkins first comments 2015-08-10 23:00:45 +02:00
bertrand 2b312fdbb4 Fixes #2595 - Cli added
Based on projectkk2glider work, with a lot of bugs I am sure. Still not
tested, this is why I preferred working on my own branch. I push it now
so that Jenkins do the first tests and you can review if I am on the
right track. 

I am really wondering if a merge with the Lua api would be possible /
nice, what do you think?
2015-08-10 22:52:26 +02:00
Andre Bernet 2d9c130839 Merge pull request #2687 from opentx/bsongis/osx
Mac libraries now loaded correctly (Fixes #2678)
2015-08-10 11:03:13 +02:00
Bertrand Songis a569c67371 Fixes #2678 2015-08-10 01:08:56 +02:00
Bertrand Songis ada0f3d8b4 Merge pull request #2686 from opentx/projectkk2glider/issue_2685_d-type_altitude_fix
Fixes #2685: D-type altitude fixes (negative values, hi/lo precision …
2015-08-09 22:48:25 +02:00
Damjan Adamic 192f5a1bd7 Fixes #2685: D-type altitude fixes (negative values, hi/lo precision vario) 2015-08-09 22:21:46 +02:00
Damjan Adamic 70d77fd851 Re #2598: removed bad include 2015-08-09 16:02:35 +02:00
Damjan Adamic f7a8715657 Fixes #2598: added USB serial port (with echo example), use USB=SERIAL to enable. If DEBUG=YES then debug output also goes to the USB serial port 2015-08-09 15:41:24 +02:00
Damjan Adamic 5d8c86923b Re #2607: gtest for hi precision VFAS added 2015-08-08 18:17:09 +02:00
Damjan Adamic a6e53bd419 Cosmetics 2015-08-08 17:46:22 +02:00
Andre Bernet 08756af9f5 Don't import install dir settings from old versions (fix #2645) 2015-08-08 11:21:48 +02:00
Bertrand Songis 447df60823 Revert "[9XR-PRO] HiFi audio now :)"
This reverts commit 3d792ea4df.
2015-08-08 11:11:53 +02:00
Bertrand Songis 3d792ea4df [9XR-PRO] HiFi audio now :) 2015-08-08 10:58:52 +02:00
Bertrand Songis 26a38913a8 Fixes #2668 2015-08-08 10:06:52 +02:00
Bertrand Songis 238335dec6 Compilation error on VC++ 2015-08-08 09:32:31 +02:00
Bertrand Songis 1efbde7d46 Fixes #2660 2015-08-08 00:41:50 +02:00
Bertrand Songis 1e92313dcd 2.1.2 start ... 2015-08-08 00:38:18 +02:00
Bertrand Songis e174255ddb Indentation 2015-08-08 00:20:30 +02:00
Bertrand Songis 4b0841b17d _NOCCM renamed to __DMA (which is 32bits aligned on Sky9x/9XR-PRO) 2015-08-08 00:16:51 +02:00
Bertrand Songis e136905e75 Better fix for #2665 2015-08-08 00:12:39 +02:00
Bertrand Songis 7c0d9c7009 Revert "Fixes #2665"
This reverts commit c251865538.
2015-08-08 00:11:46 +02:00
Bertrand Songis c251865538 Fixes #2665 2015-08-07 18:48:23 +02:00
Bertrand Songis e079148249 Typo in release notes 2015-08-07 15:31:20 +02:00
Bertrand Songis fab861e8bd Update DONATIONS.txt 2015-08-07 15:15:12 +02:00
Damjan Adamic d0c696c1bc Another typo in release notes 2015-08-06 22:39:42 +02:00
Damjan Adamic 7b75c04b30 Typo in release notes 2015-08-06 22:22:42 +02:00
Damjan Adamic 572cfd67af Fixes #2658: real fix 2015-08-06 22:09:34 +02:00
Bertrand Songis c7a07ded12 Merge pull request #2659 from opentx/projectkk2glider/issue_2658
Fixes #2658: Companion release notes before/after new version downloa…
2015-08-06 22:04:03 +02:00
Damjan Adamic 4e7181fb7e Fixes #2658: Companion release notes before/after new version download broken 2015-08-06 22:01:05 +02:00
Bertrand Songis fce1cc681a Fixes #2657 2015-08-06 20:06:48 +02:00
Bertrand Songis a7b62fc2a9 Merge pull request #2651 from opentx/projectkk2glider/additional_kts_conversions
Added conversions of knots to m/s and f/s
2015-08-06 19:28:45 +02:00
Bertrand Songis 6fcecb5666 Merge pull request #2653 from opentx/projectkk2glider/issue_2638_9xe_logs
Fixes #2638: header line for logs fixed for 9XE
2015-08-06 19:28:05 +02:00
Bertrand Songis d837739e4f Merge pull request #2654 from opentx/projectkk2glider/issue_2652
Fixes #2652:  Add missing presets to frskyDSetDefault()
2015-08-06 19:25:45 +02:00
Bertrand Songis a530bc7a6f Update DONATIONS.txt 2015-08-06 19:05:13 +02:00
Damjan Adamic 32a7c9aee6 Re #2652: filtering for Sport RSSI reverted (reason: too few samples per second) 2015-08-06 14:47:13 +02:00
Damjan Adamic 5fe10c118d Re #2638: Release notes update 2015-08-06 14:35:09 +02:00
Damjan Adamic 815fef458c Fixes #2652: Add missing presets to frskyDSetDefault() 2015-08-06 14:31:50 +02:00
Damjan Adamic 20eff3358a Fixes #2638: header line for logs fixed for 9XE 2015-08-06 14:24:40 +02:00
Damjan Adamic 98c1503bed Added conversions of knots to m/s and f/s 2015-08-06 12:37:45 +02:00
Damjan Adamic 7c8093b70f Fixes #2649: Fixed missing LUA script outputs in special function "Play Value" 2015-08-06 09:32:17 +02:00
Bertrand Songis edba5bcf89 Tonight ... 2015-08-06 06:45:19 +02:00
Bertrand Songis 0a75eb93d3 Cosmetics 2015-08-06 00:40:46 +02:00
Bertrand Songis a2c30b1849 [Companion] Blacklist added (for companies who don't respect the GPL) 2015-08-06 00:16:24 +02:00
Damjan Adamic 386cb2c912 Release notes updated, date set to today 2015-08-05 22:53:58 +02:00
Bertrand Songis 60dc533fe8 Update DONATIONS.txt 2015-08-05 21:49:54 +02:00
Bertrand Songis 6c0a9714fc [9XR-PRO] Wrong code comment
Thanks project2gglider! It was a copy-paste from Mike's code. When I
will have spare time I will replace those numbers by constants...
2015-08-05 21:43:24 +02:00
Bertrand Songis 15469aeaf7 Fixes #2643 2015-08-05 21:37:22 +02:00
Bertrand Songis a8ff8b524b Fixes #2634 - Option ALLOW_NIGHTLY_BUILDS added 2015-08-05 18:51:50 +02:00
Bertrand Songis 2378080ae8 Fixes #2631 2015-08-05 18:50:22 +02:00
Bertrand Songis 23e16b26f1 Fixes #2592 - No more reset on 9XR-PRO when leaving PXX protocol
I would like a code review for this one (both Taranis and 9XR-PRO),
thanks!
2015-08-05 18:49:41 +02:00
Bertrand Songis 3353d989bb [9X/9XR-PRO] Cosmetics in Model Select screen 2015-08-05 18:47:06 +02:00
Bertrand Songis 58659b9b1a [Companion] It now remembers the last flashed firmware 2015-08-05 18:36:14 +02:00
Bertrand Songis f4eab9bf58 [9XR-PRO] Valgrind warnings removed 2015-08-05 18:35:26 +02:00
Bertrand Songis 57f5f68804 [9XR-PRO] Bugfixes port from Taranis on Global Custom Functions 2015-08-05 18:34:41 +02:00
Bertrand Songis 5c4b12dfc2 [9XR-PRO] Cosmetics in Statistics view 2015-08-05 18:32:36 +02:00
mhotar 99ff846209 CZ translations 2015-08-05 12:13:51 +02:00
Bertrand Songis 37dd2b0064 Release notes date set to tomorrow 2015-08-05 07:00:09 +02:00
Bertrand Songis 9c20658e26 Update DONATIONS.txt 2015-08-04 21:36:22 +02:00
Bertrand Songis 6e6e80bcfc Fixes #2605 2015-08-04 20:21:37 +02:00
Andre Bernet 185ad88bc8 Dutch translations by fraternl 2015-08-04 09:31:16 +02:00
Bertrand Songis 54405135c0 Fixes #2618 2015-08-03 23:20:12 +02:00
Bertrand Songis d7cf14857e Cosmetics 2015-08-03 23:18:33 +02:00
Bertrand Songis 5417c426e3 Merge pull request #2622 from opentx/projectkk2glider/issue_2607
Fixes #2607: Added support for 0.01V resolution to D series VFAS ID 0x39
2015-08-03 22:38:32 +02:00
Bertrand Songis 3f6621b087 [9XR-PRO] Only the first 64k EEPROM could be written because of uint16_t 2015-08-03 22:36:57 +02:00
Bertrand Songis 151fb59e27 Cosmetics 2015-08-03 22:36:02 +02:00
Bertrand Songis a2902280b0 #2619 - Stupid bug
Only ~62 EEPROM write and then we get an INVALID EEPROM
2015-08-03 22:35:16 +02:00
Bertrand Songis 10832ad60a #2619 - Valgrind complains on EEPROM block erase
Should not change anything though.
2015-08-03 22:33:28 +02:00
Damjan Adamic 121f7780c2 Fixes #2607: Added support for 0.01V resolution to D series VFAS ID 0x39 2015-08-02 18:39:58 +02:00
Damjan Adamic 25d233e832 Release notes updated 2015-08-02 17:42:30 +02:00
Andre Bernet 46de8229dd Small screen platform string fixes 2015-08-02 17:06:20 +02:00
Andre Bernet 813956721d Ignore sensor IDs for small screen platforms 2015-08-02 17:05:29 +02:00
Andre Bernet 302bf05f57 Revert git attributes 2015-08-02 11:04:56 +02:00
Bertrand Songis 977e44d44a Fixes #2592 - Needs test with next nightly builds
Please confirm if this is fixed or not, I don't have a 9XR-PRO with me
here!
2015-08-01 22:43:54 +02:00
Bertrand Songis 105ac6306a Frsky-D Telemetry protocol bug (0x5D followed by 0x3D)
I should add a non regression test...
2015-08-01 22:29:09 +02:00
Bertrand Songis 3c1734bdb2 Fixes #2612 2015-08-01 22:21:24 +02:00
Bertrand Songis 9546843bc2 Cosmetics 2015-08-01 21:09:06 +02:00
Bertrand Songis bf89c53f33 #2106 - .gitattributes updated, please check what I did, thanks! 2015-08-01 20:24:47 +02:00
Bertrand Songis 406e69ab1d Cosmetics 2015-08-01 20:20:18 +02:00
Bertrand Songis 753cb4f01c #2106 - Script which will unify line endings (and code formatting) 2015-08-01 20:17:30 +02:00
Bertrand Songis 40c34644b8 Proposal for an uncrustify configuration 2015-08-01 20:14:03 +02:00
Bertrand Songis b3b534cd6d #2106 - Unify the include guards in all headers 2015-08-01 20:10:57 +02:00
Bertrand Songis 491886a5c2 #2106 - Unify the copyright in source files 2015-08-01 20:08:09 +02:00
Andre Bernet 44c096c366 Align airspeed units to S.Port spec (Fix #2305) 2015-08-01 19:22:59 +02:00
Bertrand Songis 68eafbfba7 Merge pull request #2614 from opentx/driver33/PL_TR
New lines translation
2015-08-01 19:22:09 +02:00
driver33 dd5fd62b41 New lines translation 2015-08-01 19:16:32 +02:00
Andre Bernet a1bc46e473 Fix SBUS trainer failsafe detection 2015-08-01 17:48:02 +02:00
Bertrand Songis eedaf1966e Merge pull request #2613 from opentx/mhotar/cz_sk_tts
#2610 Mhotar/cz sk tts
2015-08-01 17:40:14 +02:00
mhotar 3cbbcf18c8 #2610 CZ unicode fix in tts.py 2015-08-01 17:23:20 +02:00
Andre Bernet 9a70c84179 Companion translations updated for translators without build environment 2015-08-01 16:51:33 +02:00
Andre Bernet 9546636f0a French translations 2015-08-01 16:38:14 +02:00
Andre Bernet ecd9f1e2cf Missing translation 2015-08-01 15:34:00 +02:00
Andre Bernet 310321ce0e Add Timer3 to stats screen (Fix #2515) 2015-08-01 15:24:13 +02:00
Andre Bernet 39c0b79f85 Copy telemetry sensors (Fix #2513) 2015-08-01 15:07:55 +02:00
Andre Bernet 70e93fb493 X9E rotary encoder now generates EVT_KEY_BREAK events (Fix #2609) 2015-08-01 13:43:54 +02:00
mhotar 8a202f0ecc #2610 sk tts 2015-08-01 13:08:45 +02:00
mhotar 53a77a5bdb #2610 cz tts 2015-08-01 12:46:52 +02:00
Andre Bernet b83ad1899a Fix hardware menu navigation 2015-08-01 11:24:52 +02:00
Andre Bernet 80aee0d126 Revert "Bug in hardware menu, the "Serial port" could not be changed"
This reverts commit b9d0154e909df5131bd9139592bc0f1b4571f3a8.
2015-08-01 11:24:52 +02:00
Andre Bernet df82aeed76 French translations 2015-08-01 11:24:51 +02:00
Damjan Adamic 70d67dd7dd Export to Google Earth now working (only) with the new telemetry fields (GPS, GAlt and GSpd) 2015-08-01 10:53:06 +02:00
Damjan Adamic 922220c748 Re #2579: added missing source trainer_input.cpp to simulator 2015-08-01 10:23:21 +02:00
Bertrand Songis 819509b63a Merge pull request #2608 from opentx/raphaelcoeffic/issue2549
Fixes #2549 - Use PrefixPath to find the simulator libs
2015-08-01 08:44:27 +02:00
Bertrand Songis db072442c8 Merge pull request #2606 from opentx/raphaelcoeffic/issue2579
Fixes #2579: Added support for Trainer signal alarm
2015-08-01 08:41:50 +02:00
Damjan Adamic c1efd39df7 Better Lua traces 2015-07-31 18:59:20 +02:00
Damjan Adamic f5dca813fb Bug in hardware menu, the "Serial port" could not be changed 2015-07-31 18:59:02 +02:00
Damjan Adamic 1bc8e0d6c1 Added main stack painting for STM32F4 2015-07-31 18:58:50 +02:00
Raphael Coeffic 0fba4a638d removed PrefixPath debug line 2015-07-31 10:43:54 +02:00
Raphael Coeffic 71530f253d Fixes #2549 - Use PrefixPath to find the simulator libs 2015-07-31 10:41:16 +02:00
Bertrand Songis 274ed3a917 Update DONATIONS.txt 2015-07-31 09:40:01 +02:00
Raphael Coeffic ebae27272e renamed g_ppmInXXX into ppmInputXXX
g_ppmIns -> ppmInput
g_ppmInputValidityTimer -> ppmInputValidityTimer
2015-07-30 22:43:56 +02:00
Raphael Coeffic 3049ff768e changed ppmInValid in tests/mixer.cpp as well 2015-07-30 22:07:16 +02:00
Raphael Coeffic f6bff9683d Fixes #2579: Added support for Trainer signal alarm
- added alarm “Trainer signal lost” & “Trainer signal recovered”.
- moved PPM capture code to trainer_input.{h,cpp}
2015-07-30 21:53:44 +02:00
Bertrand Songis 013c10e7fb Update DONATIONS.txt 2015-07-30 20:42:58 +02:00
Bertrand Songis af38cb6dff Update DONATIONS.txt 2015-07-30 20:38:24 +02:00
Bertrand Songis 3d461b771f Update DONATIONS.txt 2015-07-30 20:20:33 +02:00
Bertrand Songis cee35869ba Update DONATIONS.txt 2015-07-30 20:12:52 +02:00
Bertrand Songis b6a2e89c17 Update DONATIONS.txt 2015-07-29 23:34:44 +02:00
Bertrand Songis 7cf03bd74e Merge pull request #2600 from opentx/MicheleVilla/FW_It_translation_fix
Fix FW Italian Translation
2015-07-29 21:52:40 +02:00
Michele 776dec5c74 Update it.h.txt 2015-07-29 21:14:14 +02:00
bsongis 23b9d77217 Fixes #2561 2015-07-29 20:48:37 +02:00
Bertrand Songis 06dc5136f7 Merge pull request #2599 from hrenz/patch-8
Patch 8
2015-07-29 20:35:00 +02:00
bsongis b8b6263c75 Fixes #2589 2015-07-29 20:13:16 +02:00
Bertrand Songis 8cc98a53f3 Merge pull request #2597 from opentx/driver33/PL_TR
new strings translation
2015-07-29 19:35:59 +02:00
Bertrand Songis 67e0ecfa0b Merge pull request #2594 from raphaelcoeffic/sbus_failsafe
Added support for SBUS failsafe bit
2015-07-29 19:34:06 +02:00
hrenz b7f52f2521 Update de.h.txt 2015-07-29 19:03:48 +02:00
hrenz c6e9939024 Update de.h.txt
only some chars changed
2015-07-29 18:42:42 +02:00
hrenz dd3cbda0c7 Update de.h.txt 2015-07-29 18:37:00 +02:00
hrenz 260c7cd0c0 Update de.h.txt
some changes for X9E
and master
2015-07-29 18:33:14 +02:00
Damjan Adamic ee6b2da037 Cosmetics related to #1063 2015-07-29 18:05:27 +02:00
driver33 f52c95ed55 new strings translation 2015-07-29 16:49:20 +02:00
Raphael Coeffic d2ed8d9287 Beautified SBUS code
- use “defines” for each constant.
- do not change the frame pointer while checking frame validity (improves readability).
2015-07-29 08:47:58 +02:00
bsongis a9c60a45e9 Fixes #2586 2015-07-28 23:50:46 +02:00
Raphael Coeffic 0cfe5b6c76 Added support for SBUS failsafe bit 2015-07-28 23:29:04 +02:00
Bertrand Songis c8115c674d Merge pull request #2590 from opentx/projectkk2glider/print_and_compare_refactoring_21
Projectkk2glider/print and compare refactoring 21
2015-07-28 21:48:45 +02:00
Damjan Adamic b67dfbd086 Cosmetics 2015-07-28 21:15:33 +02:00
Damjan Adamic 4e4d0fe883 Re #1063: Deduplication of code for Inputs, Mixers, Logical Switches and Special Functions 2015-07-28 20:57:06 +02:00
Bertrand Songis 34c311a562 Merge pull request #2582 from opentx/projectkk2glider/issue_2581
Fixes #2581: symbols for renamed physical inputs were missing
2015-07-28 00:55:49 +02:00
Damjan Adamic 1da0f157de Fixes #2581: symbols for renamed physical inputs were missing 2015-07-27 21:24:51 +02:00
Bertrand Songis 545f54a89c Merge pull request #2548 from opentx/bsongis/bad_sport_sensors
#2538 - Proposal for a fix.
2015-07-27 07:39:03 +02:00
bsongis dad815f631 [Companion] AutoCheckBox used instead of QCheckBox 2015-07-27 07:36:38 +02:00
bsongis 9ca09d0a85 Cosmetics 2015-07-27 01:00:48 +02:00
bsongis 71f8b663cb Fixes #2559 - Needs test (next nightly build) 2015-07-27 01:00:48 +02:00
Bertrand Songis be9a26611f Simulators added to the Resources directory 2015-07-26 17:28:25 +02:00
Bertrand Songis d9362d2634 Hardcoded path removed 2015-07-26 16:24:52 +02:00
Bertrand Songis 09d6fa833f Merge pull request #2571 from opentx/projectkk2glider/issue_2533
Fixes #2533: menu was wrong if all items on the end were hidden
2015-07-26 15:06:57 +02:00
Bertrand Songis c7ff93fdf4 Update DONATIONS.txt 2015-07-26 15:05:59 +02:00
Damjan Adamic c2e73c74a6 Fixes #2533: menu was wrong if all items on the end were hidden 2015-07-26 15:02:08 +02:00
bsongis d2e38364e6 [OSX] opentx-simulators-bundle now inside makedmg target. Perhaps still
a missing cp of the libs somewhere, inside companion.app?
2015-07-26 14:55:46 +02:00
Bertrand Songis 404eefc3da Run install_name_tool on all dylib files 2015-07-26 14:06:25 +02:00
Bertrand Songis ba1c429554 Merge pull request #2568 from opentx/driver33/PL_TR
Comapnion translation fixes
2015-07-26 14:03:52 +02:00
driver33 0df47c19c7 Comapnion translation fixes 2015-07-26 13:23:20 +02:00
Bertrand Songis 027df32564 Merge pull request #2566 from opentx/driver33/PL_TR
Small fixes in letters and ajustments.
2015-07-26 12:53:16 +02:00
Bertrand Songis 21353d2b31 OSX last commit fix 2015-07-26 12:43:13 +02:00
bsongis f1df8ead68 [OSX] It should not be needed to manually copy SDL into the bundle now 2015-07-26 12:37:50 +02:00
driver33 dbac5b773f Fixes in FW translation 2015-07-26 11:41:13 +02:00
Jacek Drewniak fb1cdeeac1 Merge pull request #2565 from opentx/master
make equal
2015-07-26 11:32:59 +02:00
bsongis 8a66e883ec Typo when porting the mod for simulators not working on OSX 2015-07-26 09:15:59 +02:00
bsongis 1922bc9edd #2563 - Still needs mods on the server 2015-07-26 08:43:56 +02:00
Andre Bernet cc41d69954 Companion part 2015-07-26 00:12:30 +02:00
bsongis 771b7a1821 Should add the simulators to the OSX platform. But here Companion
doesn't run anymore. Instead the standalone simulator is fine.
2015-07-25 21:40:35 +02:00
Andre Bernet a3fa0bd79d We need to ignore the instance, not the data Id ;) 2015-07-25 18:11:02 +02:00
Andre Bernet 19e68bac4d RSSI lacked unit (Fix #2557)
dBm renamed to dB (made no sense)
2015-07-25 18:02:14 +02:00
mhotar 983e9f2f2b CZ translations-telem.screen names fixed 2015-07-25 17:28:25 +02:00
Andre Bernet 311b5e1d04 Number of SFs was actually wrong too! 2015-07-24 22:02:46 +02:00
Andre Bernet 9b002b94ca GF enabled checkbox was missing (Fix #2558)
Number of GF in setup panel was not aligned with the radio
2015-07-24 21:54:46 +02:00
bsongis 69cbb06470 Fixes #2271 2015-07-24 16:35:05 +02:00
Bertrand Songis 2b25071e8c Merge pull request #2551 from opentx/driver33/PL_TR
Adds new translations, some letter and words fixes
2015-07-24 11:25:49 +02:00
Jacek Drewniak c9d465ca2a Adds new translations, some letter and words fixes 2015-07-24 11:07:31 +02:00
bsongis e1dfb15ba9 Fixes #2546 2015-07-24 10:42:12 +02:00
bsongis 7e44eab63c Fixes #2534 2015-07-24 10:07:11 +02:00
Bertrand Songis 7e7a762617 Fixes #2535 2015-07-24 09:31:04 +02:00
Bertrand Songis d5c2d51dea Update DONATIONS.txt 2015-07-24 00:31:33 +02:00
Bertrand Songis 7d2e48a99b Fixes #2544 2015-07-23 22:42:59 +02:00
Bertrand Songis 4ea9e5c11f The ':' separator is not a so good idea in Windows installer (ADS) 2015-07-23 21:17:18 +02:00
Bertrand Songis 8f96f50a84 New version format (mandatory for small screens) 2015-07-23 19:07:06 +02:00
bsongis c90bf43d17 [Companion] Possibility to have a suffix 2015-07-23 18:49:22 +02:00
bsongis 2549e2a2de [Companion] make clean now deletes the stamp in firmware sources 2015-07-23 18:48:11 +02:00
bsongis 658ca48137 OpenTX removed from radio type 2015-07-23 18:46:18 +02:00
bsongis c64369e95f Default tab is again 0 in Preferences Dialog 2015-07-23 18:45:00 +02:00
bsongis 6eec7789cc Cosmetics 2015-07-23 18:44:19 +02:00
bsongis 1b6f34069a Previous version-indexes were not anymore supported 2015-07-23 18:42:39 +02:00
bsongis 98b4d26676 Fixes #2542 2015-07-23 18:34:32 +02:00
bsongis 62ae7ef2bd Simplification - related to #2545 - Needs to be tested again 2015-07-23 18:30:15 +02:00
bsongis c9a58e5cfa EN Cosmetics 2015-07-23 18:28:21 +02:00
bsongis 4d5c4621c7 [Companion] French translations typos 2015-07-23 18:22:34 +02:00
bsongis 2af072ea7f [Companion] Missing errors when flashing/reading Firmware / EEPROM
(window closed really quickly)
2015-07-23 18:16:37 +02:00
bsongis 2341f5be68 Fixes #2543 2015-07-23 07:19:33 +02:00
bsongis a100af81be Fixes #2541 2015-07-22 22:56:36 +02:00
bsongis 6f21556b81 #2538 - Proposal for a fix. We have many wrong sensors, including
openXsensor. The first ID is stored in EEPROM, but not used during the
search loop
2015-07-22 22:30:37 +02:00
bsongis 8d97235f41 #2526 - Firmware nightly builds are now downloadable from Companion -
Tests needed
2015-07-22 22:25:03 +02:00
Damjan Adamic 0559abd323 Release notes updated 2015-07-22 20:28:49 +02:00
bsongis d0211c5dc6 Update DONATIONS.txt 2015-07-22 19:33:06 +02:00
bsongis f42cf4c0f4 Adds the possibility to have a suffix in the firmware version 2015-07-22 19:31:18 +02:00
bsongis a8d4ba5758 Warning removed. HELI option really needs to be tested 2015-07-22 18:58:12 +02:00
bsongis a94d08606f Fixes #2517 2015-07-22 18:55:54 +02:00
bsongis 0a213389f4 Fixes #2539 2015-07-22 18:42:02 +02:00
Bertrand Songis 7041a4dac6 Update DONATIONS.txt 2015-07-22 18:36:13 +02:00
Bertrand Songis 97cc519bcb Merge pull request #2536 from opentx/projectkk2glider/issue_2530_and_2531
Fixes #2531: VFAS id 0x39: was 10x to small
2015-07-21 23:03:46 +02:00
Damjan Adamic 6fffd7fbae Fixes #2531: VFAS id 0x39: was 10x to small
Fixes #2530: VFAS id 0x3A and 0x3B: wrong calculation of value
2015-07-21 21:43:02 +02:00
Damjan Adamic d2bd78b366 Release notes updated 2015-07-21 21:14:43 +02:00
bsongis e758d524de [Companion] Vario / Voltage / Current sources export problem 2015-07-21 20:46:07 +02:00
Damjan Adamic d967ec0b80 Re #2500: new names for Linux targets (companion21 and simulator21), the dot was removed 2015-07-21 20:32:04 +02:00
bsongis 4509b1a2a7 Fixes #2533 2015-07-21 20:24:13 +02:00
Andre Bernet 4626550c53 D-type RPM sensor was broken (Fix #2509) 2015-07-21 20:21:30 +02:00
Damjan Adamic 7b469016c1 Fixes #2532: symbol for volts was in lower case, it is now in upper case 2015-07-21 20:06:44 +02:00
bsongis 29e9039176 Telemetry sources removed from the Reset Global Function 2015-07-21 19:22:19 +02:00
bsongis 370728433a Needed for #2518 2015-07-20 22:32:25 +02:00
Bertrand Songis f6b07ceda8 Merge pull request #2528 from opentx/driver33/PL_TR
Hot Fixes translation for 2.1.x
2015-07-20 22:10:07 +02:00
Jacek Drewniak 2c08118d6d Hot Fixes translation for 2.1.x 2015-07-20 21:56:07 +02:00
bsongis 7c8deb8a48 Fixes #2518 - Needs a test 2015-07-20 21:38:57 +02:00
Bertrand Songis b427fd1364 Merge pull request #2523 from opentx/projectkk2glider/issue_2513_duplicate_sensors
Fixes #2513: set value of duplicated telemetry sensors
2015-07-20 21:25:55 +02:00
Bertrand Songis 611f85113c Merge pull request #2522 from opentx/projectkk2glider/issue_2519_global_functions_play_value_fix
Fixes #2519: removed telemetry values from available selection in Glo…
2015-07-20 21:21:02 +02:00
Damjan Adamic 76791c1961 Unreachable code removed 2015-07-20 21:17:12 +02:00
Damjan Adamic 7b28910cc2 Re #2513: set value of duplicated telemetry sensors 2015-07-20 21:13:30 +02:00
Damjan Adamic 841f11c21a Fixes #2519: removed telemetry values from available selection in Global Functions for "Play Value" 2015-07-20 20:34:15 +02:00
bsongis f845be683c Fixes #2512 2015-07-20 19:55:36 +02:00
Bertrand Songis a1e2132c12 Update DONATIONS.txt 2015-07-20 18:38:46 +02:00
bsongis dec83e2ef5 Fixes #2514 2015-07-20 18:35:51 +02:00
bsongis f9897c0191 Fixes #2506 2015-07-20 07:16:21 +02:00
bsongis 668fadb737 Revert "Fixes #2506"
This reverts commit 1f06e7982a.
2015-07-20 07:09:05 +02:00
bsongis 1f06e7982a Fixes #2506 2015-07-19 22:27:06 +02:00
bsongis 7336d92a6d Fixes #2502 2015-07-19 22:16:12 +02:00
Damjan Adamic 7b490b03d9 Fix for windows installer build for 2.1 2015-07-19 18:15:41 +02:00
Bertrand Songis 7958ff7105 Merge pull request #2482 from opentx/projectkk2glider/companion_2.1_and_2.0_alongside_on_linux
Enables side by side installation of Companion 2.1 and 2.0 on Linux
2015-07-19 16:35:21 +02:00
Bertrand Songis 1492d808f3 Merge pull request #2501 from opentx/projectkk2glider/issue_2404_play_model_name
Fixes #2404: model name played when model is loaded
2015-07-19 15:33:07 +02:00
Damjan Adamic 84fe232b0c Re #2503: Standalone simulator now remembers which radio was simulated in previous session 2015-07-19 14:54:33 +02:00
Damjan Adamic 51b8d70cc6 Several lintian errors removed:
E: companion2.1: unstripped-binary-or-object usr/local/bin/companion2.1
E: companion2.1: unstripped-binary-or-object usr/local/bin/simulator2.1
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-9x-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-9x128-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-9xr-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-9xr128-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-9xrpro-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-gruvin9x-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-mega2560-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-sky9x-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-taranis-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-taranisplus-simulator.so
E: companion2.1: unstripped-binary-or-object usr/local/lib/companion2.1/libopentx-taranisx9e-simulator.so
E: companion2.1: udev-rule-in-etc etc/udev/rules.d/45-companion2.1-taranis.rules
2015-07-19 14:32:59 +02:00
Andre Bernet 576ce4983d Fix #2504 2015-07-19 14:18:03 +02:00
Damjan Adamic b1170b2ab9 Enables side by side installation of Companion 2.1 and 2.0 on Linux
Adds missing simulator libraries on Linux
Installs Standalone Simulator icon on Linux
2015-07-19 14:06:58 +02:00
Damjan Adamic 41d0675886 Fixes #2503: Standalone simulator radio selection display problem 2015-07-19 13:19:38 +02:00
Damjan Adamic 5048ce5d45 Re #2404: better definition of PLAY_MODEL_NAME() for various platforms 2015-07-19 12:44:40 +02:00
Damjan Adamic 268f168218 Re #2404: Compilation fix 2015-07-19 11:13:51 +02:00
Damjan Adamic 08d4cb15aa Fixes #2404: model name played when model is loaded (if file "SOUNDS/<language>/<model_name>/name.wav" exists) 2015-07-19 11:07:57 +02:00
bsongis 2e252aacac Compilation error fix 2015-07-19 09:54:14 +02:00
bsongis d23a1f5739 Fixes #2492 - Thanks go to Kilrah 2015-07-18 22:59:59 +02:00
bsongis 863ed513c0 We move to 2.1.1 2015-07-18 22:55:57 +02:00
bsongis 18f28270f0 Fixes #2493 2015-07-18 22:52:15 +02:00
Andre Bernet 11ced4eecf de was missing from voice file download dropdown (fix #2497) 2015-07-18 20:01:24 +02:00
Damjan Adamic 44e73bac96 Fixes #2466: "Range" changed to "Ratio" in Companion telemetry sensor configuration (as is on the radio)
Translations re-generated
2015-07-18 19:38:58 +02:00
Damjan Adamic 8ba9016580 Fixes #2494: "Play Haptic" renamed to "Haptic" in Companion (as is on the radio) 2015-07-18 19:19:07 +02:00
Damjan Adamic 17171b2166 Release notes updated 2015-07-18 19:00:11 +02:00
bsongis 34731af074 Fixes #2491 2015-07-18 18:55:30 +02:00
bsongis 654dac1acc [Companion] ComboBox for audio / scripts list was not cleared before all
itemps inserted
2015-07-18 18:04:44 +02:00
bsongis 90ebaf2d88 Fixes #2465 - A little bit refactoring done while fixing this one 2015-07-18 17:22:26 +02:00
bsongis 2b804f92b5 Fixes #2478 2015-07-18 14:16:09 +02:00
bsongis e1e60b5572 Fixes #2487 2015-07-18 13:34:49 +02:00
bsongis 4b9f69a666 Fixes #2160 2015-07-18 13:23:12 +02:00
bsongis 1c86a16c84 [ARM boards] Shift in CSV logs when no GPS fix 2015-07-18 13:18:19 +02:00
bsongis 0cf3aeef57 Fixes #2484 2015-07-18 13:09:14 +02:00
bsongis b04295ad44 [Taranis] New gauge in Mixers/Expos screen was not right when there was
no line associated to the Mix/Input channel. Now the gauge is not
displayed in such case. Needs tests again, thanks!
2015-07-18 12:38:13 +02:00
bsongis 6147c23c0f [Taranis] Compilation error when INTERNAL_MODULE_PPM and
MODULE_D16_EU_ONLY_SUPPORT both defined
2015-07-18 09:44:29 +02:00
Andre Bernet cad3b7726d Fix #2485 2015-07-18 09:13:26 +02:00
Bertrand Songis 895afcc58c Update DONATIONS.txt 2015-07-18 09:03:55 +02:00
Jacek Drewniak df6d77289c Fixes 2015-07-18 01:10:48 +02:00
bsongis 4ad6ea8190 When sorting the issues I found a graphic from Martin in #1945 which was
not implemented. What do you think of it?
2015-07-17 11:14:56 +02:00
Andre Bernet a480c6ce87 Fix #2479 2015-07-17 09:43:04 +02:00
Bertrand Songis 17c176084c Update DONATIONS.txt 2015-07-17 08:02:44 +02:00
bsongis 5fdff961a6 Fixes #2474 - Needs test, thanks! 2015-07-17 00:13:24 +02:00
bsongis 475f1f1b2a Fixes #2476 2015-07-17 00:05:20 +02:00
Bertrand Songis 1a23b0c8d1 Update DONATIONS.txt 2015-07-16 23:20:22 +02:00
bsongis 92b5b72350 Fixes #2472 2015-07-16 23:15:35 +02:00
Bertrand Songis b639466a4f Update DONATIONS.txt 2015-07-16 19:11:22 +02:00
Bertrand Songis 0347883fdd Update README.md 2015-07-16 18:48:57 +02:00
Bertrand Songis 46cc410da7 Update README.md 2015-07-16 18:47:49 +02:00
282 changed files with 39125 additions and 36819 deletions
+45 -2
View File
@@ -7,6 +7,8 @@
<a href="http://aerialtechhobbies.com">Aerial Tech Hobbies</a>
<a href="http://litepilots.com">LitePilots</a>
<a href="http://openpilot.com">David Ankers (OpenPilot)</a>
<a href="http://3drobotics.com">3D Robotics</a>
<a href="http://rcstudio.cz">RC Studio (monthly)</a>
Mario Sette
Felice Baratto
@@ -400,7 +402,6 @@ Colin Rycroft
Emanuel Stassar
Michael Gregory
Robert Russell
Gordon Stahl
Felix Kaiser
Joshua Bardwell
Davd Goodall
@@ -598,7 +599,6 @@ Julien Gérard
Alexandre d'Alton
Peter Mergaerts
Jan Houwers
Gordon Stahl
Christian Grandjean
Roger Bergevin
NorthSide
@@ -770,3 +770,46 @@ Ron Powell
Alain Labonne
Carol Sills
Franck Aßmann
Larry Anderson
Mikael Wallbäck
Wes Warner
Christoffer H Henni
Donna Bayer
Garry Ogilvie
Karlheinz Sirsch
Fred Larssen
Rob Coppock
Franz Josef Hahn
Serge Ribault
Tanguy Le Moign
Barrett Powell
Patrice Lafeuille
Martin Blume
Marek Kopyto
Marco Lange
Gary Nix
Jack Oliphant
John Lever
Adolphe Montefiore
Steven De Weerdt
Håkan Berggen
Ayelet Egosi
Jean-Frederic Gaudreault
Jim Wagner
Lee Scott
Roger Keatley
Sherman Lovell
Hugh Caldwell
JB Fisher Company
Michels Bernhard
Pietro Rossin
Carsten Wache
Brock White
Steven Poretz
David Huelster
Gordon Stahl (monthly)
John Mathison
Richard Duczmal
Gregory Barron
Marcel Fischer
Klas Mälman
+2 -5
View File
@@ -1,8 +1,5 @@
##OpenTX Next Branch
##OpenTX 2.1 Branch
You have found your way to the GitHub repository site for the OpenTX Next Branch. This code branch holds the source code for the ongoing development.
The stable release code is not here, it is in the master branch.
Under no circumstances build and use software from this branch for real world application. At times you will be more or less guaranteed to crash your plane and destroy all your model settings.
The ongoing development on 2.1.x is done in this branch.
Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.
+58
View File
@@ -1,3 +1,61 @@
<h2>Version 2.1.3 / 2015-09-09</h2>
<ul>
<li>Fix missing translations in inputs/mixes tabs, print and compare dialogs (<a href=https://github.com/opentx/opentx/issues/2847>#2847</a>)</li>
</ul>
<h2>Version 2.1.2 / 2015-09-07</h2>
<ul>
<li>Fixed: Lua model scripts outputs not working in a simulator (<a href=https://github.com/opentx/opentx/issues/2684>#2684</a>)</li>
<li>Fixed a problem of Companion 2.1 trying to install into 2.0 path.
The effect will only be visible for the users that did not install any of the previous 2.1.x versions.
(<a href=https://github.com/opentx/opentx/issues/2645>#2645</a>)</li>
<li>Added missing SDL libraries to MAC package (<a href=https://github.com/opentx/opentx/issues/2678>#2678</a>)</li>
<li>Added used channels check/warning in Wizard (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li>
<li>Model Print and Model Compare improvements and fixes (<a href=https://github.com/opentx/opentx/issues/2734>#2734</a>, <a href=https://github.com/opentx/opentx/issues/2737>#2737</a>, <a href=https://github.com/opentx/opentx/issues/2576>#2576</a>)</li>
<li>Negative telemetry offset value was reset when writing back to radio (<a href=https://github.com/opentx/opentx/issues/2738>#2738</a>)</li>
<li>Telemetry sensor names were not displayed (<a href=https://github.com/opentx/opentx/issues/2807>#2807</a>)</li>
<li>Mixes multiplex representation now the same as on the radio (<a href=https://github.com/opentx/opentx/issues/2808>#2808</a>)</li>
<li>Fixed language-related startup crash on Mac (<a href=https://github.com/opentx/opentx/issues/2815>#2815</a>)</li>
<li>Fixed issues with conversion from 2.0 (<a href=https://github.com/opentx/opentx/issues/2809>#2809</a>, <a href=https://github.com/opentx/opentx/issues/2800>#2800</a>)</li>
<li>Fixed Throttle source export issue on X9E (<a href=https://github.com/opentx/opentx/issues/2844>#2844</a>)</li>
<li>Added support for the AR9X replacement board (prototype) for the Turnigy 9X radio, info <a href=http://www.rcgroups.com/forums/showthread.php?t=2479552>here</a></li>
</ul>
<h2>Version 2.1.1 / 2015-08-06</h2>
<ul>
<li>Vario source and center silent options were not saved(<a href=https://github.com/opentx/opentx/issues/2476>#2476</a>)</li>
<li>DSM receiver numbers for external module were not converted from previous version EEPROM (<a href=https://github.com/opentx/opentx/issues/2474>#2474</a>)</li>
<li>Precision incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2479>#2479</a>)</li>
<li>Unit incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2485>#2485</a>)</li>
<li>Fixed import/export of trim values (<a href=https://github.com/opentx/opentx/issues/2484>#2484</a>)</li>
<li>Removed constant access to floppy disk (<a href=https://github.com/opentx/opentx/issues/2160>#2160</a>)</li>
<li>Telemetry view script combo box list was empty (<a href=https://github.com/opentx/opentx/issues/2465>#2465</a>)</li>
<li>Telemetry view bars ranges not transfered to radio (<a href=https://github.com/opentx/opentx/issues/2491>#2491</a>)</li>
<li>Fixed Standalone simulator radio selection display problem (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
<li>Added missing simulation libraries and enabled side by side installation of Companion 2.0 and 2.1 on Linux (<a href=https://github.com/opentx/opentx/issues/2500>#2500</a>)</li>
<li>Standalone simulator now remembers which radio was simulated in previous session (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
<li>Radio calibration value were not displayed (<a href=https://github.com/opentx/opentx/issues/2502>#2502</a>)</li>
<li>Fixed Vario / Voltage / Current sources export problem</li>
<li>Writing model settings to 9XR-PRO did not work (<a href=https://github.com/opentx/opentx/issues/2402>#2402</a>, <a href=https://github.com/opentx/opentx/issues/2517>#2517</a>)</li>
<li>Model Print and Model Compare improvements</li>
<li>Fixed Companion OSX version (<a href=https://github.com/opentx/opentx/issues/2549>#2549</a>)</li>
<li>Firmware nightly builds are now downloadable from nightly builds of Companion (<a href=https://github.com/opentx/opentx/issues/2526>#2526</a>, <a href=https://github.com/opentx/opentx/issues/2634>#2634</a>)</li>
<li>Fixed telemetry item lists (<a href=https://github.com/opentx/opentx/issues/2541>#2541</a>)</li>
<li>Fixed missing pots P1..P3 for 9X (<a href=https://github.com/opentx/opentx/issues/2543>#2543</a>)</li>
<li>Fixed "Invalid model and settings" error message when writing models and settings to the radio (<a href=https://github.com/opentx/opentx/issues/2544>#2544</a>)</li>
<li>Global Functions fixes (<a href=https://github.com/opentx/opentx/issues/2558>#2558</a>)</li>
<li>Export to Google Earth now working (only) with the new telemetry fields (GPS, GAlt and GSpd) (<a href=https://github.com/opentx/opentx/issues/2546>#2546</a>)</li>
<li>Fixed unsuccessful writing of setting to the radio for 9XR PRO (<a href=https://github.com/opentx/opentx/issues/2605>#2605</a>)</li>
<li>Fixed missing LUA script outputs in special function "Play Value" (<a href=https://github.com/opentx/opentx/issues/2649>#2649</a>)</li>
<li>Various texts and translations corrections</li>
<li>Various small bug-fixes</li>
</ul>
<h2>Version 2.1.0 / 2015-07-16</h2>
<ul>
<li>SD card synchronizaton tool</li>
+65 -41
View File
@@ -1,17 +1,33 @@
PROJECT( companion )
SET( C9X_VERSION_MAJOR "2" )
SET( C9X_VERSION_MINOR "1" )
SET( C9X_VERSION_REVISION "0" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
SET(C9X_VERSION_MAJOR "2")
SET(C9X_VERSION_MINOR "1")
SET(C9X_VERSION_REVISION "3")
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(C9X_NAME_SUFFIX ${C9X_VERSION_MAJOR}${C9X_VERSION_MINOR})
SET(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
SET(SIMULATOR_NAME "simulator${C9X_NAME_SUFFIX}")
SET( SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX} )
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(COMPANION_NAME "companion")
SET(SIMULATOR_NAME "simulator")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
OPTION(DEBUG_IMPORT "Turns on debug output for EEPROM import") # Disabled by default
OPTION(ALLOW_NIGHTLY_BUILDS "Allow nightly builds download / update") # Disabled by default
IF(ALLOW_NIGHTLY_BUILDS)
ADD_DEFINITIONS(-DALLOW_NIGHTLY_BUILDS)
ENDIF(ALLOW_NIGHTLY_BUILDS)
OPTION(DEBUG_IMPORT "Turn on debug output for EEPROM import") # Disabled by default
IF(DEBUG_IMPORT)
ADD_DEFINITIONS( -DDEBUG_MODEL_IMPORT)
MESSAGE( STATUS "EEPROM import debugging enabled" )
@@ -142,6 +158,7 @@ set(companion_SRCS
apppreferencesdialog.cpp
fwpreferencesdialog.cpp
burnconfigdialog.cpp
multimodelprinter.cpp
comparedialog.cpp
contributorsdialog.cpp
releasenotesdialog.cpp
@@ -156,10 +173,11 @@ set(companion_SRCS
flashfirmwaredialog.cpp
flasheepromdialog.cpp
printdialog.cpp
modelprinter.cpp
fusesdialog.cpp
logsdialog.cpp
downloaddialog.cpp
splashlibrary.cpp
splashlibrarydialog.cpp
mainwindow.cpp
companion.cpp
radionotfound.cpp
@@ -179,7 +197,7 @@ set(companion_MOC_HDRS
releasenotesdialog.h
releasenotesfirmwaredialog.h
customizesplashdialog.h
splashlibrary.h
splashlibrarydialog.h
splashlabel.h
progresswidget.h
progressdialog.h
@@ -195,6 +213,8 @@ set(companion_MOC_HDRS
radionotfound.h
helpers.h
wizarddialog.h
modelprinter.h
multimodelprinter.h
)
set(companion_UIS
@@ -209,7 +229,7 @@ set(companion_UIS
printdialog.ui
htmldialog.ui
customizesplashdialog.ui
splashlibrary.ui
splashlibrarydialog.ui
progresswidget.ui
progressdialog.ui
flashfirmwaredialog.ui
@@ -254,6 +274,8 @@ NOW(TIME)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${CMAKE_CURRENT_BINARY_DIR}/stamp-opentx.h @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/companion.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simulator.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop @ONLY)
IF( WIN32 )
SET( companion_SRCS ${companion_SRCS} icon.rc )
@@ -279,14 +301,14 @@ QT4_ADD_RESOURCES( companion_SRCS ${companion_RCS} )
ADD_DEFINITIONS( -DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" )
IF( APPLE )
ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
ADD_EXECUTABLE( ${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
# OS X compiler no longer automatically includes /Library/Frameworks in search path
SET( CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks )
ELSE( )
ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
ADD_EXECUTABLE( ${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
ENDIF( )
target_link_libraries(companion generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
target_link_libraries(${COMPANION_NAME} generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
############# Standalone simu ###############
@@ -309,33 +331,34 @@ if(WIN32)
endif()
if(APPLE)
add_executable(simulator MACOSX_BUNDLE ${simu_SRCS})
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS})
else()
add_executable(simulator WIN32 ${simu_SRCS})
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS})
endif()
target_link_libraries(simulator simulation common ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
target_link_libraries(${SIMULATOR_NAME} simulation common ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
############# Packaging ####################
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL( TARGETS simulator DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL( FILES companion.desktop DESTINATION share/applications )
INSTALL( FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps )
INSTALL( FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps )
INSTALL( FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps )
INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps )
INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps )
INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps )
INSTALL( FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps )
INSTALL( FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps )
INSTALL( FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps )
INSTALL( FILES ../targets/linux/45-companion-taranis.rules DESTINATION /etc/udev/rules.d/ )
INSTALL( TARGETS ${COMPANION_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL( TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop DESTINATION share/applications RENAME companion${C9X_NAME_SUFFIX}.desktop)
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop DESTINATION share/applications RENAME simulator${C9X_NAME_SUFFIX}.desktop)
INSTALL( FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png )
INSTALL( FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg )
INSTALL( FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
# Linux specific code
SET(OperatingSystem "Linux")
ELSE (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${QT_BINARY_DIR} )
INSTALL( TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR} )
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF( WIN32 )
@@ -357,51 +380,51 @@ IF( WIN32 )
"C:/Programs/NSIS"
)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companion-windows.exe
COMMAND "${NSIS_EXE}" ARGS companion.nsi
DEPENDS companion simulator opentx-simulators ${PROJECT_BINARY_DIR}/companion.nsi
COMMENT "Companion Windows NSIS Installer")
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/simulatorInstall.exe
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/simulator-install.exe
COMMAND "${NSIS_EXE}" ARGS simulator.nsi
DEPENDS simulator opentx-simulators ${PROJECT_BINARY_DIR}/simulator.nsi
COMMENT "Simulator Windows NSIS Installer")
ADD_CUSTOM_TARGET( installer
DEPENDS ${PROJECT_BINARY_DIR}/companionInstall.exe
DEPENDS ${PROJECT_BINARY_DIR}/simulatorInstall.exe
DEPENDS ${PROJECT_BINARY_DIR}/companion-windows.exe
DEPENDS ${PROJECT_BINARY_DIR}/simulator-windows.exe
SOURCES ${PROJECT_BINARY_DIR}/companion.nsi
SOURCES ${PROJECT_BINARY_DIR}/simulator.nsi
)
ENDIF( )
IF( APPLE )
SET(MACOSX_BUNDLE_ICON_FILE iconmac.icns)
SET(MACOSX_BUNDLE_ICON_FILE iconmac.icns)
IF( CMAKE_GENERATOR STREQUAL Xcode )
SET( WORK_DIR ${CMAKE_BINARY_DIR}/Debug )
ELSE( )
SET( WORK_DIR ${PROJECT_BINARY_DIR} )
ENDIF()
ADD_CUSTOM_TARGET( addframeworks ALL
ADD_CUSTOM_TARGET( addframeworks
COMMAND mkdir -p companion.app/Contents/Frameworks
COMMAND mkdir -p companion.app/Contents/Resources
COMMAND mkdir -p companion.app/Contents/translations
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/libcrypto.1.0.0.dylib companion.app/Contents/Frameworks
COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
COMMAND rsync -r ${XSD_INCLUDE_DIR}/.. companion.app/Contents/Frameworks/
COMMAND rsync -r /Library/Frameworks/SDL.framework companion.app/Contents/Frameworks/
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL companion.app/Contents/MacOS/companion
WORKING_DIRECTORY ${WORK_DIR}
DEPENDS ${PROJECT_NAME} )
DEPENDS ${COMPANION_NAME} )
ADD_CUSTOM_TARGET( makedmg
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app -dmg -no-plugins
WORKING_DIRECTORY ${WORK_DIR}
DEPENDS addframeworks )
DEPENDS addframeworks opentx-simulators-bundle)
ENDIF( )
ADD_CUSTOM_TARGET( stamp
@@ -419,9 +442,10 @@ ELSE()
)
ENDIF()
SET(CPACK_PACKAGE_NAME "COMPANION")
SET(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
SET( CPACK_STRIP_FILES TRUE )
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
if(DPKG_PROGRAM)
SET(CPACK_GENERATOR "DEB")
+24 -12
View File
@@ -312,10 +312,10 @@ QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; }
int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
int Profile::vBatCalib() const { return _vBatCalib; }
int Profile::txVoltageCalibration() const { return _txVoltageCalibration; }
int Profile::vBatWarn() const { return _vBatWarn; }
int Profile::vBatMin() const { return _vBatMin; }
int Profile::vBatMax() const { return _vBatMax; }
@@ -342,10 +342,10 @@ void Profile::speaker (const QString x) { store(x, _speaker, "Speake
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::txCurrentCalibration (const int x) { store(x, _txCurrentCalibration, "currentCalib","Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::txVoltageCalibration (const int x) { store(x, _txVoltageCalibration, "VbatCalib","Profiles", QString("profile%1").arg(index));}
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMin (const int x) { store(x, _vBatMin, "VbatMin" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMax (const int x) { store(x, _vBatMax, "VbatMax" ,"Profiles", QString("profile%1").arg(index));}
@@ -378,10 +378,10 @@ Profile& Profile::operator=(const Profile& rhs)
speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() );
currentCalib ( rhs.currentCalib() );
txCurrentCalibration ( rhs.txCurrentCalibration() );
gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() );
vBatCalib ( rhs.vBatCalib() );
txVoltageCalibration ( rhs.txVoltageCalibration() );
vBatWarn ( rhs.vBatWarn() );
vBatMin ( rhs.vBatMin() );
vBatMax ( rhs.vBatMax() );
@@ -424,10 +424,10 @@ void Profile::initFwVariables()
_timeStamp = "";
_trainerCalib = "";
_currentCalib = 0;
_txCurrentCalibration = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_txVoltageCalibration = 0;
_vBatWarn = 0;
_vBatMin = 0;
_vBatMax = 0;
@@ -483,10 +483,10 @@ void Profile::flush()
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _txCurrentCalibration, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _txVoltageCalibration, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMin, "VbatMin" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMax, "VbatMax" ,0 ,"Profiles", QString("profile%1").arg(index));
@@ -512,6 +512,7 @@ QString AppData::mcu() { return _mcu; }
QString AppData::programmer() { return _programmer; }
QString AppData::sambaLocation() { return _sambaLocation; }
QString AppData::sambaPort() { return _sambaPort; }
QString AppData::lastSimulator() { return _lastSimulator; }
QString AppData::backupDir() { return _backupDir; }
QString AppData::gePath() { return _gePath; }
@@ -560,6 +561,7 @@ void AppData::mcu (const QString x) { store(x, _mcu,
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
void AppData::lastSimulator (const QString x) { store(x, _lastSimulator, "last_simulator" );}
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
@@ -611,7 +613,10 @@ AppData::AppData()
QStringList keys = settings20.allKeys();
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
{
settings.setValue(*i, settings20.value(*i));
if (settings20.value(*i) != QString("") && settings20.value(*i) != QString("Start Menu Folder"))
{
settings.setValue(*i, settings20.value(*i));
}
}
//Reload profiles
@@ -627,7 +632,10 @@ AppData::AppData()
QStringList keys = pre2016settings.allKeys();
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
{
settings.setValue(*i, pre2016settings.value(*i));
if (pre2016settings.value(*i) != QString("") && pre2016settings.value(*i) != QString("Start Menu Folder"))
{
settings.setValue(*i, pre2016settings.value(*i));
}
}
//Reload profiles
@@ -716,6 +724,7 @@ AppData::AppData()
getset( _programmer, "programmer" ,"usbasp" );
getset( _sambaLocation, "samba_location" ,"" );
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
getset( _lastSimulator, "last_simulator" ,"" );
getset( _backupDir, "backupPath" ,"" );
getset( _gePath, "gePath" ,"" );
@@ -732,6 +741,9 @@ AppData::AppData()
getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true );
getset( _useCompanionNightlyBuilds, "useCompanionNightlyBuilds" ,false );
getset( _useFirmwareNightlyBuilds, "useFirmwareNightlyBuilds" ,false );
getset( _jsSupport, "js_support" ,false );
getset( _maximized, "maximized" ,false );
getset( _showSplash, "show_splash" ,true );
+11 -6
View File
@@ -125,10 +125,10 @@ class Profile: protected CompStoreObj
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
int _currentCalib;
int _txCurrentCalibration;
int _gsStickMode;
int _ppmMultiplier;
int _vBatCalib;
int _txVoltageCalibration;
int _vBatWarn;
int _vBatMin;
int _vBatMax;
@@ -156,10 +156,10 @@ class Profile: protected CompStoreObj
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
int currentCalib() const;
int txCurrentCalibration() const;
int gsStickMode() const;
int ppmMultiplier() const;
int vBatCalib() const;
int txVoltageCalibration() const;
int vBatWarn() const;
int vBatMin() const;
int vBatMax() const;
@@ -186,10 +186,10 @@ class Profile: protected CompStoreObj
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void currentCalib (const int);
void txCurrentCalibration (const int);
void gsStickMode (const int);
void ppmMultiplier (const int);
void vBatCalib (const int);
void txVoltageCalibration (const int);
void vBatWarn (const int);
void vBatMin (const int);
void vBatMax (const int);
@@ -216,6 +216,8 @@ class AppData: protected CompStoreObj
BOOL_PROPERTY(outputDisplayDetails, false)
BOOL_PROPERTY(backupOnFlash, true)
BOOL_PROPERTY(checkHardwareCompatibility, true)
BOOL_PROPERTY(useCompanionNightlyBuilds, false)
BOOL_PROPERTY(useFirmwareNightlyBuilds, false)
// All the global variables
public:
@@ -240,6 +242,7 @@ class AppData: protected CompStoreObj
QString _programmer;
QString _sambaLocation;
QString _sambaPort;
QString _lastSimulator;
QString _backupDir;
QString _gePath;
@@ -290,6 +293,7 @@ class AppData: protected CompStoreObj
QString programmer();
QString sambaLocation();
QString sambaPort();
QString lastSimulator();
QString backupDir();
QString gePath();
@@ -339,6 +343,7 @@ class AppData: protected CompStoreObj
void programmer (const QString);
void sambaLocation (const QString);
void sambaPort (const QString);
void lastSimulator (const QString);
void backupDir (const QString);
void gePath (const QString);
+13 -4
View File
@@ -41,8 +41,10 @@ AppPreferencesDialog::~AppPreferencesDialog()
void AppPreferencesDialog::writeValues()
{
g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
g.autoCheckFw(ui->startupCheck_fw->isChecked());
g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
g.autoCheckApp(ui->autoCheckCompanion->isChecked());
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
g.showSplash(ui->showSplash->isChecked());
g.simuSW(ui->simuSW->isChecked());
g.useWizard(ui->modelWizard_CB->isChecked());
@@ -107,8 +109,15 @@ void AppPreferencesDialog::initSettings()
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
ui->startupCheck_fw->setChecked(g.autoCheckFw());
#if defined(ALLOW_NIGHTLY_BUILDS)
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
#else
ui->useCompanionNightlyBuilds->hide();
ui->useFirmwareNightlyBuilds->hide();
#endif
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
+77 -61
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>686</width>
<height>619</height>
<height>713</height>
</rect>
</property>
<property name="sizePolicy">
@@ -233,7 +233,7 @@ May be different from firmware language</string>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
@@ -290,6 +290,9 @@ May be different from firmware language</string>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
@@ -645,8 +648,8 @@ Mode 4:
<string>Application Settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="7" column="1" colspan="3">
<widget class="QCheckBox" name="startupCheck_companion9x">
<item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="autoCheckCompanion">
<property name="text">
<string>Automatic check for Companion updates</string>
</property>
@@ -665,7 +668,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="10" column="1" colspan="3">
<item row="13" column="1" colspan="3">
<widget class="QCheckBox" name="backupEnable">
<property name="text">
<string>Enable automatic backup before writing firmware</string>
@@ -679,24 +682,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="startupCheck_fw">
<property name="text">
<string>Automatic check for OpenTX firmware updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="15" column="1">
<item row="18" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -709,7 +695,24 @@ Mode 4:
</property>
</spacer>
</item>
<item row="12" column="0">
<item row="11" 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="15" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -749,7 +752,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="13" column="0">
<item row="16" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -784,14 +787,14 @@ Mode 4:
</property>
</widget>
</item>
<item row="9" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Automatic Backup Folder</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<item row="14" column="1" colspan="3">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -805,7 +808,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="13" column="1">
<item row="16" column="1">
<widget class="QLineEdit" name="libraryPath">
<property name="enabled">
<bool>true</bool>
@@ -815,7 +818,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="12" column="1">
<item row="15" column="1">
<widget class="QComboBox" name="splashincludeCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -835,7 +838,7 @@ Mode 4:
</item>
</widget>
</item>
<item row="9" column="1">
<item row="12" column="1">
<widget class="QLineEdit" name="backupPath">
<property name="minimumSize">
<size>
@@ -848,7 +851,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="9" column="2" colspan="2">
<item row="12" column="2" colspan="2">
<widget class="QPushButton" name="backupPathButton">
<property name="text">
<string>Open Folder</string>
@@ -875,13 +878,33 @@ Mode 4:
</property>
</widget>
</item>
<item row="13" column="2" colspan="2">
<item row="16" column="2" colspan="2">
<widget class="QPushButton" name="libraryPathButton">
<property name="text">
<string>Open Folder</string>
</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="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>
</layout>
</widget>
<widget class="QWidget" name="simulatorTab">
@@ -889,7 +912,17 @@ Mode 4:
<string>Simulator Settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="5" column="4">
<item row="5" column="1">
<widget class="QComboBox" name="joystickCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="joystickcalButton">
<property name="text">
<string>Calibrate</string>
@@ -951,7 +984,7 @@ Mode 4:
</property>
</spacer>
</item>
<item row="1" column="1" colspan="4">
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="snapshotClipboardCKB">
<property name="text">
<string>Only capture to clipboard</string>
@@ -966,29 +999,6 @@ Mode 4:
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="joystickCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="snapshotPathButton">
<property name="text">
<string>Open Folder</string>
@@ -1032,9 +1042,15 @@ Mode 4:
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<width>0</width>
<height>0</height>
</size>
</property>
@@ -1043,7 +1059,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="simuSW">
<property name="text">
<string>Remember simulator switch values</string>
@@ -1112,8 +1128,8 @@ Mode 4:
<tabstop>historySize</tabstop>
<tabstop>showSplash</tabstop>
<tabstop>modelWizard_CB</tabstop>
<tabstop>startupCheck_fw</tabstop>
<tabstop>startupCheck_companion9x</tabstop>
<tabstop>autoCheckFirmware</tabstop>
<tabstop>autoCheckCompanion</tabstop>
<tabstop>backupPath</tabstop>
<tabstop>backupPathButton</tabstop>
<tabstop>backupEnable</tabstop>
@@ -1,11 +1,11 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Companion
Name=Companion @C9X_VERSION@
GenericName=Transmitter Companion App
Comment=The Ultimate Transmitter Companion
Icon=companion
Exec='companion'
Icon=@COMPANION_NAME@
Exec='@COMPANION_NAME@'
Terminal=false
StartupNotify=false
Categories=Application
+2
View File
@@ -100,6 +100,8 @@
<file>images/library/00018.png</file>
<file>images/library/00019.png</file>
<file>images/library/00020.png</file>
<file>images/library/00021.png</file>
<file>images/library/00022.png</file>
<file>images/library/00050.png</file>
<file>images/library/00051.png</file>
<file>images/library/00052.png</file>
File diff suppressed because it is too large Load Diff
+16 -65
View File
@@ -1,10 +1,9 @@
#ifndef COMPAREDIALOG_H
#define COMPAREDIALOG_H
#ifndef _COMPAREDIALOG_H
#define _COMPAREDIALOG_H
#include <QDialog>
#include <QtGui>
#include <QDir>
#include "eeprominterface.h"
#include <QLabel>
#include "multimodelprinter.h"
namespace Ui {
class CompareDialog;
@@ -12,80 +11,32 @@ namespace Ui {
class CompareDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CompareDialog(QWidget *parent, Firmware * firmware);
~CompareDialog();
Firmware * firmware;
protected:
GeneralSettings * settings;
ModelData * g_model1;
ModelData * g_model2;
ModelData * modeltemp;
int model1;
int model2;
private:
void closeEvent(QCloseEvent *event);
Ui::CompareDialog *ui;
template<class T> QString getColor1(T val1, T val2) {
if (val1!=val2)
return "green";
else
return "grey";
}
template<class T> QString getColor2(T val1, T val2) {
if (val1!=val2)
return "red";
else
return "grey";
}
QString getColor1(char * val1, char * val2) {
if (strcmp(val1,val2)!=0)
return "green";
else
return "grey";
}
QString getColor2(char * val1, char * val2) {
if (strcmp(val1,val2)!=0)
return "red";
else
return "grey";
}
int ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused);
bool ChannelHasExpo(ExpoData * expoArray, uint8_t destCh);
int ModelHasMix(MixData * mixArray, MixData mix, bool * mixused);
bool ChannelHasMix(MixData * mixArray, uint8_t destCh);
MultiModelPrinter multimodelprinter;
ModelData model1;
ModelData model2;
bool model1Valid;
bool model2Valid;
Ui::CompareDialog * ui;
QTextEdit * te;
QString curvefile1;
QString curvefile2;
QDir *qd;
private slots:
protected slots:
void on_printButton_clicked();
void on_printFileButton_clicked();
protected:
protected:
void closeEvent(QCloseEvent * event);
bool handleDroppedModel(const QMimeData * mimeData, ModelData & model, QLabel * label);
void dropEvent(QDropEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void printDiff();
void printSetup();
void printPhases();
void printLimits();
void printExpos();
void printMixers();
void printCurves();
void printGvars();
void printSwitches();
void printSafetySwitches();
void printFSwitches();
void printFrSky();
};
#endif // COMPAREDIALOG_H
#endif // _COMPAREDIALOG_H
+1
View File
@@ -8,6 +8,7 @@ enum BoardEnum {
BOARD_GRUVIN9X,
BOARD_SKY9X,
BOARD_9XRPRO,
BOARD_AR9X,
BOARD_TARANIS,
BOARD_TARANIS_PLUS,
BOARD_TARANIS_X9E
+10 -3
View File
@@ -59,11 +59,18 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
str.append(formatTable(tr("People who have donated to OpenTX"), names, 6));
}
str.append(" <tr><td class=\"normal\">&nbsp;</td></tr>" \
" <tr><td colspan=3 class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
" <tr><td colspan=3 class=\"normal\">" + tr("Thank you all !!!") + "</td></tr>" \
str.append("<table><tr><td class=\"normal\">&nbsp;</td></tr>" \
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
"</table>");
#if 0
QFile blacklist(":/BLACKLIST.txt");
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
QStringList names;
names << blacklist.readAll();
str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
}
#endif
str.append("</body></html>");
ui->textEditor->setHtml(str);
+2 -2
View File
@@ -3,8 +3,8 @@
#include "flashfirmwaredialog.h"
#include "appdata.h"
#include "helpers.h"
#include "splashlibrary.h"
#include "firmwareinterface.h"
#include "splashlibrarydialog.h"
//*** Side Class ***
@@ -233,7 +233,7 @@ void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicke
void customizeSplashDialog::libraryButton_clicked( Side side )
{
QString fileName;
splashLibrary *ld = new splashLibrary(this,&fileName);
SplashLibraryDialog *ld = new SplashLibraryDialog(this,&fileName);
ld->exec();
if (!fileName.isEmpty()) {
if (!side.displayImage( fileName, UNDEFINED ))
+199 -173
View File
@@ -123,23 +123,23 @@ QString SensorData::unitString() const
case UNIT_FEET:
return QObject::tr("f");
case UNIT_CELSIUS:
return QObject::tr("°C");
return QObject::trUtf8("°C");
case UNIT_FAHRENHEIT:
return QObject::tr("%F");
return QObject::trUtf8("°F");
case UNIT_PERCENT:
return QObject::tr("%");
case UNIT_MAH:
return QObject::tr("mAh");
case UNIT_WATTS:
return QObject::tr("W");
case UNIT_DBM:
case UNIT_DB:
return QObject::tr("dB");
case UNIT_RPMS:
return QObject::tr("rpms");
case UNIT_G:
return QObject::tr("g");
case UNIT_DEGREE:
return QObject::tr("°");
return QObject::trUtf8("°");
case UNIT_HOURS:
return QObject::tr("hours");
case UNIT_MINUTES:
@@ -161,6 +161,14 @@ bool RawSource::isTimeBased() const
return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3));
}
float RawSourceRange::getValue(int value)
{
if (IS_ARM(GetCurrentFirmware()->getBoard()))
return float(value) * step;
else
return min + float(value) * step;
}
RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags) const
{
RawSourceRange result;
@@ -553,7 +561,7 @@ QString SwitchDn(const char sw)
return QString::fromUtf8(result);
}
QString RawSwitch::toString()
QString RawSwitch::toString() const
{
static const QString switches9X[] = {
QString("THR"), QString("RUD"), QString("ELE"),
@@ -651,7 +659,7 @@ QString RawSwitch::toString()
}
}
QString CurveReference::toString()
QString CurveReference::toString() const
{
if (value == 0) {
return "----";
@@ -670,7 +678,7 @@ QString CurveReference::toString()
}
}
CSFunctionFamily LogicalSwitchData::getFunctionFamily()
CSFunctionFamily LogicalSwitchData::getFunctionFamily() const
{
if (func == LS_FN_EDGE)
return LS_FAMILY_EDGE;
@@ -686,7 +694,7 @@ CSFunctionFamily LogicalSwitchData::getFunctionFamily()
return LS_FAMILY_VCOMP;
}
unsigned int LogicalSwitchData::getRangeFlags()
unsigned int LogicalSwitchData::getRangeFlags() const
{
if (func == LS_FN_DPOS)
return RANGE_DELTA_FUNCTION;
@@ -696,7 +704,7 @@ unsigned int LogicalSwitchData::getRangeFlags()
return 0;
}
QString LogicalSwitchData::funcToString()
QString LogicalSwitchData::funcToString() const
{
switch (func) {
case LS_FN_OFF:
@@ -746,123 +754,6 @@ QString LogicalSwitchData::funcToString()
}
}
QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettings & settings)
{
QString result = "";
if (!func)
return result;
if (andsw!=0) {
result +="( ";
}
switch (getFunctionFamily()) {
case LS_FAMILY_EDGE:
result += QObject::tr("Edge(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
break;
case LS_FAMILY_STICKY:
result += QObject::tr("Sticky(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
break;
case LS_FAMILY_TIMER:
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break;
case LS_FAMILY_VOFS: {
RawSource source = RawSource(val1);
RawSourceRange range = source.getRange(&model, settings);
QString res;
if (val1)
res += source.toString(&model);
else
res += "0";
res.remove(" ");
if (func == LS_FN_APOS || func == LS_FN_ANEG)
res = "|" + res + "|";
else if (func == LS_FN_DAPOS)
res = "|d(" + res + ")|";
else if (func == LS_FN_DPOS) result = "d(" + res + ")";
result += res;
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DPOS || func == LS_FN_DAPOS)
result += " &gt; ";
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
result += " &lt; ";
else if (func == LS_FN_VALMOSTEQUAL)
result += " ~ ";
else
result += " missing";
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
break;
}
case LS_FAMILY_VBOOL:
result += RawSwitch(val1).toString();
switch (func) {
case LS_FN_AND:
result += " AND ";
break;
case LS_FN_OR:
result += " OR ";
break;
case LS_FN_XOR:
result += " XOR ";
break;
default:
result += " bar ";
break;
}
result += RawSwitch(val2).toString();
break;
case LS_FAMILY_VCOMP:
if (val1)
result += RawSource(val1).toString(&model);
else
result += "0";
switch (func) {
case LS_FN_EQUAL:
case LS_FN_VEQUAL:
result += " = ";
break;
case LS_FN_NEQUAL:
result += " != ";
break;
case LS_FN_GREATER:
result += " &gt; ";
break;
case LS_FN_LESS:
result += " &lt; ";
break;
case LS_FN_EGREATER:
result += " &gt;= ";
break;
case LS_FN_ELESS:
result += " &lt;= ";
break;
default:
result += " foo ";
break;
}
if (val2)
result += RawSource(val2).toString(&model);
else
result += "0";
break;
}
if (andsw!=0) {
result +=" ) AND ";
result += RawSwitch(andsw).toString();
}
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (duration)
result += QObject::tr(" Duration (%1s)").arg(duration/10.0);
if (delay)
result += QObject::tr(" Delay (%1s)").arg(delay/10.0);
}
return result;
}
void CustomFunctionData::clear()
{
memset(this, 0, sizeof(CustomFunctionData));
@@ -871,7 +762,7 @@ void CustomFunctionData::clear()
}
}
QString CustomFunctionData::funcToString()
QString CustomFunctionData::funcToString() const
{
if (func >= FuncOverrideCH1 && func <= FuncOverrideCH32)
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
@@ -890,7 +781,7 @@ QString CustomFunctionData::funcToString()
else if (func == FuncPlaySound)
return QObject::tr("Play Sound");
else if (func == FuncPlayHaptic)
return QObject::tr("Play Haptic");
return QObject::tr("Haptic");
else if (func == FuncReset)
return QObject::tr("Reset");
else if (func >= FuncSetTimer1 && func <= FuncSetTimer3)
@@ -924,41 +815,89 @@ QString CustomFunctionData::funcToString()
}
}
QString CustomFunctionData::paramToString()
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
{
int val = 0;
Firmware * firmware = GetCurrentFirmware();
BoardEnum board = GetEepromInterface()->getBoard();
b->addItem(QObject::tr("Timer1"), val++);
b->addItem(QObject::tr("Timer2"), val++);
if (IS_ARM(board)) {
b->addItem( QObject::tr("Timer3"), val++);
}
b->addItem(QObject::tr("Flight"), val++);
b->addItem(QObject::tr("Telemetry"), val++);
int reCount = firmware->getCapability(RotaryEncoders);
if (reCount == 1) {
b->addItem(QObject::tr("Rotary Encoder"), val++);
}
else if (reCount == 2) {
b->addItem(QObject::tr("REa"), val++);
b->addItem(QObject::tr("REb"), val++);
}
if ((int)value < b->count()) {
b->setCurrentIndex(value);
}
if (model && IS_ARM(board)) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
if (model->sensorData[i].isAvailable()) {
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i);
b->addItem(item.toString(model), val+i);
if ((int)value == val+i) {
b->setCurrentIndex(b->count()-1);
}
}
}
}
}
void CustomFunctionData::populatePlaySoundParams(QStringList & qs)
{
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
}
void CustomFunctionData::populateHapticParams(QStringList & qs)
{
qs << "0" << "1" << "2" << "3";
}
QString CustomFunctionData::paramToString(const ModelData * model) const
{
QStringList qs;
if (func <= FuncInstantTrim) {
return QString("%1").arg(param);
}
else if (func==FuncLogs) {
return QString("%1").arg(param/10.0) + QObject::tr("s");
}
else if (func==FuncPlaySound) {
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
CustomFunctionData::populatePlaySoundParams(qs);
if (param>=0 && param<(int)qs.count())
return qs.at(param);
else
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
}
else if (func==FuncPlayHaptic) {
qs << "0" << "1" << "2" << "3";
CustomFunctionData::populateHapticParams(qs);
if (param>=0 && param<(int)qs.count())
return qs.at(param);
else
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
}
else if (func==FuncReset) {
qs.append( QObject::tr("Timer1"));
qs.append( QObject::tr("Timer2"));
qs.append( QObject::tr("Timer3"));
qs.append( QObject::tr("All"));
qs.append( QObject::tr("Telemetry"));
if (param>=0 && param<(int)qs.count())
return qs.at(param);
else
QComboBox cb;
CustomFunctionData::populateResetParams(model, &cb);
int pos = cb.findData(param);
if (pos >= 0)
return cb.itemText(pos);
else
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
}
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param);
return item.toString();
return item.toString(model);
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@@ -968,54 +907,84 @@ QString CustomFunctionData::paramToString()
return paramarm;
}
}
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
else if ((func>=FuncAdjustGV1) && (func<FuncCount)) {
switch (adjustMode) {
case 0:
return QObject::tr("Value ")+QString("%1").arg(param);
break;
case 1:
return RawSource(param).toString();
break;
case 2:
return RawSource(param).toString();
break;
case 3:
if (param==0) {
return QObject::tr("Decr:")+QString(" -1");
}
else {
return QObject::tr("Incr:")+QString(" +1");
}
break;
default:
return "";
if (param==0) return QObject::tr("Decr:") + " -1";
else return QObject::tr("Incr:") + " +1";
}
}
return "";
}
QString CustomFunctionData::repeatToString()
QString CustomFunctionData::repeatToString() const
{
if (repeatParam==0) {
return QObject::tr("No repeat");
return "";
}
else {
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
return QObject::tr("%1 sec").arg(step*repeatParam);
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
return QObject::tr("repeat") + QString("(%1").arg(step*repeatParam) + QObject::tr("s") + ")";
}
}
QString LimitData::minToString()
QString CustomFunctionData::enabledToString() const
{
if ((func>=FuncOverrideCH1 && func<=FuncOverrideCH32) ||
(func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) ||
(func==FuncReset) ||
(func>=FuncSetTimer1 && func<=FuncSetTimer2) ||
(func==FuncVolume) ||
(func <= FuncInstantTrim)) {
if (!enabled) {
return QObject::tr("DISABLED");
}
}
return "";
}
CurveData::CurveData()
{
clear(5);
}
void CurveData::clear(int count)
{
memset(this, 0, sizeof(CurveData));
this->count = count;
}
bool CurveData::isEmpty() const
{
for (int i=0; i<count; i++) {
if (points[i].y != 0) {
return false;
}
}
return true;
}
QString LimitData::minToString() const
{
return QString::number((qreal)min/10);
}
QString LimitData::maxToString()
QString LimitData::maxToString() const
{
return QString::number((qreal)max/10);
}
QString LimitData::offsetToString()
QString LimitData::revertToString() const
{
return revert ? QObject::tr("INV") : QObject::tr("NOR");
}
QString LimitData::offsetToString() const
{
return QString::number((qreal)offset/10, 'f', 1);
}
@@ -1052,13 +1021,13 @@ bool GeneralSettings::switchSourceAllowedTaranis(int index) const
bool GeneralSettings::isPotAvailable(int index) const
{
if (index<0 || index>4) return false;
if (index<0 || index>GetCurrentFirmware()->getCapability(Pots)) return false;
return potConfig[index] != POT_NONE;
}
bool GeneralSettings::isSliderAvailable(int index) const
{
if (index<0 || index>4) return false;
if (index<0 || index>GetCurrentFirmware()->getCapability(Sliders)) return false;
return sliderConfig[index] != SLIDER_NONE;
}
@@ -1090,6 +1059,11 @@ GeneralSettings::GeneralSettings()
switchConfig[6] = SWITCH_3POS;
switchConfig[7] = SWITCH_TOGGLE;
}
else {
for (int i=0; i<3; i++) {
potConfig[i] = POT_WITHOUT_DETENT;
}
}
if (IS_ARM(board)) {
speakerVolume = 12;
@@ -1109,8 +1083,8 @@ GeneralSettings::GeneralSettings()
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
int8_t t_txCurrentCalibration=(int8_t)g.profile[g.id()].txCurrentCalibration();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
@@ -1144,8 +1118,8 @@ GeneralSettings::GeneralSettings()
if (ok)
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
txCurrentCalibration=t_txCurrentCalibration;
txVoltageCalibration=t_txVoltageCalibration;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
@@ -1314,6 +1288,52 @@ bool ModelData::isInputValid(const unsigned int idx) const
return false;
}
bool ModelData::hasExpos(uint8_t inputIdx) const
{
for (int i=0; i<C9X_MAX_EXPOS; i++) {
const ExpoData & expo = expoData[i];
if (expo.chn==inputIdx && expo.mode!=0) {
return true;
}
}
return false;
}
bool ModelData::hasMixes(uint8_t channelIdx) const
{
channelIdx += 1;
for (int i=0; i<C9X_MAX_MIXERS; i++) {
if (mixData[i].destCh == channelIdx) {
return true;
}
}
return false;
}
QVector<const ExpoData *> ModelData::expos(int input) const
{
QVector<const ExpoData *> result;
for (int i=0; i<C9X_MAX_EXPOS; i++) {
const ExpoData * ed = &expoData[i];
if ((int)ed->chn==input && ed->mode!=0) {
result << ed;
}
}
return result;
}
QVector<const MixData *> ModelData::mixes(int channel) const
{
QVector<const MixData *> result;
for (int i=0; i<C9X_MAX_MIXERS; i++) {
const MixData * md = &mixData[i];
if ((int)md->destCh == channel+1) {
result << md;
}
}
return result;
}
void ModelData::removeInput(const int idx)
{
unsigned int chn = expoData[idx].chn;
@@ -1363,12 +1383,16 @@ void ModelData::clear()
moduleData[2].ppmDelay = 300;
int board = GetEepromInterface()->getBoard();
if (IS_TARANIS(board)) {
moduleData[0].protocol=PXX_XJT_X16;
moduleData[1].protocol=OFF;
moduleData[0].protocol = PULSES_PXX_XJT_X16;
moduleData[1].protocol = PULSES_OFF;
}
else if (IS_SKY9X(board)) {
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_PPM;
}
else {
moduleData[0].protocol=PPM;
moduleData[1].protocol=OFF;
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_OFF;
}
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
flightModeData[i].clear();
@@ -1393,7 +1417,7 @@ void ModelData::clear()
sensorData[i].clear();
}
bool ModelData::isempty()
bool ModelData::isEmpty() const
{
return !used;
}
@@ -1660,6 +1684,8 @@ QString getBoardName(BoardEnum board)
return "Sky9x";
case BOARD_9XRPRO:
return "9XR-PRO";
case BOARD_AR9X:
return "AR9X";
default:
return "Unknown";
}
+78 -73
View File
@@ -22,24 +22,25 @@
#include <QStringList>
#include <QList>
#include <QtXml>
#include <QComboBox>
#include <iostream>
#include "constants.h"
#include "simulatorinterface.h"
#define EESIZE_STOCK 2048
#define EESIZE_M128 4096
#define EESIZE_GRUVIN9X 4096
#define EESIZE_TARANIS (32*1024)
#define EESIZE_SKY9X (128*4096)
#define EESIZE_9XRPRO (128*4096)
#define EESIZE_RLC_MAX EESIZE_TARANIS
#define EESIZE_STOCK 2048
#define EESIZE_M128 4096
#define EESIZE_GRUVIN9X 4096
#define EESIZE_TARANIS (32*1024)
#define EESIZE_SKY9X (128*4096)
#define EESIZE_9XRPRO (128*4096)
#define EESIZE_MAX EESIZE_9XRPRO
QString getBoardName(BoardEnum board);
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
#define IS_STOCK(board) (board==BOARD_STOCK)
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO || board==BOARD_AR9X)
#define IS_9XRPRO(board) (board==BOARD_9XRPRO)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
@@ -182,19 +183,6 @@ extern const char downArrow[];
class ModelData;
class GeneralSettings;
enum ThrottleSource {
THROTTLE_SOURCE_THR,
THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_P2,
THROTTLE_SOURCE_P3,
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_S2,
THROTTLE_SOURCE_S3,
THROTTLE_SOURCE_LS,
THROTTLE_SOURCE_RS,
THROTTLE_SOURCE_FIRST_CHANNEL,
};
enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TX_TIME,
@@ -292,9 +280,7 @@ class RawSourceRange
{
}
float getValue(int value) {
return min + float(value) * step;
}
float getValue(int value);
int decimals;
double min;
@@ -392,7 +378,7 @@ class RawSwitch {
return index >= 0 ? (type * 256 + index) : -(type * 256 - index);
}
QString toString();
QString toString() const;
bool operator== ( const RawSwitch& other) {
return (this->type == other.type) && (this->index == other.index);
@@ -428,7 +414,7 @@ class CurveReference {
CurveRefType type;
int value;
QString toString();
QString toString() const;
};
enum InputMode {
@@ -446,7 +432,7 @@ class ExpoData {
unsigned int mode;
unsigned int chn;
RawSwitch swtch;
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
int weight;
int offset;
CurveReference curve;
@@ -469,14 +455,14 @@ class CurveData {
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
};
CurveData() { clear(5); }
CurveData();
void clear(int count);
bool isEmpty() const;
CurveType type;
bool smooth;
int count;
CurvePoint points[C9X_MAX_POINTS];
char name[6+1];
void clear(int count) { memset(this, 0, sizeof(CurveData)); this->count = count; }
};
class LimitData {
@@ -490,9 +476,10 @@ class LimitData {
bool symetrical;
char name[6+1];
CurveReference curve;
QString minToString();
QString maxToString();
QString offsetToString();
QString minToString() const;
QString maxToString() const;
QString offsetToString() const;
QString revertToString() const;
void clear();
};
@@ -520,7 +507,7 @@ class MixData {
bool noExpo;
MltpxValue mltpx; // multiplex method 0=+ 1=* 2=replace
unsigned int mixWarn; // mixer warning
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
int sOffset;
char name[MIXDATA_NAME_LEN+1];
@@ -577,10 +564,9 @@ class LogicalSwitchData { // Logical Switches data
unsigned int duration;
int andsw;
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
CSFunctionFamily getFunctionFamily();
unsigned int getRangeFlags();
QString funcToString();
QString toString(const ModelData & model, const GeneralSettings & settings);
CSFunctionFamily getFunctionFamily() const;
unsigned int getRangeFlags() const;
QString funcToString() const;
};
enum AssignFunc {
@@ -626,10 +612,15 @@ class CustomFunctionData { // Function Switches data
unsigned int adjustMode;
int repeatParam;
void clear();
QString funcToString();
QString paramToString();
QString repeatToString();
QStringList toStringList();
QString funcToString() const;
QString paramToString(const ModelData * model) const;
QString repeatToString() const;
QString enabledToString() const;
static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value);
static void populatePlaySoundParams(QStringList & qs);
static void populateHapticParams(QStringList & qs);
};
class FlightModeData {
@@ -769,6 +760,7 @@ class FrSkyData {
FrSkyScreenData screens[4];
FrSkyRSSIAlarm rssiAlarms[2];
unsigned int varioSource;
bool varioCenterSilent;
int varioMin;
int varioCenterMin; // if increment in 0.2m/s = 3.0m/s max
int varioCenterMax;
@@ -776,6 +768,7 @@ class FrSkyData {
bool mAhPersistent;
unsigned int storedMah;
int fasOffset;
bool ignoreSensorIds;
void clear();
};
@@ -792,6 +785,12 @@ class MavlinkData {
class TimerData {
public:
enum CountDownMode {
COUNTDOWN_SILENT,
COUNTDOWN_BEEPS,
COUNTDOWN_VOICE,
COUNTDOWN_HAPTIC
};
TimerData() { clear(); }
RawSwitch mode;
char name[TIMER_NAME_LEN+1];
@@ -803,31 +802,31 @@ class TimerData {
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
};
enum Protocol {
OFF,
PPM,
SILV_A,
SILV_B,
SILV_C,
CTP1009,
LP45,
DSM2,
DSMX,
PPM16,
PPMSIM,
PXX_XJT_X16,
PXX_XJT_D8,
PXX_XJT_LR12,
PXX_DJT,
PROTO_LAST
enum PulsesProtocol {
PULSES_OFF,
PULSES_PPM,
PULSES_SILV_A,
PULSES_SILV_B,
PULSES_SILV_C,
PULSES_CTP1009,
PULSES_LP45,
PULSES_DSM2,
PULSES_DSMX,
PULSES_PPM16,
PULSES_PPMSIM,
PULSES_PXX_XJT_X16,
PULSES_PXX_XJT_D8,
PULSES_PXX_XJT_LR12,
PULSES_PXX_DJT,
PULSES_PROTOCOL_LAST
};
enum TrainerProtocol {
MASTER_JACK,
SLAVE_JACK,
MASTER_SBUS_MODULE,
MASTER_CPPM_MODULE,
MASTER_SBUS_BATT_COMPARTMENT
TRAINER_MASTER_JACK,
TRAINER_SLAVE_JACK,
TRAINER_MASTER_SBUS_MODULE,
TRAINER_MASTER_CPPM_MODULE,
TRAINER_MASTER_SBUS_BATT_COMPARTMENT
};
class ModuleData {
@@ -845,7 +844,7 @@ class ModuleData {
bool ppmOutputType; // false = open drain, true = push pull
int ppmFrameLength;
void clear() { memset(this, 0, sizeof(ModuleData)); }
QString polarityToString() { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); }
QString polarityToString() const { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
};
#define C9X_MAX_SCRIPTS 7
@@ -914,7 +913,7 @@ class SensorData {
UNIT_PERCENT,
UNIT_MAH,
UNIT_WATTS,
UNIT_DBM,
UNIT_DB,
UNIT_RPMS,
UNIT_G,
UNIT_DEGREE,
@@ -987,6 +986,11 @@ class ModelData {
void removeInput(const int idx);
bool isInputValid(const unsigned int idx) const;
bool hasExpos(uint8_t inputIdx) const;
bool hasMixes(uint8_t output) const;
QVector<const ExpoData *> expos(int input) const;
QVector<const MixData *> mixes(int channel) const;
bool used;
char name[12+1];
@@ -1038,7 +1042,7 @@ class ModelData {
SensorData sensorData[C9X_MAX_SENSORS];
void clear();
bool isempty();
bool isEmpty() const;
void setDefaultInputs(const GeneralSettings & settings);
void setDefaultMixes(const GeneralSettings & settings);
void setDefaultValues(unsigned int id, const GeneralSettings & settings);
@@ -1122,7 +1126,8 @@ class GeneralSettings {
unsigned int currModel; // 0..15
unsigned int contrast;
unsigned int vBatWarn;
int vBatCalib;
int txVoltageCalibration;
int txCurrentCalibration;
int vBatMin;
int vBatMax;
int backlightMode;
@@ -1170,7 +1175,6 @@ class GeneralSettings {
int speakerVolume;
unsigned int backlightBright;
int switchesDelay;
int currentCalib;
int temperatureCalib;
int temperatureWarn;
unsigned int mAhWarn;
@@ -1301,7 +1305,7 @@ enum Capability {
PPMCenter,
PPMUnitMicroseconds,
SYMLimits,
HasCurrentCalibration,
HastxCurrentCalibration,
HasVolume,
HasBrightness,
PerModelTimers,
@@ -1313,6 +1317,7 @@ enum Capability {
LCDWidth,
GetThrSwitch,
HasDisplayText,
GlobalFunctions,
VirtualInputs,
TrainerInputs,
RtcTime,
@@ -1356,11 +1361,11 @@ class EEPROMInterface
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0) = 0;
virtual int getSize(ModelData &) = 0;
virtual int getSize(const ModelData &) = 0;
virtual int getSize(GeneralSettings &) = 0;
virtual int getSize(const GeneralSettings &) = 0;
virtual int isAvailable(Protocol proto, int port=0) = 0;
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
virtual const int getEEpromSize() = 0;
+2 -1
View File
@@ -52,7 +52,8 @@ void RleFile::EeFsCreate(uint8_t *eeprom, int size, BoardEnum board, unsigned in
if (IS_SKY9X(board)) {
memset(eeprom, 0xFF, size);
if (version >= 217) {
eepromFatHeader = (EepromHeader *)eeprom;
memset(eeprom, 0, EEPROM_FAT_SIZE);
eepromFatHeader = (EepromHeader *)(eeprom + EEPROM_FAT_SIZE);
eepromFatHeader->mark = EEPROM_MARK;
eepromFatHeader->index = 1;
for (int i=0; i<EEPROM_MAX_FILES; i++) {
+56 -51
View File
@@ -20,6 +20,7 @@
#include "firmwareinterface.h"
#include "helpers.h"
#define FW_MARK "FW"
#define VERS_MARK "VERS"
#define DATE_MARK "DATE"
#define TIME_MARK "TIME"
@@ -44,30 +45,34 @@ int getFileType(const QString &fullFileName)
FirmwareInterface::FirmwareInterface(const QString &filename):
flash(MAX_FSIZE, 0),
flash_size(0),
flashSize(0),
versionId(0),
splash_offset(0),
splash_size(0),
splash_width(0),
splash_height(0),
eepromVersion(0),
eepromVariant(0),
splashOffset(0),
splashSize(0),
splashWidth(0),
splashHeight(0),
isValidFlag(false)
{
if (!filename.isEmpty()) {
QFile file(filename);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
QTextStream inputStream(&file);
flash_size = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
file.close();
if (flash_size == 0) {
if (flashSize == 0) {
file.open(QIODevice::ReadOnly);
flash_size = file.read((char *)flash.data(), MAX_FSIZE);
flashSize = file.read((char *)flash.data(), MAX_FSIZE);
}
}
}
if (flash_size > 0) {
if (flashSize > 0) {
flavour = seekLabel(FW_MARK);
version = seekLabel(VERS_MARK);
if (version.startsWith("opentx-")) {
// old version format
int index = version.lastIndexOf('-');
flavour = version.mid(0, index);
version = version.mid(index+1);
@@ -150,8 +155,8 @@ bool FirmwareInterface::SeekSplash(QByteArray splash)
{
int start = flash.indexOf(splash);
if (start>0) {
splash_offset = start;
splash_size = splash.size();
splashOffset = start;
splashSize = splash.size();
return true;
}
else {
@@ -167,8 +172,8 @@ bool FirmwareInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
if (start>0) {
int end = start + sps.size() + size;
if (end == flash.indexOf(spe, end)) {
splash_offset = start + sps.size();
splash_size = end - start - sps.size();
splashOffset = start + sps.size();
splashSize = end - start - sps.size();
return true;
}
else {
@@ -187,10 +192,10 @@ bool FirmwareInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
void FirmwareInterface::SeekSplash(void)
{
splash_size = 0;
splash_offset = 0;
splash_width = SPLASH_WIDTH;
splash_height = SPLASH_HEIGHT;
splashSize = 0;
splashOffset = 0;
splashWidth = SPLASH_WIDTH;
splashHeight = SPLASH_HEIGHT;
splash_format = QImage::Format_Mono;
if (SeekSplash(QByteArray((const char *)gr9x_splash, sizeof(gr9x_splash))) || SeekSplash(QByteArray((const char *)gr9xv4_splash, sizeof(gr9xv4_splash)))) {
@@ -206,8 +211,8 @@ void FirmwareInterface::SeekSplash(void)
}
if (SeekSplash(QByteArray((const char *)opentxtaranis_splash, sizeof(opentxtaranis_splash)))) {
splash_width = SPLASHX9D_WIDTH;
splash_height = SPLASHX9D_HEIGHT;
splashWidth = SPLASHX9D_WIDTH;
splashHeight = SPLASHX9D_HEIGHT;
splash_format = QImage::Format_Indexed8;
return;
}
@@ -221,8 +226,8 @@ void FirmwareInterface::SeekSplash(void)
}
if (SeekSplash(QByteArray(OTX_SPS_TARANIS, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 6784)) {
splash_width = SPLASHX9D_WIDTH;
splash_height = SPLASHX9D_HEIGHT;
splashWidth = SPLASHX9D_WIDTH;
splashHeight = SPLASHX9D_HEIGHT;
splash_format = QImage::Format_Indexed8;
return;
}
@@ -232,14 +237,14 @@ void FirmwareInterface::SeekSplash(void)
}
if (SeekSplash(QByteArray(ERSPLASH_MARKER, sizeof(ERSPLASH_MARKER)))) {
splash_offset += sizeof(ERSPLASH_MARKER);
splash_size = sizeof(er9x_splash);
splashOffset += sizeof(ERSPLASH_MARKER);
splashSize = sizeof(er9x_splash);
}
}
bool FirmwareInterface::setSplash(const QImage & newsplash)
{
if (splash_offset == 0 || splash_size == 0) {
if (splashOffset == 0 || splashSize == 0) {
return false;
}
@@ -247,9 +252,9 @@ bool FirmwareInterface::setSplash(const QImage & newsplash)
QColor color;
QByteArray splash;
if (splash_format == QImage::Format_Indexed8) {
for (unsigned int y=0; y<splash_height; y++) {
unsigned int idx = (y/2)*splash_width;
for (unsigned int x=0; x<splash_width; x++, idx++) {
for (unsigned int y=0; y<splashHeight; y++) {
unsigned int idx = (y/2)*splashWidth;
for (unsigned int x=0; x<splashWidth; x++, idx++) {
QRgb gray = qGray(newsplash.pixel(x, y));
uint8_t z = ((255-gray)*15)/255;
if (y & 1) z <<= 4;
@@ -260,27 +265,27 @@ bool FirmwareInterface::setSplash(const QImage & newsplash)
else {
QColor black = QColor(0,0,0);
QImage blackNwhite = newsplash.convertToFormat(QImage::Format_MonoLSB);
for (uint y=0; y<splash_height; y++) {
for (uint x=0; x<splash_width; x++) {
for (uint y=0; y<splashHeight; y++) {
for (uint x=0; x<splashWidth; x++) {
color = QColor(blackNwhite.pixel(x,y));
b[splash_width*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
b[splashWidth*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
}
}
}
splash.clear();
splash.append(b, splash_size);
flash.replace(splash_offset, splash_size, splash);
splash.append(b, splashSize);
flash.replace(splashOffset, splashSize, splash);
return true;
}
int FirmwareInterface::getSplashWidth()
{
return splash_width;
return splashWidth;
}
uint FirmwareInterface::getSplashHeight()
{
return splash_height;
return splashHeight;
}
QImage::Format FirmwareInterface::getSplashFormat()
@@ -290,17 +295,17 @@ QImage::Format FirmwareInterface::getSplashFormat()
QImage FirmwareInterface::getSplash()
{
if (splash_offset == 0 || splash_size == 0) {
if (splashOffset == 0 || splashSize == 0) {
return QImage(); // empty image
}
if (splash_format == QImage::Format_Indexed8) {
QImage image(splash_width, splash_height, QImage::Format_RGB888);
if (splash_offset > 0) {
for (unsigned int y=0; y<splash_height; y++) {
unsigned int idx = (y/2)*splash_width;
for (unsigned int x=0; x<splash_width; x++, idx++) {
uint8_t byte = flash.at(splash_offset+idx);
QImage image(splashWidth, splashHeight, QImage::Format_RGB888);
if (splashOffset > 0) {
for (unsigned int y=0; y<splashHeight; y++) {
unsigned int idx = (y/2)*splashWidth;
for (unsigned int x=0; x<splashWidth; x++, idx++) {
uint8_t byte = flash.at(splashOffset+idx);
unsigned int z = (y & 1) ? (byte >> 4) : (byte & 0x0F);
z = 255-(z*255)/15;
QRgb rgb = qRgb(z, z, z);
@@ -311,11 +316,11 @@ QImage FirmwareInterface::getSplash()
return image;
}
else {
QImage image(splash_width, splash_height, QImage::Format_Mono);
if (splash_offset > 0) {
for (unsigned int y=0; y<splash_height; y++) {
for(unsigned int x=0; x<splash_width; x++) {
image.setPixel(x, y, (flash.at(splash_offset+(splash_width*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
QImage image(splashWidth, splashHeight, QImage::Format_Mono);
if (splashOffset > 0) {
for (unsigned int y=0; y<splashHeight; y++) {
for(unsigned int x=0; x<splashWidth; x++) {
image.setPixel(x, y, (flash.at(splashOffset+(splashWidth*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
}
}
}
@@ -325,7 +330,7 @@ QImage FirmwareInterface::getSplash()
bool FirmwareInterface::hasSplash()
{
return (splash_offset > 0 ? true : false);
return (splashOffset > 0 ? true : false);
}
bool FirmwareInterface::isValid()
@@ -336,7 +341,7 @@ bool FirmwareInterface::isValid()
unsigned int FirmwareInterface::save(QString fileName)
{
uint8_t binflash[MAX_FSIZE];
memcpy(&binflash, flash.constData(), flash_size);
memcpy(&binflash, flash.constData(), flashSize);
QFile file(fileName);
int fileType = getFileType(fileName);
@@ -347,16 +352,16 @@ unsigned int FirmwareInterface::save(QString fileName)
}
QTextStream outputStream(&file);
HexInterface hex=HexInterface(outputStream);
hex.save(binflash, flash_size);
hex.save(binflash, flashSize);
}
else {
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { //reading HEX TEXT file
return -1;
}
file.write((char*)binflash, flash_size);
file.write((char*)binflash, flashSize);
}
file.close();
return flash_size;
return flashSize;
}
+6 -6
View File
@@ -45,7 +45,7 @@ class FirmwareInterface
FirmwareInterface(const QString &filename);
inline QString getDate() { return date; }
inline QString getTime() { return time; }
int getSize() { return flash_size; }
int getSize() { return flashSize; }
QString getFlavour() const;
bool isHardwareCompatible(const FirmwareInterface &previousFirmware) const;
inline QString getVersion() { return version; }
@@ -64,7 +64,7 @@ class FirmwareInterface
private:
QByteArray flash;
uint flash_size;
uint flashSize;
QString seekString(const QString & string);
QString seekLabel(const QString & label);
void SeekSplash();
@@ -80,10 +80,10 @@ class FirmwareInterface
int eepromVersion;
int eepromVariant;
QByteArray splash;
uint splash_offset;
uint splash_size;
uint splash_width;
uint splash_height;
uint splashOffset;
uint splashSize;
uint splashWidth;
uint splashHeight;
QImage::Format splash_format;
bool isValidFlag;
};
+5 -5
View File
@@ -70,7 +70,7 @@ Er9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.trainer = trainer;
result.blightinv=blightinv;
result.stickScroll=stickScroll;
@@ -361,16 +361,16 @@ t_Er9xModelData::operator ModelData ()
c9x.timers[0].val = tmrVal;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
+1 -1
View File
@@ -61,7 +61,7 @@ PACK(typedef struct t_Er9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Er9xTrainerData trainer;
uint8_t view;
@@ -190,23 +190,23 @@ int Er9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant,
return 0;
}
int Er9xInterface::getSize(ModelData &model)
int Er9xInterface::getSize(const ModelData &model)
{
return 0;
}
int Er9xInterface::getSize(GeneralSettings &settings)
int Er9xInterface::getSize(const GeneralSettings &settings)
{
return 0;
}
int Er9xInterface::isAvailable(Protocol prot, int port)
int Er9xInterface::isAvailable(PulsesProtocol prot, int port)
{
switch (prot) {
case PPM:
case DSM2:
case PXX_DJT:
case PPM16:
case PULSES_PPM:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
return 1;
default:
return 0;
+3 -3
View File
@@ -42,11 +42,11 @@ class Er9xInterface : public EEPROMInterface
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(ModelData &);
virtual int getSize(const ModelData &);
virtual int getSize(GeneralSettings &settings);
virtual int getSize(const GeneralSettings &settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
@@ -82,7 +82,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@@ -135,7 +135,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.switchWarningStates = switchWarningStates;
result.speakerVolume = volume;
result.backlightBright = bright ;
result.currentCalib = current_calib;
result.txCurrentCalibration = current_calib;
return result;
}
@@ -493,16 +493,16 @@ t_Ersky9xModelData_v10::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
@@ -608,16 +608,16 @@ t_Ersky9xModelData_v11::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
@@ -69,7 +69,7 @@ PACK(typedef struct t_Ersky9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Ersky9xTrainerData trainer;
uint8_t view;
@@ -234,23 +234,23 @@ int Ersky9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varia
return 0;
}
int Ersky9xInterface::getSize(ModelData &model)
int Ersky9xInterface::getSize(const ModelData & model)
{
return 0;
}
int Ersky9xInterface::getSize(GeneralSettings &settings)
int Ersky9xInterface::getSize(const GeneralSettings & settings)
{
return 0;
}
int Ersky9xInterface::isAvailable(Protocol prot, int port)
int Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
{
switch (prot) {
case PPM:
case DSM2:
case PXX_DJT:
case PPM16:
case PULSES_PPM:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
return 1;
default:
return 0;
@@ -42,11 +42,11 @@ class Ersky9xInterface : public EEPROMInterface
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(ModelData &);
virtual int getSize(const ModelData &);
virtual int getSize(GeneralSettings &settings);
virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
@@ -70,7 +70,7 @@ Gruvin9xGeneral_v103::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@@ -127,7 +127,7 @@ Gruvin9xGeneral_v104::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@@ -170,12 +170,12 @@ t_Gruvin9xExpoData::operator ExpoData ()
c9x.chn = chn;
c9x.swtch = gruvin9xToSwitch(swtch);
if (negPhase) {
c9x.phases= 1 << (phase -1);
c9x.flightModes= 1 << (phase -1);
} else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
} else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.weight = weight;
if (expo) {
@@ -423,25 +423,25 @@ t_Gruvin9xModelData_v102::operator ModelData ()
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -493,25 +493,25 @@ t_Gruvin9xModelData_v103::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -563,25 +563,25 @@ t_Gruvin9xModelData_v105::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -653,25 +653,25 @@ t_Gruvin9xModelData_v106::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -69,7 +69,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v103 {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v103 trainer;
uint8_t view; //index of subview in main scrren
@@ -106,7 +106,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v104 {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v104 trainer;
uint8_t view; //index of subview in main scrren
@@ -206,25 +206,25 @@ int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t vari
return 0;
}
int Gruvin9xInterface::getSize(ModelData &model)
int Gruvin9xInterface::getSize(const ModelData & model)
{
return 0;
}
int Gruvin9xInterface::getSize(GeneralSettings &settings)
int Gruvin9xInterface::getSize(const GeneralSettings & settings)
{
return 0;
}
int Gruvin9xInterface::isAvailable(Protocol proto, int port)
int Gruvin9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PPM:
case SILV_A:
case SILV_B:
case SILV_C:
case CTP1009:
case DSM2:
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
case PULSES_DSM2:
return 1;
default:
return 0;
@@ -43,11 +43,11 @@ class Gruvin9xInterface : public EEPROMInterface
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(ModelData &);
virtual int getSize(const ModelData &);
virtual int getSize(GeneralSettings &settings);
virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
@@ -87,14 +87,14 @@ t_Open9xGruvin9xMixData_v207::operator MixData ()
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
@@ -155,14 +155,14 @@ t_Open9xGruvin9xMixData_v209::operator MixData ()
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
@@ -222,7 +222,7 @@ t_Open9xGruvin9xMixData_v211::operator MixData ()
c9x.noExpo = noExpo;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
c9x.phases = phases;
c9x.flightModes = phases;
c9x.sOffset = sOffset;
}
return c9x;
@@ -440,16 +440,16 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -514,19 +514,19 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -596,19 +596,19 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -679,19 +679,19 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -766,19 +766,19 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -160,12 +160,12 @@ t_Open9xArmExpoData_v208::operator ExpoData ()
}
c9x.swtch = open9xArmToSwitch(swtch);
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
} else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
} else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.weight = weight;
return c9x;
@@ -190,14 +190,14 @@ t_Open9xArmExpoData_v210::operator ExpoData ()
}
c9x.swtch = open9xArmToSwitch(swtch);
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.weight = weight;
getEEPROMZString(c9x.name, name, sizeof(name));
@@ -213,7 +213,7 @@ t_Open9xArmExpoData_v212::operator ExpoData ()
// TODO c9x.curveMode=curveMode;
// c9x.curveParam=curveParam;
c9x.swtch = open9xArmToSwitch(swtch);
c9x.phases= phases;
c9x.flightModes= phases;
c9x.weight = weight;
getEEPROMZString(c9x.name, name, sizeof(name));
return c9x;
@@ -292,14 +292,14 @@ t_Open9xArmMixData_v208::operator MixData ()
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=511;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
@@ -358,14 +358,14 @@ t_Open9xArmMixData_v209::operator MixData ()
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=511;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
@@ -424,14 +424,14 @@ t_Open9xArmMixData_v210::operator MixData ()
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
c9x.flightModes=0;
}
else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes=511;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
@@ -493,7 +493,7 @@ t_Open9xArmMixData_v212::operator MixData ()
c9x.noExpo = noExpo;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
c9x.phases = phases;
c9x.flightModes = phases;
c9x.sOffset = sOffset;
getEEPROMZString(c9x.name, name, sizeof(name));
}
@@ -716,19 +716,19 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -799,19 +799,19 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -883,19 +883,19 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -967,19 +967,19 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1054,19 +1054,19 @@ t_Open9xArmModelData_v212::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -88,7 +88,7 @@ t_Open9xExpoData_v201::operator ExpoData ()
ExpoData c9x;
c9x.mode = mode;
c9x.chn = chn;
if (expo!=0 && curve!=0) {
if (expo != 0 && curve != 0) {
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX"));
}
else {
@@ -101,14 +101,14 @@ t_Open9xExpoData_v201::operator ExpoData ()
}
c9x.swtch = open9xStockToSwitch(swtch);
if (negPhase) {
c9x.phases= 1 << (phase -1);
c9x.flightModes = 1 << (phase -1);
}
else if (phase==0) {
c9x.phases=0;
else if (phase == 0) {
c9x.flightModes = 0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes = 63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.weight = weight;
return c9x;
@@ -121,7 +121,7 @@ t_Open9xExpoData_v211::operator ExpoData ()
c9x.chn = chn;
// TODO c9x.curve
c9x.swtch = open9xStockToSwitch(swtch);
c9x.phases = phases;
c9x.flightModes = phases;
c9x.weight = weight;
return c9x;
}
@@ -129,8 +129,8 @@ t_Open9xExpoData_v211::operator ExpoData ()
t_Open9xLimitData_v201::operator LimitData ()
{
LimitData c9x;
c9x.min = 10*(min-100);
c9x.max = 10*(max+100);
c9x.min = 10 * (min - 100);
c9x.max = 10 * (max + 100);
c9x.revert = revert;
c9x.offset = offset;
return c9x;
@@ -139,12 +139,12 @@ t_Open9xLimitData_v201::operator LimitData ()
t_Open9xLimitData_v211::operator LimitData ()
{
LimitData c9x;
c9x.min = 10*(min-100);
c9x.max = 10*(max+100);
c9x.min = 10 * (min - 100);
c9x.max = 10 * (max + 100);
c9x.revert = revert;
c9x.offset = offset;
c9x.symetrical=symetrical;
c9x.ppmCenter=ppmCenter;
c9x.symetrical = symetrical;
c9x.ppmCenter = ppmCenter;
return c9x;
}
@@ -197,13 +197,13 @@ t_Open9xMixData_v201::operator MixData ()
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
} else if (phase==0) {
c9x.phases=0;
if (phase < 0) {
c9x.flightModes = 1 << (-phase -1);
} else if (phase == 0) {
c9x.flightModes = 0;
} else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes = 63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
return c9x;
@@ -258,13 +258,13 @@ t_Open9xMixData_v203::operator MixData ()
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
} else if (phase==0) {
c9x.phases=0;
if (phase < 0) {
c9x.flightModes = 1 << (-phase -1);
} else if (phase == 0) {
c9x.flightModes = 0;
} else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes = 63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
return c9x;
@@ -319,15 +319,15 @@ t_Open9xMixData_v205::operator MixData ()
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
if (phase < 0) {
c9x.flightModes = 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
else if (phase == 0) {
c9x.flightModes = 0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes = 63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
@@ -339,7 +339,7 @@ t_Open9xMixData_v209::operator MixData ()
MixData c9x;
if (srcRaw) {
c9x.destCh = destCh+1;
c9x.destCh = destCh + 1;
c9x.swtch = open9xStockToSwitch(swtch);
if (srcRaw == 0) {
@@ -386,15 +386,15 @@ t_Open9xMixData_v209::operator MixData ()
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.phases= 1 << (-phase -1);
if (phase < 0) {
c9x.flightModes = 1 << (-phase -1);
}
else if (phase==0) {
c9x.phases=0;
else if (phase ==0 ) {
c9x.flightModes = 0;
}
else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
c9x.flightModes = 63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
@@ -406,7 +406,7 @@ t_Open9xMixData_v211::operator MixData ()
MixData c9x;
if (srcRaw) {
c9x.destCh = destCh+1;
c9x.destCh = destCh + 1;
c9x.swtch = open9xStockToSwitch(swtch);
if (srcRaw == 0) {
@@ -453,7 +453,7 @@ t_Open9xMixData_v211::operator MixData ()
c9x.noExpo = noExpo;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
c9x.phases = phases;
c9x.flightModes = phases;
c9x.sOffset = sOffset;
}
return c9x;
@@ -603,8 +603,8 @@ t_Open9xCustomFunctionData_v203::operator CustomFunctionData ()
CustomFunctionData c9x;
c9x.swtch = open9xStockToSwitch(swtch);
if (func < 16) {
c9x.enabled=param & 0x01;
c9x.param = (param>>1)<<1;
c9x.enabled = param & 0x01;
c9x.param = (param>>1) << 1;
c9x.func = (AssignFunc)(func);
} else {
c9x.param = param;
@@ -730,7 +730,7 @@ t_Open9xTimerData_v202::operator TimerData ()
FrSkyRSSIAlarm t_Open9xFrSkyRSSIAlarm::get(int index)
{
FrSkyRSSIAlarm c9x;
c9x.level = (2+index+level) % 4;
c9x.level = (2 + index + level) % 4;
c9x.value = value + 50;
return c9x;
}
@@ -840,7 +840,7 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.blades = blades+2;
c9x.blades = blades + 2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -853,7 +853,7 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.blades = blades+2;
c9x.blades = blades + 2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
c9x.screens[0].body.bars[i] = bars[i];
@@ -869,7 +869,7 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades+2;
c9x.blades = blades + 2;
c9x.currentSource=currentSource;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -886,7 +886,7 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.voltsSource = voltsSource;
c9x.blades = blades+2;
c9x.blades = blades + 2;
c9x.currentSource=currentSource;
int lines_screen_index = 0;
@@ -917,16 +917,16 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -991,16 +991,16 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1067,16 +1067,16 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1141,16 +1141,16 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1217,19 +1217,19 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 4:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1295,19 +1295,19 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1381,19 +1381,19 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1468,19 +1468,19 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@@ -1556,19 +1556,19 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
+85 -94
View File
@@ -12,7 +12,7 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || IS_2560(board))
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 3) : 3)
#define MAX_POTS(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : (version >= 216 ? 3 : 2)) : 3)
#define MAX_SLIDERS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 2) : 0)
#define MAX_SWITCHES(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 18 : 8) : 7)
#define MAX_SWITCHES_POSITION(board, version) (IS_TARANIS_X9E(board) ? 18*3 : (IS_TARANIS(board) ? 8*3 : 9))
@@ -80,7 +80,7 @@ class SwitchesConversionTable: public ConversionTable {
}
if (IS_TARANIS(board) && version >= 216) {
for (int i=1; i<=MAX_POTS(board)*6; i++) {
for (int i=1; i<=MAX_POTS(board, version)*6; i++) {
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++);
}
@@ -212,8 +212,9 @@ class SourcesConversionTable: public ConversionTable {
}
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++)
for (int i=0; i<32; i++) {
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
}
for (int i=0; i<7; i++) {
for (int j=0; j<6; j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
@@ -221,16 +222,18 @@ class SourcesConversionTable: public ConversionTable {
}
}
for (int i=0; i<NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board); i++) {
for (int i=0; i<NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
}
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
}
if (!afterrelease21March2013) {
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<NUM_STICKS; i++) {
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
}
}
addConversion(RawSource(SOURCE_TYPE_MAX), val++);
@@ -380,32 +383,6 @@ void OpenTxEepromCleanup(void)
SwitchesConversionTable::Cleanup();
}
ThrottleSourceConversionTable::ThrottleSourceConversionTable(BoardEnum board, unsigned int version)
{
int val=0;
addConversion(THROTTLE_SOURCE_THR, val++);
if (IS_TARANIS(board)) {
addConversion(THROTTLE_SOURCE_S1, val++);
addConversion(THROTTLE_SOURCE_S2, val++);
if (version >= 216)
addConversion(THROTTLE_SOURCE_S3, val++);
addConversion(THROTTLE_SOURCE_LS, val++);
addConversion(THROTTLE_SOURCE_RS, val++);
}
else {
addConversion(THROTTLE_SOURCE_P1, val++);
addConversion(THROTTLE_SOURCE_P2, val++);
addConversion(THROTTLE_SOURCE_P3, val++);
}
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
addConversion(THROTTLE_SOURCE_FIRST_CHANNEL+i, val++);
}
}
template <int N>
class SwitchField: public ConversionField< SignedField<N> > {
public:
@@ -943,7 +920,7 @@ class MixField: public TransformedField {
{
if (IS_TARANIS(board) && version >= 217) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<9>(mix.phases));
internalField.Append(new UnsignedField<9>(mix.flightModes));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<1>((unsigned int &)mix.carryTrim));
internalField.Append(new UnsignedField<4>(mix.mixWarn));
@@ -961,7 +938,7 @@ class MixField: public TransformedField {
else if (IS_ARM(board) && version >= 217) {
internalField.Append(new UnsignedField<5>(_destCh));
internalField.Append(new UnsignedField<3>(mix.mixWarn));
internalField.Append(new UnsignedField<9>(mix.phases));
internalField.Append(new UnsignedField<9>(mix.flightModes));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new BoolField<1>(mix.noExpo));
internalField.Append(new SignedField<3>(mix.carryTrim));
@@ -979,7 +956,7 @@ class MixField: public TransformedField {
}
else if (IS_TARANIS(board) && version == 216) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new UnsignedField<16>(mix.flightModes));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<1>((unsigned int &)mix.carryTrim));
internalField.Append(new SpareBitsField<5>());
@@ -1000,7 +977,7 @@ class MixField: public TransformedField {
else if (IS_ARM(board) && version == 216) {
internalField.Append(new UnsignedField<5>(_destCh));
internalField.Append(new UnsignedField<3>(mix.mixWarn));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new UnsignedField<16>(mix.flightModes));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new BoolField<1>(mix.noExpo));
internalField.Append(new SignedField<3>(mix.carryTrim));
@@ -1019,7 +996,7 @@ class MixField: public TransformedField {
}
else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new UnsignedField<16>(mix.flightModes));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new BoolField<1>(mix.noExpo));
internalField.Append(new SignedField<3>(mix.carryTrim));
@@ -1064,7 +1041,7 @@ class MixField: public TransformedField {
internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
internalField.Append(new SignedField<8>(_weight));
internalField.Append(new SwitchField<8>(mix.swtch, board, version));
internalField.Append(new UnsignedField<8>(mix.phases));
internalField.Append(new UnsignedField<8>(mix.flightModes));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new SignedField<3>(mix.carryTrim));
internalField.Append(new UnsignedField<2>(mix.mixWarn));
@@ -1085,7 +1062,7 @@ class MixField: public TransformedField {
internalField.Append(new SignedField<8>(_weight));
internalField.Append(new SwitchField<6>(mix.swtch, board, version));
internalField.Append(new UnsignedField<2>((unsigned int &)mix.mltpx));
internalField.Append(new UnsignedField<5>(mix.phases));
internalField.Append(new UnsignedField<5>(mix.flightModes));
internalField.Append(new SignedField<3>(mix.carryTrim));
internalField.Append(new SourceField<6>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
internalField.Append(new UnsignedField<2>(mix.mixWarn));
@@ -1214,7 +1191,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<14>(expo.scale, "Scale"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases));
internalField.Append(new UnsignedField<16>(expo.flightModes));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
@@ -1226,7 +1203,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<3>(expo.chn, "Channel"));
internalField.Append(new BoolField<2>(_curveMode));
internalField.Append(new UnsignedField<9>(expo.phases, "Phases"));
internalField.Append(new UnsignedField<9>(expo.flightModes, "Phases"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new ZCharField<6>(expo.name));
@@ -1237,7 +1214,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<16>(expo.scale, "Scale"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases));
internalField.Append(new UnsignedField<16>(expo.flightModes));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
@@ -1251,7 +1228,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<4>(expo.chn, "Channel"));
internalField.Append(new BoolField<2>(_curveMode));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases, "Phases"));
internalField.Append(new UnsignedField<16>(expo.flightModes, "Phases"));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new ZCharField<6>(expo.name));
internalField.Append(new SignedField<8>(_curveParam));
@@ -1260,7 +1237,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<8>(expo.mode, "Mode"));
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new UnsignedField<16>(expo.phases, "Phases"));
internalField.Append(new UnsignedField<16>(expo.flightModes, "Phases"));
internalField.Append(new SignedField<8>(_weight, "Weight"));
internalField.Append(new BoolField<8>(_curveMode));
if (HAS_LARGE_LCD(board)) {
@@ -1277,7 +1254,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<2>(expo.chn));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new SpareBitsField<3>());
internalField.Append(new UnsignedField<8>(expo.phases));
internalField.Append(new UnsignedField<8>(expo.flightModes));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
internalField.Append(new SignedField<8>(_weight));
internalField.Append(new SignedField<8>(_curveParam));
@@ -1286,7 +1263,7 @@ class InputField: public TransformedField {
internalField.Append(new UnsignedField<2>(expo.mode));
internalField.Append(new SwitchField<6>(expo.swtch, board, version));
internalField.Append(new UnsignedField<2>(expo.chn));
internalField.Append(new UnsignedField<5>(expo.phases));
internalField.Append(new UnsignedField<5>(expo.flightModes));
internalField.Append(new BoolField<1>(_curveMode));
internalField.Append(new SignedField<8>(_weight));
internalField.Append(new SignedField<8>(_curveParam));
@@ -1360,10 +1337,9 @@ class InputField: public TransformedField {
class LimitField: public StructField {
public:
template <int shift>
template <int shift, int GV1>
static int exportLimitValue(int value)
{
const int GV1 = 4096;
if (value > 10000) {
return -GV1 + value - 10001;
}
@@ -1373,16 +1349,9 @@ class LimitField: public StructField {
return value + shift;
}
template <int shift>
template <int shift, int GV1>
static int importLimitValue(int value)
{
/* GVARS mapping on radio:
GV1 = -4096
GV9 = -4088
-GV1 = 4095
-GV9 = 4087
*/
const int GV1 = 4096;
if (value >= GV1) {
return 10001 + value - GV1;
}
@@ -1402,10 +1371,10 @@ class LimitField: public StructField {
StructField("Limit")
{
if (IS_TARANIS(board) && version >= 217) {
Append(new ConversionField< SignedField<11> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
Append(new ConversionField< SignedField<11> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
Append(new ConversionField< SignedField<11> >(limit.min, exportLimitValue<1000, 1024>, importLimitValue<1000, 1024>));
Append(new ConversionField< SignedField<11> >(limit.max, exportLimitValue<-1000, 1024>, importLimitValue<-1000, 1024>));
Append(new SignedField<10>(limit.ppmCenter));
Append(new ConversionField< SignedField<11> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
Append(new ConversionField< SignedField<11> >(limit.offset, exportLimitValue<0, 1024>, importLimitValue<0, 1024>));
Append(new BoolField<1>(limit.symetrical));
Append(new BoolField<1>(limit.revert));
Append(new SpareBitsField<3>());
@@ -1416,10 +1385,10 @@ class LimitField: public StructField {
}
else {
if (IS_TARANIS(board) && version >= 216) {
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000, 4096>, importLimitValue<1000, 4096>));
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000, 4096>, importLimitValue<-1000, 4096>));
Append(new SignedField<8>(limit.ppmCenter));
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0, 4096>, importLimitValue<0, 4096>));
}
else {
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
@@ -1754,6 +1723,7 @@ class LogicalSwitchField: public TransformedField {
{
delete andswitchesConversionTable;
}
virtual void beforeExport()
{
if (csw.func == LS_FN_TIMER) {
@@ -1795,8 +1765,14 @@ class LogicalSwitchField: public TransformedField {
switchesConversionTable->importValue(v2, csw.val2);
}
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
sourcesConversionTable->importValue((uint32_t)v2, csw.val2);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@@ -1809,7 +1785,12 @@ class LogicalSwitchField: public TransformedField {
}
}
else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@@ -2708,7 +2689,13 @@ class FrskyField: public StructField {
}
}
Append(new ConversionField< UnsignedField<8> >(frsky.varioSource, &telemetryVarioSourceConversionTable, "Vario Source"));
if (version >= 217) {
Append(new UnsignedField<7>(frsky.varioSource, "Vario Source"));
Append(new BoolField<1>(frsky.varioCenterSilent));
}
else {
Append(new ConversionField< UnsignedField<8> >(frsky.varioSource, &telemetryVarioSourceConversionTable, "Vario Source"));
}
Append(new SignedField<8>(frsky.varioCenterMax));
Append(new SignedField<8>(frsky.varioCenterMin));
Append(new SignedField<8>(frsky.varioMin));
@@ -2811,7 +2798,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
_id = sensor.id;
_instance = sensor.instance;
_param = (sensor.ratio) + ((unsigned int)sensor.offset << 16);
_ratio = sensor.ratio;
_offset = sensor.offset;
}
else {
_id = sensor.persistentValue;
@@ -2822,7 +2810,7 @@ class SensorField: public TransformedField {
_param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24);
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
_param = (sensor.gps) + (sensor.alt << 8);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
_param = (sensor.amps);
}
}
@@ -2832,8 +2820,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
sensor.id = _id;
sensor.instance = _instance;
sensor.ratio = _param & 0xFFFF;
sensor.offset = (_param >> 16) & 0xFFFF;
sensor.ratio = _ratio;
sensor.offset = _offset;
}
else {
sensor.persistentValue = _id;
@@ -2845,7 +2833,7 @@ class SensorField: public TransformedField {
sensor.sources[i] = _sources[i];
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
(sensor.gps = _sources[0], sensor.alt = _sources[1]);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
sensor.amps = _sources[0];
}
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
@@ -2859,6 +2847,10 @@ class SensorField: public TransformedField {
union {
unsigned int _param;
uint8_t _sources[4];
struct {
uint16_t _ratio;
int16_t _offset;
};
};
};
@@ -2872,8 +2864,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board),
version(version),
variant(variant),
protocolsConversionTable(board),
throttleSourceConversionTable(board, version)
protocolsConversionTable(board)
{
sprintf(name, "Model %s", modelData.name);
@@ -2951,7 +2942,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 217) {
internalField.Append(new BoolField<1>(modelData.noGlobalFunctions));
internalField.Append(new UnsignedField<2>(modelData.trimsDisplay));
internalField.Append(new SpareBitsField<1>());
internalField.Append(new BoolField<1>(modelData.frsky.ignoreSensorIds));
}
else if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216)) {
internalField.Append(new SpareBitsField<4>());
@@ -3008,7 +2999,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
}
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc, "Throttle Source"));
if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId));
@@ -3150,7 +3141,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 217) {
for (int i=0; i<8; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else
internalField.Append(new SpareBitsField<1>());
@@ -3158,7 +3149,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
else if (IS_ARM(board) && version >= 216) {
for (int i=0; i<6; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else
internalField.Append(new SpareBitsField<1>());
@@ -3167,7 +3158,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
if (IS_ARM(board) && version >= 216) {
for (int i=0; i < MAX_POTS(board)+MAX_SLIDERS(board); i++) {
for (int i=0; i < MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
}
}
@@ -3193,10 +3184,10 @@ void OpenTxModelData::beforeExport()
// qDebug() << QString("before export model") << modelData.name;
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12)
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16;
else if (modelData.moduleData[module].protocol >= LP45 && modelData.moduleData[module].protocol <= DSMX)
subprotocols[module] = modelData.moduleData[module].protocol - LP45;
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;
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX)
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
else
subprotocols[module] = (module==0 ? -1 : 0);
}
@@ -3210,7 +3201,7 @@ void OpenTxModelData::afterImport()
for (unsigned int i=0; i<NUM_STICKS; i++) {
for (int j=0; j<64; j++) {
ExpoData * expo = &modelData.expoData[j];
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->phases == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->flightModes == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
break;
if (expo->mode == 0 || expo->chn > i) {
ExpoData * newExpo = modelData.insertInput(j);
@@ -3225,18 +3216,18 @@ void OpenTxModelData::afterImport()
}
}
if (IS_TARANIS(board) && modelData.moduleData[0].protocol == 0) {
modelData.moduleData[0].protocol = PXX_XJT_X16;
}
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) {
if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
if (subprotocols[module] >= 0)
modelData.moduleData[module].protocol += subprotocols[module];
else
modelData.moduleData[module].protocol = OFF;
modelData.moduleData[module].protocol = PULSES_OFF;
}
}
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
}
}
OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant):
@@ -3245,7 +3236,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData),
board(board),
version(version),
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board))
inputsCount(NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
{
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
@@ -3282,7 +3273,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.currModel));
internalField.Append(new UnsignedField<8>(generalData.contrast));
internalField.Append(new UnsignedField<8>(generalData.vBatWarn));
internalField.Append(new SignedField<8>(generalData.vBatCalib));
internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
internalField.Append(new SignedField<8>(generalData.backlightMode));
for (int i=0; i<NUM_STICKS; i++)
@@ -3366,7 +3357,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(generalData.backlightBright));
internalField.Append(new SignedField<8>(generalData.currentCalib));
internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
if (version >= 213) {
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
@@ -3409,7 +3400,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
}
for (int i=0; i<4; i++) {
if (i < MAX_POTS(board))
if (i < MAX_POTS(board, version))
internalField.Append(new UnsignedField<2>(generalData.potConfig[i]));
else
internalField.Append(new SpareBitsField<2>());
@@ -3441,7 +3432,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
for (int i=0; i<NUM_STICKS; ++i) {
internalField.Append(new ZCharField<3>(generalData.stickName[i]));
}
for (int i=0; i<MAX_POTS(board); ++i) {
for (int i=0; i<MAX_POTS(board, version); ++i) {
internalField.Append(new ZCharField<3>(generalData.potName[i]));
}
for (int i=0; i<MAX_SLIDERS(board); ++i) {
+14 -21
View File
@@ -56,40 +56,34 @@ class ProtocolsConversionTable: public ConversionTable
{
int val = 0;
if (IS_ARM(board)) {
addConversion(OFF, val++);
addConversion(PULSES_OFF, val++);
}
addConversion(PPM, val++);
addConversion(PULSES_PPM, val++);
if (!IS_ARM(board)) {
addConversion(PPM16, val++);
addConversion(PPMSIM, val++);
addConversion(PULSES_PPM16, val++);
addConversion(PULSES_PPMSIM, val++);
}
if (IS_ARM(board)) {
addConversion(PXX_XJT_X16, val);
addConversion(PXX_XJT_D8, val);
addConversion(PXX_XJT_LR12, val++);
addConversion(PULSES_PXX_XJT_X16, val);
addConversion(PULSES_PXX_XJT_D8, val);
addConversion(PULSES_PXX_XJT_LR12, val++);
}
else {
addConversion(PXX_DJT, val++);
addConversion(PULSES_PXX_DJT, val++);
}
if (IS_ARM(board)) {
addConversion(LP45, val);
addConversion(DSM2, val);
addConversion(DSMX, val++);
addConversion(PULSES_LP45, val);
addConversion(PULSES_DSM2, val);
addConversion(PULSES_DSMX, val++);
}
else {
addConversion(LP45, val++);
addConversion(DSM2, val++);
addConversion(DSMX, val++);
addConversion(PULSES_LP45, val++);
addConversion(PULSES_DSM2, val++);
addConversion(PULSES_DSMX, val++);
}
}
};
class ThrottleSourceConversionTable: public ConversionTable {
public:
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
};
class ChannelsConversionTable: public ConversionTable
{
public:
@@ -121,7 +115,6 @@ class OpenTxModelData: public TransformedField {
char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable;
};
@@ -23,6 +23,9 @@
#include "file.h"
#include "appdata.h"
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/nightly/firmware"
#define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2
@@ -70,6 +73,8 @@ const char * OpenTxEepromInterface::getName()
return "OpenTX for Sky9x board / 9X";
case BOARD_9XRPRO:
return "OpenTX for 9XR-PRO";
case BOARD_AR9X:
return "OpenTX for ar9x board / 9X";
default:
return "OpenTX for an unknown board";
}
@@ -88,6 +93,7 @@ const int OpenTxEepromInterface::getEEpromSize()
case BOARD_SKY9X:
return EESIZE_SKY9X;
case BOARD_9XRPRO:
case BOARD_AR9X:
return EESIZE_9XRPRO;
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
@@ -378,6 +384,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
case BOARD_SKY9X:
case BOARD_AR9X:
case BOARD_9XRPRO:
version = 217;
break;
@@ -411,7 +418,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
}
for (int i=0; i<getMaxModels(); i++) {
if (!radioData.models[i].isempty()) {
if (!radioData.models[i].isEmpty()) {
result = saveModel<OpenTxModelData>(i, radioData.models[i], version, variant);
if (!result) {
return 0;
@@ -438,19 +445,18 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
return size;
}
int OpenTxEepromInterface::getSize(ModelData &model)
int OpenTxEepromInterface::getSize(const ModelData & model)
{
if (IS_SKY9X(board))
return 0;
if (model.isempty())
if (model.isEmpty())
return 0;
// TODO something better...
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board, 255/*version max*/);
QByteArray tmp(EESIZE_MAX, 0);
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255/*version max*/);
OpenTxModelData open9xModel(model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
OpenTxModelData open9xModel((ModelData &)model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
QByteArray eeprom;
open9xModel.Export(eeprom);
@@ -461,15 +467,15 @@ int OpenTxEepromInterface::getSize(ModelData &model)
return efile->size(0);
}
int OpenTxEepromInterface::getSize(GeneralSettings &settings)
int OpenTxEepromInterface::getSize(const GeneralSettings & settings)
{
if (IS_SKY9X(board))
return 0;
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board, 255);
QByteArray tmp(EESIZE_MAX, 0);
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255);
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmware()->getVariantNumber());
OpenTxGeneralData open9xGeneral((GeneralSettings &)settings, board, 255, GetCurrentFirmware()->getVariantNumber());
// open9xGeneral.Dump();
QByteArray eeprom;
@@ -605,10 +611,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
else
return 9;
case CustomFunctions:
if (IS_TARANIS(board))
if (IS_ARM(board))
return 64;
else if (IS_ARM(board))
return 60;
else if (IS_2560(board) || board==BOARD_M128)
return 24;
else
@@ -649,7 +653,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case Haptic:
return (IS_2560(board) || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || id.contains("haptic"));
case ModelTrainerEnable:
if (IS_ARM(board))
if (IS_TARANIS(board))
return 1;
else
return 0;
@@ -710,7 +714,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
return (IS_ARM(board) && !IS_9XRPRO(board)) ? 2 : 1;
case HasPPMStart:
return (IS_ARM(board) ? true : false);
case HasCurrentCalibration:
case HastxCurrentCalibration:
return (IS_SKY9X(board) ? true : false);
case HasVolume:
return (IS_ARM(board) ? true : false);
@@ -732,6 +736,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ;
case HasDisplayText:
return IS_ARM(board) ? 1 : 0;
case GlobalFunctions:
return IS_ARM(board) ? 64 : 0;
case VirtualInputs:
return IS_TARANIS(board) ? 32 : 0;
case TrainerInputs:
@@ -791,16 +797,16 @@ bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
return true;
}
int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
int OpenTxEepromInterface::isAvailable(PulsesProtocol proto, int port)
{
if (IS_TARANIS(board)) {
switch (port) {
case 0:
switch (proto) {
case OFF:
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PULSES_OFF:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
return 1;
default:
return 0;
@@ -808,15 +814,15 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case 1:
switch (proto) {
case OFF:
case PPM:
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
//case PXX_DJT: // Unavailable for now
case LP45:
case DSM2:
case DSMX:
case PULSES_OFF:
case PULSES_PPM:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
//case PULSES_PXX_DJT: // Unavailable for now
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
return 1;
default:
return 0;
@@ -824,7 +830,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case -1:
switch (proto) {
case PPM:
case PULSES_PPM:
return 1;
default:
return 0;
@@ -838,13 +844,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
switch (port) {
case 0:
switch (proto) {
case PPM:
// case PXX_XJT_X16:
// case PXX_XJT_D8:
// case PXX_XJT_LR12:
case LP45:
case DSM2:
case DSMX:
case PULSES_PPM:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
return 1;
default:
return 0;
@@ -852,7 +858,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case 1:
switch (proto) {
case PPM:
case PULSES_PPM:
return 1;
default:
return 0;
@@ -864,13 +870,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
}
else {
switch (proto) {
case PPM:
case DSMX:
case LP45:
case DSM2:
case PXX_DJT:
case PPM16:
case PPMSIM:
case PULSES_PPM:
case PULSES_DSMX:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
case PULSES_PPMSIM:
return 1;
default:
return 0;
@@ -1047,9 +1053,18 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
return true;
}
QString OpenTxFirmware::getFirmwareBaseUrl()
{
#if defined(ALLOW_NIGHTLY_BUILDS)
return (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
#else
return OPENTX_FIRMWARE_DOWNLOADS;
#endif
}
QString OpenTxFirmware::getFirmwareUrl()
{
QString url = OPENTX_FIRMWARE_DOWNLOADS;
QString url = getFirmwareBaseUrl();
switch (board) {
case BOARD_STOCK:
case BOARD_M128:
@@ -1058,6 +1073,7 @@ QString OpenTxFirmware::getFirmwareUrl()
url.append(QString("/getfw.php?fw=%1.hex").arg(id));
break;
case BOARD_SKY9X:
case BOARD_AR9X:
case BOARD_9XRPRO:
case BOARD_TARANIS:
case BOARD_TARANIS_PLUS:
@@ -1073,16 +1089,16 @@ QString OpenTxFirmware::getFirmwareUrl()
QString OpenTxFirmware::getReleaseNotesUrl()
{
QString url = OPENTX_FIRMWARE_DOWNLOADS;
QString url = getFirmwareBaseUrl();
url.append("/releasenotes.txt");
return url;
}
QString OpenTxFirmware::getStampUrl()
{
QString url = OPENTX_FIRMWARE_DOWNLOADS;
url.append("/stamp-opentx.txt");
return url;
QString url = getFirmwareBaseUrl();
url.append("/stamp-opentx.txt");
return url;
}
void addOpenTxCommonOptions(OpenTxFirmware * firmware)
@@ -1100,9 +1116,10 @@ void addOpenTxTaranisOptions(OpenTxFirmware * 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("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
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);
firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views"));
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use anymore on radios sold after Jan 1st, 2015"));
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015"));
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
}
@@ -1128,7 +1145,7 @@ void registerOpenTxFirmwares()
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
/* 9x board */
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK);
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X board"), BOARD_STOCK);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1164,7 +1181,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* 9x board with M128 chip */
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128);
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("M128 / 9X board"), BOARD_M128);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1194,7 +1211,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK);
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("9XR"), BOARD_STOCK);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1227,7 +1244,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128);
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("9XR with M128 chip"), BOARD_M128);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1255,7 +1272,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* Gruvin9x board */
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X);
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("Gruvin9x board / 9X"), BOARD_GRUVIN9X);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
@@ -1280,7 +1297,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* MEGA2560 board */
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("OpenTX for MEGA2560 board"), BOARD_MEGA2560);
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("MEGA2560 board"), BOARD_MEGA2560);
addOpenTxLcdOptions(firmware);
firmware->addOption("PWR", QObject::tr("Power management by soft-off circuitry"));
firmware->addOptions(ext_options);
@@ -1310,7 +1327,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X);
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("Sky9x board / 9X"), BOARD_SKY9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
@@ -1318,6 +1335,7 @@ void registerOpenTxFirmwares()
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
@@ -1328,9 +1346,9 @@ void registerOpenTxFirmwares()
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO);
/* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("ar9x board / 9X"), BOARD_AR9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
@@ -1338,6 +1356,30 @@ void registerOpenTxFirmwares()
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
@@ -1349,20 +1391,20 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* Taranis board */
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS);
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis Plus board */
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis X9E board */
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("OpenTX for FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
@@ -19,8 +19,6 @@
#include "eeprominterface.h"
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
class RleFile;
class OpenTxEepromInterface : public EEPROMInterface
@@ -43,11 +41,11 @@ class OpenTxEepromInterface : public EEPROMInterface
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(ModelData &);
virtual int getSize(const ModelData &);
virtual int getSize(GeneralSettings &);
virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
@@ -101,6 +99,7 @@ class OpenTxFirmware: public Firmware {
addTTSLanguage("en");
addTTSLanguage("cz");
addTTSLanguage("de");
addTTSLanguage("es");
addTTSLanguage("fr");
addTTSLanguage("hu");
@@ -124,6 +123,10 @@ class OpenTxFirmware: public Firmware {
virtual bool isTelemetrySourceAvailable(int source);
protected:
QString getFirmwareBaseUrl();
};
void registerOpenTxFirmwares();
@@ -13,11 +13,13 @@ add_custom_target(about_lbm_taranis
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
add_custom_target(trans
make tra
add_custom_target(commondeps
make stamp_header tra
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${RADIO_SRC_DIRECTORY}/stamp-opentx.h)
add_custom_target(lua_exports
make PCB=TARANIS lua_exports.inc
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
@@ -41,6 +43,11 @@ include_directories(
${RADIO_SRC_DIRECTORY}/thirdparty/Lua/src
)
if(APPLE)
# OS X compiler no longer automatically includes /Library/Frameworks in search path
set(CMAKE_SHARED_LINKER_FLAGS -F/Library/Frameworks)
endif(APPLE)
if(DEFINED TRANSLATIONS)
set(COMMON_DEFINITIONS ${COMMON_DEFINITIONS} TRANSLATIONS_${TRANSLATIONS})
string(TOLOWER ${TRANSLATIONS} TRANSLATION_SUFFIX)
@@ -73,21 +80,23 @@ add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_dependencies(opentx-9x${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-9xr${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-9x128${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-9xr128${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x trans)
add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
add_dependencies(opentx-9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-9xr${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-9x128${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-9xr128${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-ar9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
set(OPENTX_LIBRARIES
opentx-9x${SUFFIX}-simulator
@@ -98,11 +107,16 @@ set(OPENTX_LIBRARIES
opentx-mega2560${SUFFIX}-simulator
opentx-sky9x${SUFFIX}-simulator
opentx-9xrpro${SUFFIX}-simulator
opentx-ar9x${SUFFIX}-simulator
opentx-taranis${SUFFIX}-simulator
opentx-taranisplus${SUFFIX}-simulator
opentx-taranisx9e${SUFFIX}-simulator
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${OPENTX_LIBRARIES} LIBRARY DESTINATION ${SIMULATOR_LIB_PATH})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# 9X with ATmega64
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
@@ -143,6 +157,11 @@ target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# AR9X
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Taranis standard
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
@@ -158,6 +177,27 @@ target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
ADD_CUSTOM_TARGET(opentx-simulators
add_custom_target(opentx-simulators
DEPENDS ${OPENTX_LIBRARIES}
)
if(APPLE)
set(SIMULATOR_BUNDLES)
foreach(_file ${OPENTX_LIBRARIES})
set(SIMULATOR_BUNDLE "${_file}-bundle")
add_custom_target(${SIMULATOR_BUNDLE}
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${_file}.dylib
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${_file}.dylib
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${_file}.dylib
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND pwd
COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/
DEPENDS ${_file}
)
list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE})
endforeach()
add_custom_target(opentx-simulators-bundle DEPENDS ${SIMULATOR_BUNDLES})
endif(APPLE)
@@ -41,14 +41,15 @@
#define GRAPHICS
#define CURVES
#if defined(PCBTARANIS)
#define RTCLOCK
#define XCURVES
#define VIRTUALINPUTS
#define LUA
#define LUA_MODEL_SCRIPTS
#define RTCLOCK
#define XCURVES
#define VIRTUALINPUTS
#define LUA
#define LUA_MODEL_SCRIPTS
#define LUAINPUTS
#else
#define BUZZER
#define TEMPLATES
#define BUZZER
#define TEMPLATES
#endif
#define BOLD_FONT
#define HAPTIC
@@ -61,17 +62,17 @@
#endif
#if defined(PCBSKY9X) && !defined(REVX)
#define ROTARY_ENCODERS 1
#define ROTARY_ENCODERS 1
#elif defined(PCBGRUVIN9X)
#define ROTARY_ENCODERS 2
#define ROTARY_ENCODERS 2
#endif
#if defined(CPUARM)
#define FRSKY_SPORT
#define FRSKY_SPORT
#endif
#if defined (PCBTARANIS)
#define MIXERS_MONITOR
#define MIXERS_MONITOR
#endif
#undef min
@@ -121,6 +122,7 @@ namespace NAMESPACE {
#include "radio/src/stamp.cpp"
#include "radio/src/maths.cpp"
#include "radio/src/vario.cpp"
#include "radio/src/trainer_input.cpp"
#if defined(PCBTARANIS)
#include "radio/src/bmp.cpp"
@@ -231,7 +233,7 @@ namespace NAMESPACE {
#include "radio/src/targets/taranis/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/taranis/trainer_driver.cpp"
#include "radio/src/targets/taranis/uart3_driver.cpp"
#include "radio/src/targets/taranis/serial2_driver.cpp"
#elif defined(PCBSKY9X)
#include "radio/src/targets/sky9x/board_sky9x.cpp"
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
@@ -242,7 +244,7 @@ namespace NAMESPACE {
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
#include "radio/src/targets/sky9x/coproc_driver.cpp"
#include "radio/src/targets/sky9x/haptic_driver.cpp"
#include "radio/src/targets/sky9x/second_serial_driver.cpp"
#include "radio/src/targets/sky9x/serial2_driver.cpp"
#include "radio/src/targets/sky9x/pulses_driver.cpp"
#elif defined(PCBGRUVIN9X)
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
@@ -35,6 +35,10 @@
#define FLAVOUR "9xrpro"
#define NAMESPACE Sky9xPro
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X) && defined(AR9X)
#define FLAVOUR "ar9x"
#define NAMESPACE Ar9x
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X)
#define FLAVOUR "sky9x"
#define NAMESPACE Sky9X
+1 -1
View File
@@ -62,7 +62,7 @@ Th9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
// result.lightSw = th9xToSwitch(lightSw);
result.trainer = trainer;
result.view = view;
+1 -1
View File
@@ -64,7 +64,7 @@ PACK(typedef struct t_Th9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Th9xTrainerData trainer;
uint8_t adcFilt:2;
@@ -130,24 +130,24 @@ int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant,
return 0;
}
int Th9xInterface::getSize(ModelData &model)
int Th9xInterface::getSize(const ModelData & model)
{
return 0;
}
int Th9xInterface::getSize(GeneralSettings &settings)
int Th9xInterface::getSize(const GeneralSettings & settings)
{
return 0;
}
int Th9xInterface::isAvailable(Protocol proto, int port)
int Th9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PPM:
case SILV_A:
case SILV_B:
case SILV_C:
case CTP1009:
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
return 1;
default:
return 0;
+3 -3
View File
@@ -42,11 +42,11 @@ class Th9xInterface : public EEPROMInterface
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(ModelData &);
virtual int getSize(const ModelData &);
virtual int getSize(GeneralSettings &);
virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
+7 -7
View File
@@ -2,13 +2,13 @@
#include "ui_flasheepromdialog.h"
#include "eeprominterface.h"
#include "helpers.h"
#include "splashlibrary.h"
#include "firmwareinterface.h"
#include "hexinterface.h"
#include "appdata.h"
#include "progressdialog.h"
#include "radiointerface.h"
#include "converteeprom.h"
#include "splashlibrarydialog.h"
FlashEEpromDialog::FlashEEpromDialog(QWidget *parent, const QString &filename):
QDialog(parent),
@@ -102,7 +102,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
return -1;
}
QByteArray eeprom(EESIZE_RLC_MAX, 0);
QByteArray eeprom(EESIZE_MAX, 0);
int fileType = getFileType(filename);
#if 0
@@ -144,7 +144,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
return -1;
}
}
eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_RLC_MAX);
eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_MAX);
}
else if (fileType==FILE_TYPE_BIN) { //read binary
eeprom_size = file.size();
@@ -175,8 +175,8 @@ bool FlashEEpromDialog::patchCalibration()
QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t txVoltageCalibration=(int8_t) g.profile[g.id()].txVoltageCalibration();
int8_t txCurrentCalibration=(int8_t) g.profile[g.id()].txCurrentCalibration();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
@@ -204,8 +204,8 @@ bool FlashEEpromDialog::patchCalibration()
radioData->generalSettings.trainer.calib[i] = byte16;
}
}
radioData->generalSettings.currentCalib = currentCalib;
radioData->generalSettings.vBatCalib = vBatCalib;
radioData->generalSettings.txCurrentCalibration = txCurrentCalibration;
radioData->generalSettings.txVoltageCalibration = txVoltageCalibration;
radioData->generalSettings.PPM_Multiplier = PPM_Multiplier;
return true;
}
+3 -2
View File
@@ -9,8 +9,8 @@
#include "hexinterface.h"
#include "progressdialog.h"
#include "radiointerface.h"
#include "splashlibrary.h"
#include "progresswidget.h"
#include "splashlibrarydialog.h"
#if defined WIN32 || !defined __GNUC__
#include <windows.h>
@@ -185,7 +185,7 @@ void FlashFirmwareDialog::on_useExternalSplash_clicked()
void FlashFirmwareDialog::on_useLibrarySplash_clicked()
{
QString fileName;
splashLibrary *ld = new splashLibrary(this, &fileName);
SplashLibraryDialog *ld = new SplashLibraryDialog(this, &fileName);
ld->exec();
if (!fileName.isEmpty()) {
QImage image(fileName);
@@ -203,6 +203,7 @@ void FlashFirmwareDialog::on_useLibrarySplash_clicked()
void FlashFirmwareDialog::on_burnButton_clicked()
{
g.flashDir(QFileInfo(fwName).dir().absolutePath());
g.profile[g.id()].fwName(fwName);
g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked());
g.backupOnFlash(ui->backupEEprom->isChecked());
+13 -6
View File
@@ -159,6 +159,11 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
ui->serialPortLabel->hide();
}
if (!IS_SKY9X(firmware->getBoard())) {
ui->txCurrentCalibration->hide();
ui->txCurrentCalibrationLabel->hide();
}
if (IS_TARANIS_X9E(firmware->getBoard())) {
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
@@ -170,6 +175,8 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
}
disableMouseScrolling();
setValues();
}
CalibrationPanel::~CalibrationPanel()
@@ -212,9 +219,9 @@ void CalibrationPanel::on_PPM4_editingFinished()
}
void CalibrationPanel::on_CurrentCalib_SB_editingFinished()
void CalibrationPanel::on_txCurrentCalibration_editingFinished()
{
generalSettings.currentCalib = ui->CurrentCalib_SB->value();
generalSettings.txCurrentCalibration = ui->txCurrentCalibration->value();
emit modified();
}
@@ -226,8 +233,8 @@ void CalibrationPanel::on_bluetoothEnable_stateChanged(int)
void CalibrationPanel::setValues()
{
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)generalSettings.currentCalib);
ui->txVoltageCalibration->setValue((double)generalSettings.txVoltageCalibration/10);
ui->txCurrentCalibration->setValue((double)generalSettings.txCurrentCalibration);
ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]);
ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]);
@@ -263,9 +270,9 @@ void CalibrationPanel::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10);
}
void CalibrationPanel::on_battCalibDSB_editingFinished()
void CalibrationPanel::on_txVoltageCalibration_editingFinished()
{
generalSettings.vBatCalib = ui->battCalibDSB->value()*10;
generalSettings.txVoltageCalibration = ui->txVoltageCalibration->value()*10;
emit modified();
}
+2 -2
View File
@@ -21,14 +21,14 @@ class CalibrationPanel : public GeneralPanel
// virtual void update();
private slots:
void on_battCalibDSB_editingFinished();
void on_txVoltageCalibration_editingFinished();
void on_PPM1_editingFinished();
void on_PPM2_editingFinished();
void on_PPM3_editingFinished();
void on_PPM4_editingFinished();
void on_PPM_MultiplierDSB_editingFinished();
void on_CurrentCalib_SB_editingFinished();
void on_txCurrentCalibration_editingFinished();
void on_bluetoothEnable_stateChanged(int);
void on_ana1Neg_editingFinished();
+7 -7
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>805</width>
<height>1269</height>
<height>1313</height>
</rect>
</property>
<property name="windowTitle">
@@ -562,14 +562,14 @@
</widget>
</item>
<item row="42" column="0">
<widget class="QLabel" name="label_22">
<widget class="QLabel" name="txVoltageCalibrationLabel">
<property name="text">
<string>Battery</string>
<string>Battery Offset</string>
</property>
</widget>
</item>
<item row="42" column="1">
<widget class="QDoubleSpinBox" name="battCalibDSB">
<widget class="QDoubleSpinBox" name="txVoltageCalibration">
<property name="statusTip">
<string/>
</property>
@@ -674,7 +674,7 @@
</widget>
</item>
<item row="43" column="1">
<widget class="QSpinBox" name="CurrentCalib_SB">
<widget class="QSpinBox" name="txCurrentCalibration">
<property name="minimum">
<number>-49</number>
</property>
@@ -698,9 +698,9 @@
</widget>
</item>
<item row="43" column="0">
<widget class="QLabel" name="label_CurrentCalib">
<widget class="QLabel" name="txCurrentCalibrationLabel">
<property name="text">
<string>Current</string>
<string>Current Offset</string>
</property>
</widget>
</item>
+6 -6
View File
@@ -88,8 +88,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
}
else {
QString trainercalib = g.profile[profile_id].trainerCalib();
int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib();
int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib();
int8_t txVoltageCalibration = (int8_t)g.profile[profile_id].txVoltageCalibration();
int8_t txCurrentCalibration = (int8_t)g.profile[profile_id].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
@@ -123,8 +123,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
if (ok)
generalSettings.trainer.calib[i]=byte16;
}
generalSettings.currentCalib=currentCalib;
generalSettings.vBatCalib=vBatCalib;
generalSettings.txCurrentCalibration=txCurrentCalibration;
generalSettings.txVoltageCalibration=txVoltageCalibration;
generalSettings.vBatWarn=vBatWarn;
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin();
@@ -225,8 +225,8 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0')));
}
g.profile[profile_id].trainerCalib( calib );
g.profile[profile_id].vBatCalib( generalSettings.vBatCalib );
g.profile[profile_id].currentCalib( generalSettings.currentCalib );
g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
g.profile[profile_id].vBatMin( generalSettings.vBatMin );
+68 -188
View File
@@ -47,44 +47,6 @@ const QColor colors[C9X_MAX_CURVES] = {
QColor(255,127,0),
};
QString getPhaseName(int val, const char * phasename)
{
if (!val) return "---";
if (!phasename) {
return QString(val < 0 ? "!" : "") + QObject::tr("FM%1").arg(abs(val) - 1);
}
else {
QString phaseName;
phaseName.append(phasename);
if (phaseName.isEmpty()) {
return QString(val < 0 ? "!" : "") + QObject::tr("FM%1").arg(abs(val) - 1);
}
else {
return QString(val < 0 ? "!" : "") + phaseName;
}
}
}
QString getInputStr(ModelData * model, int index)
{
QString result;
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
if (strlen(model->inputNames[index]) > 0) {
result = QObject::tr("[I%1]").arg(index+1);
result += QString(model->inputNames[index]);
}
else {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
}
}
else {
result = RawSource(SOURCE_TYPE_STICK, index).toString(model);
}
return result;
}
void populateGvSourceCB(QComboBox *b, int value)
{
QString strings[] = { QObject::tr("---"), QObject::tr("Rud Trim"), QObject::tr("Ele Trim"), QObject::tr("Thr Trim"), QObject::tr("Ail Trim"), QObject::tr("Rot Enc"), QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
@@ -95,18 +57,35 @@ void populateGvSourceCB(QComboBox *b, int value)
b->setCurrentIndex(value);
}
QString getProtocolStr(const int proto)
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current)
{
static const char *strings[] = { "OFF",
"PPM",
"Silverlit A", "Silverlit B", "Silverlit C",
"CTP1009",
"LP45", "DSM2", "DSMX",
"PPM16", "PPMsim",
"FrSky XJT - D16", "FrSky XJT - D8", "FrSky XJT - LR12", "FrSky DJT",
};
b->clear();
b->addItem("----");
return CHECK_IN_ARRAY(strings, proto);
bool added = false;
// Convert set into list and sort it alphabetically case insensitive
QStringList list = QStringList::fromSet(set);
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
foreach (QString entry, list) {
b->addItem(entry);
if (entry == current) {
b->setCurrentIndex(b->count()-1);
added = true;
}
}
if (!added && !current.isEmpty()) {
b->addItem(current);
b->setCurrentIndex(b->count()-1);
}
}
void getFileComboBoxValue(QComboBox * b, char * dest, int length)
{
memset(dest, 0, length+1);
if (b->currentText() != "----") {
strncpy(dest, b->currentText().toAscii(), length);
}
}
void populatePhasesCB(QComboBox *b, int value)
@@ -638,7 +617,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
if (model->sensorData[i].isAvailable()) {
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
for (int j=0; j<3; ++j) {
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
b->addItem(item.toString(model), item.toValue());
@@ -650,8 +629,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
}
else {
for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) {
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
continue;
if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime))
continue;
if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry))
@@ -763,134 +740,6 @@ QString getFrSkySrc(int index)
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
}
QString getTrimInc(ModelData * g_model)
{
switch (g_model->trimInc) {
case -2:
return QObject::tr("Exponential");
case -1:
return QObject::tr("Extra Fine");
case 0:
return QObject::tr("Fine");
case 1:
return QObject::tr("Medium");
case 2:
return QObject::tr("Coarse");
default:
return QObject::tr("Unknown");
}
}
QString getTimerStr(TimerData & timer)
{
QString result = QObject::tr("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
result += QString(", ") + timer.mode.toString();
if (timer.persistent)
result += QObject::tr(", Persistent");
if (timer.minuteBeep)
result += QObject::tr(", MinuteBeep");
if (timer.countdownBeep == 1)
result += QObject::tr(", CountDown(Beeps)");
else if (timer.countdownBeep == 2)
result += QObject::tr(", CountDown(Voice)");
return result;
}
QString getProtocol(ModuleData & module)
{
QString str = getProtocolStr(module.protocol);
if (module.protocol == PPM)
str.append(QObject::tr(": Channel start: %1, %2 Channels, %3usec Delay, Pulse polarity %4").arg(module.channelsStart+1).arg(module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString()));
else
str.append(QObject::tr(": Channel start: %1, %2 Channels").arg(module.channelsStart+1).arg(module.channelsCount));
return str;
}
QString getTrainerMode(const int trainermode, ModuleData & module)
{
QString result;
switch (trainermode) {
case 1:
result=QObject::tr("Slave/Jack")+QObject::tr(": Channel start: %1, %2 Channels, %3usec Delay, Pulse polarity %4").arg(module.channelsStart+1).arg(module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
break;
case 2:
result=QObject::tr("Master/SBUS Module");
break;
case 3:
result=QObject::tr("Master/CPPM Module");
break;
case 4:
result=QObject::tr("Master/SBUS in battery compartment");
break;
default:
result=QObject::tr("Master/Jack");
}
return result;
}
QString getPhasesStr(unsigned int phases, ModelData * model)
{
int numphases = GetCurrentFirmware()->getCapability(FlightModes);
if (numphases && phases) {
QString str;
int count = 0;
if (phases == (unsigned int)(1<<numphases) - 1) {
str = QObject::tr("None");
}
if (phases) {
for (int i=0; i<numphases;i++) {
if (!(phases & (1<<i))) {
if (count++ > 0) str += QString(", ");
str += getPhaseName(i+1, model->flightModeData[i].name);
}
}
}
if (count > 1)
return QObject::tr("Flight modes(%1)").arg(str);
else
return QObject::tr("Flight mode(%1)").arg(str);
}
else {
return "";
}
}
QString getCenterBeepStr(ModelData * g_model)
{
QStringList strl;
if (g_model->beepANACenter & 0x01)
strl << QObject::tr("Rudder");
if (g_model->beepANACenter & 0x02)
strl << QObject::tr("Elevator");
if (g_model->beepANACenter & 0x04)
strl << QObject::tr("Throttle");
if (g_model->beepANACenter & 0x08)
strl << QObject::tr("Aileron");
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
if (g_model->beepANACenter & 0x10)
strl << "S1";
if (g_model->beepANACenter & 0x20)
strl << "S2";
if (g_model->beepANACenter & 0x40)
strl << "S3";
if (g_model->beepANACenter & 0x80)
strl << "LS";
if (g_model->beepANACenter & 0x100)
strl << "RS";
}
else {
if (g_model->beepANACenter & 0x10)
strl << "P1";
if (g_model->beepANACenter & 0x20)
strl << "P2";
if (g_model->beepANACenter & 0x40)
strl << "P3";
}
return strl.join(", ");
}
QString getTheme()
{
int theme_set = g.theme();
@@ -988,22 +837,38 @@ QPixmap makePixMap( QImage image, QString firmwareType )
return(QPixmap::fromImage(image));
}
int version2index(QString version)
int version2index(const QString & version)
{
QStringList parts = version.split('.');
int result = 0;
if (parts.size() > 2)
result = parts[2].toInt();
int result = 999;
QStringList parts = version.split("N");
if (parts.size() > 1)
result += 100 * parts[1].toInt();
result = parts[1].toInt(); // nightly build
parts = parts[0].split('.');
if (parts.size() > 2)
result += 1000 * parts[2].toInt();
if (parts.size() > 1)
result += 100000 * parts[1].toInt();
if (parts.size() > 0)
result += 10000 * parts[0].toInt();
result += 10000000 * parts[0].toInt();
return result;
}
QString index2version(int index)
{
if (index >= 19900) {
if (index >= 19900000) {
int nightly = index % 1000;
index /= 1000;
int revision = index % 100;
index /= 100;
int minor = index % 100;
int major = index / 100;
QString result = QString("%1.%2.%3").arg(major).arg(minor).arg(revision);
if (nightly > 0 && nightly < 999) {
result += QString("N%1").arg(nightly);
}
return result;
}
else if (index >= 19900) {
int revision = index % 100;
index /= 100;
int minor = index % 100;
@@ -1021,7 +886,7 @@ int qunlink(const QString & fileName)
return unlink(ba.constData());
}
QString generateProcessUniqueTempFileName(const QString &fileName)
QString generateProcessUniqueTempFileName(const QString & fileName)
{
QString sanitizedFileName = fileName;
sanitizedFileName.remove('/');
@@ -1115,3 +980,18 @@ double toDecimalCoordinate(const QString & value)
}
return result;
}
QStringList extractLatLon(const QString & position)
{
QStringList result;
QStringList parts = position.split(' ');
if (parts.size() != 2) {
result.append("");
result.append("");
}
else {
result.append(parts.at(1).trimmed());
result.append(parts.at(0).trimmed());
}
return result;
}
+4 -11
View File
@@ -26,6 +26,8 @@ extern const QColor colors[C9X_MAX_CURVES];
#define TRIM_MODE_NONE 0x1F // 0b11111
void populateGvSourceCB(QComboBox *b, int value);
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current);
void getFileComboBoxValue(QComboBox * b, char * dest, int length);
void populateRotEncCB(QComboBox *b, int value, int renumber);
QString getTheme();
@@ -98,8 +100,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData * model);
#define POPULATE_NONE (1<<0)
#define POPULATE_SOURCES (1<<1)
@@ -117,17 +117,9 @@ QString getPhasesStr(unsigned int phases, ModelData * model);
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
void populateGVCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, const RawSource &source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags);
QString getPhaseName(int val, const char * phasename=NULL);
QString getInputStr(ModelData * model, int index);
QString image2qstring(QImage image);
int findmult(float value, float base);
QString getTrimInc(ModelData * g_model);
QString getTimerStr(TimerData & timer);
QString getProtocol(ModuleData & module);
QString getTrainerMode(const int trainermode, ModuleData & module);
QString getCenterBeepStr(ModelData * g_model);
/* FrSky helpers */
QString getFrSkyAlarmType(int alarm);
QString getFrSkyUnits(int units);
@@ -160,7 +152,7 @@ QVector<T> findWidgets(QObject * object, const QString & name)
// Format a pixmap to fit on the radio using a specific firmware
QPixmap makePixMap( QImage image, QString firmwareType );
int version2index(QString version);
int version2index(const QString & version);
QString index2version(int index);
class QTimeS : public QTime
@@ -207,5 +199,6 @@ private:
};
double toDecimalCoordinate(const QString & value);
QStringList extractLatLon(const QString & position);
#endif // HELPERS_H
+1
View File
@@ -0,0 +1 @@
*/*.directory
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

+2 -2
View File
@@ -344,7 +344,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QToolButton" name="splashLibraryButton">
<widget class="QToolButton" name="SplashLibraryDialogButton">
<property name="text">
<string>...</string>
</property>
@@ -455,7 +455,7 @@
<tabstop>splashincludeCB</tabstop>
<tabstop>SplashFileName</tabstop>
<tabstop>SplashSelect</tabstop>
<tabstop>splashLibraryButton</tabstop>
<tabstop>SplashLibraryDialogButton</tabstop>
<tabstop>clearImageButton</tabstop>
<tabstop>InvertPixels</tabstop>
<tabstop>buttonBox</tabstop>
+89 -99
View File
@@ -8,14 +8,14 @@
#include <unistd.h>
#endif
logsDialog::logsDialog(QWidget *parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::logsDialog)
LogsDialog::LogsDialog(QWidget *parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui(new Ui::LogsDialog)
{
csvlog.clear();
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("logs.png"));
setWindowIcon(CompanionIcon("logs.png"));
plotLock=false;
@@ -36,26 +36,20 @@ logsDialog::logsDialog(QWidget *parent) :
// create and prepare a plot title layout element
QCPPlotTitle *title = new QCPPlotTitle(ui->customPlot);
title->setText(tr("Telemetry logs"));
// title->setFont(QFont("sans", 12, QFont::Bold));
// add it to the main plot layout
ui->customPlot->plotLayout()->insertRow(0);
ui->customPlot->plotLayout()->addElement(0, 0, title);
ui->customPlot->setNoAntialiasingOnDrag(true);
ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom |
QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables);
ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables);
axisRect = ui->customPlot->axisRect();
axisRect->axis(QCPAxis::atBottom)->setLabel(tr("Time (hh:mm:ss)"));
axisRect->axis(QCPAxis::atBottom)->setTickLabelType(QCPAxis::ltDateTime);
axisRect->axis(QCPAxis::atBottom)->setDateTimeFormat("hh:mm:ss");
QDateTime now = QDateTime::currentDateTime();
axisRect->axis(QCPAxis::atBottom)->setRange(now.addSecs(-60*60*2).toTime_t(),
now.toTime_t());
axisRect->axis(QCPAxis::atBottom)->setRange(now.addSecs(-60*60*2).toTime_t(), now.toTime_t());
axisRect->axis(QCPAxis::atLeft)->setTickLabels(false);
axisRect->addAxis(QCPAxis::atLeft);
axisRect->addAxis(QCPAxis::atRight);
axisRect->axis(QCPAxis::atLeft, 1)->setVisible(false);
@@ -76,8 +70,8 @@ logsDialog::logsDialog(QWidget *parent) :
ui->customPlot->setAutoAddPlottableToLegend(false);
QString Path=g.gePath();
if (Path.isEmpty() || !QFile(Path).exists()) {
QString path = g.gePath();
if (path.isEmpty() || !QFile(path).exists()) {
ui->mapsButton->hide();
}
@@ -99,57 +93,52 @@ logsDialog::logsDialog(QWidget *parent) :
connect(ui->Reset_PB, SIGNAL(clicked()), this, SLOT(plotLogs()));
}
logsDialog::~logsDialog()
LogsDialog::~LogsDialog()
{
delete ui;
}
void logsDialog::titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title)
void LogsDialog::titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title)
{
// Set the plot title by double clicking on it
bool ok;
QString newTitle = QInputDialog::getText(this, tr("Plot Title Change"),
tr("New plot title:"), QLineEdit::Normal, title->text(), &ok);
if (ok)
{
QString newTitle = QInputDialog::getText(this, tr("Plot Title Change"), tr("New plot title:"), QLineEdit::Normal, title->text(), &ok);
if (ok) {
title->setText(newTitle);
ui->customPlot->replot();
}
}
void logsDialog::axisLabelDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part)
void LogsDialog::axisLabelDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part)
{
// Set an axis label by double clicking on it
if (part == QCPAxis::spAxisLabel) // only react when the actual axis label is clicked, not tick label or axis backbone
{
if (part == QCPAxis::spAxisLabel) {
// only react when the actual axis label is clicked, not tick label or axis backbone
bool ok;
QString newLabel = QInputDialog::getText(this, tr("Axis Label Change"), tr("New axis label:"), QLineEdit::Normal, axis->label(), &ok);
if (ok)
{
if (ok) {
axis->setLabel(newLabel);
ui->customPlot->replot();
}
}
}
void logsDialog::legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item)
void LogsDialog::legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item)
{
// Rename a graph by double clicking on its legend item
if (item) // only react if item was clicked (user could have clicked on border padding of legend where there is no item, then item is 0)
{
if (item) {
// only react if item was clicked (user could have clicked on border padding of legend where there is no item, then item is 0)
QCPPlottableLegendItem *plItem = qobject_cast<QCPPlottableLegendItem*>(item);
bool ok;
QString newName = QInputDialog::getText(this, tr("Graph Name Change"), tr("New graph name:"), QLineEdit::Normal, plItem->plottable()->name(), &ok);
if (ok)
{
if (ok) {
plItem->plottable()->setName(newName);
ui->customPlot->replot();
}
}
}
void logsDialog::selectionChanged()
void LogsDialog::selectionChanged()
{
/*
normally, axis base line, axis tick labels and axis labels are selectable separately, but we want
@@ -208,20 +197,18 @@ void logsDialog::selectionChanged()
}
// synchronize selection of graphs with selection of corresponding legend items:
for (int i=0; i<ui->customPlot->graphCount(); ++i)
{
for (int i=0; i<ui->customPlot->graphCount(); ++i) {
QCPGraph *graph = ui->customPlot->graph(i);
QCPPlottableLegendItem *item = ui->customPlot->legend->itemWithPlottable(graph);
if (item == NULL) item = rightLegend->itemWithPlottable(graph);
if (item->selected() || graph->selected())
{
if (item->selected() || graph->selected()) {
item->setSelected(true);
graph->setSelected(true);
}
}
}
QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
QList<QStringList> LogsDialog::filterGePoints(const QList<QStringList> & input)
{
QList<QStringList> result;
@@ -230,17 +217,16 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
return result;
}
int latcol=0, longcol=0;
int gpscol = 0;
for (int i=1; i<input.at(0).count(); i++) {
//Long,Lat,Course,GPS Speed,GPS Alt
if (input.at(0).at(i).contains("Long")) {
longcol=i;
}
if (input.at(0).at(i).contains("Lat")) {
latcol=i;
if (input.at(0).at(i) == "GPS") {
gpscol=i;
}
}
if (longcol==0 || latcol==0) {
if (gpscol == 0) {
QMessageBox::critical(this, tr("Error: no GPS data not found"),
tr("The column containing GPS coordinates must be named \"GPS\".\n\n\
The columns for altitude \"GAlt\" and for speed \"GSpd\" are optional"));
return result;
}
@@ -253,14 +239,15 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
for (int i = 1; i < n; i++) {
if ((ui->logTable->item(i-1, 1)->isSelected() && rangeSelected) || !rangeSelected) {
QString latitude = input.at(i).at(latcol).trimmed();
QString longitude = input.at(i).at(longcol).trimmed();
QStringList latlon = extractLatLon(input.at(i).at(gpscol));
QString latitude = latlon[0];
QString longitude = latlon[1];
double flatitude = toDecimalCoordinate(latitude);
double flongitude = toDecimalCoordinate(longitude);
// glitch filter
if ( glitchFilter.isGlitch(flatitude, flongitude) ) {
qDebug() << "filterGePoints(): GPS glitch detected at" << i << flatitude << flongitude;
// qDebug() << "filterGePoints(): GPS glitch detected at" << i << flatitude << flongitude;
continue;
}
@@ -275,42 +262,39 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
}
}
qDebug() << "filterGePoints(): filtered from" << input.count() << "to " << result.count() << "points";
// qDebug() << "filterGePoints(): filtered from" << input.count() << "to " << result.count() << "points";
return result;
}
void logsDialog::exportToGoogleEarth()
void LogsDialog::exportToGoogleEarth()
{
// filter data points
QList<QStringList> dataPoints = filterGePoints(csvlog);
int n = dataPoints.count(); // number of points to export
if (n==0) return;
int latcol=0, longcol=0, altcol=0, speedcol=0;
int gpscol=0, altcol=0, speedcol=0;
QSet<int> nondataCols;
for (int i=1; i<dataPoints.at(0).count(); i++) {
//Long,Lat,Course,GPS Speed,GPS Alt
if (dataPoints.at(0).at(i).contains("Long")) {
longcol=i;
// Long,Lat,Course,GPS Speed,GPS Alt
if (dataPoints.at(0).at(i) == "GPS") {
gpscol=i;
}
if (dataPoints.at(0).at(i).contains("GAlt")) {
altcol = i;
nondataCols << i;
}
if (dataPoints.at(0).at(i).contains("Lat")) {
latcol=i;
nondataCols << i;
}
if (dataPoints.at(0).at(i).contains("GPS Alt")) {
altcol=i;
nondataCols << i;
}
if (dataPoints.at(0).at(i).contains("GPS Speed")) {
speedcol=i;
if (dataPoints.at(0).at(i).contains("GSpd")) {
speedcol = i;
nondataCols << i;
}
}
if (longcol==0 || latcol==0 || altcol==0) {
if (gpscol==0 ) {
return;
}
// qDebug() << "gpscol" << gpscol << "altcol" << altcol << "speedcol" << speedcol;
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
if (QFile::exists(geIconFilename)) {
QFile::remove(geIconFilename);
@@ -375,22 +359,26 @@ void logsDialog::exportToGoogleEarth()
// coordinate data points
for (int i=1; i<n; i++) {
QString latitude=dataPoints.at(i).at(latcol).trimmed();
QString longitude=dataPoints.at(i).at(longcol).trimmed();
QStringList latlon = extractLatLon(dataPoints.at(i).at(gpscol));
QString latitude = latlon[0];
QString longitude = latlon[1];
int altitude = altcol ? dataPoints.at(i).at(altcol).toFloat() : 0;
latitude.sprintf("%3.8f", toDecimalCoordinate(latitude));
longitude.sprintf("%3.8f", toDecimalCoordinate(longitude));
outputStream << "\t\t\t\t\t<gx:coord>" << longitude << " " << latitude << " " << dataPoints.at(i).at(altcol).toFloat() << " </gx:coord>\n" ;
outputStream << "\t\t\t\t\t<gx:coord>" << longitude << " " << latitude << " " << altitude << " </gx:coord>\n" ;
}
// additional data for data points
outputStream << "\t\t\t\t\t<ExtendedData>\n\t\t\t\t\t\t<SchemaData schemaUrl=\"#schema\">\n";
// gps speed data points
outputStream << "\t\t\t\t\t\t\t<gx:SimpleArrayData name=\"GPSSpeed\">\n";
for (int i=1; i<n; i++) {
outputStream << "\t\t\t\t\t\t\t\t<gx:value>"<< dataPoints.at(i).at(speedcol) <<"</gx:value>\n";
if (speedcol) {
// gps speed data points
outputStream << "\t\t\t\t\t\t\t<gx:SimpleArrayData name=\"GPSSpeed\">\n";
for (int i=1; i<n; i++) {
outputStream << "\t\t\t\t\t\t\t\t<gx:value>"<< dataPoints.at(i).at(speedcol) <<"</gx:value>\n";
}
outputStream << "\t\t\t\t\t\t\t</gx:SimpleArrayData>\n";
}
outputStream << "\t\t\t\t\t\t\t</gx:SimpleArrayData>\n";
// add values for additional fields
for (int i=0; i<dataPoints.at(0).count()-2; i++) {
@@ -420,7 +408,7 @@ void logsDialog::exportToGoogleEarth()
process->start(gePath, parameters);
}
void logsDialog::on_mapsButton_clicked()
void LogsDialog::on_mapsButton_clicked()
{
ui->FieldsTW->setDisabled(true);
ui->logTable->setDisabled(true);
@@ -431,7 +419,7 @@ void logsDialog::on_mapsButton_clicked()
ui->logTable->setDisabled(false);
}
void logsDialog::mousePress()
void LogsDialog::mousePress()
{
// if an axis is selected, only allow the direction of that axis to be dragged
// if no axis is selected, both directions may be dragged
@@ -444,7 +432,7 @@ void logsDialog::mousePress()
axisRect->setRangeDrag(Qt::Horizontal | Qt::Vertical);
}
void logsDialog::mouseWheel()
void LogsDialog::mouseWheel()
{
// if an axis is selected, only allow the direction of that axis to be zoomed
// if no axis is selected, both directions may be zoomed
@@ -462,7 +450,7 @@ void logsDialog::mouseWheel()
}
}
void logsDialog::removeAllGraphs()
void LogsDialog::removeAllGraphs()
{
ui->customPlot->clearGraphs();
ui->customPlot->legend->setVisible(false);
@@ -480,12 +468,11 @@ void logsDialog::removeAllGraphs()
ui->customPlot->replot();
}
void logsDialog::on_fileOpen_BT_clicked()
void LogsDialog::on_fileOpen_BT_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this,tr("Select your log file"), g.logDir());
QString fileName = QFileDialog::getOpenFileName(this, tr("Select your log file"), g.logDir());
if (!fileName.isEmpty()) {
g.logDir( fileName );
g.logDir(fileName);
ui->FileName_LE->setText(fileName);
if (cvsFileParse()) {
ui->FieldsTW->clear();
@@ -525,15 +512,16 @@ void logsDialog::on_fileOpen_BT_clicked()
}
}
bool logsDialog::cvsFileParse()
bool LogsDialog::cvsFileParse()
{
QFile file(ui->FileName_LE->text());
int errors=0;
int lines=-1;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
return false;
} else {
}
else {
csvlog.clear();
logFilename.clear();
QTextStream inputStream(&file);
@@ -541,7 +529,8 @@ bool logsDialog::cvsFileParse()
if (buffer.startsWith("Date,Time")) {
file.reset();
} else {
}
else {
return false;
}
@@ -554,29 +543,30 @@ bool logsDialog::cvsFileParse()
}
if (columns.count()==numfields) {
csvlog.append(columns);
} else {
}
else {
errors++;
}
lines++;
}
logFilename=QFileInfo(file.fileName()).baseName();
logFilename = QFileInfo(file.fileName()).baseName();
}
file.close();
if (errors>1) {
if (errors > 1) {
QMessageBox::warning(this, "Companion", tr("The selected logfile contains %1 invalid lines out of %2 total lines").arg(errors).arg(lines));
}
int n=csvlog.count();
if (n==1) {
int n = csvlog.count();
if (n == 1) {
csvlog.clear();
return false;
}
plotLock = true;
setFlightSessions();
plotLock=false;
plotLock = false;
return true;
}
@@ -586,7 +576,7 @@ struct FlightSession {
QDateTime end;
};
QDateTime logsDialog::getRecordTimeStamp(int index)
QDateTime LogsDialog::getRecordTimeStamp(int index)
{
QString tstamp = csvlog.at(index).at(0) + " " + csvlog.at(index).at(1);
if (csvlog.at(index).at(1).contains("."))
@@ -594,7 +584,7 @@ QDateTime logsDialog::getRecordTimeStamp(int index)
return QDateTime::fromString(tstamp, "yyyy-MM-dd HH:mm:ss");
}
QString logsDialog::generateDuration(const QDateTime & start, const QDateTime & end)
QString LogsDialog::generateDuration(const QDateTime & start, const QDateTime & end)
{
int secs = start.secsTo(end);
QString durationString;
@@ -606,11 +596,11 @@ QString logsDialog::generateDuration(const QDateTime & start, const QDateTime &
return durationString;
}
void logsDialog::setFlightSessions()
void LogsDialog::setFlightSessions()
{
ui->sessions_CB->clear();
int n=csvlog.count();
int n = csvlog.count();
// qDebug() << "records" << n;
// find session breaks
@@ -646,7 +636,7 @@ void logsDialog::setFlightSessions()
}
}
void logsDialog::on_sessions_CB_currentIndexChanged(int index)
void LogsDialog::on_sessions_CB_currentIndexChanged(int index)
{
if (plotLock) return;
plotLock = true;
@@ -674,7 +664,7 @@ void logsDialog::on_sessions_CB_currentIndexChanged(int index)
plotLogs();
}
void logsDialog::plotLogs()
void LogsDialog::plotLogs()
{
if (plotLock) return;
@@ -920,7 +910,7 @@ void logsDialog::plotLogs()
ui->customPlot->replot();
}
void logsDialog::yAxisChangeRanges(QCPRange range)
void LogsDialog::yAxisChangeRanges(QCPRange range)
{
if (axisRect->axis(QCPAxis::atRight)->visible()) {
double lowerChange = (range.lower - yAxesRanges[firstLeft].min) *
+8 -8
View File
@@ -1,5 +1,5 @@
#ifndef LOGSDIALOG_H
#define LOGSDIALOG_H
#ifndef _LOGSDIALOG_H_
#define _LOGSDIALOG_H_
#include <QtCore>
#include <QtGui>
@@ -37,16 +37,16 @@ struct plotsCollection {
};
namespace Ui {
class logsDialog;
class LogsDialog;
}
class logsDialog : public QDialog
class LogsDialog : public QDialog
{
Q_OBJECT
public:
explicit logsDialog(QWidget *parent = 0);
~logsDialog();
explicit LogsDialog(QWidget *parent = 0);
~LogsDialog();
private slots:
void titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title);
@@ -64,7 +64,7 @@ private slots:
private:
QList<QStringList> csvlog;
Ui::logsDialog *ui;
Ui::LogsDialog *ui;
QCPAxisRect *axisRect;
QCPLegend *rightLegend;
bool plotLock;
@@ -85,4 +85,4 @@ private:
};
#endif // LOGSDIALOG_H
#endif // _LOGSDIALOG_H_
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>logsDialog</class>
<widget class="QDialog" name="logsDialog">
<class>LogsDialog</class>
<widget class="QDialog" name="LogsDialog">
<property name="geometry">
<rect>
<x>0</x>
+85 -76
View File
@@ -70,15 +70,16 @@
#include "radiointerface.h"
#include "progressdialog.h"
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/nightly/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#ifdef __APPLE__
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-macosx.stamp"
#define C9X_INSTALLER "/companion-macosx-%1.dmg"
#define COMPANION_STAMP "companion-macosx.stamp"
#define COMPANION_INSTALLER "companion-macosx-%1.dmg"
#else
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-windows.stamp"
#define C9X_INSTALLER "/companion-windows-%1.exe"
#define COMPANION_STAMP "companion-windows.stamp"
#define COMPANION_INSTALLER "companion-windows-%1.exe"
#endif
#if defined WIN32 || !defined __GNUC__
@@ -123,7 +124,6 @@ MainWindow::MainWindow():
}
QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
updateSdsyncAction();
QStringList strl = QApplication::arguments();
QString str;
@@ -216,6 +216,15 @@ void MainWindow::dowloadLastFirmwareUpdate()
checkForUpdates();
}
QString MainWindow::getCompanionUpdateBaseUrl()
{
#if defined(ALLOW_NIGHTLY_BUILDS)
return g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS;
#else
return OPENTX_COMPANION_DOWNLOADS;
#endif
}
void MainWindow::checkForUpdates()
{
if (checkForUpdatesState & SHOW_DIALOG_WAIT) {
@@ -229,7 +238,7 @@ void MainWindow::checkForUpdates()
// TODO why create each time a network manager?
networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*)));
QNetworkRequest request(QUrl(C9X_STAMP));
QNetworkRequest request(QUrl(QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(COMPANION_STAMP)));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
networkManager->get(request);
}
@@ -290,13 +299,13 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
if (ret == QMessageBox::Yes) {
#if defined __APPLE__
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version));
#else
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version), tr("Executable (*.exe)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version), tr("Executable (*.exe)"));
#endif
if (!fileName.isEmpty()) {
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
installer_fileName = fileName;
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
dd->exec();
@@ -406,6 +415,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
QString currentVersionString = index2version(currentVersion);
QMessageBox msgBox;
msgBox.setWindowTitle("Companion");
QSpacerItem * horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout * layout = (QGridLayout*)msgBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
@@ -413,8 +423,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
if (currentVersion == 0) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(versionString));
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@@ -442,8 +451,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
else if (version > currentVersion) {
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@@ -453,8 +461,8 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
msgBox.resize(0,0);
msgBox.exec();
if( msgBox.clickedButton() == rnButton ) {
ContributorsDialog *cd = new ContributorsDialog(this); // , 2, rn);
cd->exec();
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(versionString),
QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
@@ -530,37 +538,22 @@ void MainWindow::closeEvent(QCloseEvent *event)
}
}
void MainWindow::setLanguage(QString langString)
void MainWindow::setLanguage(const QString & langString)
{
g.locale( langString );
QMessageBox msgBox;
msgBox.setText(tr("The selected language will be used the next time you start Companion."));
msgBox.setIcon(QMessageBox::Information);
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
msgBox.exec();
g.locale(langString);
QMessageBox::information(this, tr("Companion"), tr("The selected language will be used the next time you start Companion."));
}
void MainWindow::setTheme(int index)
{
g.theme( index );
QMessageBox msgBox;
msgBox.setText(tr("The new theme will be loaded the next time you start Companion."));
msgBox.setIcon(QMessageBox::Information);
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
msgBox.exec();
g.theme(index);
QMessageBox::information(this, tr("Companion"), tr("The new theme will be loaded the next time you start Companion."));
}
void MainWindow::setIconThemeSize(int index)
{
g.iconSize( index );
QMessageBox msgBox;
msgBox.setText(tr("The icon size will be used the next time you start Companion."));
msgBox.setIcon(QMessageBox::Information);
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
msgBox.exec();
g.iconSize(index);
QMessageBox::information(this, tr("Companion"), tr("The icon size will be used the next time you start Companion."));
}
void MainWindow::newFile()
@@ -674,41 +667,47 @@ void MainWindow::contributors()
void MainWindow::sdsync()
{
QString sdPath = g.profile[g.id()].sdPath();
if (sdPath.isEmpty()) {
QMessageBox::warning(this, QObject::tr("Synchronization error"), QObject::tr("No SD directory configured!"));
return;
}
QString massstoragePath = findMassstoragePath("SOUNDS");
if (massstoragePath.isEmpty()) {
QMessageBox::warning(this, QObject::tr("Synchronization error"), QObject::tr("No Radio connected!"));
return;
}
massstoragePath += "/..";
massstoragePath = massstoragePath.left(massstoragePath.length() - 7);
ProgressDialog progressDialog(this, tr("Synchronize SD"), CompanionIcon("sdsync.png"));
SyncProcess syncProcess(massstoragePath, g.profile[g.id()].sdPath(), progressDialog.progress());
syncProcess.run();
progressDialog.exec();
if (!syncProcess.run()) {
progressDialog.exec();
}
}
void MainWindow::changelog()
{
ReleaseNotesDialog * dialog = new ReleaseNotesDialog(this);
dialog->exec();
ReleaseNotesDialog * dialog = new ReleaseNotesDialog(this);
dialog->exec();
}
void MainWindow::fwchangelog()
{
Firmware *currfirm = GetCurrentFirmware();
QString rn=currfirm->getReleaseNotesUrl();
if (rn.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
}
else {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
dialog->exec();
}
Firmware * firmware = GetCurrentFirmware();
QString url = firmware->getReleaseNotesUrl();
if (url.isEmpty()) {
QMessageBox::information(this, tr("Firmware updates"), tr("Current firmware does not provide release notes informations."));
}
else {
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, url);
dialog->exec();
}
}
void MainWindow::customizeSplash()
{
customizeSplashDialog *cd = new customizeSplashDialog(this);
cd->exec();
customizeSplashDialog * dialog = new customizeSplashDialog(this);
dialog->exec();
}
void MainWindow::cut()
@@ -783,25 +782,41 @@ void MainWindow::readEeprom()
bool MainWindow::readFirmwareFromRadio(const QString &filename)
{
ProgressDialog progressDialog(this, tr("Read Firmware from Radio"), CompanionIcon("read_flash.png"));
return readFirmware(filename, progressDialog.progress());
bool result = readFirmware(filename, progressDialog.progress());
if (!result) {
progressDialog.exec();
}
return result;
}
bool MainWindow::writeFirmwareToRadio(const QString &filename)
{
ProgressDialog progressDialog(this, tr("Write Firmware to Radio"), CompanionIcon("write_flash.png"));
return writeFirmware(filename, progressDialog.progress());
bool result = writeFirmware(filename, progressDialog.progress());
if (!result) {
progressDialog.exec();
}
return result;
}
bool MainWindow::readEepromFromRadio(const QString &filename)
{
ProgressDialog progressDialog(this, tr("Read Models and Settings from Radio"), CompanionIcon("read_eeprom.png"));
return ::readEeprom(filename, progressDialog.progress());
bool result = ::readEeprom(filename, progressDialog.progress());
if (!result) {
progressDialog.exec();
}
return result;
}
bool MainWindow::writeEepromToRadio(const QString &filename)
{
ProgressDialog progressDialog(this, tr("Write Models and Settings to Radio"), CompanionIcon("write_eeprom.png"));
return ::writeEeprom(filename, progressDialog.progress());
bool result = ::writeEeprom(filename, progressDialog.progress());
if (!result) {
progressDialog.exec();
}
return result;
}
void MainWindow::writeBackup()
@@ -872,7 +887,7 @@ void MainWindow::compare()
void MainWindow::logFile()
{
logsDialog *fd = new logsDialog(this);
LogsDialog *fd = new LogsDialog(this);
fd->setWindowFlags(Qt::Window); //to show minimize an maximize buttons
fd->setAttribute(Qt::WA_DeleteOnClose, true);
fd->show();
@@ -897,12 +912,6 @@ void MainWindow::about()
msgBox.exec();
}
void MainWindow::updateSdsyncAction()
{
QTimer::singleShot(1000, this, SLOT(updateSdsyncAction()));
sdsyncAct->setEnabled(!findMassstoragePath("SOUNDS").isEmpty());
}
void MainWindow::updateMenus()
{
bool hasMdiChild = (activeMdiChild() != 0);
@@ -924,7 +933,7 @@ void MainWindow::updateMenus()
updateLanguageActions();
updateIconSizeActions();
updateIconThemeActions();
setWindowTitle(tr("OpenTX Companion 2.1 - FW: %1 - Profile: %2").arg(GetCurrentFirmware()->getName()).arg( g.profile[g.id()].name() ));
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(C9X_VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
}
MdiChild *MainWindow::createMdiChild()
@@ -1109,8 +1118,8 @@ void MainWindow::createMenus()
languageMenu->addAction(germanLangAct);
languageMenu->addAction(finnishLangAct);
languageMenu->addAction(frenchLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(italianLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(polishLangAct);
// languageMenu->addAction(portugueseLangAct);
languageMenu->addAction(spanishLangAct);
@@ -1357,20 +1366,20 @@ void MainWindow::updateLanguageActions()
frenchLangAct->setChecked(true);
else if (langId=="it_IT")
italianLangAct->setChecked(true);
else if (langId=="he_IL")
hebrewLangAct->setChecked(true);
// else if (langId=="he_IL")
// hebrewLangAct->setChecked(true);
else if (langId=="pl_PL")
polishLangAct->setChecked(true);
else if (langId=="pt_PT")
portugueseLangAct->setChecked(true);
else if (langId=="ru_RU")
russianLangAct->setChecked(true);
// else if (langId=="pt_PT")
// portugueseLangAct->setChecked(true);
else if (langId=="es_ES")
spanishLangAct->setChecked(true);
else if (langId=="sv_SE")
swedishLangAct->setChecked(true);
else if (langId=="nl_NL")
dutchLangAct->setChecked(true);
// else if (langId=="ru_RU")
// russianLangAct->setChecked(true);
// else if (langId=="nl_NL")
// dutchLangAct->setChecked(true);
}
void MainWindow::updateIconThemeActions()
+24 -22
View File
@@ -76,30 +76,31 @@ class MainWindow : public QMainWindow
MainWindow();
protected:
QString getCompanionUpdateBaseUrl();
void dowloadLastFirmwareUpdate();
void startFirmwareDownload();
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void setLanguage(const QString & langString);
private slots:
void openDocURL();
void setLanguage(QString langString);
void setSysLanguage() {setLanguage("");};
void setCZLanguage() {setLanguage("cs_CZ");};
void setDELanguage() {setLanguage("de_DE");};
void setENLanguage() {setLanguage("en");};
void setFILanguage() {setLanguage("fi_FI");};
void setFRLanguage() {setLanguage("fr_FR");};
void setITLanguage() {setLanguage("it_IT");};
void setHELanguage() {setLanguage("he_IL");};
void setPLLanguage() {setLanguage("pl_PL");};
void setESLanguage() {setLanguage("es_ES");};
void setPTLanguage() {setLanguage("pt_PT");};
void setRULanguage() {setLanguage("ru_RU");};
void setSELanguage() {setLanguage("sv_SE");};
void setNLLanguage() {setLanguage("nl_NL");};
void setSysLanguage() { setLanguage(""); };
void setCZLanguage() { setLanguage("cs_CZ"); };
void setDELanguage() { setLanguage("de_DE"); };
void setENLanguage() { setLanguage("en"); };
void setFILanguage() { setLanguage("fi_FI"); };
void setFRLanguage() { setLanguage("fr_FR"); };
void setITLanguage() { setLanguage("it_IT"); };
void setHELanguage() { setLanguage("he_IL"); };
void setPLLanguage() { setLanguage("pl_PL"); };
void setESLanguage() { setLanguage("es_ES"); };
void setPTLanguage() { setLanguage("pt_PT"); };
void setRULanguage() { setLanguage("ru_RU"); };
void setSELanguage() { setLanguage("sv_SE"); };
void setNLLanguage() { setLanguage("nl_NL"); };
void setTheme(int index);
void setClassicTheme() {setTheme(0);};
@@ -156,7 +157,6 @@ class MainWindow : public QMainWindow
void loadBackup();
void appPrefs();
void fwPrefs();
void updateSdsyncAction();
void updateMenus();
void createProfile();
MdiChild *createMdiChild();
@@ -262,20 +262,22 @@ class MainWindow : public QMainWindow
QAction *normalIconAct;
QAction *bigIconAct;
QAction *hugeIconAct;
QAction *sysLangAct;
QAction *englishLangAct;
QAction *czechLangAct;
QAction *germanLangAct;
QAction *frenchLangAct;
QAction *englishLangAct;
QAction *finnishLangAct;
QAction *frenchLangAct;
QAction *italianLangAct;
QAction *hebrewLangAct;
// QAction *hebrewLangAct;
QAction *polishLangAct;
// QAction *portugueseLangAct;
QAction *spanishLangAct;
QAction *portugueseLangAct;
QAction *swedishLangAct;
QAction *russianLangAct;
QAction *dutchLangAct;
// QAction *russianLangAct;
// QAction *dutchLangAct;
QAction *openDocURLAct;
};
+94 -89
View File
@@ -155,7 +155,7 @@ void MdiChild::on_SimulateTxButton_clicked()
void MdiChild::checkAndInitModel(int row)
{
ModelData &model = radioData.models[row - 1];
if (model.isempty()) {
if (model.isEmpty()) {
model.setDefaultValues(row - 1, radioData.generalSettings);
setModified();
}
@@ -170,7 +170,7 @@ void MdiChild::generalEdit()
void MdiChild::modelEdit()
{
int row = ui->modelsList->currentRow();
int row = getCurrentRow();
if (row == 0){
generalEdit();
@@ -189,7 +189,7 @@ void MdiChild::modelEdit()
void MdiChild::wizardEdit()
{
int row = ui->modelsList->currentRow();
int row = getCurrentRow();
if (row > 0) {
checkAndInitModel(row);
WizardDialog * wizard = new WizardDialog(radioData.generalSettings, row, this);
@@ -203,13 +203,13 @@ void MdiChild::wizardEdit()
void MdiChild::openEditWindow()
{
int row = ui->modelsList->currentRow();
int row = getCurrentRow();
if (row == 0){
generalEdit();
}
else{
ModelData &model = radioData.models[row - 1];
if (model.isempty() && g.useWizard()) {
if (model.isEmpty() && g.useWizard()) {
wizardEdit();
}
else {
@@ -282,8 +282,8 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
}
}
uint8_t eeprom[EESIZE_RLC_MAX];
int eeprom_size = HexInterface(inputStream).load(eeprom, EESIZE_RLC_MAX);
QByteArray eeprom(EESIZE_MAX, 0);
int eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_MAX);
if (!eeprom_size) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid EEPROM File %1")
@@ -294,7 +294,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
file.close();
if (!loadEEprom(radioData, eeprom, eeprom_size)) {
if (!loadEEprom(radioData, (uint8_t *)eeprom.data(), eeprom_size)) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid EEPROM File %1")
.arg(fileName));
@@ -388,32 +388,32 @@ bool MdiChild::saveAs(bool isNew)
bool MdiChild::saveFile(const QString &fileName, bool setCurrent)
{
QString myFile;
myFile = fileName;
if (IS_SKY9X(GetEepromInterface()->getBoard())) {
myFile.replace(".eepe", ".bin");
}
QFile file(myFile);
QString myFile;
myFile = fileName;
if (IS_SKY9X(GetEepromInterface()->getBoard())) {
myFile.replace(".eepe", ".bin");
}
QFile file(myFile);
int fileType = getFileType(myFile);
int fileType = getFileType(myFile);
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
int eeprom_size = 0;
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
int eeprom_size = 0;
if (fileType != FILE_TYPE_XML) {
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber(), 0/*last version*/);
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;
}
}
if (!file.open(fileType == FILE_TYPE_BIN ? QIODevice::WriteOnly : (QIODevice::WriteOnly | QIODevice::Text))) {
if (fileType != FILE_TYPE_XML) {
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber(), 0/*last version*/);
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;
}
}
QTextStream outputStream(&file);
if (!file.open(fileType == FILE_TYPE_BIN ? QIODevice::WriteOnly : (QIODevice::WriteOnly | QIODevice::Text))) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;
}
QTextStream outputStream(&file);
#if 0
if (fileType==FILE_TYPE_XML) {
@@ -425,34 +425,34 @@ bool MdiChild::saveFile(const QString &fileName, bool setCurrent)
}
else
#endif
if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { // write hex
if (fileType==FILE_TYPE_EEPE)
outputStream << EEPE_EEPROM_FILE_HEADER << "\n";
if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { // write hex
if (fileType==FILE_TYPE_EEPE)
outputStream << EEPE_EEPROM_FILE_HEADER << "\n";
if (!HexInterface(outputStream).save(eeprom, eeprom_size)) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
file.close();
return false;
}
}
else if (fileType==FILE_TYPE_BIN) // write binary
{
long result = file.write((char*)eeprom, eeprom_size);
if(result!=eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(myFile).arg(file.errorString()));
if (!HexInterface(outputStream).save(eeprom, eeprom_size)) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
file.close();
return false;
}
}
else {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(myFile).arg("Unknown format"));
}
else if (fileType==FILE_TYPE_BIN) // write binary
{
long result = file.write((char*)eeprom, eeprom_size);
if(result!=eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;
}
}
else {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(myFile).arg("Unknown format"));
return false;
}
free(eeprom); // TODO free in all cases ...
file.close();
if(setCurrent) setCurrentFile(myFile);
free(eeprom); // TODO free in all cases ...
file.close();
if(setCurrent) setCurrentFile(myFile);
return true;
return true;
}
QString MdiChild::userFriendlyCurrentFile()
@@ -529,8 +529,8 @@ void MdiChild::writeEeprom() // write to Tx
void MdiChild::simulate()
{
if (ui->modelsList->currentRow() >= 1) {
startSimulation(this, radioData, ui->modelsList->currentRow()-1);
if (getCurrentRow() > 0) {
startSimulation(this, radioData, getCurrentRow()-1);
}
}
@@ -539,10 +539,10 @@ void MdiChild::print(int model, QString filename)
PrintDialog * pd = NULL;
if (model>=0 && !filename.isEmpty()) {
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[model], filename);
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[model], filename);
}
else if (ui->modelsList->currentRow() > 0) {
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
else if (getCurrentRow() > 0) {
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[getCurrentRow()-1]);
}
if (pd) {
@@ -561,49 +561,54 @@ void MdiChild::setEEpromAvail(int eavail)
EEPromAvail=eavail;
}
int MdiChild::getCurrentRow() const
{
return ui->modelsList->currentRow();
}
bool MdiChild::loadBackup()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open backup Models and Settings file"), g.eepromDir(),tr(EEPROM_FILES_FILTER));
if (fileName.isEmpty())
return false;
QFile file(fileName);
QString fileName = QFileDialog::getOpenFileName(this, tr("Open backup Models and Settings file"), g.eepromDir(),tr(EEPROM_FILES_FILTER));
if (fileName.isEmpty())
return false;
QFile file(fileName);
if (!file.exists()) {
QMessageBox::critical(this, tr("Error"), tr("Unable to find file %1!").arg(fileName));
return false;
}
if(ui->modelsList->currentRow()<1) return false;
int index=ui->modelsList->currentRow()-1;
if (!file.exists()) {
QMessageBox::critical(this, tr("Error"), tr("Unable to find file %1!").arg(fileName));
return false;
}
if(getCurrentRow() < 1) return false;
int index = getCurrentRow() - 1;
int eeprom_size = file.size();
if (!file.open(QFile::ReadOnly)) { //reading binary file - TODO HEX support
QMessageBox::critical(this, tr("Error"),
tr("Error opening file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
return false;
}
QByteArray eeprom(eeprom_size, 0);
long result = file.read((char*)eeprom.data(), eeprom_size);
file.close();
int eeprom_size = file.size();
if (!file.open(QFile::ReadOnly)) { //reading binary file - TODO HEX support
QMessageBox::critical(this, tr("Error"),
tr("Error opening file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
return false;
}
QByteArray eeprom(eeprom_size, 0);
long result = file.read((char*)eeprom.data(), eeprom_size);
file.close();
if (result != eeprom_size) {
QMessageBox::critical(this, tr("Error"),
tr("Error reading file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
if (result != eeprom_size) {
QMessageBox::critical(this, tr("Error"),
tr("Error reading file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
return false;
}
return false;
}
if (!::loadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid binary backup File %1")
.arg(fileName));
return false;
}
if (!::loadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid binary backup File %1")
.arg(fileName));
return false;
}
ui->modelsList->refreshList();
ui->modelsList->refreshList();
return true;
return true;
}
+1
View File
@@ -77,6 +77,7 @@ class MdiChild : public QWidget
void viableModelSelected(bool viable);
void eepromInterfaceChanged();
void setEEpromAvail(int eavail);
int getCurrentRow() const;
signals:
void copyAvailable(bool val);
+17 -94
View File
@@ -61,7 +61,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
addEmptyLabel(gridLayout, 5 );
lock = true;
int num_fsw = firmware->getCapability(CustomFunctions);
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
if (!firmware->getCapability(VoicesAsNumbers)) {
tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength));
@@ -379,7 +379,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
}
}
else if (func==FuncReset) {
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
}
@@ -442,16 +442,9 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
else {
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
int vml = firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
}
}
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, firmware->getCapability(VoicesMaxLength));
}
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, tracksSet);
populateFileComboBox(fswtchParamArmT[i], tracksSet, cfn.paramarm);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
}
@@ -460,16 +453,12 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
else if (func==FuncBackgroundMusic) {
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
int vml=firmware->getCapability(VoicesMaxLength);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) {
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
}
}
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, firmware->getCapability(VoicesMaxLength));
}
populateFileComboBox(fswtchParamArmT[i], tracksSet, cfn.paramarm);
if (fswtchParamArmT[i]->currentText() != "----") {
widgetsMask |= CUSTOM_FUNCTION_PLAY;
}
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, tracksSet);
}
else if (func==FuncPlaySound) {
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
@@ -485,27 +474,9 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
else if (func==FuncPlayScript) {
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
int vml = 8/*TODO*/;
if (fswtchParamArmT[i]->currentText() != "----") {
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
}
}
}
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, scriptsSet);
}
else if (func==FuncPlayScript) {
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
if (modified) {
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
int vml = 8/*TODO*/;
if (fswtchParamArmT[i]->currentText() != "----") {
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
}
}
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, 8);
}
populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm);
}
else if (func==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value();
@@ -543,7 +514,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
void CustomFunctionsPanel::update()
{
lock = true;
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
for (int i=0; i<num_fsw; i++) {
if (!initialized) {
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
populateFuncCB(fswtchFunc[i], functions[i].func);
@@ -659,77 +631,28 @@ void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value)
b->setCurrentIndex(value);
}
void CustomFunctionsPanel::populateFuncParamArmTCB(QComboBox *b, char * value, const QSet<QString> &paramsList)
{
b->clear();
b->addItem("----");
bool added = false;
QString currentvalue(value);
// Convert set into list and sort it alphabetically case insensitive
QStringList list = QStringList::fromSet(paramsList);
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
foreach (QString entry, list) {
b->addItem(entry);
if (entry==currentvalue) {
b->setCurrentIndex(b->count()-1);
added = true;
}
}
if (!added && strlen(value)) {
b->addItem(value);
b->setCurrentIndex(b->count()-1);
}
}
void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode)
{
QStringList qs;
b->clear();
if (function==FuncPlaySound) {
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
CustomFunctionData::populatePlaySoundParams(qs);
b->addItems(qs);
b->setCurrentIndex(value);
}
else if (function==FuncPlayHaptic) {
qs << "0" << "1" << "2" << "3";
CustomFunctionData::populateHapticParams(qs);
b->addItems(qs);
b->setCurrentIndex(value);
}
else if (function==FuncReset) {
qs.append( QObject::tr("Timer1"));
qs.append( QObject::tr("Timer2"));
if (IS_ARM(firmware->getBoard())) {
qs.append( QObject::tr("Timer3"));
}
qs.append( QObject::tr("Flight"));
qs.append( QObject::tr("Telemetry"));
int reCount = firmware->getCapability(RotaryEncoders);
if (reCount == 1) {
qs.append( QObject::tr("Rotary Encoder"));
}
else if (reCount == 2) {
qs.append( QObject::tr("REa"));
qs.append( QObject::tr("REb"));
}
if (IS_ARM(firmware->getBoard())) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
if (model->sensorData[i].isAvailable()) {
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i);
qs.append(item.toString(model));
}
}
}
b->addItems(qs);
b->setCurrentIndex(value);
CustomFunctionData::populateResetParams(model, b, value);
}
else if (function==FuncVolume) {
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
}
else if (function==FuncPlayValue) {
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT);
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT|POPULATE_SCRIPT_OUTPUTS);
}
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
switch (adjustmode) {
@@ -65,7 +65,6 @@ 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);
void populateFuncParamArmTCB(QComboBox *b, char * value, const QSet<QString> & paramsList);
bool initialized;
QSet<QString> tracksSet;
+67 -64
View File
@@ -10,13 +10,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
generalSettings(generalSettings),
firmware(firmware),
ed(expoData),
inputName(inputName)
inputName(inputName),
modelPrinter(firmware, generalSettings, model)
{
ui->setupUi(this);
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
setWindowTitle(tr("Edit %1").arg(getInputStr(&model, ed->chn)));
setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn)));
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
@@ -32,7 +33,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->offsetCB->hide();
}
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
@@ -46,14 +48,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
}
}
else {
int mask=1;
for (int i=0; i<9 ; i++) {
if ((ed->phases & mask)==0) {
int mask = 1;
for (int i=0; i<9; i++) {
if ((ed->flightModes & mask) == 0) {
cb_fp[i]->setChecked(true);
}
mask <<= 1;
}
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
@@ -61,7 +63,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
if (firmware->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES |
POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
ui->sourceCB->removeItem(0);
ui->inputName->setValidator(new QRegExpValidator(rx, this));
ui->inputName->setText(inputName);
@@ -75,10 +78,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->trimCB->hide();
}
ui->trimCB->addItem(tr("Rud"), 1);
ui->trimCB->addItem(tr("Ele"), 2);
ui->trimCB->addItem(tr("Thr"), 3);
ui->trimCB->addItem(tr("Ail"), 4);
for(int i=0; i < NUM_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i), i+1);
}
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
int expolength = firmware->getCapability(HasExpoNames);
@@ -138,67 +140,68 @@ void ExpoDialog::updateScale()
void ExpoDialog::valuesChanged()
{
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (ed->srcRaw != srcRaw) {
ed->srcRaw = srcRaw;
updateScale();
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (ed->srcRaw != srcRaw) {
ed->srcRaw = srcRaw;
updateScale();
}
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toAscii().data());
if (firmware->getCapability(VirtualInputs)) {
inputName = ui->inputName->text();
}
ed->flightModes = 0;
for (int i=8; i>=0 ; i--) {
if (!cb_fp[i]->checkState()) {
ed->flightModes++;
}
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toAscii().data());
if (firmware->getCapability(VirtualInputs))
inputName = ui->inputName->text();
ed->phases=0;
for (int i=8; i>=0 ; i--) {
if (!cb_fp[i]->checkState()) {
ed->phases+=1;
ed->flightModes <<= 1;
}
ed->flightModes >>= 1;
if (firmware->getCapability(FlightModes)) {
int zeros = 0;
int ones = 0;
int phtemp = ed->flightModes;
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
if (phtemp & 1) {
ones++;
}
ed->phases<<=1;
else {
zeros++;
}
phtemp >>= 1;
}
ed->phases>>=1;
if (firmware->getCapability(FlightModes)) {
int zeros=0;
int ones=0;
int phtemp=ed->phases;
if (zeros == 1) {
phtemp=ed->flightModes;
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
if ((phtemp & 1) == 0) {
break;
}
phtemp >>= 1;
}
}
else if (ones == 1) {
phtemp = ed->flightModes;
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
if (phtemp & 1) {
ones++;
}
else {
zeros++;
}
phtemp >>=1;
}
if (zeros==1) {
phtemp=ed->phases;
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
if ((phtemp & 1)==0) {
break;
}
phtemp >>=1;
}
}
else if (ones==1) {
phtemp=ed->phases;
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
if (phtemp & 1) {
break;
}
phtemp >>=1;
break;
}
phtemp >>= 1;
}
}
else {
ed->phases=0;
}
}
else {
ed->flightModes = 0;
}
}
void ExpoDialog::shrink()
+2
View File
@@ -3,6 +3,7 @@
#include <QDialog>
#include "eeprominterface.h"
#include "modelprinter.h"
class GVarGroup;
class CurveGroup;
@@ -35,6 +36,7 @@ class ExpoDialog : public QDialog {
GVarGroup * gvWeightGroup;
GVarGroup * gvOffsetGroup;
CurveGroup * curveGroup;
ModelPrinter modelPrinter;
};
#endif // EXPODIALOG_H
+5 -1
View File
@@ -56,7 +56,11 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
}
// The trims
QString labels[] = { tr("Rud"), tr("Ele"), tr("Thr"), tr("Ail") }; // TODO is elsewhere for sure
QString labels[NUM_STICKS];
for(int i=0; i < NUM_STICKS; i++) {
labels[i] = AnalogString(i);
}
trimsLabel << ui->trim1Label << ui->trim2Label << ui->trim3Label << ui->trim4Label;
trimsUse << ui->trim1Use << ui->trim2Use << ui->trim3Use << ui->trim4Use;
+10 -38
View File
@@ -5,7 +5,8 @@
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
expoInserted(false)
expoInserted(false),
modelPrinter(firmware, generalSettings, model)
{
inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
@@ -135,18 +136,18 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
QString str;
if (new_ch) *new_ch = 0;
if (dest < 0) {
str = getInputStr(model, -dest-1);
str = modelPrinter.printInputName(-dest-1);
if (new_ch) *new_ch = 1;
}
else {
ExpoData *md = &model->expoData[dest];
ExpoData & input = model->expoData[dest];
if ((dest == 0) || (model->expoData[dest-1].chn != md->chn)) {
if ((dest == 0) || (model->expoData[dest-1].chn != input.chn)) {
if (new_ch) *new_ch = 1;
if (firmware->getCapability(VirtualInputs))
str = QString("%1").arg(getInputStr(model, md->chn), -10, ' ');
str += QString("%1").arg(modelPrinter.printInputName(input.chn), -10, ' ');
else
str = getInputStr(model, md->chn);
str = modelPrinter.printInputName(input.chn);
}
else {
if (firmware->getCapability(VirtualInputs))
@@ -154,39 +155,10 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
else
str = " ";
}
switch (md->mode) {
case (1): str += " <-"; break;
case (2): str += " ->"; break;
default: str += " "; break;
}
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset));
if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString(model));
if (md->carryTrim>0) {
str += " " + tr("NoTrim");
}
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
}
}
if (md->curve.value) str += " " + md->curve.toString();
QString phasesStr = getPhasesStr(md->phases, model);
if (!phasesStr.isEmpty()) str += " " + phasesStr;
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
if (firmware->getCapability(HasExpoNames)) {
QString expoName = md->name;
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
}
str.replace(" ", "&nbsp;");
str += modelPrinter.printInputLine(input);
}
return Qt::escape(str).replace(" ", "&nbsp;");
return str;
}
bool InputsPanel::gm_insertExpo(int idx)
+2
View File
@@ -3,6 +3,7 @@
#include "modeledit.h"
#include "mixerslist.h"
#include "modelprinter.h"
class InputsPanel : public ModelPanel
{
@@ -35,6 +36,7 @@ class InputsPanel : public ModelPanel
MixersList *ExposlistWidget;
bool firstLine;
int inputsCount;
ModelPrinter modelPrinter;
int getExpoIndex(unsigned int dch);
bool gm_insertExpo(int idx);
+19 -21
View File
@@ -19,16 +19,18 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS |
POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0);
int limit = firmware->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB,
md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
ui->MixDR_CB->setChecked(md->noExpo==0);
ui->MixDR_CB->setChecked(md->noExpo == 0);
if (!firmware->getCapability(HasNoExpo)) {
ui->MixDR_CB->hide();
@@ -36,10 +38,9 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
if (!firmware->getCapability(VirtualInputs)) {
ui->trimCB->addItem(tr("Rud"));
ui->trimCB->addItem(tr("Ele"));
ui->trimCB->addItem(tr("Thr"));
ui->trimCB->addItem(tr("Ail"));
for(int i=0; i < NUM_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i));
}
}
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
@@ -63,14 +64,14 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
}
else {
int mask=1;
int mask = 1;
for (int i=0; i<9 ; i++) {
if ((md->phases & mask)==0) {
if ((md->flightModes & mask) == 0) {
cb_fp[i]->setChecked(true);
}
mask <<= 1;
}
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
@@ -149,29 +150,26 @@ void MixerDialog::valuesChanged()
ui->label_MixDR->setEnabled(drVisible);
}
md->carryTrim = -(ui->trimCB->currentIndex()-1);
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
md->mixWarn = ui->warningCB->currentIndex();
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
int scale=firmware->getCapability(SlowScale);
int scale = firmware->getCapability(SlowScale);
md->delayDown = round(ui->delayDownSB->value()*scale);
md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale);
md->speedUp = round(ui->slowUpSB->value()*scale);
int i=0;
for (i=0; i<ui->mixerName->text().toAscii().length(); i++) {
md->name[i]=ui->mixerName->text().toAscii().at(i);
}
md->name[i]=0;
md->phases=0;
strcpy(md->name, ui->mixerName->text().toAscii());
md->flightModes = 0;
for (int i=8; i>=0 ; i--) {
if (!cb_fp[i]->checkState()) {
md->phases+=1;
md->flightModes++;
}
md->phases<<=1;
md->flightModes <<= 1;
}
md->phases>>=1;
md->flightModes >>= 1;
lock = false;
}
+227 -286
View File
@@ -6,7 +6,8 @@
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
mixInserted(false),
highlightedSource(0)
highlightedSource(0),
modelPrinter(firmware, generalSettings, model)
{
QGridLayout * mixesLayout = new QGridLayout(this);
@@ -43,40 +44,21 @@ MixesPanel::~MixesPanel()
{
}
QString MixesPanel::getChannelLabel(int curDest)
{
QString str;
str = QObject::tr("CH%1").arg(curDest);
// TODO not nice, Qt brings a function for that, I don't remember right now
(str.length() < 4) ? str.append(" ") : str.append(" ");
if (firmware->getCapability(HasChNames)) {
QString name = model->limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
str += name.left(8);
}
return Qt::escape(str);
}
void MixesPanel::update()
{
// curDest -> destination channel
// i -> mixer number
QByteArray qba;
MixerlistWidget->clear();
firstLine = true;
unsigned int curDest = 0;
int i;
unsigned int outputs = firmware->getCapability(Outputs);
for (i=0; i<firmware->getCapability(Mixes); i++) {
MixData *md = &model->mixData[i];
// qDebug() << "md->destCh: " << md->destCh;
if (md->destCh==0 || md->destCh>outputs) continue;
for (int i=0; i<firmware->getCapability(Mixes); i++) {
MixData & mix = model->mixData[i];
// qDebug() << "mix.destCh: " << mix.destCh;
if (mix.destCh == 0 || mix.destCh>outputs) continue;
QString str = "";
while (curDest < md->destCh-1) {
while (curDest < mix.destCh-1) {
curDest++;
AddMixerLine(-curDest);
}
@@ -139,24 +121,24 @@ bool MixesPanel::AddMixerLine(int dest)
QString MixesPanel::getMixerText(int dest, bool * new_ch)
{
QString str;
if (new_ch) *new_ch = 0;
bool newChannel = false;
if (dest < 0) {
str = getChannelLabel(-dest);
//highlight channell if needed
str = modelPrinter.printMixerName(-dest);
//highlight channel if needed
if (-dest == (int)highlightedSource) {
str = "<b>" + str + "</b>";
}
if (new_ch) *new_ch = 1;
newChannel = true;
}
else {
MixData *md = &model->mixData[dest];
//md->destCh from 1 to 32
str = getChannelLabel(md->destCh);
MixData & mix = model->mixData[dest];
//mix->destCh from 1 to 32
str = modelPrinter.printMixerName(mix.destCh);
if ((dest == 0) || (model->mixData[dest-1].destCh != md->destCh)) {
if (new_ch) *new_ch = 1;
//highlight channell if needed
if (md->destCh == highlightedSource) {
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
newChannel = true;
//highlight channel if needed
if (mix.destCh == highlightedSource) {
str = "<b>" + str + "</b>";
}
}
@@ -164,199 +146,155 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str.fill(' ');
}
switch (md->mltpx) {
case (1): str += " *"; break;
case (2): str += " R"; break;
default: str += " "; break;
};
// highlight source if needed
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
str += " <b>" + Qt::escape(md->srcRaw.toString(model)) + "</b>";
}
else {
str += " " + Qt::escape(md->srcRaw.toString(model));
}
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
QString phasesStr = getPhasesStr(md->phases, model);
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
if (md->swtch.type != SWITCH_TYPE_NONE) {
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
}
if (md->carryTrim > 0)
str += " " + Qt::escape(tr("NoTrim"));
else if (md->carryTrim<0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (md->delayDown || md->delayUp)
str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
if (!MixerName.isEmpty()) {
str += " " + Qt::escape(QString("(%1)").arg(MixerName));
}
}
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
}
if (new_ch) *new_ch = newChannel;
return str.replace(" ", "&nbsp;");
}
bool MixesPanel::gm_insertMix(int idx)
{
if (idx<0 || idx>=firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
return false;
}
if (idx < 0 || idx >= firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
return false;
}
int i = model->mixData[idx].destCh;
memmove(&model->mixData[idx+1],&model->mixData[idx],
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
memset(&model->mixData[idx],0,sizeof(MixData));
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model->mixData[idx].destCh = i;
model->mixData[idx].weight = 100;
return true;
int i = model->mixData[idx].destCh;
memmove(&model->mixData[idx+1], &model->mixData[idx],
(firmware->getCapability(Mixes)-(idx+1)) * sizeof(MixData) );
memset(&model->mixData[idx], 0, sizeof(MixData));
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
model->mixData[idx].destCh = i;
model->mixData[idx].weight = 100;
return true;
}
void MixesPanel::gm_deleteMix(int index)
{
memmove(&model->mixData[index],&model->mixData[index+1],
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
memset(&model->mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
memmove(&model->mixData[index], &model->mixData[index+1],
(firmware->getCapability(Mixes)-(index+1)) * sizeof(MixData));
memset(&model->mixData[firmware->getCapability(Mixes)-1], 0, sizeof(MixData));
}
void MixesPanel::gm_openMix(int index)
{
if(index<0 || index>=firmware->getCapability(Mixes)) return;
if(index < 0 || index>=firmware->getCapability(Mixes)) return;
MixData mixd(model->mixData[index]);
MixData mixd(model->mixData[index]);
emit modified();
update();
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
if(g->exec()) {
model->mixData[index] = mixd;
emit modified();
update();
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
if(g->exec()) {
model->mixData[index] = mixd;
emit modified();
update();
} else {
if (mixInserted) {
gm_deleteMix(index);
}
mixInserted=false;
emit modified();
update();
}
else {
if (mixInserted) {
gm_deleteMix(index);
}
mixInserted = false;
emit modified();
update();
}
}
int MixesPanel::getMixerIndex(unsigned int dch)
{
int i = 0;
while ((model->mixData[i].destCh<=dch) && (model->mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
if(i==firmware->getCapability(Mixes)) return -1;
return i;
int i = 0;
while ((model->mixData[i].destCh <= dch) && (model->mixData[i].destCh) && (i < firmware->getCapability(Mixes))) i++;
if (i == firmware->getCapability(Mixes)) return -1;
return i;
}
void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
{
int idx= MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
if (idx<0) {
int i = -idx;
idx = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(idx))
return;
model->mixData[idx].destCh = i;
mixInserted=true;
} else {
mixInserted=false;
}
gm_openMix(idx);
int idx = MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
if (idx<0) {
int i = -idx;
idx = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(idx)) return;
model->mixData[idx].destCh = i;
mixInserted = true;
}
else {
mixInserted = false;
}
gm_openMix(idx);
}
void MixesPanel::mixersDeleteList(QList<int> list)
{
qSort(list.begin(), list.end());
qSort(list.begin(), list.end());
int iDec = 0;
foreach(int idx, list) {
gm_deleteMix(idx-iDec);
iDec++;
}
int iDec = 0;
foreach(int idx, list) {
gm_deleteMix(idx - iDec);
iDec++;
}
}
QList<int> MixesPanel::createMixListFromSelected()
{
QList<int> list;
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx>=0 && idx<firmware->getCapability(Mixes)) list << idx;
}
return list;
QList<int> list;
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx >= 0 && idx<firmware->getCapability(Mixes)) list << idx;
}
return list;
}
// TODO duplicated code
void MixesPanel::setSelectedByMixList(QList<int> list)
{
for(int i=0; i<MixerlistWidget->count(); i++) {
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
if(list.contains(t))
MixerlistWidget->item(i)->setSelected(true);
for(int i=0; i<MixerlistWidget->count(); i++) {
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
if(list.contains(t)) {
MixerlistWidget->item(i)->setSelected(true);
}
}
}
void MixesPanel::mixersDelete(bool ask)
{
QList<int> list = createMixListFromSelected();
if(list.isEmpty()) return;
QList<int> list = createMixListFromSelected();
if(list.isEmpty()) return;
QMessageBox::StandardButton ret = QMessageBox::No;
QMessageBox::StandardButton ret = QMessageBox::No;
if(ask)
ret = QMessageBox::warning(this, "companion",
tr("Delete Selected Mixes?"),
QMessageBox::Yes | QMessageBox::No);
if(ask) {
ret = QMessageBox::warning(this, "companion",
tr("Delete Selected Mixes?"),
QMessageBox::Yes | QMessageBox::No);
}
if ((ret == QMessageBox::Yes) || (!ask)) {
mixersDeleteList(list);
emit modified();
update();
}
if ((ret == QMessageBox::Yes) || (!ask)) {
mixersDeleteList(list);
emit modified();
update();
}
}
void MixesPanel::mixersCut()
{
mixersCopy();
mixersDelete(false);
mixersCopy();
mixersDelete(false);
}
void MixesPanel::mixersCopy()
{
QList<int> list = createMixListFromSelected();
QList<int> list = createMixListFromSelected();
QByteArray mxData;
foreach(int idx, list) {
mxData.append((char*)&model->mixData[idx], sizeof(MixData));
}
QByteArray mxData;
foreach(int idx, list) {
mxData.append((char*)&model->mixData[idx],sizeof(MixData));
}
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-companion-mix", mxData);
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-companion-mix", mxData);
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
}
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
@@ -365,10 +303,11 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
int idx; // mixer index
int dch;
if(destIdx<0) {
if (destIdx < 0) {
dch = -destIdx;
idx = getMixerIndex(dch) - 1; //get mixer index to insert
} else {
}
else {
idx = destIdx;
dch = model->mixData[idx].destCh;
}
@@ -376,14 +315,13 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
QByteArray mxData = mimeData->data("application/x-companion-mix");
int i = 0;
while(i<mxData.size()) {
while (i < mxData.size()) {
idx++;
if(idx==firmware->getCapability(Mixes)) break;
if (idx == firmware->getCapability(Mixes)) break;
if (!gm_insertMix(idx)) break;
if (!gm_insertMix(idx))
break;
MixData *md = &model->mixData[idx];
memcpy(md,mxData.mid(i,sizeof(MixData)).constData(),sizeof(MixData));
MixData * md = &model->mixData[idx];
memcpy(md, mxData.mid(i, sizeof(MixData)).constData(), sizeof(MixData));
md->destCh = dch;
i += sizeof(MixData);
}
@@ -396,34 +334,35 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
void MixesPanel::mixersPaste()
{
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
QListWidgetItem *item = MixerlistWidget->currentItem();
if (item)
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
QListWidgetItem *item = MixerlistWidget->currentItem();
if (item) {
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
}
}
void MixesPanel::mixersDuplicate()
{
mixersCopy();
mixersPaste();
mixersCopy();
mixersPaste();
}
void MixesPanel::mixerOpen()
{
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
if(idx<0) {
int i = -idx;
idx = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(idx))
return;
model->mixData[idx].destCh = i;
mixInserted=true;
} else {
mixInserted=false;
}
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
if(idx < 0) {
int i = -idx;
idx = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(idx)) return;
model->mixData[idx].destCh = i;
mixInserted = true;
}
else {
mixInserted = false;
}
gm_openMix(idx);
gm_openMix(idx);
}
void MixesPanel::mixerHighlight()
@@ -446,135 +385,137 @@ void MixesPanel::mixerHighlight()
void MixesPanel::mixerAdd()
{
if (!MixerlistWidget->currentItem())
return;
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
if (!MixerlistWidget->currentItem()) return;
if(index<0) { // if empty then return relavent index
int i = -index;
index = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(index))
return;
model->mixData[index].destCh = i;
mixInserted=true;
} else {
index++;
if (!gm_insertMix(index))
return;
model->mixData[index].destCh = model->mixData[index-1].destCh;
mixInserted=true;
}
gm_openMix(index);
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
if(index < 0) { // if empty then return relavent index
int i = -index;
index = getMixerIndex(i); //get mixer index to insert
if (!gm_insertMix(index)) return;
model->mixData[index].destCh = i;
mixInserted = true;
}
else {
index++;
if (!gm_insertMix(index)) return;
model->mixData[index].destCh = model->mixData[index-1].destCh;
mixInserted = true;
}
gm_openMix(index);
}
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
{
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
bool hasData = mimeData->hasFormat("application/x-companion-mix");
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
bool hasData = mimeData->hasFormat("application/x-companion-mix");
QMenu contextMenu;
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"),this,SLOT(mixerHighlight()),tr("Ctrl+T"));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
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"));
QMenu contextMenu;
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"), this, SLOT(mixerAdd()), tr("Ctrl+A"));
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(mixerOpen()), tr("Enter"));
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"), this, SLOT(mixerHighlight()), tr("Ctrl+T"));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"), this, SLOT(mixersDelete()), tr("Delete"));
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"), this, SLOT(mixersCopy()), tr("Ctrl+C"));
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"), this, SLOT(mixersCut()), tr("Ctrl+X"));
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"), this, SLOT(mixersPaste()), tr("Ctrl+V"))->setEnabled(hasData);
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(mixersDuplicate()), tr("Ctrl+U"));
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.exec(globalPos);
contextMenu.exec(globalPos);
}
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
{
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
pasteMixerMimeData(data, idx);
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
pasteMixerMimeData(data, idx);
}
void MixesPanel::mixesEdited()
{
emit modified();
emit modified();
}
void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
{
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
if(event->matches(QKeySequence::Delete)) mixersDelete();
if(event->matches(QKeySequence::Copy)) mixersCopy();
if(event->matches(QKeySequence::Cut)) mixersCut();
if(event->matches(QKeySequence::Paste)) mixersPaste();
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
if(event->matches(QKeySequence::Delete)) mixersDelete();
if(event->matches(QKeySequence::Copy)) mixersCopy();
if(event->matches(QKeySequence::Cut)) mixersCut();
if(event->matches(QKeySequence::Paste)) mixersPaste();
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
if(event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) mixerOpen();
if(event->matches(QKeySequence::MoveToNextLine))
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
if(event->matches(QKeySequence::MoveToPreviousLine))
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) mixerOpen();
if(event->matches(QKeySequence::MoveToNextLine)) {
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
}
if(event->matches(QKeySequence::MoveToPreviousLine)) {
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
}
}
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
{
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
if(idx > firmware->getCapability(Mixes) || (idx == firmware->getCapability(Mixes) && dir)) return idx;
MixData &src=model->mixData[idx];
MixData &src=model->mixData[idx];
if (idx==0 && !dir) {
//special case: topmost mixer moving up
if (src.destCh > 1) src.destCh--;
return idx;
}
if (idx == 0 && !dir) {
//special case: topmost mixer moving up
if (src.destCh > 1) src.destCh--;
return idx;
}
int tdx = dir ? idx+1 : idx-1;
MixData &tgt=model->mixData[tdx];
int tdx = dir ? idx+1 : idx-1;
MixData & tgt = model->mixData[tdx];
unsigned int outputs = firmware->getCapability(Outputs);
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
unsigned int outputs = firmware->getCapability(Outputs);
if(src.destCh == 0 || src.destCh > outputs || tgt.destCh > outputs) return idx;
if (tgt.destCh!=src.destCh) {
if ((dir) && (src.destCh<outputs)) src.destCh++;
if ((!dir) && (src.destCh>0)) src.destCh--;
return idx;
}
if (tgt.destCh != src.destCh) {
if (dir && src.destCh < outputs) src.destCh++;
if (!dir && src.destCh > 0) src.destCh--;
return idx;
}
//flip between idx and tgt
MixData temp;
memcpy(&temp,&src,sizeof(MixData));
memcpy(&src,&tgt,sizeof(MixData));
memcpy(&tgt,&temp,sizeof(MixData));
return tdx;
//flip between idx and tgt
MixData temp;
memcpy(&temp, &src, sizeof(MixData));
memcpy(&src, &tgt, sizeof(MixData));
memcpy(&tgt, &temp, sizeof(MixData));
return tdx;
}
void MixesPanel::moveMixUp()
{
QList<int> list = createMixListFromSelected();
QList<int> highlightList;
foreach(int idx, list) {
highlightList << gm_moveMix(idx, false);
}
emit modified();
update();
setSelectedByMixList(highlightList);
QList<int> list = createMixListFromSelected();
QList<int> highlightList;
foreach(int idx, list) {
highlightList << gm_moveMix(idx, false);
}
emit modified();
update();
setSelectedByMixList(highlightList);
}
void MixesPanel::moveMixDown()
{
QList<int> list = createMixListFromSelected();
QList<int> highlightList;
foreach(int idx, list) {
highlightList << gm_moveMix(idx, true);
}
emit modified();
update();
setSelectedByMixList(highlightList);
QList<int> list = createMixListFromSelected();
QList<int> highlightList;
foreach(int idx, list) {
highlightList << gm_moveMix(idx, true);
}
emit modified();
update();
setSelectedByMixList(highlightList);
}
void MixesPanel::clearMixes()
+2 -1
View File
@@ -4,6 +4,7 @@
#include "modeledit.h"
#include "mixerslist.h"
#include "mixerdialog.h"
#include "modelprinter.h"
class MixesPanel : public ModelPanel
{
@@ -44,6 +45,7 @@ class MixesPanel : public ModelPanel
bool mixInserted;
unsigned int highlightedSource;
bool firstLine;
ModelPrinter modelPrinter;
int getMixerIndex(unsigned int dch);
bool gm_insertMix(int idx);
@@ -53,7 +55,6 @@ class MixesPanel : public ModelPanel
void mixersDeleteList(QList<int> list);
QList<int> createMixListFromSelected();
void setSelectedByMixList(QList<int> list);
QString getChannelLabel(int curDest);
bool AddMixerLine(int dest);
QString getMixerText(int dest, bool * new_ch);
};
+52 -34
View File
@@ -4,6 +4,7 @@
#include "ui_setup_module.h"
#include "helpers.h"
#include "appdata.h"
#include "modelprinter.h"
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget *prevFocus):
ModelPanel(parent, model, generalSettings, firmware),
@@ -35,10 +36,11 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
}
ui->countdownBeep->setField(timer.countdownBeep, this);
ui->countdownBeep->addItem(tr("Silent"), 0);
ui->countdownBeep->addItem(tr("Beeps"), 1);
ui->countdownBeep->addItem(tr("Silent"), TimerData::COUNTDOWN_SILENT);
ui->countdownBeep->addItem(tr("Beeps"), TimerData::COUNTDOWN_BEEPS);
if (IS_ARM(board) || IS_2560(board)) {
ui->countdownBeep->addItem(tr("Voice"), 2);
ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE);
ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC);
}
ui->persistent->setField(timer.persistent, this);
@@ -165,9 +167,9 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
ui->label_module->setText(label);
// The protocols available on this board
for (int i=0; i<PROTO_LAST; i++) {
if (GetEepromInterface()->isAvailable((Protocol)i, moduleIdx)) {
ui->protocol->addItem(getProtocolStr(i), (QVariant)i);
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
if (GetEepromInterface()->isAvailable((PulsesProtocol)i, moduleIdx)) {
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
}
}
@@ -221,42 +223,42 @@ ModulePanel::~ModulePanel()
void ModulePanel::update()
{
unsigned int mask = 0;
Protocol protocol = (Protocol)module.protocol;
PulsesProtocol protocol = (PulsesProtocol)module.protocol;
unsigned int max_rx_num = 63;
if (moduleIdx >= 0) {
mask |= MASK_PROTOCOL;
switch (protocol) {
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PXX_DJT:
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==PXX_XJT_X16) || (protocol==PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
if ((protocol==PULSES_PXX_XJT_X16) || (protocol==PULSES_PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
break;
case LP45:
case DSM2:
case DSMX:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER;
module.channelsCount = 6;
max_rx_num = 20;
break;
case PPM:
case PULSES_PPM:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
if (IS_9XRPRO(firmware->getBoard())) {
mask |= MASK_OPEN_DRAIN;
}
break;
case OFF:
case PULSES_OFF:
default:
break;
}
}
else if (IS_TARANIS(firmware->getBoard())) {
switch(model->trainerMode) {
case MASTER_JACK:
case TRAINER_MASTER_JACK:
break;
case SLAVE_JACK:
case TRAINER_SLAVE_JACK:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
break;
default:
@@ -264,7 +266,7 @@ void ModulePanel::update()
break;
}
}
else if (model->trainerMode != MASTER_JACK) {
else if (model->trainerMode != TRAINER_MASTER_JACK) {
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
}
@@ -517,6 +519,10 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
if (!firmware->getCapability(HasDisplayText)) {
ui->displayText->hide();
}
if (!firmware->getCapability(GlobalFunctions)) {
ui->gfEnabled->hide();
}
// Beep Center checkboxes
prevFocus = ui->trimsDisplay;
@@ -683,7 +689,7 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
{
if (!lock) {
model->thrTraceSrc = ui->throttleSource->itemData(index).toInt();
model->thrTraceSrc = index;
emit modified();
}
}
@@ -729,34 +735,39 @@ void SetupPanel::on_image_currentIndexChanged(int index)
void SetupPanel::populateThrottleSourceCB()
{
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
const QString pots9x[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
const QString potsTaranisX9E[] = { QObject::tr("F1"), QObject::tr("F2"), QObject::tr("F3"), QObject::tr("F4"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
unsigned int i;
lock = true;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<6; i++) {
ui->throttleSource->addItem(sourcesTaranis[i], i);
ui->throttleSource->addItem(QObject::tr("THR"));
if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
for (i=0; i<8; i++) {
ui->throttleSource->addItem(potsTaranisX9E[i], i);
}
}
else if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<5; i++) {
ui->throttleSource->addItem(potsTaranis[i], i);
}
}
else {
for (i=0; i<4; i++) {
ui->throttleSource->addItem(sources9x[i], i);
for (i=0; i<3; i++) {
ui->throttleSource->addItem(pots9x[i], i);
}
}
if (model->thrTraceSrc < i)
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=0; i<channels; i++) {
ui->throttleSource->addItem(QObject::tr("CH%1").arg(i+1, 2, 10, QChar('0')), THROTTLE_SOURCE_FIRST_CHANNEL+i);
if (model->thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
ui->throttleSource->addItem(ModelPrinter::printChannelName(i));
}
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
lock = false;
}
@@ -774,6 +785,7 @@ void SetupPanel::update()
ui->extendedLimits->setChecked(model->extendedLimits);
ui->extendedTrims->setChecked(model->extendedTrims);
ui->displayText->setChecked(model->displayChecklist);
ui->gfEnabled->setChecked(!model->noGlobalFunctions);
updateBeepCenter();
updateStartupSwitches();
@@ -915,6 +927,12 @@ void SetupPanel::on_displayText_toggled(bool checked)
emit modified();
}
void SetupPanel::on_gfEnabled_toggled(bool checked)
{
model->noGlobalFunctions = !checked;
emit modified();
}
void SetupPanel::on_throttleTrim_toggled(bool checked)
{
model->thrTrim = checked;
+1
View File
@@ -101,6 +101,7 @@ class SetupPanel : public ModelPanel
void on_throttleWarning_toggled(bool checked);
void on_throttleReverse_toggled(bool checked);
void on_displayText_toggled(bool checked);
void on_gfEnabled_toggled(bool checked);
void on_image_currentIndexChanged(int index);
void on_trimIncrement_currentIndexChanged(int index);
void onBeepCenterToggled(bool checked);
+7
View File
@@ -215,6 +215,13 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="gfEnabled">
<property name="text">
<string>Global Functions</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
+64 -37
View File
@@ -29,20 +29,10 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, Mod
update();
ui->UnitCB->setCurrentIndex(analog.type);
if (!IS_TARANIS(firmware->getBoard())) {
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
}
else {
ui->alarm1LevelCB->hide();
ui->alarm2LevelCB->hide();
ui->alarm1GreaterCB->hide();
ui->alarm2GreaterCB->hide();
ui->alarm1Label->setText(tr("Low Alarm"));
ui->alarm2Label->setText(tr("Critical Alarm"));
}
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
if (!(firmware->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide();
@@ -340,6 +330,13 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
ui->screenType->setField(screen.type, this);
lock = false;
if (IS_TARANIS(firmware->getBoard())) {
QSet<QString> scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/TELEMETRY", QStringList() << "*.lua", 8);
populateFileComboBox(ui->scriptName, scriptsSet, screen.body.script.filename);
connect(ui->scriptName, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptNameEdited()));
connect(ui->scriptName, SIGNAL(editTextChanged ( const QString)), this, SLOT(scriptNameEdited()));
}
update();
}
@@ -362,6 +359,7 @@ void TelemetryCustomScreen::update()
{
lock = true;
ui->scriptName->setVisible(screen.type == TELEMETRY_SCREEN_SCRIPT);
ui->screenNums->setVisible(screen.type == TELEMETRY_SCREEN_NUMBERS);
ui->screenBars->setVisible(screen.type == TELEMETRY_SCREEN_BARS);
@@ -391,9 +389,12 @@ void TelemetryCustomScreen::updateBar(int line)
RawSource source = screen.body.bars[line].source;
if (source.type != SOURCE_TYPE_NONE) {
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max)
screen.body.bars[line].barMax = 255 - max;
if (!IS_ARM(GetCurrentFirmware()->getBoard())) {
int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max) {
screen.body.bars[line].barMax = 255 - max;
}
}
minSB[line]->setEnabled(true);
minSB[line]->setDecimals(range.decimals);
minSB[line]->setMinimum(range.min);
@@ -405,7 +406,12 @@ void TelemetryCustomScreen::updateBar(int line)
maxSB[line]->setMinimum(range.min);
maxSB[line]->setMaximum(range.max);
maxSB[line]->setSingleStep(range.step);
maxSB[line]->setValue(range.getValue(255 - screen.body.bars[line].barMax));
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
maxSB[line]->setValue(range.getValue(screen.body.bars[line].barMax));
}
else {
maxSB[line]->setValue(range.getValue(255 - screen.body.bars[line].barMax));
}
}
else {
minSB[line]->setDisabled(true);
@@ -424,6 +430,16 @@ void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
}
}
void TelemetryCustomScreen::scriptNameEdited()
{
if (!lock) {
lock = true;
getFileComboBoxValue(ui->scriptName, screen.body.script.filename, 8);
emit modified();
lock = false;
}
}
void TelemetryCustomScreen::customFieldChanged(int value)
{
if (!lock) {
@@ -450,7 +466,10 @@ void TelemetryCustomScreen::barMinChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
if (IS_ARM(GetCurrentFirmware()->getBoard()))
screen.body.bars[line].barMin = round(value / minSB[line]->singleStep());
else
screen.body.bars[line].barMin = round((value-minSB[line]->minimum()) / minSB[line]->singleStep());
// TODO set min (maxSB)
emit modified();
}
@@ -460,7 +479,10 @@ void TelemetryCustomScreen::barMaxChanged(double value)
{
if (!lock) {
int line = sender()->property("index").toInt();
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());
if (IS_ARM(GetCurrentFirmware()->getBoard()))
screen.body.bars[line].barMax = round((value) / maxSB[line]->singleStep());
else
screen.body.bars[line].barMax = 255 - round((value-minSB[line]->minimum()) / maxSB[line]->singleStep());
// TODO set max (minSB)
emit modified();
}
@@ -511,6 +533,7 @@ void TelemetrySensorPanel::update()
bool cellsFieldsDisplayed = false;
bool consFieldsDisplayed = false;
bool ratioFieldsDisplayed = false;
bool totalizeFieldsDisplayed = false;
bool sources12FieldsDisplayed = false;
bool sources34FieldsDisplayed = false;
@@ -534,6 +557,7 @@ void TelemetrySensorPanel::update()
consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
totalizeFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
updateSourcesComboBox(ui->source1, true);
updateSourcesComboBox(ui->source2, true);
updateSourcesComboBox(ui->source3, true);
@@ -573,15 +597,15 @@ void TelemetrySensorPanel::update()
ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS);
ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS);
ui->offset->setVisible(ratioFieldsDisplayed);
ui->precLabel->setVisible(isConfigurable);
ui->precLabel->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable);
ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed);
ui->gpsSensor->setVisible(gpsFieldsDisplayed);
ui->altSensorLabel->setVisible(gpsFieldsDisplayed);
ui->altSensor->setVisible(gpsFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed);
ui->ampsSensor->setVisible(consFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->ampsSensor->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed);
ui->cellsSensor->setVisible(cellsFieldsDisplayed);
ui->cellsIndex->setVisible(cellsFieldsDisplayed);
@@ -639,6 +663,10 @@ void TelemetrySensorPanel::on_formula_currentIndexChanged(int index)
{
if (!lock) {
sensor.formula = index;
if (sensor.formula == SensorData::TELEM_FORMULA_CELL) {
sensor.prec = 2;
sensor.unit = SensorData::UNIT_VOLTS;
}
update();
emit modified();
}
@@ -697,6 +725,8 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
if (IS_TARANIS(firmware->getBoard())) {
ui->voltsSource->setField(model.frsky.voltsSource);
ui->altitudeSource->setField(model.frsky.altitudeSource);
ui->varioSource->setField(model.frsky.varioSource);
ui->varioCenterSilent->setField(model.frsky.varioCenterSilent);
}
else {
ui->topbarGB->hide();
@@ -721,7 +751,7 @@ TelemetryPanel::~TelemetryPanel()
void TelemetryPanel::update()
{
if (IS_TARANIS(firmware->getBoard())) {
if (model->moduleData[0].protocol == OFF && model->moduleData[1].protocol == PPM) {
if (model->moduleData[0].protocol == PULSES_OFF && model->moduleData[1].protocol == PULSES_PPM) {
ui->telemetryProtocol->setEnabled(true);
}
else {
@@ -731,6 +761,7 @@ void TelemetryPanel::update()
populateTelemetrySourcesComboBox(ui->voltsSource, model, false);
populateTelemetrySourcesComboBox(ui->altitudeSource, model, false);
populateTelemetrySourcesComboBox(ui->varioSource, model, false);
}
if (IS_ARM(firmware->getBoard())) {
@@ -756,10 +787,12 @@ void TelemetryPanel::setup()
ui->telemetryProtocol->addItem(tr("FrSky D (cable)"), 2);
}
ui->telemetryProtocol->setCurrentIndex(model->telemetryProtocol);
ui->ignoreSensorIds->setField(model->frsky.ignoreSensorIds);
}
else {
ui->telemetryProtocolLabel->hide();
ui->telemetryProtocol->hide();
ui->ignoreSensorIds->hide();
}
ui->rssiAlarm1SB->setValue(model->frsky.rssiAlarms[0].value);
@@ -794,7 +827,7 @@ void TelemetryPanel::setup()
ui->VarioLabel_2->hide();
ui->VarioLabel_3->hide();
ui->VarioLabel_4->hide();
ui->varioSourceCB->hide();
ui->varioSource->hide();
ui->varioSource_label->hide();
}
else {
@@ -849,29 +882,23 @@ void TelemetryPanel::setup()
ui->frskyProtoCB->setCurrentIndex(model->frsky.usrProto);
ui->bladesCount->setValue(model->frsky.blades);
populateVarioSource();
populateVoltsSource();
populateCurrentSource();
}
populateVoltsSource();
populateCurrentSource();
populateVarioSource();
lock = false;
}
void TelemetryPanel::populateVarioSource()
{
AutoComboBox * cb = ui->varioSourceCB;
AutoComboBox * cb = ui->varioSource;
cb->setField(model->frsky.varioSource, this);
if (!IS_TARANIS(firmware->getBoard())) {
cb->addItem(tr("Alti"), TELEMETRY_VARIO_SOURCE_ALTI);
cb->addItem(tr("Alti+"), TELEMETRY_VARIO_SOURCE_ALTI_PLUS);
}
cb->addItem(tr("Alti"), TELEMETRY_VARIO_SOURCE_ALTI);
cb->addItem(tr("Alti+"), TELEMETRY_VARIO_SOURCE_ALTI_PLUS);
cb->addItem(tr("VSpeed"), TELEMETRY_VARIO_SOURCE_VSPEED);
cb->addItem(tr("A1"), TELEMETRY_VARIO_SOURCE_A1);
cb->addItem(tr("A2"), TELEMETRY_VARIO_SOURCE_A2);
if (IS_TARANIS(firmware->getBoard())) {
cb->addItem(tr("dTE"), TELEMETRY_VARIO_SOURCE_DTE);
}
}
void TelemetryPanel::populateVoltsSource()
+1
View File
@@ -60,6 +60,7 @@ class TelemetryCustomScreen: public ModelPanel
private slots:
void on_screenType_currentIndexChanged(int index);
void scriptNameEdited();
void customFieldChanged(int index);
void barSourceChanged(int index);
void barMinChanged(double value);
+112 -11
View File
@@ -62,7 +62,16 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="rssiLayout" columnstretch="0,0,1">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="2" column="0">
@@ -269,7 +278,16 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A1Layout">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
@@ -294,7 +312,16 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A2Layout">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
@@ -322,14 +349,23 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_39">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout_66" columnstretch="1,0,0,0">
<layout class="QGridLayout" name="gridLayout_66" columnstretch="1,1,1,1,1">
<item row="0" column="0">
<widget class="QLabel" name="VarioLabel_1">
<property name="sizePolicy">
@@ -488,6 +524,32 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="VarioLabel_6">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Center Silent</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="AutoCheckBox" name="varioCenterSilent">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
@@ -511,7 +573,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="AutoComboBox" name="varioSourceCB">
<widget class="AutoComboBox" name="varioSource">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -545,7 +607,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_40">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
@@ -616,7 +687,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
@@ -867,10 +947,19 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="sensorsLayout" columnstretch="0">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<item row="0" column="0">
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="sensorsLabel">
<property name="font">
<font>
@@ -883,6 +972,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="AutoCheckBox" name="ignoreSensorIds">
<property name="text">
<string>Disable multi sensor handling</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -920,6 +1016,11 @@
<extends>QComboBox</extends>
<header>autocombobox.h</header>
</customwidget>
<customwidget>
<class>AutoCheckBox</class>
<extends>QCheckBox</extends>
<header>autocheckbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>telemetryProtocol</tabstop>
@@ -927,7 +1028,7 @@
<tabstop>rssiAlarm1SB</tabstop>
<tabstop>rssiAlarm2CB</tabstop>
<tabstop>rssiAlarm2SB</tabstop>
<tabstop>varioSourceCB</tabstop>
<tabstop>varioSource</tabstop>
<tabstop>varioLimitMin_DSB</tabstop>
<tabstop>varioLimitCenterMin_DSB</tabstop>
<tabstop>varioLimitCenterMax_DSB</tabstop>
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>283</width>
<height>86</height>
<width>915</width>
<height>305</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,7 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="screenScript" stretch="0,0,1">
<layout class="QHBoxLayout" name="screenScript" stretch="0,0,0,1">
<item>
<widget class="QLabel" name="screenTypeLabel">
<property name="sizePolicy">
@@ -52,7 +52,14 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_16">
<widget class="QComboBox" name="scriptName">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -70,7 +77,7 @@
<widget class="QGroupBox" name="screenBars">
<layout class="QGridLayout" name="screenBarsLayout" columnstretch="1,0,1,0">
<item row="0" column="1">
<widget class="QLabel" name="label_266">
<widget class="QLabel" name="minLabel">
<property name="text">
<string>Min</string>
</property>
@@ -80,7 +87,7 @@
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_265">
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Source</string>
</property>
@@ -90,7 +97,7 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_267">
<widget class="QLabel" name="gaugeLabel">
<property name="text">
<string>Gauge</string>
</property>
@@ -100,7 +107,7 @@
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_268">
<widget class="QLabel" name="maxLabel">
<property name="text">
<string>Max</string>
</property>
+22 -22
View File
@@ -272,7 +272,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Amps Sensor :</string>
<string>Sensor :</string>
</property>
</widget>
</item>
@@ -366,82 +366,82 @@
</item>
<item>
<property name="text">
<string>Voltage (V)</string>
<string>V</string>
</property>
</item>
<item>
<property name="text">
<string>Current (A)</string>
<string>A</string>
</property>
</item>
<item>
<property name="text">
<string>Current (mA)</string>
<string>mA</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (kts)</string>
<string>kt</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (m/s)</string>
<string>m/s</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (ft/s)</string>
<string>ft/s</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (km/h)</string>
<string>km/h</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (miles/h)</string>
<string>mph</string>
</property>
</item>
<item>
<property name="text">
<string>Meters (m)</string>
<string>m</string>
</property>
</item>
<item>
<property name="text">
<string>Feet (ft)</string>
<string>ft</string>
</property>
</item>
<item>
<property name="text">
<string>Temp (°C)</string>
<string>°C</string>
</property>
</item>
<item>
<property name="text">
<string>Temp (°F)</string>
<string>°F</string>
</property>
</item>
<item>
<property name="text">
<string>Percentage (%)</string>
<string>%</string>
</property>
</item>
<item>
<property name="text">
<string>Energy (mAh)</string>
<string>mAh</string>
</property>
</item>
<item>
<property name="text">
<string>Power (W)</string>
<string>W</string>
</property>
</item>
<item>
<property name="text">
<string>RF Power (dBm)</string>
<string>dBm</string>
</property>
</item>
<item>
@@ -451,22 +451,22 @@
</item>
<item>
<property name="text">
<string>Acceleration (g)</string>
<string>g</string>
</property>
</item>
<item>
<property name="text">
<string>Heading (°)</string>
<string>°</string>
</property>
</item>
<item>
<property name="text">
<string>Volume (mL)</string>
<string>mL</string>
</property>
</item>
<item>
<property name="text">
<string>Volume (US fl.Oz.)</string>
<string>US fl.Oz.</string>
</property>
</item>
</widget>
@@ -512,7 +512,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Range</string>
<string>Ratio</string>
</property>
</widget>
</item>
+648
View File
@@ -0,0 +1,648 @@
#include "helpers.h"
#include "modelprinter.h"
#include <QPainter>
QString changeColor(const QString & input, const QString & to, const QString & from)
{
QString result = input;
return result.replace("color="+from, "color="+to);
}
ModelPrinter::ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model):
firmware(firmware),
generalSettings(generalSettings),
model(model)
{
}
ModelPrinter::~ModelPrinter()
{
foreach(QString filename, curvefiles) {
qunlink(filename);
}
}
void debugHtml(const QString & html)
{
QFile file("foo.html");
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
file.write(html.toUtf8());
file.close();
}
QString addFont(const QString & input, const QString & color, const QString & size, const QString & face)
{
QString colorStr;
if (!color.isEmpty()) {
colorStr = "color=" + color;
}
QString sizeStr;
if (!size.isEmpty()) {
sizeStr = "size=" + size;
}
QString faceStr;
if (!face.isEmpty()) {
faceStr = "face='" + face + "'";
}
return "<font " + sizeStr + " " + faceStr + " " + colorStr + ">" + input + "</font>";
}
QString ModelPrinter::printEEpromSize()
{
return tr("%1 bytes").arg(GetEepromInterface()->getSize(model));
}
QString ModelPrinter::printChannelName(int idx)
{
return tr("CH%1").arg(idx+1, 2, 10, QChar('0'));
}
QString ModelPrinter::printOutputName(int idx)
{
QString name = QString(model.limitData[idx].name).trimmed();
if (firmware->getCapability(HasChNames) && !name.isEmpty()) {
return name;
}
else {
return "";
}
}
QString ModelPrinter::printTrimIncrementMode()
{
switch (model.trimInc) {
case -2:
return tr("Exponential");
case -1:
return tr("Extra Fine");
case 0:
return tr("Fine");
case 1:
return tr("Medium");
case 2:
return tr("Coarse");
default:
return tr("Unknown");
}
}
QString ModelPrinter::printThrottleTrimMode()
{
return model.thrTrim ? tr("Enabled") : tr("Disabled");
}
QString ModelPrinter::printModuleProtocol(unsigned int protocol)
{
static const char *strings[] = { "OFF",
"PPM",
"Silverlit A", "Silverlit B", "Silverlit C",
"CTP1009",
"LP45", "DSM2", "DSMX",
"PPM16", "PPMsim",
"FrSky XJT (D16)", "FrSky XJT (D8)", "FrSky XJT (LR12)", "FrSky DJT",
};
return CHECK_IN_ARRAY(strings, protocol);
}
QString ModelPrinter::printModule(int idx)
{
const ModuleData & module = model.moduleData[idx];
if (module.protocol == PULSES_OFF)
return printModuleProtocol(module.protocol);
else if (module.protocol == PULSES_PPM)
return tr("%1, Channels(%2-%3), PPM delay(%4usec), Pulse polarity(%5)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
else {
QString result = tr("%1, Channels(%2-%3)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount);
if (module.protocol != PULSES_PXX_XJT_D8) {
result += " " + tr("Receiver number(%1)").arg(module.modelId);
}
return result;
}
}
QString ModelPrinter::printTrainerMode()
{
QString result;
switch (model.trainerMode) {
case 1:
result = tr("Slave/Jack"); // TODO + tr(": Channel start: %1, %2 Channels, %3usec Delay, Pulse polarity %4").arg(module.channelsStart+1).arg(module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
break;
case 2:
result = tr("Master/SBUS Module");
break;
case 3:
result = tr("Master/CPPM Module");
break;
case 4:
result = tr("Master/SBUS in battery compartment");
break;
default:
result = tr("Master/Jack");
}
return result;
}
QString ModelPrinter::printCenterBeep()
{
QStringList strl;
if (model.beepANACenter & 0x01)
strl << tr("Rudder");
if (model.beepANACenter & 0x02)
strl << tr("Elevator");
if (model.beepANACenter & 0x04)
strl << tr("Throttle");
if (model.beepANACenter & 0x08)
strl << tr("Aileron");
if (IS_TARANIS(firmware->getBoard())) {
if (model.beepANACenter & 0x10)
strl << "S1";
if (model.beepANACenter & 0x20)
strl << "S2";
if (model.beepANACenter & 0x40)
strl << "S3";
if (model.beepANACenter & 0x80)
strl << "LS";
if (model.beepANACenter & 0x100)
strl << "RS";
}
else {
if (model.beepANACenter & 0x10)
strl << "P1";
if (model.beepANACenter & 0x20)
strl << "P2";
if (model.beepANACenter & 0x40)
strl << "P3";
}
return strl.join(", ");
}
QString ModelPrinter::printTimer(int idx)
{
return printTimer(model.timers[idx]);
}
QString ModelPrinter::printTimer(const TimerData & timer)
{
QStringList result;
if (firmware->getCapability(TimersName) && timer.name[0])
result += tr("Name(%1)").arg(timer.name);
result += QString("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
result += timer.mode.toString();
if (timer.persistent)
result += tr("Persistent");
if (timer.minuteBeep)
result += tr("MinuteBeep");
if (timer.countdownBeep == TimerData::COUNTDOWN_BEEPS)
result += tr("CountDown(Beeps)");
else if (timer.countdownBeep == TimerData::COUNTDOWN_VOICE)
result += tr("CountDown(Voice)");
else if (timer.countdownBeep == TimerData::COUNTDOWN_HAPTIC)
result += tr("CountDown(Haptic)");
return result.join(", ");
}
QString ModelPrinter::printTrim(int flightModeIndex, int stickIndex)
{
const FlightModeData & fm = model.flightModeData[flightModeIndex];
if (fm.trimMode[stickIndex] == -1) {
return tr("Off");
}
else {
if (fm.trimRef[stickIndex] == flightModeIndex) {
return QString("%1").arg(fm.trim[stickIndex]);
}
else {
if (fm.trimMode[stickIndex] == 0) {
return tr("FM%1").arg(fm.trimRef[stickIndex]);
}
else {
if (fm.trim[stickIndex] < 0)
return tr("FM%1%2").arg(fm.trimRef[stickIndex]).arg(fm.trim[stickIndex]);
else
return tr("FM%1+%2").arg(fm.trimRef[stickIndex]).arg(fm.trim[stickIndex]);
}
}
}
}
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]);
}
else {
int num = fm.gvars[gvarIndex] - 1025;
if (num >= flightModeIndex) num++;
return tr("FM%1").arg(num);
}
}
QString ModelPrinter::printRotaryEncoder(int flightModeIndex, int reIndex)
{
const FlightModeData & fm = model.flightModeData[flightModeIndex];
if (fm.rotaryEncoders[reIndex] <= 1024) {
return QString("%1").arg(fm.rotaryEncoders[reIndex]);
}
else {
int num = fm.rotaryEncoders[reIndex] - 1025;
if (num >= flightModeIndex) num++;
return tr("FM%1").arg(num);
}
}
QString ModelPrinter::printInputName(int idx)
{
QString result;
if (firmware->getCapability(VirtualInputs)) {
if (strlen(model.inputNames[idx]) > 0) {
result = tr("[I%1]").arg(idx+1);
result += QString(model.inputNames[idx]);
}
else {
result = tr("Input%1").arg(idx+1, 2, 10, QChar('0'));
}
}
else {
result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model);
}
return Qt::escape(result);
}
QString ModelPrinter::printInputLine(int idx)
{
return printInputLine(model.expoData[idx]);
}
QString ModelPrinter::printInputLine(const ExpoData & input)
{
QString str = "&nbsp;";
switch (input.mode) {
case (1): str += "&lt;-&nbsp;"; break;
case (2): str += "-&gt;&nbsp;"; break;
default: str += "&nbsp;&nbsp;&nbsp;"; break;
}
if (firmware->getCapability(VirtualInputs)) {
str += Qt::escape(input.srcRaw.toString(&model));
}
str += " " + Qt::escape(tr("Weight")) + QString("(%1)").arg(getGVarString(input.weight,true));
if (input.curve.value) str += " " + Qt::escape(input.curve.toString());
QString flightModesStr = printFlightModes(input.flightModes);
if (!flightModesStr.isEmpty()) str += " " + Qt::escape(flightModesStr);
if (input.swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(tr("Switch")) + QString("(%1)").arg(input.swtch.toString());
if (firmware->getCapability(VirtualInputs)) {
if (input.carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
else if (input.carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model));
}
if (firmware->getCapability(HasExpoNames) && input.name[0])
str += Qt::escape(QString(" [%1]").arg(input.name));
return str;
}
QString ModelPrinter::printMixerName(int curDest)
{
QString str = printChannelName(curDest-1) + " ";
if (firmware->getCapability(HasChNames)) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
str += name.left(8);
}
return Qt::escape(str);
}
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
{
return printMixerLine(model.mixData[idx], highlightedSource, showMultiplex);
}
QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, int highlightedSource)
{
QString str = "&nbsp;";
if (showMultiplex) {
switch(mix.mltpx) {
case (1): str += "*="; break;
case (2): str += ":="; break;
default: str += "+="; break;
}
}
else {
str += "&nbsp;&nbsp;";
}
// highlight source if needed
QString source = Qt::escape(mix.srcRaw.toString(&model));
if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {
source = "<b>" + source + "</b>";
}
str += "&nbsp;" + source;
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(mix.weight, true)));
QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty())
str += " " + Qt::escape(flightModesStr);
if (mix.swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(tr("Switch(%1)").arg(mix.swtch.toString()));
if (mix.carryTrim > 0)
str += " " + Qt::escape(tr("NoTrim"));
else if (mix.carryTrim < 0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model);
if (firmware->getCapability(HasNoExpo) && mix.noExpo)
str += " " + Qt::escape(tr("No DR/Expo"));
if (mix.sOffset)
str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(mix.sOffset)));
if (mix.curve.value)
str += " " + Qt::escape(mix.curve.toString());
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (mix.delayDown || mix.delayUp)
str += " " + Qt::escape(tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale));
if (mix.speedDown || mix.speedUp)
str += " " + Qt::escape(tr("Slow((u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale));
if (mix.mixWarn)
str += " " + Qt::escape(tr("Warn(%1)").arg(mix.mixWarn));
if (firmware->getCapability(HasMixerNames) && mix.name[0])
str += Qt::escape(QString(" [%1]").arg(mix.name));
return str;
}
QString ModelPrinter::printFlightModeSwitch(int index)
{
if (index == 0)
return "---";
else if (index > 0) {
return printFlightModeName(index-1);
}
else {
return "!" + printFlightModeName(-index-1);
}
}
QString ModelPrinter::printFlightModeName(int index)
{
const FlightModeData & fm = model.flightModeData[index];
if (strlen(fm.name) > 0) {
return QString("%1").arg(fm.name);
}
else {
return tr("FM%1").arg(index);
}
}
QString ModelPrinter::printFlightModes(unsigned int flightModes)
{
int numFlightModes = firmware->getCapability(FlightModes);
if (numFlightModes && flightModes) {
if (flightModes == (unsigned int)(1<<numFlightModes) - 1) {
return tr("Disabled in all flight modes");
}
else {
QStringList list;
for (int i=0; i<numFlightModes; i++) {
if (!(flightModes & (1<<i))) {
list << printFlightModeName(i);
}
}
if (list.size() > 1)
return tr("Flight modes(%1)").arg(list.join(", "));
else
return tr("Flight mode(%1)").arg(list.join(", "));
}
}
else return "";
}
QString ModelPrinter::printLogicalSwitchLine(int idx)
{
QString result = "";
const LogicalSwitchData & ls = model.logicalSw[idx];
if (!ls.func)
return result;
if (ls.andsw!=0) {
result +="( ";
}
switch (ls.getFunctionFamily()) {
case LS_FAMILY_EDGE:
result += tr("Edge(%1, [%2:%3])").arg(RawSwitch(ls.val1).toString()).arg(ValToTim(ls.val2)).arg(ValToTim(ls.val2+ls.val3));
break;
case LS_FAMILY_STICKY:
result += tr("Sticky(%1, %2)").arg(RawSwitch(ls.val1).toString()).arg(RawSwitch(ls.val2).toString());
break;
case LS_FAMILY_TIMER:
result += tr("Timer(%1, %2)").arg(ValToTim(ls.val1)).arg(ValToTim(ls.val2));
break;
case LS_FAMILY_VOFS: {
RawSource source = RawSource(ls.val1);
RawSourceRange range = source.getRange(&model, generalSettings);
QString res;
if (ls.val1)
res += source.toString(&model);
else
res += "0";
res.remove(" ");
if (ls.func == LS_FN_APOS || ls.func == LS_FN_ANEG)
res = "|" + res + "|";
else if (ls.func == LS_FN_DAPOS)
res = "|d(" + res + ")|";
else if (ls.func == LS_FN_DPOS)
result = "d(" + res + ")";
result += res;
if (ls.func == LS_FN_VEQUAL)
result += " = ";
else if (ls.func == LS_FN_APOS || ls.func == LS_FN_VPOS || ls.func == LS_FN_DPOS || ls.func == LS_FN_DAPOS)
result += " &gt; ";
else if (ls.func == LS_FN_ANEG || ls.func == LS_FN_VNEG)
result += " &lt; ";
else if (ls.func == LS_FN_VALMOSTEQUAL)
result += " ~ ";
else
result += " missing";
result += QString::number(range.step * (ls.val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
break;
}
case LS_FAMILY_VBOOL:
result += RawSwitch(ls.val1).toString();
switch (ls.func) {
case LS_FN_AND:
result += " AND ";
break;
case LS_FN_OR:
result += " OR ";
break;
case LS_FN_XOR:
result += " XOR ";
break;
default:
result += " bar ";
break;
}
result += RawSwitch(ls.val2).toString();
break;
case LS_FAMILY_VCOMP:
if (ls.val1)
result += RawSource(ls.val1).toString(&model);
else
result += "0";
switch (ls.func) {
case LS_FN_EQUAL:
case LS_FN_VEQUAL:
result += " = ";
break;
case LS_FN_NEQUAL:
result += " != ";
break;
case LS_FN_GREATER:
result += " &gt; ";
break;
case LS_FN_LESS:
result += " &lt; ";
break;
case LS_FN_EGREATER:
result += " &gt;= ";
break;
case LS_FN_ELESS:
result += " &lt;= ";
break;
default:
result += " foo ";
break;
}
if (ls.val2)
result += RawSource(ls.val2).toString(&model);
else
result += "0";
break;
}
if (ls.andsw != 0) {
result +=" ) AND ";
result += RawSwitch(ls.andsw).toString();
}
if (firmware->getCapability(LogicalSwitchesExt)) {
if (ls.duration)
result += " " + tr("Duration(%1s)").arg(ls.duration/10.0);
if (ls.delay)
result += " " + tr("Delay(%1s)").arg(ls.delay/10.0);
}
return result;
}
QString ModelPrinter::printCustomFunctionLine(int idx)
{
QString result;
const CustomFunctionData & cf = model.customFn[idx];
if (cf.swtch.type == SWITCH_TYPE_NONE) return result;
result += cf.swtch.toString() + " - ";
result += cf.funcToString() + "(";
result += cf.paramToString(&model) + ")";
if (!cf.repeatToString().isEmpty()) result += " " + cf.repeatToString();
if (!cf.enabledToString().isEmpty()) result += " " + cf.enabledToString();
return result;
}
QString ModelPrinter::printCurve(int idx)
{
QString result;
const CurveData & curve = model.curves[idx];
result += (curve.type == CurveData::CURVE_TYPE_CUSTOM) ? tr("Custom") : tr("Standard");
result += ", [";
if (curve.type == CurveData::CURVE_TYPE_CUSTOM) {
for (int j=0; j<curve.count; j++) {
if (j != 0)
result += ", ";
result += QString("(%1, %2)").arg(curve.points[j].x).arg(curve.points[j].y);
}
}
else {
for (int j=0; j<curve.count; j++) {
if (j != 0)
result += ", ";
result += QString("%1").arg(curve.points[j].y);
}
}
result += "]";
return result;
}
CurveImage::CurveImage():
size(200),
image(size+1, size+1, QImage::Format_RGB32),
painter(&image)
{
painter.setBrush(QBrush("#FFFFFF"));
painter.setPen(QColor(0, 0, 0));
painter.drawRect(0, 0, size, size);
painter.setPen(QColor(0, 0, 0));
painter.drawLine(0, size/2, size, size/2);
painter.drawLine(size/2, 0, size/2, size);
for (int i=0; i<21; i++) {
painter.drawLine(size/2-5, (size*i)/(20), size/2+5, (size*i)/(20));
painter.drawLine((size*i)/(20), size/2-5, (size*i)/(20), size/2+5);
}
}
void CurveImage::drawCurve(const CurveData & curve, QColor color)
{
painter.setPen(QPen(color, 2, Qt::SolidLine));
for (int j=1; j<curve.count; j++) {
if (curve.type == CurveData::CURVE_TYPE_CUSTOM)
painter.drawLine(size/2+(size*curve.points[j-1].x)/200, size/2-(size*curve.points[j-1].y)/200, size/2+(size*curve.points[j].x)/200, size/2-(size*curve.points[j].y)/200);
else
painter.drawLine(size*(j-1)/(curve.count-1), size/2-(size*curve.points[j-1].y)/200, size*(j)/(curve.count-1), size/2-(size*curve.points[j].y)/200);
}
}
void CurveImage::save(const QString & filename)
{
image.save(filename, "png", 100);
}
QString ModelPrinter::createCurveImage(int idx)
{
CurveImage image;
image.drawCurve(model.curves[idx], colors[idx]);
QString filename = generateProcessUniqueTempFileName(QString("curve-%1-%2.png").arg((uint64_t)this).arg(idx));
image.save(filename);
curvefiles << filename;
return filename;
}
QString ModelPrinter::createCurvesImage()
{
CurveImage image;
for (int idx=0; idx<firmware->getCapability(NumCurves); idx++) {
image.drawCurve(model.curves[idx], colors[idx]);
}
QString filename = generateProcessUniqueTempFileName(QString("curves-%1.png").arg((uint64_t)this));
image.save(filename);
curvefiles << filename;
return filename;
}
+73
View File
@@ -0,0 +1,73 @@
#ifndef _MODELPRINTER_H_
#define _MODELPRINTER_H_
#include <QString>
#include <QStringList>
#include <QPainter>
#include "eeprominterface.h"
QString changeColor(const QString & input, const QString & to, const QString & from = "grey");
QString addFont(const QString & input, const QString & color = "", const QString & size = "", const QString & face = "");
void debugHtml(const QString & html);
class CurveImage
{
public:
CurveImage();
void drawCurve(const CurveData & curve, QColor color);
void save(const QString & filename);
protected:
int size;
QImage image;
QPainter painter;
};
class ModelPrinter: public QObject
{
Q_OBJECT
public:
ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model);
virtual ~ModelPrinter();
QString printEEpromSize();
QString printTrimIncrementMode();
QString printThrottleTrimMode();
static QString printModuleProtocol(unsigned int protocol);
QString printFlightModeSwitch(int index);
QString printFlightModeName(int index);
QString printFlightModes(unsigned int flightModes);
QString printModule(int idx);
QString printTrainerMode();
QString printCenterBeep();
QString printTrim(int flightModeIndex, int stickIndex);
QString printGlobalVar(int flightModeIndex, int gvarIndex);
QString printRotaryEncoder(int flightModeIndex, int reIndex);
QString printTimer(int idx);
QString printTimer(const TimerData & timer);
QString printInputName(int idx);
QString printInputLine(int idx);
QString printInputLine(const ExpoData & ed);
QString printMixerName(int curDest);
QString printMixerLine(int idx, bool showMultiplex, int highlightedSource = 0);
QString printMixerLine(const MixData & md, bool showMultiplex, int highlightedSource = 0);
QString printLogicalSwitchLine(int idx);
QString printCustomFunctionLine(int idx);
static QString printChannelName(int idx);
QString printOutputName(int idx);
QString printCurve(int idx);
QString createCurvesImage();
QString createCurveImage(int idx);
private:
Firmware * firmware;
const GeneralSettings & generalSettings;
const ModelData & model;
QStringList curvefiles;
};
#endif // _MODELPRINTER_H_
+16 -10
View File
@@ -78,13 +78,14 @@ ModelsListWidget::ModelsListWidget(QWidget *parent):
void ModelsListWidget::ShowContextMenu(const QPoint& pos)
{
QPoint globalPos = this->mapToGlobal(pos);
QPoint globalPos = this->mapToGlobal(pos);
QMenu contextMenu;
if (((MdiChild *)parent())->getCurrentRow() > 0) {
// context menu for model
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
bool hasData = mimeData->hasFormat("application/x-companion");
QMenu contextMenu;
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(EditModel()));
contextMenu.addAction(CompanionIcon("open.png"), tr("&Restore from backup"),this,SLOT(LoadBackup()));
contextMenu.addAction(CompanionIcon("wizard.png"), tr("&Model Wizard"),this,SLOT(OpenWizard()));
@@ -100,7 +101,12 @@ void ModelsListWidget::ShowContextMenu(const QPoint& pos)
contextMenu.addAction(CompanionIcon("print.png"), tr("P&rint model"),this, SLOT(print()),QKeySequence(tr("Ctrl+P")));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("simulate.png"), tr("&Simulate model"),this, SLOT(simulate()),tr("Alt+S"));
contextMenu.exec(globalPos);
}
else {
// context menu for radio settings
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(EditModel()));
}
contextMenu.exec(globalPos);
}
void ModelsListWidget::EditModel()
@@ -137,7 +143,7 @@ void ModelsListWidget::setdefault()
{
if (currentRow()==0) return;
unsigned int currModel = currentRow() - 1;
if (!radioData->models[currModel].isempty() && radioData->generalSettings.currModel != currModel) {
if (!radioData->models[currModel].isEmpty() && radioData->generalSettings.currModel != currModel) {
radioData->generalSettings.currModel = currModel;
refreshList();
((MdiChild *)parent())->setModified();
@@ -289,7 +295,7 @@ void ModelsListWidget::refreshList()
{
QString item = QString().sprintf("%02d: ", i+1);
if (!radioData->models[i].isempty()) {
if (!radioData->models[i].isEmpty()) {
if (eepromInterface && IS_SKY9X(eepromInterface->getBoard())) {
if (radioData->models[i].name[0]==0) {
QString modelname="Model";
@@ -357,7 +363,7 @@ void ModelsListWidget::deleteSelected(bool ask=true)
QMessageBox::StandardButton ret = QMessageBox::Yes;
if(ask) {
foreach(QModelIndex index, this->selectionModel()->selectedIndexes()) {
if (index.row()>0 && !radioData->models[index.row()-1].isempty()) {
if (index.row()>0 && !radioData->models[index.row()-1].isEmpty()) {
isModel=true;
selModel=index.row()-1;
}
@@ -459,7 +465,7 @@ void ModelsListWidget::doPaste(QByteArray *gmData, int index)
i += sizeof(GeneralSettings);
}
else { //model data
if (!radioData->models[id-1].isempty()) {
if (!radioData->models[id-1].isEmpty()) {
ret = QMessageBox::question(this, "Companion", tr("You are pasting on an not empty model, are you sure?"),
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
@@ -515,7 +521,7 @@ void ModelsListWidget::duplicate()
{
ModelData *model = &radioData->models[i-1];
while(i<GetEepromInterface()->getMaxModels()) {
if (radioData->models[i].isempty()) {
if (radioData->models[i].isEmpty()) {
radioData->models[i] = *model;
((MdiChild *)parent())->setModified();
break;
@@ -575,7 +581,7 @@ void ModelsListWidget::viableModelSelected(int idx)
else if (idx<1)
((MdiChild*)parent())->viableModelSelected(false);
else
((MdiChild*)parent())->viableModelSelected(!radioData->models[currentRow()-1].isempty());
((MdiChild*)parent())->viableModelSelected(!radioData->models[currentRow()-1].isEmpty());
}
+497
View File
@@ -0,0 +1,497 @@
#include "helpers.h"
#include "helpers_html.h"
#include "multimodelprinter.h"
#include <algorithm>
MultiModelPrinter::MultiColumns::MultiColumns(int count):
count(count),
compareColumns(NULL)
{
columns = new QString[count];
}
MultiModelPrinter::MultiColumns::~MultiColumns()
{
delete[] columns;
}
void MultiModelPrinter::MultiColumns::append(const QString & str)
{
for (int i=0; i<count; i++) {
append(i, str);
}
}
void MultiModelPrinter::MultiColumns::appendTitle(const QString & name)
{
append("<b>" + name + "</b>&nbsp;");
}
void MultiModelPrinter::MultiColumns::append(int idx, const QString & str)
{
if (compareColumns)
compareColumns[idx].append(str);
else
columns[idx].append(str);
}
void MultiModelPrinter::MultiColumns::beginCompare()
{
compareColumns = new QString[count];
}
void MultiModelPrinter::MultiColumns::endCompare(const QString & color)
{
for (int i=0; i<count; i++) {
QString cellColor = color;
if (i==0 && count>1 && compareColumns[0]!=compareColumns[1])
cellColor = "green";
else if (i>0 && compareColumns[i]!=compareColumns[0])
cellColor = "red";
columns[i].append(QString("<font color='%1'>%2</font>").arg(cellColor).arg(compareColumns[i]));
}
delete[] compareColumns;
compareColumns = NULL;
}
template <class T>
void MultiModelPrinter::MultiColumns::append(int idx, T val)
{
append(idx, QString("%1").arg(val));
}
QString MultiModelPrinter::MultiColumns::print()
{
QString result = "<tr>";
for (int i=0; i<count; i++) {
result.append(QString("<td width='%1%'>%2</td>").arg(100.0/count).arg(columns[i]));
}
result.append("</tr>");
return result;
}
bool MultiModelPrinter::MultiColumns::isEmpty()
{
for (int i=0; i<count; i++) {
if (!columns[i].isEmpty())
return false;
}
return true;
}
#define COMPARE(what) \
columns.beginCompare(); \
for (int cc=0; cc<models.size(); cc++) { \
ModelPrinter * modelPrinter = modelPrinters[cc]; \
ModelData * model = models[cc]; \
(void)(model); (void)(modelPrinter); \
columns.append(cc, (what)); \
} \
columns.endCompare();
QString MultiModelPrinter::printTitle(const QString & label)
{
return QString("<tr><td colspan='%1'><h2>").arg(modelPrinters.count()) + label + "</h2></td></tr>";
}
MultiModelPrinter::MultiModelPrinter(Firmware * firmware):
firmware(firmware)
{
}
MultiModelPrinter::~MultiModelPrinter()
{
for(int i=0; i<modelPrinters.size(); i++) {
delete modelPrinters[i];
}
}
void MultiModelPrinter::setModel(int idx, const ModelData & model)
{
int count = std::max(models.size(), idx+1);
models.resize(count);
modelPrinters.resize(count);
if (modelPrinters[idx]) {
// free existing model printer
delete modelPrinters[idx];
modelPrinters[idx] = 0;
}
models[idx] = (ModelData *)&model; // TODO remove cast
modelPrinters[idx] = new ModelPrinter(firmware, defaultSettings, model);
}
QString MultiModelPrinter::print()
{
QString str = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-family: monospace;'>";
str += printSetup();
if (firmware->getCapability(FlightModes))
str += printFlightModes();
str += printInputs();
str += printMixers();
str += printLimits();
str += printCurves();
if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes))
str += printGvars();
str += printLogicalSwitches();
str += printCustomFunctions();
str += printTelemetry();
str += "</table>";
return str;
}
QString MultiModelPrinter::printSetup()
{
QString str = printTitle(tr("General Model Settings"));
MultiColumns columns(models.size());
columns.appendTitle(tr("Name:"));
COMPARE(model->name);
columns.append("<br/>");
columns.appendTitle(tr("EEprom Size:"));
COMPARE(modelPrinter->printEEpromSize());
columns.append("<br/>");
for (int i=0; i<firmware->getCapability(Timers); i++) {
columns.appendTitle(tr("Timer%1:").arg(i+1));
COMPARE(modelPrinter->printTimer(i));
columns.append("<br/>");
}
for (int i=0; i<firmware->getCapability(NumModules); i++) {
columns.appendTitle(firmware->getCapability(NumModules) > 1 ? tr("Module%1:").arg(i+1) : tr("Module:"));
COMPARE(modelPrinter->printModule(i));
columns.append("<br/>");
}
if (IS_TARANIS(firmware->getBoard())) {
columns.appendTitle(tr("Trainer port:"));
COMPARE(modelPrinter->printTrainerMode());
columns.append("<br/>");
}
columns.appendTitle(tr("Throttle Trim:"));
COMPARE(modelPrinter->printThrottleTrimMode());
columns.append("<br/>");
columns.appendTitle(tr("Trim Increment:"));
COMPARE(modelPrinter->printTrimIncrementMode());
columns.append("<br/>");
columns.appendTitle(tr("Center Beep:"));
COMPARE(modelPrinter->printCenterBeep());
str.append(columns.print());
return str;
}
QString MultiModelPrinter::printFlightModes()
{
QString str = printTitle(tr("Flight modes"));
// Trims
{
MultiColumns columns(models.size());
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
columns.append("<tr>");
columns.append("<td><b>" + tr("Flight mode") + "</b></td>");
columns.append("<td><b>" + tr("Switch") + "</b></td>");
columns.append("<td><b>" + tr("Fade IN") + "</b></td>");
columns.append("<td><b>" + tr("Fade OUT") + "</b></td>");
for (int i=0; i<NUM_STICKS; i++) {
columns.append("<td><b>" + AnalogString(i) + " trim</b></td>");
}
columns.append("</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);
columns.append("</td><td>");
COMPARE(model->flightModeData[i].swtch.toString());
columns.append("</td><td>");
COMPARE(model->flightModeData[i].fadeIn);
columns.append("</td><td>");
COMPARE(model->flightModeData[i].fadeOut);
columns.append("</td>");
for (int k=0; k<NUM_STICKS; k++) {
columns.append("<td>");
COMPARE(modelPrinter->printTrim(i, k));
columns.append("</td>");
}
columns.append("</tr>");
}
columns.append("</table>");
str.append(columns.print());
}
// GVars and Rotary Encoders
int gvars = firmware->getCapability(Gvars);
if ((gvars && firmware->getCapability(GvarsFlightModes)) || firmware->getCapability(RotaryEncoders)) {
MultiColumns columns(models.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>");
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>");
}
}
for (int i=0; i<firmware->getCapability(RotaryEncoders); i++) {
columns.append("<td><b>" + tr("RE%1").arg(i+1) + "</b></td>");
}
columns.append("</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);
columns.append("</td>");
if (firmware->getCapability(GvarsFlightModes)) {
for (int k=0; k<gvars; k++) {
columns.append("<td>");
COMPARE(modelPrinter->printGlobalVar(i, k));
columns.append("</td>");
}
}
for (int k=0; k<firmware->getCapability(RotaryEncoders); k++) {
columns.append("<td>");
COMPARE(modelPrinter->printRotaryEncoder(i, k));
columns.append("</td>");
}
columns.append("</tr>");
}
columns.append("</table>");
str.append(columns.print());
}
return str;
}
QString MultiModelPrinter::printLimits()
{
QString str = printTitle(tr("Limits"));
MultiColumns columns(models.size());
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>" \
"<tr>" \
" <td><b>" + tr("Channel") + "</b></td>" \
" <td><b>" + (firmware->getCapability(HasChNames) ? tr("Name") : "") + "</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>");
for (int i=0; i<firmware->getCapability(Outputs); i++) {
columns.append("<tr><td><b>");
COMPARE(modelPrinter->printChannelName(i));
columns.append("</b></td><td>");
COMPARE(modelPrinter->printOutputName(i));
columns.append("</td><td>");
COMPARE(model->limitData[i].offsetToString());
columns.append("</td><td>");
COMPARE(model->limitData[i].minToString());
columns.append("</td><td>");
COMPARE(model->limitData[i].maxToString());
columns.append("</td><td>");
COMPARE(model->limitData[i].revertToString());
columns.append("</td></tr>");
}
columns.append("</table>");
str.append(columns.print());
return str;
}
QString MultiModelPrinter::printGvars()
{
QString str = printTitle(tr("Global Variables"));
int gvars = firmware->getCapability(Gvars);
MultiColumns columns(models.size());
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'><tr>");
for (int i=0; i<gvars; i++) {
columns.append(QString("<td><b>") + tr("GV%1").arg(i+1) + "</b></td>");
}
columns.append("</tr><tr>");
for (int i=0; i<gvars; i++) {
columns.append("<td>");
COMPARE(model->flightModeData[0].gvars[i]);
columns.append("</td>");
}
columns.append("</tr>");
str.append(columns.print());
return str;
}
QString MultiModelPrinter::printInputs()
{
QString str = printTitle(tr("Inputs"));
MultiColumns columns(models.size());
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
for (int i=0; i<std::max(4, firmware->getCapability(VirtualInputs)); i++) {
int count = 0;
for (int k=0; k<models.size(); k++) {
count = std::max(count, models[k]->expos(i).size());
}
if (count > 0) {
columns.append("<tr><td width='20%'><b>");
COMPARE(modelPrinter->printInputName(i));
columns.append("</b></td><td>");
for (int j=0; j<count; j++) {
if (j > 0)
columns.append("<br/>");
COMPARE(j<model->expos(i).size() ? modelPrinter->printInputLine(*model->expos(i)[j]) : "");
}
columns.append("</td></tr>");
}
}
str.append(columns.print());
return str;
}
QString MultiModelPrinter::printMixers()
{
QString str = printTitle(tr("Mixers"));
MultiColumns columns(models.size());
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
for (int i=0; i<firmware->getCapability(Outputs); i++) {
int count = 0;
for (int k=0; k<models.size(); k++) {
count = std::max(count, models[k]->mixes(i).size());
}
if (count > 0) {
columns.append("<tr><td width='20%'><b>");
COMPARE(modelPrinter->printMixerName(i+1));
columns.append("</b></td><td>");
for (int j=0; j<count; j++) {
if (j > 0)
columns.append("<br/>");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j], (j>0)) : "&nbsp;");
}
columns.append("</td></tr>");
}
}
str.append(columns.print());
return str;
}
QString MultiModelPrinter::printCurves()
{
QString str;
MultiColumns columns(models.size());
int count = 0;
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
for (int i=0; i<firmware->getCapability(NumCurves); i++) {
bool curveEmpty = true;
for (int k=0; k<models.size(); k++) {
if (!models[k]->curves[i].isEmpty()) {
curveEmpty = false;
break;
}
}
if (!curveEmpty) {
count++;
columns.append("<tr><td width='20%'><b>" + tr("CV%1").arg(i+1) + "</b></td><td>");
COMPARE(modelPrinter->printCurve(i));
for (int k=0; k<models.size(); k++)
columns.append(k, QString("<br/><img src='%1' border='0' />").arg(modelPrinters[k]->createCurveImage(i)));
columns.append("</td></tr>");
}
}
columns.append("</table><br/>");
if (count > 0) {
str.append(printTitle(tr("Curves")));
str.append(columns.print());
}
return str;
}
QString MultiModelPrinter::printLogicalSwitches()
{
QString str;
MultiColumns columns(models.size());
int count = 0;
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
bool lsEmpty = true;
for (int k=0; k<models.size(); k++) {
if (!modelPrinters[k]->printLogicalSwitchLine(i).isEmpty()) {
lsEmpty = false;
break;
}
}
if (!lsEmpty) {
count++;
columns.append("<tr><td width='20%'><b>" + tr("L%1").arg(i+1) + "</b></td><td>");
COMPARE(modelPrinter->printLogicalSwitchLine(i));
columns.append("</td></tr>");
}
}
columns.append("</table>");
if (count > 0) {
str.append(printTitle(tr("Logical Switches")));
str.append(columns.print());
}
return str;
}
QString MultiModelPrinter::printCustomFunctions()
{
QString str;
MultiColumns columns(models.size());
int count = 0;
columns.append("<table cellspacing='0' cellpadding='1' width='100%' border='0' style='border-collapse:collapse'>");
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
bool sfEmpty = true;
for (int k=0; k<models.size(); k++) {
if (!modelPrinters[k]->printCustomFunctionLine(i).isEmpty()) {
sfEmpty = false;
break;
}
}
if (!sfEmpty) {
count++;
columns.append("<tr><td width='20%'><b>" + tr("SF%1").arg(i+1) + "</b></td><td>");
COMPARE(modelPrinter->printCustomFunctionLine(i));
columns.append("</td></tr>");
}
}
columns.append("</table>");
if (count > 0) {
str.append(printTitle(tr("Special Functions")));
str.append(columns.print());
}
return str;
}
QString MultiModelPrinter::printTelemetry()
{
QString str = printTitle(tr("Telemetry Settings"));
// Analogs on non ARM boards
if (!IS_ARM(firmware->getBoard())) {
MultiColumns columns(models.size());
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'>" \
"<tr><td width='22%'><b>" + tr("Analogs") + "</b></td><td width='26%'><b>" + tr("Unit") + "</b></td><td width='26%'><b>" + tr("Scale") + "</b></td><td width='26%'><b>" + tr("Offset") + "</b></td></tr>");
for (int i=0; i<2; i++) {
columns.append("<tr><td><b>"+tr("A%1").arg(i+1)+"</b></td><td>");
COMPARE(getFrSkyUnits(model->frsky.channels[i].type));
columns.append("</td><td>");
COMPARE(QString::number((model->frsky.channels[i].ratio / (model->frsky.channels[i].type==0 ? 10.0 : 1)), 10, (model->frsky.channels[i].type==0 ? 1 : 0)));
columns.append("</td><td>");
COMPARE(QString::number((model->frsky.channels[i].offset*(model->frsky.channels[i].ratio / (model->frsky.channels[i].type==0 ?10.0 : 1)))/255, 10, (model->frsky.channels[i].type==0 ? 1 : 0)));
columns.append("</td></tr>");
}
columns.append("</table><br/>");
str.append(columns.print());
// TODO I remove the analogs alarms for now
}
// RSSI alarms
{
MultiColumns columns(models.size());
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>");
COMPARE(getFrSkyAlarmType(model->frsky.rssiAlarms[i].level));
columns.append("</td><td>&lt;</td><td>");
COMPARE(QString::number(model->frsky.rssiAlarms[i].value, 10));
columns.append("</td></tr>");
}
columns.append("</table><br/>");
str.append(columns.print());
}
return str;
}
+56
View File
@@ -0,0 +1,56 @@
#ifndef _MULTIMODELPRINTER_H
#define _MULTIMODELPRINTER_H
#include <QObject>
#include "eeprominterface.h"
#include "modelprinter.h"
class MultiModelPrinter: public QObject
{
Q_OBJECT
public:
MultiModelPrinter(Firmware * firmware);
virtual ~MultiModelPrinter();
void setModel(int idx, const ModelData & model);
QString print();
protected:
class MultiColumns {
public:
MultiColumns(int count);
~MultiColumns();
bool isEmpty();
QString print();
void append(const QString & str);
void appendTitle(const QString & name);
void append(int idx, const QString & str);
template <class T> void append(int idx, T val);
void beginCompare();
void endCompare(const QString & color = "grey");
private:
int count;
QString * columns;
QString * compareColumns;
};
Firmware * firmware;
GeneralSettings defaultSettings;
QVector<ModelData *> models; // TODO const
QVector<ModelPrinter *> modelPrinters;
QString printTitle(const QString & label);
QString printSetup();
QString printFlightModes();
QString printLimits();
QString printInputs();
QString printMixers();
QString printCurves();
QString printGvars();
QString printLogicalSwitches();
QString printCustomFunctions();
QString printTelemetry();
};
#endif // _MULTIMODELPRINTER_H
+52 -812
View File
@@ -1,58 +1,27 @@
#include "printdialog.h"
#include "ui_printdialog.h"
#include "helpers.h"
#include "helpers_html.h"
#include "eeprominterface.h"
#include <QtGui>
#include <QImage>
#include <QColor>
#include <QPainter>
#include <QPrinter>
#include <QPrintDialog>
#if !defined WIN32 && defined __GNUC__
#include <unistd.h>
#endif
// #if !defined WIN32 && defined __GNUC__
// #include <unistd.h>
// #endif
#define ISIZE 200 // curve image size
#define ISIZEW 400 // curve image size
PrintDialog::PrintDialog(QWidget *parent, Firmware * firmware, GeneralSettings *gg, ModelData *gm, QString filename) :
PrintDialog::PrintDialog(QWidget *parent, Firmware * firmware, GeneralSettings & generalSettings, ModelData & model, const QString & filename) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
firmware(firmware),
g_eeGeneral(gg),
g_model(gm),
generalSettings(generalSettings),
model(model),
printfilename(filename),
ui(new Ui::PrintDialog),
gvars(firmware->getCapability(Gvars))
multimodelprinter(firmware)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("print.png"));
te = ui->textEdit;
setWindowTitle(tr("Setup for: ") + g_model->name);
te->clear();
QString modelname=g_model->name;
if (modelname.isEmpty()) {
curvefile5=generateProcessUniqueTempFileName("curve5.png");
curvefile9=generateProcessUniqueTempFileName("curve9.png");
}
else {
curvefile5=generateProcessUniqueTempFileName(QString("%1-curve5.png").arg(modelname));
curvefile9=generateProcessUniqueTempFileName(QString("%1-curve9.png").arg(modelname));
}
printSetup();
if (gvars) {
te->append(printFlightModes()+"<br>");
}
printInputs();
printMixes();
printLimits();
printCurves();
printGvars();
printSwitches();
printFSwitches();
printFrSky();
te->scrollToAnchor("1");
setWindowTitle(model.name);
multimodelprinter.setModel(0, model);
ui->textEdit->setHtml(multimodelprinter.print());
if (!printfilename.isEmpty()) {
printToFile();
QTimer::singleShot(0, this, SLOT(autoClose()));
@@ -65,788 +34,59 @@ void PrintDialog::closeEvent(QCloseEvent *event)
PrintDialog::~PrintDialog()
{
// notice PrintDialog::closeEvent() is not called if user clicks on Close button
qunlink(curvefile5);
qunlink(curvefile9);
delete ui;
}
void PrintDialog::printSetup()
{
QString str = "<a name=1></a><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append(QString("<tr><td colspan=%1 ><table border=0 width=\"100%\"><tr><td><h1>").arg((firmware->getCapability(FlightModes) && !gvars) ? 2 : 1));
str.append(g_model->name);
str.append("&nbsp;(");
str.append(firmware->getName());
str.append(")</h1></td><td align=right valign=top NOWRAP><font size=-1>"+tr("printed on: %1").arg(QDateTime::currentDateTime().toString(Qt::SystemLocaleShortDate))+"</font></td></tr></table></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
str.append("<tr><td><h2>"+tr("General Model Settings")+"</h2></td></tr>");
str.append("<tr><td>");
str.append(fv(tr("Name"), g_model->name));
str.append(fv(tr("EEprom Size"), QString("%1").arg(firmware->getEepromInterface()->getSize(*g_model))));
str.append(fv(tr("Timer1"), getTimerStr(g_model->timers[0]))); //value, mode, count up/down
str.append(fv(tr("Timer2"), getTimerStr(g_model->timers[1]))); //value, mode, count up/down
if (firmware->getCapability(NumModules)>1) {
str.append("<b>"+(IS_TARANIS(firmware->getBoard()) ? tr("Internal Radio System") : tr("Radio System") )+"</b><br>&nbsp;&nbsp;"); //proto, numch, delay,
}
str.append(fv(tr("Protocol"), getProtocol(g_model->moduleData[0])));
if (firmware->getCapability(NumModules)>1) {
str.append("<b>"+(IS_TARANIS(firmware->getBoard()) ? tr("External Radio Module") : tr("Extra Radio System"))+"</b><br>&nbsp;&nbsp;"); //proto, numch, delay,
str.append(fv(tr("Protocol"), getProtocol(g_model->moduleData[1])));
}
if (IS_TARANIS(firmware->getBoard())){
str.append(fv(tr("Trainer port mode"), getTrainerMode(g_model->trainerMode, g_model->moduleData[2])));
}
str.append(fv(tr("Throttle Trim"), g_model->thrTrim ? tr("Enabled") : tr("Disabled")));
str.append(fv(tr("Trim Increment"), getTrimInc(g_model)));
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model))); // specify which channels beep
str.append("</td></tr></table></td>");
if (!gvars) {
str.append("<td width=\"380\">");
str.append(printFlightModes());
str.append("</td>");
}
str.append("</tr></table><br>");
te->append(str);
}
QString PrintDialog::printFlightModes()
{
QString str = "";
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(!gvars ? 8+firmware->getCapability(RotaryEncoders) : 8+gvars+firmware->getCapability(RotaryEncoders)));
str.append(tr("Flight modes"));
str.append("</h2></td></tr><tr><td style=\"border-style:none;\">&nbsp;</td><td colspan=2 align=center><b>");
str.append(tr("Fades")+"</b></td>");
str.append("<td colspan=4 align=center><b>"+tr("Trims")+"</b></td>");
if (gvars) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</b></td>");
}
if (firmware->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(firmware->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
}
str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center nowrap><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center ><b>"+tr("IN")+"</b></td><td align=center ><b>"+tr("OUT")+"</b></td>");
QString labels[] = { tr("Rud"), tr("Ele"), tr("Thr"), tr("Ail") }; // TODO is elsewhere for sure
for (int i=0; i<4; i++) {
GeneralSettings generalSettings = *g_eeGeneral;
str.append(QString("<td align=\"center\" nowrap><b>%1</b></td>").arg((QString)labels[CONVERT_MODE(i+1)-1]));
}
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td align=\"center\" nowrap><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i]));
}
for (int i=0; i<firmware->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
}
str.append("</tr>");
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
FlightModeData *pd=&g_model->flightModeData[i];
str.append("<tr><td valign=\"middle\"><b>"+tr("FM")+QString("%1</b> <font size=+1 face='Courier New' color=green>%2</font></td>").arg(i).arg(pd->name));
str.append(QString("<td valign=\"middle\" align=\"right\"><font size=+1 face='Courier New' color=green>%1</font></td>").arg((qreal)pd->fadeIn/firmware->getCapability(SlowScale)));
str.append(QString("<td valign=\"middle\" width=\"30\" align=\"right\"><font size=+1 face='Courier New' color=green>%1</font></td>").arg((qreal)pd->fadeOut/firmware->getCapability(SlowScale)));
for (int k=0; k<4; k++) {
//TODO trim values
if (pd->trimMode[k]==-1) {
str.append(QString("<td valign=\"middle\" align=\"center\"><font size=+1 face='Courier New' color=grey>")+tr("Off")+QString("</font></td>"));
} else {
if (pd->trimRef[k]==i) {
str.append("<td valign=\"middle\" align=\"center\" ><font size=+1 face='Courier New' color=green>"+QString("%1").arg(pd->trim[k])+QString("</font></td>"));
} else {
if (pd->trimMode[k]==0) {
str.append("<td valign=\"middle\" align=\"center\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1").arg(pd->trimRef[k])+QString("</font></td>"));
} else {
str.append("<td valign=\"middle\" align=\"center\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1+").arg(pd->trimRef[k])+QString("<br>%1").arg(pd->trim[k])+QString("</font></td>"));
}
}
}
}
for (unsigned int k=0; k<gvars; k++) {
if (pd->gvars[k]<=1024) {
str.append(QString("<td align=\"right\" valign=\"middle\"><font size=+1 face='Courier New' color=green>%1").arg(pd->gvars[k])+"</font></td>");
}
else {
int num = pd->gvars[k] - 1025;
if (num>=i) num++;
str.append("<td align=\"right\" valign=\"middle\"><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(num));
}
}
for (int k=0; k<firmware->getCapability(RotaryEncoders); k++) {
if (pd->rotaryEncoders[k]<=1024) {
str.append(QString("<td align=\"right\" valign=\"middle\"><font size=+1 face='Courier New' color=green>%1").arg(pd->rotaryEncoders[k])+"</font></td>");
}
else {
int num = pd->rotaryEncoders[k] - 1025;
if (num>=i) num++;
str.append(QString("<td align=\"right\" valign=\"middle\"><font size=+1 face='Courier New' color=green>")+tr("FM")+QString("%1</font></td>").arg(num));
}
}
str.append(QString("<td align=center valign=\"middle\"><font size=+1 face='Courier New' color=green>%1</font></td>").arg(pd->swtch.toString()));
str.append("</tr>");
}
str.append("</table>");
return(str);
}
void PrintDialog::printInputs()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td><h2>";
str.append(tr("Inputs"));
str.append("</h2></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
int ec=0;
unsigned int lastCHN = 255;
for(int i=0; i<C9X_MAX_EXPOS; i++) {
ExpoData *ed=&g_model->expoData[i];
if(ed->mode==0)
continue;
ec++;
str.append("<tr><td><font size=+1 face='Courier New'>");
if(lastCHN!=ed->chn) {
lastCHN=ed->chn;
str.append("<b>"+getInputStr(g_model, ed->chn)+"</b>");
}
str.append("</font></td>");
str.append("<td><font size=+1 face='Courier New' color=green>");
switch(ed->mode) {
case (1):
str += "&lt;-";
break;
case (2):
str += "-&gt;";
break;
default:
str += "&nbsp;&nbsp;";
break;
};
str += "&nbsp;" + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString(g_model));
if (ed->carryTrim>0) str += " " + tr("NoTrim");
else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(g_model);
}
if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
if (firmware->getCapability(FlightModes)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<<firmware->getCapability(FlightModes))-1) {
unsigned int mask=1;
bool first = true;
bool multiple = false;
QString strModes;
for (int j=0; j<firmware->getCapability(FlightModes);j++) {
if (!(ed->phases & mask)) {
//FlightModeData *pd = &g_model->flightModeData[j];
const char * pdName = g_model->flightModeData[j].name;
if (first) {
strModes += Qt::escape(QString("%1").arg(getPhaseName(j+1,pdName)));
first = false;
} else {
strModes += Qt::escape(QString(", %1").arg(getPhaseName(j+1, pdName)));
multiple = true;
}
}
mask <<= 1;
}
if (!strModes.isEmpty()) {
str += " " + tr(multiple?"Flight modes":"Flight mode") + "(" + strModes + ")";
}
} else {
str += tr("DISABLED")+QString(" !!!");
}
}
}
if (ed->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
if (firmware->getCapability(HasExpoNames) && ed->name[0]) str += Qt::escape(QString(" [%1]").arg(ed->name));
str += "</font></td></tr>";
}
str += "</table></td></tr></table><br>";
if (ec>0)
te->append(str);
}
void PrintDialog::printMixes()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Mixers"));
str.append("</h2></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=3>");
unsigned int lastCHN = 255;
for(int i=0; i<firmware->getCapability(Mixes); i++) {
MixData *md = &g_model->mixData[i];
if(!md->destCh || md->destCh>(unsigned int)firmware->getCapability(Outputs) ) break;
str.append("<tr><td><font size=+1 face='Courier New'><b>");
if(lastCHN!=md->destCh) {
lastCHN=md->destCh;
QString chname = QObject::tr("CH%1").arg(lastCHN);
// TODO not nice, Qt brings a function for that, I don't remember right now
(chname.length() < 4) ? chname.append(" ") : chname.append(" ");
if (firmware->getCapability(HasChNames)) {
QString name = g_model->limitData[lastCHN-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
chname += name.left(8);
}
chname = Qt::escape(chname);
str.append(chname.replace(" ", "&nbsp;"));
}
else {
str.append("&nbsp;");
}
str.append("</b></font></td>");
str.append("<td><font size=+1 face='Courier New' color=green>");
switch(md->mltpx) {
case (1): str += "&nbsp;*"; break;
case (2): str += "&nbsp;R"; break;
default: str += "&nbsp;&nbsp;"; break;
};
str += " " + md->srcRaw.toString(g_model);
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
QString phasesStr = getPhasesStr(md->phases, g_model);
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
if (md->swtch.type != SWITCH_TYPE_NONE) {
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
}
if (md->carryTrim>0)
str += " " + Qt::escape(tr("NoTrim"));
else if (md->carryTrim<0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(g_model);
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
if (md->delayDown || md->delayUp)
str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
if (md->mixWarn)
str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
if (!MixerName.isEmpty()) {
str += " " + Qt::escape(QString("(%1)").arg(MixerName));
}
}
str.append("</font></td></tr>");
}
str.append("</table></td></tr></table><br>");
te->append(str);
}
void PrintDialog::printLimits()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
int numcol;
numcol=(firmware->getCapability(Outputs)+1)>17 ? 17:firmware->getCapability(Outputs)+1;
str.append(QString("<tr><td colspan=%1><h2>").arg(numcol)+tr("Limits")+"</h2></td></tr>");
str.append("<tr><td>&nbsp;</td>");
if (firmware->getCapability(Outputs)<17) {
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name, "green"));
}
}
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].offsetToString(), "green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].minToString(), "green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].maxToString(), "green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=0; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
}
} else {
for(int i=0; i<16; i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(g_model->limitData[i].name,"green"));
}
}
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].min/10),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].max/10),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=0; i<16; i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
}
str.append("</tr>");
str.append(QString("<tr><td colspan=%1>&nbsp;").arg(numcol)+"</td></tr>");
str.append("<tr><td>&nbsp;</td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
}
str.append("</tr>");
if (firmware->getCapability(HasChNames)) {
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(g_model->limitData[i].name,"green"));
}
}
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].min/10),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString::number((qreal)g_model->limitData[i].max/10),"green"));
}
str.append("</tr>");
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
for(int i=16; i<firmware->getCapability(Outputs); i++) {
str.append(doTR(QString(g_model->limitData[i].revert ? tr("INV") : tr("NOR")),"green"));
}
}
str.append("</tr>");
str.append("</table>");
str.append("<br>");
te->append(str);
}
void PrintDialog::printCurves()
{
int i,r,g,b,c,count,usedcurves=0;
char buffer[16];
QPen pen(Qt::black, 2, Qt::SolidLine);
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-before:auto;\" width=\"100%\"><tr><td><h2>";
str.append(tr("Curves"));
str.append("</h2></td></tr><tr><td>");
int numcurves=firmware->getCapability(NumCurves);
if (numcurves==0) {
numcurves=16;
}
QImage qi(ISIZEW+1,ISIZEW+1,QImage::Format_RGB32);
QPainter painter(&qi);
painter.setBrush(QBrush("#FFFFFF"));
painter.setPen(QColor(0,0,0));
painter.drawRect(0,0,ISIZEW,ISIZEW);
str.append("<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">"+QString("<tr><td width=\"400\"><img src=\"%1\" border=0></td><td><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">").arg(curvefile5));
for(i=0; i<numcurves; i++) {
pen.setColor(colors[usedcurves]);
painter.setPen(pen);
colors[usedcurves].getRgb(&r,&g,&b);
c=r;
c*=256;
c+=g;
c*=256;
c+=b;
sprintf(buffer,"%06x",c);
int curvepoints=g_model->curves[i].count;
count=0;
for(int j=0; j<curvepoints; j++) {
if (g_model->curves[i].points[j].y!=0)
count++;
}
if ((count>0) || (g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM)|| (g_model->curves[i].count !=5)) {
if(usedcurves%2 == 0) str.append("<tr>");
str.append(QString("<td width=\"70\"><font color=#%1><b>").arg(buffer)+tr("Curve")+QString(" %1</b></font></td>").arg(i+1));
if(usedcurves%2) str.append("</tr>");
usedcurves++;
}
}
if (!(usedcurves%2)) str.append("</tr>");
if (usedcurves!=0) {
str.append("</table></td></tr><tr><td colspan=2><table border=1 cellspacing=0 cellpadding=3 width=\"100%\">");
str.append("<tr>");
str.append(doTC("&nbsp;"));
str.append(doTC("&nbsp;"));
int numpoint=0;
for(i=0; i<numcurves; i++) {
if (g_model->curves[i].count>numpoint)
numpoint=g_model->curves[i].count;
}
for(i=0; i<numpoint; i++)
str.append(doTC(tr("pt %1").arg(i+1), "", true));
str.append("</tr>");
for(i=0; i<numcurves; i++) {
int curvepoints=g_model->curves[i].count;
count=0;
for(int j=0; j<curvepoints; j++) {
if (g_model->curves[i].points[j].y!=0)
count++;
}
if ((count>0) || (g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM)) {
pen.setColor(colors[i]);
painter.setPen(pen);
colors[i].getRgb(&r,&g,&b);
c=r;
c*=256;
c+=g;
c*=256;
c+=b;
sprintf(buffer,"%06x",c);
str.append("<tr>");
if (g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM)
str.append(QString("<td width=\"70\" rowspan=2 valign=middle><font color=#%1><b>").arg(buffer)+tr("Curve")+QString(" %1</b></font></td><td width=5>Y</td>").arg(i+1));
else
str.append(QString("<td width=\"70\"><font color=#%1><b>").arg(buffer)+tr("Curve")+QString(" %1</b></font></td><td width=5>Y</td>").arg(i+1));
for(int j=0; j<curvepoints; j++) {
str.append(doTR(QString::number(g_model->curves[i].points[j].y),"green"));
if (j>0 && (count!=0 ||(g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM))) {
if (g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM)
painter.drawLine(ISIZEW/2+(ISIZEW*g_model->curves[i].points[j-1].x)/200,ISIZEW/2-(ISIZEW*g_model->curves[i].points[j-1].y)/200,ISIZEW/2+(ISIZEW*g_model->curves[i].points[j].x)/200,ISIZEW/2-(ISIZEW*g_model->curves[i].points[j].y)/200);
else
painter.drawLine(ISIZEW*(j-1)/(curvepoints-1),ISIZEW/2-(ISIZEW*g_model->curves[i].points[j-1].y)/200,ISIZEW*(j)/(curvepoints-1),ISIZEW/2-(ISIZEW*g_model->curves[i].points[j].y)/200);
}
}
for(int j=curvepoints; j<numpoint; j++) {
str.append(doTR("","green"));
}
str.append("</tr>");
if (g_model->curves[i].type == CurveData::CURVE_TYPE_CUSTOM) {
str.append("<tr><td width=5>X</td>");
for(int j=0; j<curvepoints; j++) {
str.append(doTR(QString::number(g_model->curves[i].points[j].x),"green"));
}
for(int j=curvepoints; j<numpoint; j++) {
str.append(doTR("","green"));
}
str.append("</tr>");
}
}
}
str.append("</table></td></tr></table></td></tr></table>");
str.append("<br>");
painter.setPen(QColor(0,0,0));
painter.drawLine(0,ISIZEW/2,ISIZEW,ISIZEW/2);
painter.drawLine(ISIZEW/2,0,ISIZEW/2,ISIZEW);
for(i=0; i<21; i++) {
painter.drawLine(ISIZEW/2-5,(ISIZEW*i)/(20),ISIZEW/2+5,(ISIZEW*i)/(20));
painter.drawLine((ISIZEW*i)/(20),ISIZEW/2-5,(ISIZEW*i)/(20),ISIZEW/2+5);
}
qi.save(curvefile5, "png",100);
te->append(str);
}
}
void PrintDialog::printSwitches()
{
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3>");
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
if (g_model->logicalSw[i].func) {
str.append("<tr>");
str.append("<td width=\"60\"><b>"+tr("L")+QString("%1</b></td>").arg(i+1));
QString tstr = g_model->logicalSw[i].toString(*g_model, *g_eeGeneral);
str.append(doTL(tstr,"green"));
str.append("</tr>");
sc++;
}
}
str.append("</table></td></tr></table>");
str.append("<br>");
if (sc!=0)
te->append(str);
}
void PrintDialog::printGvars()
{
if (!firmware->getCapability(GvarsFlightModes) && gvars) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=3 width=100>");
FlightModeData *pd=&g_model->flightModeData[0];
int width = 100/gvars;
str.append("<tr>");
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=green>").arg(width)+QString("%1</font></td>").arg(pd->gvars[i]));
}
str.append("</tr>");
str.append("</table></td></tr></table>");
str.append("<br>");
te->append(str);
}
}
void PrintDialog::printFSwitches()
{
int sc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Special Functions")+"</h2></td></tr>");
str.append("<tr><td><table border=0 cellspacing=0 cellpadding=3><tr>");
str.append("<td width=\"60\"><b>#</b></td>");
str.append(doTL(tr("Switch"), "", true));
str.append(doTL(tr("Function"), "", true));
str.append(doTL(tr("Parameter"), "", true));
str.append(doTL(tr("Repeat"), "", true));
str.append(doTL(tr("Enabled"), "", true));
str.append("</tr>");
for(int i=0; i<firmware->getCapability(CustomFunctions); i++) {
if (g_model->customFn[i].swtch.type!=SWITCH_TYPE_NONE) {
str.append("<tr>");
str.append(doTL(tr("SF%1").arg(i+1),"", true));
str.append(doTL(g_model->customFn[i].swtch.toString(),"green"));
str.append(doTL(g_model->customFn[i].funcToString(),"green"));
str.append(doTL(g_model->customFn[i].paramToString(),"green"));
int index=g_model->customFn[i].func;
if ((g_model->customFn[i].repeatParam>0) &&
(index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic)) {
str.append(doTL(QString("%1").arg(g_model->customFn[i].repeatParam),"green"));
} else {
str.append(doTL( "&nbsp;","green"));
}
if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) {
str.append(doTL((g_model->customFn[i].enabled ? "ON" : "OFF"),"green"));
} else {
str.append(doTL( "---","green"));
}
str.append("</tr>");
sc++;
}
}
str.append("</table></td></tr></table>");
str.append("<br>");
if (sc!=0)
te->append(str);
}
void PrintDialog::printFrSky()
{
int tc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
str.append("<tr><td colspan=3><h2>"+tr("Telemetry Settings")+"</h2></td></tr>");
str.append("<tr>");
str.append(doTC(tr("Analog"),"", true));
str.append(doTC(tr("Range"),"", true));
str.append(doTC(tr("Offset"),"", true));
str.append("</tr>");
FrSkyData *fd=&g_model->frsky;
for (int i=0; i<2; i++) {
if (fd->channels[i].ratio!=0) {
tc++;
float ratio=(fd->channels[i].ratio/(fd->channels[i].type==0 ?10.0:1));
QString unit = " " + getFrSkyUnits(fd->channels[i].type);
str.append("<tr>");
str.append(doTL(tr("A%1").arg(i+1), "", true));
str.append(doTC(QString::number(ratio,10,(fd->channels[i].type==0 ? 1:0))+unit, "green"));
str.append(doTC(QString::number((fd->channels[i].offset*ratio)/255,10,(fd->channels[i].type==0 ? 1:0))+unit, "green"));
str.append("</tr>");
}
}
str.append("<tr><td colspan=3 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr>");
str.append(doTC(tr("Alarms"),"", true));
str.append(doTC(tr("Low Alarm"),"", true));
str.append(doTC(tr("Critical Alarm"),"", true));
str.append("</tr>");
str.append("<tr>");
str.append(doTL(tr("RSSI"),"", true));
str.append(doTC(QString::number(fd->rssiAlarms[0].value,10),"green"));
str.append(doTC(QString::number(fd->rssiAlarms[1].value,10),"green"));
str.append("</tr>");
for (int i=0; i<2; i++) {
if (fd->channels[i].ratio!=0) {
float ratio=(fd->channels[i].ratio/(fd->channels[i].type==0 ?10.0:1));
QString unit = " " + getFrSkyUnits(fd->channels[i].type);
str.append("<tr>");
str.append(doTL(tr("A%1").arg(i+1), "", true));
str.append(doTC(QString::number(ratio*(fd->channels[i].alarms[0].value/255.0+fd->channels[i].offset/255.0),10,(fd->channels[i].type==0 ? 1:0))+unit, "green"));
str.append(doTC(QString::number(ratio*(fd->channels[i].alarms[1].value/255.0+fd->channels[i].offset/255.0),10,(fd->channels[i].type==0 ? 1:0))+unit, "green"));
str.append("</tr>");
}
}
//TODO preferrably in new tables
str.append("<tr><td colspan=3 align=\"Left\" height=\"4px\"></td></tr>");
//str.append("<tr><td align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=2 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>");
//str.append("<tr><td align=\"Left\"><b>"+tr("Units system")+"</b></td><td colspan=2 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
str.append("<tr><td align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=2 align=\"left\">"+QString("%1").arg(fd->blades)+"</td></tr>");
str.append("<tr><td align=\"Left\" height=\"4px\"></td></tr></table>");
}
else { //other boards
str.append("<tr><td colspan=10><h2>"+tr("Telemetry Settings")+"</h2></td></tr>");
str.append("<tr><td colspan=4 align=\"center\">&nbsp;</td><td colspan=3 align=\"center\"><b>"+tr("Alarm 1")+"</b></td><td colspan=3 align=\"center\"><b>"+tr("Alarm 2")+"</b></td></tr>");
str.append("<tr><td align=\"center\"><b>"+tr("Analog")+"</b></td><td align=\"center\"><b>"+tr("Unit")+"</b></td><td align=\"center\"><b>"+tr("Scale")+"</b></td><td align=\"center\"><b>"+tr("Offset")+"</b></td>");
str.append("<td width=\"40\" align=\"center\"><b>"+tr("Type")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Condition")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Value")+"</b></td>");
str.append("<td width=\"40\" align=\"center\"><b>"+tr("Type")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Condition")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Value")+"</b></td></tr>");
FrSkyData *fd=&g_model->frsky;
for (int i=0; i<2; i++) {
if (fd->channels[i].ratio!=0) {
tc++;
float ratio=(fd->channels[i].ratio/(fd->channels[i].type==0 ?10.0:1));
str.append("<tr><td align=\"center\"><b>"+tr("A%1").arg(i+1)+"</b></td><td align=\"center\"><font color=green>"+getFrSkyUnits(fd->channels[i].type)+"</font></td><td align=\"center\"><font color=green>"+QString::number(ratio,10,(fd->channels[i].type==0 ? 1:0))+"</font></td><td align=\"center\"><font color=green>"+QString::number((fd->channels[i].offset*ratio)/255,10,(fd->channels[i].type==0 ? 1:0))+"</font></td>");
str.append("<td width=\"40\" align=\"center\"><font color=green>"+getFrSkyAlarmType(fd->channels[i].alarms[0].level)+"</font></td>");
str.append("<td width=\"40\" align=\"center\"><font color=green>");
str.append((fd->channels[i].alarms[0].greater==1) ? "&gt;" : "&lt;");
str.append("</font></td><td width=\"40\" align=\"center\"><font color=green>"+QString::number(ratio*(fd->channels[i].alarms[0].value/255.0+fd->channels[i].offset/255.0),10,(fd->channels[i].type==0 ? 1:0))+"</font></td>");
str.append("<td width=\"40\" align=\"center\"><font color=green>"+getFrSkyAlarmType(fd->channels[i].alarms[1].level)+"</font></td>");
str.append("<td width=\"40\" align=\"center\"><font color=green>");
str.append((fd->channels[i].alarms[1].greater==1) ? "&gt;" : "&lt;");
str.append("</font></td><td width=\"40\" align=\"center\"><font color=green>"+QString::number(ratio*(fd->channels[i].alarms[1].value/255.0+fd->channels[i].offset/255.0),10,(fd->channels[i].type==0 ? 1:0))+"</font></td></tr>");
}
}
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr><td colspan=4 align=\"center\" rowspan=2>&nbsp;</td><td colspan=3 align=\"center\"><b>"+tr("Alarm 1")+"</b></td><td colspan=3 align=\"center\"><b>"+tr("Alarm 2")+"</b></td></tr>");
str.append("<tr><td width=\"40\" align=\"center\"><b>"+tr("Type")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Condition")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Value")+"</b></td>");
str.append("<td width=\"40\" align=\"center\"><b>"+tr("Type")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Condition")+"</b></td><td width=\"40\" align=\"center\"><b>"+tr("Value")+"</b></td></tr>");
str.append("<tr><td align=\"Left\" colspan=4><b>"+tr("RSSI Alarm")+"</b></td>");
str.append("<td width=\"40\" align=\"center\"><b>"+getFrSkyAlarmType(fd->rssiAlarms[0].level)+"</b></td><td width=\"40\" align=\"center\"><b>&lt;</b></td><td width=\"40\" align=\"center\"><b>"+QString::number(fd->rssiAlarms[0].value,10)+"</b></td>");
str.append("<td width=\"40\" align=\"center\"><b>"+getFrSkyAlarmType(fd->rssiAlarms[1].level)+"</b></td><td width=\"40\" align=\"center\"><b>&lt;</b></td><td width=\"40\" align=\"center\"><b>"+QString::number(fd->rssiAlarms[1].value,10)+"</b></td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
}
#if 0
if (firmware->getCapability(TelemetryBars) || (firmware->getCapability(TelemetryCSFields))) {
int cols=firmware->getCapability(TelemetryColsCSFields);
if (cols==0) cols=2;
for (int j=0; j<firmware->getCapability(TelemetryCSFields)/(4*cols); j++ ) {
if (fd->screens[j].type==0) {
if (cols==2) {
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=3 align=\"Left\"><b>"+tr("Custom Telemetry View")+"</b></td></tr>");
} else {
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=5 align=\"Left\"><b>"+tr("Custom Telemetry View")+"</b></td></tr>");
}
for (int r=0; r<4; r++) {
str.append("<tr>");
for (int c=0; c<cols; c++) {
if (fd->screens[j].body.lines[r].source[c]!=0)
tc++;
if (cols==2) {
str.append("<td align=\"Center\" width=\"45%\"><b>"+getFrSkySrc(fd->screens[j].body.lines[r].source[c])+"</b></td>");
} else {
str.append("<td align=\"Center\" width=\"30%\"><b>"+getFrSkySrc(fd->screens[j].body.lines[r].source[c])+"</b></td>");
}
if (c<(cols-1)) {
if (cols==2) {
str.append("<td align=\"Center\" width=\"10%\"><b>&nbsp;</b></td>");
} else {
str.append("<td align=\"Center\" width=\"5%\"><b>&nbsp;</b></td>");
}
}
}
str.append("</tr>");
}
str.append("</table>");
} else {
str.append("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=4 align=\"Left\"><b>"+tr("Telemetry Bars")+"</b></td></tr>");
str.append("<tr><td align=\"Center\"><b>"+tr("Bar Number")+"</b></td><td align=\"Center\"><b>"+tr("Source")+"</b></td><td align=\"Center\"><b>"+tr("Min")+"</b></td><td align=\"Center\"><b>"+tr("Max")+"</b></td></tr>");
for (int i=0; i<4; i++) {
if (fd->screens[j].body.bars[i].source!=0)
tc++;
// TODO str.append("<tr><td align=\"Center\"><b>"+QString::number(i+1,10)+"</b></td><td align=\"Center\"><b>"+getFrSkySrc(fd->screens[j].body.bars[i].source)+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source, fd->screens[j].body.bars[i].barMin,fd)):"----")+"</b></td><td align=\"Right\"><b>"+(fd->screens[j].body.bars[i].source>0 ? QString::number(getBarValue(fd->screens[j].body.bars[i].source,(255-fd->screens[j].body.bars[i].barMax),fd)) :"----")+"</b></td></tr>");
}
str.append("</table>");
}
}
}
#endif
if (tc>0)
te->append(str);
}
void PrintDialog::on_printButton_clicked()
{
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
QPrintDialog *dialog = new QPrintDialog(&printer, this);
dialog->setWindowTitle(tr("Print Document"));
if (dialog->exec() != QDialog::Accepted)
return;
te->print(&printer);
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
QPrintDialog *dialog = new QPrintDialog(&printer, this);
dialog->setWindowTitle(tr("Print Document"));
if (dialog->exec() != QDialog::Accepted)
return;
ui->textEdit->print(&printer);
}
void PrintDialog::on_printFileButton_clicked()
{
QString fn = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),tr("ODF files (*.odt);;PDF Files(*.pdf);;HTML-Files (*.htm *.html);;All Files (*)"));
if (fn.isEmpty())
return;
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".pdf", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
fn += ".pdf"; // default
if (fn.endsWith(".pdf", Qt::CaseInsensitive)) {
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setColorMode(QPrinter::Color);
printer.setOutputFileName(fn);
te->print(&printer);
} else {
QTextDocumentWriter writer(fn);
writer.write(te->document());
}
QString fn = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),tr("ODF files (*.odt);;PDF Files(*.pdf);;HTML-Files (*.htm *.html);;All Files (*)"));
if (fn.isEmpty())
return;
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".pdf", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
fn += ".pdf"; // default
if (fn.endsWith(".pdf", Qt::CaseInsensitive)) {
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setColorMode(QPrinter::Color);
printer.setOutputFileName(fn);
ui->textEdit->print(&printer);
}
else {
QTextDocumentWriter writer(fn);
writer.write(ui->textEdit->document());
}
}
void PrintDialog::printToFile()
{
if (printfilename.isEmpty())
return;
if (! (printfilename.endsWith(".odt", Qt::CaseInsensitive) || printfilename.endsWith(".pdf", Qt::CaseInsensitive) || printfilename.endsWith(".htm", Qt::CaseInsensitive) || printfilename.endsWith(".html", Qt::CaseInsensitive)) )
printfilename += ".pdf"; // default
if (printfilename.endsWith(".pdf", Qt::CaseInsensitive)) {
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setColorMode(QPrinter::Color);
printer.setOutputFileName(printfilename);
te->print(&printer);
} else {
QTextDocumentWriter writer(printfilename);
writer.write(te->document());
}
if (printfilename.isEmpty())
return;
if (! (printfilename.endsWith(".odt", Qt::CaseInsensitive) || printfilename.endsWith(".pdf", Qt::CaseInsensitive) || printfilename.endsWith(".htm", Qt::CaseInsensitive) || printfilename.endsWith(".html", Qt::CaseInsensitive)) )
printfilename += ".pdf"; // default
if (printfilename.endsWith(".pdf", Qt::CaseInsensitive)) {
QPrinter printer;
printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setColorMode(QPrinter::Color);
printer.setOutputFileName(printfilename);
ui->textEdit->print(&printer);
}
else {
QTextDocumentWriter writer(printfilename);
writer.write(ui->textEdit->document());
}
}
void PrintDialog::autoClose()
+13 -31
View File
@@ -1,10 +1,9 @@
#ifndef PRINTDIALOG_H
#define PRINTDIALOG_H
#ifndef _PRINTDIALOG_H
#define _PRINTDIALOG_H
#include <QDialog>
#include <QtGui>
#include <QDir>
#include "eeprominterface.h"
#include "multimodelprinter.h"
namespace Ui {
class PrintDialog;
@@ -14,44 +13,27 @@ class PrintDialog : public QDialog
{
Q_OBJECT
public:
explicit PrintDialog(QWidget *parent, Firmware * firmware, GeneralSettings *gg, ModelData *gm, QString filename="");
public:
PrintDialog(QWidget * parent, Firmware * firmware, GeneralSettings & generalSettings, ModelData & model, const QString & filename="");
~PrintDialog();
void closeEvent(QCloseEvent *event);
void closeEvent(QCloseEvent * event);
Firmware * firmware;
GeneralSettings * g_eeGeneral;
ModelData * g_model;
GeneralSettings & generalSettings;
ModelData & model;
QString printfilename;
private:
protected:
Ui::PrintDialog *ui;
unsigned int gvars;
MultiModelPrinter multimodelprinter; // TODO multimodelPrinter
void printSetup();
QString printFlightModes();
void printInputs();
void printMixes();
void printLimits();
void printCurves();
void printGvars();
void printSwitches();
void printSafetySwitches();
void printFSwitches();
void printFrSky();
void printToFile();
QTextEdit * te;
QString curvefile5;
QString curvefile9;
QDir *qd;
private slots:
private slots:
void on_printButton_clicked();
void on_printFileButton_clicked();
void autoClose();
};
#endif // PRINTDIALOG_H
#endif // _PRINTDIALOG_H
+98 -90
View File
@@ -5,119 +5,127 @@
#include <QMessageBox>
#include <QTextStream>
#include <QDebug>
#include <QEventLoop>
#include <QTimer>
SyncProcess::SyncProcess(const QString &folder1, const QString &folder2, ProgressWidget *progress):
folder1(folder1),
folder2(folder2),
progress(progress),
simulation(false),
index(0)
SyncProcess::SyncProcess(const QString & folder1, const QString & folder2, ProgressWidget * progress):
folder1(folder1),
folder2(folder2),
progress(progress),
index(0),
count(0),
closed(false)
{
connect(progress, SIGNAL(stopped()),this, SLOT(onClosed()));
}
void SyncProcess::run()
void SyncProcess::onClosed()
{
simulation = true;
index = 0;
if (synchronize()) {
int count = index;
progress->setMaximum(count);
simulation = false;
index = 0;
synchronize();
progress->setValue(count);
}
closed = true;
}
bool SyncProcess::synchronize()
bool SyncProcess::run()
{
if (!QFile::exists(folder1)) {
QMessageBox::warning(NULL, QObject::tr("Synchronization error"), QObject::tr("The directory '%1' doesn't exist!").arg(folder1));
return false;
return true;
}
if (!QFile::exists(folder2)) {
QMessageBox::warning(NULL, QObject::tr("Synchronization error"), QObject::tr("The directory '%1' doesn't exist!").arg(folder2));
return false;
return true;
}
count = getFilesCount(folder1) + getFilesCount(folder2);
progress->setMaximum(count);
QStringList errors = updateDir(folder1, folder2) + updateDir(folder2, folder1);
if (errors.count() > 0) {
QMessageBox::warning(NULL, QObject::tr("Synchronization error"), errors.join("\n"));
return false;
}
return true;
// don't close the window unless the user wanted
return closed;
}
QStringList SyncProcess::updateDir(const QDir &source, const QDir &destination)
int SyncProcess::getFilesCount(const QString & directory)
{
int result = 0;
QDirIterator it(directory, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
result++;
}
return result;
}
QStringList SyncProcess::updateDir(const QString & source, const QString & destination)
{
QDirIterator it(source, QDirIterator::Subdirectories);
while (it.hasNext()) {
if (!simulation) {
progress->setValue(index);
}
QString path = it.next();
// qDebug() << path;
QFileInfo sourceInfo(path);
QString relativePath = source.relativeFilePath(path);
QString destinationPath = destination.absoluteFilePath(relativePath);
QFileInfo destinationInfo(destinationPath);
if (sourceInfo.isDir()) {
if (!destinationInfo.exists()) {
++index;
if (!simulation) {
progress->addText(tr("Create directory %1\n").arg(destinationPath));
if (!destination.mkdir(relativePath)) {
errors << QObject::tr("Create '%1' failed").arg(destinationPath);
continue;
}
}
}
}
else {
if (!destinationInfo.exists()) {
// qDebug() << "Copy" << path << "to" << destinationPath;
++index;
if (!simulation) {
progress->addText(tr("Copy %1 to %2\n").arg(path).arg(destinationPath));
if (!QFile::copy(path, destinationPath)) {
errors << QObject::tr("Copy '%1' to '%2' failed").arg(path).arg(destinationPath);
continue;
}
}
}
else if (sourceInfo.lastModified() > destinationInfo.lastModified()) {
++index;
if (!simulation) {
progress->addText(tr("Read %1\n").arg(path));
// retrieve source contents
QFile sourceFile(path);
if (!sourceFile.open(QFile::ReadOnly)) {
errors << QObject::tr("Open '%1' failed").arg(path);
continue;
}
QString sourceContents = sourceFile.readAll();
sourceFile.close();
// try to retrieve destination contents
QFile destinationFile(path);
if (destinationFile.open(QFile::ReadOnly)) {
QString destinationContents = destinationFile.readAll();
destinationFile.close();
if (sourceContents == destinationContents) {
// qDebug() << "Skip" << path;
continue;
}
}
if (!destinationFile.open(QFile::WriteOnly)) {
errors << QObject::tr("Write '%1' failed").arg(destinationPath);
continue;
}
progress->addText(tr("Write %1\n").arg(destinationPath));
// qDebug() << "Write" << destinationPath;
QTextStream destinationStream(&destinationFile);
destinationStream << sourceContents;
destinationFile.close();
}
}
while (!closed && it.hasNext()) {
QEventLoop loop;
QTimer::singleShot(10, &loop, SLOT(quit()));
loop.exec();
index++;
progress->setInfo(tr("%1/%2 files").arg(index).arg(count));
progress->setValue(index);
QString result = updateEntry(it.next(), source, destination);
if (!result.isEmpty()) {
errors << result;
}
}
return errors;
}
QString SyncProcess::updateEntry(const QString & path, const QDir & source, const QDir & destination)
{
QFileInfo sourceInfo(path);
QString relativePath = source.relativeFilePath(path);
QString destinationPath = destination.absoluteFilePath(relativePath);
QFileInfo destinationInfo(destinationPath);
if (sourceInfo.isDir()) {
if (!destinationInfo.exists()) {
progress->addText(tr("Create directory %1\n").arg(destinationPath));
if (!destination.mkdir(relativePath)) {
return QObject::tr("Create '%1' failed").arg(destinationPath);
}
}
}
else {
if (!destinationInfo.exists()) {
// qDebug() << "Copy" << path << "to" << destinationPath;
progress->addText(tr("Copy %1 to %2\n").arg(path).arg(destinationPath));
if (!QFile::copy(path, destinationPath)) {
return QObject::tr("Copy '%1' to '%2' failed").arg(path).arg(destinationPath);
}
}
else if (sourceInfo.lastModified() > destinationInfo.lastModified()) {
// retrieve source contents
QFile sourceFile(path);
if (!sourceFile.open(QFile::ReadOnly)) {
return QObject::tr("Open '%1' failed").arg(path);
}
QString sourceContents = sourceFile.readAll();
sourceFile.close();
// try to retrieve destination contents
QFile destinationFile(path);
if (destinationFile.open(QFile::ReadOnly)) {
QString destinationContents = destinationFile.readAll();
destinationFile.close();
if (sourceContents == destinationContents) {
// qDebug() << "Skip" << path;
return QString();
}
}
if (!destinationFile.open(QFile::WriteOnly)) {
return QObject::tr("Write '%1' failed").arg(destinationPath);
}
progress->addText(tr("Write %1\n").arg(destinationPath));
// qDebug() << "Write" << destinationPath;
QTextStream destinationStream(&destinationFile);
destinationStream << sourceContents;
destinationFile.close();
}
}
return QString();
}
+18 -14
View File
@@ -1,7 +1,6 @@
#ifndef SYNCPROCESS_H_
#define SYNCPROCESS_H_
#include <QObject>
#include <QString>
#include <QStringList>
@@ -10,21 +9,26 @@ class ProgressWidget;
class SyncProcess : public QObject
{
Q_OBJECT
Q_OBJECT
public:
SyncProcess(const QString &folder1, const QString &folder2, ProgressWidget *progress);
void run();
public:
SyncProcess(const QString & folder1, const QString & folder2, ProgressWidget * progress);
bool run();
protected:
bool synchronize();
QStringList updateDir(const QDir &source, const QDir &destination);
QString folder1;
QString folder2;
ProgressWidget *progress;
QStringList errors;
bool simulation;
int index;
protected slots:
void onClosed();
protected:
int getFilesCount(const QString & directory);
QStringList updateDir(const QString & source, const QString & destination);
QString updateEntry(const QString & path, const QDir & source, const QDir & destination);
QString folder1;
QString folder2;
ProgressWidget * progress;
QStringList errors;
int index;
int count;
bool closed;
};
#endif /* SYNCPROCESS_H_ */
+2 -1
View File
@@ -23,7 +23,7 @@ ProgressDialog::~ProgressDialog()
delete ui;
}
ProgressWidget *ProgressDialog::progress()
ProgressWidget * ProgressDialog::progress()
{
return ui->outputProgress;
}
@@ -31,6 +31,7 @@ ProgressWidget *ProgressDialog::progress()
void ProgressDialog::on_closeButton_clicked()
{
if (!locked) {
ui->outputProgress->stop();
close();
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ public:
ProgressDialog(QWidget *parent, const QString &label, const QIcon &icon, bool forceOpen=false);
~ProgressDialog();
ProgressWidget *progress();
ProgressWidget * progress();
private slots:
void on_closeButton_clicked();
+5
View File
@@ -29,6 +29,11 @@ ProgressWidget::~ProgressWidget()
delete ui;
}
void ProgressWidget::stop()
{
emit stopped();
}
void ProgressWidget::forceOpen()
{
ui->checkBox->hide();
+2
View File
@@ -24,10 +24,12 @@ class ProgressWidget : public QWidget
void setProgressColor(const QColor &color);
void addSeparator();
void forceOpen();
void stop();
signals:
void detailsToggled();
void locked(bool);
void stopped();
protected slots:
void on_checkBox_toggled(bool checked);
+1 -1
View File
@@ -29,7 +29,7 @@ class AutoCheckBox: public QCheckBox
{
lock = true;
if (field) {
setChecked((int)*field);
setChecked(*field);
}
lock = false;
}
+16 -1
View File
@@ -13,6 +13,7 @@ class AutoComboBox: public QComboBox
QComboBox(parent),
field(NULL),
panel(NULL),
next(0),
lock(false)
{
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
@@ -22,10 +23,23 @@ class AutoComboBox: public QComboBox
{
lock = true;
QComboBox::clear();
next = 0;
lock = false;
}
void addItem(const QString & item, int value)
virtual void insertItems(int index, const QStringList & items)
{
foreach(QString item, items) {
addItem(item);
}
}
virtual void addItem(const QString & item)
{
addItem(item, next++);
}
virtual void addItem(const QString & item, int value)
{
lock = true;
QComboBox::addItem(item, value);
@@ -78,6 +92,7 @@ class AutoComboBox: public QComboBox
protected:
int * field;
GenericPanel * panel;
int next;
bool lock;
};
+2 -3
View File
@@ -483,8 +483,7 @@ void SimulatorDialog::initUi(T * ui)
line = (i-16) % (std::min(16,outputs-16)/2);
}
QLabel * label = new QLabel(tabWidget);
ModelData model;
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(&model));
label->setText(RawSource(SOURCE_TYPE_CH, i).toString());
outputTab->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
QSlider * slider = new QSlider(tabWidget);
@@ -546,7 +545,7 @@ void SimulatorDialog::initUi(T * ui)
label->setAutoFillBackground(true);
if ((i % 2) ==0 ) {
label->setStyleSheet("QLabel { background-color: rgb(220, 220, 220) }");
}
}
ui->gvarsLayout->addWidget(label, i+1, 0);
for (int fm=0; fm<fmodes; fm++) {
QLabel * value = new QLabel(tabWidget);
+2 -2
View File
@@ -108,7 +108,7 @@ return main_thread_error;
#ifdef SETTRAINER_IMPORT
#undef SETTRAINER_IMPORT
ppmInValid = 100;
g_ppmIns[inputNumber] = LIMIT< ::int16_t>(-512, value, 512);
ppmInputValidityTimer = 100;
ppmInput[inputNumber] = LIMIT< ::int16_t>(-512, value, 512);
#endif

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