Compare commits

...

235 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
215 changed files with 25356 additions and 23556 deletions
-3
View File
@@ -1,3 +0,0 @@
<a href="http://3drobotics.com">3D Robotics</a>
They sell the Iris+ with a modified version of OpenTX which doesn't fullfil the GPL requirements.
No donations, no thanks, we are just free staff for them...
+26 -3
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
@@ -789,4 +789,27 @@ 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
+1 -1
View File
@@ -1,5 +1,5 @@
##OpenTX 2.1 Branch
The ongoing development is not done in this branch. It is performed in the branch called next.
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.
+28 -1
View File
@@ -1,3 +1,30 @@
<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>
@@ -16,7 +43,7 @@
<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>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>
+9 -5
View File
@@ -2,11 +2,11 @@ PROJECT( companion )
SET(C9X_VERSION_MAJOR "2")
SET(C9X_VERSION_MINOR "1")
SET(C9X_VERSION_REVISION "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})
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -158,6 +158,7 @@ set(companion_SRCS
apppreferencesdialog.cpp
fwpreferencesdialog.cpp
burnconfigdialog.cpp
multimodelprinter.cpp
comparedialog.cpp
contributorsdialog.cpp
releasenotesdialog.cpp
@@ -176,7 +177,7 @@ set(companion_SRCS
fusesdialog.cpp
logsdialog.cpp
downloaddialog.cpp
splashlibrary.cpp
splashlibrarydialog.cpp
mainwindow.cpp
companion.cpp
radionotfound.cpp
@@ -196,7 +197,7 @@ set(companion_MOC_HDRS
releasenotesdialog.h
releasenotesfirmwaredialog.h
customizesplashdialog.h
splashlibrary.h
splashlibrarydialog.h
splashlabel.h
progresswidget.h
progressdialog.h
@@ -212,6 +213,8 @@ set(companion_MOC_HDRS
radionotfound.h
helpers.h
wizarddialog.h
modelprinter.h
multimodelprinter.h
)
set(companion_UIS
@@ -226,7 +229,7 @@ set(companion_UIS
printdialog.ui
htmldialog.ui
customizesplashdialog.ui
splashlibrary.ui
splashlibrarydialog.ui
progresswidget.ui
progressdialog.ui
flashfirmwaredialog.ui
@@ -412,6 +415,7 @@ IF( APPLE )
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}
+18 -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));
@@ -613,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
@@ -629,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
+6 -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);
+22 -29
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>
@@ -912,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>
@@ -974,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>
@@ -989,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>
@@ -1055,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>
@@ -1066,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>
+2 -1
View File
@@ -4,7 +4,6 @@
<file>icon.png</file>
<file>../../CREDITS.txt</file>
<file>../../DONATIONS.txt</file>
<file>../../BLACKLIST.txt</file>
<file>../releasenotes.txt</file>
<file>images/9xdb.png</file>
<file>images/9xdl.png</file>
@@ -101,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
+14 -68
View File
@@ -1,11 +1,9 @@
#ifndef COMPAREDIALOG_H
#define COMPAREDIALOG_H
#ifndef _COMPAREDIALOG_H
#define _COMPAREDIALOG_H
#include <QDialog>
#include <QtGui>
#include <QDir>
#include "eeprominterface.h"
#include "modelprinter.h"
#include <QLabel>
#include "multimodelprinter.h"
namespace Ui {
class CompareDialog;
@@ -13,84 +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;
MultiModelPrinter multimodelprinter;
ModelData model1;
ModelData model2;
bool model1Valid;
bool model2Valid;
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";
}
bool ChannelHasExpo(ExpoData * expoArray, uint8_t destCh);
bool ChannelHasMix(MixData * mixArray, uint8_t destCh);
bool handleDroppedModel(const QMimeData * mimeData, ModelData * model, QLabel * label);
void applyDiffFont(QString & v1, QString & v2, const QString & font = "", bool eqGrey = false);
void diffAndAssembleTableLines(QStringList & i1, QStringList & i2, QString & o1, QString & o2);
Ui::CompareDialog * ui;
QTextEdit * te;
QString curvefile1;
QString curvefile2;
QDir *qd;
ModelPrinter modelPrinter1;
ModelPrinter modelPrinter2;
GeneralSettings dummySettings;
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 printInputs();
void printMixers();
void printCurves();
void printGvars();
void printLogicalSwitches();
void printSafetySwitches();
void printCustomFunctions();
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
+3
View File
@@ -63,12 +63,15 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
" <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);
ui->textEditor->scroll(0, 0);
+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 ))
+93 -15
View File
@@ -815,7 +815,7 @@ QString CustomFunctionData::funcToString() const
}
}
void CustomFunctionData::populateResetParams(ModelData * model, QComboBox * b, unsigned int value = 0)
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
{
int val = 0;
Firmware * firmware = GetCurrentFirmware();
@@ -863,7 +863,7 @@ void CustomFunctionData::populateHapticParams(QStringList & qs)
qs << "0" << "1" << "2" << "3";
}
QString CustomFunctionData::paramToString(ModelData * model) const
QString CustomFunctionData::paramToString(const ModelData * model) const
{
QStringList qs;
if (func <= FuncInstantTrim) {
@@ -897,7 +897,7 @@ QString CustomFunctionData::paramToString(ModelData * model) const
}
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)) {
@@ -948,17 +948,43 @@ QString CustomFunctionData::enabledToString() const
return "";
}
QString LimitData::minToString()
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);
}
@@ -1057,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();
@@ -1092,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;
@@ -1262,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;
@@ -1311,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();
@@ -1341,7 +1417,7 @@ void ModelData::clear()
sensorData[i].clear();
}
bool ModelData::isempty()
bool ModelData::isEmpty() const
{
return !used;
}
@@ -1608,6 +1684,8 @@ QString getBoardName(BoardEnum board)
return "Sky9x";
case BOARD_9XRPRO:
return "9XR-PRO";
case BOARD_AR9X:
return "AR9X";
default:
return "Unknown";
}
+53 -54
View File
@@ -40,7 +40,7 @@ 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)
@@ -183,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,
@@ -445,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;
@@ -468,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 {
@@ -489,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();
};
@@ -519,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];
@@ -625,11 +613,11 @@ class CustomFunctionData { // Function Switches data
int repeatParam;
void clear();
QString funcToString() const;
QString paramToString(ModelData * model) const;
QString paramToString(const ModelData * model) const;
QString repeatToString() const;
QString enabledToString() const;
static void populateResetParams(ModelData * model, QComboBox * b, unsigned int value);
static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value);
static void populatePlaySoundParams(QStringList & qs);
static void populateHapticParams(QStringList & qs);
@@ -797,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];
@@ -808,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 {
@@ -850,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
@@ -992,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];
@@ -1043,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);
@@ -1127,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;
@@ -1175,7 +1175,6 @@ class GeneralSettings {
int speakerVolume;
unsigned int backlightBright;
int switchesDelay;
int currentCalib;
int temperatureCalib;
int temperatureWarn;
unsigned int mAhWarn;
@@ -1306,7 +1305,7 @@ enum Capability {
PPMCenter,
PPMUnitMicroseconds,
SYMLimits,
HasCurrentCalibration,
HastxCurrentCalibration,
HasVolume,
HasBrightness,
PerModelTimers,
@@ -1362,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;
+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);
+66 -73
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));
@@ -1746,6 +1723,7 @@ class LogicalSwitchField: public TransformedField {
{
delete andswitchesConversionTable;
}
virtual void beforeExport()
{
if (csw.func == LS_FN_TIMER) {
@@ -1787,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) {
@@ -1801,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) {
@@ -2809,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;
@@ -2820,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);
}
}
@@ -2830,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;
@@ -2843,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());
@@ -2857,6 +2847,10 @@ class SensorField: public TransformedField {
union {
unsigned int _param;
uint8_t _sources[4];
struct {
uint16_t _ratio;
int16_t _offset;
};
};
};
@@ -2870,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);
@@ -3006,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));
@@ -3148,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>());
@@ -3156,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>());
@@ -3165,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]));
}
}
@@ -3191,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);
}
@@ -3208,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);
@@ -3224,15 +3217,15 @@ void OpenTxModelData::afterImport()
}
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 != OFF) {
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
}
}
@@ -3243,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);
@@ -3280,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++)
@@ -3364,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));
@@ -3407,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>());
@@ -3439,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;
};
@@ -73,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";
}
@@ -91,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:
@@ -381,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;
@@ -414,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;
@@ -441,18 +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;
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);
@@ -463,7 +467,7 @@ 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;
@@ -471,7 +475,7 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
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;
@@ -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);
@@ -793,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;
@@ -810,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;
@@ -826,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;
@@ -840,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;
@@ -854,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;
@@ -866,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;
@@ -1069,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:
@@ -1111,7 +1116,8 @@ 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 in the EU on radios sold after Jan 1st, 2015"));
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
@@ -1329,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"));
@@ -1339,6 +1346,29 @@ void registerOpenTxFirmwares()
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 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"));
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"));
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);
@@ -1349,6 +1379,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"));
@@ -41,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:
@@ -43,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)
@@ -75,6 +80,7 @@ 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})
@@ -87,6 +93,7 @@ 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)
@@ -100,6 +107,7 @@ 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
@@ -149,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})
@@ -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
@@ -232,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"
@@ -243,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:
+5 -5
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),
@@ -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;
}
+2 -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);
+11 -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);
@@ -214,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();
}
@@ -228,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]);
@@ -265,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 );
+1 -133
View File
@@ -47,24 +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;
}
}
}
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")};
@@ -106,20 +88,6 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
}
}
QString getProtocolStr(const int proto)
{
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, proto);
}
void populatePhasesCB(QComboBox *b, int value)
{
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
@@ -772,106 +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 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();
@@ -1018,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('/');
-8
View File
@@ -100,7 +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);
#define POPULATE_NONE (1<<0)
#define POPULATE_SOURCES (1<<1)
@@ -118,16 +117,9 @@ QString getProtocolStr(const int proto);
// 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 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);
+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>
+31 -25
View File
@@ -667,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()
@@ -1112,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);
@@ -1360,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()
+8 -6
View File
@@ -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;
};
+91 -86
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 {
@@ -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);
+65 -63
View File
@@ -11,7 +11,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
firmware(firmware),
ed(expoData),
inputName(inputName),
modelPrinter(firmware, &generalSettings, &model)
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 };
@@ -33,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);
@@ -47,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();
}
@@ -62,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);
@@ -76,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);
@@ -139,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()
+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;
+6 -6
View File
@@ -6,7 +6,7 @@
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
expoInserted(false),
modelPrinter(firmware, &generalSettings, &model)
modelPrinter(firmware, generalSettings, model)
{
inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
@@ -140,14 +140,14 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
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(modelPrinter.printInputName(md->chn), -10, ' ');
str += QString("%1").arg(modelPrinter.printInputName(input.chn), -10, ' ');
else
str = modelPrinter.printInputName(md->chn);
str = modelPrinter.printInputName(input.chn);
}
else {
if (firmware->getCapability(VirtualInputs))
@@ -156,7 +156,7 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
str = " ";
}
str.replace(" ", "&nbsp;");
str += modelPrinter.printInputLine(md);
str += modelPrinter.printInputLine(input);
}
return str;
}
+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;
}
+223 -220
View File
@@ -7,7 +7,7 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
ModelPanel(parent, model, generalSettings, firmware),
mixInserted(false),
highlightedSource(0),
modelPrinter(firmware, &generalSettings, &model)
modelPrinter(firmware, generalSettings, model)
{
QGridLayout * mixesLayout = new QGridLayout(this);
@@ -48,19 +48,17 @@ 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);
}
@@ -123,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 = 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 = modelPrinter.printMixerName(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;
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
newChannel = true;
//highlight channel if needed
if (md->destCh == highlightedSource) {
if (mix.destCh == highlightedSource) {
str = "<b>" + str + "</b>";
}
}
@@ -148,153 +146,155 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str.fill(' ');
}
str += modelPrinter.printMixerLine(md, highlightedSource);
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)
@@ -303,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;
}
@@ -314,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);
}
@@ -334,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()
@@ -384,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()
+41 -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;
}
@@ -687,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();
}
}
@@ -733,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;
}
+10 -18
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();
@@ -543,6 +533,7 @@ void TelemetrySensorPanel::update()
bool cellsFieldsDisplayed = false;
bool consFieldsDisplayed = false;
bool ratioFieldsDisplayed = false;
bool totalizeFieldsDisplayed = false;
bool sources12FieldsDisplayed = false;
bool sources34FieldsDisplayed = false;
@@ -566,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);
@@ -605,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);
@@ -759,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 {
+70 -7
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,7 +349,16 @@
</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">
@@ -571,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">
@@ -642,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">
@@ -893,7 +947,16 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="sensorsLayout" columnstretch="0">
<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="1" column="0">
+21 -21
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>
+430 -99
View File
@@ -1,5 +1,6 @@
#include "helpers.h"
#include "modelprinter.h"
#include <QPainter>
QString changeColor(const QString & input, const QString & to, const QString & from)
{
@@ -7,13 +8,19 @@ QString changeColor(const QString & input, const QString & to, const QString & f
return result.replace("color="+from, "color="+to);
}
ModelPrinter::ModelPrinter(Firmware * firmware,
GeneralSettings *gg, ModelData *gm) :
ModelPrinter::ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model):
firmware(firmware),
g_eeGeneral(gg),
g_model(gm)
generalSettings(generalSettings),
model(model)
{
}
}
ModelPrinter::~ModelPrinter()
{
foreach(QString filename, curvefiles) {
qunlink(filename);
}
}
void debugHtml(const QString & html)
{
@@ -40,67 +47,277 @@ QString addFont(const QString & input, const QString & color, const QString & si
return "<font " + sizeStr + " " + faceStr + " " + colorStr + ">" + input + "</font>";
}
QString ModelPrinter::printInputName(int idx)
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;
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
if (strlen(g_model->inputNames[idx]) > 0) {
result = QObject::tr("[I%1]").arg(idx+1);
result += QString(g_model->inputNames[idx]);
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 {
result = QObject::tr("Input%1").arg(idx+1, 2, 10, QChar('0'));
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(g_model);
result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model);
}
return Qt::escape(result);
}
QString ModelPrinter::printInputLine(const ExpoData * ed)
QString ModelPrinter::printInputLine(int idx)
{
return printInputLine(model.expoData[idx]);
}
QString ModelPrinter::printInputLine(const ExpoData & input)
{
QString str = "&nbsp;";
switch (ed->mode) {
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(ed->srcRaw.toString(g_model));
str += Qt::escape(input.srcRaw.toString(&model));
}
str += " " + Qt::escape(QObject::tr("Weight")) + QString("(%1)").arg(getGVarString(ed->weight,true));
if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
str += " " + Qt::escape(tr("Weight")) + QString("(%1)").arg(getGVarString(input.weight,true));
if (input.curve.value) str += " " + Qt::escape(input.curve.toString());
QString phasesStr = printPhases(ed->phases);
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
QString flightModesStr = printFlightModes(input.flightModes);
if (!flightModesStr.isEmpty()) str += " " + Qt::escape(flightModesStr);
if (ed->swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(QObject::tr("Switch") + QString("(%1)").arg(ed->swtch.toString()));
if (input.swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(tr("Switch")) + QString("(%1)").arg(input.swtch.toString());
if (firmware->getCapability(VirtualInputs)) {
if (ed->carryTrim>0) str += " " + Qt::escape(QObject::tr("NoTrim"));
else if (ed->carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(g_model));
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) && ed->name[0])
str += Qt::escape(QString(" [%1]").arg(ed->name));
if (firmware->getCapability(HasExpoNames) && input.name[0])
str += Qt::escape(QString(" [%1]").arg(input.name));
return str;
}
QString ModelPrinter::printMixerName(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(" ");
QString str = printChannelName(curDest-1) + " ";
if (firmware->getCapability(HasChNames)) {
QString name = g_model->limitData[curDest-1].name;
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
@@ -110,84 +327,116 @@ QString ModelPrinter::printMixerName(int curDest)
return Qt::escape(str);
}
QString ModelPrinter::printMixerLine(const MixData * md, int highlightedSource)
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;";
switch(md->mltpx) {
case (1): str += "*"; break;
case (2): str += "R"; break;
default: str += "&nbsp;"; break;
};
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(md->srcRaw.toString(g_model));
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
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(QObject::tr("Weight")) + QString("(%1)").arg(getGVarString(md->weight, true));
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(mix.weight, true)));
QString phasesStr = printPhases(md->phases);
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty())
str += " " + Qt::escape(flightModesStr);
if (md->swtch.type != SWITCH_TYPE_NONE) {
str += " " + Qt::escape(QObject::tr("Switch")) + QString("(%1)").arg(md->swtch.toString());
}
if (mix.swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(tr("Switch(%1)").arg(mix.swtch.toString()));
if (md->carryTrim>0) str += " " + Qt::escape(QObject::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(QObject::tr("No DR/Expo"));
if (md->sOffset) str += " " + Qt::escape(QObject::tr("Offset")) + QString("(%1)").arg(getGVarString(md->sOffset));
if (md->curve.value) str += " " + Qt::escape(md->curve.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 (md->delayDown || md->delayUp)
str += " " + Qt::escape(QObject::tr("Delay")) + QString("(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale);
if (md->speedDown || md->speedUp)
str += " " + Qt::escape(QObject::tr("Slow")) + QString("(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale);
if (md->mixWarn)
// str += Qt::escape(QObject::tr(" Warn(%1)").arg(md->mixWarn));
str += " " + Qt::escape(QObject::tr("Warn")) + QString("(%1)").arg(md->mixWarn);
if (firmware->getCapability(HasMixerNames) && md->name[0])
str += Qt::escape(QString(" [%1]").arg(md->name));
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::printPhases(unsigned int phases)
QString ModelPrinter::printFlightModeSwitch(int index)
{
int numphases = GetCurrentFirmware()->getCapability(FlightModes);
if (numphases && phases) {
QString str;
int count = 0;
if (phases == (unsigned int)(1<<numphases) - 1) {
str = " ### " + QObject::tr("DISABLED") + " ### ";
}
// if (phases) {
for (int i=0; i<numphases; i++) {
if (!(phases & (1<<i))) {
if (count++ > 0) str += QString(", ");
str += getPhaseName(i+1, g_model->flightModeData[i].name);
}
}
// }
if (count > 1)
return QObject::tr("Flight modes") + QString("(%1)").arg(str);
else
return QObject::tr("Flight mode") + QString("(%1)").arg(str);
if (index == 0)
return "---";
else if (index > 0) {
return printFlightModeName(index-1);
}
return "";
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 = g_model->logicalSw[idx];
const LogicalSwitchData & ls = model.logicalSw[idx];
if (!ls.func)
return result;
@@ -197,20 +446,20 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
}
switch (ls.getFunctionFamily()) {
case LS_FAMILY_EDGE:
result += QObject::tr("Edge(%1, [%2:%3])").arg(RawSwitch(ls.val1).toString()).arg(ValToTim(ls.val2)).arg(ValToTim(ls.val2+ls.val3));
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 += QObject::tr("Sticky(%1, %2)").arg(RawSwitch(ls.val1).toString()).arg(RawSwitch(ls.val2).toString());
result += tr("Sticky(%1, %2)").arg(RawSwitch(ls.val1).toString()).arg(RawSwitch(ls.val2).toString());
break;
case LS_FAMILY_TIMER:
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(ls.val1)).arg(ValToTim(ls.val2));
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(g_model, *g_eeGeneral);
RawSourceRange range = source.getRange(&model, generalSettings);
QString res;
if (ls.val1)
res += source.toString(g_model);
res += source.toString(&model);
else
res += "0";
res.remove(" ");
@@ -218,10 +467,12 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
res = "|" + res + "|";
else if (ls.func == LS_FN_DAPOS)
res = "|d(" + res + ")|";
else if (ls.func == LS_FN_DPOS) result = "d(" + res + ")";
else if (ls.func == LS_FN_DPOS)
result = "d(" + res + ")";
result += res;
if (ls.func == LS_FN_APOS || ls.func == LS_FN_VPOS || ls.func == LS_FN_DPOS || ls.func == LS_FN_DAPOS)
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; ";
@@ -253,7 +504,7 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
case LS_FAMILY_VCOMP:
if (ls.val1)
result += RawSource(ls.val1).toString(g_model);
result += RawSource(ls.val1).toString(&model);
else
result += "0";
switch (ls.func) {
@@ -281,22 +532,22 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
break;
}
if (ls.val2)
result += RawSource(ls.val2).toString(g_model);
result += RawSource(ls.val2).toString(&model);
else
result += "0";
break;
}
if (ls.andsw!=0) {
if (ls.andsw != 0) {
result +=" ) AND ";
result += RawSwitch(ls.andsw).toString();
}
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
if (firmware->getCapability(LogicalSwitchesExt)) {
if (ls.duration)
result += QObject::tr(" Duration (%1s)").arg(ls.duration/10.0);
result += " " + tr("Duration(%1s)").arg(ls.duration/10.0);
if (ls.delay)
result += QObject::tr(" Delay (%1s)").arg(ls.delay/10.0);
result += " " + tr("Delay(%1s)").arg(ls.delay/10.0);
}
return result;
@@ -305,13 +556,93 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
QString ModelPrinter::printCustomFunctionLine(int idx)
{
QString result;
const CustomFunctionData & cf = g_model->customFn[idx];
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(g_model) + ")";
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;
}
+59 -21
View File
@@ -1,7 +1,9 @@
#ifndef MODELPRINTER_H
#define MODELPRINTER_H
#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");
@@ -10,26 +12,62 @@ QString addFont(const QString & input, const QString & color = "", const QString
void debugHtml(const QString & html);
class ModelPrinter
class CurveImage
{
public:
ModelPrinter(Firmware * firmware, GeneralSettings *gg, ModelData *gm);
~ModelPrinter() {};
QString printInputName(int idx);
QString printInputLine(const ExpoData * ed);
QString printMixerName(int curDest);
QString printMixerLine(const MixData * md, int highlightedSource = 0);
QString printLogicalSwitchLine(int idx);
QString printCustomFunctionLine(int idx);
public:
CurveImage();
void drawCurve(const CurveData & curve, QColor color);
void save(const QString & filename);
private:
Firmware * firmware;
GeneralSettings * g_eeGeneral;
ModelData * g_model;
QString printPhases(unsigned int phases);
protected:
int size;
QImage image;
QPainter painter;
};
#endif //#ifndef MODELPRINTER_H
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 -691
View File
@@ -1,60 +1,27 @@
#include "printdialog.h"
#include "ui_printdialog.h"
#include "helpers.h"
#include "helpers_html.h"
#include "eeprominterface.h"
#include "modelprinter.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)),
modelPrinter(firmware, gg, gm)
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();
printLogicalSwitches();
printCustomFunctions();
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()));
@@ -67,665 +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))));
for (int i=0; i<firmware->getCapability(Timers); i++) {
str.append(fv(tr("Timer%1").arg(i+1), getTimerStr(g_model->timers[i]))); // 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 += tr("Inputs");
str += "</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 += "<tr><td>";
if(lastCHN!=ed->chn) {
lastCHN=ed->chn;
str += addFont("<b>"+modelPrinter.printInputName(ed->chn)+"</b>", "", "+1", "Courier New");
}
str += "</td>";
str += "<td>" + addFont(modelPrinter.printInputLine(ed), "green", "+1", "Courier New") + "</td>";
str += "</tr>";
}
str += "</table></td></tr></table><br>";
if (ec>0) te->append(str);
// debugHtml(str);
}
void PrintDialog::printMixes()
{
QString str = "<table border=1 cellspacing=0 cellpadding=3 style=\"page-break-after:always;\" width=\"100%\"><tr><td><h2>";
str += tr("Mixers");
str += "</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 += "<tr><td><b>";
if(lastCHN!=md->destCh) {
lastCHN=md->destCh;
str += addFont(modelPrinter.printMixerName(md->destCh).replace(" ", "&nbsp;"), "", "+1", "Courier New");
}
str += "</b></td>";
str += "<td>" + addFont(modelPrinter.printMixerLine(md), "green", "+1", "Courier New") + "</td>";
str += "</tr>";
}
str += "</table></td></tr></table><br>";
te->append(str);
// debugHtml(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::printLogicalSwitches()
{
bool haveOutput = false;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str += "<tr><td><h2>" + tr("Logical Switches") + "</h2></td></tr>";
str += "<tr><td><table border=0 cellspacing=0 cellpadding=3>";
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
QString sw = modelPrinter.printLogicalSwitchLine(i);
if (!sw.isEmpty()) {
str += "<tr>";
str += "<td width=\"60\"><b>"+ tr("L") + QString("%1</b></td>").arg(i+1);
str += "<td align=left>" + addFont(sw, "green") + "</td>";
str += "</tr>";
haveOutput = true;
}
}
str += "</table></td></tr></table>";
str += "<br>";
if (haveOutput) 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::printCustomFunctions()
{
bool haveOutput = false;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str += "<tr><td><h2>" + tr("Special Functions") + "</h2></td></tr>";
str += "<tr><td><table border=0 cellspacing=0 cellpadding=3>";
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
QString cf = modelPrinter.printCustomFunctionLine(i);
if (!cf.isEmpty()) {
str += "<tr>";
str += "<td width=\"60\"><b>"+ tr("SF") + QString("%1</b></td>").arg(i+1);
str += "<td align=left>" + addFont(cf, "green") + "</td>";
str += "</tr>";
haveOutput = true;
}
}
str += "</table></td></tr></table>";
str += "<br>";
if (haveOutput) te->append(str);
}
void PrintDialog::printFrSky()
{
int tc=0;
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
int analog=2;
if (IS_ARM(firmware->getBoard())) {
analog=4;
}
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<analog; 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<analog; 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\">"+QString("%1").arg(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()
+12 -33
View File
@@ -1,11 +1,9 @@
#ifndef PRINTDIALOG_H
#define PRINTDIALOG_H
#ifndef _PRINTDIALOG_H
#define _PRINTDIALOG_H
#include <QDialog>
#include <QtGui>
#include <QDir>
#include "eeprominterface.h"
#include "modelprinter.h"
#include "multimodelprinter.h"
namespace Ui {
class PrintDialog;
@@ -15,46 +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 printLogicalSwitches();
void printSafetySwitches();
void printCustomFunctions();
void printFrSky();
void printToFile();
QTextEdit * te;
QString curvefile5;
QString curvefile9;
QDir *qd;
ModelPrinter modelPrinter;
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);
+25 -25
View File
@@ -68,128 +68,128 @@ void TelemetrySimulator::generateTelemetryFrame()
switch(item++) {
case 0:
if (ui->Rssi->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, RSSI_ID, LIMIT<uint32_t>(0, ui->Rssi->text().toInt(&ok, 0), 0xFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, RSSI_ID, LIMIT<uint32_t>(0, ui->Rssi->text().toInt(&ok, 0), 0xFF));
break;
case 1:
#if defined(XJT_VERSION_ID)
generateSportPacket(buffer, 1, DATA_FRAME, XJT_VERSION_ID, 11);
generateSportPacket(buffer, INSTANCE, DATA_FRAME, XJT_VERSION_ID, 11);
#endif
break;
case 2:
if (ui->Swr->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, SWR_ID, LIMIT<uint32_t>(0, ui->Swr->text().toInt(&ok, 0), 0xFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, SWR_ID, LIMIT<uint32_t>(0, ui->Swr->text().toInt(&ok, 0), 0xFFFF));
break;
case 3:
if (ui->A1->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ADC1_ID, LIMIT<uint32_t>(0, ui->A1->text().toInt(&ok, 0), 0xFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ADC1_ID, LIMIT<uint32_t>(0, ui->A1->text().toInt(&ok, 0), 0xFF));
break;
case 4:
if (ui->A2->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ADC2_ID, LIMIT<uint32_t>(0, ui->A2->text().toInt(&ok, 0), 0xFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ADC2_ID, LIMIT<uint32_t>(0, ui->A2->text().toInt(&ok, 0), 0xFF));
break;
case 5:
if (ui->A3->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, A3_FIRST_ID, LIMIT<uint32_t>(0, ui->A3->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, A3_FIRST_ID, LIMIT<uint32_t>(0, ui->A3->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 6:
if (ui->A4->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, A4_FIRST_ID, LIMIT<uint32_t>(0, ui->A4->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, A4_FIRST_ID, LIMIT<uint32_t>(0, ui->A4->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 7:
if (ui->T1->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, T1_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T1->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, T1_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T1->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 8:
if (ui->T2->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, T2_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T2->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, T2_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T2->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 9:
if (ui->rpm->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->text().toInt(&ok, 0), 0xFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->text().toInt(&ok, 0), 0xFFFF));
break;
case 10:
if (ui->fuel->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, FUEL_FIRST_ID, LIMIT<uint32_t>(0, ui->fuel->text().toInt(&ok, 0), 0xFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, FUEL_FIRST_ID, LIMIT<uint32_t>(0, ui->fuel->text().toInt(&ok, 0), 0xFFFF));
break;
case 11:
if (ui->aspeed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, AIR_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->aspeed->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, AIR_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->aspeed->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 12:
if (ui->vspeed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, VARIO_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->vspeed->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, VARIO_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->vspeed->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 13:
if (ui->valt->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->valt->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->valt->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 14:
if (ui->accx->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCX_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accx->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCX_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accx->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 15:
if (ui->accy->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCY_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accy->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCY_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accy->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 16:
if (ui->accz->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 17:
if (ui->vfas->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, VFAS_FIRST_ID, LIMIT<uint32_t>(0, ui->vfas->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, VFAS_FIRST_ID, LIMIT<uint32_t>(0, ui->vfas->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 18:
if (ui->curr->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, CURR_FIRST_ID, LIMIT<uint32_t>(0, ui->curr->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, CURR_FIRST_ID, LIMIT<uint32_t>(0, ui->curr->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 19:
if (ui->cells->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, CELLS_FIRST_ID, LIMIT<uint32_t>(0, ui->cells->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, CELLS_FIRST_ID, LIMIT<uint32_t>(0, ui->cells->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 20:
if (ui->gps_alt->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->gps_alt->text().toInt(&ok, 0), 0x7FFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->gps_alt->text().toInt(&ok, 0), 0x7FFFFFFF));
break;
case 21:
if (ui->gps_speed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_speed->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_speed->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 22:
if (ui->gps_course->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_COURS_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_course->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_COURS_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_course->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 23:
if (ui->gps_time->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_TIME_DATE_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_time->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_TIME_DATE_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_time->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
case 24:
if (ui->gps_latlon->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_LONG_LATI_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_latlon->text().toInt(&ok, 0), 0xFFFFFFFF));
generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_LONG_LATI_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_latlon->text().toInt(&ok, 0), 0xFFFFFFFF));
break;
default:
+2
View File
@@ -7,6 +7,8 @@
#include <QTimer>
#include "simulatorinterface.h"
#define INSTANCE (ui->Instance->text().toInt(&ok,0) -1)
namespace Ui {
class TelemetrySimulator;
}
+15 -1
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<width>331</width>
<height>384</height>
</rect>
</property>
@@ -326,6 +326,20 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Instance</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="Instance">
<property name="text">
<string>2</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
@@ -1,15 +1,18 @@
#include "splashlibrary.h"
#include "ui_splashlibrary.h"
#include "splashlibrarydialog.h"
#include "ui_splashlibrarydialog.h"
#include "appdata.h"
#include <QtGui>
#include "helpers.h"
#include "firmwareinterface.h"
#include "helpers.h"
splashLibrary::splashLibrary(QWidget *parent, QString * fileName) : QDialog(parent), ui(new Ui::splashLibrary) {
splashFileName = fileName;
SplashLibraryDialog::SplashLibraryDialog(QWidget *parent, QString * filename):
QDialog(parent),
ui(new Ui::SplashLibraryDialog),
splashFileName(filename)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("library.png"));
setWindowIcon(CompanionIcon("library.png"));
ui->nextPage->setIcon(CompanionIcon("arrow-right.png"));
ui->prevPage->setIcon(CompanionIcon("arrow-left.png"));
page = 0;
@@ -24,11 +27,13 @@ splashLibrary::splashLibrary(QWidget *parent, QString * fileName) : QDialog(pare
}
}
splashLibrary::~splashLibrary() {
SplashLibraryDialog::~SplashLibraryDialog()
{
delete ui;
}
void splashLibrary::setupPage(int page) {
void SplashLibraryDialog::setupPage(int page)
{
splashLabel * sl[] = { ui->FwImage_01, ui->FwImage_02, ui->FwImage_03, ui->FwImage_04 ,
ui->FwImage_05, ui->FwImage_06, ui->FwImage_07, ui->FwImage_08 ,
ui->FwImage_09, ui->FwImage_10, ui->FwImage_11, ui->FwImage_12 ,
@@ -60,7 +65,8 @@ void splashLibrary::setupPage(int page) {
setWindowTitle(tr("Splash Library - page %1 of %2").arg(page + 1).arg(ceil((float) imageList.size() / 20.0)));
}
void splashLibrary::getFileList() {
void SplashLibraryDialog::getFileList()
{
imageList.clear();
if (g.embedSplashes()) {
QDir myRes(":/images/library");
@@ -102,11 +108,13 @@ void splashLibrary::getFileList() {
}
}
void splashLibrary::dclose() {
void SplashLibraryDialog::dclose()
{
close();
}
void splashLibrary::onButtonPressed(int button) {
void SplashLibraryDialog::onButtonPressed(int button)
{
splashLabel * myLabel = qobject_cast<splashLabel *>(sender());
foreach(splashLabel *sl, findChildren<splashLabel *>()) {
@@ -123,7 +131,7 @@ void splashLibrary::onButtonPressed(int button) {
myLabel->setStyleSheet("border:1px solid; border-color:#00ffff");
}
void splashLibrary::on_nextPage_clicked() {
void SplashLibraryDialog::on_nextPage_clicked() {
page++;
if (page >= (imageList.size() / 20)) {
ui->nextPage->setDisabled(true);
@@ -132,7 +140,7 @@ void splashLibrary::on_nextPage_clicked() {
setupPage(page);
}
void splashLibrary::on_prevPage_clicked() {
void SplashLibraryDialog::on_prevPage_clicked() {
page--;
if (page == 0) {
ui->prevPage->setDisabled(true);
@@ -5,16 +5,16 @@
#include <QDialog>
namespace Ui {
class splashLibrary;
class SplashLibraryDialog;
}
class splashLibrary : public QDialog
class SplashLibraryDialog : public QDialog
{
Q_OBJECT
public:
explicit splashLibrary(QWidget *parent = 0, QString * fileName=NULL);
~splashLibrary();
explicit SplashLibraryDialog(QWidget *parent = 0, QString * fileName=NULL);
~SplashLibraryDialog();
private slots:
void dclose();
@@ -25,7 +25,7 @@ private slots:
private:
void getFileList();
void setupPage(int page);
Ui::splashLibrary *ui;
Ui::SplashLibraryDialog *ui;
QString * splashFileName;
QString libraryPath;
QStringList imageList;
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>splashLibrary</class>
<widget class="QDialog" name="splashLibrary">
<class>SplashLibraryDialog</class>
<widget class="QDialog" name="SplashLibraryDialog">
<property name="geometry">
<rect>
<x>0</x>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+46 -16
View File
@@ -1,6 +1,6 @@
/*
* Author - Kjell Kernen
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@ -181,6 +181,16 @@ int StandardPage::nextFreeChannel(int channel)
return -1;
}
int StandardPage::totalChannelsAvailable()
{
int c = 0;
for(int i=0; i<WIZ_MAX_CHANNELS; i++)
if (wizDlg->mix.channel[i].page == Page_None)
c++;
return c;
}
void StandardPage::populateCB(QComboBox *cb, int preferred)
{
cb->clear();
@@ -214,7 +224,7 @@ bool StandardPage::bookChannel(QComboBox * cb, Input input1, int weight1, Input
{
int channel = cb->itemData(cb->currentIndex()).toInt();
if (channel<0 || channel>=WIZ_MAX_CHANNELS)
return false;
return false;
if (wizDlg->mix.channel[channel].page != Page_None)
return false;
@@ -231,7 +241,7 @@ void StandardPage::releaseBookings()
{
for (int i=0; i<WIZ_MAX_CHANNELS; i++) {
if (wizDlg->mix.channel[i].page == pageCurrent) {
wizDlg->mix.channel[i].clear();
wizDlg->mix.channel[i].clear();
}
}
}
@@ -298,7 +308,7 @@ bool ModelSelectionPage::validatePage()
return true;
}
int ModelSelectionPage::nextId() const
int ModelSelectionPage::nextId() const
{
if (helicopterRB->isChecked())
return Page_Cyclic;
@@ -432,7 +442,7 @@ AileronsPage::AileronsPage(WizardDialog *dlg, QString image, QString title, QStr
l->addWidget(aileron1CB);
l->addWidget(new QLabel(tr("Second Aileron Channel:")));
l->addWidget(aileron2CB);
connect(noAileronsRB, SIGNAL(toggled(bool)), this, SLOT(noAileronChannel()));
connect(oneAileronRB, SIGNAL(toggled(bool)), this, SLOT(oneAileronChannel()));
connect(twoAileronsRB, SIGNAL(toggled(bool)), this, SLOT(twoAileronChannels()));
@@ -448,10 +458,10 @@ void AileronsPage::initializePage()
bool AileronsPage::validatePage()
{
releaseBookings();
if (noAileronsRB->isChecked()) {
if (noAileronsRB->isChecked()) {
return true;
}
if (oneAileronRB->isChecked()) {
if (oneAileronRB->isChecked()) {
return (bookChannel(aileron1CB, AILERONS_INPUT, 100 ));
}
return( bookChannel(aileron1CB, AILERONS_INPUT, 100 ) &&
@@ -497,7 +507,7 @@ FlapsPage::FlapsPage(WizardDialog *dlg, QString image, QString title, QString te
l->addWidget(flap1CB);
l->addWidget(new QLabel(tr("Second Flap Channel:")));
l->addWidget(flap2CB);
connect(noFlapsRB, SIGNAL(toggled(bool)), this, SLOT(noFlapChannel()));
connect(oneFlapRB, SIGNAL(toggled(bool)), this, SLOT(oneFlapChannel()));
connect(twoFlapsRB, SIGNAL(toggled(bool)), this, SLOT(twoFlapChannels()));
@@ -512,10 +522,10 @@ void FlapsPage::initializePage()
bool FlapsPage::validatePage() {
releaseBookings();
if (noFlapsRB->isChecked()) {
if (noFlapsRB->isChecked()) {
return true;
}
if (oneFlapRB->isChecked()) {
if (oneFlapRB->isChecked()) {
return (bookChannel(flap1CB, FLAPS_INPUT, 100 ));
}
return( bookChannel(flap1CB, FLAPS_INPUT, 100 ) &&
@@ -561,7 +571,7 @@ AirbrakesPage::AirbrakesPage(WizardDialog *dlg, QString image, QString title, QS
l->addWidget(airbrake1CB);
l->addWidget(new QLabel(tr("Second Airbrake Channel:")));
l->addWidget(airbrake2CB);
connect(noAirbrakesRB, SIGNAL(toggled(bool)), this, SLOT(noAirbrakeChannel()));
connect(oneAirbrakeRB, SIGNAL(toggled(bool)), this, SLOT(oneAirbrakeChannel()));
connect(twoAirbrakesRB, SIGNAL(toggled(bool)), this, SLOT(twoAirbrakeChannels()));
@@ -577,10 +587,10 @@ void AirbrakesPage::initializePage()
bool AirbrakesPage::validatePage()
{
releaseBookings();
if (noAirbrakesRB->isChecked()) {
if (noAirbrakesRB->isChecked()) {
return true;
}
if (oneAirbrakeRB->isChecked()) {
if (oneAirbrakeRB->isChecked()) {
return (bookChannel(airbrake1CB, AIRBRAKES_INPUT, 100 ));
}
return( bookChannel(airbrake1CB, AIRBRAKES_INPUT, 100 ) &&
@@ -708,11 +718,13 @@ TailPage::TailPage(WizardDialog *dlg, QString image, QString title, QString text
elevatorCB = new QComboBox();
rudderCB = new QComboBox();
QLayout *l = layout();
l = layout();
l->addWidget(new QLabel(tr("Rudder Channel:")));
l->addWidget(rudderCB);
l->addWidget(new QLabel(tr("Elevator Channel:")));
l->addWidget(elevatorCB);
errorMessage = NULL;
}
void TailPage::initializePage()
@@ -720,6 +732,13 @@ void TailPage::initializePage()
populateCB(elevatorCB, getDefaultChannel(ELEVATOR_INPUT));
populateCB(rudderCB, getDefaultChannel(RUDDER_INPUT));
StandardPage::initializePage();
if (totalChannelsAvailable() < 2) {
errorMessage = new QLabel(tr("Only one channel still available!<br>"
"You probably should configure your model without using the wizard."));
errorMessage->setStyleSheet("QLabel { color : red; }");
l->addWidget(errorMessage);
}
}
bool TailPage::validatePage()
@@ -729,9 +748,20 @@ bool TailPage::validatePage()
bookChannel(rudderCB, RUDDER_INPUT, 100));
}
void TailPage::cleanupPage()
{
if (errorMessage)
{
l->removeWidget(errorMessage);
delete errorMessage;
errorMessage = NULL;
}
StandardPage::cleanupPage();
}
SimpleTailPage::SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
: StandardPage(Page_Simpletail, dlg, image, title, text, nextPage)
{
{
elevatorCB = new QComboBox();
QLayout *l = layout();
@@ -1001,7 +1031,7 @@ WizardPrinter::WizardPrinter(WizMix *wizMix)
{
mix = wizMix;
}
QString WizardPrinter::printChannel( Input input1, int weight1, Input input2, int weight2 )
{
QString str;
+29 -25
View File
@@ -1,6 +1,6 @@
/*
* Author - Kjell Kernen
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@ -15,7 +15,7 @@
#ifndef WIZARDDIALOG_H
#define WIZARDDIALOG_H
#include <QWizard>
#include "wizarddata.h"
#include "wizarddata.h"
QT_BEGIN_NAMESPACE
class QCheckBox;
@@ -46,7 +46,7 @@ class StandardPage: public QWizardPage
StandardPage(WizardPage curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
WizardDialog *wizDlg;
protected:
protected:
void releaseBookings();
void releasePreBookings();
void initializePage();
@@ -55,6 +55,7 @@ class StandardPage: public QWizardPage
int nextFreeChannel(int channel = 0);
void populateCB(QComboBox * cb, int preferred=-1);
bool bookChannel(QComboBox * cb, Input input1, int weight1, Input input2=NO_INPUT, int weight2=0);
int totalChannelsAvailable();
private:
QLabel *topLabel;
@@ -67,48 +68,48 @@ class ModelSelectionPage: public StandardPage
{
Q_OBJECT
public:
ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private:
QLineEdit *nameLineEdit;
QRadioButton *planeRB;
QRadioButton *multirotorRB;
QRadioButton *helicopterRB;
bool validatePage();
int nextId() const;
int nextId() const;
};
class WingtypeSelectionPage: public StandardPage
{
Q_OBJECT
public:
WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private:
QRadioButton *deltaWingRB;
QRadioButton *standardWingRB;
int nextId() const;
int nextId() const;
};
class TailSelectionPage: public StandardPage
{
Q_OBJECT
public:
TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private:
QRadioButton *vTailRB;
QRadioButton *standardTailRB;
QRadioButton *simpleTailRB;
int nextId() const;
int nextId() const;
};
class FlybarSelectionPage: public StandardPage
{
Q_OBJECT
public:
FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
private:
QRadioButton *flybarRB;
QRadioButton *noFlybarRB;
int nextId() const;
int nextId() const;
};
class ThrottlePage: public StandardPage
@@ -133,10 +134,10 @@ class AileronsPage: public StandardPage
{
Q_OBJECT
public:
AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
protected slots:
void noAileronChannel();
void oneAileronChannel();
@@ -154,7 +155,7 @@ class FlapsPage: public StandardPage
{
Q_OBJECT
public:
FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
@@ -175,7 +176,7 @@ class AirbrakesPage: public StandardPage
{
Q_OBJECT
public:
AirbrakesPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
AirbrakesPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
@@ -229,19 +230,22 @@ class TailPage: public StandardPage
{
Q_OBJECT
public:
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
void cleanupPage();
bool validatePage();
private:
QComboBox *elevatorCB;
QComboBox *rudderCB;
QLayout *l;
QLabel *errorMessage;
};
class VTailPage: public StandardPage
{
Q_OBJECT
public:
VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
VTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -253,7 +257,7 @@ class SimpleTailPage: public StandardPage
{
Q_OBJECT
public:
SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -264,7 +268,7 @@ class CyclicPage: public StandardPage
{
Q_OBJECT
public:
CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -278,7 +282,7 @@ class GyroPage: public StandardPage
{
Q_OBJECT
public:
GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -291,7 +295,7 @@ class FblPage: public StandardPage
{
Q_OBJECT
public:
FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -305,7 +309,7 @@ class HeliPage: public StandardPage
{
Q_OBJECT
public:
HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -319,7 +323,7 @@ class MultirotorPage: public StandardPage
{
Q_OBJECT
public:
MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -333,7 +337,7 @@ class OptionsPage: public StandardPage
{
Q_OBJECT
public:
OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:
@@ -346,7 +350,7 @@ class ConclusionPage: public StandardPage
{
Q_OBJECT
public:
ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
void initializePage();
bool validatePage();
private:

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