Compare commits
934 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eefbf6cc21 | |||
| 0c0d0ded91 | |||
| cbaae312c9 | |||
| b7a4f6632f | |||
| 49c25df507 | |||
| 82b82f34fe | |||
| d40a6e52f0 | |||
| 5d753527f7 | |||
| 21594aa84c | |||
| 6243b19a8c | |||
| 7bef0eedbb | |||
| c7874d3d79 | |||
| 6cdec34a3c | |||
| 64aa1f7d9e | |||
| 74055055af | |||
| 043f35f1d6 | |||
| a277d456d9 | |||
| 60b714ace3 | |||
| 083867ea7b | |||
| e366389c01 | |||
| 8fc733a3c6 | |||
| b41031d64d | |||
| 285731aaf3 | |||
| cfdd572c8f | |||
| d8583906e1 | |||
| 2eba031009 | |||
| 30a3e6db92 | |||
| bb87e907c2 | |||
| 3cffa328d1 | |||
| e9c4735049 | |||
| ed85532e34 | |||
| ad20b96364 | |||
| b8cf1ff9a8 | |||
| 7a91db3d05 | |||
| 7f9299f9e7 | |||
| 4c113b6518 | |||
| 12e15650e8 | |||
| 1bbe578c71 | |||
| f6463b64b3 | |||
| f6808c9adf | |||
| 6017fa7892 | |||
| 1494b3db98 | |||
| a9b3b40352 | |||
| 10d29e93b5 | |||
| e2c7f16703 | |||
| f6e4a47428 | |||
| c0b2b18654 | |||
| 2e324f7815 | |||
| 414779f35c | |||
| 6364c71ed9 | |||
| 93e7619144 | |||
| 0bfcd8450e | |||
| d4c0271826 | |||
| 583943c207 | |||
| 5e4a585a01 | |||
| 73a82afff1 | |||
| b929000beb | |||
| 1286b7e19c | |||
| df909159df | |||
| 50aa3f7a2f | |||
| a3e7154467 | |||
| 05c6d8e9c1 | |||
| 5e4cd75469 | |||
| 4c6063abb6 | |||
| 44f961f2f4 | |||
| 2449a0dedb | |||
| 857efbc7c5 | |||
| 0a0eb942f1 | |||
| 304b55b8bf | |||
| 57e3d1afa5 | |||
| 6b8675f486 | |||
| a8c794f4cf | |||
| 98bb86ef5b | |||
| c38173d55e | |||
| 8d4bfe48a8 | |||
| 4418b6d334 | |||
| 3b1ecb21c1 | |||
| c581535ceb | |||
| 18f5c7476a | |||
| 89339c3d81 | |||
| a2e0ce8304 | |||
| 86bc97dc4c | |||
| 7592b3d78a | |||
| 00a44257be | |||
| 12d9c20e0e | |||
| bee2d56ac3 | |||
| 68b0a63952 | |||
| 702562e324 | |||
| 7a49d30c7c | |||
| ece3a34faa | |||
| 01a51ade7c | |||
| 3610b87912 | |||
| 9085529a20 | |||
| ee4bc74c62 | |||
| 50b4453461 | |||
| dc89fd2b91 | |||
| e56d8c931c | |||
| 2a10dcc4b5 | |||
| a28bf112e8 | |||
| c310a43e1c | |||
| d1be972872 | |||
| 03dda8f77e | |||
| 4e065d0849 | |||
| 7e57ed4c89 | |||
| d254b8d3f6 | |||
| 6868a6a91a | |||
| 77d6049ea7 | |||
| 6bd93619c3 | |||
| 8a493e4cfb | |||
| f957fa8a62 | |||
| dac95f34ad | |||
| efbf0c7016 | |||
| 0fdcfa5536 | |||
| 1a1160f4d2 | |||
| c70cdc53ed | |||
| b83786d1ac | |||
| ec10caaca4 | |||
| d4ff720bad | |||
| ee6cd81069 | |||
| fdfe7a1737 | |||
| e40f936ba1 | |||
| c1e5139e9c | |||
| 6de2575539 | |||
| c7093a8a7d | |||
| eb34c5989e | |||
| 4ae719488d | |||
| fc82ffd1d7 | |||
| 99cbff143d | |||
| 0ee86e0c41 | |||
| 606c9534fc | |||
| 206e30f7fd | |||
| f00442a1f8 | |||
| 4d07ac54d0 | |||
| 0b0b8939a3 | |||
| 42a62b27d0 | |||
| b1bd638d5d | |||
| 28b466c5a4 | |||
| 1c3d9321df | |||
| a09357e866 | |||
| 2a70eafb02 | |||
| 39a220f2f5 | |||
| 567e1602fc | |||
| 2174c0b6bc | |||
| aa4e136b1e | |||
| 72652e4220 | |||
| 35ccff88e2 | |||
| f70c09e656 | |||
| e7cd70c2f4 | |||
| 3c4324adc5 | |||
| 13ddbf3ae9 | |||
| 5d7cc79db8 | |||
| 1e14fbf498 | |||
| a17416b67a | |||
| 638f48e58a | |||
| 08a88f00b9 | |||
| ce3d5dbac5 | |||
| 26bf88c65b | |||
| 23672a391d | |||
| fb5f36c5f8 | |||
| f04385d718 | |||
| 332785a65d | |||
| 12f25a6854 | |||
| 35dafd96be | |||
| 7b4676f6ac | |||
| c79a695eeb | |||
| 584eea47d5 | |||
| 7e2a50e990 | |||
| b5db38bacb | |||
| 89a9eb44a6 | |||
| 33765dd033 | |||
| 6ba194581d | |||
| b9aca7b4c4 | |||
| b37c0522c3 | |||
| 1e7edd072a | |||
| 8c45305b47 | |||
| 9f80411fa7 | |||
| 21ed4236fa | |||
| d0736b75ce | |||
| d0197ce0bc | |||
| d464420a1a | |||
| 1a172ce103 | |||
| c924cc9713 | |||
| 8f3c264c4e | |||
| 4d0bd14ad0 | |||
| 69594ba38b | |||
| 779749aafe | |||
| 25ef680bf1 | |||
| 1659d8ba78 | |||
| 7ef790d3ef | |||
| 92c02daae0 | |||
| 94d8b8b0e8 | |||
| 763192d26c | |||
| a28bc4c70f | |||
| f4c13097c1 | |||
| 731faa82ad | |||
| 0236307d8a | |||
| b0d3ae2605 | |||
| 446788ae9c | |||
| 20d36cdfb0 | |||
| 9ae4222a28 | |||
| ce90ee2702 | |||
| b375ba5ac1 | |||
| cf0d489fc4 | |||
| 9796eab94d | |||
| c3c1d0eb69 | |||
| 289d54a3bd | |||
| 3186a5d99e | |||
| 682fa5dcf1 | |||
| f337655e8d | |||
| b5164a723d | |||
| 6d9f8db165 | |||
| 70b82622bd | |||
| 40e9c3714e | |||
| 3c89f7930a | |||
| 03c035ac1b | |||
| ee6deca13a | |||
| 904c90803c | |||
| 29f7d670f0 | |||
| 51d0b667f2 | |||
| 27fad56b03 | |||
| e1e3f26031 | |||
| a34f98667f | |||
| 7790e87619 | |||
| 89f1bf5db7 | |||
| 10fe9df322 | |||
| 9d27e1d78d | |||
| d0d7135db4 | |||
| 1ce0b71c5c | |||
| 109faf8989 | |||
| 754b875d81 | |||
| 2572ed0eba | |||
| feac6d000f | |||
| 4a60c8aa6e | |||
| d54f25ccba | |||
| 2f03e2c4ad | |||
| c92d88b664 | |||
| b666892da4 | |||
| 52809b51b9 | |||
| 1a399a649d | |||
| 0f246d2f39 | |||
| e5ef862729 | |||
| e6546af9b1 | |||
| feb98816ec | |||
| 71411fcb62 | |||
| d5824f5719 | |||
| f875aec72b | |||
| 1b7e62a1f0 | |||
| ef5746de11 | |||
| 454a664d01 | |||
| 58edcc3af8 | |||
| 09846ca917 | |||
| 2b2f34af29 | |||
| a06d405a2c | |||
| 429490eb86 | |||
| c73a8bac25 | |||
| f854442c79 | |||
| 806bd1da53 | |||
| 9e5f400627 | |||
| a1d44d4d9f | |||
| cc2fcce559 | |||
| f7044a20ec | |||
| a4869cdb8a | |||
| 333d7f1ac1 | |||
| a14e8a524f | |||
| 380f435cf2 | |||
| 5805c0904a | |||
| cd2be28aab | |||
| d038a0379b | |||
| 40e5657387 | |||
| aa24bd72ff | |||
| a11884522a | |||
| 58216ec8b0 | |||
| 1641db873d | |||
| b1ec421b02 | |||
| 5119448170 | |||
| 0d6d309362 | |||
| b56e107e25 | |||
| 473ddcb56d | |||
| 484583106c | |||
| 7138c7c0e4 | |||
| dcebac87b9 | |||
| 8b419770e2 | |||
| 3d29b8e7e5 | |||
| 22c429a1a7 | |||
| 3b4a6fb49b | |||
| 3dc7e66ba7 | |||
| fbc2def259 | |||
| 08ff104d26 | |||
| b65fa29e1d | |||
| b3073e104b | |||
| 22b17c64ff | |||
| 2e068044c6 | |||
| d3e2a00cd2 | |||
| 2feb5ac894 | |||
| 6f30718745 | |||
| 80af8fe001 | |||
| 2b2d6ed9db | |||
| 16e7dbbb94 | |||
| 942148fc5c | |||
| 088f4d5e3f | |||
| d882dc1071 | |||
| 4ea4e38ccb | |||
| 756441bc50 | |||
| 7c0767144f | |||
| 95040234b3 | |||
| d5e2cac813 | |||
| 01226b612a | |||
| 47ea418d5b | |||
| 2aa2b41f3a | |||
| 85a5554922 | |||
| 4b91f5937d | |||
| 6cbe780d57 | |||
| cd4d6afff8 | |||
| 2a54bee20b | |||
| ee4ea18a3e | |||
| d38cf06b07 | |||
| 54891af0d2 | |||
| 022bd2d3da | |||
| dd88490d00 | |||
| 018a022c35 | |||
| 1668507114 | |||
| 580dc6d2de | |||
| ebe4ed19c5 | |||
| bc08d95576 | |||
| 319b8695d5 | |||
| 768b255d7d | |||
| aa88651e0a | |||
| 9463f49ba1 | |||
| cee3559aac | |||
| 082ba0893d | |||
| 4ef9913f76 | |||
| 21a67b82d4 | |||
| 701082f012 | |||
| dad1a06344 | |||
| 8976afe3bc | |||
| e326cb8515 | |||
| dc4a434076 | |||
| 9ae7aea7bb | |||
| dcbc20f1c0 | |||
| 1acd23bf8c | |||
| f98bf5e678 | |||
| 60eca69bfe | |||
| 7297669c4b | |||
| ad63f7e7f7 | |||
| da8c0297c4 | |||
| cd16b4da0e | |||
| 94efa965da | |||
| cb5bb83067 | |||
| 98abd4ec08 | |||
| 1cc3fedaf2 | |||
| 2f378d83d6 | |||
| 22f4f18071 | |||
| 268fc43fbd | |||
| 637d20a66d | |||
| 48a11f63ea | |||
| 30f5b1b275 | |||
| e8680c32b0 | |||
| 21760a3960 | |||
| a30ddb7437 | |||
| f4dc2caedf | |||
| 0d9f011a4e | |||
| 03ff929ef7 | |||
| 3849121098 | |||
| 66f473b8b6 | |||
| 6af4d09345 | |||
| e3dee13cb3 | |||
| 7a01f04f49 | |||
| b46fd48de6 | |||
| d7d38cd076 | |||
| 8e0adbe602 | |||
| 11753450ae | |||
| bb1d368c03 | |||
| 3231c0506f | |||
| 1b74d5a061 | |||
| 7ec4f508ee | |||
| 60f2535212 | |||
| 3f6e1d0b3a | |||
| e57361f7e1 | |||
| 436b5003d9 | |||
| 1dfa03d77d | |||
| 1d6adcc25a | |||
| b48946b3aa | |||
| b50c452500 | |||
| e55466894c | |||
| a38e9f6d3a | |||
| de4a5c586d | |||
| 455f9bfde2 | |||
| 9f25c7a0b6 | |||
| 02dbe6bcac | |||
| 6fe12ba625 | |||
| cd794e986a | |||
| 3aba306de9 | |||
| 412d8131f7 | |||
| daac7e6bf2 | |||
| b7bf6c5be7 | |||
| cc28219760 | |||
| 5d9f168003 | |||
| d1dbe6efce | |||
| 22a50041e3 | |||
| ea74e31841 | |||
| cdc66a7d01 | |||
| a5f94e17eb | |||
| be84af5f84 | |||
| 02b72befdb | |||
| 5f343b4a6e | |||
| 7f8211ada5 | |||
| a3584e56f4 | |||
| 106702342d | |||
| 701af4984b | |||
| bfc01f9504 | |||
| 18ffe9f503 | |||
| 407289e1d1 | |||
| 6bffe4aa80 | |||
| 1aa5143677 | |||
| 0f6bee2273 | |||
| 71aa066b99 | |||
| 96a2e18833 | |||
| d63ac41b6a | |||
| 365d2b6c58 | |||
| 6389f977bc | |||
| 7134f38ad5 | |||
| aab8fc8a96 | |||
| 0c39ed3488 | |||
| a142a74c36 | |||
| 9f8a1d5f97 | |||
| e65c131c75 | |||
| 552e730065 | |||
| dbc0d764e1 | |||
| 5cebe43306 | |||
| 646cc937ac | |||
| 6d52039266 | |||
| 14967b6a94 | |||
| b9ce8df5b6 | |||
| cae807499b | |||
| df0c0808b0 | |||
| 064c58d858 | |||
| 9af87b228c | |||
| 9eae49eed3 | |||
| 92310fff5f | |||
| 3d7c71d3ce | |||
| cd0f24fd8c | |||
| c1c3289b02 | |||
| b13b3467af | |||
| 0569d5b880 | |||
| 80bf502b11 | |||
| fbb5adcebb | |||
| 3aac623a4b | |||
| 10f5bd211b | |||
| 3387395932 | |||
| c269b2ceff | |||
| 20c6edd58e | |||
| 4854ffa683 | |||
| 0baad9e393 | |||
| 3ddcd3050e | |||
| ed86c5e16c | |||
| 2030bf7599 | |||
| 4571ed2438 | |||
| b46bb9b5cf | |||
| 2d4db9604a | |||
| b65d716029 | |||
| 259a42bfdc | |||
| 562c879751 | |||
| 746dbe22b8 | |||
| 2a49e98a80 | |||
| 20ee2318cd | |||
| 21ac2eca88 | |||
| afdff355de | |||
| 3f14a25852 | |||
| abc48390ca | |||
| 8dd5ebf053 | |||
| 65c9ae6bfd | |||
| 5188645313 | |||
| 2260cde321 | |||
| f76f7a6ad4 | |||
| 33c694f5a3 | |||
| a8890b11e0 | |||
| c8525b311f | |||
| 99d3afbe1a | |||
| 1f1a88a06c | |||
| bf6b5cc389 | |||
| 9967aab3dd | |||
| 2fef5f3e78 | |||
| d3edecb133 | |||
| 6ecf4ec6a0 | |||
| 57bc32edf5 | |||
| 5beeb208be | |||
| 2bf3f80364 | |||
| 3c0ed1350a | |||
| 2625e05953 | |||
| 461d994dea | |||
| c2ee6d2eaf | |||
| ebad326256 | |||
| 3dc47f39ea | |||
| aaacfb0888 | |||
| 45d22c83d4 | |||
| 45801a89ea | |||
| 1a1f175ac1 | |||
| 922ff5622f | |||
| b4a8caba1c | |||
| bab02ce9f7 | |||
| 3a09fb3777 | |||
| 7caa7f8144 | |||
| 1d9e2b7ad0 | |||
| 2a3e690373 | |||
| 3f48f28079 | |||
| 9083b1f35c | |||
| a18ff7b502 | |||
| 0460b892d8 | |||
| 4b9fcdaf9f | |||
| 91bd3f0cdb | |||
| c96f8aef36 | |||
| bd48c4770b | |||
| 0a616cee36 | |||
| b8923b1411 | |||
| 57e26f4b5e | |||
| ffd49691f5 | |||
| f956563444 | |||
| b54123f8a3 | |||
| 976c01051d | |||
| d14931f77f | |||
| 2a2650376c | |||
| 17302fb6e0 | |||
| 54cc9e0545 | |||
| ff2c2d41ad | |||
| db6a68e8ed | |||
| 967ac584a4 | |||
| 50b080cf61 | |||
| a975d40ceb | |||
| e1b1342655 | |||
| 8a6ba0eb8e | |||
| 87df5766f0 | |||
| 4acebc3186 | |||
| bd206cbbd2 | |||
| c846cc582a | |||
| be7b4e5064 | |||
| 61b701f930 | |||
| 8b83911017 | |||
| 2274e6395d | |||
| f7c9da6826 | |||
| bf6c6ac0c4 | |||
| 405d83b539 | |||
| 362e7c67db | |||
| 29e2ce7bd1 | |||
| a985d021b6 | |||
| c907c20705 | |||
| 5b4d9cd7d7 | |||
| 6ae59ab67c | |||
| 6374f52585 | |||
| 398d32821e | |||
| 771206e1b2 | |||
| c47a43e5ce | |||
| 62edfbb651 | |||
| b17f697f69 | |||
| 8b00509cb2 | |||
| ac9e9665dc | |||
| 89bb1226ac | |||
| 94cc359c9f | |||
| 8999839538 | |||
| 09b2cd7b46 | |||
| 4b1bd9bfd5 | |||
| 468b5520bd | |||
| c0dee366c0 | |||
| c767ed7159 | |||
| 10e72cc214 | |||
| 7e6e709031 | |||
| a2514545f4 | |||
| 57e8fc1cb1 | |||
| 6d0d0f9b0b | |||
| 88aea7f780 | |||
| e4f7fd910c | |||
| 7befb457f2 | |||
| c22784d5a4 | |||
| 404cab2548 | |||
| ef56bf3cb4 | |||
| 3920cc6919 | |||
| 5a049857f5 | |||
| 97a9c91baf | |||
| 55b5acb62e | |||
| 34f7c3a463 | |||
| 3002c0a478 | |||
| 433983e2ca | |||
| 0a33883d49 | |||
| 5d7f55fa97 | |||
| acad63f838 | |||
| ed2ae75c8a | |||
| dbca85c0e8 | |||
| 78a55507cd | |||
| c3e16dac92 | |||
| 6412361680 | |||
| 3b3fe4d946 | |||
| d1d8a32cff | |||
| 8739bd8ad9 | |||
| 77d3eae4d6 | |||
| e83b7c3a69 | |||
| f4e55f9d45 | |||
| 8bde8ca7b4 | |||
| d00b9eb8ec | |||
| 2f5682e25a | |||
| 0d6907c76c | |||
| 710ed9c5d1 | |||
| c53ba92139 | |||
| 5e2fe112b0 | |||
| 001c400f47 | |||
| 983a4da111 | |||
| d42a29570c | |||
| c2e35ddd9c | |||
| 0f91d66b49 | |||
| 6ac811076e | |||
| 2530caa16e | |||
| a1a50041dd | |||
| 65bdd25173 | |||
| 096b3c98a4 | |||
| fbd7fa4464 | |||
| 0c7e545b42 | |||
| ed05174fc8 | |||
| a8db4c4fa5 | |||
| ab1ce7515c | |||
| 34090a1d3e | |||
| 60c925a721 | |||
| 36d5f42b66 | |||
| 3075ad857e | |||
| 4056287d3d | |||
| 537d7e089f | |||
| b10276bb34 | |||
| e685528fd3 | |||
| 7498ab9957 | |||
| 9f19deb1e2 | |||
| 616741888e | |||
| 5b4f0a0bbb | |||
| 00a5437dde | |||
| 379d432365 | |||
| 744c560255 | |||
| 28b9a70e6b | |||
| f5f1a052ca | |||
| e8f28cc681 | |||
| 23c985ffd6 | |||
| 3dc781c89c | |||
| 4d7f456be5 | |||
| 154572e547 | |||
| 3469fa5c93 | |||
| dcce01fa9c | |||
| 56bc0d817f | |||
| 71706d5e93 | |||
| b8c51c9bf0 | |||
| e68b421de3 | |||
| 32ca88dbf8 | |||
| 4d83dd2c24 | |||
| 330a91441a | |||
| affda2d8fe | |||
| e7f3c280f0 | |||
| 89c27cfcca | |||
| 9303361d6b | |||
| 82c8246c25 | |||
| c0f2dddfa1 | |||
| db8ee18b5d | |||
| e3c9ecd26e | |||
| 5df19e1c3d | |||
| 3384ad2235 | |||
| d693ccd4f0 | |||
| 47547e2397 | |||
| 51f46d9a69 | |||
| 04a8570d48 | |||
| 806c343b80 | |||
| 17cb8f9459 | |||
| 1fdecd1ad4 | |||
| 900b53f165 | |||
| 6356fbb2f4 | |||
| 979ece9208 | |||
| a1df80a7f7 | |||
| a5bb41a31b | |||
| 9b527b1810 | |||
| 2b312fdbb4 | |||
| 2d9c130839 | |||
| a569c67371 | |||
| ada0f3d8b4 | |||
| 192f5a1bd7 | |||
| 70d77fd851 | |||
| f7a8715657 | |||
| 5d8c86923b | |||
| a6e53bd419 | |||
| 08756af9f5 | |||
| 447df60823 | |||
| 3d792ea4df | |||
| 26a38913a8 | |||
| 238335dec6 | |||
| 1efbde7d46 | |||
| 1e92313dcd | |||
| e174255ddb | |||
| 4b0841b17d | |||
| e136905e75 | |||
| 7c0d9c7009 | |||
| c251865538 | |||
| e079148249 | |||
| fab861e8bd | |||
| d0c696c1bc | |||
| 7b75c04b30 | |||
| 572cfd67af | |||
| c7a07ded12 | |||
| 4e7181fb7e | |||
| fce1cc681a | |||
| a7b62fc2a9 | |||
| 6fcecb5666 | |||
| d837739e4f | |||
| a530bc7a6f | |||
| 32a7c9aee6 | |||
| 5fe10c118d | |||
| 815fef458c | |||
| 20eff3358a | |||
| 98c1503bed | |||
| 7c8093b70f | |||
| edba5bcf89 | |||
| 0a75eb93d3 | |||
| a2c30b1849 | |||
| 386cb2c912 | |||
| 60dc533fe8 | |||
| 6c0a9714fc | |||
| 15469aeaf7 | |||
| a8ff8b524b | |||
| 2378080ae8 | |||
| 23e16b26f1 | |||
| 3353d989bb | |||
| 58659b9b1a | |||
| f4eab9bf58 | |||
| 57f5f68804 | |||
| 5c4b12dfc2 | |||
| 99ff846209 | |||
| 37dd2b0064 | |||
| 9c20658e26 | |||
| 6e6e80bcfc | |||
| 185ad88bc8 | |||
| 54405135c0 | |||
| d7cf14857e | |||
| 5417c426e3 | |||
| 3f6621b087 | |||
| 151fb59e27 | |||
| a2902280b0 | |||
| 10832ad60a | |||
| 121f7780c2 | |||
| 25d233e832 | |||
| 46de8229dd | |||
| 813956721d | |||
| 302bf05f57 | |||
| 977e44d44a | |||
| 105ac6306a | |||
| 3c1734bdb2 | |||
| 9546843bc2 | |||
| bf89c53f33 | |||
| 406e69ab1d | |||
| 753cb4f01c | |||
| 40c34644b8 | |||
| b3b534cd6d | |||
| 491886a5c2 | |||
| 44c096c366 | |||
| 68eafbfba7 | |||
| dd5fd62b41 | |||
| a1bc46e473 | |||
| eedaf1966e | |||
| 3cbbcf18c8 | |||
| 9a70c84179 | |||
| 9546636f0a | |||
| ecd9f1e2cf | |||
| 310321ce0e | |||
| 39c0b79f85 | |||
| 70e93fb493 | |||
| 8a202f0ecc | |||
| 53a77a5bdb | |||
| b83ad1899a | |||
| 80aee0d126 | |||
| df82aeed76 | |||
| 70d67dd7dd | |||
| 922220c748 | |||
| 819509b63a | |||
| db072442c8 | |||
| c1efd39df7 | |||
| f5dca813fb | |||
| 1bc8e0d6c1 | |||
| 0fba4a638d | |||
| 71530f253d | |||
| 274ed3a917 | |||
| ebae27272e | |||
| 3049ff768e | |||
| f6bff9683d | |||
| 013c10e7fb | |||
| af38cb6dff | |||
| 3d461b771f | |||
| cee35869ba | |||
| b6a2e89c17 | |||
| 7cf03bd74e | |||
| 776dec5c74 | |||
| 23b9d77217 | |||
| 06dc5136f7 | |||
| b8b6263c75 | |||
| 8cc98a53f3 | |||
| 67e0ecfa0b | |||
| b7f52f2521 | |||
| c6e9939024 | |||
| dd3cbda0c7 | |||
| 260c7cd0c0 | |||
| ee6b2da037 | |||
| f52c95ed55 | |||
| d2ed8d9287 | |||
| a9c60a45e9 | |||
| 0cfe5b6c76 | |||
| c8115c674d | |||
| b67dfbd086 | |||
| 4e4d0fe883 | |||
| 34c311a562 | |||
| 1da0f157de | |||
| 545f54a89c | |||
| dad815f631 | |||
| 9ca09d0a85 | |||
| 71f8b663cb | |||
| be9a26611f | |||
| d9362d2634 | |||
| 09d6fa833f | |||
| c7ff93fdf4 | |||
| c2e73c74a6 | |||
| d2e38364e6 | |||
| 404eefc3da | |||
| ba1c429554 | |||
| 0df47c19c7 | |||
| 027df32564 | |||
| 21353d2b31 | |||
| f1df8ead68 | |||
| dbac5b773f | |||
| fb1cdeeac1 | |||
| 8a66e883ec | |||
| 1922bc9edd | |||
| cc41d69954 | |||
| 771b7a1821 | |||
| a3fa0bd79d | |||
| 19e68bac4d | |||
| 983e9f2f2b | |||
| 311b5e1d04 | |||
| 9b002b94ca | |||
| 69cbb06470 | |||
| 2b25071e8c | |||
| c9d465ca2a | |||
| e1dfb15ba9 | |||
| 7e44eab63c | |||
| 7e7a762617 | |||
| d5c2d51dea | |||
| 7d2e48a99b | |||
| 4ea9e5c11f | |||
| 8f96f50a84 | |||
| c90bf43d17 | |||
| 2549e2a2de | |||
| 658ca48137 | |||
| c64369e95f | |||
| 6eec7789cc | |||
| 1b6f34069a | |||
| 98b4d26676 | |||
| 62ae7ef2bd | |||
| c9a58e5cfa | |||
| 4d5c4621c7 | |||
| 2af072ea7f | |||
| 2341f5be68 | |||
| a100af81be | |||
| 6f21556b81 | |||
| 8d97235f41 | |||
| 0559abd323 | |||
| d0211c5dc6 | |||
| f42cf4c0f4 | |||
| a8d4ba5758 | |||
| a94d08606f | |||
| 0a213389f4 | |||
| 7041a4dac6 | |||
| 97cc519bcb | |||
| 6fffd7fbae | |||
| d2bd78b366 | |||
| e758d524de | |||
| d967ec0b80 | |||
| 4509b1a2a7 | |||
| 4626550c53 | |||
| 7b469016c1 | |||
| 29e9039176 | |||
| 370728433a | |||
| f6b07ceda8 | |||
| 2c08118d6d | |||
| 7c8deb8a48 | |||
| b427fd1364 | |||
| 611f85113c | |||
| 76791c1961 | |||
| 7b28910cc2 | |||
| 841f11c21a | |||
| f845be683c | |||
| a1e2132c12 | |||
| dec83e2ef5 | |||
| f9897c0191 | |||
| 668fadb737 | |||
| 1f06e7982a | |||
| 7336d92a6d | |||
| 7b490b03d9 | |||
| 7958ff7105 | |||
| 1492d808f3 | |||
| 84fe232b0c | |||
| 51b8d70cc6 | |||
| 576ce4983d | |||
| b1170b2ab9 | |||
| 41d0675886 | |||
| 5048ce5d45 | |||
| 268f168218 | |||
| 08d4cb15aa | |||
| 2e252aacac | |||
| d23a1f5739 | |||
| 863ed513c0 | |||
| 18f28270f0 | |||
| 11ced4eecf | |||
| 44e73bac96 | |||
| 8ba9016580 | |||
| 17171b2166 | |||
| 34731af074 | |||
| 654dac1acc | |||
| 90ebaf2d88 | |||
| 2b804f92b5 | |||
| e1e60b5572 | |||
| 4b9f69a666 | |||
| 1c86a16c84 | |||
| 0cf3aeef57 | |||
| b04295ad44 | |||
| 6147c23c0f | |||
| cad3b7726d | |||
| 895afcc58c | |||
| df6d77289c | |||
| 4ad6ea8190 | |||
| a480c6ce87 | |||
| 17c176084c | |||
| 5fdff961a6 | |||
| 475f1f1b2a | |||
| 1a23b0c8d1 | |||
| 92b5b72350 | |||
| b639466a4f | |||
| 0347883fdd | |||
| 46cc410da7 |
@@ -6,3 +6,4 @@ radio/src/bootloader/bootloader_ramBoot*
|
||||
*.lbm
|
||||
*.o
|
||||
/doc/
|
||||
*.inc
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
language: cpp
|
||||
|
||||
before_install:
|
||||
- sudo apt-get remove cmake cmake-data --yes
|
||||
- sudo add-apt-repository ppa:george-edison55/precise-backports --yes
|
||||
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes
|
||||
- sudo apt-get update
|
||||
|
||||
install:
|
||||
- sudo apt-get install -y lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
|
||||
|
||||
script:
|
||||
- radio/util/commit-tests.sh
|
||||
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ../companion/src && cmake --build .
|
||||
+124
-9
@@ -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
|
||||
@@ -24,7 +26,6 @@ Chris Guy
|
||||
Adrien Gravouille
|
||||
Thomas Black
|
||||
Marc Lucht
|
||||
Michel Baily
|
||||
Zdenek Trojanek
|
||||
Martin Hotar
|
||||
Stefan Grundevik
|
||||
@@ -47,11 +48,9 @@ R. Scott Page
|
||||
Johan Cronje
|
||||
Renato Aranghelovici
|
||||
Jeffrey Irvin
|
||||
John Rodgers
|
||||
Kenneth Crump
|
||||
Damjan Adamic
|
||||
Martin Wilson
|
||||
Joe Street
|
||||
John Holdsworth
|
||||
Daniel Schwartz
|
||||
Dean Church (monthly)
|
||||
@@ -111,7 +110,6 @@ Erhard Werner
|
||||
Stig Jøran Moen
|
||||
Keith Hertzog
|
||||
Christophe Dauvergne
|
||||
Michel Baily
|
||||
Tauno Rautakorpi
|
||||
Sven Assmus
|
||||
Paul Dittman
|
||||
@@ -148,7 +146,6 @@ Mike Matheny
|
||||
Martin Sniedze
|
||||
Fernando Rimoldi
|
||||
Sidney Fisher
|
||||
Bruce Anderson
|
||||
John Rodgers
|
||||
Ed Pare
|
||||
Thomas Kilduff
|
||||
@@ -400,7 +397,6 @@ Colin Rycroft
|
||||
Emanuel Stassar
|
||||
Michael Gregory
|
||||
Robert Russell
|
||||
Gordon Stahl
|
||||
Felix Kaiser
|
||||
Joshua Bardwell
|
||||
Davd Goodall
|
||||
@@ -416,7 +412,6 @@ Andrea Montefusco
|
||||
Paul Luby
|
||||
Donald L Webster
|
||||
Kenneth Frehafer
|
||||
Peter McHenry
|
||||
Matthias Hase
|
||||
Markus Wolf
|
||||
Andrew Fazio
|
||||
@@ -587,7 +582,6 @@ Dietmar Drees
|
||||
Jürgen Monden
|
||||
David Morgan
|
||||
Andrew Fernie
|
||||
Michel Baily
|
||||
Donald Burke
|
||||
Ronald Donker
|
||||
Fredie Singh
|
||||
@@ -598,7 +592,6 @@ Julien Gérard
|
||||
Alexandre d'Alton
|
||||
Peter Mergaerts
|
||||
Jan Houwers
|
||||
Gordon Stahl
|
||||
Christian Grandjean
|
||||
Roger Bergevin
|
||||
NorthSide
|
||||
@@ -770,3 +763,125 @@ Ron Powell
|
||||
Alain Labonne
|
||||
Carol Sills
|
||||
Franck Aßmann
|
||||
Larry Anderson
|
||||
Mikael Wallbäck
|
||||
Wes Warner
|
||||
Christoffer H Henni
|
||||
Donna Bayer
|
||||
Garry Ogilvie
|
||||
Karlheinz Sirsch
|
||||
Fred Larssen
|
||||
Rob Coppock
|
||||
Franz Josef Hahn
|
||||
Serge Ribault
|
||||
Tanguy Le Moign
|
||||
Barrett Powell
|
||||
Patrice Lafeuille
|
||||
Martin Blume
|
||||
Marek Kopyto
|
||||
Marco Lange
|
||||
Gary Nix
|
||||
Jack Oliphant
|
||||
John Lever
|
||||
Adolphe Montefiore
|
||||
Steven De Weerdt
|
||||
Håkan Berggen
|
||||
Ayelet Egosi
|
||||
Jean-Frederic Gaudreault
|
||||
Jim Wagner
|
||||
Lee Scott
|
||||
Roger Keatley
|
||||
Sherman Lovell
|
||||
Hugh Caldwell
|
||||
JB Fisher Company
|
||||
Michels Bernhard
|
||||
Pietro Rossin
|
||||
Carsten Wache
|
||||
Brock White
|
||||
Steven Poretz
|
||||
David Huelster
|
||||
Gordon Stahl (monthly)
|
||||
John Mathison
|
||||
Richard Duczmal
|
||||
Gregory Barron
|
||||
Marcel Fischer
|
||||
Klas Mälman
|
||||
Viljo Liukku
|
||||
Eric Smith
|
||||
Sven Assmus
|
||||
Luke Mole
|
||||
NorthSide
|
||||
Hannes Mössler
|
||||
James Kaufman
|
||||
Ravi Gupta
|
||||
Lexington S Morley
|
||||
Ralph Segar
|
||||
Frédéric Devillard
|
||||
Cory Theurer
|
||||
Valentinos Zachariou
|
||||
Garrett Paquette
|
||||
Heung Jin Choi
|
||||
Kerry Cochrell
|
||||
Doug Miller
|
||||
Andrzej Weydmann
|
||||
Chair-man.nl
|
||||
Eric Beier
|
||||
Jay Warren
|
||||
Marian Matej
|
||||
Alastair Smith
|
||||
Timothy Senecal
|
||||
Dietmar Drees
|
||||
Bruce Jones
|
||||
Adil Busaidy
|
||||
Herman Hofman
|
||||
Jean Paul Michel
|
||||
Peter McHenry
|
||||
Julien lecoquierre
|
||||
Jean-Marie Clay
|
||||
Robert Nicoll
|
||||
Dan Nixon
|
||||
Ewald Moehring
|
||||
Giovanni Carnesecchi
|
||||
Paul Dumsday
|
||||
Tadeusz Adamowski
|
||||
Andrew Newton
|
||||
Neil Horne
|
||||
Kerstin Appelqvist
|
||||
John Curran
|
||||
Gerald Thiel
|
||||
Jürg Bingisser
|
||||
George Emer
|
||||
Jerzy Manarczyk
|
||||
Gerard Braakhuis
|
||||
Nicolas Leblond
|
||||
Burt Pickard-Richardson
|
||||
Jiri Petrzelka
|
||||
RK Custom Homes
|
||||
David Semeria
|
||||
Philip Lewis
|
||||
William Kim
|
||||
Dean Berg
|
||||
Tim Spurr
|
||||
Clifton Hipsher
|
||||
Mike Frizell
|
||||
Oliver Jacob
|
||||
Pawel Stepien
|
||||
Thomas Kilduff
|
||||
Barry Fox
|
||||
Anatoly Bakalenko
|
||||
Bruce Anderson
|
||||
Jeremy Cowgar
|
||||
Edward Hauser
|
||||
Stuart Brown
|
||||
Anton Glock
|
||||
Roger Ritchie
|
||||
George Carnie
|
||||
Philippe Stofleth
|
||||
Tim Dzugan
|
||||
Illia Izotov
|
||||
Richard Miles (monthly)
|
||||
Attila Kapolnai
|
||||
Gilles Dando
|
||||
Denis Roussille
|
||||
Olivier Anken
|
||||
Michel Motte
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
##OpenTX Next Branch
|
||||
##OpenTX 2.1 Branch
|
||||
|
||||
You have found your way to the GitHub repository site for the OpenTX Next Branch. This code branch holds the source code for the ongoing development.
|
||||
[](https://travis-ci.org/opentx/opentx)
|
||||
[](https://gitter.im/opentx/opentx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
|
||||
|
||||
The stable release code is not here, it is in the master branch.
|
||||
Under no circumstances build and use software from this branch for real world application. At times you will be more or less guaranteed to crash your plane and destroy all your model settings.
|
||||
The ongoing development on 2.1.x is done in this branch.
|
||||
|
||||
Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.
|
||||
|
||||
@@ -1,3 +1,118 @@
|
||||
<h2>Version 2.1.7 / 2016-01-04</h2>
|
||||
|
||||
<ul>
|
||||
<li>Lua 'execute' failed in non-root directory (in Simulator) (<a href=https://github.com/opentx/opentx/issues/3024>#3024</a>)</li>
|
||||
<!-- this is disabled until the speed problem is fixed <li>Header line always visible in Outputs, Logical Switches and Special Functions (<a href=https://github.com/opentx/opentx/issues/2861>#2861</a>)</li> -->
|
||||
<li>LR12 changes: removed option for remote failsafe configuration, added in EU firmware variant</li>
|
||||
<li>Added Clear option to the flight mode context menu (right click on the Name label) (<a href=https://github.com/opentx/opentx/issues/3026>#3026</a>)</li>
|
||||
<li>New features for Telemetry Simulator: log replay, user friendly sensor values (<a href=https://github.com/opentx/opentx/issues/3124>#3124</a>)</li>
|
||||
<li>Added F7 key to reload LUA permanent scripts in radio simulator (<a href=https://github.com/opentx/opentx/issues/3141>#3141</a>)</li>
|
||||
<li>AR9X firmware flashing fall-back was wrong</li>
|
||||
<li>Command line options support added to standalone simulator (try "./simulator21 --help" on Linux and "simulator.exe /help" on Windows for usage) (<a href=https://github.com/opentx/opentx/issues/3160>#3160</a>)</li>
|
||||
<li>Various rounding problem fixed: Telemetry sensor Ratio parameter (<a href=https://github.com/opentx/opentx/issues/3117>#3117</a>),
|
||||
Outputs Sub-trim, Min and Max values (<a href=https://github.com/opentx/opentx/issues/3156>#3156</a>)</li>
|
||||
<li>Fixed: telemetry sensors Ratio and Offset value increment/decrement step (<a href=https://github.com/opentx/opentx/issues/3121>#3121</a>)</li>
|
||||
<li>Hardware/Calibration tab split int two tabs (<a href=https://github.com/opentx/opentx/issues/2974>#2974</a>)</li>
|
||||
<li>Fixed Fahrenheit temperature conversion error (if PREC was not 0) (<a href=https://github.com/opentx/opentx/issues/3146>#3146</a>)</li>
|
||||
<li>Application Setting 'Enable automatic backup before writing firmware' was not saved (<a href=https://github.com/opentx/opentx/issues/3040>#3040</a>)</li>
|
||||
<li>Fixed RPM package problem on Fedora (<a href=https://github.com/opentx/opentx/issues/3130>#3130</a>)</li>
|
||||
<li>Fixed conversion errors when loading 2.0.x EEPE (<a href=https://github.com/opentx/opentx/issues/3177>#3177</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.6 / 2015-11-11</h2>
|
||||
|
||||
<ul>
|
||||
<li>Telemetry custom screen changes didn't emit modified signal (<a href=https://github.com/opentx/opentx/issues/3029>#3029</a>)</li>
|
||||
<li>Hide D8/LR12 when eu firmware option is selected</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.5 / 2015-11-05</h2>
|
||||
|
||||
Notice: version 2.1.4 was skipped by the OpenTX team to avoid confusion with FrSky's release of OpenTX 2.1.4
|
||||
|
||||
<ul>
|
||||
<li>Fixed: changing any setting on the telemetry panel does not set the file as being modified (<a href=https://github.com/opentx/opentx/issues/2875>#2875</a>)</li>
|
||||
<li>Print model fix for "Play value.... not on startup" (<a href=https://github.com/opentx/opentx/issues/2736>#2736</a>)</li>
|
||||
<li>Top LCD Timer could not be selected for X9E (<a href=https://github.com/opentx/opentx/issues/2850>#2850</a>)</li>
|
||||
<li>More informative error/info messages when openin eepe files (<a href=https://github.com/opentx/opentx/issues/2778>#2778</a>)</li>
|
||||
<li>Print model fix for curves (<a href=https://github.com/opentx/opentx/issues/2896>#2896</a>)</li>
|
||||
<li>Added missing special functions (bind, range check, set failsafe) (<a href=https://github.com/opentx/opentx/issues/2753>#2753</a>)</li>
|
||||
<li>Some defaults missing when changing telemetry formula, update propagation issues (<a href=https://github.com/opentx/opentx/issues/2928>#2928</a>)</li>
|
||||
<li>Fixed wrong import of Logical switches from OpenTX 2.0.x version (<a href=https://github.com/opentx/opentx/issues/2942>#2942</a>)</li>
|
||||
<li>Fixed a problem with updates path on Windows (<a href=https://github.com/opentx/opentx/issues/2876>#2876</a>)</li>
|
||||
<li>Edge representation unified (changed from "no release" to "instant") (<a href=https://github.com/opentx/opentx/issues/2837>#2837</a>)</li>
|
||||
<li>Added channel names on failsafe sliders (<a href=https://github.com/opentx/opentx/issues/3021>#3021</a>)</li>
|
||||
<li>Corrected failsafe mapping when using Custom failsafe mode, D16 protocol and channel range different from from 1-8.
|
||||
Users with such setups are advised to re-check their failsafe settings (<a href=https://github.com/opentx/opentx/issues/2975>#2975</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
<li>Various small bug-fixes: <a href=https://github.com/opentx/opentx/issues/2994>#2994</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/3016>#3016</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/3012>#3012</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.3 / 2015-09-09</h2>
|
||||
|
||||
<ul>
|
||||
<li>Fix missing translations in inputs/mixes tabs, print and compare dialogs (<a href=https://github.com/opentx/opentx/issues/2847>#2847</a>)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.2 / 2015-09-07</h2>
|
||||
|
||||
<ul>
|
||||
<li>Fixed: Lua model scripts outputs not working in a simulator (<a href=https://github.com/opentx/opentx/issues/2684>#2684</a>)</li>
|
||||
<li>Fixed a problem of Companion 2.1 trying to install into 2.0 path.
|
||||
The effect will only be visible for the users that did not install any of the previous 2.1.x versions.
|
||||
(<a href=https://github.com/opentx/opentx/issues/2645>#2645</a>)</li>
|
||||
<li>Added missing SDL libraries to MAC package (<a href=https://github.com/opentx/opentx/issues/2678>#2678</a>)</li>
|
||||
<li>Added used channels check/warning in Wizard (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li>
|
||||
<li>Model Print and Model Compare improvements and fixes (<a href=https://github.com/opentx/opentx/issues/2734>#2734</a>, <a href=https://github.com/opentx/opentx/issues/2737>#2737</a>, <a href=https://github.com/opentx/opentx/issues/2576>#2576</a>)</li>
|
||||
<li>Negative telemetry offset value was reset when writing back to radio (<a href=https://github.com/opentx/opentx/issues/2738>#2738</a>)</li>
|
||||
<li>Telemetry sensor names were not displayed (<a href=https://github.com/opentx/opentx/issues/2807>#2807</a>)</li>
|
||||
<li>Mixes multiplex representation now the same as on the radio (<a href=https://github.com/opentx/opentx/issues/2808>#2808</a>)</li>
|
||||
<li>Fixed language-related startup crash on Mac (<a href=https://github.com/opentx/opentx/issues/2815>#2815</a>)</li>
|
||||
<li>Fixed issues with conversion from 2.0 (<a href=https://github.com/opentx/opentx/issues/2809>#2809</a>, <a href=https://github.com/opentx/opentx/issues/2800>#2800</a>)</li>
|
||||
<li>Fixed Throttle source export issue on X9E (<a href=https://github.com/opentx/opentx/issues/2844>#2844</a>)</li>
|
||||
<li>Added support for the AR9X replacement board (prototype) for the Turnigy 9X radio, info <a href=http://www.rcgroups.com/forums/showthread.php?t=2479552>here</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.1 / 2015-08-06</h2>
|
||||
<ul>
|
||||
<li>Vario source and center silent options were not saved(<a href=https://github.com/opentx/opentx/issues/2476>#2476</a>)</li>
|
||||
<li>DSM receiver numbers for external module were not converted from previous version EEPROM (<a href=https://github.com/opentx/opentx/issues/2474>#2474</a>)</li>
|
||||
<li>Precision incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2479>#2479</a>)</li>
|
||||
<li>Unit incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2485>#2485</a>)</li>
|
||||
<li>Fixed import/export of trim values (<a href=https://github.com/opentx/opentx/issues/2484>#2484</a>)</li>
|
||||
<li>Removed constant access to floppy disk (<a href=https://github.com/opentx/opentx/issues/2160>#2160</a>)</li>
|
||||
<li>Telemetry view script combo box list was empty (<a href=https://github.com/opentx/opentx/issues/2465>#2465</a>)</li>
|
||||
<li>Telemetry view bars ranges not transfered to radio (<a href=https://github.com/opentx/opentx/issues/2491>#2491</a>)</li>
|
||||
<li>Fixed Standalone simulator radio selection display problem (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
|
||||
<li>Added missing simulation libraries and enabled side by side installation of Companion 2.0 and 2.1 on Linux (<a href=https://github.com/opentx/opentx/issues/2500>#2500</a>)</li>
|
||||
<li>Standalone simulator now remembers which radio was simulated in previous session (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
|
||||
<li>Radio calibration value were not displayed (<a href=https://github.com/opentx/opentx/issues/2502>#2502</a>)</li>
|
||||
<li>Fixed Vario / Voltage / Current sources export problem</li>
|
||||
<li>Writing model settings to 9XR-PRO did not work (<a href=https://github.com/opentx/opentx/issues/2402>#2402</a>, <a href=https://github.com/opentx/opentx/issues/2517>#2517</a>)</li>
|
||||
<li>Model Print and Model Compare improvements</li>
|
||||
<li>Fixed Companion OSX version (<a href=https://github.com/opentx/opentx/issues/2549>#2549</a>)</li>
|
||||
<li>Firmware nightly builds are now downloadable from nightly builds of Companion (<a href=https://github.com/opentx/opentx/issues/2526>#2526</a>, <a href=https://github.com/opentx/opentx/issues/2634>#2634</a>)</li>
|
||||
<li>Fixed telemetry item lists (<a href=https://github.com/opentx/opentx/issues/2541>#2541</a>)</li>
|
||||
<li>Fixed missing pots P1..P3 for 9X (<a href=https://github.com/opentx/opentx/issues/2543>#2543</a>)</li>
|
||||
<li>Fixed "Invalid model and settings" error message when writing models and settings to the radio (<a href=https://github.com/opentx/opentx/issues/2544>#2544</a>)</li>
|
||||
<li>Global Functions fixes (<a href=https://github.com/opentx/opentx/issues/2558>#2558</a>)</li>
|
||||
<li>Export to Google Earth now working (only) with the new telemetry fields (GPS, GAlt and GSpd) (<a href=https://github.com/opentx/opentx/issues/2546>#2546</a>)</li>
|
||||
<li>Fixed unsuccessful writing of setting to the radio for 9XR PRO (<a href=https://github.com/opentx/opentx/issues/2605>#2605</a>)</li>
|
||||
<li>Fixed missing LUA script outputs in special function "Play Value" (<a href=https://github.com/opentx/opentx/issues/2649>#2649</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
<li>Various small bug-fixes</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.0 / 2015-07-16</h2>
|
||||
<ul>
|
||||
<li>SD card synchronizaton tool</li>
|
||||
|
||||
@@ -1,22 +1,44 @@
|
||||
PROJECT( companion )
|
||||
|
||||
SET( C9X_VERSION_MAJOR "2" )
|
||||
SET( C9X_VERSION_MINOR "1" )
|
||||
SET( C9X_VERSION_REVISION "0" )
|
||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
|
||||
SET(C9X_VERSION_MAJOR "2")
|
||||
SET(C9X_VERSION_MINOR "1")
|
||||
SET(C9X_VERSION_REVISION "7")
|
||||
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
|
||||
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
SET(C9X_NAME_SUFFIX ${C9X_VERSION_MAJOR}${C9X_VERSION_MINOR})
|
||||
SET(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
SET(SIMULATOR_NAME "simulator${C9X_NAME_SUFFIX}")
|
||||
SET( SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX} )
|
||||
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
SET(COMPANION_NAME "companion")
|
||||
SET(SIMULATOR_NAME "simulator")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
OPTION(DEBUG_IMPORT "Turns on debug output for EEPROM import") # Disabled by default
|
||||
OPTION(ALLOW_NIGHTLY_BUILDS "Allow nightly builds download / update") # Disabled by default
|
||||
IF(ALLOW_NIGHTLY_BUILDS)
|
||||
ADD_DEFINITIONS(-DALLOW_NIGHTLY_BUILDS)
|
||||
ENDIF(ALLOW_NIGHTLY_BUILDS)
|
||||
|
||||
OPTION(DEBUG_IMPORT "Turn on debug output for EEPROM import") # Disabled by default
|
||||
IF(DEBUG_IMPORT)
|
||||
ADD_DEFINITIONS( -DDEBUG_MODEL_IMPORT)
|
||||
MESSAGE( STATUS "EEPROM import debugging enabled" )
|
||||
ENDIF(DEBUG_IMPORT)
|
||||
|
||||
OPTION(TABLE_LAYOUT "Use QTableWidget for grid layouts") # Disabled by default
|
||||
IF(TABLE_LAYOUT)
|
||||
ADD_DEFINITIONS( -DTABLE_LAYOUT)
|
||||
MESSAGE( STATUS "Using QTableWidget" )
|
||||
ENDIF(TABLE_LAYOUT)
|
||||
|
||||
MESSAGE( STATUS "Looking for XercesC " )
|
||||
FIND_PACKAGE(XercesC)
|
||||
IF ( XERCESC_FOUND )
|
||||
@@ -46,7 +68,7 @@ ELSE()
|
||||
MESSAGE( "SDL not found! Joysticks support will be disabled. Simulator audio will not work." )
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(Qt4 4.8.4 REQUIRED)
|
||||
FIND_PACKAGE(Qt4 4.8.1 REQUIRED)
|
||||
SET( QT_USE_QTNETWORK True )
|
||||
SET( QT_USE_QTXML True )
|
||||
INCLUDE( ${QT_USE_FILE} )
|
||||
@@ -69,6 +91,8 @@ ELSE()
|
||||
MESSAGE( "QT lupdate not found!" )
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-DQXT_STATIC)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
COMMAND ${XSDCXX_EXECUTABLE} cxx-tree --root-element-all --generate-serialization --output-dir ${PROJECT_BINARY_DIR}/ ${PROJECT_SOURCE_DIR}/radio.xsd
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/radio.hxx ${PROJECT_BINARY_DIR}/radio.cxx
|
||||
@@ -77,6 +101,7 @@ ADD_CUSTOM_COMMAND(
|
||||
|
||||
IF( MSVC )
|
||||
SET(CMAKE_CXX_FLAGS "/EHsc /LD")
|
||||
set(INTTYPES_INCLUDE_OPTION -IC:/Programs/msinttypes)
|
||||
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/winbuild C:/Programs/pthreads/Pre-built.2/include C:/Programs/msinttypes)
|
||||
LINK_DIRECTORIES( C:/Programs/pthreads/Pre-built.2/lib/ )
|
||||
SET( PTHREAD_LIBRARY pthreadVC2.lib )
|
||||
@@ -86,6 +111,11 @@ ELSE( )
|
||||
LINK_DIRECTORIES( /usr/local/lib )
|
||||
ENDIF( )
|
||||
|
||||
IF( MSVC )
|
||||
MESSAGE( STATUS "Adding include C:/Programs/dirent/include for dirent.h" )
|
||||
INCLUDE_DIRECTORIES( C:/programs/dirent/include )
|
||||
ENDIF( )
|
||||
|
||||
set(RADIO_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/../../radio/src)
|
||||
set(SIMU_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/simulation)
|
||||
set(COMPANION_SRC_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
@@ -96,6 +126,7 @@ include_directories(
|
||||
${PROJECT_SOURCE_DIR}/shared
|
||||
${SIMU_SRC_DIRECTORY}
|
||||
${XSD_INCLUDE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/qxtcommandoptions
|
||||
)
|
||||
|
||||
add_subdirectory(shared)
|
||||
@@ -104,6 +135,7 @@ add_subdirectory(generaledit)
|
||||
add_subdirectory(simulation)
|
||||
add_subdirectory(firmwares/opentx/simulator)
|
||||
add_subdirectory(qcustomplot)
|
||||
add_subdirectory(qxtcommandoptions)
|
||||
|
||||
set(common_SRCS
|
||||
eeprominterface.cpp
|
||||
@@ -142,6 +174,7 @@ set(companion_SRCS
|
||||
apppreferencesdialog.cpp
|
||||
fwpreferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
multimodelprinter.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
releasenotesdialog.cpp
|
||||
@@ -156,10 +189,11 @@ set(companion_SRCS
|
||||
flashfirmwaredialog.cpp
|
||||
flasheepromdialog.cpp
|
||||
printdialog.cpp
|
||||
modelprinter.cpp
|
||||
fusesdialog.cpp
|
||||
logsdialog.cpp
|
||||
downloaddialog.cpp
|
||||
splashlibrary.cpp
|
||||
splashlibrarydialog.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
radionotfound.cpp
|
||||
@@ -179,7 +213,7 @@ set(companion_MOC_HDRS
|
||||
releasenotesdialog.h
|
||||
releasenotesfirmwaredialog.h
|
||||
customizesplashdialog.h
|
||||
splashlibrary.h
|
||||
splashlibrarydialog.h
|
||||
splashlabel.h
|
||||
progresswidget.h
|
||||
progressdialog.h
|
||||
@@ -195,6 +229,8 @@ set(companion_MOC_HDRS
|
||||
radionotfound.h
|
||||
helpers.h
|
||||
wizarddialog.h
|
||||
modelprinter.h
|
||||
multimodelprinter.h
|
||||
)
|
||||
|
||||
set(companion_UIS
|
||||
@@ -209,7 +245,7 @@ set(companion_UIS
|
||||
printdialog.ui
|
||||
htmldialog.ui
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
splashlibrarydialog.ui
|
||||
progresswidget.ui
|
||||
progressdialog.ui
|
||||
flashfirmwaredialog.ui
|
||||
@@ -253,7 +289,8 @@ NOW(TIME)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${CMAKE_CURRENT_BINARY_DIR}/stamp-opentx.h @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/companion.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simulator.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop @ONLY)
|
||||
|
||||
IF( WIN32 )
|
||||
SET( companion_SRCS ${companion_SRCS} icon.rc )
|
||||
@@ -279,14 +316,14 @@ QT4_ADD_RESOURCES( companion_SRCS ${companion_RCS} )
|
||||
ADD_DEFINITIONS( -DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" )
|
||||
|
||||
IF( APPLE )
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
|
||||
ADD_EXECUTABLE( ${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
|
||||
# OS X compiler no longer automatically includes /Library/Frameworks in search path
|
||||
SET( CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks )
|
||||
ELSE( )
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
|
||||
ADD_EXECUTABLE( ${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
|
||||
ENDIF( )
|
||||
|
||||
target_link_libraries(companion generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
target_link_libraries(${COMPANION_NAME} generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
|
||||
############# Standalone simu ###############
|
||||
|
||||
@@ -309,33 +346,34 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_executable(simulator MACOSX_BUNDLE ${simu_SRCS})
|
||||
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS})
|
||||
else()
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(simulator simulation common ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
|
||||
target_link_libraries(${SIMULATOR_NAME} simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
|
||||
|
||||
############# Packaging ####################
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
|
||||
INSTALL( TARGETS simulator DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
|
||||
INSTALL( FILES companion.desktop DESTINATION share/applications )
|
||||
INSTALL( FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps )
|
||||
INSTALL( FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps )
|
||||
INSTALL( FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps )
|
||||
INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps )
|
||||
INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps )
|
||||
INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps )
|
||||
INSTALL( FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps )
|
||||
INSTALL( FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps )
|
||||
INSTALL( FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps )
|
||||
INSTALL( FILES ../targets/linux/45-companion-taranis.rules DESTINATION /etc/udev/rules.d/ )
|
||||
INSTALL( TARGETS ${COMPANION_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
|
||||
INSTALL( TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop DESTINATION share/applications RENAME companion${C9X_NAME_SUFFIX}.desktop)
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop DESTINATION share/applications RENAME simulator${C9X_NAME_SUFFIX}.desktop)
|
||||
INSTALL( FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png )
|
||||
INSTALL( FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg )
|
||||
INSTALL( FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
|
||||
# Linux specific code
|
||||
SET(OperatingSystem "Linux")
|
||||
ELSE (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${QT_BINARY_DIR} )
|
||||
INSTALL( TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR} )
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
IF( WIN32 )
|
||||
@@ -357,51 +395,51 @@ IF( WIN32 )
|
||||
"C:/Programs/NSIS"
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companion-windows.exe
|
||||
COMMAND "${NSIS_EXE}" ARGS companion.nsi
|
||||
DEPENDS companion simulator opentx-simulators ${PROJECT_BINARY_DIR}/companion.nsi
|
||||
COMMENT "Companion Windows NSIS Installer")
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/simulatorInstall.exe
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/simulator-install.exe
|
||||
COMMAND "${NSIS_EXE}" ARGS simulator.nsi
|
||||
DEPENDS simulator opentx-simulators ${PROJECT_BINARY_DIR}/simulator.nsi
|
||||
COMMENT "Simulator Windows NSIS Installer")
|
||||
|
||||
ADD_CUSTOM_TARGET( installer
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/companionInstall.exe
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/simulatorInstall.exe
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/companion-windows.exe
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/simulator-windows.exe
|
||||
SOURCES ${PROJECT_BINARY_DIR}/companion.nsi
|
||||
SOURCES ${PROJECT_BINARY_DIR}/simulator.nsi
|
||||
)
|
||||
ENDIF( )
|
||||
|
||||
IF( APPLE )
|
||||
SET(MACOSX_BUNDLE_ICON_FILE iconmac.icns)
|
||||
SET(MACOSX_BUNDLE_ICON_FILE iconmac.icns)
|
||||
IF( CMAKE_GENERATOR STREQUAL Xcode )
|
||||
SET( WORK_DIR ${CMAKE_BINARY_DIR}/Debug )
|
||||
ELSE( )
|
||||
SET( WORK_DIR ${PROJECT_BINARY_DIR} )
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_TARGET( addframeworks ALL
|
||||
ADD_CUSTOM_TARGET( addframeworks
|
||||
COMMAND mkdir -p companion.app/Contents/Frameworks
|
||||
COMMAND mkdir -p companion.app/Contents/Resources
|
||||
COMMAND mkdir -p companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
|
||||
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
|
||||
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/libcrypto.1.0.0.dylib companion.app/Contents/Frameworks
|
||||
COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync -r ${XSD_INCLUDE_DIR}/.. companion.app/Contents/Frameworks/
|
||||
COMMAND rsync -r /Library/Frameworks/SDL.framework companion.app/Contents/Frameworks/
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
|
||||
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL companion.app/Contents/MacOS/companion
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
DEPENDS ${PROJECT_NAME} )
|
||||
|
||||
DEPENDS ${COMPANION_NAME} )
|
||||
|
||||
ADD_CUSTOM_TARGET( makedmg
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app -dmg -no-plugins
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
DEPENDS addframeworks )
|
||||
|
||||
DEPENDS addframeworks opentx-simulators-bundle)
|
||||
ENDIF( )
|
||||
|
||||
ADD_CUSTOM_TARGET( stamp
|
||||
@@ -411,7 +449,7 @@ ADD_CUSTOM_TARGET( stamp
|
||||
IF( LUPDATE_FOUND )
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND ${LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -ts ${companion_TS}
|
||||
COMMAND ${LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -no-obsolete -ts ${companion_TS}
|
||||
)
|
||||
ELSE()
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
@@ -419,9 +457,14 @@ ELSE()
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
SET(CPACK_PACKAGE_NAME "COMPANION")
|
||||
SET(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
|
||||
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
|
||||
# The file stripping is deliberately disabled, with the stripped file we get
|
||||
# very poor trace-backs from the users when they report Companion crash
|
||||
SET( CPACK_STRIP_FILES FALSE )
|
||||
|
||||
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||
if(DPKG_PROGRAM)
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
@@ -442,6 +485,7 @@ else(DPKG_PROGRAM)
|
||||
SET(CPACK_RPM_PACKAGE_VERSION ${C9X_VERSION})
|
||||
SET(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}-${C9X_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib /lib/udev /lib/udev/rules.d")
|
||||
endif(DPKG_PROGRAM)
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
+25
-13
@@ -312,10 +312,10 @@ QString Profile::speaker() const { return _speaker; }
|
||||
QString Profile::stickPotCalib() const { return _stickPotCalib; }
|
||||
QString Profile::timeStamp() const { return _timeStamp; }
|
||||
QString Profile::trainerCalib() const { return _trainerCalib; }
|
||||
int Profile::currentCalib() const { return _currentCalib; }
|
||||
int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
|
||||
int Profile::gsStickMode() const { return _gsStickMode; }
|
||||
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
|
||||
int Profile::vBatCalib() const { return _vBatCalib; }
|
||||
int Profile::txVoltageCalibration() const { return _txVoltageCalibration; }
|
||||
int Profile::vBatWarn() const { return _vBatWarn; }
|
||||
int Profile::vBatMin() const { return _vBatMin; }
|
||||
int Profile::vBatMax() const { return _vBatMax; }
|
||||
@@ -342,10 +342,10 @@ void Profile::speaker (const QString x) { store(x, _speaker, "Speake
|
||||
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::txCurrentCalibration (const int x) { store(x, _txCurrentCalibration, "currentCalib","Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::txVoltageCalibration (const int x) { store(x, _txVoltageCalibration, "VbatCalib","Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::vBatMin (const int x) { store(x, _vBatMin, "VbatMin" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::vBatMax (const int x) { store(x, _vBatMax, "VbatMax" ,"Profiles", QString("profile%1").arg(index));}
|
||||
@@ -378,10 +378,10 @@ Profile& Profile::operator=(const Profile& rhs)
|
||||
speaker ( rhs.speaker() );
|
||||
stickPotCalib( rhs.stickPotCalib() );
|
||||
trainerCalib ( rhs.trainerCalib() );
|
||||
currentCalib ( rhs.currentCalib() );
|
||||
txCurrentCalibration ( rhs.txCurrentCalibration() );
|
||||
gsStickMode ( rhs.gsStickMode() );
|
||||
ppmMultiplier( rhs.ppmMultiplier() );
|
||||
vBatCalib ( rhs.vBatCalib() );
|
||||
txVoltageCalibration ( rhs.txVoltageCalibration() );
|
||||
vBatWarn ( rhs.vBatWarn() );
|
||||
vBatMin ( rhs.vBatMin() );
|
||||
vBatMax ( rhs.vBatMax() );
|
||||
@@ -424,10 +424,10 @@ void Profile::initFwVariables()
|
||||
_timeStamp = "";
|
||||
_trainerCalib = "";
|
||||
|
||||
_currentCalib = 0;
|
||||
_txCurrentCalibration = 0;
|
||||
_gsStickMode = 0;
|
||||
_ppmMultiplier = 0;
|
||||
_vBatCalib = 0;
|
||||
_txVoltageCalibration = 0;
|
||||
_vBatWarn = 0;
|
||||
_vBatMin = 0;
|
||||
_vBatMax = 0;
|
||||
@@ -483,10 +483,10 @@ void Profile::flush()
|
||||
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _txCurrentCalibration, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _txVoltageCalibration, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _vBatMin, "VbatMin" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _vBatMax, "VbatMax" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
@@ -512,6 +512,7 @@ QString AppData::mcu() { return _mcu; }
|
||||
QString AppData::programmer() { return _programmer; }
|
||||
QString AppData::sambaLocation() { return _sambaLocation; }
|
||||
QString AppData::sambaPort() { return _sambaPort; }
|
||||
QString AppData::lastSimulator() { return _lastSimulator; }
|
||||
|
||||
QString AppData::backupDir() { return _backupDir; }
|
||||
QString AppData::gePath() { return _gePath; }
|
||||
@@ -560,6 +561,7 @@ void AppData::mcu (const QString x) { store(x, _mcu,
|
||||
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
|
||||
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
|
||||
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
|
||||
void AppData::lastSimulator (const QString x) { store(x, _lastSimulator, "last_simulator" );}
|
||||
|
||||
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
|
||||
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
|
||||
@@ -611,7 +613,10 @@ AppData::AppData()
|
||||
QStringList keys = settings20.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, settings20.value(*i));
|
||||
if (settings20.value(*i) != QString("") && settings20.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, settings20.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
@@ -627,7 +632,10 @@ AppData::AppData()
|
||||
QStringList keys = pre2016settings.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, pre2016settings.value(*i));
|
||||
if (pre2016settings.value(*i) != QString("") && pre2016settings.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, pre2016settings.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
@@ -716,6 +724,7 @@ AppData::AppData()
|
||||
getset( _programmer, "programmer" ,"usbasp" );
|
||||
getset( _sambaLocation, "samba_location" ,"" );
|
||||
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
|
||||
getset( _lastSimulator, "last_simulator" ,"" );
|
||||
|
||||
getset( _backupDir, "backupPath" ,"" );
|
||||
getset( _gePath, "gePath" ,"" );
|
||||
@@ -728,10 +737,13 @@ AppData::AppData()
|
||||
getset( _updatesDir, "lastUpdatesDir" ,"" );
|
||||
|
||||
getset( _outputDisplayDetails, "outputDisplayDetails" ,false );
|
||||
getset( _enableBackup, "backupEnable" ,false );
|
||||
getset( _enableBackup, "enableBackup" ,false );
|
||||
getset( _backupOnFlash, "backupOnFlash" ,true );
|
||||
getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true );
|
||||
|
||||
getset( _useCompanionNightlyBuilds, "useCompanionNightlyBuilds" ,false );
|
||||
getset( _useFirmwareNightlyBuilds, "useFirmwareNightlyBuilds" ,false );
|
||||
|
||||
getset( _jsSupport, "js_support" ,false );
|
||||
getset( _maximized, "maximized" ,false );
|
||||
getset( _showSplash, "show_splash" ,true );
|
||||
|
||||
+11
-6
@@ -125,10 +125,10 @@ class Profile: protected CompStoreObj
|
||||
QString _stickPotCalib;
|
||||
QString _timeStamp;
|
||||
QString _trainerCalib;
|
||||
int _currentCalib;
|
||||
int _txCurrentCalibration;
|
||||
int _gsStickMode;
|
||||
int _ppmMultiplier;
|
||||
int _vBatCalib;
|
||||
int _txVoltageCalibration;
|
||||
int _vBatWarn;
|
||||
int _vBatMin;
|
||||
int _vBatMax;
|
||||
@@ -156,10 +156,10 @@ class Profile: protected CompStoreObj
|
||||
QString stickPotCalib() const;
|
||||
QString timeStamp() const;
|
||||
QString trainerCalib() const;
|
||||
int currentCalib() const;
|
||||
int txCurrentCalibration() const;
|
||||
int gsStickMode() const;
|
||||
int ppmMultiplier() const;
|
||||
int vBatCalib() const;
|
||||
int txVoltageCalibration() const;
|
||||
int vBatWarn() const;
|
||||
int vBatMin() const;
|
||||
int vBatMax() const;
|
||||
@@ -186,10 +186,10 @@ class Profile: protected CompStoreObj
|
||||
void stickPotCalib (const QString);
|
||||
void timeStamp (const QString);
|
||||
void trainerCalib (const QString);
|
||||
void currentCalib (const int);
|
||||
void txCurrentCalibration (const int);
|
||||
void gsStickMode (const int);
|
||||
void ppmMultiplier (const int);
|
||||
void vBatCalib (const int);
|
||||
void txVoltageCalibration (const int);
|
||||
void vBatWarn (const int);
|
||||
void vBatMin (const int);
|
||||
void vBatMax (const int);
|
||||
@@ -216,6 +216,8 @@ class AppData: protected CompStoreObj
|
||||
BOOL_PROPERTY(outputDisplayDetails, false)
|
||||
BOOL_PROPERTY(backupOnFlash, true)
|
||||
BOOL_PROPERTY(checkHardwareCompatibility, true)
|
||||
BOOL_PROPERTY(useCompanionNightlyBuilds, false)
|
||||
BOOL_PROPERTY(useFirmwareNightlyBuilds, false)
|
||||
|
||||
// All the global variables
|
||||
public:
|
||||
@@ -240,6 +242,7 @@ class AppData: protected CompStoreObj
|
||||
QString _programmer;
|
||||
QString _sambaLocation;
|
||||
QString _sambaPort;
|
||||
QString _lastSimulator;
|
||||
|
||||
QString _backupDir;
|
||||
QString _gePath;
|
||||
@@ -290,6 +293,7 @@ class AppData: protected CompStoreObj
|
||||
QString programmer();
|
||||
QString sambaLocation();
|
||||
QString sambaPort();
|
||||
QString lastSimulator();
|
||||
|
||||
QString backupDir();
|
||||
QString gePath();
|
||||
@@ -339,6 +343,7 @@ class AppData: protected CompStoreObj
|
||||
void programmer (const QString);
|
||||
void sambaLocation (const QString);
|
||||
void sambaPort (const QString);
|
||||
void lastSimulator (const QString);
|
||||
|
||||
void backupDir (const QString);
|
||||
void gePath (const QString);
|
||||
|
||||
@@ -41,8 +41,10 @@ AppPreferencesDialog::~AppPreferencesDialog()
|
||||
|
||||
void AppPreferencesDialog::writeValues()
|
||||
{
|
||||
g.autoCheckApp(ui->startupCheck_companion9x->isChecked());
|
||||
g.autoCheckFw(ui->startupCheck_fw->isChecked());
|
||||
g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
|
||||
g.autoCheckApp(ui->autoCheckCompanion->isChecked());
|
||||
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
|
||||
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
|
||||
g.showSplash(ui->showSplash->isChecked());
|
||||
g.simuSW(ui->simuSW->isChecked());
|
||||
g.useWizard(ui->modelWizard_CB->isChecked());
|
||||
@@ -107,8 +109,15 @@ void AppPreferencesDialog::initSettings()
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
}
|
||||
ui->startupCheck_companion9x->setChecked(g.autoCheckApp());
|
||||
ui->startupCheck_fw->setChecked(g.autoCheckFw());
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
|
||||
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
|
||||
#else
|
||||
ui->useCompanionNightlyBuilds->hide();
|
||||
ui->useFirmwareNightlyBuilds->hide();
|
||||
#endif
|
||||
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
|
||||
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
|
||||
ui->showSplash->setChecked(g.showSplash());
|
||||
ui->historySize->setValue(g.historySize());
|
||||
ui->backLightColor->setCurrentIndex(g.backLight());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>686</width>
|
||||
<height>619</height>
|
||||
<height>713</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -233,7 +233,7 @@ May be different from firmware language</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
@@ -290,6 +290,9 @@ May be different from firmware language</string>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -624,7 +627,7 @@ Mode 4:
|
||||
<item row="10" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="sdPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -634,7 +637,7 @@ Mode 4:
|
||||
<string>The profile specific folder, if set, will override general Backup folder</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -645,8 +648,8 @@ Mode 4:
|
||||
<string>Application Settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="7" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="startupCheck_companion9x">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="autoCheckCompanion">
|
||||
<property name="text">
|
||||
<string>Automatic check for Companion updates</string>
|
||||
</property>
|
||||
@@ -665,7 +668,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="13" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="backupEnable">
|
||||
<property name="text">
|
||||
<string>Enable automatic backup before writing firmware</string>
|
||||
@@ -679,24 +682,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="startupCheck_fw">
|
||||
<property name="text">
|
||||
<string>Automatic check for OpenTX firmware updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="18" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -709,7 +695,24 @@ Mode 4:
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="autoCheckFirmware">
|
||||
<property name="text">
|
||||
<string>Automatic check for OpenTX firmware updates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -749,7 +752,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@@ -784,14 +787,14 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Automatic Backup Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item row="14" column="1" colspan="3">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -805,7 +808,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="QLineEdit" name="libraryPath">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -815,7 +818,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="QComboBox" name="splashincludeCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@@ -835,7 +838,7 @@ Mode 4:
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="backupPath">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -848,10 +851,10 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2" colspan="2">
|
||||
<item row="12" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="backupPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -871,14 +874,34 @@ Mode 4:
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="ge_pathButton">
|
||||
<property name="text">
|
||||
<string>Find Executable</string>
|
||||
<string>Select Executable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2" colspan="2">
|
||||
<item row="16" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="useFirmwareNightlyBuilds">
|
||||
<property name="text">
|
||||
<string>Use OpenTX firmware nightly builds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="useCompanionNightlyBuilds">
|
||||
<property name="text">
|
||||
<string>Use Companion nightly builds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -889,7 +912,17 @@ Mode 4:
|
||||
<string>Simulator Settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="5" column="4">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="joystickCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="joystickcalButton">
|
||||
<property name="text">
|
||||
<string>Calibrate</string>
|
||||
@@ -951,7 +984,7 @@ Mode 4:
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="snapshotClipboardCKB">
|
||||
<property name="text">
|
||||
<string>Only capture to clipboard</string>
|
||||
@@ -966,32 +999,9 @@ 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>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
@@ -1032,9 +1042,15 @@ Mode 4:
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -1043,7 +1059,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="simuSW">
|
||||
<property name="text">
|
||||
<string>Remember simulator switch values</string>
|
||||
@@ -1112,8 +1128,8 @@ Mode 4:
|
||||
<tabstop>historySize</tabstop>
|
||||
<tabstop>showSplash</tabstop>
|
||||
<tabstop>modelWizard_CB</tabstop>
|
||||
<tabstop>startupCheck_fw</tabstop>
|
||||
<tabstop>startupCheck_companion9x</tabstop>
|
||||
<tabstop>autoCheckFirmware</tabstop>
|
||||
<tabstop>autoCheckCompanion</tabstop>
|
||||
<tabstop>backupPath</tabstop>
|
||||
<tabstop>backupPathButton</tabstop>
|
||||
<tabstop>backupEnable</tabstop>
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#undef main
|
||||
#endif
|
||||
#include "mainwindow.h"
|
||||
#include "version.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
@@ -87,6 +88,13 @@ int main(int argc, char *argv[])
|
||||
app.setOrganizationDomain("open-tx.org");
|
||||
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
if (strl.contains("--version")) {
|
||||
printf("%s\n", C9X_VERSION);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
app.setStyle(new MyProxyStyle);
|
||||
#endif
|
||||
@@ -148,7 +156,8 @@ int main(int argc, char *argv[])
|
||||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
unregisterFirmwares();
|
||||
unregisterSimulators();
|
||||
unregisterOpenTxFirmwares();
|
||||
unregisterEEpromInterfaces();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Companion
|
||||
Name=Companion @C9X_VERSION@
|
||||
GenericName=Transmitter Companion App
|
||||
Comment=The Ultimate Transmitter Companion
|
||||
Icon=companion
|
||||
Exec='companion'
|
||||
Icon=@COMPANION_NAME@
|
||||
Exec='@COMPANION_NAME@'
|
||||
Terminal=false
|
||||
StartupNotify=false
|
||||
Categories=Application
|
||||
@@ -100,6 +100,8 @@
|
||||
<file>images/library/00018.png</file>
|
||||
<file>images/library/00019.png</file>
|
||||
<file>images/library/00020.png</file>
|
||||
<file>images/library/00021.png</file>
|
||||
<file>images/library/00022.png</file>
|
||||
<file>images/library/00050.png</file>
|
||||
<file>images/library/00051.png</file>
|
||||
<file>images/library/00052.png</file>
|
||||
|
||||
+73
-1383
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,9 @@
|
||||
#ifndef COMPAREDIALOG_H
|
||||
#define COMPAREDIALOG_H
|
||||
#ifndef _COMPAREDIALOG_H
|
||||
#define _COMPAREDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtGui>
|
||||
#include <QDir>
|
||||
#include "eeprominterface.h"
|
||||
#include <QLabel>
|
||||
#include "multimodelprinter.h"
|
||||
|
||||
namespace Ui {
|
||||
class CompareDialog;
|
||||
@@ -12,80 +11,32 @@ namespace Ui {
|
||||
|
||||
class CompareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompareDialog(QWidget *parent, Firmware * firmware);
|
||||
~CompareDialog();
|
||||
Firmware * firmware;
|
||||
|
||||
protected:
|
||||
GeneralSettings * settings;
|
||||
ModelData * g_model1;
|
||||
ModelData * g_model2;
|
||||
ModelData * modeltemp;
|
||||
int model1;
|
||||
int model2;
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
Ui::CompareDialog *ui;
|
||||
template<class T> QString getColor1(T val1, T val2) {
|
||||
if (val1!=val2)
|
||||
return "green";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
template<class T> QString getColor2(T val1, T val2) {
|
||||
if (val1!=val2)
|
||||
return "red";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
QString getColor1(char * val1, char * val2) {
|
||||
if (strcmp(val1,val2)!=0)
|
||||
return "green";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
QString getColor2(char * val1, char * val2) {
|
||||
if (strcmp(val1,val2)!=0)
|
||||
return "red";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
|
||||
int ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused);
|
||||
bool ChannelHasExpo(ExpoData * expoArray, uint8_t destCh);
|
||||
int ModelHasMix(MixData * mixArray, MixData mix, bool * mixused);
|
||||
bool ChannelHasMix(MixData * mixArray, uint8_t destCh);
|
||||
MultiModelPrinter multimodelprinter;
|
||||
ModelData model1;
|
||||
ModelData model2;
|
||||
bool model1Valid;
|
||||
bool model2Valid;
|
||||
Ui::CompareDialog * ui;
|
||||
|
||||
QTextEdit * te;
|
||||
QString curvefile1;
|
||||
QString curvefile2;
|
||||
QDir *qd;
|
||||
|
||||
private slots:
|
||||
protected slots:
|
||||
void on_printButton_clicked();
|
||||
void on_printFileButton_clicked();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * event);
|
||||
bool handleDroppedModel(const QMimeData * mimeData, ModelData & model, QLabel * label);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void printDiff();
|
||||
void printSetup();
|
||||
void printPhases();
|
||||
void printLimits();
|
||||
void printExpos();
|
||||
void printMixers();
|
||||
void printCurves();
|
||||
void printGvars();
|
||||
void printSwitches();
|
||||
void printSafetySwitches();
|
||||
void printFSwitches();
|
||||
void printFrSky();
|
||||
};
|
||||
|
||||
#endif // COMPAREDIALOG_H
|
||||
#endif // _COMPAREDIALOG_H
|
||||
|
||||
@@ -8,6 +8,7 @@ enum BoardEnum {
|
||||
BOARD_GRUVIN9X,
|
||||
BOARD_SKY9X,
|
||||
BOARD_9XRPRO,
|
||||
BOARD_AR9X,
|
||||
BOARD_TARANIS,
|
||||
BOARD_TARANIS_PLUS,
|
||||
BOARD_TARANIS_X9E
|
||||
|
||||
@@ -59,11 +59,18 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
|
||||
str.append(formatTable(tr("People who have donated to OpenTX"), names, 6));
|
||||
}
|
||||
|
||||
str.append(" <tr><td class=\"normal\"> </td></tr>" \
|
||||
" <tr><td colspan=3 class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
|
||||
" <tr><td colspan=3 class=\"normal\">" + tr("Thank you all !!!") + "</td></tr>" \
|
||||
str.append("<table><tr><td class=\"normal\"> </td></tr>" \
|
||||
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
|
||||
"</table>");
|
||||
|
||||
#if 0
|
||||
QFile blacklist(":/BLACKLIST.txt");
|
||||
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QStringList names;
|
||||
names << blacklist.readAll();
|
||||
str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
str.append("</body></html>");
|
||||
ui->textEditor->setHtml(str);
|
||||
|
||||
Executable → Regular
+4
-1
@@ -26,8 +26,11 @@ bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom
|
||||
sourceFile.close();
|
||||
|
||||
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
|
||||
if (!loadEEprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size) || !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version))
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size));
|
||||
if (!errors.test(NO_ERROR)
|
||||
|| !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile destinationFile(destinationEEprom);
|
||||
if (!destinationFile.open(QIODevice::WriteOnly))
|
||||
|
||||
Executable → Regular
@@ -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 ))
|
||||
|
||||
+314
-199
@@ -123,23 +123,23 @@ QString SensorData::unitString() const
|
||||
case UNIT_FEET:
|
||||
return QObject::tr("f");
|
||||
case UNIT_CELSIUS:
|
||||
return QObject::tr("°C");
|
||||
return QObject::trUtf8("°C");
|
||||
case UNIT_FAHRENHEIT:
|
||||
return QObject::tr("%F");
|
||||
return QObject::trUtf8("°F");
|
||||
case UNIT_PERCENT:
|
||||
return QObject::tr("%");
|
||||
case UNIT_MAH:
|
||||
return QObject::tr("mAh");
|
||||
case UNIT_WATTS:
|
||||
return QObject::tr("W");
|
||||
case UNIT_DBM:
|
||||
case UNIT_DB:
|
||||
return QObject::tr("dB");
|
||||
case UNIT_RPMS:
|
||||
return QObject::tr("rpms");
|
||||
case UNIT_G:
|
||||
return QObject::tr("g");
|
||||
case UNIT_DEGREE:
|
||||
return QObject::tr("°");
|
||||
return QObject::trUtf8("°");
|
||||
case UNIT_HOURS:
|
||||
return QObject::tr("hours");
|
||||
case UNIT_MINUTES:
|
||||
@@ -161,6 +161,14 @@ bool RawSource::isTimeBased() const
|
||||
return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3));
|
||||
}
|
||||
|
||||
float RawSourceRange::getValue(int value)
|
||||
{
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard()))
|
||||
return float(value) * step;
|
||||
else
|
||||
return min + float(value) * step;
|
||||
}
|
||||
|
||||
RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSettings & settings, unsigned int flags) const
|
||||
{
|
||||
RawSourceRange result;
|
||||
@@ -473,7 +481,7 @@ QString RawSource::toString(const ModelData * model) const
|
||||
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
|
||||
QObject::tr("L31"), QObject::tr("L32")
|
||||
};
|
||||
|
||||
|
||||
if (index<0) {
|
||||
return QObject::tr("----");
|
||||
}
|
||||
@@ -520,7 +528,7 @@ QString RawSource::toString(const ModelData * model) const
|
||||
return CHECK_IN_ARRAY(telemetry, index);
|
||||
}
|
||||
case SOURCE_TYPE_GVAR:
|
||||
return QObject::tr("GV%1").arg(index+1);
|
||||
return QObject::tr("GV%1").arg(index+1);
|
||||
default:
|
||||
return QObject::tr("----");
|
||||
}
|
||||
@@ -528,15 +536,15 @@ QString RawSource::toString(const ModelData * model) const
|
||||
|
||||
bool RawSource::isPot() const
|
||||
{
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= NUM_STICKS &&
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= NUM_STICKS &&
|
||||
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots));
|
||||
}
|
||||
|
||||
bool RawSource::isSlider() const
|
||||
{
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= NUM_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
|
||||
return (type == SOURCE_TYPE_STICK &&
|
||||
index >= NUM_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
|
||||
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders));
|
||||
}
|
||||
|
||||
@@ -553,7 +561,7 @@ QString SwitchDn(const char sw)
|
||||
return QString::fromUtf8(result);
|
||||
}
|
||||
|
||||
QString RawSwitch::toString()
|
||||
QString RawSwitch::toString() const
|
||||
{
|
||||
static const QString switches9X[] = {
|
||||
QString("THR"), QString("RUD"), QString("ELE"),
|
||||
@@ -651,7 +659,7 @@ QString RawSwitch::toString()
|
||||
}
|
||||
}
|
||||
|
||||
QString CurveReference::toString()
|
||||
QString CurveReference::toString() const
|
||||
{
|
||||
if (value == 0) {
|
||||
return "----";
|
||||
@@ -670,7 +678,7 @@ QString CurveReference::toString()
|
||||
}
|
||||
}
|
||||
|
||||
CSFunctionFamily LogicalSwitchData::getFunctionFamily()
|
||||
CSFunctionFamily LogicalSwitchData::getFunctionFamily() const
|
||||
{
|
||||
if (func == LS_FN_EDGE)
|
||||
return LS_FAMILY_EDGE;
|
||||
@@ -686,7 +694,7 @@ CSFunctionFamily LogicalSwitchData::getFunctionFamily()
|
||||
return LS_FAMILY_VCOMP;
|
||||
}
|
||||
|
||||
unsigned int LogicalSwitchData::getRangeFlags()
|
||||
unsigned int LogicalSwitchData::getRangeFlags() const
|
||||
{
|
||||
if (func == LS_FN_DPOS)
|
||||
return RANGE_DELTA_FUNCTION;
|
||||
@@ -696,7 +704,7 @@ unsigned int LogicalSwitchData::getRangeFlags()
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString LogicalSwitchData::funcToString()
|
||||
QString LogicalSwitchData::funcToString() const
|
||||
{
|
||||
switch (func) {
|
||||
case LS_FN_OFF:
|
||||
@@ -746,123 +754,6 @@ QString LogicalSwitchData::funcToString()
|
||||
}
|
||||
}
|
||||
|
||||
QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettings & settings)
|
||||
{
|
||||
QString result = "";
|
||||
|
||||
if (!func)
|
||||
return result;
|
||||
|
||||
if (andsw!=0) {
|
||||
result +="( ";
|
||||
}
|
||||
switch (getFunctionFamily()) {
|
||||
case LS_FAMILY_EDGE:
|
||||
result += QObject::tr("Edge(%1, [%2:%3])").arg(RawSwitch(val1).toString()).arg(ValToTim(val2)).arg(ValToTim(val2+val3));
|
||||
break;
|
||||
case LS_FAMILY_STICKY:
|
||||
result += QObject::tr("Sticky(%1, %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString());
|
||||
break;
|
||||
case LS_FAMILY_TIMER:
|
||||
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
|
||||
break;
|
||||
case LS_FAMILY_VOFS: {
|
||||
RawSource source = RawSource(val1);
|
||||
RawSourceRange range = source.getRange(&model, settings);
|
||||
QString res;
|
||||
if (val1)
|
||||
res += source.toString(&model);
|
||||
else
|
||||
res += "0";
|
||||
res.remove(" ");
|
||||
if (func == LS_FN_APOS || func == LS_FN_ANEG)
|
||||
res = "|" + res + "|";
|
||||
else if (func == LS_FN_DAPOS)
|
||||
res = "|d(" + res + ")|";
|
||||
else if (func == LS_FN_DPOS) result = "d(" + res + ")";
|
||||
result += res;
|
||||
|
||||
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DPOS || func == LS_FN_DAPOS)
|
||||
result += " > ";
|
||||
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
|
||||
result += " < ";
|
||||
else if (func == LS_FN_VALMOSTEQUAL)
|
||||
result += " ~ ";
|
||||
else
|
||||
result += " missing";
|
||||
result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset);
|
||||
break;
|
||||
}
|
||||
case LS_FAMILY_VBOOL:
|
||||
result += RawSwitch(val1).toString();
|
||||
switch (func) {
|
||||
case LS_FN_AND:
|
||||
result += " AND ";
|
||||
break;
|
||||
case LS_FN_OR:
|
||||
result += " OR ";
|
||||
break;
|
||||
case LS_FN_XOR:
|
||||
result += " XOR ";
|
||||
break;
|
||||
default:
|
||||
result += " bar ";
|
||||
break;
|
||||
}
|
||||
result += RawSwitch(val2).toString();
|
||||
break;
|
||||
|
||||
case LS_FAMILY_VCOMP:
|
||||
if (val1)
|
||||
result += RawSource(val1).toString(&model);
|
||||
else
|
||||
result += "0";
|
||||
switch (func) {
|
||||
case LS_FN_EQUAL:
|
||||
case LS_FN_VEQUAL:
|
||||
result += " = ";
|
||||
break;
|
||||
case LS_FN_NEQUAL:
|
||||
result += " != ";
|
||||
break;
|
||||
case LS_FN_GREATER:
|
||||
result += " > ";
|
||||
break;
|
||||
case LS_FN_LESS:
|
||||
result += " < ";
|
||||
break;
|
||||
case LS_FN_EGREATER:
|
||||
result += " >= ";
|
||||
break;
|
||||
case LS_FN_ELESS:
|
||||
result += " <= ";
|
||||
break;
|
||||
default:
|
||||
result += " foo ";
|
||||
break;
|
||||
}
|
||||
if (val2)
|
||||
result += RawSource(val2).toString(&model);
|
||||
else
|
||||
result += "0";
|
||||
break;
|
||||
}
|
||||
|
||||
if (andsw!=0) {
|
||||
result +=" ) AND ";
|
||||
result += RawSwitch(andsw).toString();
|
||||
}
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(LogicalSwitchesExt)) {
|
||||
if (duration)
|
||||
result += QObject::tr(" Duration (%1s)").arg(duration/10.0);
|
||||
if (delay)
|
||||
result += QObject::tr(" Delay (%1s)").arg(delay/10.0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void CustomFunctionData::clear()
|
||||
{
|
||||
memset(this, 0, sizeof(CustomFunctionData));
|
||||
@@ -871,7 +762,7 @@ void CustomFunctionData::clear()
|
||||
}
|
||||
}
|
||||
|
||||
QString CustomFunctionData::funcToString()
|
||||
QString CustomFunctionData::funcToString() const
|
||||
{
|
||||
if (func >= FuncOverrideCH1 && func <= FuncOverrideCH32)
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
|
||||
@@ -890,7 +781,7 @@ QString CustomFunctionData::funcToString()
|
||||
else if (func == FuncPlaySound)
|
||||
return QObject::tr("Play Sound");
|
||||
else if (func == FuncPlayHaptic)
|
||||
return QObject::tr("Play Haptic");
|
||||
return QObject::tr("Haptic");
|
||||
else if (func == FuncReset)
|
||||
return QObject::tr("Reset");
|
||||
else if (func >= FuncSetTimer1 && func <= FuncSetTimer3)
|
||||
@@ -906,7 +797,7 @@ QString CustomFunctionData::funcToString()
|
||||
else if (func == FuncPlayScript)
|
||||
return QObject::tr("Play Script");
|
||||
else if (func == FuncLogs)
|
||||
return QObject::tr("Start Logs");
|
||||
return QObject::tr("SD Logs");
|
||||
else if (func == FuncVolume)
|
||||
return QObject::tr("Volume");
|
||||
else if (func == FuncBacklight)
|
||||
@@ -919,46 +810,106 @@ QString CustomFunctionData::funcToString()
|
||||
return QObject::tr("Background Music Pause");
|
||||
else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast)
|
||||
return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1);
|
||||
else if (func == FuncSetFailsafeInternalModule)
|
||||
return QObject::tr("SetFailsafe Int. Module");
|
||||
else if (func == FuncSetFailsafeExternalModule)
|
||||
return QObject::tr("SetFailsafe Ext. Module");
|
||||
else if (func == FuncRangeCheckInternalModule)
|
||||
return QObject::tr("RangeCheck Int. Module");
|
||||
else if (func == FuncRangeCheckExternalModule)
|
||||
return QObject::tr("RangeCheck Ext. Module");
|
||||
else if (func == FuncBindInternalModule)
|
||||
return QObject::tr("Bind Int. Module");
|
||||
else if (func == FuncBindExternalModule)
|
||||
return QObject::tr("Bind Ext. Module");
|
||||
else {
|
||||
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
|
||||
}
|
||||
}
|
||||
|
||||
QString CustomFunctionData::paramToString()
|
||||
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
|
||||
{
|
||||
int val = 0;
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
|
||||
b->addItem(QObject::tr("Timer1"), val++);
|
||||
b->addItem(QObject::tr("Timer2"), val++);
|
||||
if (IS_ARM(board)) {
|
||||
b->addItem( QObject::tr("Timer3"), val++);
|
||||
}
|
||||
b->addItem(QObject::tr("Flight"), val++);
|
||||
b->addItem(QObject::tr("Telemetry"), val++);
|
||||
int reCount = firmware->getCapability(RotaryEncoders);
|
||||
if (reCount == 1) {
|
||||
b->addItem(QObject::tr("Rotary Encoder"), val++);
|
||||
}
|
||||
else if (reCount == 2) {
|
||||
b->addItem(QObject::tr("REa"), val++);
|
||||
b->addItem(QObject::tr("REb"), val++);
|
||||
}
|
||||
if ((int)value < b->count()) {
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
if (model && IS_ARM(board)) {
|
||||
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
||||
if (model->sensorData[i].isAvailable()) {
|
||||
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i);
|
||||
b->addItem(item.toString(model), val+i);
|
||||
if ((int)value == val+i) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFunctionData::populatePlaySoundParams(QStringList & qs)
|
||||
{
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
}
|
||||
|
||||
void CustomFunctionData::populateHapticParams(QStringList & qs)
|
||||
{
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
}
|
||||
|
||||
QString CustomFunctionData::paramToString(const ModelData * model) const
|
||||
{
|
||||
QStringList qs;
|
||||
if (func <= FuncInstantTrim) {
|
||||
return QString("%1").arg(param);
|
||||
}
|
||||
else if (func==FuncLogs) {
|
||||
return QString("%1").arg(param/10.0) + QObject::tr("s");
|
||||
}
|
||||
else if (func==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
CustomFunctionData::populatePlaySoundParams(qs);
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
CustomFunctionData::populateHapticParams(qs);
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if (func==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
qs.append( QObject::tr("Timer3"));
|
||||
qs.append( QObject::tr("All"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
if (param>=0 && param<(int)qs.count())
|
||||
return qs.at(param);
|
||||
QComboBox cb;
|
||||
CustomFunctionData::populateResetParams(model, &cb);
|
||||
int pos = cb.findData(param);
|
||||
if (pos >= 0)
|
||||
return cb.itemText(pos);
|
||||
else
|
||||
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
|
||||
}
|
||||
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
|
||||
RawSource item(param);
|
||||
return item.toString();
|
||||
return item.toString(model);
|
||||
}
|
||||
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
|
||||
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
@@ -968,54 +919,87 @@ QString CustomFunctionData::paramToString()
|
||||
return paramarm;
|
||||
}
|
||||
}
|
||||
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
|
||||
else if ((func>=FuncAdjustGV1) && (func<FuncCount)) {
|
||||
switch (adjustMode) {
|
||||
case 0:
|
||||
return QObject::tr("Value ")+QString("%1").arg(param);
|
||||
break;
|
||||
case 1:
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 2:
|
||||
return RawSource(param).toString();
|
||||
break;
|
||||
case 3:
|
||||
if (param==0) {
|
||||
return QObject::tr("Decr:")+QString(" -1");
|
||||
}
|
||||
else {
|
||||
return QObject::tr("Incr:")+QString(" +1");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
if (param==0) return QObject::tr("Decr:") + " -1";
|
||||
else return QObject::tr("Incr:") + " +1";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
QString CustomFunctionData::repeatToString()
|
||||
QString CustomFunctionData::repeatToString() const
|
||||
{
|
||||
if (repeatParam==0) {
|
||||
return QObject::tr("No repeat");
|
||||
if (repeatParam == -1) {
|
||||
return QObject::tr("played once, not during startup");
|
||||
}
|
||||
else if (repeatParam == 0) {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10;
|
||||
return QObject::tr("%1 sec").arg(step*repeatParam);
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
return QObject::tr("repeat(%1s)").arg(step*repeatParam);
|
||||
}
|
||||
}
|
||||
|
||||
QString LimitData::minToString()
|
||||
QString CustomFunctionData::enabledToString() const
|
||||
{
|
||||
if ((func>=FuncOverrideCH1 && func<=FuncOverrideCH32) ||
|
||||
(func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) ||
|
||||
(func==FuncReset) ||
|
||||
(func>=FuncSetTimer1 && func<=FuncSetTimer2) ||
|
||||
(func==FuncVolume) ||
|
||||
(func <= FuncInstantTrim)) {
|
||||
if (!enabled) {
|
||||
return QObject::tr("DISABLED");
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
CurveData::CurveData()
|
||||
{
|
||||
clear(5);
|
||||
}
|
||||
|
||||
void CurveData::clear(int count)
|
||||
{
|
||||
memset(this, 0, sizeof(CurveData));
|
||||
this->count = count;
|
||||
}
|
||||
|
||||
bool CurveData::isEmpty() const
|
||||
{
|
||||
for (int i=0; i<count; i++) {
|
||||
if (points[i].y != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString LimitData::minToString() const
|
||||
{
|
||||
return QString::number((qreal)min/10);
|
||||
}
|
||||
|
||||
QString LimitData::maxToString()
|
||||
QString LimitData::maxToString() const
|
||||
{
|
||||
return QString::number((qreal)max/10);
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString()
|
||||
QString LimitData::revertToString() const
|
||||
{
|
||||
return revert ? QObject::tr("INV") : QObject::tr("NOR");
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString() const
|
||||
{
|
||||
return QString::number((qreal)offset/10, 'f', 1);
|
||||
}
|
||||
@@ -1052,13 +1036,13 @@ bool GeneralSettings::switchSourceAllowedTaranis(int index) const
|
||||
|
||||
bool GeneralSettings::isPotAvailable(int index) const
|
||||
{
|
||||
if (index<0 || index>4) return false;
|
||||
if (index<0 || index>GetCurrentFirmware()->getCapability(Pots)) return false;
|
||||
return potConfig[index] != POT_NONE;
|
||||
}
|
||||
|
||||
bool GeneralSettings::isSliderAvailable(int index) const
|
||||
{
|
||||
if (index<0 || index>4) return false;
|
||||
if (index<0 || index>GetCurrentFirmware()->getCapability(Sliders)) return false;
|
||||
return sliderConfig[index] != SLIDER_NONE;
|
||||
}
|
||||
|
||||
@@ -1090,6 +1074,11 @@ GeneralSettings::GeneralSettings()
|
||||
switchConfig[6] = SWITCH_3POS;
|
||||
switchConfig[7] = SWITCH_TOGGLE;
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<3; i++) {
|
||||
potConfig[i] = POT_WITHOUT_DETENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ARM(board)) {
|
||||
speakerVolume = 12;
|
||||
@@ -1109,8 +1098,8 @@ GeneralSettings::GeneralSettings()
|
||||
}
|
||||
else {
|
||||
QString t_trainercalib=g.profile[g.id()].trainerCalib();
|
||||
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
|
||||
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
|
||||
int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
|
||||
int8_t t_txCurrentCalibration=(int8_t)g.profile[g.id()].txCurrentCalibration();
|
||||
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
|
||||
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
|
||||
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
|
||||
@@ -1144,8 +1133,8 @@ GeneralSettings::GeneralSettings()
|
||||
if (ok)
|
||||
trainer.calib[i]=byte16;
|
||||
}
|
||||
currentCalib=t_currentCalib;
|
||||
vBatCalib=t_vBatCalib;
|
||||
txCurrentCalibration=t_txCurrentCalibration;
|
||||
txVoltageCalibration=t_txVoltageCalibration;
|
||||
vBatWarn=t_vBatWarn;
|
||||
PPM_Multiplier=t_PPM_Multiplier;
|
||||
stickMode = t_stickMode;
|
||||
@@ -1314,6 +1303,52 @@ bool ModelData::isInputValid(const unsigned int idx) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ModelData::hasExpos(uint8_t inputIdx) const
|
||||
{
|
||||
for (int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||
const ExpoData & expo = expoData[i];
|
||||
if (expo.chn==inputIdx && expo.mode!=0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ModelData::hasMixes(uint8_t channelIdx) const
|
||||
{
|
||||
channelIdx += 1;
|
||||
for (int i=0; i<C9X_MAX_MIXERS; i++) {
|
||||
if (mixData[i].destCh == channelIdx) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QVector<const ExpoData *> ModelData::expos(int input) const
|
||||
{
|
||||
QVector<const ExpoData *> result;
|
||||
for (int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||
const ExpoData * ed = &expoData[i];
|
||||
if ((int)ed->chn==input && ed->mode!=0) {
|
||||
result << ed;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QVector<const MixData *> ModelData::mixes(int channel) const
|
||||
{
|
||||
QVector<const MixData *> result;
|
||||
for (int i=0; i<C9X_MAX_MIXERS; i++) {
|
||||
const MixData * md = &mixData[i];
|
||||
if ((int)md->destCh == channel+1) {
|
||||
result << md;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void ModelData::removeInput(const int idx)
|
||||
{
|
||||
unsigned int chn = expoData[idx].chn;
|
||||
@@ -1363,12 +1398,16 @@ void ModelData::clear()
|
||||
moduleData[2].ppmDelay = 300;
|
||||
int board = GetEepromInterface()->getBoard();
|
||||
if (IS_TARANIS(board)) {
|
||||
moduleData[0].protocol=PXX_XJT_X16;
|
||||
moduleData[1].protocol=OFF;
|
||||
moduleData[0].protocol = PULSES_PXX_XJT_X16;
|
||||
moduleData[1].protocol = PULSES_OFF;
|
||||
}
|
||||
else if (IS_SKY9X(board)) {
|
||||
moduleData[0].protocol = PULSES_PPM;
|
||||
moduleData[1].protocol = PULSES_PPM;
|
||||
}
|
||||
else {
|
||||
moduleData[0].protocol=PPM;
|
||||
moduleData[1].protocol=OFF;
|
||||
moduleData[0].protocol = PULSES_PPM;
|
||||
moduleData[1].protocol = PULSES_OFF;
|
||||
}
|
||||
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
|
||||
flightModeData[i].clear();
|
||||
@@ -1393,7 +1432,7 @@ void ModelData::clear()
|
||||
sensorData[i].clear();
|
||||
}
|
||||
|
||||
bool ModelData::isempty()
|
||||
bool ModelData::isEmpty() const
|
||||
{
|
||||
return !used;
|
||||
}
|
||||
@@ -1581,7 +1620,7 @@ void registerEEpromInterfaces()
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X));
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_9XRPRO));
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS));
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS));
|
||||
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9E));
|
||||
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
|
||||
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
|
||||
@@ -1595,7 +1634,7 @@ void unregisterEEpromInterfaces()
|
||||
foreach(EEPROMInterface * intf, eepromInterfaces) {
|
||||
// qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast<uint64_t>(intf), 16 );
|
||||
delete intf;
|
||||
}
|
||||
}
|
||||
OpenTxEepromCleanup();
|
||||
}
|
||||
|
||||
@@ -1603,42 +1642,116 @@ QList<Firmware *> firmwares;
|
||||
Firmware * default_firmware_variant;
|
||||
Firmware * current_firmware_variant;
|
||||
|
||||
void unregisterFirmwares()
|
||||
void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound)
|
||||
{
|
||||
foreach (Firmware * f, firmwares) {
|
||||
delete f;
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
QStringList errorsList;
|
||||
|
||||
errorsList << QT_TRANSLATE_NOOP("EepromInterface", "Possible causes for this:");
|
||||
|
||||
if (errors.test(UNSUPPORTED_NEWER_VERSION)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from a newer version of OpenTX"); }
|
||||
if (errors.test(NOT_OPENTX)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from OpenTX"); }
|
||||
if (errors.test(NOT_TH9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Th9X"); }
|
||||
if (errors.test(NOT_GRUVIN9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Gruvin9X"); }
|
||||
if (errors.test(NOT_ERSKY9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from ErSky9X"); }
|
||||
if (errors.test(NOT_ER9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Er9X"); }
|
||||
if (errors.test(WRONG_SIZE)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom size is invalid"); }
|
||||
if (errors.test(WRONG_FILE_SYSTEM)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom file system is invalid"); }
|
||||
if (errors.test(UNKNOWN_BOARD)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from a unknown board"); }
|
||||
if (errors.test(WRONG_BOARD)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from the wrong board"); }
|
||||
if (errors.test(BACKUP_NOT_SUPPORTED)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom backup not supported"); }
|
||||
|
||||
if (errors.test(UNKNOWN_ERROR)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Something that couldn't be guessed, sorry"); }
|
||||
|
||||
if (errors.test(HAS_WARNINGS)) {
|
||||
errorsList << QT_TRANSLATE_NOOP("EepromInterface", "Warning:");
|
||||
if (errors.test(WARNING_WRONG_FIRMWARE)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
|
||||
}
|
||||
|
||||
QMessageBox msgBox(parent);
|
||||
msgBox.setWindowTitle(title);
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setText(mainMessage);
|
||||
msgBox.setInformativeText(errorsList.join("\n"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
bool loadEEprom(RadioData &radioData, const uint8_t *eeprom, const int size)
|
||||
void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound)
|
||||
{
|
||||
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
|
||||
if (eepromInterface->load(radioData, eeprom, size))
|
||||
return true;
|
||||
}
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
QStringList warningsList;
|
||||
if (errors.test(WARNING_WRONG_FIRMWARE)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
|
||||
if (errors.test(OLD_VERSION)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your eeprom is from an old version of OpenTX, upgrading!\n You should 'save as' to keep the old file as a backup."); }
|
||||
|
||||
return false;
|
||||
QMessageBox msgBox(parent);
|
||||
msgBox.setWindowTitle(title);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setText(QT_TRANSLATE_NOOP("EepromInterface", "Warnings!"));
|
||||
msgBox.setInformativeText(warningsList.join("\n"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
bool loadBackup(RadioData &radioData, uint8_t *eeprom, int size, int index)
|
||||
unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
|
||||
if (eepromInterface->loadBackup(radioData, eeprom, size, index))
|
||||
return true;
|
||||
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, eeprom, size));
|
||||
if (result.test(NO_ERROR)) {
|
||||
return result.to_ulong();
|
||||
}
|
||||
else {
|
||||
errors |= result;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (errors.none()) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
}
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long LoadBackup(RadioData & radioData, uint8_t * eeprom, int size, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
|
||||
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index));
|
||||
if (result.test(NO_ERROR)) {
|
||||
return result.to_ulong();
|
||||
}
|
||||
else {
|
||||
errors |= result;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.none()) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
}
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
|
||||
bool loadEEpromXml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long LoadEepromXml(RadioData & radioData, QDomDocument & doc)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
|
||||
if (eepromInterface->loadxml(radioData, doc))
|
||||
return true;
|
||||
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadxml(radioData, doc));
|
||||
if (result.test(NO_ERROR)) {
|
||||
return result.to_ulong();
|
||||
}
|
||||
else {
|
||||
errors |= result;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (errors.none()) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
}
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
QString getBoardName(BoardEnum board)
|
||||
@@ -1660,6 +1773,8 @@ QString getBoardName(BoardEnum board)
|
||||
return "Sky9x";
|
||||
case BOARD_9XRPRO:
|
||||
return "9XR-PRO";
|
||||
case BOARD_AR9X:
|
||||
return "AR9X";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
+142
-84
@@ -22,24 +22,26 @@
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QtXml>
|
||||
#include <QComboBox>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include "constants.h"
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
#define EESIZE_STOCK 2048
|
||||
#define EESIZE_M128 4096
|
||||
#define EESIZE_GRUVIN9X 4096
|
||||
#define EESIZE_TARANIS (32*1024)
|
||||
#define EESIZE_SKY9X (128*4096)
|
||||
#define EESIZE_9XRPRO (128*4096)
|
||||
#define EESIZE_RLC_MAX EESIZE_TARANIS
|
||||
#define EESIZE_STOCK 2048
|
||||
#define EESIZE_M128 4096
|
||||
#define EESIZE_GRUVIN9X 4096
|
||||
#define EESIZE_TARANIS (32*1024)
|
||||
#define EESIZE_SKY9X (128*4096)
|
||||
#define EESIZE_9XRPRO (128*4096)
|
||||
#define EESIZE_MAX EESIZE_9XRPRO
|
||||
|
||||
QString getBoardName(BoardEnum board);
|
||||
|
||||
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
|
||||
#define IS_STOCK(board) (board==BOARD_STOCK)
|
||||
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
|
||||
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
|
||||
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO || board==BOARD_AR9X)
|
||||
#define IS_9XRPRO(board) (board==BOARD_9XRPRO)
|
||||
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
|
||||
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
|
||||
@@ -182,19 +184,6 @@ extern const char downArrow[];
|
||||
class ModelData;
|
||||
class GeneralSettings;
|
||||
|
||||
enum ThrottleSource {
|
||||
THROTTLE_SOURCE_THR,
|
||||
THROTTLE_SOURCE_P1,
|
||||
THROTTLE_SOURCE_P2,
|
||||
THROTTLE_SOURCE_P3,
|
||||
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
|
||||
THROTTLE_SOURCE_S2,
|
||||
THROTTLE_SOURCE_S3,
|
||||
THROTTLE_SOURCE_LS,
|
||||
THROTTLE_SOURCE_RS,
|
||||
THROTTLE_SOURCE_FIRST_CHANNEL,
|
||||
};
|
||||
|
||||
enum TelemetrySource {
|
||||
TELEMETRY_SOURCE_TX_BATT,
|
||||
TELEMETRY_SOURCE_TX_TIME,
|
||||
@@ -292,9 +281,7 @@ class RawSourceRange
|
||||
{
|
||||
}
|
||||
|
||||
float getValue(int value) {
|
||||
return min + float(value) * step;
|
||||
}
|
||||
float getValue(int value);
|
||||
|
||||
int decimals;
|
||||
double min;
|
||||
@@ -392,7 +379,7 @@ class RawSwitch {
|
||||
return index >= 0 ? (type * 256 + index) : -(type * 256 - index);
|
||||
}
|
||||
|
||||
QString toString();
|
||||
QString toString() const;
|
||||
|
||||
bool operator== ( const RawSwitch& other) {
|
||||
return (this->type == other.type) && (this->index == other.index);
|
||||
@@ -428,7 +415,7 @@ class CurveReference {
|
||||
CurveRefType type;
|
||||
int value;
|
||||
|
||||
QString toString();
|
||||
QString toString() const;
|
||||
};
|
||||
|
||||
enum InputMode {
|
||||
@@ -446,7 +433,7 @@ class ExpoData {
|
||||
unsigned int mode;
|
||||
unsigned int chn;
|
||||
RawSwitch swtch;
|
||||
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
|
||||
unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
|
||||
int weight;
|
||||
int offset;
|
||||
CurveReference curve;
|
||||
@@ -469,14 +456,14 @@ class CurveData {
|
||||
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
|
||||
};
|
||||
|
||||
CurveData() { clear(5); }
|
||||
|
||||
CurveData();
|
||||
void clear(int count);
|
||||
bool isEmpty() const;
|
||||
CurveType type;
|
||||
bool smooth;
|
||||
int count;
|
||||
CurvePoint points[C9X_MAX_POINTS];
|
||||
char name[6+1];
|
||||
void clear(int count) { memset(this, 0, sizeof(CurveData)); this->count = count; }
|
||||
};
|
||||
|
||||
class LimitData {
|
||||
@@ -490,9 +477,10 @@ class LimitData {
|
||||
bool symetrical;
|
||||
char name[6+1];
|
||||
CurveReference curve;
|
||||
QString minToString();
|
||||
QString maxToString();
|
||||
QString offsetToString();
|
||||
QString minToString() const;
|
||||
QString maxToString() const;
|
||||
QString offsetToString() const;
|
||||
QString revertToString() const;
|
||||
void clear();
|
||||
};
|
||||
|
||||
@@ -520,7 +508,7 @@ class MixData {
|
||||
bool noExpo;
|
||||
MltpxValue mltpx; // multiplex method 0=+ 1=* 2=replace
|
||||
unsigned int mixWarn; // mixer warning
|
||||
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
|
||||
unsigned int flightModes; // -5=!FP4, 0=normal, 5=FP4
|
||||
int sOffset;
|
||||
char name[MIXDATA_NAME_LEN+1];
|
||||
|
||||
@@ -577,10 +565,9 @@ class LogicalSwitchData { // Logical Switches data
|
||||
unsigned int duration;
|
||||
int andsw;
|
||||
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
|
||||
CSFunctionFamily getFunctionFamily();
|
||||
unsigned int getRangeFlags();
|
||||
QString funcToString();
|
||||
QString toString(const ModelData & model, const GeneralSettings & settings);
|
||||
CSFunctionFamily getFunctionFamily() const;
|
||||
unsigned int getRangeFlags() const;
|
||||
QString funcToString() const;
|
||||
};
|
||||
|
||||
enum AssignFunc {
|
||||
@@ -611,6 +598,12 @@ enum AssignFunc {
|
||||
FuncBackgroundMusicPause,
|
||||
FuncAdjustGV1,
|
||||
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
|
||||
FuncSetFailsafeInternalModule,
|
||||
FuncSetFailsafeExternalModule,
|
||||
FuncRangeCheckInternalModule,
|
||||
FuncRangeCheckExternalModule,
|
||||
FuncBindInternalModule,
|
||||
FuncBindExternalModule,
|
||||
FuncCount,
|
||||
FuncReserve = -1
|
||||
};
|
||||
@@ -626,10 +619,15 @@ class CustomFunctionData { // Function Switches data
|
||||
unsigned int adjustMode;
|
||||
int repeatParam;
|
||||
void clear();
|
||||
QString funcToString();
|
||||
QString paramToString();
|
||||
QString repeatToString();
|
||||
QStringList toStringList();
|
||||
QString funcToString() const;
|
||||
QString paramToString(const ModelData * model) const;
|
||||
QString repeatToString() const;
|
||||
QString enabledToString() const;
|
||||
|
||||
static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value);
|
||||
static void populatePlaySoundParams(QStringList & qs);
|
||||
static void populateHapticParams(QStringList & qs);
|
||||
|
||||
};
|
||||
|
||||
class FlightModeData {
|
||||
@@ -757,6 +755,22 @@ enum TelemetryCurrentSources {
|
||||
TELEMETRY_CURRENT_SOURCE_FAS
|
||||
};
|
||||
|
||||
enum UartModes {
|
||||
UART_MODE_NONE,
|
||||
UART_MODE_TELEMETRY_MIRROR,
|
||||
UART_MODE_TELEMETRY,
|
||||
UART_MODE_SBUS_TRAINER,
|
||||
UART_MODE_DEBUG
|
||||
};
|
||||
|
||||
enum TrainerMode {
|
||||
TRAINER_MODE_MASTER_TRAINER_JACK,
|
||||
TRAINER_MODE_SLAVE,
|
||||
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
||||
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
||||
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
||||
};
|
||||
|
||||
class FrSkyData {
|
||||
public:
|
||||
FrSkyData() { clear(); }
|
||||
@@ -769,6 +783,7 @@ class FrSkyData {
|
||||
FrSkyScreenData screens[4];
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
unsigned int varioSource;
|
||||
bool varioCenterSilent;
|
||||
int varioMin;
|
||||
int varioCenterMin; // if increment in 0.2m/s = 3.0m/s max
|
||||
int varioCenterMax;
|
||||
@@ -776,6 +791,7 @@ class FrSkyData {
|
||||
bool mAhPersistent;
|
||||
unsigned int storedMah;
|
||||
int fasOffset;
|
||||
bool ignoreSensorIds;
|
||||
|
||||
void clear();
|
||||
};
|
||||
@@ -792,6 +808,12 @@ class MavlinkData {
|
||||
|
||||
class TimerData {
|
||||
public:
|
||||
enum CountDownMode {
|
||||
COUNTDOWN_SILENT,
|
||||
COUNTDOWN_BEEPS,
|
||||
COUNTDOWN_VOICE,
|
||||
COUNTDOWN_HAPTIC
|
||||
};
|
||||
TimerData() { clear(); }
|
||||
RawSwitch mode;
|
||||
char name[TIMER_NAME_LEN+1];
|
||||
@@ -803,31 +825,32 @@ 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_CROSSFIRE,
|
||||
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 {
|
||||
@@ -842,10 +865,10 @@ class ModuleData {
|
||||
int failsafeChannels[C9X_NUM_CHNOUT];
|
||||
int ppmDelay;
|
||||
bool ppmPulsePol; // false = positive
|
||||
bool ppmOutputType; // false = open drain, true = push pull
|
||||
bool ppmOutputType; // false = open drain, true = push pull
|
||||
int ppmFrameLength;
|
||||
void clear() { memset(this, 0, sizeof(ModuleData)); }
|
||||
QString polarityToString() { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); }
|
||||
QString polarityToString() const { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
|
||||
};
|
||||
|
||||
#define C9X_MAX_SCRIPTS 7
|
||||
@@ -914,7 +937,7 @@ class SensorData {
|
||||
UNIT_PERCENT,
|
||||
UNIT_MAH,
|
||||
UNIT_WATTS,
|
||||
UNIT_DBM,
|
||||
UNIT_DB,
|
||||
UNIT_RPMS,
|
||||
UNIT_G,
|
||||
UNIT_DEGREE,
|
||||
@@ -987,6 +1010,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];
|
||||
@@ -1037,8 +1065,10 @@ class ModelData {
|
||||
|
||||
SensorData sensorData[C9X_MAX_SENSORS];
|
||||
|
||||
unsigned int toplcdTimer;
|
||||
|
||||
void clear();
|
||||
bool isempty();
|
||||
bool isEmpty() const;
|
||||
void setDefaultInputs(const GeneralSettings & settings);
|
||||
void setDefaultMixes(const GeneralSettings & settings);
|
||||
void setDefaultValues(unsigned int id, const GeneralSettings & settings);
|
||||
@@ -1122,7 +1152,8 @@ class GeneralSettings {
|
||||
unsigned int currModel; // 0..15
|
||||
unsigned int contrast;
|
||||
unsigned int vBatWarn;
|
||||
int vBatCalib;
|
||||
int txVoltageCalibration;
|
||||
int txCurrentCalibration;
|
||||
int vBatMin;
|
||||
int vBatMax;
|
||||
int backlightMode;
|
||||
@@ -1170,7 +1201,6 @@ class GeneralSettings {
|
||||
int speakerVolume;
|
||||
unsigned int backlightBright;
|
||||
int switchesDelay;
|
||||
int currentCalib;
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
@@ -1271,7 +1301,6 @@ enum Capability {
|
||||
HasExpoNames,
|
||||
HasNoExpo,
|
||||
HasMixerNames,
|
||||
HasChNames,
|
||||
HasCvNames,
|
||||
HasPxxCountry,
|
||||
HasPPMStart,
|
||||
@@ -1301,7 +1330,7 @@ enum Capability {
|
||||
PPMCenter,
|
||||
PPMUnitMicroseconds,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
HastxCurrentCalibration,
|
||||
HasVolume,
|
||||
HasBrightness,
|
||||
PerModelTimers,
|
||||
@@ -1313,6 +1342,8 @@ enum Capability {
|
||||
LCDWidth,
|
||||
GetThrSwitch,
|
||||
HasDisplayText,
|
||||
HasTopLcd,
|
||||
GlobalFunctions,
|
||||
VirtualInputs,
|
||||
TrainerInputs,
|
||||
RtcTime,
|
||||
@@ -1331,7 +1362,8 @@ enum Capability {
|
||||
HasInputDiff,
|
||||
HasMixerExpo,
|
||||
MixersMonitor,
|
||||
HasBatMeterRange
|
||||
HasBatMeterRange,
|
||||
DangerousFunctions,
|
||||
};
|
||||
|
||||
class SimulatorInterface;
|
||||
@@ -1348,19 +1380,17 @@ class EEPROMInterface
|
||||
|
||||
inline BoardEnum getBoard() { return board; }
|
||||
|
||||
virtual bool load(RadioData &radioData, const uint8_t *eeprom, int size) = 0;
|
||||
virtual unsigned long load(RadioData &radioData, const uint8_t *eeprom, int size) = 0;
|
||||
|
||||
virtual bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0;
|
||||
virtual unsigned long loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0;
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc) = 0;
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc) = 0;
|
||||
|
||||
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 isAvailable(Protocol proto, int port=0) = 0;
|
||||
virtual int getSize(const GeneralSettings &) = 0;
|
||||
|
||||
virtual const int getEEpromSize() = 0;
|
||||
|
||||
@@ -1473,11 +1503,37 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
||||
void registerEEpromInterfaces();
|
||||
void unregisterEEpromInterfaces();
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
|
||||
bool loadEEprom(RadioData &radioData, const uint8_t *eeprom, int size);
|
||||
bool loadEEpromXml(RadioData &radioData, QDomDocument &doc);
|
||||
enum EepromLoadErrors {
|
||||
NO_ERROR,
|
||||
|
||||
UNKNOWN_ERROR,
|
||||
UNSUPPORTED_NEWER_VERSION,
|
||||
WRONG_SIZE,
|
||||
WRONG_FILE_SYSTEM,
|
||||
NOT_OPENTX,
|
||||
NOT_TH9X,
|
||||
NOT_GRUVIN9X,
|
||||
NOT_ERSKY9X,
|
||||
NOT_ER9X,
|
||||
UNKNOWN_BOARD,
|
||||
WRONG_BOARD,
|
||||
BACKUP_NOT_SUPPORTED,
|
||||
|
||||
HAS_WARNINGS,
|
||||
OLD_VERSION,
|
||||
WARNING_WRONG_FIRMWARE,
|
||||
|
||||
NUM_ERRORS
|
||||
};
|
||||
|
||||
void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound);
|
||||
void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound);
|
||||
|
||||
unsigned long LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
|
||||
unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
|
||||
unsigned long LoadEepromXml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
struct Option {
|
||||
const char * name;
|
||||
@@ -1571,6 +1627,8 @@ class Firmware {
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source) = 0;
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
|
||||
|
||||
public:
|
||||
QList<const char *> languages;
|
||||
QList<const char *> ttslanguages;
|
||||
|
||||
+7
-10
@@ -52,7 +52,8 @@ void RleFile::EeFsCreate(uint8_t *eeprom, int size, BoardEnum board, unsigned in
|
||||
if (IS_SKY9X(board)) {
|
||||
memset(eeprom, 0xFF, size);
|
||||
if (version >= 217) {
|
||||
eepromFatHeader = (EepromHeader *)eeprom;
|
||||
memset(eeprom, 0, EEPROM_FAT_SIZE);
|
||||
eepromFatHeader = (EepromHeader *)(eeprom + EEPROM_FAT_SIZE);
|
||||
eepromFatHeader->mark = EEPROM_MARK;
|
||||
eepromFatHeader->index = 1;
|
||||
for (int i=0; i<EEPROM_MAX_FILES; i++) {
|
||||
@@ -121,20 +122,16 @@ PACK(struct EepromFileHeader
|
||||
|
||||
bool RleFile::searchFat()
|
||||
{
|
||||
int bestFatIndex = -1;
|
||||
eepromFatHeader = NULL;
|
||||
uint32_t bestFatIndex = 0;
|
||||
for (int i=0; i<EEPROM_ZONE_SIZE/EEPROM_FAT_SIZE; i++) {
|
||||
EepromHeader * header = (EepromHeader *)(eeprom+i*EEPROM_FAT_SIZE);
|
||||
if (header->mark == EEPROM_MARK && (int)header->index >= bestFatIndex) {
|
||||
bestFatIndex = i;
|
||||
eepromFatHeader = header;
|
||||
bestFatIndex = header->index;
|
||||
}
|
||||
}
|
||||
if (bestFatIndex >= 0) {
|
||||
eepromFatHeader = (EepromHeader *)(eeprom+bestFatIndex*EEPROM_FAT_SIZE);;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return (eepromFatHeader != NULL);
|
||||
}
|
||||
|
||||
bool RleFile::EeFsOpen(uint8_t *eeprom, int size, BoardEnum board)
|
||||
|
||||
Executable → Regular
+56
-51
@@ -20,6 +20,7 @@
|
||||
#include "firmwareinterface.h"
|
||||
#include "helpers.h"
|
||||
|
||||
#define FW_MARK "FW"
|
||||
#define VERS_MARK "VERS"
|
||||
#define DATE_MARK "DATE"
|
||||
#define TIME_MARK "TIME"
|
||||
@@ -44,30 +45,34 @@ int getFileType(const QString &fullFileName)
|
||||
|
||||
FirmwareInterface::FirmwareInterface(const QString &filename):
|
||||
flash(MAX_FSIZE, 0),
|
||||
flash_size(0),
|
||||
flashSize(0),
|
||||
versionId(0),
|
||||
splash_offset(0),
|
||||
splash_size(0),
|
||||
splash_width(0),
|
||||
splash_height(0),
|
||||
eepromVersion(0),
|
||||
eepromVariant(0),
|
||||
splashOffset(0),
|
||||
splashSize(0),
|
||||
splashWidth(0),
|
||||
splashHeight(0),
|
||||
isValidFlag(false)
|
||||
{
|
||||
if (!filename.isEmpty()) {
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
|
||||
QTextStream inputStream(&file);
|
||||
flash_size = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
|
||||
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
|
||||
file.close();
|
||||
if (flash_size == 0) {
|
||||
if (flashSize == 0) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
flash_size = file.read((char *)flash.data(), MAX_FSIZE);
|
||||
flashSize = file.read((char *)flash.data(), MAX_FSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flash_size > 0) {
|
||||
if (flashSize > 0) {
|
||||
flavour = seekLabel(FW_MARK);
|
||||
version = seekLabel(VERS_MARK);
|
||||
if (version.startsWith("opentx-")) {
|
||||
// old version format
|
||||
int index = version.lastIndexOf('-');
|
||||
flavour = version.mid(0, index);
|
||||
version = version.mid(index+1);
|
||||
@@ -150,8 +155,8 @@ bool FirmwareInterface::SeekSplash(QByteArray splash)
|
||||
{
|
||||
int start = flash.indexOf(splash);
|
||||
if (start>0) {
|
||||
splash_offset = start;
|
||||
splash_size = splash.size();
|
||||
splashOffset = start;
|
||||
splashSize = splash.size();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@@ -167,8 +172,8 @@ bool FirmwareInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
|
||||
if (start>0) {
|
||||
int end = start + sps.size() + size;
|
||||
if (end == flash.indexOf(spe, end)) {
|
||||
splash_offset = start + sps.size();
|
||||
splash_size = end - start - sps.size();
|
||||
splashOffset = start + sps.size();
|
||||
splashSize = end - start - sps.size();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@@ -187,10 +192,10 @@ bool FirmwareInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
|
||||
|
||||
void FirmwareInterface::SeekSplash(void)
|
||||
{
|
||||
splash_size = 0;
|
||||
splash_offset = 0;
|
||||
splash_width = SPLASH_WIDTH;
|
||||
splash_height = SPLASH_HEIGHT;
|
||||
splashSize = 0;
|
||||
splashOffset = 0;
|
||||
splashWidth = SPLASH_WIDTH;
|
||||
splashHeight = SPLASH_HEIGHT;
|
||||
splash_format = QImage::Format_Mono;
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)gr9x_splash, sizeof(gr9x_splash))) || SeekSplash(QByteArray((const char *)gr9xv4_splash, sizeof(gr9xv4_splash)))) {
|
||||
@@ -206,8 +211,8 @@ void FirmwareInterface::SeekSplash(void)
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)opentxtaranis_splash, sizeof(opentxtaranis_splash)))) {
|
||||
splash_width = SPLASHX9D_WIDTH;
|
||||
splash_height = SPLASHX9D_HEIGHT;
|
||||
splashWidth = SPLASHX9D_WIDTH;
|
||||
splashHeight = SPLASHX9D_HEIGHT;
|
||||
splash_format = QImage::Format_Indexed8;
|
||||
return;
|
||||
}
|
||||
@@ -221,8 +226,8 @@ void FirmwareInterface::SeekSplash(void)
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(OTX_SPS_TARANIS, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 6784)) {
|
||||
splash_width = SPLASHX9D_WIDTH;
|
||||
splash_height = SPLASHX9D_HEIGHT;
|
||||
splashWidth = SPLASHX9D_WIDTH;
|
||||
splashHeight = SPLASHX9D_HEIGHT;
|
||||
splash_format = QImage::Format_Indexed8;
|
||||
return;
|
||||
}
|
||||
@@ -232,14 +237,14 @@ void FirmwareInterface::SeekSplash(void)
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(ERSPLASH_MARKER, sizeof(ERSPLASH_MARKER)))) {
|
||||
splash_offset += sizeof(ERSPLASH_MARKER);
|
||||
splash_size = sizeof(er9x_splash);
|
||||
splashOffset += sizeof(ERSPLASH_MARKER);
|
||||
splashSize = sizeof(er9x_splash);
|
||||
}
|
||||
}
|
||||
|
||||
bool FirmwareInterface::setSplash(const QImage & newsplash)
|
||||
{
|
||||
if (splash_offset == 0 || splash_size == 0) {
|
||||
if (splashOffset == 0 || splashSize == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -247,9 +252,9 @@ bool FirmwareInterface::setSplash(const QImage & newsplash)
|
||||
QColor color;
|
||||
QByteArray splash;
|
||||
if (splash_format == QImage::Format_Indexed8) {
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
unsigned int idx = (y/2)*splash_width;
|
||||
for (unsigned int x=0; x<splash_width; x++, idx++) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
unsigned int idx = (y/2)*splashWidth;
|
||||
for (unsigned int x=0; x<splashWidth; x++, idx++) {
|
||||
QRgb gray = qGray(newsplash.pixel(x, y));
|
||||
uint8_t z = ((255-gray)*15)/255;
|
||||
if (y & 1) z <<= 4;
|
||||
@@ -260,27 +265,27 @@ bool FirmwareInterface::setSplash(const QImage & newsplash)
|
||||
else {
|
||||
QColor black = QColor(0,0,0);
|
||||
QImage blackNwhite = newsplash.convertToFormat(QImage::Format_MonoLSB);
|
||||
for (uint y=0; y<splash_height; y++) {
|
||||
for (uint x=0; x<splash_width; x++) {
|
||||
for (uint y=0; y<splashHeight; y++) {
|
||||
for (uint x=0; x<splashWidth; x++) {
|
||||
color = QColor(blackNwhite.pixel(x,y));
|
||||
b[splash_width*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
|
||||
b[splashWidth*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
splash.clear();
|
||||
splash.append(b, splash_size);
|
||||
flash.replace(splash_offset, splash_size, splash);
|
||||
splash.append(b, splashSize);
|
||||
flash.replace(splashOffset, splashSize, splash);
|
||||
return true;
|
||||
}
|
||||
|
||||
int FirmwareInterface::getSplashWidth()
|
||||
{
|
||||
return splash_width;
|
||||
return splashWidth;
|
||||
}
|
||||
|
||||
uint FirmwareInterface::getSplashHeight()
|
||||
{
|
||||
return splash_height;
|
||||
return splashHeight;
|
||||
}
|
||||
|
||||
QImage::Format FirmwareInterface::getSplashFormat()
|
||||
@@ -290,17 +295,17 @@ QImage::Format FirmwareInterface::getSplashFormat()
|
||||
|
||||
QImage FirmwareInterface::getSplash()
|
||||
{
|
||||
if (splash_offset == 0 || splash_size == 0) {
|
||||
if (splashOffset == 0 || splashSize == 0) {
|
||||
return QImage(); // empty image
|
||||
}
|
||||
|
||||
if (splash_format == QImage::Format_Indexed8) {
|
||||
QImage image(splash_width, splash_height, QImage::Format_RGB888);
|
||||
if (splash_offset > 0) {
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
unsigned int idx = (y/2)*splash_width;
|
||||
for (unsigned int x=0; x<splash_width; x++, idx++) {
|
||||
uint8_t byte = flash.at(splash_offset+idx);
|
||||
QImage image(splashWidth, splashHeight, QImage::Format_RGB888);
|
||||
if (splashOffset > 0) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
unsigned int idx = (y/2)*splashWidth;
|
||||
for (unsigned int x=0; x<splashWidth; x++, idx++) {
|
||||
uint8_t byte = flash.at(splashOffset+idx);
|
||||
unsigned int z = (y & 1) ? (byte >> 4) : (byte & 0x0F);
|
||||
z = 255-(z*255)/15;
|
||||
QRgb rgb = qRgb(z, z, z);
|
||||
@@ -311,11 +316,11 @@ QImage FirmwareInterface::getSplash()
|
||||
return image;
|
||||
}
|
||||
else {
|
||||
QImage image(splash_width, splash_height, QImage::Format_Mono);
|
||||
if (splash_offset > 0) {
|
||||
for (unsigned int y=0; y<splash_height; y++) {
|
||||
for(unsigned int x=0; x<splash_width; x++) {
|
||||
image.setPixel(x, y, (flash.at(splash_offset+(splash_width*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
|
||||
QImage image(splashWidth, splashHeight, QImage::Format_Mono);
|
||||
if (splashOffset > 0) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
for(unsigned int x=0; x<splashWidth; x++) {
|
||||
image.setPixel(x, y, (flash.at(splashOffset+(splashWidth*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,7 +330,7 @@ QImage FirmwareInterface::getSplash()
|
||||
|
||||
bool FirmwareInterface::hasSplash()
|
||||
{
|
||||
return (splash_offset > 0 ? true : false);
|
||||
return (splashOffset > 0 ? true : false);
|
||||
}
|
||||
|
||||
bool FirmwareInterface::isValid()
|
||||
@@ -336,7 +341,7 @@ bool FirmwareInterface::isValid()
|
||||
unsigned int FirmwareInterface::save(QString fileName)
|
||||
{
|
||||
uint8_t binflash[MAX_FSIZE];
|
||||
memcpy(&binflash, flash.constData(), flash_size);
|
||||
memcpy(&binflash, flash.constData(), flashSize);
|
||||
QFile file(fileName);
|
||||
|
||||
int fileType = getFileType(fileName);
|
||||
@@ -347,16 +352,16 @@ unsigned int FirmwareInterface::save(QString fileName)
|
||||
}
|
||||
QTextStream outputStream(&file);
|
||||
HexInterface hex=HexInterface(outputStream);
|
||||
hex.save(binflash, flash_size);
|
||||
hex.save(binflash, flashSize);
|
||||
}
|
||||
else {
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { //reading HEX TEXT file
|
||||
return -1;
|
||||
}
|
||||
file.write((char*)binflash, flash_size);
|
||||
file.write((char*)binflash, flashSize);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return flash_size;
|
||||
return flashSize;
|
||||
}
|
||||
|
||||
Executable → Regular
+6
-6
@@ -45,7 +45,7 @@ class FirmwareInterface
|
||||
FirmwareInterface(const QString &filename);
|
||||
inline QString getDate() { return date; }
|
||||
inline QString getTime() { return time; }
|
||||
int getSize() { return flash_size; }
|
||||
int getSize() { return flashSize; }
|
||||
QString getFlavour() const;
|
||||
bool isHardwareCompatible(const FirmwareInterface &previousFirmware) const;
|
||||
inline QString getVersion() { return version; }
|
||||
@@ -64,7 +64,7 @@ class FirmwareInterface
|
||||
|
||||
private:
|
||||
QByteArray flash;
|
||||
uint flash_size;
|
||||
uint flashSize;
|
||||
QString seekString(const QString & string);
|
||||
QString seekLabel(const QString & label);
|
||||
void SeekSplash();
|
||||
@@ -80,10 +80,10 @@ class FirmwareInterface
|
||||
int eepromVersion;
|
||||
int eepromVariant;
|
||||
QByteArray splash;
|
||||
uint splash_offset;
|
||||
uint splash_size;
|
||||
uint splash_width;
|
||||
uint splash_height;
|
||||
uint splashOffset;
|
||||
uint splashSize;
|
||||
uint splashWidth;
|
||||
uint splashHeight;
|
||||
QImage::Format splash_format;
|
||||
bool isValidFlag;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -89,14 +89,17 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
|
||||
}
|
||||
|
||||
bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying er9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
Er9xGeneral er9xGeneral;
|
||||
memset(&er9xGeneral,0,sizeof(er9xGeneral));
|
||||
if(!loadGeneralDataXML(&doc, &er9xGeneral)) {
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
} else {
|
||||
radioData.generalSettings=er9xGeneral;
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
@@ -111,21 +114,26 @@ bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying er9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
@@ -133,7 +141,8 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
|
||||
if (efile->readRlc1((uint8_t*)&er9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
@@ -151,13 +160,16 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
break;
|
||||
default:
|
||||
std::cout << "not er9x\n";
|
||||
return false;
|
||||
errors.set(NOT_ER9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc1((uint8_t*)&er9xGeneral, sizeof(Er9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
|
||||
}
|
||||
radioData.generalSettings = er9xGeneral;
|
||||
|
||||
@@ -174,12 +186,15 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
unsigned long Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Er9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
@@ -190,23 +205,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -29,24 +29,24 @@ class Er9xInterface : public EEPROMInterface
|
||||
virtual ~Er9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(ModelData &);
|
||||
|
||||
virtual int getSize(GeneralSettings &settings);
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int isAvailable(Protocol proto, int port=0);
|
||||
virtual int getSize(const GeneralSettings &settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -54,17 +54,17 @@ class Er9xInterface : public EEPROMInterface
|
||||
|
||||
private:
|
||||
void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
|
||||
|
||||
|
||||
void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
|
||||
|
||||
|
||||
void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);
|
||||
|
||||
|
||||
QDomElement getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); //parse out data to XML format
|
||||
|
||||
|
||||
QDomElement getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver); //parse out data to XML format
|
||||
|
||||
|
||||
bool loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); // get data from XML
|
||||
|
||||
|
||||
bool loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum = -1); // get data from XML
|
||||
|
||||
};
|
||||
|
||||
@@ -54,8 +54,14 @@ class Er9xSimulator : public SimulatorInterface {
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts() {};
|
||||
|
||||
protected:
|
||||
|
||||
Er9xInterface * er9xInterface;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
#include "ersky9xinterface.h"
|
||||
#include "ersky9xeeprom.h"
|
||||
#include "simulator/ersky9xsimulator.h"
|
||||
@@ -120,14 +119,17 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
|
||||
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying ersky9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
Ersky9xGeneral ersky9xGeneral;
|
||||
memset(&ersky9xGeneral,0,sizeof(ersky9xGeneral));
|
||||
if(!loadGeneralDataXML(&doc, &ersky9xGeneral)) {
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
else {
|
||||
radioData.generalSettings=ersky9xGeneral;
|
||||
@@ -137,32 +139,39 @@ bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
if (ersky9xGeneral.myVers == 10) {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v10>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v11>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying ersky9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != EESIZE_SKY9X) {
|
||||
std::cout << "wrong size\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
@@ -170,7 +179,8 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
|
||||
|
||||
if (efile->readRlc2((uint8_t*)&ersky9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
@@ -182,12 +192,14 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
|
||||
break;
|
||||
default:
|
||||
std::cout << "not ersky9x\n";
|
||||
return false;
|
||||
errors.set(NOT_ERSKY9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc2((uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
radioData.generalSettings = ersky9xGeneral;
|
||||
|
||||
@@ -218,12 +230,15 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Ersky9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
@@ -234,23 +249,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;
|
||||
|
||||
@@ -34,19 +34,19 @@ class Ersky9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, const uint8_t * eeprom, int size);
|
||||
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
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:
|
||||
|
||||
|
||||
@@ -54,8 +54,14 @@ class Ersky9xSimulator : public SimulatorInterface {
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts() {};
|
||||
|
||||
protected:
|
||||
|
||||
Ersky9xInterface * ersky9xInterface;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -93,24 +93,30 @@ bool Gruvin9xInterface::loadGeneral(GeneralSettings &settings, int version)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
|
||||
bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != this->getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
@@ -118,14 +124,16 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
|
||||
uint8_t version;
|
||||
if (efile->readRlc2(&version, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (version == 0) {
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (efile->readRlc1(&version, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,25 +153,33 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
|
||||
break;
|
||||
default:
|
||||
std::cout << "not gruvin9x\n";
|
||||
return false;
|
||||
errors.set(NOT_GRUVIN9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (version == 5) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1))
|
||||
return false;
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else if (version < 104) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings))
|
||||
return false;
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else if (version <= 106) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings))
|
||||
return false;
|
||||
if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
@@ -185,17 +201,21 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
|
||||
}
|
||||
else {
|
||||
std::cout << "ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
unsigned long Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
@@ -206,25 +226,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -30,24 +30,25 @@ class Gruvin9xInterface : public EEPROMInterface
|
||||
virtual ~Gruvin9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(ModelData &);
|
||||
|
||||
virtual int getSize(GeneralSettings &settings);
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int isAvailable(Protocol proto, int port=0);
|
||||
virtual int getSize(const GeneralSettings & settings);
|
||||
|
||||
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);
|
||||
|
||||
@@ -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++);
|
||||
@@ -266,15 +269,18 @@ class SourcesConversionTable: public ConversionTable {
|
||||
}
|
||||
|
||||
if (!afterrelease21March2013) {
|
||||
for (int i=0; i<3; i++)
|
||||
for (int i=0; i<3; i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_CYC, i), val++);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_PPM_INPUTS(board, version); i++)
|
||||
for (int i=0; i<NUM_PPM_INPUTS(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_PPM, i), val++);
|
||||
}
|
||||
|
||||
for (int i=0; i<MAX_CHANNELS(board, version); i++)
|
||||
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_CH, i), val++);
|
||||
}
|
||||
|
||||
if (!(flags & FLAG_NOTELEMETRY)) {
|
||||
if (IS_ARM(board) && version >= 217) {
|
||||
@@ -290,33 +296,34 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
if (afterrelease21March2013) {
|
||||
if ((board != BOARD_STOCK && (board!=BOARD_M128 || version<215)) || (variant & GVARS_VARIANT)) {
|
||||
for (int i=0; i<MAX_GVARS(board, version); i++)
|
||||
for (int i=0; i<MAX_GVARS(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_GVAR, i), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
|
||||
if (version < 216) {
|
||||
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPEED || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 0), val++); // BATT
|
||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 1), val++); // TIME
|
||||
val += 5;
|
||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // Timer1
|
||||
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer2
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
|
||||
if (version < 216) {
|
||||
if (i == TELEMETRY_SOURCE_TX_TIME || i == TELEMETRY_SOURCE_SWR || i == TELEMETRY_SOURCE_A3 ||
|
||||
i == TELEMETRY_SOURCE_A4 || i == TELEMETRY_SOURCE_ASPEED || i == TELEMETRY_SOURCE_DTE ||
|
||||
i == TELEMETRY_SOURCE_CELL_MIN || i == TELEMETRY_SOURCE_CELLS_MIN || i == TELEMETRY_SOURCE_VFAS_MIN)
|
||||
continue;
|
||||
}
|
||||
if (i == TELEMETRY_SOURCE_TX_TIME || i == TELEMETRY_SOURCE_SWR || i == TELEMETRY_SOURCE_A3 ||
|
||||
i == TELEMETRY_SOURCE_A4 || i == TELEMETRY_SOURCE_A3_MIN || i == TELEMETRY_SOURCE_A4_MIN)
|
||||
continue;
|
||||
}
|
||||
if (!IS_ARM(board)) {
|
||||
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_A3_MIN || i==TELEMETRY_SOURCE_A4_MIN)
|
||||
continue;
|
||||
}
|
||||
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
|
||||
if (version >= 216 && IS_ARM(board)) {
|
||||
if (i==TELEMETRY_SOURCE_RSSI_RX)
|
||||
val += 1;
|
||||
if (i==TELEMETRY_SOURCE_TX_TIME)
|
||||
val += 5;
|
||||
if (i==TELEMETRY_SOURCE_DTE)
|
||||
val += 5;
|
||||
if (i==TELEMETRY_SOURCE_POWER_MAX)
|
||||
val += 5;
|
||||
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,38 +387,12 @@ 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:
|
||||
SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0):
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch",
|
||||
"Switch "+ sw.toString()+" cannot be exported on this board!"),
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toAscii(),
|
||||
QObject::tr("Switch ").toAscii()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toAscii()),
|
||||
sw(sw),
|
||||
_switch(0)
|
||||
{
|
||||
@@ -943,7 +924,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 +942,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 +960,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 +981,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 +1000,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 +1045,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 +1066,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 +1195,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 +1207,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 +1218,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 +1232,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 +1241,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 +1258,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 +1267,7 @@ class InputField: public TransformedField {
|
||||
internalField.Append(new UnsignedField<2>(expo.mode));
|
||||
internalField.Append(new SwitchField<6>(expo.swtch, board, version));
|
||||
internalField.Append(new UnsignedField<2>(expo.chn));
|
||||
internalField.Append(new UnsignedField<5>(expo.phases));
|
||||
internalField.Append(new UnsignedField<5>(expo.flightModes));
|
||||
internalField.Append(new BoolField<1>(_curveMode));
|
||||
internalField.Append(new SignedField<8>(_weight));
|
||||
internalField.Append(new SignedField<8>(_curveParam));
|
||||
@@ -1360,10 +1341,9 @@ class InputField: public TransformedField {
|
||||
|
||||
class LimitField: public StructField {
|
||||
public:
|
||||
template <int shift>
|
||||
template <int shift, int GV1>
|
||||
static int exportLimitValue(int value)
|
||||
{
|
||||
const int GV1 = 4096;
|
||||
if (value > 10000) {
|
||||
return -GV1 + value - 10001;
|
||||
}
|
||||
@@ -1373,16 +1353,9 @@ class LimitField: public StructField {
|
||||
return value + shift;
|
||||
}
|
||||
|
||||
template <int shift>
|
||||
template <int shift, int GV1>
|
||||
static int importLimitValue(int value)
|
||||
{
|
||||
/* GVARS mapping on radio:
|
||||
GV1 = -4096
|
||||
GV9 = -4088
|
||||
-GV1 = 4095
|
||||
-GV9 = 4087
|
||||
*/
|
||||
const int GV1 = 4096;
|
||||
if (value >= GV1) {
|
||||
return 10001 + value - GV1;
|
||||
}
|
||||
@@ -1402,10 +1375,10 @@ class LimitField: public StructField {
|
||||
StructField("Limit")
|
||||
{
|
||||
if (IS_TARANIS(board) && version >= 217) {
|
||||
Append(new ConversionField< SignedField<11> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||
Append(new ConversionField< SignedField<11> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||
Append(new ConversionField< SignedField<11> >(limit.min, exportLimitValue<1000, 1024>, importLimitValue<1000, 1024>));
|
||||
Append(new ConversionField< SignedField<11> >(limit.max, exportLimitValue<-1000, 1024>, importLimitValue<-1000, 1024>));
|
||||
Append(new SignedField<10>(limit.ppmCenter));
|
||||
Append(new ConversionField< SignedField<11> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||
Append(new ConversionField< SignedField<11> >(limit.offset, exportLimitValue<0, 1024>, importLimitValue<0, 1024>));
|
||||
Append(new BoolField<1>(limit.symetrical));
|
||||
Append(new BoolField<1>(limit.revert));
|
||||
Append(new SpareBitsField<3>());
|
||||
@@ -1416,10 +1389,10 @@ class LimitField: public StructField {
|
||||
}
|
||||
else {
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000, 4096>, importLimitValue<1000, 4096>));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000, 4096>, importLimitValue<-1000, 4096>));
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0, 4096>, importLimitValue<0, 4096>));
|
||||
}
|
||||
else {
|
||||
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
||||
@@ -1710,12 +1683,6 @@ class LogicalSwitchField: public TransformedField {
|
||||
internalField.Append(new SignedField<16>(v3));
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(csw.func, &functionsConversionTable, "Function"));
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 216) {
|
||||
internalField.Append(new SignedField<8>(v1));
|
||||
internalField.Append(new SignedField<16>(v2));
|
||||
internalField.Append(new SignedField<16>(v3));
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(csw.func, &functionsConversionTable, "Function"));
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 215) {
|
||||
internalField.Append(new SignedField<16>(v1));
|
||||
internalField.Append(new SignedField<16>(v2));
|
||||
@@ -1754,6 +1721,7 @@ class LogicalSwitchField: public TransformedField {
|
||||
{
|
||||
delete andswitchesConversionTable;
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (csw.func == LS_FN_TIMER) {
|
||||
@@ -1795,8 +1763,14 @@ class LogicalSwitchField: public TransformedField {
|
||||
switchesConversionTable->importValue(v2, csw.val2);
|
||||
}
|
||||
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
|
||||
if (IS_ARM(board)) {
|
||||
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
|
||||
sourcesConversionTable->importValue((uint32_t)v2, csw.val2);
|
||||
}
|
||||
else {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
|
||||
}
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
RawSource val1(csw.val1);
|
||||
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
|
||||
@@ -1809,7 +1783,12 @@ class LogicalSwitchField: public TransformedField {
|
||||
}
|
||||
}
|
||||
else if (csw.func != LS_FN_OFF) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
if (IS_ARM(board) && version >= 217) {
|
||||
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) {
|
||||
@@ -1938,9 +1917,12 @@ class CustomFunctionsConversionTable: public ConversionTable {
|
||||
val++;
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(FuncVolume, val++);
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncSetFailsafeInternalModule, val);
|
||||
addConversion(FuncSetFailsafeExternalModule, val++);
|
||||
addConversion(FuncRangeCheckInternalModule, val);
|
||||
addConversion(FuncRangeCheckExternalModule, val++);
|
||||
addConversion(FuncBindInternalModule, val);
|
||||
addConversion(FuncBindExternalModule, val++);
|
||||
}
|
||||
addConversion(FuncPlaySound, val++);
|
||||
addConversion(FuncPlayPrompt, val++);
|
||||
@@ -2099,6 +2081,21 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
*((uint8_t *)(_param+3)) = fn.func - FuncSetTimer1;
|
||||
}
|
||||
}
|
||||
else if (fn.func >= FuncSetFailsafeInternalModule && fn.func <= FuncSetFailsafeExternalModule) {
|
||||
if (version >= 216) {
|
||||
*((uint16_t *)_param) = fn.func - FuncSetFailsafeInternalModule;
|
||||
}
|
||||
}
|
||||
else if (fn.func >= FuncRangeCheckInternalModule && fn.func <= FuncRangeCheckExternalModule) {
|
||||
if (version >= 216) {
|
||||
*((uint16_t *)_param) = fn.func - FuncRangeCheckInternalModule;
|
||||
}
|
||||
}
|
||||
else if (fn.func >= FuncBindInternalModule && fn.func <= FuncBindExternalModule) {
|
||||
if (version >= 216) {
|
||||
*((uint16_t *)_param) = fn.func - FuncBindInternalModule;
|
||||
}
|
||||
}
|
||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic || fn.func == FuncPlayScript) {
|
||||
memcpy(_param, fn.paramarm, sizeof(_param));
|
||||
}
|
||||
@@ -2214,8 +2211,9 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
}
|
||||
}
|
||||
else if (fn.func == FuncPlayValue) {
|
||||
if (version >= 213)
|
||||
if (version >= 213) {
|
||||
sourcesConversionTable->importValue(value, (int &)fn.param);
|
||||
}
|
||||
else
|
||||
SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(value, (int &)fn.param);
|
||||
}
|
||||
@@ -2708,7 +2706,13 @@ class FrskyField: public StructField {
|
||||
}
|
||||
}
|
||||
|
||||
Append(new ConversionField< UnsignedField<8> >(frsky.varioSource, &telemetryVarioSourceConversionTable, "Vario Source"));
|
||||
if (version >= 217) {
|
||||
Append(new UnsignedField<7>(frsky.varioSource, "Vario Source"));
|
||||
Append(new BoolField<1>(frsky.varioCenterSilent));
|
||||
}
|
||||
else {
|
||||
Append(new ConversionField< UnsignedField<8> >(frsky.varioSource, &telemetryVarioSourceConversionTable, "Vario Source"));
|
||||
}
|
||||
Append(new SignedField<8>(frsky.varioCenterMax));
|
||||
Append(new SignedField<8>(frsky.varioCenterMin));
|
||||
Append(new SignedField<8>(frsky.varioMin));
|
||||
@@ -2811,7 +2815,8 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
_id = sensor.id;
|
||||
_instance = sensor.instance;
|
||||
_param = (sensor.ratio) + ((unsigned int)sensor.offset << 16);
|
||||
_ratio = sensor.ratio;
|
||||
_offset = sensor.offset;
|
||||
}
|
||||
else {
|
||||
_id = sensor.persistentValue;
|
||||
@@ -2822,7 +2827,7 @@ class SensorField: public TransformedField {
|
||||
_param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24);
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
|
||||
_param = (sensor.gps) + (sensor.alt << 8);
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
|
||||
_param = (sensor.amps);
|
||||
}
|
||||
}
|
||||
@@ -2832,8 +2837,8 @@ class SensorField: public TransformedField {
|
||||
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
sensor.id = _id;
|
||||
sensor.instance = _instance;
|
||||
sensor.ratio = _param & 0xFFFF;
|
||||
sensor.offset = (_param >> 16) & 0xFFFF;
|
||||
sensor.ratio = _ratio;
|
||||
sensor.offset = _offset;
|
||||
}
|
||||
else {
|
||||
sensor.persistentValue = _id;
|
||||
@@ -2845,7 +2850,7 @@ class SensorField: public TransformedField {
|
||||
sensor.sources[i] = _sources[i];
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
|
||||
(sensor.gps = _sources[0], sensor.alt = _sources[1]);
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
|
||||
sensor.amps = _sources[0];
|
||||
}
|
||||
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
|
||||
@@ -2859,6 +2864,10 @@ class SensorField: public TransformedField {
|
||||
union {
|
||||
unsigned int _param;
|
||||
uint8_t _sources[4];
|
||||
struct {
|
||||
uint16_t _ratio;
|
||||
int16_t _offset;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2872,8 +2881,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
board(board),
|
||||
version(version),
|
||||
variant(variant),
|
||||
protocolsConversionTable(board),
|
||||
throttleSourceConversionTable(board, version)
|
||||
protocolsConversionTable(board)
|
||||
{
|
||||
sprintf(name, "Model %s", modelData.name);
|
||||
|
||||
@@ -2951,7 +2959,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
if (IS_ARM(board) && version >= 217) {
|
||||
internalField.Append(new BoolField<1>(modelData.noGlobalFunctions));
|
||||
internalField.Append(new UnsignedField<2>(modelData.trimsDisplay));
|
||||
internalField.Append(new SpareBitsField<1>());
|
||||
internalField.Append(new BoolField<1>(modelData.frsky.ignoreSensorIds));
|
||||
}
|
||||
else if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216)) {
|
||||
internalField.Append(new SpareBitsField<4>());
|
||||
@@ -3008,7 +3016,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
|
||||
}
|
||||
|
||||
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
|
||||
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc, "Throttle Source"));
|
||||
|
||||
if (!afterrelease21March2013) {
|
||||
internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId));
|
||||
@@ -3150,7 +3158,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
|
||||
if (IS_ARM(board) && version >= 217) {
|
||||
for (int i=0; i<8; i++) {
|
||||
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
|
||||
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
|
||||
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
|
||||
else
|
||||
internalField.Append(new SpareBitsField<1>());
|
||||
@@ -3158,7 +3166,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 216) {
|
||||
for (int i=0; i<6; i++) {
|
||||
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
|
||||
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
|
||||
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
|
||||
else
|
||||
internalField.Append(new SpareBitsField<1>());
|
||||
@@ -3167,7 +3175,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]));
|
||||
}
|
||||
}
|
||||
@@ -3186,6 +3194,10 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
internalField.Append(new SensorField(modelData.sensorData[i], board, version));
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(board)) {
|
||||
internalField.Append(new UnsignedField<8>(modelData.toplcdTimer));
|
||||
}
|
||||
}
|
||||
|
||||
void OpenTxModelData::beforeExport()
|
||||
@@ -3193,10 +3205,10 @@ void OpenTxModelData::beforeExport()
|
||||
// qDebug() << QString("before export model") << modelData.name;
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12)
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16;
|
||||
else if (modelData.moduleData[module].protocol >= LP45 && modelData.moduleData[module].protocol <= DSMX)
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - LP45;
|
||||
if (modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12)
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
|
||||
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX)
|
||||
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
|
||||
else
|
||||
subprotocols[module] = (module==0 ? -1 : 0);
|
||||
}
|
||||
@@ -3210,7 +3222,7 @@ void OpenTxModelData::afterImport()
|
||||
for (unsigned int i=0; i<NUM_STICKS; i++) {
|
||||
for (int j=0; j<64; j++) {
|
||||
ExpoData * expo = &modelData.expoData[j];
|
||||
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->phases == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
|
||||
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->flightModes == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
|
||||
break;
|
||||
if (expo->mode == 0 || expo->chn > i) {
|
||||
ExpoData * newExpo = modelData.insertInput(j);
|
||||
@@ -3225,18 +3237,18 @@ void OpenTxModelData::afterImport()
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && modelData.moduleData[0].protocol == 0) {
|
||||
modelData.moduleData[0].protocol = PXX_XJT_X16;
|
||||
}
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) {
|
||||
if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
|
||||
if (subprotocols[module] >= 0)
|
||||
modelData.moduleData[module].protocol += subprotocols[module];
|
||||
else
|
||||
modelData.moduleData[module].protocol = OFF;
|
||||
modelData.moduleData[module].protocol = PULSES_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
|
||||
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
|
||||
}
|
||||
}
|
||||
|
||||
OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
@@ -3245,7 +3257,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
generalData(generalData),
|
||||
board(board),
|
||||
version(version),
|
||||
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board))
|
||||
inputsCount(NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
|
||||
{
|
||||
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
|
||||
|
||||
@@ -3282,7 +3294,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
internalField.Append(new UnsignedField<8>(generalData.currModel));
|
||||
internalField.Append(new UnsignedField<8>(generalData.contrast));
|
||||
internalField.Append(new UnsignedField<8>(generalData.vBatWarn));
|
||||
internalField.Append(new SignedField<8>(generalData.vBatCalib));
|
||||
internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
|
||||
internalField.Append(new SignedField<8>(generalData.backlightMode));
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
@@ -3366,7 +3378,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
|
||||
if (IS_ARM(board)) {
|
||||
internalField.Append(new UnsignedField<8>(generalData.backlightBright));
|
||||
internalField.Append(new SignedField<8>(generalData.currentCalib));
|
||||
internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
|
||||
if (version >= 213) {
|
||||
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
|
||||
@@ -3409,7 +3421,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
if (i < MAX_POTS(board))
|
||||
if (i < MAX_POTS(board, version))
|
||||
internalField.Append(new UnsignedField<2>(generalData.potConfig[i]));
|
||||
else
|
||||
internalField.Append(new SpareBitsField<2>());
|
||||
@@ -3441,7 +3453,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) {
|
||||
|
||||
@@ -56,40 +56,37 @@ 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++);
|
||||
}
|
||||
if (IS_TARANIS(board)) {
|
||||
addConversion(PULSES_CROSSFIRE, val++);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ThrottleSourceConversionTable: public ConversionTable {
|
||||
|
||||
public:
|
||||
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
|
||||
};
|
||||
|
||||
class ChannelsConversionTable: public ConversionTable
|
||||
{
|
||||
public:
|
||||
@@ -121,7 +118,6 @@ class OpenTxModelData: public TransformedField {
|
||||
char name[256];
|
||||
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
||||
ProtocolsConversionTable protocolsConversionTable;
|
||||
ThrottleSourceConversionTable throttleSourceConversionTable;
|
||||
ChannelsConversionTable channelsConversionTable;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
|
||||
#define OPENTX_NIGHT_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/nightly/firmware"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
|
||||
@@ -70,6 +73,8 @@ const char * OpenTxEepromInterface::getName()
|
||||
return "OpenTX for Sky9x board / 9X";
|
||||
case BOARD_9XRPRO:
|
||||
return "OpenTX for 9XR-PRO";
|
||||
case BOARD_AR9X:
|
||||
return "OpenTX for ar9x board / 9X";
|
||||
default:
|
||||
return "OpenTX for an unknown board";
|
||||
}
|
||||
@@ -88,6 +93,7 @@ const int OpenTxEepromInterface::getEEpromSize()
|
||||
case BOARD_SKY9X:
|
||||
return EESIZE_SKY9X;
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_AR9X:
|
||||
return EESIZE_9XRPRO;
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_PLUS:
|
||||
@@ -301,15 +307,19 @@ bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, unsi
|
||||
return (sz == eeprom.size());
|
||||
}
|
||||
|
||||
bool OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import...";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != getEEpromSize()) {
|
||||
if (size==4096) {
|
||||
int notnull=false;
|
||||
@@ -320,21 +330,25 @@ bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, in
|
||||
}
|
||||
if (notnull) {
|
||||
std::cout << " wrong size (" << size << ")\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(NULL, "companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
errors.set(HAS_WARNINGS);
|
||||
errors.set(WARNING_WRONG_FIRMWARE);
|
||||
size=2048;
|
||||
}
|
||||
} else {
|
||||
std::cout << " wrong size (" << size << "/" << getEEpromSize() << ")\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) {
|
||||
std::cout << " wrong file system\n";
|
||||
return false;
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
@@ -342,30 +356,39 @@ bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, in
|
||||
uint8_t version;
|
||||
if (efile->readRlc2(&version, 1) != 1) {
|
||||
std::cout << " no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " version " << (unsigned int)version;
|
||||
|
||||
if (!checkVersion(version)) {
|
||||
EepromLoadErrors version_error = checkVersion(version);
|
||||
if (version_error == OLD_VERSION) {
|
||||
errors.set(version_error);
|
||||
errors.set(HAS_WARNINGS);
|
||||
} else if (version_error == NOT_OPENTX) {
|
||||
std::cout << " not open9x\n";
|
||||
return false;
|
||||
errors.set(version_error);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!loadGeneral<OpenTxGeneralData>(radioData.generalSettings, version)) {
|
||||
std::cout << " ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " variant " << radioData.generalSettings.variant;
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
if (!loadModel(version, radioData.models[i], NULL, i, radioData.generalSettings.variant, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << " ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
std::cout << " ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
@@ -378,6 +401,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
case BOARD_TARANIS_PLUS:
|
||||
case BOARD_TARANIS_X9E:
|
||||
case BOARD_SKY9X:
|
||||
case BOARD_AR9X:
|
||||
case BOARD_9XRPRO:
|
||||
version = 217;
|
||||
break;
|
||||
@@ -411,7 +435,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
}
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
if (!radioData.models[i].isempty()) {
|
||||
if (!radioData.models[i].isEmpty()) {
|
||||
result = saveModel<OpenTxModelData>(i, radioData.models[i], version, variant);
|
||||
if (!result) {
|
||||
return 0;
|
||||
@@ -438,19 +462,18 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
return size;
|
||||
}
|
||||
|
||||
int OpenTxEepromInterface::getSize(ModelData &model)
|
||||
int OpenTxEepromInterface::getSize(const ModelData & model)
|
||||
{
|
||||
if (IS_SKY9X(board))
|
||||
return 0;
|
||||
|
||||
if (model.isempty())
|
||||
if (model.isEmpty())
|
||||
return 0;
|
||||
|
||||
// TODO something better...
|
||||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board, 255/*version max*/);
|
||||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255/*version max*/);
|
||||
|
||||
OpenTxModelData open9xModel(model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
|
||||
OpenTxModelData open9xModel((ModelData &)model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
|
||||
|
||||
QByteArray eeprom;
|
||||
open9xModel.Export(eeprom);
|
||||
@@ -461,15 +484,15 @@ int OpenTxEepromInterface::getSize(ModelData &model)
|
||||
return efile->size(0);
|
||||
}
|
||||
|
||||
int OpenTxEepromInterface::getSize(GeneralSettings &settings)
|
||||
int OpenTxEepromInterface::getSize(const GeneralSettings & settings)
|
||||
{
|
||||
if (IS_SKY9X(board))
|
||||
return 0;
|
||||
|
||||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board, 255);
|
||||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255);
|
||||
|
||||
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmware()->getVariantNumber());
|
||||
OpenTxGeneralData open9xGeneral((GeneralSettings &)settings, board, 255, GetCurrentFirmware()->getVariantNumber());
|
||||
// open9xGeneral.Dump();
|
||||
|
||||
QByteArray eeprom;
|
||||
@@ -555,8 +578,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
return (IS_TARANIS(board) ? 10 : 6);
|
||||
case GvarsName:
|
||||
return (IS_9X(board) ? 0 : 6);
|
||||
case HasChNames:
|
||||
return (IS_TARANIS(board) ? 1 : 0);
|
||||
case GvarsInCS:
|
||||
case HasFAIMode:
|
||||
return 1;
|
||||
@@ -568,7 +589,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case OffsetWeight:
|
||||
return (IS_ARM(board) ? 500 : 245);
|
||||
case Timers:
|
||||
return (IS_ARM(board) ? 3 : 2);
|
||||
return ((IS_ARM(board) && id.contains("timer3")) ? 3 : 2);
|
||||
case TimersName:
|
||||
return (IS_TARANIS(board) ? 8 : (IS_ARM(board) ? 3 : 0));
|
||||
case PermTimers:
|
||||
@@ -605,10 +626,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
else
|
||||
return 9;
|
||||
case CustomFunctions:
|
||||
if (IS_TARANIS(board))
|
||||
if (IS_ARM(board))
|
||||
return 64;
|
||||
else if (IS_ARM(board))
|
||||
return 60;
|
||||
else if (IS_2560(board) || board==BOARD_M128)
|
||||
return 24;
|
||||
else
|
||||
@@ -649,7 +668,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;
|
||||
@@ -707,10 +726,10 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case HasFailsafe:
|
||||
return (IS_ARM(board) ? 32 : 0);
|
||||
case NumModules:
|
||||
return (IS_ARM(board) && !IS_9XRPRO(board)) ? 2 : 1;
|
||||
return (IS_ARM(board) ? 2 : 1);
|
||||
case HasPPMStart:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
case HasCurrentCalibration:
|
||||
case HastxCurrentCalibration:
|
||||
return (IS_SKY9X(board) ? true : false);
|
||||
case HasVolume:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
@@ -732,6 +751,10 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ;
|
||||
case HasDisplayText:
|
||||
return IS_ARM(board) ? 1 : 0;
|
||||
case HasTopLcd:
|
||||
return IS_TARANIS_X9E(board) ? 1 : 0;
|
||||
case GlobalFunctions:
|
||||
return IS_ARM(board) ? 64 : 0;
|
||||
case VirtualInputs:
|
||||
return IS_TARANIS(board) ? 32 : 0;
|
||||
case TrainerInputs:
|
||||
@@ -774,7 +797,9 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case MixersMonitor:
|
||||
return id.contains("mixersmon") ? 1 : 0;
|
||||
case HasBatMeterRange:
|
||||
return (IS_TARANIS(board) ? true : false);
|
||||
return (IS_TARANIS(board) ? true : id.contains("battgraph"));
|
||||
case DangerousFunctions:
|
||||
return id.contains("danger") ? 1 : 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -791,32 +816,36 @@ bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
|
||||
return true;
|
||||
}
|
||||
|
||||
int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
|
||||
int OpenTxFirmware::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_LR12:
|
||||
return 1;
|
||||
case PULSES_PXX_XJT_D8:
|
||||
return id.contains("eu") ? 0 : 1;
|
||||
case PULSES_PPM:
|
||||
return id.contains("internalppm") ? 1 : 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
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:
|
||||
case PULSES_CROSSFIRE:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -824,7 +853,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
|
||||
break;
|
||||
case -1:
|
||||
switch (proto) {
|
||||
case PPM:
|
||||
case PULSES_PPM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -838,13 +867,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
|
||||
switch (port) {
|
||||
case 0:
|
||||
switch (proto) {
|
||||
case PPM:
|
||||
// case PXX_XJT_X16:
|
||||
// case PXX_XJT_D8:
|
||||
// case PXX_XJT_LR12:
|
||||
case LP45:
|
||||
case DSM2:
|
||||
case DSMX:
|
||||
case PULSES_PPM:
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -852,7 +881,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
|
||||
break;
|
||||
case 1:
|
||||
switch (proto) {
|
||||
case PPM:
|
||||
case PULSES_PPM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -864,13 +893,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: // Unavailable for now
|
||||
case PULSES_PPM16:
|
||||
case PULSES_PPMSIM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -883,73 +912,60 @@ size_t getSizeA(T (&)[SIZE]) {
|
||||
return SIZE;
|
||||
}
|
||||
|
||||
bool OpenTxEepromInterface::checkVersion(unsigned int version)
|
||||
EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version)
|
||||
{
|
||||
switch(version) {
|
||||
case 201:
|
||||
// first version
|
||||
break;
|
||||
case 202:
|
||||
// channel order is now always RUD - ELE - THR - AIL
|
||||
// changes in timers
|
||||
// ppmFrameLength added
|
||||
// thrTraceSrc added
|
||||
break;
|
||||
case 203:
|
||||
// mixers changed (for the trims use for change the offset of a mix)
|
||||
// telemetry offset raised to -127 +127
|
||||
// function switches now have a param on 4 bits
|
||||
break;
|
||||
case 204:
|
||||
// telemetry changes (bars)
|
||||
break;
|
||||
case 205:
|
||||
// mixer changes (differential, negative curves)...
|
||||
break;
|
||||
// case 206:
|
||||
case 207:
|
||||
// V4: Rotary Encoders position in FlightModes
|
||||
break;
|
||||
case 208:
|
||||
// Trim value in 16bits
|
||||
// FrSky A1/A2 offset on 12bits
|
||||
// ARM: More Mixers / Expos / CSW / FSW / CHNOUT
|
||||
break;
|
||||
case 209:
|
||||
// Add TrmR, TrmE, TrmT, TrmA as Mix sources
|
||||
// Trims are now OFF / ON / Rud / Ele / Thr / Ail
|
||||
break;
|
||||
case 210:
|
||||
// Add names in Mixes / Expos
|
||||
// Add a new telemetry screen
|
||||
// Add support for Play Track <filename>
|
||||
break;
|
||||
case 211:
|
||||
// Curves big change
|
||||
break;
|
||||
case 212:
|
||||
// Big changes in mixers / limitse
|
||||
break;
|
||||
case 213:
|
||||
// GVARS / Variants introduction
|
||||
break;
|
||||
case 214:
|
||||
// Massive EEPROM change!
|
||||
break;
|
||||
case 215:
|
||||
// M128 revert because too much RAM used!
|
||||
break;
|
||||
case 216:
|
||||
// A lot of things (first github release)
|
||||
return OLD_VERSION;
|
||||
break;
|
||||
case 217:
|
||||
// 3 logical switches removed on M128 / gruvin9x boards
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
return NOT_OPENTX;
|
||||
}
|
||||
|
||||
return true;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant)
|
||||
@@ -985,13 +1001,16 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
std::cout << "trying " << getName() << " backup import...";
|
||||
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) {
|
||||
std::cout << " no\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
BoardEnum backupBoard = (BoardEnum)-1;
|
||||
@@ -1007,12 +1026,14 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
|
||||
break;
|
||||
default:
|
||||
std::cout << " unknown board\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_BOARD);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (backupBoard != board) {
|
||||
std::cout << " not right board\n";
|
||||
return false;
|
||||
errors.set(WRONG_BOARD);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
uint8_t version = eeprom[4];
|
||||
@@ -1022,34 +1043,52 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
|
||||
|
||||
std::cout << " version " << (unsigned int)version << " ";
|
||||
|
||||
if (!checkVersion(version)) {
|
||||
EepromLoadErrors version_error = checkVersion(version);
|
||||
if (version_error == OLD_VERSION) {
|
||||
errors.set(version_error);
|
||||
errors.set(HAS_WARNINGS);
|
||||
} else if (version_error == NOT_OPENTX) {
|
||||
std::cout << " not open9x\n";
|
||||
return false;
|
||||
errors.set(version_error);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (size > esize-8) {
|
||||
std::cout << " wrong size\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (bcktype=='M') {
|
||||
if (!loadModel(version, radioData.models[index], &eeprom[8], size, variant)) {
|
||||
std::cout << " ko\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << " backup type not supported\n";
|
||||
return false;
|
||||
errors.set(BACKUP_NOT_SUPPORTED);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << " ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getFirmwareBaseUrl()
|
||||
{
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
return (g.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_FIRMWARE_DOWNLOADS : OPENTX_FIRMWARE_DOWNLOADS);
|
||||
#else
|
||||
return OPENTX_FIRMWARE_DOWNLOADS;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getFirmwareUrl()
|
||||
{
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
QString url = getFirmwareBaseUrl();
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
@@ -1058,6 +1097,7 @@ QString OpenTxFirmware::getFirmwareUrl()
|
||||
url.append(QString("/getfw.php?fw=%1.hex").arg(id));
|
||||
break;
|
||||
case BOARD_SKY9X:
|
||||
case BOARD_AR9X:
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_PLUS:
|
||||
@@ -1073,16 +1113,16 @@ QString OpenTxFirmware::getFirmwareUrl()
|
||||
|
||||
QString OpenTxFirmware::getReleaseNotesUrl()
|
||||
{
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
QString url = getFirmwareBaseUrl();
|
||||
url.append("/releasenotes.txt");
|
||||
return url;
|
||||
}
|
||||
|
||||
QString OpenTxFirmware::getStampUrl()
|
||||
{
|
||||
QString url = OPENTX_FIRMWARE_DOWNLOADS;
|
||||
url.append("/stamp-opentx.txt");
|
||||
return url;
|
||||
QString url = getFirmwareBaseUrl();
|
||||
url.append("/stamp-opentx.txt");
|
||||
return url;
|
||||
}
|
||||
|
||||
void addOpenTxCommonOptions(OpenTxFirmware * firmware)
|
||||
@@ -1100,9 +1140,10 @@ void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
|
||||
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
firmware->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
Option usb_options[] = { { "massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)") }, { "cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface") }, { NULL } };
|
||||
firmware->addOptions(usb_options);
|
||||
firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views"));
|
||||
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use anymore on radios sold after Jan 1st, 2015"));
|
||||
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015"));
|
||||
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
|
||||
}
|
||||
|
||||
@@ -1128,7 +1169,7 @@ void registerOpenTxFirmwares()
|
||||
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
|
||||
|
||||
/* 9x board */
|
||||
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK);
|
||||
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X board"), BOARD_STOCK);
|
||||
firmware->addOptions(ext_options);
|
||||
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1164,7 +1205,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128);
|
||||
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("M128 / 9X board"), BOARD_M128);
|
||||
firmware->addOptions(ext_options);
|
||||
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1194,7 +1235,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9XR board */
|
||||
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK);
|
||||
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("9XR"), BOARD_STOCK);
|
||||
firmware->addOptions(extr_options);
|
||||
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1227,7 +1268,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9XR board with M128 chip */
|
||||
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128);
|
||||
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("9XR with M128 chip"), BOARD_M128);
|
||||
firmware->addOptions(extr_options);
|
||||
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
@@ -1255,7 +1296,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* Gruvin9x board */
|
||||
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X);
|
||||
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("Gruvin9x board / 9X"), BOARD_GRUVIN9X);
|
||||
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
firmware->addOption("nofp", QObject::tr("No flight modes"));
|
||||
@@ -1280,7 +1321,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* MEGA2560 board */
|
||||
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("OpenTX for MEGA2560 board"), BOARD_MEGA2560);
|
||||
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("MEGA2560 board"), BOARD_MEGA2560);
|
||||
addOpenTxLcdOptions(firmware);
|
||||
firmware->addOption("PWR", QObject::tr("Power management by soft-off circuitry"));
|
||||
firmware->addOptions(ext_options);
|
||||
@@ -1310,7 +1351,7 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* Sky9x board */
|
||||
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X);
|
||||
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("Sky9x board / 9X"), BOARD_SKY9X);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
firmware->addOption("nofp", QObject::tr("No flight modes"));
|
||||
@@ -1318,6 +1359,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"));
|
||||
@@ -1329,8 +1371,8 @@ void registerOpenTxFirmwares()
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9XR-Pro */
|
||||
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO);
|
||||
/* ar9x board */
|
||||
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("ar9x board / 9X"), BOARD_AR9X);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
firmware->addOption("nofp", QObject::tr("No flight modes"));
|
||||
@@ -1338,6 +1380,30 @@ void registerOpenTxFirmwares()
|
||||
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
|
||||
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
|
||||
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
|
||||
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
|
||||
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
firmware->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
|
||||
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
|
||||
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9XR-Pro */
|
||||
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
firmware->addOption("nofp", QObject::tr("No flight modes"));
|
||||
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
|
||||
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
|
||||
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
|
||||
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
|
||||
@@ -1349,20 +1415,20 @@ void registerOpenTxFirmwares()
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* Taranis board */
|
||||
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS);
|
||||
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
|
||||
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* Taranis Plus board */
|
||||
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
|
||||
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* Taranis X9E board */
|
||||
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("OpenTX for FrSky Taranis X9E"), BOARD_TARANIS_X9E);
|
||||
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
|
||||
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addOpenTxCommonOptions(firmware);
|
||||
@@ -1372,3 +1438,9 @@ void registerOpenTxFirmwares()
|
||||
current_firmware_variant = default_firmware_variant;
|
||||
}
|
||||
|
||||
void unregisterOpenTxFirmwares()
|
||||
{
|
||||
foreach (Firmware * f, firmwares) {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||
*
|
||||
*
|
||||
* Based on th9x -> http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads-21.open-tx.org/firmware"
|
||||
|
||||
class RleFile;
|
||||
|
||||
class OpenTxEepromInterface : public EEPROMInterface
|
||||
@@ -35,25 +33,23 @@ class OpenTxEepromInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
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(const GeneralSettings &);
|
||||
|
||||
virtual int getSize(GeneralSettings &);
|
||||
|
||||
virtual int isAvailable(Protocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
const char * getName();
|
||||
|
||||
bool checkVersion(unsigned int version);
|
||||
EepromLoadErrors checkVersion(unsigned int version);
|
||||
|
||||
bool checkVariant(unsigned int version, unsigned int variant);
|
||||
|
||||
@@ -101,6 +97,7 @@ class OpenTxFirmware: public Firmware {
|
||||
|
||||
addTTSLanguage("en");
|
||||
addTTSLanguage("cz");
|
||||
addTTSLanguage("de");
|
||||
addTTSLanguage("es");
|
||||
addTTSLanguage("fr");
|
||||
addTTSLanguage("hu");
|
||||
@@ -113,7 +110,7 @@ class OpenTxFirmware: public Firmware {
|
||||
}
|
||||
|
||||
virtual Firmware * getFirmwareVariant(const QString & id);
|
||||
|
||||
|
||||
virtual QString getStampUrl();
|
||||
|
||||
virtual QString getReleaseNotesUrl();
|
||||
@@ -123,9 +120,16 @@ class OpenTxFirmware: public Firmware {
|
||||
virtual int getCapability(const Capability);
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source);
|
||||
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
QString getFirmwareBaseUrl();
|
||||
|
||||
};
|
||||
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,15 +13,25 @@ add_custom_target(about_lbm_taranis
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
add_custom_target(trans
|
||||
make tra
|
||||
add_custom_target(commondeps
|
||||
make stamp_header tra
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
add_custom_target(lua_exports
|
||||
make PCB=TARANIS lua_exports.inc
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${RADIO_SRC_DIRECTORY}/stamp-opentx.h)
|
||||
|
||||
macro(add_lua_export_target target)
|
||||
add_custom_command(
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/lua/lua_exports_${target}.inc
|
||||
COMMAND ${CMAKE_C_COMPILER} -E ${ARGN} -DEXPORT ${INTTYPES_INCLUDE_OPTION} myeeprom.h | grep LEXP > lua_exports_${target}.txt
|
||||
COMMAND python ../util/luaexport.py ${C9X_VERSION} lua_exports_${target}.txt lua/lua_exports_${target}.inc lua_fields_${target}.txt
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
add_custom_target(lua_export_${target} DEPENDS ${RADIO_SRC_DIRECTORY}/lua/lua_exports_${target}.inc)
|
||||
endmacro(add_lua_export_target)
|
||||
|
||||
add_lua_export_target(taranis -DPCBTARANIS -DLUA -DVIRTUALINPUTS)
|
||||
add_lua_export_target(taranis_x9e -DPCBTARANIS -DREVPLUS -DREV9E -DLUA -DVIRTUALINPUTS)
|
||||
|
||||
set(OPENTX_SRC_FILES
|
||||
opentxsimulator.cpp
|
||||
@@ -41,6 +51,11 @@ include_directories(
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/Lua/src
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
# OS X compiler no longer automatically includes /Library/Frameworks in search path
|
||||
set(CMAKE_SHARED_LINKER_FLAGS -F/Library/Frameworks)
|
||||
endif(APPLE)
|
||||
|
||||
if(DEFINED TRANSLATIONS)
|
||||
set(COMMON_DEFINITIONS ${COMMON_DEFINITIONS} TRANSLATIONS_${TRANSLATIONS})
|
||||
string(TOLOWER ${TRANSLATIONS} TRANSLATION_SUFFIX)
|
||||
@@ -73,21 +88,23 @@ add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
|
||||
add_dependencies(opentx-9x${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-9xr${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-9x128${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-9xr128${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x trans)
|
||||
add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
|
||||
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
|
||||
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis trans lua_exports)
|
||||
add_dependencies(opentx-9x${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-9xr${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-9x128${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-9xr128${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-ar9x${SUFFIX}-simulator about_lbm_9x commondeps)
|
||||
add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_export_taranis)
|
||||
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_export_taranis)
|
||||
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_export_taranis_x9e)
|
||||
|
||||
set(OPENTX_LIBRARIES
|
||||
opentx-9x${SUFFIX}-simulator
|
||||
@@ -98,11 +115,16 @@ set(OPENTX_LIBRARIES
|
||||
opentx-mega2560${SUFFIX}-simulator
|
||||
opentx-sky9x${SUFFIX}-simulator
|
||||
opentx-9xrpro${SUFFIX}-simulator
|
||||
opentx-ar9x${SUFFIX}-simulator
|
||||
opentx-taranis${SUFFIX}-simulator
|
||||
opentx-taranisplus${SUFFIX}-simulator
|
||||
opentx-taranisx9e${SUFFIX}-simulator
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${OPENTX_LIBRARIES} LIBRARY DESTINATION ${SIMULATOR_LIB_PATH})
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
# 9X with ATmega64
|
||||
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/stock)
|
||||
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
@@ -143,6 +165,11 @@ target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_
|
||||
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# AR9X
|
||||
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
|
||||
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis standard
|
||||
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
|
||||
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
@@ -158,6 +185,27 @@ target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_
|
||||
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
ADD_CUSTOM_TARGET(opentx-simulators
|
||||
add_custom_target(opentx-simulators
|
||||
DEPENDS ${OPENTX_LIBRARIES}
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set(SIMULATOR_BUNDLES)
|
||||
foreach(_file ${OPENTX_LIBRARIES})
|
||||
set(SIMULATOR_BUNDLE "${_file}-bundle")
|
||||
add_custom_target(${SIMULATOR_BUNDLE}
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${_file}.dylib
|
||||
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${_file}.dylib
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMAND pwd
|
||||
COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/
|
||||
DEPENDS ${_file}
|
||||
)
|
||||
list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE})
|
||||
endforeach()
|
||||
add_custom_target(opentx-simulators-bundle DEPENDS ${SIMULATOR_BUNDLES})
|
||||
endif(APPLE)
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#include "opentxsimulator.h"
|
||||
#include <QDebug>
|
||||
#include <stdio.h>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
@@ -41,14 +40,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 +61,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
|
||||
@@ -90,6 +90,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/telemetry/telemetry.cpp"
|
||||
#include "radio/src/telemetry/frsky_sport.cpp"
|
||||
#include "radio/src/sbus.cpp"
|
||||
#include "radio/src/crc16.cpp"
|
||||
#else
|
||||
#include "radio/src/main_avr.cpp"
|
||||
#include "radio/src/audio_avr.cpp"
|
||||
@@ -121,6 +122,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/stamp.cpp"
|
||||
#include "radio/src/maths.cpp"
|
||||
#include "radio/src/vario.cpp"
|
||||
#include "radio/src/trainer_input.cpp"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#include "radio/src/bmp.cpp"
|
||||
@@ -231,7 +233,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/targets/taranis/pulses_driver.cpp"
|
||||
#include "radio/src/targets/taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/taranis/trainer_driver.cpp"
|
||||
#include "radio/src/targets/taranis/uart3_driver.cpp"
|
||||
#include "radio/src/targets/taranis/serial2_driver.cpp"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "radio/src/targets/sky9x/board_sky9x.cpp"
|
||||
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
|
||||
@@ -242,7 +244,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/coproc_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/haptic_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/second_serial_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/serial2_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pulses_driver.cpp"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
|
||||
@@ -258,7 +260,11 @@ namespace NAMESPACE {
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/telemetry/frsky.cpp"
|
||||
#include "radio/src/telemetry/frsky_d.cpp"
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/telemetry/frsky_d_arm.cpp"
|
||||
#else
|
||||
#include "radio/src/telemetry/frsky_d.cpp"
|
||||
#endif
|
||||
#include "radio/src/translations/tts_en.cpp"
|
||||
|
||||
#if defined(CPUARM)
|
||||
@@ -276,7 +282,10 @@ namespace NAMESPACE {
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
#include "radio/src/lua_api.cpp"
|
||||
#include "radio/src/lua/interface.cpp"
|
||||
#include "radio/src/lua/api_general.cpp"
|
||||
#include "radio/src/lua/api_lcd.cpp"
|
||||
#include "radio/src/lua/api_model.cpp"
|
||||
#include "radio/src/thirdparty/Lua/src/lapi.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lcode.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lctype.c"
|
||||
@@ -307,6 +316,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/thirdparty/Lua/src/ltablib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lcorolib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/liolib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lstrlib.c"
|
||||
#endif
|
||||
|
||||
int16_t g_anas[NUM_STICKS+NUM_POTS];
|
||||
@@ -487,6 +497,44 @@ void OpenTxSimulator::sendTelemetry(::uint8_t * data, unsigned int len)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id)
|
||||
{
|
||||
#if defined(FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
return sensor->instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
|
||||
{
|
||||
#if defined(FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
return sensor->custom.ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setLuaStateReloadPermanentScripts()
|
||||
{
|
||||
#if defined(LUA)
|
||||
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, ::int16_t value)
|
||||
{
|
||||
#define SETTRAINER_IMPORT
|
||||
|
||||
@@ -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
|
||||
@@ -118,9 +122,16 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len);
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id);
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id);
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value);
|
||||
|
||||
virtual void installTraceHook(void (*callback)(const char *));
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Automatically generated file (CMake) - do not edit
|
||||
#define DATE_STR "@DATE@"
|
||||
#define TIME_STR "@TIME@"
|
||||
#define VERS_STR "@C9X_VERSION@"
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -57,23 +57,29 @@ const int Th9xInterface::getMaxModels()
|
||||
return 16;
|
||||
}
|
||||
|
||||
bool Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
unsigned long Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying th9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
return false;
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
return false;
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
@@ -81,7 +87,8 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
|
||||
if (efile->readRlc2((uint8_t*)&th9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
return false;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)th9xGeneral.myVers << " ";
|
||||
@@ -91,14 +98,16 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
break;
|
||||
default:
|
||||
std::cout << "not th9x\n";
|
||||
return false;
|
||||
errors.set(NOT_TH9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
int len = efile->readRlc2((uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
|
||||
if (len != sizeof(Th9xGeneral)) {
|
||||
std::cout << "not th9x\n";
|
||||
return false;
|
||||
errors.set(NOT_TH9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
radioData.generalSettings = th9xGeneral;
|
||||
|
||||
@@ -114,12 +123,15 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
return true;
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
bool Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
unsigned long Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
@@ -130,24 +142,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;
|
||||
|
||||
@@ -34,19 +34,19 @@ class Th9xInterface : public EEPROMInterface
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual bool load(RadioData &, const uint8_t *eeprom, int size);
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
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:
|
||||
|
||||
|
||||
Executable → Regular
+13
-11
@@ -2,13 +2,13 @@
|
||||
#include "ui_flasheepromdialog.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "splashlibrary.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "hexinterface.h"
|
||||
#include "appdata.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
#include "converteeprom.h"
|
||||
#include "splashlibrarydialog.h"
|
||||
|
||||
FlashEEpromDialog::FlashEEpromDialog(QWidget *parent, const QString &filename):
|
||||
QDialog(parent),
|
||||
@@ -102,9 +102,9 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
QByteArray eeprom(EESIZE_RLC_MAX, 0);
|
||||
QByteArray eeprom(EESIZE_MAX, 0);
|
||||
int fileType = getFileType(filename);
|
||||
|
||||
|
||||
#if 0
|
||||
if (fileType==FILE_TYPE_XML) {
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@@ -125,7 +125,8 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
bool xmlOK = doc.setContent(&file);
|
||||
if (xmlOK) {
|
||||
RadioData * radioData = new RadioData();
|
||||
if (!loadEEpromXml(*radioData, doc)) {
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(*radioData, doc));
|
||||
if (!errors.test(NO_ERROR)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
|
||||
}
|
||||
else {
|
||||
@@ -144,7 +145,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_RLC_MAX);
|
||||
eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_MAX);
|
||||
}
|
||||
else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
eeprom_size = file.size();
|
||||
@@ -160,7 +161,8 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
}
|
||||
|
||||
RadioData * radioData = new RadioData();
|
||||
if (eeprom_size == 0 || !loadEEprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size)) {
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size));
|
||||
if (eeprom_size == 0 || !errors.test(NO_ERROR)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename));
|
||||
}
|
||||
else {
|
||||
@@ -175,8 +177,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 +206,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;
|
||||
}
|
||||
@@ -303,7 +305,7 @@ void FlashEEpromDialog::on_burnButton_clicked()
|
||||
backupPath = g.profile[g.id()].pBackupDir();
|
||||
if (backupPath.isEmpty()) {
|
||||
backupPath=g.backupDir();
|
||||
}
|
||||
}
|
||||
backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin";
|
||||
}
|
||||
else if (ui->checkFirmwareCompatibility->isChecked()) {
|
||||
|
||||
Executable → Regular
Executable → Regular
+1
-1
@@ -110,7 +110,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Allows Companion to write to older version of the firmware</string>
|
||||
<string><html><head/><body><p>Saves a dated copy of your eeprom to the backup folder you specified in the Companion settings before writing the current model to the radio.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Backup before Write</string>
|
||||
|
||||
Executable → Regular
+3
-2
@@ -9,8 +9,8 @@
|
||||
#include "hexinterface.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
#include "splashlibrary.h"
|
||||
#include "progresswidget.h"
|
||||
#include "splashlibrarydialog.h"
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
@@ -185,7 +185,7 @@ void FlashFirmwareDialog::on_useExternalSplash_clicked()
|
||||
void FlashFirmwareDialog::on_useLibrarySplash_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
splashLibrary *ld = new splashLibrary(this, &fileName);
|
||||
SplashLibraryDialog *ld = new SplashLibraryDialog(this, &fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
@@ -203,6 +203,7 @@ void FlashFirmwareDialog::on_useLibrarySplash_clicked()
|
||||
void FlashFirmwareDialog::on_burnButton_clicked()
|
||||
{
|
||||
g.flashDir(QFileInfo(fwName).dir().absolutePath());
|
||||
g.profile[g.id()].fwName(fwName);
|
||||
g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked());
|
||||
g.backupOnFlash(ui->backupEEprom->isChecked());
|
||||
|
||||
|
||||
Executable → Regular
Executable → Regular
@@ -4,13 +4,15 @@ set(generaledit_NAMES
|
||||
generaledit
|
||||
generalsetup
|
||||
trainer
|
||||
calibration
|
||||
hardware
|
||||
)
|
||||
|
||||
set(generaledit_SRCS
|
||||
calibration.cpp
|
||||
)
|
||||
|
||||
set(generaledit_HDRS
|
||||
calibration.h
|
||||
)
|
||||
|
||||
set(generaledit_UIS
|
||||
|
||||
@@ -1,422 +1,90 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QSpinBox>
|
||||
#include "calibration.h"
|
||||
#include "ui_calibration.h"
|
||||
|
||||
void CalibrationPanel::setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||
enabled = true;
|
||||
type->addItem(tr("None"), GeneralSettings::SWITCH_NONE);
|
||||
}
|
||||
else if (index < 8) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("2 Positions Toggle"), GeneralSettings::SWITCH_TOGGLE);
|
||||
type->addItem(tr("2 Positions"), GeneralSettings::SWITCH_2POS);
|
||||
type->addItem(tr("3 Positions"), GeneralSettings::SWITCH_3POS);
|
||||
name->setField(generalSettings.switchName[index], 3, this);
|
||||
type->setField(generalSettings.switchConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void CalibrationPanel::setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS_X9E(firmware->getBoard()) && index < 4) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS).toString());
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS_PLUS(firmware->getBoard()) && index < 3) {
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS(firmware->getBoard()) && index < 2) {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("None"), GeneralSettings::POT_NONE);
|
||||
type->addItem(tr("Pot with detent"), GeneralSettings::POT_WITH_DETENT);
|
||||
type->addItem(tr("Multipos switch"), GeneralSettings::POT_MULTIPOS_SWITCH);
|
||||
type->addItem(tr("Pot without detent"), GeneralSettings::POT_WITHOUT_DETENT);
|
||||
name->setField(generalSettings.potName[index], 3, this);
|
||||
type->setField(generalSettings.potConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void CalibrationPanel::setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard()) && index < 2) {
|
||||
type->setEnabled(false);
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS_X9E(firmware->getBoard()) && index < 4) {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS+4).toString());
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("None"), GeneralSettings::SLIDER_NONE);
|
||||
type->addItem(tr("Slider with detent"), GeneralSettings::SLIDER_WITH_DETENT);
|
||||
name->setField(generalSettings.sliderName[index], 3, this);
|
||||
type->setField(generalSettings.sliderConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware),
|
||||
ui(new Ui::Calibration)
|
||||
GeneralPanel(parent, generalSettings, firmware)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (!firmware->getCapability(MultiposPots)) {
|
||||
ui->potsTypeSeparator->hide();
|
||||
tableWidget = new QTableWidget();
|
||||
QVBoxLayout * layout = new QVBoxLayout();
|
||||
layout->addWidget(tableWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setLayout(layout);
|
||||
|
||||
tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
tableWidget->setColumnCount(3);
|
||||
tableWidget->setShowGrid(false);
|
||||
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
tableWidget->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
tableWidget->setStyleSheet("QTableWidget {background-color: transparent;}");
|
||||
QStringList headerLabels;
|
||||
headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span");
|
||||
tableWidget->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
int rows = NUM_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders);
|
||||
tableWidget->setRowCount(rows);
|
||||
|
||||
for(int i = 0; i < rows; ++i) {
|
||||
|
||||
QTableWidgetItem *newItem = new QTableWidgetItem(AnalogString(i));
|
||||
newItem->setTextAlignment(Qt::AlignLeft);
|
||||
tableWidget->setVerticalHeaderItem(i, newItem);
|
||||
|
||||
for(int j = 0; j < 3; ++j) {
|
||||
QSpinBox * newItem = new QSpinBox();
|
||||
newItem->setMinimum(-9999);
|
||||
newItem->setMaximum(9999);
|
||||
newItem->setSingleStep(1);
|
||||
newItem->setValue(getCalibrationValue(i, j));
|
||||
newItem->setProperty("row", i);
|
||||
newItem->setProperty("column", j);
|
||||
tableWidget->setCellWidget(i, j, newItem);
|
||||
connect(newItem, SIGNAL(valueChanged(int)), this, SLOT(onCellChanged(int)));
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->rudName->setField(generalSettings.stickName[0], 3, this);
|
||||
ui->eleName->setField(generalSettings.stickName[1], 3, this);
|
||||
ui->thrName->setField(generalSettings.stickName[2], 3, this);
|
||||
ui->ailName->setField(generalSettings.stickName[3], 3, this);
|
||||
}
|
||||
else {
|
||||
ui->rudLabel->hide();
|
||||
ui->rudName->hide();
|
||||
ui->eleLabel->hide();
|
||||
ui->eleName->hide();
|
||||
ui->thrLabel->hide();
|
||||
ui->thrName->hide();
|
||||
ui->ailLabel->hide();
|
||||
ui->ailName->hide();
|
||||
}
|
||||
|
||||
setupPotConfig(0, ui->pot1Label, ui->pot1Name, ui->pot1Type);
|
||||
setupPotConfig(1, ui->pot2Label, ui->pot2Name, ui->pot2Type);
|
||||
setupPotConfig(2, ui->pot3Label, ui->pot3Name, ui->pot3Type);
|
||||
setupPotConfig(3, ui->pot4Label, ui->pot4Name, ui->pot4Type);
|
||||
|
||||
setupSliderConfig(0, ui->lsLabel, ui->lsName, ui->lsType);
|
||||
setupSliderConfig(1, ui->rsLabel, ui->rsName, ui->rsType);
|
||||
setupSliderConfig(2, ui->ls2Label, ui->ls2Name, ui->ls2Type);
|
||||
setupSliderConfig(3, ui->rs2Label, ui->rs2Name, ui->rs2Type);
|
||||
|
||||
setupSwitchConfig(0, ui->saLabel, ui->saName, ui->saType);
|
||||
setupSwitchConfig(1, ui->sbLabel, ui->sbName, ui->sbType);
|
||||
setupSwitchConfig(2, ui->scLabel, ui->scName, ui->scType);
|
||||
setupSwitchConfig(3, ui->sdLabel, ui->sdName, ui->sdType);
|
||||
setupSwitchConfig(4, ui->seLabel, ui->seName, ui->seType);
|
||||
setupSwitchConfig(5, ui->sfLabel, ui->sfName, ui->sfType);
|
||||
setupSwitchConfig(6, ui->sgLabel, ui->sgName, ui->sgType);
|
||||
setupSwitchConfig(7, ui->shLabel, ui->shName, ui->shType);
|
||||
setupSwitchConfig(8, ui->siLabel, ui->siName, ui->siType);
|
||||
setupSwitchConfig(9, ui->sjLabel, ui->sjName, ui->sjType);
|
||||
setupSwitchConfig(10, ui->skLabel, ui->skName, ui->skType);
|
||||
setupSwitchConfig(11, ui->slLabel, ui->slName, ui->slType);
|
||||
setupSwitchConfig(12, ui->smLabel, ui->smName, ui->smType);
|
||||
setupSwitchConfig(13, ui->snLabel, ui->snName, ui->snType);
|
||||
setupSwitchConfig(14, ui->soLabel, ui->soName, ui->soType);
|
||||
setupSwitchConfig(15, ui->spLabel, ui->spName, ui->spType);
|
||||
setupSwitchConfig(16, ui->sqLabel, ui->sqName, ui->sqType);
|
||||
setupSwitchConfig(17, ui->srLabel, ui->srName, ui->srType);
|
||||
|
||||
int potsCount = GetCurrentFirmware()->getCapability(Pots);
|
||||
if (potsCount == 3) {
|
||||
ui->ana8Neg->hide();
|
||||
ui->ana8Mid->hide();
|
||||
ui->ana8Pos->hide();
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->serialPortMode->setCurrentIndex(generalSettings.hw_uartMode);
|
||||
}
|
||||
else {
|
||||
ui->serialPortMode->hide();
|
||||
ui->serialPortLabel->hide();
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
|
||||
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
|
||||
}
|
||||
else {
|
||||
ui->bluetoothLabel->hide();
|
||||
ui->bluetoothEnable->hide();
|
||||
ui->bluetoothName->hide();
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
}
|
||||
|
||||
CalibrationPanel::~CalibrationPanel()
|
||||
void CalibrationPanel::onCellChanged(int value)
|
||||
{
|
||||
delete ui;
|
||||
QSpinBox * sb = qobject_cast<QSpinBox*>(sender());
|
||||
int row = sb->property("row").toInt();
|
||||
int column = sb->property("column").toInt();
|
||||
|
||||
if (value != getCalibrationValue(row, column)) {
|
||||
setCalibrationValue(row,column, value);
|
||||
qDebug() << "CalibrationPanel::onCellChanged" << row << column << "to" << value;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
int CalibrationPanel::getCalibrationValue(int row, int column)
|
||||
{
|
||||
switch(column) {
|
||||
case 0:
|
||||
return generalSettings.calibSpanNeg[row];
|
||||
case 1:
|
||||
return generalSettings.calibMid[row];
|
||||
case 2:
|
||||
return generalSettings.calibSpanPos[row];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*void CalibrationPanel::update()
|
||||
void CalibrationPanel::setCalibrationValue(int row, int column, int value)
|
||||
{
|
||||
}
|
||||
*/
|
||||
void CalibrationPanel::on_PPM_MultiplierDSB_editingFinished()
|
||||
{
|
||||
generalSettings.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_PPM1_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[0] = ui->PPM1->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_PPM2_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[1] = ui->PPM2->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_PPM3_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[2] = ui->PPM3->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_PPM4_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[3] = ui->PPM4->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
void CalibrationPanel::on_CurrentCalib_SB_editingFinished()
|
||||
{
|
||||
generalSettings.currentCalib = ui->CurrentCalib_SB->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_bluetoothEnable_stateChanged(int)
|
||||
{
|
||||
generalSettings.bluetoothEnable = ui->bluetoothEnable->isChecked();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::setValues()
|
||||
{
|
||||
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10);
|
||||
ui->CurrentCalib_SB->setValue((double)generalSettings.currentCalib);
|
||||
|
||||
ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]);
|
||||
ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]);
|
||||
ui->ana3Neg->setValue(generalSettings.calibSpanNeg[2]);
|
||||
ui->ana4Neg->setValue(generalSettings.calibSpanNeg[3]);
|
||||
ui->ana5Neg->setValue(generalSettings.calibSpanNeg[4]);
|
||||
ui->ana6Neg->setValue(generalSettings.calibSpanNeg[5]);
|
||||
ui->ana7Neg->setValue(generalSettings.calibSpanNeg[6]);
|
||||
ui->ana8Neg->setValue(generalSettings.calibSpanNeg[7]);
|
||||
|
||||
ui->ana1Mid->setValue(generalSettings.calibMid[0]);
|
||||
ui->ana2Mid->setValue(generalSettings.calibMid[1]);
|
||||
ui->ana3Mid->setValue(generalSettings.calibMid[2]);
|
||||
ui->ana4Mid->setValue(generalSettings.calibMid[3]);
|
||||
ui->ana5Mid->setValue(generalSettings.calibMid[4]);
|
||||
ui->ana6Mid->setValue(generalSettings.calibMid[5]);
|
||||
ui->ana7Mid->setValue(generalSettings.calibMid[6]);
|
||||
ui->ana8Mid->setValue(generalSettings.calibMid[7]);
|
||||
|
||||
ui->ana1Pos->setValue(generalSettings.calibSpanPos[0]);
|
||||
ui->ana2Pos->setValue(generalSettings.calibSpanPos[1]);
|
||||
ui->ana3Pos->setValue(generalSettings.calibSpanPos[2]);
|
||||
ui->ana4Pos->setValue(generalSettings.calibSpanPos[3]);
|
||||
ui->ana5Pos->setValue(generalSettings.calibSpanPos[4]);
|
||||
ui->ana6Pos->setValue(generalSettings.calibSpanPos[5]);
|
||||
ui->ana7Pos->setValue(generalSettings.calibSpanPos[6]);
|
||||
ui->ana8Pos->setValue(generalSettings.calibSpanPos[7]);
|
||||
|
||||
ui->PPM1->setValue(generalSettings.trainer.calib[0]);
|
||||
ui->PPM2->setValue(generalSettings.trainer.calib[1]);
|
||||
ui->PPM3->setValue(generalSettings.trainer.calib[2]);
|
||||
ui->PPM4->setValue(generalSettings.trainer.calib[3]);
|
||||
ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10);
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_battCalibDSB_editingFinished()
|
||||
{
|
||||
generalSettings.vBatCalib = ui->battCalibDSB->value()*10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
void CalibrationPanel::on_ana1Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[0] = ui->ana1Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana2Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[1] = ui->ana2Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana3Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[2] = ui->ana3Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana4Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[3] = ui->ana4Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana5Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[4] = ui->ana5Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana6Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[5] = ui->ana6Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana7Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[6] = ui->ana7Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana8Neg_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanNeg[7] = ui->ana8Neg->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana1Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[0] = ui->ana1Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana2Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[1] = ui->ana2Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana3Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[2] = ui->ana3Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana4Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[3] = ui->ana4Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana5Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[4] = ui->ana5Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana6Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[5] = ui->ana6Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana7Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[6] = ui->ana7Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana8Mid_editingFinished()
|
||||
{
|
||||
generalSettings.calibMid[7] = ui->ana8Mid->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
void CalibrationPanel::on_ana1Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[0] = ui->ana1Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana2Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[1] = ui->ana2Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana3Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[2] = ui->ana3Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana4Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[3] = ui->ana4Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana5Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[4] = ui->ana5Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana6Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[5] = ui->ana6Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana7Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[6] = ui->ana7Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_ana8Pos_editingFinished()
|
||||
{
|
||||
generalSettings.calibSpanPos[7] = ui->ana8Pos->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CalibrationPanel::on_serialPortMode_currentIndexChanged(int index)
|
||||
{
|
||||
generalSettings.hw_uartMode = index;
|
||||
emit modified();
|
||||
switch(column) {
|
||||
case 0:
|
||||
generalSettings.calibSpanNeg[row] = value;
|
||||
break;
|
||||
case 1:
|
||||
generalSettings.calibMid[row] = value;
|
||||
break;
|
||||
case 2:
|
||||
generalSettings.calibSpanPos[row] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef CALIBRATION_H
|
||||
#define CALIBRATION_H
|
||||
|
||||
#include <QTableWidget>
|
||||
#include "generaledit.h"
|
||||
|
||||
namespace Ui {
|
||||
@@ -17,58 +18,16 @@ class CalibrationPanel : public GeneralPanel
|
||||
|
||||
public:
|
||||
CalibrationPanel(QWidget *parent, GeneralSettings & generalSettings, Firmware * firmware);
|
||||
virtual ~CalibrationPanel();
|
||||
// virtual void update();
|
||||
virtual ~CalibrationPanel() {};
|
||||
|
||||
private slots:
|
||||
void on_battCalibDSB_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_bluetoothEnable_stateChanged(int);
|
||||
|
||||
void on_ana1Neg_editingFinished();
|
||||
void on_ana2Neg_editingFinished();
|
||||
void on_ana3Neg_editingFinished();
|
||||
void on_ana4Neg_editingFinished();
|
||||
void on_ana5Neg_editingFinished();
|
||||
void on_ana6Neg_editingFinished();
|
||||
void on_ana7Neg_editingFinished();
|
||||
void on_ana8Neg_editingFinished();
|
||||
|
||||
void on_ana1Mid_editingFinished();
|
||||
void on_ana2Mid_editingFinished();
|
||||
void on_ana3Mid_editingFinished();
|
||||
void on_ana4Mid_editingFinished();
|
||||
void on_ana5Mid_editingFinished();
|
||||
void on_ana6Mid_editingFinished();
|
||||
void on_ana7Mid_editingFinished();
|
||||
void on_ana8Mid_editingFinished();
|
||||
|
||||
void on_ana1Pos_editingFinished();
|
||||
void on_ana2Pos_editingFinished();
|
||||
void on_ana3Pos_editingFinished();
|
||||
void on_ana4Pos_editingFinished();
|
||||
void on_ana5Pos_editingFinished();
|
||||
void on_ana6Pos_editingFinished();
|
||||
void on_ana7Pos_editingFinished();
|
||||
void on_ana8Pos_editingFinished();
|
||||
|
||||
void on_serialPortMode_currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
void setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
|
||||
void setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
|
||||
void setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
|
||||
void onCellChanged(int value);
|
||||
|
||||
private:
|
||||
Ui::Calibration *ui;
|
||||
QTableWidget * tableWidget;
|
||||
|
||||
void setValues();
|
||||
int getCalibrationValue(int row, int column);
|
||||
void setCalibrationValue(int row, int column, int value);
|
||||
};
|
||||
|
||||
#endif // CALIBRATION_H
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "generalsetup.h"
|
||||
#include "trainer.h"
|
||||
#include "calibration.h"
|
||||
#include "hardware.h"
|
||||
#include "../modeledit/customfunctions.h"
|
||||
#include "verticalscrollarea.h"
|
||||
|
||||
@@ -42,7 +43,8 @@ GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * fir
|
||||
addTab(new CustomFunctionsPanel(this, NULL, generalSettings, firmware), tr("Global Functions"));
|
||||
}
|
||||
addTab(new TrainerPanel(this, generalSettings, firmware), tr("Trainer"));
|
||||
addTab(new CalibrationPanel(this, generalSettings, firmware), tr("Hardware / Calibration"));
|
||||
addTab(new HardwarePanel(this, generalSettings, firmware), tr("Hardware"));
|
||||
addTab(new CalibrationPanel(this, generalSettings, firmware), tr("Calibration"));
|
||||
|
||||
ui->tabWidget->setCurrentIndex( g.generalEditTab() );
|
||||
}
|
||||
@@ -88,8 +90,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 +125,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 +227,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 );
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
#include "hardware.h"
|
||||
#include "ui_hardware.h"
|
||||
|
||||
void HardwarePanel::setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type, bool threePos = true)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||
enabled = true;
|
||||
type->addItem(tr("None"), GeneralSettings::SWITCH_NONE);
|
||||
}
|
||||
else if (index < 8) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("2 Positions Toggle"), GeneralSettings::SWITCH_TOGGLE);
|
||||
type->addItem(tr("2 Positions"), GeneralSettings::SWITCH_2POS);
|
||||
if (threePos) type->addItem(tr("3 Positions"), GeneralSettings::SWITCH_3POS);
|
||||
name->setField(generalSettings.switchName[index], 3, this);
|
||||
type->setField(generalSettings.switchConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void HardwarePanel::setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS_X9E(firmware->getBoard()) && index < 4) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS).toString());
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS_PLUS(firmware->getBoard()) && index < 3) {
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS(firmware->getBoard()) && index < 2) {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("None"), GeneralSettings::POT_NONE);
|
||||
type->addItem(tr("Pot with detent"), GeneralSettings::POT_WITH_DETENT);
|
||||
type->addItem(tr("Multipos switch"), GeneralSettings::POT_MULTIPOS_SWITCH);
|
||||
type->addItem(tr("Pot without detent"), GeneralSettings::POT_WITHOUT_DETENT);
|
||||
name->setField(generalSettings.potName[index], 3, this);
|
||||
type->setField(generalSettings.potConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void HardwarePanel::setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard()) && index < 2) {
|
||||
type->setEnabled(false);
|
||||
enabled = true;
|
||||
}
|
||||
else if (IS_TARANIS_X9E(firmware->getBoard()) && index < 4) {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (IS_TARANIS_X9E(firmware->getBoard())) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS+4).toString());
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
type->addItem(tr("None"), GeneralSettings::SLIDER_NONE);
|
||||
type->addItem(tr("Slider with detent"), GeneralSettings::SLIDER_WITH_DETENT);
|
||||
name->setField(generalSettings.sliderName[index], 3, this);
|
||||
type->setField(generalSettings.sliderConfig[index], this);
|
||||
}
|
||||
else {
|
||||
label->hide();
|
||||
name->hide();
|
||||
type->hide();
|
||||
}
|
||||
}
|
||||
|
||||
HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware),
|
||||
ui(new Ui::Hardware)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->rudName->setField(generalSettings.stickName[0], 3, this);
|
||||
ui->eleName->setField(generalSettings.stickName[1], 3, this);
|
||||
ui->thrName->setField(generalSettings.stickName[2], 3, this);
|
||||
ui->ailName->setField(generalSettings.stickName[3], 3, this);
|
||||
}
|
||||
else {
|
||||
ui->rudLabel->hide();
|
||||
ui->rudName->hide();
|
||||
ui->eleLabel->hide();
|
||||
ui->eleName->hide();
|
||||
ui->thrLabel->hide();
|
||||
ui->thrName->hide();
|
||||
ui->ailLabel->hide();
|
||||
ui->ailName->hide();
|
||||
}
|
||||
|
||||
setupPotConfig(0, ui->pot1Label, ui->pot1Name, ui->pot1Type);
|
||||
setupPotConfig(1, ui->pot2Label, ui->pot2Name, ui->pot2Type);
|
||||
setupPotConfig(2, ui->pot3Label, ui->pot3Name, ui->pot3Type);
|
||||
setupPotConfig(3, ui->pot4Label, ui->pot4Name, ui->pot4Type);
|
||||
|
||||
setupSliderConfig(0, ui->lsLabel, ui->lsName, ui->lsType);
|
||||
setupSliderConfig(1, ui->rsLabel, ui->rsName, ui->rsType);
|
||||
setupSliderConfig(2, ui->ls2Label, ui->ls2Name, ui->ls2Type);
|
||||
setupSliderConfig(3, ui->rs2Label, ui->rs2Name, ui->rs2Type);
|
||||
|
||||
setupSwitchConfig(0, ui->saLabel, ui->saName, ui->saType);
|
||||
setupSwitchConfig(1, ui->sbLabel, ui->sbName, ui->sbType);
|
||||
setupSwitchConfig(2, ui->scLabel, ui->scName, ui->scType);
|
||||
setupSwitchConfig(3, ui->sdLabel, ui->sdName, ui->sdType);
|
||||
setupSwitchConfig(4, ui->seLabel, ui->seName, ui->seType);
|
||||
setupSwitchConfig(5, ui->sfLabel, ui->sfName, ui->sfType, false); //switch does not support 3POS
|
||||
setupSwitchConfig(6, ui->sgLabel, ui->sgName, ui->sgType);
|
||||
setupSwitchConfig(7, ui->shLabel, ui->shName, ui->shType, false); //switch does not support 3POS
|
||||
setupSwitchConfig(8, ui->siLabel, ui->siName, ui->siType);
|
||||
setupSwitchConfig(9, ui->sjLabel, ui->sjName, ui->sjType);
|
||||
setupSwitchConfig(10, ui->skLabel, ui->skName, ui->skType);
|
||||
setupSwitchConfig(11, ui->slLabel, ui->slName, ui->slType);
|
||||
setupSwitchConfig(12, ui->smLabel, ui->smName, ui->smType);
|
||||
setupSwitchConfig(13, ui->snLabel, ui->snName, ui->snType);
|
||||
setupSwitchConfig(14, ui->soLabel, ui->soName, ui->soType);
|
||||
setupSwitchConfig(15, ui->spLabel, ui->spName, ui->spType);
|
||||
setupSwitchConfig(16, ui->sqLabel, ui->sqName, ui->sqType);
|
||||
setupSwitchConfig(17, ui->srLabel, ui->srName, ui->srType);
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->serialPortMode->setCurrentIndex(generalSettings.hw_uartMode);
|
||||
}
|
||||
else {
|
||||
ui->serialPortMode->hide();
|
||||
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);
|
||||
}
|
||||
else {
|
||||
ui->bluetoothLabel->hide();
|
||||
ui->bluetoothEnable->hide();
|
||||
ui->bluetoothName->hide();
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
setValues();
|
||||
}
|
||||
|
||||
HardwarePanel::~HardwarePanel()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void HardwarePanel::on_PPM_MultiplierDSB_editingFinished()
|
||||
{
|
||||
generalSettings.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_PPM1_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[0] = ui->PPM1->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_PPM2_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[1] = ui->PPM2->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_PPM3_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[2] = ui->PPM3->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_PPM4_editingFinished()
|
||||
{
|
||||
generalSettings.trainer.calib[3] = ui->PPM4->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
void HardwarePanel::on_txCurrentHardware_editingFinished()
|
||||
{
|
||||
generalSettings.txCurrentCalibration = ui->txCurrentCalibration->value();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_bluetoothEnable_stateChanged(int)
|
||||
{
|
||||
generalSettings.bluetoothEnable = ui->bluetoothEnable->isChecked();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::setValues()
|
||||
{
|
||||
ui->txVoltageCalibration->setValue((double)generalSettings.txVoltageCalibration/10);
|
||||
ui->txCurrentCalibration->setValue((double)generalSettings.txCurrentCalibration);
|
||||
|
||||
ui->PPM1->setValue(generalSettings.trainer.calib[0]);
|
||||
ui->PPM2->setValue(generalSettings.trainer.calib[1]);
|
||||
ui->PPM3->setValue(generalSettings.trainer.calib[2]);
|
||||
ui->PPM4->setValue(generalSettings.trainer.calib[3]);
|
||||
ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10);
|
||||
}
|
||||
|
||||
void HardwarePanel::on_txVoltageHardware_editingFinished()
|
||||
{
|
||||
generalSettings.txVoltageCalibration = ui->txVoltageCalibration->value()*10;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void HardwarePanel::on_serialPortMode_currentIndexChanged(int index)
|
||||
{
|
||||
generalSettings.hw_uartMode = index;
|
||||
emit modified();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef HARDWARE_H
|
||||
#define HARDWARE_H
|
||||
|
||||
#include "generaledit.h"
|
||||
|
||||
namespace Ui {
|
||||
class Hardware;
|
||||
}
|
||||
|
||||
class QLabel;
|
||||
class AutoLineEdit;
|
||||
class AutoComboBox;
|
||||
|
||||
class HardwarePanel : public GeneralPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HardwarePanel(QWidget *parent, GeneralSettings & generalSettings, Firmware * firmware);
|
||||
virtual ~HardwarePanel();
|
||||
|
||||
private slots:
|
||||
void on_txVoltageHardware_editingFinished();
|
||||
void on_PPM1_editingFinished();
|
||||
void on_PPM2_editingFinished();
|
||||
void on_PPM3_editingFinished();
|
||||
void on_PPM4_editingFinished();
|
||||
void on_PPM_MultiplierDSB_editingFinished();
|
||||
|
||||
void on_txCurrentHardware_editingFinished();
|
||||
void on_bluetoothEnable_stateChanged(int);
|
||||
|
||||
void on_serialPortMode_currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
void setupPotConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
|
||||
void setupSliderConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type);
|
||||
void setupSwitchConfig(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type, bool threePos);
|
||||
|
||||
private:
|
||||
Ui::Hardware *ui;
|
||||
|
||||
void setValues();
|
||||
};
|
||||
|
||||
#endif // HARDWARE_H
|
||||
+303
-757
File diff suppressed because it is too large
Load Diff
+160
-189
@@ -12,6 +12,8 @@
|
||||
#include "simulatorinterface.h"
|
||||
#include "firmwareinterface.h"
|
||||
|
||||
Stopwatch gStopwatch("global");
|
||||
|
||||
const QColor colors[C9X_MAX_CURVES] = {
|
||||
QColor(0,0,127),
|
||||
QColor(0,127,0),
|
||||
@@ -47,44 +49,6 @@ const QColor colors[C9X_MAX_CURVES] = {
|
||||
QColor(255,127,0),
|
||||
};
|
||||
|
||||
QString getPhaseName(int val, const char * phasename)
|
||||
{
|
||||
if (!val) return "---";
|
||||
if (!phasename) {
|
||||
return QString(val < 0 ? "!" : "") + QObject::tr("FM%1").arg(abs(val) - 1);
|
||||
}
|
||||
else {
|
||||
QString phaseName;
|
||||
phaseName.append(phasename);
|
||||
if (phaseName.isEmpty()) {
|
||||
return QString(val < 0 ? "!" : "") + QObject::tr("FM%1").arg(abs(val) - 1);
|
||||
}
|
||||
else {
|
||||
return QString(val < 0 ? "!" : "") + phaseName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString getInputStr(ModelData * model, int index)
|
||||
{
|
||||
QString result;
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
|
||||
if (strlen(model->inputNames[index]) > 0) {
|
||||
result = QObject::tr("[I%1]").arg(index+1);
|
||||
result += QString(model->inputNames[index]);
|
||||
}
|
||||
else {
|
||||
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = RawSource(SOURCE_TYPE_STICK, index).toString(model);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void populateGvSourceCB(QComboBox *b, int value)
|
||||
{
|
||||
QString strings[] = { QObject::tr("---"), QObject::tr("Rud Trim"), QObject::tr("Ele Trim"), QObject::tr("Thr Trim"), QObject::tr("Ail Trim"), QObject::tr("Rot Enc"), QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
||||
@@ -95,18 +59,35 @@ void populateGvSourceCB(QComboBox *b, int value)
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
|
||||
QString getProtocolStr(const int proto)
|
||||
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current)
|
||||
{
|
||||
static const char *strings[] = { "OFF",
|
||||
"PPM",
|
||||
"Silverlit A", "Silverlit B", "Silverlit C",
|
||||
"CTP1009",
|
||||
"LP45", "DSM2", "DSMX",
|
||||
"PPM16", "PPMsim",
|
||||
"FrSky XJT - D16", "FrSky XJT - D8", "FrSky XJT - LR12", "FrSky DJT",
|
||||
};
|
||||
b->clear();
|
||||
b->addItem("----");
|
||||
|
||||
return CHECK_IN_ARRAY(strings, proto);
|
||||
bool added = false;
|
||||
// Convert set into list and sort it alphabetically case insensitive
|
||||
QStringList list = QStringList::fromSet(set);
|
||||
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
|
||||
foreach (QString entry, list) {
|
||||
b->addItem(entry);
|
||||
if (entry == current) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!added && !current.isEmpty()) {
|
||||
b->addItem(current);
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void getFileComboBoxValue(QComboBox * b, char * dest, int length)
|
||||
{
|
||||
memset(dest, 0, length+1);
|
||||
if (b->currentText() != "----") {
|
||||
strncpy(dest, b->currentText().toAscii(), length);
|
||||
}
|
||||
}
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value)
|
||||
@@ -194,7 +175,7 @@ void GVarGroup::valuesChanged()
|
||||
else if (sb)
|
||||
weight = sb->value();
|
||||
else
|
||||
weight = dsb->value()/step;
|
||||
weight = round(dsb->value()/step);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +619,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
||||
if (model->sensorData[i].isAvailable()) {
|
||||
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
|
||||
for (int j=0; j<3; ++j) {
|
||||
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
@@ -650,8 +631,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) {
|
||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
||||
continue;
|
||||
if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime))
|
||||
continue;
|
||||
if (i==TELEMETRY_SOURCE_SWR && !GetCurrentFirmware()->getCapability(SportTelemetry))
|
||||
@@ -763,134 +742,6 @@ QString getFrSkySrc(int index)
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
|
||||
}
|
||||
|
||||
QString getTrimInc(ModelData * g_model)
|
||||
{
|
||||
switch (g_model->trimInc) {
|
||||
case -2:
|
||||
return QObject::tr("Exponential");
|
||||
case -1:
|
||||
return QObject::tr("Extra Fine");
|
||||
case 0:
|
||||
return QObject::tr("Fine");
|
||||
case 1:
|
||||
return QObject::tr("Medium");
|
||||
case 2:
|
||||
return QObject::tr("Coarse");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString getTimerStr(TimerData & timer)
|
||||
{
|
||||
QString result = QObject::tr("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
|
||||
result += QString(", ") + timer.mode.toString();
|
||||
if (timer.persistent)
|
||||
result += QObject::tr(", Persistent");
|
||||
if (timer.minuteBeep)
|
||||
result += QObject::tr(", MinuteBeep");
|
||||
if (timer.countdownBeep == 1)
|
||||
result += QObject::tr(", CountDown(Beeps)");
|
||||
else if (timer.countdownBeep == 2)
|
||||
result += QObject::tr(", CountDown(Voice)");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getProtocol(ModuleData & module)
|
||||
{
|
||||
QString str = getProtocolStr(module.protocol);
|
||||
|
||||
if (module.protocol == PPM)
|
||||
str.append(QObject::tr(": Channel start: %1, %2 Channels, %3usec Delay, Pulse polarity %4").arg(module.channelsStart+1).arg(module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString()));
|
||||
else
|
||||
str.append(QObject::tr(": Channel start: %1, %2 Channels").arg(module.channelsStart+1).arg(module.channelsCount));
|
||||
return str;
|
||||
}
|
||||
|
||||
QString getTrainerMode(const int trainermode, ModuleData & module)
|
||||
{
|
||||
QString result;
|
||||
switch (trainermode) {
|
||||
case 1:
|
||||
result=QObject::tr("Slave/Jack")+QObject::tr(": Channel start: %1, %2 Channels, %3usec Delay, Pulse polarity %4").arg(module.channelsStart+1).arg(module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
|
||||
break;
|
||||
case 2:
|
||||
result=QObject::tr("Master/SBUS Module");
|
||||
break;
|
||||
case 3:
|
||||
result=QObject::tr("Master/CPPM Module");
|
||||
break;
|
||||
case 4:
|
||||
result=QObject::tr("Master/SBUS in battery compartment");
|
||||
break;
|
||||
default:
|
||||
result=QObject::tr("Master/Jack");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getPhasesStr(unsigned int phases, ModelData * model)
|
||||
{
|
||||
int numphases = GetCurrentFirmware()->getCapability(FlightModes);
|
||||
|
||||
if (numphases && phases) {
|
||||
QString str;
|
||||
int count = 0;
|
||||
if (phases == (unsigned int)(1<<numphases) - 1) {
|
||||
str = QObject::tr("None");
|
||||
}
|
||||
if (phases) {
|
||||
for (int i=0; i<numphases;i++) {
|
||||
if (!(phases & (1<<i))) {
|
||||
if (count++ > 0) str += QString(", ");
|
||||
str += getPhaseName(i+1, model->flightModeData[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count > 1)
|
||||
return QObject::tr("Flight modes(%1)").arg(str);
|
||||
else
|
||||
return QObject::tr("Flight mode(%1)").arg(str);
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
QString getCenterBeepStr(ModelData * g_model)
|
||||
{
|
||||
QStringList strl;
|
||||
if (g_model->beepANACenter & 0x01)
|
||||
strl << QObject::tr("Rudder");
|
||||
if (g_model->beepANACenter & 0x02)
|
||||
strl << QObject::tr("Elevator");
|
||||
if (g_model->beepANACenter & 0x04)
|
||||
strl << QObject::tr("Throttle");
|
||||
if (g_model->beepANACenter & 0x08)
|
||||
strl << QObject::tr("Aileron");
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "S1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "S2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "S3";
|
||||
if (g_model->beepANACenter & 0x80)
|
||||
strl << "LS";
|
||||
if (g_model->beepANACenter & 0x100)
|
||||
strl << "RS";
|
||||
}
|
||||
else {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "P1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "P2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "P3";
|
||||
}
|
||||
return strl.join(", ");
|
||||
}
|
||||
|
||||
QString getTheme()
|
||||
{
|
||||
int theme_set = g.theme();
|
||||
@@ -988,22 +839,38 @@ QPixmap makePixMap( QImage image, QString firmwareType )
|
||||
return(QPixmap::fromImage(image));
|
||||
}
|
||||
|
||||
int version2index(QString version)
|
||||
int version2index(const QString & version)
|
||||
{
|
||||
QStringList parts = version.split('.');
|
||||
int result = 0;
|
||||
if (parts.size() > 2)
|
||||
result = parts[2].toInt();
|
||||
int result = 999;
|
||||
QStringList parts = version.split("N");
|
||||
if (parts.size() > 1)
|
||||
result += 100 * parts[1].toInt();
|
||||
result = parts[1].toInt(); // nightly build
|
||||
parts = parts[0].split('.');
|
||||
if (parts.size() > 2)
|
||||
result += 1000 * parts[2].toInt();
|
||||
if (parts.size() > 1)
|
||||
result += 100000 * parts[1].toInt();
|
||||
if (parts.size() > 0)
|
||||
result += 10000 * parts[0].toInt();
|
||||
result += 10000000 * parts[0].toInt();
|
||||
return result;
|
||||
}
|
||||
|
||||
QString index2version(int index)
|
||||
{
|
||||
if (index >= 19900) {
|
||||
if (index >= 19900000) {
|
||||
int nightly = index % 1000;
|
||||
index /= 1000;
|
||||
int revision = index % 100;
|
||||
index /= 100;
|
||||
int minor = index % 100;
|
||||
int major = index / 100;
|
||||
QString result = QString("%1.%2.%3").arg(major).arg(minor).arg(revision);
|
||||
if (nightly > 0 && nightly < 999) {
|
||||
result += QString("N%1").arg(nightly);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else if (index >= 19900) {
|
||||
int revision = index % 100;
|
||||
index /= 100;
|
||||
int minor = index % 100;
|
||||
@@ -1021,7 +888,7 @@ int qunlink(const QString & fileName)
|
||||
return unlink(ba.constData());
|
||||
}
|
||||
|
||||
QString generateProcessUniqueTempFileName(const QString &fileName)
|
||||
QString generateProcessUniqueTempFileName(const QString & fileName)
|
||||
{
|
||||
QString sanitizedFileName = fileName;
|
||||
sanitizedFileName.remove('/');
|
||||
@@ -1115,3 +982,107 @@ double toDecimalCoordinate(const QString & value)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList extractLatLon(const QString & position)
|
||||
{
|
||||
QStringList result;
|
||||
QStringList parts = position.split(' ');
|
||||
if (parts.size() != 2) {
|
||||
result.append("");
|
||||
result.append("");
|
||||
}
|
||||
else {
|
||||
result.append(parts.at(1).trimmed());
|
||||
result.append(parts.at(0).trimmed());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TableLayout::TableLayout(QWidget * parent, int rowCount, const QStringList & headerLabels)
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
tableWidget = new QTableWidget(parent);
|
||||
QVBoxLayout * layout = new QVBoxLayout();
|
||||
layout->addWidget(tableWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
parent->setLayout(layout);
|
||||
|
||||
tableWidget->setRowCount(rowCount);
|
||||
tableWidget->setColumnCount(headerLabels.size());
|
||||
tableWidget->setShowGrid(false);
|
||||
tableWidget->verticalHeader()->setVisible(false);
|
||||
tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
tableWidget->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
tableWidget->setStyleSheet("QTableWidget {background-color: transparent;}");
|
||||
tableWidget->setHorizontalHeaderLabels(headerLabels);
|
||||
#else
|
||||
gridWidget = new QGridLayout(parent);
|
||||
|
||||
int col = 0;
|
||||
foreach(QString text, headerLabels) {
|
||||
QLabel *label = new QLabel();
|
||||
label->setFrameShape(QFrame::Panel);
|
||||
label->setFrameShadow(QFrame::Raised);
|
||||
label->setMidLineWidth(0);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setMargin(5);
|
||||
label->setText(text);
|
||||
// if (!minimize)
|
||||
// label->setMinimumWidth(100);
|
||||
gridWidget->addWidget(label, 0, col++);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableLayout::addWidget(int row, int column, QWidget * widget)
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
QHBoxLayout * layout = new QHBoxLayout(tableWidget);
|
||||
layout->addWidget(widget);
|
||||
addLayout(row, column, layout);
|
||||
#else
|
||||
gridWidget->addWidget(widget, row + 1, column);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableLayout::addLayout(int row, int column, QLayout * layout)
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
layout->setContentsMargins(1, 3, 1, 3);
|
||||
QWidget * containerWidget = new QWidget(tableWidget);
|
||||
containerWidget->setLayout(layout);
|
||||
tableWidget->setCellWidget(row, column, containerWidget);
|
||||
#else
|
||||
gridWidget->addLayout(layout, row + 1, column);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableLayout::resizeColumnsToContents()
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
tableWidget->resizeColumnsToContents();
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableLayout::setColumnWidth(int col, int width)
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
tableWidget->setColumnWidth(col, width);
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void TableLayout::pushRowsUp(int row)
|
||||
{
|
||||
#if defined(TABLE_LAYOUT)
|
||||
#else
|
||||
// Push the rows up
|
||||
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
||||
gridWidget->addItem(spacer, row, 0);
|
||||
#endif
|
||||
// Push rows upward
|
||||
// addDoubleSpring(gridLayout, 5, num_fsw+1);
|
||||
|
||||
}
|
||||
|
||||
+63
-11
@@ -2,6 +2,9 @@
|
||||
#define HELPERS_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QTableWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QDebug>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
extern const QColor colors[C9X_MAX_CURVES];
|
||||
@@ -26,6 +29,8 @@ extern const QColor colors[C9X_MAX_CURVES];
|
||||
#define TRIM_MODE_NONE 0x1F // 0b11111
|
||||
|
||||
void populateGvSourceCB(QComboBox *b, int value);
|
||||
void populateFileComboBox(QComboBox * b, const QSet<QString> & set, const QString & current);
|
||||
void getFileComboBoxValue(QComboBox * b, char * dest, int length);
|
||||
void populateRotEncCB(QComboBox *b, int value, int renumber);
|
||||
|
||||
QString getTheme();
|
||||
@@ -98,8 +103,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
QString getProtocolStr(const int proto);
|
||||
QString getPhasesStr(unsigned int phases, ModelData * model);
|
||||
|
||||
#define POPULATE_NONE (1<<0)
|
||||
#define POPULATE_SOURCES (1<<1)
|
||||
@@ -117,17 +120,9 @@ QString getPhasesStr(unsigned int phases, ModelData * model);
|
||||
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
|
||||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags);
|
||||
QString getPhaseName(int val, const char * phasename=NULL);
|
||||
QString getInputStr(ModelData * model, int index);
|
||||
QString image2qstring(QImage image);
|
||||
int findmult(float value, float base);
|
||||
|
||||
QString getTrimInc(ModelData * g_model);
|
||||
QString getTimerStr(TimerData & timer);
|
||||
QString getProtocol(ModuleData & module);
|
||||
QString getTrainerMode(const int trainermode, ModuleData & module);
|
||||
QString getCenterBeepStr(ModelData * g_model);
|
||||
|
||||
/* FrSky helpers */
|
||||
QString getFrSkyAlarmType(int alarm);
|
||||
QString getFrSkyUnits(int units);
|
||||
@@ -160,7 +155,7 @@ QVector<T> findWidgets(QObject * object, const QString & name)
|
||||
// Format a pixmap to fit on the radio using a specific firmware
|
||||
QPixmap makePixMap( QImage image, QString firmwareType );
|
||||
|
||||
int version2index(QString version);
|
||||
int version2index(const QString & version);
|
||||
QString index2version(int index);
|
||||
|
||||
class QTimeS : public QTime
|
||||
@@ -207,5 +202,62 @@ private:
|
||||
};
|
||||
|
||||
double toDecimalCoordinate(const QString & value);
|
||||
QStringList extractLatLon(const QString & position);
|
||||
|
||||
class TableLayout
|
||||
{
|
||||
public:
|
||||
TableLayout(QWidget * parent, int rowCount, const QStringList & headerLabels);
|
||||
// ~TableLayout() ;
|
||||
|
||||
void addWidget(int row, int column, QWidget * widget);
|
||||
void addLayout(int row, int column, QLayout * layout);
|
||||
|
||||
void resizeColumnsToContents();
|
||||
void setColumnWidth(int col, int width);
|
||||
void pushRowsUp(int row);
|
||||
|
||||
private:
|
||||
#if defined(TABLE_LAYOUT)
|
||||
QTableWidget * tableWidget;
|
||||
#else
|
||||
QGridLayout * gridWidget;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
class Stopwatch
|
||||
{
|
||||
public:
|
||||
Stopwatch(const QString & name) :
|
||||
name(name), total(0) {
|
||||
timer.start();
|
||||
};
|
||||
~Stopwatch() {};
|
||||
|
||||
void restart() {
|
||||
total = 0;
|
||||
timer.restart();
|
||||
};
|
||||
|
||||
void report() {
|
||||
qint64 elapsed = timer.restart();
|
||||
total += elapsed;
|
||||
qDebug() << name << QString("%1 ms [%2 ms]").arg(elapsed).arg(total);
|
||||
};
|
||||
|
||||
void report(const QString & text) {
|
||||
qint64 elapsed = timer.restart();
|
||||
total += elapsed;
|
||||
qDebug() << name << text << QString("%1 ms [%2 ms]").arg(elapsed).arg(total);
|
||||
};
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QElapsedTimer timer;
|
||||
qint64 total;
|
||||
};
|
||||
|
||||
extern Stopwatch gStopwatch;
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
||||
Executable → Regular
Executable → Regular
@@ -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 |
Executable → Regular
Executable → Regular
Executable → Regular
@@ -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>
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
logsDialog::logsDialog(QWidget *parent) :
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
ui(new Ui::logsDialog)
|
||||
LogsDialog::LogsDialog(QWidget *parent) :
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
ui(new Ui::LogsDialog)
|
||||
{
|
||||
csvlog.clear();
|
||||
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("logs.png"));
|
||||
setWindowIcon(CompanionIcon("logs.png"));
|
||||
|
||||
plotLock=false;
|
||||
|
||||
@@ -36,26 +36,20 @@ logsDialog::logsDialog(QWidget *parent) :
|
||||
// create and prepare a plot title layout element
|
||||
QCPPlotTitle *title = new QCPPlotTitle(ui->customPlot);
|
||||
title->setText(tr("Telemetry logs"));
|
||||
// title->setFont(QFont("sans", 12, QFont::Bold));
|
||||
|
||||
// add it to the main plot layout
|
||||
ui->customPlot->plotLayout()->insertRow(0);
|
||||
ui->customPlot->plotLayout()->addElement(0, 0, title);
|
||||
|
||||
ui->customPlot->setNoAntialiasingOnDrag(true);
|
||||
|
||||
ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom |
|
||||
QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables);
|
||||
ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables);
|
||||
|
||||
axisRect = ui->customPlot->axisRect();
|
||||
axisRect->axis(QCPAxis::atBottom)->setLabel(tr("Time (hh:mm:ss)"));
|
||||
axisRect->axis(QCPAxis::atBottom)->setTickLabelType(QCPAxis::ltDateTime);
|
||||
axisRect->axis(QCPAxis::atBottom)->setDateTimeFormat("hh:mm:ss");
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
axisRect->axis(QCPAxis::atBottom)->setRange(now.addSecs(-60*60*2).toTime_t(),
|
||||
now.toTime_t());
|
||||
|
||||
axisRect->axis(QCPAxis::atBottom)->setRange(now.addSecs(-60*60*2).toTime_t(), now.toTime_t());
|
||||
axisRect->axis(QCPAxis::atLeft)->setTickLabels(false);
|
||||
|
||||
axisRect->addAxis(QCPAxis::atLeft);
|
||||
axisRect->addAxis(QCPAxis::atRight);
|
||||
axisRect->axis(QCPAxis::atLeft, 1)->setVisible(false);
|
||||
@@ -76,8 +70,8 @@ logsDialog::logsDialog(QWidget *parent) :
|
||||
|
||||
ui->customPlot->setAutoAddPlottableToLegend(false);
|
||||
|
||||
QString Path=g.gePath();
|
||||
if (Path.isEmpty() || !QFile(Path).exists()) {
|
||||
QString path = g.gePath();
|
||||
if (path.isEmpty() || !QFile(path).exists()) {
|
||||
ui->mapsButton->hide();
|
||||
}
|
||||
|
||||
@@ -99,57 +93,52 @@ logsDialog::logsDialog(QWidget *parent) :
|
||||
connect(ui->Reset_PB, SIGNAL(clicked()), this, SLOT(plotLogs()));
|
||||
}
|
||||
|
||||
logsDialog::~logsDialog()
|
||||
LogsDialog::~LogsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void logsDialog::titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title)
|
||||
void LogsDialog::titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title)
|
||||
{
|
||||
// Set the plot title by double clicking on it
|
||||
|
||||
bool ok;
|
||||
QString newTitle = QInputDialog::getText(this, tr("Plot Title Change"),
|
||||
tr("New plot title:"), QLineEdit::Normal, title->text(), &ok);
|
||||
if (ok)
|
||||
{
|
||||
QString newTitle = QInputDialog::getText(this, tr("Plot Title Change"), tr("New plot title:"), QLineEdit::Normal, title->text(), &ok);
|
||||
if (ok) {
|
||||
title->setText(newTitle);
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
void logsDialog::axisLabelDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part)
|
||||
void LogsDialog::axisLabelDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part)
|
||||
{
|
||||
// Set an axis label by double clicking on it
|
||||
if (part == QCPAxis::spAxisLabel) // only react when the actual axis label is clicked, not tick label or axis backbone
|
||||
{
|
||||
if (part == QCPAxis::spAxisLabel) {
|
||||
// only react when the actual axis label is clicked, not tick label or axis backbone
|
||||
bool ok;
|
||||
QString newLabel = QInputDialog::getText(this, tr("Axis Label Change"), tr("New axis label:"), QLineEdit::Normal, axis->label(), &ok);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
axis->setLabel(newLabel);
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void logsDialog::legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item)
|
||||
void LogsDialog::legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item)
|
||||
{
|
||||
// Rename a graph by double clicking on its legend item
|
||||
if (item) // only react if item was clicked (user could have clicked on border padding of legend where there is no item, then item is 0)
|
||||
{
|
||||
if (item) {
|
||||
// only react if item was clicked (user could have clicked on border padding of legend where there is no item, then item is 0)
|
||||
QCPPlottableLegendItem *plItem = qobject_cast<QCPPlottableLegendItem*>(item);
|
||||
bool ok;
|
||||
QString newName = QInputDialog::getText(this, tr("Graph Name Change"), tr("New graph name:"), QLineEdit::Normal, plItem->plottable()->name(), &ok);
|
||||
if (ok)
|
||||
{
|
||||
if (ok) {
|
||||
plItem->plottable()->setName(newName);
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void logsDialog::selectionChanged()
|
||||
void LogsDialog::selectionChanged()
|
||||
{
|
||||
/*
|
||||
normally, axis base line, axis tick labels and axis labels are selectable separately, but we want
|
||||
@@ -208,20 +197,18 @@ void logsDialog::selectionChanged()
|
||||
}
|
||||
|
||||
// synchronize selection of graphs with selection of corresponding legend items:
|
||||
for (int i=0; i<ui->customPlot->graphCount(); ++i)
|
||||
{
|
||||
for (int i=0; i<ui->customPlot->graphCount(); ++i) {
|
||||
QCPGraph *graph = ui->customPlot->graph(i);
|
||||
QCPPlottableLegendItem *item = ui->customPlot->legend->itemWithPlottable(graph);
|
||||
if (item == NULL) item = rightLegend->itemWithPlottable(graph);
|
||||
if (item->selected() || graph->selected())
|
||||
{
|
||||
if (item->selected() || graph->selected()) {
|
||||
item->setSelected(true);
|
||||
graph->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
|
||||
QList<QStringList> LogsDialog::filterGePoints(const QList<QStringList> & input)
|
||||
{
|
||||
QList<QStringList> result;
|
||||
|
||||
@@ -230,17 +217,16 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
|
||||
return result;
|
||||
}
|
||||
|
||||
int latcol=0, longcol=0;
|
||||
int gpscol = 0;
|
||||
for (int i=1; i<input.at(0).count(); i++) {
|
||||
//Long,Lat,Course,GPS Speed,GPS Alt
|
||||
if (input.at(0).at(i).contains("Long")) {
|
||||
longcol=i;
|
||||
}
|
||||
if (input.at(0).at(i).contains("Lat")) {
|
||||
latcol=i;
|
||||
if (input.at(0).at(i) == "GPS") {
|
||||
gpscol=i;
|
||||
}
|
||||
}
|
||||
if (longcol==0 || latcol==0) {
|
||||
if (gpscol == 0) {
|
||||
QMessageBox::critical(this, tr("Error: no GPS data not found"),
|
||||
tr("The column containing GPS coordinates must be named \"GPS\".\n\n\
|
||||
The columns for altitude \"GAlt\" and for speed \"GSpd\" are optional"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -253,14 +239,15 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
|
||||
for (int i = 1; i < n; i++) {
|
||||
if ((ui->logTable->item(i-1, 1)->isSelected() && rangeSelected) || !rangeSelected) {
|
||||
|
||||
QString latitude = input.at(i).at(latcol).trimmed();
|
||||
QString longitude = input.at(i).at(longcol).trimmed();
|
||||
QStringList latlon = extractLatLon(input.at(i).at(gpscol));
|
||||
QString latitude = latlon[0];
|
||||
QString longitude = latlon[1];
|
||||
double flatitude = toDecimalCoordinate(latitude);
|
||||
double flongitude = toDecimalCoordinate(longitude);
|
||||
|
||||
// glitch filter
|
||||
if ( glitchFilter.isGlitch(flatitude, flongitude) ) {
|
||||
qDebug() << "filterGePoints(): GPS glitch detected at" << i << flatitude << flongitude;
|
||||
// qDebug() << "filterGePoints(): GPS glitch detected at" << i << flatitude << flongitude;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -275,42 +262,39 @@ QList<QStringList> logsDialog::filterGePoints(const QList<QStringList> & input)
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "filterGePoints(): filtered from" << input.count() << "to " << result.count() << "points";
|
||||
// qDebug() << "filterGePoints(): filtered from" << input.count() << "to " << result.count() << "points";
|
||||
return result;
|
||||
}
|
||||
|
||||
void logsDialog::exportToGoogleEarth()
|
||||
void LogsDialog::exportToGoogleEarth()
|
||||
{
|
||||
// filter data points
|
||||
QList<QStringList> dataPoints = filterGePoints(csvlog);
|
||||
int n = dataPoints.count(); // number of points to export
|
||||
if (n==0) return;
|
||||
|
||||
int latcol=0, longcol=0, altcol=0, speedcol=0;
|
||||
int gpscol=0, altcol=0, speedcol=0;
|
||||
QSet<int> nondataCols;
|
||||
for (int i=1; i<dataPoints.at(0).count(); i++) {
|
||||
//Long,Lat,Course,GPS Speed,GPS Alt
|
||||
if (dataPoints.at(0).at(i).contains("Long")) {
|
||||
longcol=i;
|
||||
// Long,Lat,Course,GPS Speed,GPS Alt
|
||||
if (dataPoints.at(0).at(i) == "GPS") {
|
||||
gpscol=i;
|
||||
}
|
||||
if (dataPoints.at(0).at(i).contains("GAlt")) {
|
||||
altcol = i;
|
||||
nondataCols << i;
|
||||
}
|
||||
if (dataPoints.at(0).at(i).contains("Lat")) {
|
||||
latcol=i;
|
||||
nondataCols << i;
|
||||
}
|
||||
if (dataPoints.at(0).at(i).contains("GPS Alt")) {
|
||||
altcol=i;
|
||||
nondataCols << i;
|
||||
}
|
||||
if (dataPoints.at(0).at(i).contains("GPS Speed")) {
|
||||
speedcol=i;
|
||||
if (dataPoints.at(0).at(i).contains("GSpd")) {
|
||||
speedcol = i;
|
||||
nondataCols << i;
|
||||
}
|
||||
}
|
||||
if (longcol==0 || latcol==0 || altcol==0) {
|
||||
|
||||
if (gpscol==0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// qDebug() << "gpscol" << gpscol << "altcol" << altcol << "speedcol" << speedcol;
|
||||
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
|
||||
if (QFile::exists(geIconFilename)) {
|
||||
QFile::remove(geIconFilename);
|
||||
@@ -375,22 +359,26 @@ void logsDialog::exportToGoogleEarth()
|
||||
|
||||
// coordinate data points
|
||||
for (int i=1; i<n; i++) {
|
||||
QString latitude=dataPoints.at(i).at(latcol).trimmed();
|
||||
QString longitude=dataPoints.at(i).at(longcol).trimmed();
|
||||
QStringList latlon = extractLatLon(dataPoints.at(i).at(gpscol));
|
||||
QString latitude = latlon[0];
|
||||
QString longitude = latlon[1];
|
||||
int altitude = altcol ? dataPoints.at(i).at(altcol).toFloat() : 0;
|
||||
latitude.sprintf("%3.8f", toDecimalCoordinate(latitude));
|
||||
longitude.sprintf("%3.8f", toDecimalCoordinate(longitude));
|
||||
outputStream << "\t\t\t\t\t<gx:coord>" << longitude << " " << latitude << " " << dataPoints.at(i).at(altcol).toFloat() << " </gx:coord>\n" ;
|
||||
outputStream << "\t\t\t\t\t<gx:coord>" << longitude << " " << latitude << " " << altitude << " </gx:coord>\n" ;
|
||||
}
|
||||
|
||||
// additional data for data points
|
||||
outputStream << "\t\t\t\t\t<ExtendedData>\n\t\t\t\t\t\t<SchemaData schemaUrl=\"#schema\">\n";
|
||||
|
||||
// gps speed data points
|
||||
outputStream << "\t\t\t\t\t\t\t<gx:SimpleArrayData name=\"GPSSpeed\">\n";
|
||||
for (int i=1; i<n; i++) {
|
||||
outputStream << "\t\t\t\t\t\t\t\t<gx:value>"<< dataPoints.at(i).at(speedcol) <<"</gx:value>\n";
|
||||
if (speedcol) {
|
||||
// gps speed data points
|
||||
outputStream << "\t\t\t\t\t\t\t<gx:SimpleArrayData name=\"GPSSpeed\">\n";
|
||||
for (int i=1; i<n; i++) {
|
||||
outputStream << "\t\t\t\t\t\t\t\t<gx:value>"<< dataPoints.at(i).at(speedcol) <<"</gx:value>\n";
|
||||
}
|
||||
outputStream << "\t\t\t\t\t\t\t</gx:SimpleArrayData>\n";
|
||||
}
|
||||
outputStream << "\t\t\t\t\t\t\t</gx:SimpleArrayData>\n";
|
||||
|
||||
// add values for additional fields
|
||||
for (int i=0; i<dataPoints.at(0).count()-2; i++) {
|
||||
@@ -420,7 +408,7 @@ void logsDialog::exportToGoogleEarth()
|
||||
process->start(gePath, parameters);
|
||||
}
|
||||
|
||||
void logsDialog::on_mapsButton_clicked()
|
||||
void LogsDialog::on_mapsButton_clicked()
|
||||
{
|
||||
ui->FieldsTW->setDisabled(true);
|
||||
ui->logTable->setDisabled(true);
|
||||
@@ -431,7 +419,7 @@ void logsDialog::on_mapsButton_clicked()
|
||||
ui->logTable->setDisabled(false);
|
||||
}
|
||||
|
||||
void logsDialog::mousePress()
|
||||
void LogsDialog::mousePress()
|
||||
{
|
||||
// if an axis is selected, only allow the direction of that axis to be dragged
|
||||
// if no axis is selected, both directions may be dragged
|
||||
@@ -444,7 +432,7 @@ void logsDialog::mousePress()
|
||||
axisRect->setRangeDrag(Qt::Horizontal | Qt::Vertical);
|
||||
}
|
||||
|
||||
void logsDialog::mouseWheel()
|
||||
void LogsDialog::mouseWheel()
|
||||
{
|
||||
// if an axis is selected, only allow the direction of that axis to be zoomed
|
||||
// if no axis is selected, both directions may be zoomed
|
||||
@@ -462,7 +450,7 @@ void logsDialog::mouseWheel()
|
||||
}
|
||||
}
|
||||
|
||||
void logsDialog::removeAllGraphs()
|
||||
void LogsDialog::removeAllGraphs()
|
||||
{
|
||||
ui->customPlot->clearGraphs();
|
||||
ui->customPlot->legend->setVisible(false);
|
||||
@@ -480,12 +468,11 @@ void logsDialog::removeAllGraphs()
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
|
||||
void logsDialog::on_fileOpen_BT_clicked()
|
||||
void LogsDialog::on_fileOpen_BT_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Select your log file"), g.logDir());
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select your log file"), g.logDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
|
||||
g.logDir( fileName );
|
||||
g.logDir(fileName);
|
||||
ui->FileName_LE->setText(fileName);
|
||||
if (cvsFileParse()) {
|
||||
ui->FieldsTW->clear();
|
||||
@@ -525,15 +512,16 @@ void logsDialog::on_fileOpen_BT_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
bool logsDialog::cvsFileParse()
|
||||
bool LogsDialog::cvsFileParse()
|
||||
{
|
||||
QFile file(ui->FileName_LE->text());
|
||||
int errors=0;
|
||||
int lines=-1;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
csvlog.clear();
|
||||
logFilename.clear();
|
||||
QTextStream inputStream(&file);
|
||||
@@ -541,7 +529,8 @@ bool logsDialog::cvsFileParse()
|
||||
|
||||
if (buffer.startsWith("Date,Time")) {
|
||||
file.reset();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -554,29 +543,30 @@ bool logsDialog::cvsFileParse()
|
||||
}
|
||||
if (columns.count()==numfields) {
|
||||
csvlog.append(columns);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
errors++;
|
||||
}
|
||||
lines++;
|
||||
}
|
||||
|
||||
logFilename=QFileInfo(file.fileName()).baseName();
|
||||
logFilename = QFileInfo(file.fileName()).baseName();
|
||||
}
|
||||
|
||||
file.close();
|
||||
if (errors>1) {
|
||||
if (errors > 1) {
|
||||
QMessageBox::warning(this, "Companion", tr("The selected logfile contains %1 invalid lines out of %2 total lines").arg(errors).arg(lines));
|
||||
}
|
||||
|
||||
int n=csvlog.count();
|
||||
if (n==1) {
|
||||
int n = csvlog.count();
|
||||
if (n == 1) {
|
||||
csvlog.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
plotLock = true;
|
||||
setFlightSessions();
|
||||
plotLock=false;
|
||||
plotLock = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -586,7 +576,7 @@ struct FlightSession {
|
||||
QDateTime end;
|
||||
};
|
||||
|
||||
QDateTime logsDialog::getRecordTimeStamp(int index)
|
||||
QDateTime LogsDialog::getRecordTimeStamp(int index)
|
||||
{
|
||||
QString tstamp = csvlog.at(index).at(0) + " " + csvlog.at(index).at(1);
|
||||
if (csvlog.at(index).at(1).contains("."))
|
||||
@@ -594,7 +584,7 @@ QDateTime logsDialog::getRecordTimeStamp(int index)
|
||||
return QDateTime::fromString(tstamp, "yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
QString logsDialog::generateDuration(const QDateTime & start, const QDateTime & end)
|
||||
QString LogsDialog::generateDuration(const QDateTime & start, const QDateTime & end)
|
||||
{
|
||||
int secs = start.secsTo(end);
|
||||
QString durationString;
|
||||
@@ -606,11 +596,11 @@ QString logsDialog::generateDuration(const QDateTime & start, const QDateTime &
|
||||
return durationString;
|
||||
}
|
||||
|
||||
void logsDialog::setFlightSessions()
|
||||
void LogsDialog::setFlightSessions()
|
||||
{
|
||||
ui->sessions_CB->clear();
|
||||
|
||||
int n=csvlog.count();
|
||||
int n = csvlog.count();
|
||||
// qDebug() << "records" << n;
|
||||
|
||||
// find session breaks
|
||||
@@ -646,7 +636,7 @@ void logsDialog::setFlightSessions()
|
||||
}
|
||||
}
|
||||
|
||||
void logsDialog::on_sessions_CB_currentIndexChanged(int index)
|
||||
void LogsDialog::on_sessions_CB_currentIndexChanged(int index)
|
||||
{
|
||||
if (plotLock) return;
|
||||
plotLock = true;
|
||||
@@ -674,7 +664,7 @@ void logsDialog::on_sessions_CB_currentIndexChanged(int index)
|
||||
plotLogs();
|
||||
}
|
||||
|
||||
void logsDialog::plotLogs()
|
||||
void LogsDialog::plotLogs()
|
||||
{
|
||||
if (plotLock) return;
|
||||
|
||||
@@ -920,7 +910,7 @@ void logsDialog::plotLogs()
|
||||
ui->customPlot->replot();
|
||||
}
|
||||
|
||||
void logsDialog::yAxisChangeRanges(QCPRange range)
|
||||
void LogsDialog::yAxisChangeRanges(QCPRange range)
|
||||
{
|
||||
if (axisRect->axis(QCPAxis::atRight)->visible()) {
|
||||
double lowerChange = (range.lower - yAxesRanges[firstLeft].min) *
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LOGSDIALOG_H
|
||||
#define LOGSDIALOG_H
|
||||
#ifndef _LOGSDIALOG_H_
|
||||
#define _LOGSDIALOG_H_
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -37,16 +37,16 @@ struct plotsCollection {
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class logsDialog;
|
||||
class LogsDialog;
|
||||
}
|
||||
|
||||
class logsDialog : public QDialog
|
||||
class LogsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit logsDialog(QWidget *parent = 0);
|
||||
~logsDialog();
|
||||
explicit LogsDialog(QWidget *parent = 0);
|
||||
~LogsDialog();
|
||||
|
||||
private slots:
|
||||
void titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title);
|
||||
@@ -64,7 +64,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QList<QStringList> csvlog;
|
||||
Ui::logsDialog *ui;
|
||||
Ui::LogsDialog *ui;
|
||||
QCPAxisRect *axisRect;
|
||||
QCPLegend *rightLegend;
|
||||
bool plotLock;
|
||||
@@ -85,4 +85,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // LOGSDIALOG_H
|
||||
#endif // _LOGSDIALOG_H_
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>logsDialog</class>
|
||||
<widget class="QDialog" name="logsDialog">
|
||||
<class>LogsDialog</class>
|
||||
<widget class="QDialog" name="LogsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
||||
+122
-116
@@ -70,15 +70,16 @@
|
||||
#include "radiointerface.h"
|
||||
#include "progressdialog.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/companion"
|
||||
#define OPENTX_NIGHT_COMPANION_DOWNLOADS "http://downloads-21.open-tx.org/nightly/companion"
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-macosx.stamp"
|
||||
#define C9X_INSTALLER "/companion-macosx-%1.dmg"
|
||||
#define COMPANION_STAMP "companion-macosx.stamp"
|
||||
#define COMPANION_INSTALLER "companion-macosx-%1.dmg"
|
||||
#else
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-windows.stamp"
|
||||
#define C9X_INSTALLER "/companion-windows-%1.exe"
|
||||
#define COMPANION_STAMP "companion-windows.stamp"
|
||||
#define COMPANION_INSTALLER "companion-windows-%1.exe"
|
||||
#endif
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
@@ -114,16 +115,15 @@ MainWindow::MainWindow():
|
||||
this->setIconSize(QSize(32, 32));
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
setAcceptDrops(true);
|
||||
|
||||
|
||||
// give time to the splash to disappear and main window to open before starting updates
|
||||
int updateDelay = 1000;
|
||||
bool showSplash = g.showSplash();
|
||||
if (showSplash) {
|
||||
updateDelay += (SPLASH_TIME*1000);
|
||||
updateDelay += (SPLASH_TIME*1000);
|
||||
}
|
||||
QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
|
||||
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
|
||||
updateSdsyncAction();
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
QString str;
|
||||
@@ -158,13 +158,13 @@ MainWindow::MainWindow():
|
||||
child->show();
|
||||
}
|
||||
else {
|
||||
child->show();
|
||||
child->show();
|
||||
child->print(model,printfilename);
|
||||
child->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (printing) {
|
||||
QTimer::singleShot(0, this, SLOT(autoClose()));
|
||||
}
|
||||
@@ -185,7 +185,7 @@ void MainWindow::displayWarnings()
|
||||
}
|
||||
}
|
||||
else if (warnId==0) {
|
||||
g.warningId(WARNING_ID);
|
||||
g.warningId(WARNING_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,15 @@ void MainWindow::dowloadLastFirmwareUpdate()
|
||||
checkForUpdates();
|
||||
}
|
||||
|
||||
QString MainWindow::getCompanionUpdateBaseUrl()
|
||||
{
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
return g.useCompanionNightlyBuilds() ? OPENTX_NIGHT_COMPANION_DOWNLOADS : OPENTX_COMPANION_DOWNLOADS;
|
||||
#else
|
||||
return OPENTX_COMPANION_DOWNLOADS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::checkForUpdates()
|
||||
{
|
||||
if (checkForUpdatesState & SHOW_DIALOG_WAIT) {
|
||||
@@ -229,7 +238,7 @@ void MainWindow::checkForUpdates()
|
||||
// TODO why create each time a network manager?
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*)));
|
||||
QNetworkRequest request(QUrl(C9X_STAMP));
|
||||
QNetworkRequest request(QUrl(QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(COMPANION_STAMP)));
|
||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||
networkManager->get(request);
|
||||
}
|
||||
@@ -283,20 +292,17 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
int c9xver = version2index(c9xversion);
|
||||
|
||||
if (c9xver < vnum) {
|
||||
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
|
||||
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
|
||||
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
|
||||
"Would you like to download it?").arg(version) ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (ret == QMessageBox::Yes) {
|
||||
#if defined __APPLE__
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version));
|
||||
#else
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(C9X_INSTALLER).arg(version), tr("Executable (*.exe)"));
|
||||
#endif
|
||||
QDir dir(g.updatesDir());
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), dir.absoluteFilePath(QString(COMPANION_INSTALLER).arg(version)), tr("Executable (*.exe)"));
|
||||
if (!fileName.isEmpty()) {
|
||||
g.updatesDir(QFileInfo(fileName).dir().absolutePath());
|
||||
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
|
||||
downloadDialog * dd = new downloadDialog(this, QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
|
||||
installer_fileName = fileName;
|
||||
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
|
||||
dd->exec();
|
||||
@@ -304,7 +310,7 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
}
|
||||
#else
|
||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (downloadDialog_forWait && checkForUpdatesState==0) {
|
||||
@@ -406,6 +412,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||
QString currentVersionString = index2version(currentVersion);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Companion");
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QGridLayout * layout = (QGridLayout*)msgBox.layout();
|
||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||
@@ -413,8 +420,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||
if (currentVersion == 0) {
|
||||
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
|
||||
QAbstractButton *rnButton = NULL;
|
||||
msgBox.setWindowTitle("Companion");
|
||||
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(versionString));
|
||||
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(versionString));
|
||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
||||
if (!rn.isEmpty()) {
|
||||
@@ -442,8 +448,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||
else if (version > currentVersion) {
|
||||
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
|
||||
QAbstractButton *rnButton = NULL;
|
||||
msgBox.setText("Companion");
|
||||
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
|
||||
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
|
||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
|
||||
if (!rn.isEmpty()) {
|
||||
@@ -453,8 +458,8 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||
msgBox.resize(0,0);
|
||||
msgBox.exec();
|
||||
if( msgBox.clickedButton() == rnButton ) {
|
||||
ContributorsDialog *cd = new ContributorsDialog(this); // , 2, rn);
|
||||
cd->exec();
|
||||
ReleaseNotesFirmwareDialog * dialog = new ReleaseNotesFirmwareDialog(this, rn);
|
||||
dialog->exec();
|
||||
int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(versionString),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret2 == QMessageBox::Yes) {
|
||||
@@ -530,37 +535,22 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setLanguage(QString langString)
|
||||
{
|
||||
g.locale( langString );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The selected language will be used the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
void MainWindow::setLanguage(const QString & langString)
|
||||
{
|
||||
g.locale(langString);
|
||||
QMessageBox::information(this, tr("Companion"), tr("The selected language will be used the next time you start Companion."));
|
||||
}
|
||||
|
||||
void MainWindow::setTheme(int index)
|
||||
{
|
||||
g.theme( index );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The new theme will be loaded the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
{
|
||||
g.theme(index);
|
||||
QMessageBox::information(this, tr("Companion"), tr("The new theme will be loaded the next time you start Companion."));
|
||||
}
|
||||
|
||||
void MainWindow::setIconThemeSize(int index)
|
||||
{
|
||||
g.iconSize( index );
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The icon size will be used the next time you start Companion."));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
{
|
||||
g.iconSize(index);
|
||||
QMessageBox::information(this, tr("Companion"), tr("The icon size will be used the next time you start Companion."));
|
||||
}
|
||||
|
||||
void MainWindow::newFile()
|
||||
@@ -674,41 +664,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()
|
||||
@@ -764,7 +760,7 @@ void MainWindow::readEeprom()
|
||||
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
|
||||
if (IS_ARM(eepromInterface->getBoard()))
|
||||
if (IS_ARM(eepromInterface->getBoard()))
|
||||
tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
else
|
||||
tempFile += generateProcessUniqueTempFileName("temp.hex");
|
||||
@@ -783,25 +779,41 @@ void MainWindow::readEeprom()
|
||||
bool MainWindow::readFirmwareFromRadio(const QString &filename)
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Read Firmware from Radio"), CompanionIcon("read_flash.png"));
|
||||
return readFirmware(filename, progressDialog.progress());
|
||||
bool result = readFirmware(filename, progressDialog.progress());
|
||||
if (!result) {
|
||||
progressDialog.exec();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MainWindow::writeFirmwareToRadio(const QString &filename)
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Write Firmware to Radio"), CompanionIcon("write_flash.png"));
|
||||
return writeFirmware(filename, progressDialog.progress());
|
||||
bool result = writeFirmware(filename, progressDialog.progress());
|
||||
if (!result) {
|
||||
progressDialog.exec();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MainWindow::readEepromFromRadio(const QString &filename)
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Read Models and Settings from Radio"), CompanionIcon("read_eeprom.png"));
|
||||
return ::readEeprom(filename, progressDialog.progress());
|
||||
bool result = ::readEeprom(filename, progressDialog.progress());
|
||||
if (!result) {
|
||||
progressDialog.exec();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MainWindow::writeEepromToRadio(const QString &filename)
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Write Models and Settings to Radio"), CompanionIcon("write_eeprom.png"));
|
||||
return ::writeEeprom(filename, progressDialog.progress());
|
||||
bool result = ::writeEeprom(filename, progressDialog.progress());
|
||||
if (!result) {
|
||||
progressDialog.exec();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MainWindow::writeBackup()
|
||||
@@ -872,7 +884,7 @@ void MainWindow::compare()
|
||||
|
||||
void MainWindow::logFile()
|
||||
{
|
||||
logsDialog *fd = new logsDialog(this);
|
||||
LogsDialog *fd = new LogsDialog(this);
|
||||
fd->setWindowFlags(Qt::Window); //to show minimize an maximize buttons
|
||||
fd->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
fd->show();
|
||||
@@ -897,12 +909,6 @@ void MainWindow::about()
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MainWindow::updateSdsyncAction()
|
||||
{
|
||||
QTimer::singleShot(1000, this, SLOT(updateSdsyncAction()));
|
||||
sdsyncAct->setEnabled(!findMassstoragePath("SOUNDS").isEmpty());
|
||||
}
|
||||
|
||||
void MainWindow::updateMenus()
|
||||
{
|
||||
bool hasMdiChild = (activeMdiChild() != 0);
|
||||
@@ -911,7 +917,7 @@ void MainWindow::updateMenus()
|
||||
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
|
||||
writeEepromAct->setEnabled(hasMdiChild);
|
||||
separatorAct->setVisible(hasMdiChild);
|
||||
|
||||
|
||||
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
|
||||
cutAct->setEnabled(hasSelection);
|
||||
copyAct->setEnabled(hasSelection);
|
||||
@@ -924,7 +930,7 @@ void MainWindow::updateMenus()
|
||||
updateLanguageActions();
|
||||
updateIconSizeActions();
|
||||
updateIconThemeActions();
|
||||
setWindowTitle(tr("OpenTX Companion 2.1 - FW: %1 - Profile: %2").arg(GetCurrentFirmware()->getName()).arg( g.profile[g.id()].name() ));
|
||||
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(C9X_VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
|
||||
}
|
||||
|
||||
MdiChild *MainWindow::createMdiChild()
|
||||
@@ -953,7 +959,7 @@ QAction * MainWindow::addAct(const QString & icon, const QString & sName, const
|
||||
QAction * newAction = new QAction( this );
|
||||
if (!icon.isEmpty())
|
||||
newAction->setIcon(CompanionIcon(icon));
|
||||
if (!sName.isEmpty())
|
||||
if (!sName.isEmpty())
|
||||
newAction->setText(sName);
|
||||
if (!lName.isEmpty())
|
||||
newAction->setStatusTip(lName);
|
||||
@@ -974,7 +980,7 @@ QAction * MainWindow::addAct(QActionGroup *aGroup, const QString & sName, const
|
||||
{
|
||||
QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot);
|
||||
action->setCheckable(true);
|
||||
aGroup->addAction(action);
|
||||
aGroup->addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
@@ -1008,7 +1014,7 @@ void MainWindow::createActions()
|
||||
cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut()));
|
||||
copyAct = addAct("copy.png", tr("Copy Model"), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy()));
|
||||
pasteAct = addAct("paste.png", tr("Paste Model"), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste()));
|
||||
|
||||
|
||||
QActionGroup *themeAlignGroup = new QActionGroup(this);
|
||||
classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classic companion9x icon theme"), SLOT(setClassicTheme()));
|
||||
yericoThemeAct = addAct( themeAlignGroup, tr("Yerico"), tr("Yellow round honey sweet icon theme"), SLOT(setYericoTheme()));
|
||||
@@ -1063,7 +1069,7 @@ void MainWindow::createActions()
|
||||
readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup()));
|
||||
contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors()));
|
||||
sdsyncAct = addAct("sdsync.png", tr("Synchronize SD"), tr("SD card synchronization"), SLOT(sdsync()));
|
||||
|
||||
|
||||
compareAct->setEnabled(false);
|
||||
simulateAct->setEnabled(false);
|
||||
printAct->setEnabled(false);
|
||||
@@ -1109,8 +1115,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);
|
||||
@@ -1147,7 +1153,7 @@ void MainWindow::createMenus()
|
||||
burnMenu->addSeparator();
|
||||
burnMenu->addSeparator();
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (!IS_ARM(eepromInterface->getBoard())) {
|
||||
if (!IS_ARM(eepromInterface->getBoard())) {
|
||||
burnMenu->addAction(burnFusesAct);
|
||||
burnMenu->addAction(burnListAct);
|
||||
}
|
||||
@@ -1164,7 +1170,7 @@ void MainWindow::createMenus()
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(contributorsAct);
|
||||
}
|
||||
|
||||
|
||||
QMenu *MainWindow::createRecentFileMenu()
|
||||
{
|
||||
QMenu *recentFileMenu = new QMenu(this);
|
||||
@@ -1205,7 +1211,7 @@ void MainWindow::createToolBars()
|
||||
break;
|
||||
default:
|
||||
size=QSize(24,24);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
fileToolBar = addToolBar(tr("File"));
|
||||
fileToolBar->setIconSize(size);
|
||||
@@ -1251,7 +1257,7 @@ void MainWindow::createToolBars()
|
||||
editToolBar->addAction(cutAct);
|
||||
editToolBar->addAction(copyAct);
|
||||
editToolBar->addAction(pasteAct);
|
||||
|
||||
|
||||
burnToolBar = new QToolBar(tr("Write"));
|
||||
addToolBar( Qt::LeftToolBarArea, burnToolBar );
|
||||
burnToolBar->setIconSize(size);
|
||||
@@ -1308,7 +1314,7 @@ void MainWindow::setActiveSubWindow(QWidget *window)
|
||||
void MainWindow::updateRecentFileActions()
|
||||
{
|
||||
int i, numRecentFiles;
|
||||
|
||||
|
||||
// Hide all document slots
|
||||
for ( i=0 ; i < g.historySize(); i++)
|
||||
recentFileActs[i]->setVisible(false);
|
||||
@@ -1316,7 +1322,7 @@ void MainWindow::updateRecentFileActions()
|
||||
// Fill slots with content and unhide them
|
||||
QStringList files = g.recentFiles();
|
||||
numRecentFiles = qMin(files.size(), g.historySize());
|
||||
|
||||
|
||||
for ( i = 0; i < numRecentFiles; i++) {
|
||||
QString text = strippedName(files[i]);
|
||||
if (!text.trimmed().isEmpty())
|
||||
@@ -1343,34 +1349,34 @@ void MainWindow::updateLanguageActions()
|
||||
{
|
||||
QString langId = g.locale();
|
||||
|
||||
if (langId=="")
|
||||
if (langId=="")
|
||||
sysLangAct->setChecked(true);
|
||||
else if (langId=="cs_CZ")
|
||||
else if (langId=="cs_CZ")
|
||||
czechLangAct->setChecked(true);
|
||||
else if (langId=="de_DE")
|
||||
else if (langId=="de_DE")
|
||||
germanLangAct->setChecked(true);
|
||||
else if (langId=="en")
|
||||
else if (langId=="en")
|
||||
englishLangAct->setChecked(true);
|
||||
else if (langId=="fi_FI")
|
||||
else if (langId=="fi_FI")
|
||||
finnishLangAct->setChecked(true);
|
||||
else if (langId=="fr_FR")
|
||||
else if (langId=="fr_FR")
|
||||
frenchLangAct->setChecked(true);
|
||||
else if (langId=="it_IT")
|
||||
else if (langId=="it_IT")
|
||||
italianLangAct->setChecked(true);
|
||||
else if (langId=="he_IL")
|
||||
hebrewLangAct->setChecked(true);
|
||||
else if (langId=="pl_PL")
|
||||
// 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")
|
||||
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()
|
||||
@@ -1387,9 +1393,9 @@ void MainWindow::updateIconThemeActions()
|
||||
|
||||
void MainWindow::updateProfilesActions()
|
||||
{
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
{
|
||||
if (g.profile[i].existsOnDisk())
|
||||
if (g.profile[i].existsOnDisk())
|
||||
{
|
||||
QString text = tr("%2").arg(g.profile[i].name());
|
||||
profileActs[i]->setText(text);
|
||||
@@ -1397,8 +1403,8 @@ void MainWindow::updateProfilesActions()
|
||||
profileActs[i]->setVisible(true);
|
||||
if (i == g.id())
|
||||
profileActs[i]->setChecked(true);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
profileActs[i]->setVisible(false);
|
||||
}
|
||||
@@ -1412,7 +1418,7 @@ void MainWindow::createProfile()
|
||||
;
|
||||
if (i==MAX_PROFILES) //Failed to find free slot
|
||||
return;
|
||||
|
||||
|
||||
// Copy current profile to new and give it a new name
|
||||
g.profile[i] = g.profile[g.id()];
|
||||
g.profile[i].name(tr("New Radio"));
|
||||
|
||||
+24
-22
@@ -76,30 +76,31 @@ class MainWindow : public QMainWindow
|
||||
MainWindow();
|
||||
|
||||
protected:
|
||||
QString getCompanionUpdateBaseUrl();
|
||||
void dowloadLastFirmwareUpdate();
|
||||
void startFirmwareDownload();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void setLanguage(const QString & langString);
|
||||
|
||||
private slots:
|
||||
void openDocURL();
|
||||
|
||||
void setLanguage(QString langString);
|
||||
void setSysLanguage() {setLanguage("");};
|
||||
void setCZLanguage() {setLanguage("cs_CZ");};
|
||||
void setDELanguage() {setLanguage("de_DE");};
|
||||
void setENLanguage() {setLanguage("en");};
|
||||
void setFILanguage() {setLanguage("fi_FI");};
|
||||
void setFRLanguage() {setLanguage("fr_FR");};
|
||||
void setITLanguage() {setLanguage("it_IT");};
|
||||
void setHELanguage() {setLanguage("he_IL");};
|
||||
void setPLLanguage() {setLanguage("pl_PL");};
|
||||
void setESLanguage() {setLanguage("es_ES");};
|
||||
void setPTLanguage() {setLanguage("pt_PT");};
|
||||
void setRULanguage() {setLanguage("ru_RU");};
|
||||
void setSELanguage() {setLanguage("sv_SE");};
|
||||
void setNLLanguage() {setLanguage("nl_NL");};
|
||||
void setSysLanguage() { setLanguage(""); };
|
||||
void setCZLanguage() { setLanguage("cs_CZ"); };
|
||||
void setDELanguage() { setLanguage("de_DE"); };
|
||||
void setENLanguage() { setLanguage("en"); };
|
||||
void setFILanguage() { setLanguage("fi_FI"); };
|
||||
void setFRLanguage() { setLanguage("fr_FR"); };
|
||||
void setITLanguage() { setLanguage("it_IT"); };
|
||||
void setHELanguage() { setLanguage("he_IL"); };
|
||||
void setPLLanguage() { setLanguage("pl_PL"); };
|
||||
void setESLanguage() { setLanguage("es_ES"); };
|
||||
void setPTLanguage() { setLanguage("pt_PT"); };
|
||||
void setRULanguage() { setLanguage("ru_RU"); };
|
||||
void setSELanguage() { setLanguage("sv_SE"); };
|
||||
void setNLLanguage() { setLanguage("nl_NL"); };
|
||||
|
||||
void setTheme(int index);
|
||||
void setClassicTheme() {setTheme(0);};
|
||||
@@ -156,7 +157,6 @@ class MainWindow : public QMainWindow
|
||||
void loadBackup();
|
||||
void appPrefs();
|
||||
void fwPrefs();
|
||||
void updateSdsyncAction();
|
||||
void updateMenus();
|
||||
void createProfile();
|
||||
MdiChild *createMdiChild();
|
||||
@@ -262,20 +262,22 @@ class MainWindow : public QMainWindow
|
||||
QAction *normalIconAct;
|
||||
QAction *bigIconAct;
|
||||
QAction *hugeIconAct;
|
||||
|
||||
QAction *sysLangAct;
|
||||
QAction *englishLangAct;
|
||||
QAction *czechLangAct;
|
||||
QAction *germanLangAct;
|
||||
QAction *frenchLangAct;
|
||||
QAction *englishLangAct;
|
||||
QAction *finnishLangAct;
|
||||
QAction *frenchLangAct;
|
||||
QAction *italianLangAct;
|
||||
QAction *hebrewLangAct;
|
||||
// QAction *hebrewLangAct;
|
||||
QAction *polishLangAct;
|
||||
// QAction *portugueseLangAct;
|
||||
QAction *spanishLangAct;
|
||||
QAction *portugueseLangAct;
|
||||
QAction *swedishLangAct;
|
||||
QAction *russianLangAct;
|
||||
QAction *dutchLangAct;
|
||||
// QAction *russianLangAct;
|
||||
// QAction *dutchLangAct;
|
||||
|
||||
QAction *openDocURLAct;
|
||||
};
|
||||
|
||||
|
||||
+131
-109
@@ -81,7 +81,7 @@ MdiChild::MdiChild():
|
||||
}
|
||||
}
|
||||
|
||||
MdiChild::~MdiChild()
|
||||
MdiChild::~MdiChild()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -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,26 +170,31 @@ void MdiChild::generalEdit()
|
||||
|
||||
void MdiChild::modelEdit()
|
||||
{
|
||||
int row = ui->modelsList->currentRow();
|
||||
int row = getCurrentRow();
|
||||
|
||||
if (row == 0){
|
||||
generalEdit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
checkAndInitModel( row );
|
||||
ModelData &model = radioData.models[row - 1];
|
||||
gStopwatch.restart();
|
||||
gStopwatch.report("ModelEdit creation");
|
||||
ModelEdit *t = new ModelEdit(this, radioData, (row - 1), GetCurrentFirmware()/*firmware*/);
|
||||
gStopwatch.report("ModelEdit created");
|
||||
t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name);
|
||||
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
|
||||
gStopwatch.report("STARTING MODEL EDIT");
|
||||
t->show();
|
||||
QApplication::restoreOverrideCursor();
|
||||
gStopwatch.report("ModelEdit shown");
|
||||
}
|
||||
}
|
||||
|
||||
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 +208,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 {
|
||||
@@ -251,7 +256,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
XmlInterface(inputStream).load(radioData);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
@@ -260,18 +265,19 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
.arg(file.errorString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QDomDocument doc(ER9X_EEPROM_FILE_TYPE);
|
||||
bool xmlOK = doc.setContent(&file);
|
||||
if(xmlOK) {
|
||||
if (loadEEpromXml(radioData, doc)){
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(radioData, doc));
|
||||
if (errors.test(NO_ERROR)) {
|
||||
ui->modelsList->refreshList();
|
||||
if(resetCurrentFile) setCurrentFile(fileName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
file.reset();
|
||||
|
||||
|
||||
QTextStream inputStream(&file);
|
||||
|
||||
if (fileType==FILE_TYPE_EEPE) { // read EEPE file header
|
||||
@@ -282,8 +288,8 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t eeprom[EESIZE_RLC_MAX];
|
||||
int eeprom_size = HexInterface(inputStream).load(eeprom, EESIZE_RLC_MAX);
|
||||
QByteArray eeprom(EESIZE_MAX, 0);
|
||||
int eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_MAX);
|
||||
if (!eeprom_size) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Invalid EEPROM File %1")
|
||||
@@ -294,12 +300,14 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
|
||||
file.close();
|
||||
|
||||
if (!loadEEprom(radioData, eeprom, eeprom_size)) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Invalid EEPROM File %1")
|
||||
.arg(fileName));
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(radioData, (uint8_t *)eeprom.data(), eeprom_size));
|
||||
if (!errors.test(NO_ERROR)) {
|
||||
ShowEepromErrors(this, tr("Error"), tr("Invalid EEPROM File %1").arg(fileName), errors.to_ulong());
|
||||
return false;
|
||||
}
|
||||
if (errors.test(HAS_WARNINGS)) {
|
||||
ShowEepromWarnings(this, tr("Warning"), errors.to_ulong());
|
||||
}
|
||||
|
||||
ui->modelsList->refreshList();
|
||||
if(resetCurrentFile) setCurrentFile(fileName);
|
||||
@@ -330,11 +338,18 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!loadEEprom(radioData, eeprom, eeprom_size) && !::loadBackup(radioData, eeprom, eeprom_size, 0)) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Invalid binary EEPROM File %1")
|
||||
.arg(fileName));
|
||||
return false;
|
||||
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size));
|
||||
if (!errorsEeprom.test(NO_ERROR)) {
|
||||
std::bitset<NUM_ERRORS> errorsBackup((unsigned long long)LoadBackup(radioData, eeprom, eeprom_size, 0));
|
||||
if (!errorsBackup.test(NO_ERROR)) {
|
||||
ShowEepromErrors(this, tr("Error"), tr("Invalid binary EEPROM File %1").arg(fileName), (errorsEeprom | errorsBackup).to_ulong());
|
||||
return false;
|
||||
}
|
||||
if (errorsBackup.test(HAS_WARNINGS)) {
|
||||
ShowEepromWarnings(this, tr("Warning"), errorsBackup.to_ulong());
|
||||
}
|
||||
} else if (errorsEeprom.test(HAS_WARNINGS)) {
|
||||
ShowEepromWarnings(this, tr("Warning"), errorsEeprom.to_ulong());
|
||||
}
|
||||
|
||||
ui->modelsList->refreshList();
|
||||
@@ -367,7 +382,7 @@ bool MdiChild::saveAs(bool isNew)
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName());
|
||||
#else
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(BIN_FILES_FILTER));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
QFileInfo fi(curFile);
|
||||
@@ -375,45 +390,45 @@ bool MdiChild::saveAs(bool isNew)
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName());
|
||||
#else
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(EEPROM_FILES_FILTER));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
g.eepromDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
if (isNew)
|
||||
return saveFile(fileName);
|
||||
else
|
||||
else
|
||||
return saveFile(fileName,true);
|
||||
}
|
||||
|
||||
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 +440,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()
|
||||
@@ -505,7 +520,7 @@ void MdiChild::setCurrentFile(const QString &fileName)
|
||||
files.prepend(fileName);
|
||||
while (files.size() > MaxRecentFiles)
|
||||
files.removeLast();
|
||||
|
||||
|
||||
g.recentFiles( files );
|
||||
}
|
||||
|
||||
@@ -529,8 +544,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,12 +554,12 @@ 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) {
|
||||
pd->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
pd->show();
|
||||
@@ -561,49 +576,56 @@ 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));
|
||||
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();
|
||||
|
||||
if (result != eeprom_size) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error reading file %1:\n%2.")
|
||||
.arg(fileName)
|
||||
.arg(file.errorString()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index));
|
||||
if (!errorsEeprom.test(NO_ERROR)) {
|
||||
ShowEepromErrors(this, tr("Error"), tr("Invalid binary backup File %1").arg(fileName), (errorsEeprom).to_ulong());
|
||||
return false;
|
||||
}
|
||||
if(ui->modelsList->currentRow()<1) return false;
|
||||
int index=ui->modelsList->currentRow()-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();
|
||||
|
||||
if (result != eeprom_size) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error reading file %1:\n%2.")
|
||||
.arg(fileName)
|
||||
.arg(file.errorString()));
|
||||
|
||||
return false;
|
||||
if (errorsEeprom.test(HAS_WARNINGS)) {
|
||||
ShowEepromWarnings(this, tr("Warning"), errorsEeprom.to_ulong());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
LimitsGroup::LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
firmware(firmware),
|
||||
spinbox(new QDoubleSpinBox()),
|
||||
value(value),
|
||||
@@ -39,14 +39,17 @@ LimitsGroup::LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row,
|
||||
}
|
||||
|
||||
spinbox->setSingleStep(displayStep*internalStep);
|
||||
spinbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||
QCheckBox * gv = new QCheckBox(QObject::tr("GV"));
|
||||
gv->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
horizontalLayout->addWidget(gv);
|
||||
QComboBox * cb = new QComboBox();
|
||||
cb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
horizontalLayout->addWidget(cb);
|
||||
horizontalLayout->addWidget(spinbox);
|
||||
gridLayout->addLayout(horizontalLayout, row, col, 1, 1);
|
||||
tableLayout->addLayout(row, col, horizontalLayout);
|
||||
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
|
||||
}
|
||||
|
||||
@@ -74,55 +77,55 @@ void LimitsGroup::updateMinMax(int max)
|
||||
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
bool minimize = false;
|
||||
Stopwatch s1("Channels");
|
||||
|
||||
int col = 1;
|
||||
if (firmware->getCapability(ChannelsName)) {
|
||||
minimize=true;
|
||||
addLabel(gridLayout, tr("Name"), col++);
|
||||
int channelNameMaxLen = firmware->getCapability(ChannelsName);
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#";
|
||||
if (channelNameMaxLen > 0) {
|
||||
headerLabels << tr("Name");
|
||||
}
|
||||
addLabel(gridLayout, tr("Subtrim"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Min"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Max"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Direction"), col++, minimize);
|
||||
headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction");
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
addLabel(gridLayout, tr("Curve"), col++, minimize);
|
||||
headerLabels << tr("Curve");
|
||||
if (firmware->getCapability(PPMCenter))
|
||||
addLabel(gridLayout, tr("PPM Center"), col++, minimize);
|
||||
headerLabels << tr("PPM Center");
|
||||
if (firmware->getCapability(SYMLimits))
|
||||
addLabel(gridLayout, tr("Linear Subtrim"), col++, true);
|
||||
headerLabels << tr("Linear Subtrim");
|
||||
TableLayout * tableLayout = new TableLayout(this, firmware->getCapability(LogicalSwitches), headerLabels);
|
||||
|
||||
s1.report("header");
|
||||
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
col = 0;
|
||||
int col = 0;
|
||||
|
||||
// Channel label
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(tr("Channel %1").arg(i+1));
|
||||
label->setText(tr("CH%1").arg(i+1));
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
gridLayout->addWidget(label, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, label);
|
||||
|
||||
// Channel name
|
||||
int nameLen = firmware->getCapability(ChannelsName);
|
||||
if (nameLen > 0) {
|
||||
if (channelNameMaxLen > 0) {
|
||||
QLineEdit * name = new QLineEdit(this);
|
||||
name->setProperty("index", i);
|
||||
name->setMaxLength(nameLen);
|
||||
name->setMaxLength(channelNameMaxLen);
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
name->setValidator(new QRegExpValidator(rx, this));
|
||||
name->setText(model.limitData[i].name);
|
||||
connect(name, SIGNAL(editingFinished()), this, SLOT(nameEdited()));
|
||||
gridLayout->addWidget(name, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, name);
|
||||
}
|
||||
|
||||
// Channel offset
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, -1000, 1000, 0);
|
||||
|
||||
// Channel min
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
|
||||
|
||||
// Channel max
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
|
||||
|
||||
// Channel inversion
|
||||
QComboBox * invCB = new QComboBox(this);
|
||||
@@ -130,7 +133,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
invCB->setProperty("index", i);
|
||||
invCB->setCurrentIndex((model.limitData[i].revert) ? 1 : 0);
|
||||
connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited()));
|
||||
gridLayout->addWidget(invCB, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, invCB);
|
||||
|
||||
// Curve
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
@@ -142,7 +145,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
}
|
||||
curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
|
||||
connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
|
||||
gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, curveCB);
|
||||
}
|
||||
|
||||
// PPM center
|
||||
@@ -157,7 +160,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
center->setValue(1500);
|
||||
center->setValue(model.limitData[i].ppmCenter + 1500);
|
||||
connect(center, SIGNAL(editingFinished()), this, SLOT(ppmcenterEdited()));
|
||||
gridLayout->addWidget(center, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, center);
|
||||
}
|
||||
|
||||
// Symetrical limits
|
||||
@@ -166,14 +169,15 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
symlimits->setProperty("index", i);
|
||||
symlimits->setChecked(model.limitData[i].symetrical);
|
||||
connect(symlimits, SIGNAL(toggled(bool)), this, SLOT(symlimitsEdited()));
|
||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, symlimits);
|
||||
}
|
||||
}
|
||||
|
||||
// Push the rows up
|
||||
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
||||
s1.report("add elements");
|
||||
|
||||
disableMouseScrolling();
|
||||
tableLayout->resizeColumnsToContents();
|
||||
tableLayout->pushRowsUp(firmware->getCapability(Outputs)+1);
|
||||
s1.report("end");
|
||||
}
|
||||
|
||||
Channels::~Channels()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef CHANNELS_H
|
||||
#define CHANNELS_H
|
||||
|
||||
#include "helpers.h"
|
||||
#include "modeledit.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
@@ -9,7 +10,7 @@ class GVarGroup;
|
||||
class LimitsGroup
|
||||
{
|
||||
public:
|
||||
LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
~LimitsGroup();
|
||||
|
||||
void updateMinMax(int max);
|
||||
|
||||
@@ -43,8 +43,7 @@ void RepeatComboBox::update()
|
||||
|
||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GenericPanel(parent, model, generalSettings, firmware),
|
||||
functions(model ? model->customFn : generalSettings.customFn),
|
||||
initialized(false)
|
||||
functions(model ? model->customFn : generalSettings.customFn)
|
||||
#if defined(PHONON)
|
||||
,
|
||||
phononCurrent(-1),
|
||||
@@ -52,16 +51,9 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
clickOutput(NULL)
|
||||
#endif
|
||||
{
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
|
||||
addLabel(gridLayout, tr("Switch"), 1);
|
||||
addLabel(gridLayout, tr("Action"), 2);
|
||||
addLabel(gridLayout, tr("Parameters"), 3);
|
||||
addLabel(gridLayout, tr("Enable"), 4, true );
|
||||
addEmptyLabel(gridLayout, 5 );
|
||||
|
||||
Stopwatch s1("CustomFunctionsPanel - populate");
|
||||
lock = true;
|
||||
int num_fsw = firmware->getCapability(CustomFunctions);
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
|
||||
if (!firmware->getCapability(VoicesAsNumbers)) {
|
||||
tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength));
|
||||
@@ -75,6 +67,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
}
|
||||
}
|
||||
|
||||
s1.report("get tracks");
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
@@ -86,9 +80,14 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
}
|
||||
}
|
||||
}
|
||||
s1.report("get scripts");
|
||||
|
||||
CompanionIcon playIcon("play.png");
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable");
|
||||
TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels);
|
||||
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
// The label
|
||||
QLabel * label = new QLabel(this);
|
||||
@@ -101,28 +100,35 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
label->setText(tr("GF%1").arg(i+1));
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
tableLayout->addWidget(i, 0, label);
|
||||
// s1.report("label");
|
||||
|
||||
// The switch
|
||||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
|
||||
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
fswtchSwtch[i]->setMaxVisibleItems(10);
|
||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
|
||||
tableLayout->addWidget(i, 1, fswtchSwtch[i]);
|
||||
// s1.report("switch");
|
||||
|
||||
// The function
|
||||
fswtchFunc[i] = new QComboBox(this);
|
||||
fswtchFunc[i]->setProperty("index", i);
|
||||
populateFuncCB(fswtchFunc[i], functions[i].func);
|
||||
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
|
||||
gridLayout->addWidget(fswtchFunc[i], i+1, 2);
|
||||
tableLayout->addWidget(i, 2, fswtchFunc[i]);
|
||||
// s1.report("func");
|
||||
|
||||
// The parameters
|
||||
QHBoxLayout *paramLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(paramLayout, i+1, 3);
|
||||
QHBoxLayout * paramLayout = new QHBoxLayout();
|
||||
tableLayout->addLayout(i, 3, paramLayout);
|
||||
|
||||
fswtchGVmode[i] = new QComboBox(this);
|
||||
fswtchGVmode[i]->setProperty("index", i);
|
||||
populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
|
||||
fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
paramLayout->addWidget(fswtchGVmode[i]);
|
||||
|
||||
@@ -149,12 +155,15 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
|
||||
fswtchParamT[i] = new QComboBox(this);
|
||||
fswtchParamT[i]->setProperty("index", i);
|
||||
populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
|
||||
paramLayout->addWidget(fswtchParamT[i]);
|
||||
fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
|
||||
fswtchParamArmT[i] = new QComboBox(this);
|
||||
fswtchParamArmT[i]->setProperty("index", i);
|
||||
fswtchParamArmT[i]->setEditable(true);
|
||||
fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
paramLayout->addWidget(fswtchParamArmT[i]);
|
||||
|
||||
connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
@@ -171,14 +180,15 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
|
||||
#ifdef PHONON
|
||||
playBT[i] = new QPushButton(this);
|
||||
playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
playBT[i]->setProperty("index", i);
|
||||
playBT[i]->setIcon(playIcon);
|
||||
paramLayout->addWidget(playBT[i]);
|
||||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
#endif
|
||||
|
||||
QHBoxLayout *repeatLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(repeatLayout, i+1, 4);
|
||||
QHBoxLayout * repeatLayout = new QHBoxLayout();
|
||||
tableLayout->addLayout(i, 4, repeatLayout);
|
||||
fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam);
|
||||
repeatLayout->addWidget(fswtchRepeat[i], i+1);
|
||||
connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||
@@ -186,17 +196,24 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
||||
fswtchEnable[i] = new QCheckBox(this);
|
||||
fswtchEnable[i]->setProperty("index", i);
|
||||
fswtchEnable[i]->setText(tr("ON"));
|
||||
fswtchEnable[i]->setFixedWidth( 80 );
|
||||
fswtchEnable[i]->setFixedWidth(200);
|
||||
repeatLayout->addWidget(fswtchEnable[i], i+1);
|
||||
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
}
|
||||
|
||||
// Push rows upward
|
||||
addDoubleSpring(gridLayout, 5, num_fsw+1);
|
||||
s1.report("add items");
|
||||
|
||||
disableMouseScrolling();
|
||||
s1.report("disableMouseScrolling");
|
||||
|
||||
lock = false;
|
||||
|
||||
update();
|
||||
s1.report("update");
|
||||
tableLayout->resizeColumnsToContents();
|
||||
s1.report("resizeColumnsToContents");
|
||||
tableLayout->setColumnWidth(3, 300);
|
||||
tableLayout->pushRowsUp(num_fsw+1);
|
||||
s1.report("end");
|
||||
}
|
||||
|
||||
CustomFunctionsPanel::~CustomFunctionsPanel()
|
||||
@@ -379,17 +396,20 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
}
|
||||
}
|
||||
else if (func==FuncReset) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (func>=FuncSetTimer1 && func<=FuncSetTimer2) {
|
||||
else if (func>=FuncSetTimer1 && func<=FuncSetTimer3) {
|
||||
if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds();
|
||||
fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0));
|
||||
fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59));
|
||||
fswtchParamTime[i]->setTime(QTimeS(cfn.param));
|
||||
widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (func>=FuncSetFailsafeInternalModule && func<=FuncBindExternalModule) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (func==FuncVolume) {
|
||||
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
@@ -442,16 +462,9 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
else {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
|
||||
int vml = firmware->getCapability(VoicesMaxLength);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
|
||||
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, firmware->getCapability(VoicesMaxLength));
|
||||
}
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, tracksSet);
|
||||
populateFileComboBox(fswtchParamArmT[i], tracksSet, cfn.paramarm);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
}
|
||||
@@ -460,16 +473,12 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
else if (func==FuncBackgroundMusic) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
|
||||
int vml=firmware->getCapability(VoicesMaxLength);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(),vml); j++) {
|
||||
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, firmware->getCapability(VoicesMaxLength));
|
||||
}
|
||||
populateFileComboBox(fswtchParamArmT[i], tracksSet, cfn.paramarm);
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
}
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, tracksSet);
|
||||
}
|
||||
else if (func==FuncPlaySound) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
@@ -485,27 +494,9 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
else if (func==FuncPlayScript) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
|
||||
int vml = 8/*TODO*/;
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
|
||||
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
populateFuncParamArmTCB(fswtchParamArmT[i], cfn.paramarm, scriptsSet);
|
||||
}
|
||||
else if (func==FuncPlayScript) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(cfn.paramarm, 0, sizeof(cfn.paramarm));
|
||||
int vml = 8/*TODO*/;
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
|
||||
cfn.paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, 8);
|
||||
}
|
||||
populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm);
|
||||
}
|
||||
else if (func==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
|
||||
if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value();
|
||||
@@ -543,16 +534,10 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
void CustomFunctionsPanel::update()
|
||||
{
|
||||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
|
||||
if (!initialized) {
|
||||
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], functions[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
|
||||
}
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
refreshCustomFunction(i);
|
||||
}
|
||||
initialized = true;
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -632,6 +617,8 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
|
||||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
|
||||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
|
||||
((i==FuncSetTimer3) && firmware->getCapability(Timers) < 3) ||
|
||||
((i>=FuncRangeCheckInternalModule && i<=FuncBindExternalModule) && (!model || !firmware->getCapability(DangerousFunctions))) ||
|
||||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
|
||||
) {
|
||||
// skipped
|
||||
@@ -659,77 +646,28 @@ void CustomFunctionsPanel::populateGVmodeCB(QComboBox *b, unsigned int value)
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncParamArmTCB(QComboBox *b, char * value, const QSet<QString> ¶msList)
|
||||
{
|
||||
b->clear();
|
||||
b->addItem("----");
|
||||
|
||||
bool added = false;
|
||||
QString currentvalue(value);
|
||||
// Convert set into list and sort it alphabetically case insensitive
|
||||
QStringList list = QStringList::fromSet(paramsList);
|
||||
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
|
||||
foreach (QString entry, list) {
|
||||
b->addItem(entry);
|
||||
if (entry==currentvalue) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!added && strlen(value)) {
|
||||
b->addItem(value);
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode)
|
||||
{
|
||||
QStringList qs;
|
||||
b->clear();
|
||||
if (function==FuncPlaySound) {
|
||||
qs <<"Beep 1" << "Beep 2" << "Beep 3" << "Warn1" << "Warn2" << "Cheep" << "Ratata" << "Tick" << "Siren" << "Ring" ;
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
CustomFunctionData::populatePlaySoundParams(qs);
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncPlayHaptic) {
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
CustomFunctionData::populateHapticParams(qs);
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncReset) {
|
||||
qs.append( QObject::tr("Timer1"));
|
||||
qs.append( QObject::tr("Timer2"));
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
qs.append( QObject::tr("Timer3"));
|
||||
}
|
||||
qs.append( QObject::tr("Flight"));
|
||||
qs.append( QObject::tr("Telemetry"));
|
||||
int reCount = firmware->getCapability(RotaryEncoders);
|
||||
if (reCount == 1) {
|
||||
qs.append( QObject::tr("Rotary Encoder"));
|
||||
}
|
||||
else if (reCount == 2) {
|
||||
qs.append( QObject::tr("REa"));
|
||||
qs.append( QObject::tr("REb"));
|
||||
}
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
||||
if (model->sensorData[i].isAvailable()) {
|
||||
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i);
|
||||
qs.append(item.toString(model));
|
||||
}
|
||||
}
|
||||
}
|
||||
b->addItems(qs);
|
||||
b->setCurrentIndex(value);
|
||||
CustomFunctionData::populateResetParams(model, b, value);
|
||||
}
|
||||
else if (function==FuncVolume) {
|
||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS|POPULATE_SWITCHES);
|
||||
}
|
||||
else if (function==FuncPlayValue) {
|
||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT);
|
||||
populateSourceCB(b, RawSource(value), generalSettings, model, POPULATE_NONE|POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRY|POPULATE_TELEMETRYEXT|POPULATE_SCRIPT_OUTPUTS);
|
||||
}
|
||||
else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
|
||||
switch (adjustmode) {
|
||||
|
||||
@@ -65,9 +65,7 @@ class CustomFunctionsPanel : public GenericPanel
|
||||
void populateFuncCB(QComboBox *b, unsigned int value);
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
void populateFuncParamArmTCB(QComboBox *b, char * value, const QSet<QString> & paramsList);
|
||||
|
||||
bool initialized;
|
||||
QSet<QString> tracksSet;
|
||||
QSet<QString> scriptsSet;
|
||||
int phononCurrent;
|
||||
|
||||
@@ -10,13 +10,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
generalSettings(generalSettings),
|
||||
firmware(firmware),
|
||||
ed(expoData),
|
||||
inputName(inputName)
|
||||
inputName(inputName),
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
setWindowTitle(tr("Edit %1").arg(getInputStr(&model, ed->chn)));
|
||||
setWindowTitle(tr("Edit %1").arg(modelPrinter.printInputName(ed->chn)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
@@ -32,7 +33,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
ui->offsetCB->hide();
|
||||
}
|
||||
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
|
||||
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
||||
|
||||
@@ -46,14 +48,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
}
|
||||
}
|
||||
else {
|
||||
int mask=1;
|
||||
for (int i=0; i<9 ; i++) {
|
||||
if ((ed->phases & mask)==0) {
|
||||
int mask = 1;
|
||||
for (int i=0; i<9; i++) {
|
||||
if ((ed->flightModes & mask) == 0) {
|
||||
cb_fp[i]->setChecked(true);
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
|
||||
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
@@ -61,7 +63,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
ui->inputName->setMaxLength(4);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES |
|
||||
POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
ui->sourceCB->removeItem(0);
|
||||
ui->inputName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->inputName->setText(inputName);
|
||||
@@ -75,10 +78,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
|
||||
ui->trimCB->addItem(tr("Rud"), 1);
|
||||
ui->trimCB->addItem(tr("Ele"), 2);
|
||||
ui->trimCB->addItem(tr("Thr"), 3);
|
||||
ui->trimCB->addItem(tr("Ail"), 4);
|
||||
for(int i=0; i < NUM_STICKS; i++) {
|
||||
ui->trimCB->addItem(AnalogString(i), i+1);
|
||||
}
|
||||
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
||||
|
||||
int expolength = firmware->getCapability(HasExpoNames);
|
||||
@@ -138,67 +140,68 @@ void ExpoDialog::updateScale()
|
||||
|
||||
void ExpoDialog::valuesChanged()
|
||||
{
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
||||
|
||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
inputName = ui->inputName->text();
|
||||
}
|
||||
|
||||
ed->flightModes = 0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
ed->flightModes++;
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
||||
|
||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
inputName = ui->inputName->text();
|
||||
|
||||
ed->phases=0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
ed->phases+=1;
|
||||
ed->flightModes <<= 1;
|
||||
}
|
||||
ed->flightModes >>= 1;
|
||||
if (firmware->getCapability(FlightModes)) {
|
||||
int zeros = 0;
|
||||
int ones = 0;
|
||||
int phtemp = ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
ones++;
|
||||
}
|
||||
ed->phases<<=1;
|
||||
else {
|
||||
zeros++;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
ed->phases>>=1;
|
||||
if (firmware->getCapability(FlightModes)) {
|
||||
int zeros=0;
|
||||
int ones=0;
|
||||
int phtemp=ed->phases;
|
||||
if (zeros == 1) {
|
||||
phtemp=ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if ((phtemp & 1) == 0) {
|
||||
break;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
}
|
||||
else if (ones == 1) {
|
||||
phtemp = ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
ones++;
|
||||
}
|
||||
else {
|
||||
zeros++;
|
||||
}
|
||||
phtemp >>=1;
|
||||
}
|
||||
if (zeros==1) {
|
||||
phtemp=ed->phases;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if ((phtemp & 1)==0) {
|
||||
break;
|
||||
}
|
||||
phtemp >>=1;
|
||||
}
|
||||
}
|
||||
else if (ones==1) {
|
||||
phtemp=ed->phases;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
break;
|
||||
}
|
||||
phtemp >>=1;
|
||||
break;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ed->phases=0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ed->flightModes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ExpoDialog::shrink()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include "eeprominterface.h"
|
||||
#include "modelprinter.h"
|
||||
|
||||
class GVarGroup;
|
||||
class CurveGroup;
|
||||
@@ -35,6 +36,7 @@ class ExpoDialog : public QDialog {
|
||||
GVarGroup * gvWeightGroup;
|
||||
GVarGroup * gvOffsetGroup;
|
||||
CurveGroup * curveGroup;
|
||||
ModelPrinter modelPrinter;
|
||||
};
|
||||
|
||||
#endif // EXPODIALOG_H
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="labelName">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
|
||||
@@ -15,6 +15,9 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->labelName->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->labelName, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(name_customContextMenuRequested(const QPoint &)));
|
||||
|
||||
int modesCount = firmware->getCapability(FlightModes);
|
||||
|
||||
// Phase name
|
||||
@@ -56,7 +59,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;
|
||||
@@ -422,6 +429,29 @@ void FlightModePanel::phaseTrimSlider_valueChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void FlightModePanel::name_customContextMenuRequested(const QPoint & pos)
|
||||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Clear"),this,SLOT(fmClear()),tr("Clear"));
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void FlightModePanel::fmClear()
|
||||
{
|
||||
int res = QMessageBox::question(this, "Companion", tr("Clear all current Flight Mode properties?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res == QMessageBox::Yes) {
|
||||
phase.clear();
|
||||
for(int i=0; i < 4; ++i) {
|
||||
model->setTrimValue(phaseIdx, i, 0);
|
||||
}
|
||||
update();
|
||||
emit modified();
|
||||
emit nameModified();
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
FlightModesPanel::FlightModesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
|
||||
@@ -41,6 +41,8 @@ class FlightModePanel : public ModelPanel
|
||||
void phaseGVPopupToggled(bool checked);
|
||||
void phaseREValue_editingFinished();
|
||||
void phaseREUse_currentIndexChanged(int index);
|
||||
void name_customContextMenuRequested(const QPoint & pos);
|
||||
void fmClear();
|
||||
|
||||
private:
|
||||
Ui::FlightMode *ui;
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
expoInserted(false)
|
||||
expoInserted(false),
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
inputsCount = firmware->getCapability(VirtualInputs);
|
||||
if (inputsCount == 0)
|
||||
@@ -135,18 +136,18 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
||||
QString str;
|
||||
if (new_ch) *new_ch = 0;
|
||||
if (dest < 0) {
|
||||
str = getInputStr(model, -dest-1);
|
||||
str = modelPrinter.printInputName(-dest-1);
|
||||
if (new_ch) *new_ch = 1;
|
||||
}
|
||||
else {
|
||||
ExpoData *md = &model->expoData[dest];
|
||||
ExpoData & input = model->expoData[dest];
|
||||
|
||||
if ((dest == 0) || (model->expoData[dest-1].chn != md->chn)) {
|
||||
if ((dest == 0) || (model->expoData[dest-1].chn != input.chn)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
str = QString("%1").arg(getInputStr(model, md->chn), -10, ' ');
|
||||
str += QString("%1").arg(modelPrinter.printInputName(input.chn), -10, ' ');
|
||||
else
|
||||
str = getInputStr(model, md->chn);
|
||||
str = modelPrinter.printInputName(input.chn);
|
||||
}
|
||||
else {
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
@@ -154,39 +155,10 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
||||
else
|
||||
str = " ";
|
||||
}
|
||||
|
||||
switch (md->mode) {
|
||||
case (1): str += " <-"; break;
|
||||
case (2): str += " ->"; break;
|
||||
default: str += " "; break;
|
||||
}
|
||||
|
||||
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight));
|
||||
if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset));
|
||||
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
str += " " + tr("Source(%1)").arg(md->srcRaw.toString(model));
|
||||
if (md->carryTrim>0) {
|
||||
str += " " + tr("NoTrim");
|
||||
}
|
||||
else if (md->carryTrim<0) {
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
|
||||
}
|
||||
}
|
||||
|
||||
if (md->curve.value) str += " " + md->curve.toString();
|
||||
|
||||
QString phasesStr = getPhasesStr(md->phases, model);
|
||||
if (!phasesStr.isEmpty()) str += " " + phasesStr;
|
||||
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
|
||||
|
||||
if (firmware->getCapability(HasExpoNames)) {
|
||||
QString expoName = md->name;
|
||||
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
|
||||
}
|
||||
str.replace(" ", " ");
|
||||
str += modelPrinter.printInputLine(input);
|
||||
}
|
||||
return Qt::escape(str).replace(" ", " ");
|
||||
return str;
|
||||
}
|
||||
|
||||
bool InputsPanel::gm_insertExpo(int idx)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "modeledit.h"
|
||||
#include "mixerslist.h"
|
||||
#include "modelprinter.h"
|
||||
|
||||
class InputsPanel : public ModelPanel
|
||||
{
|
||||
@@ -35,6 +36,7 @@ class InputsPanel : public ModelPanel
|
||||
MixersList *ExposlistWidget;
|
||||
bool firstLine;
|
||||
int inputsCount;
|
||||
ModelPrinter modelPrinter;
|
||||
|
||||
int getExpoIndex(unsigned int dch);
|
||||
bool gm_insertExpo(int idx);
|
||||
|
||||
@@ -11,19 +11,18 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
selectedSwitch(0)
|
||||
{
|
||||
Stopwatch s1("LogicalSwitchesPanel");
|
||||
|
||||
int channelsMax = model.getChannelsMax(true);
|
||||
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
|
||||
int col = 1;
|
||||
addLabel(gridLayout, tr("Function"), col++);
|
||||
addLabel(gridLayout, tr("V1"), col++);
|
||||
addLabel(gridLayout, tr("V2"), col++);
|
||||
addLabel(gridLayout, tr("AND Switch"), col++);
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#" << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch");
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
addLabel(gridLayout, tr("Duration"), col++);
|
||||
addLabel(gridLayout, tr("Delay"), col++);
|
||||
headerLabels << tr("Duration") << tr("Delay");
|
||||
}
|
||||
TableLayout * tableLayout = new TableLayout(this, firmware->getCapability(LogicalSwitches), headerLabels);
|
||||
|
||||
s1.report("header");
|
||||
|
||||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
|
||||
@@ -35,19 +34,20 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
label->setMouseTracking(true);
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
tableLayout->addWidget(i, 0, label);
|
||||
|
||||
// The function
|
||||
csw[i] = new QComboBox(this);
|
||||
csw[i]->setProperty("index", i);
|
||||
connect(csw[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
|
||||
gridLayout->addWidget(csw[i], i+1, 1);
|
||||
tableLayout->addWidget(i, 1, csw[i]);
|
||||
|
||||
// V1
|
||||
QHBoxLayout *v1Layout = new QHBoxLayout();
|
||||
cswitchSource1[i] = new QComboBox(this);
|
||||
cswitchSource1[i]->setProperty("index",i);
|
||||
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v1Edited(int)));
|
||||
gridLayout->addWidget(cswitchSource1[i], i+1, 2);
|
||||
v1Layout->addWidget(cswitchSource1[i]);
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
cswitchValue[i] = new QDoubleSpinBox(this);
|
||||
cswitchValue[i]->setMaximum(channelsMax);
|
||||
@@ -56,8 +56,9 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
cswitchValue[i]->setDecimals(0);
|
||||
cswitchValue[i]->setProperty("index", i);
|
||||
connect(cswitchValue[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
|
||||
gridLayout->addWidget(cswitchValue[i], i+1, 2);
|
||||
v1Layout->addWidget(cswitchValue[i]);
|
||||
cswitchValue[i]->setVisible(false);
|
||||
tableLayout->addLayout(i, 2, v1Layout);
|
||||
|
||||
// V2
|
||||
QHBoxLayout *v2Layout = new QHBoxLayout();
|
||||
@@ -90,13 +91,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
connect(cswitchTOffset[i],SIGNAL(editingFinished()),this,SLOT(edited()));
|
||||
v2Layout->addWidget(cswitchTOffset[i]);
|
||||
cswitchTOffset[i]->setVisible(false);
|
||||
gridLayout->addLayout(v2Layout, i+1, 3);
|
||||
tableLayout->addLayout(i, 3, v2Layout);
|
||||
|
||||
// AND
|
||||
cswitchAnd[i] = new QComboBox(this);
|
||||
cswitchAnd[i]->setProperty("index", i);
|
||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
||||
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
||||
tableLayout->addWidget(i, 4, cswitchAnd[i]);
|
||||
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
// Duration
|
||||
@@ -108,7 +109,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
cswitchDuration[i]->setAccelerated(true);
|
||||
cswitchDuration[i]->setDecimals(1);
|
||||
connect(cswitchDuration[i], SIGNAL(valueChanged(double)), this, SLOT(durationEdited(double)));
|
||||
gridLayout->addWidget(cswitchDuration[i], i+1, 5);
|
||||
tableLayout->addWidget(i, 5, cswitchDuration[i]);
|
||||
|
||||
// Delay
|
||||
cswitchDelay[i] = new QDoubleSpinBox(this);
|
||||
@@ -119,15 +120,18 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
cswitchDelay[i]->setAccelerated(true);
|
||||
cswitchDelay[i]->setDecimals(1);
|
||||
connect(cswitchDelay[i], SIGNAL(valueChanged(double)), this, SLOT(delayEdited(double)));
|
||||
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
||||
tableLayout->addWidget(i, 6, cswitchDelay[i]);
|
||||
}
|
||||
}
|
||||
// Push rows upward
|
||||
addVSpring(gridLayout,0,firmware->getCapability(LogicalSwitches)+1);
|
||||
|
||||
s1.report("added elements");
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
lock = false;
|
||||
update();
|
||||
tableLayout->resizeColumnsToContents();
|
||||
tableLayout->pushRowsUp(firmware->getCapability(LogicalSwitches)+1);
|
||||
s1.report("end");
|
||||
}
|
||||
|
||||
LogicalSwitchesPanel::~LogicalSwitchesPanel()
|
||||
@@ -240,7 +244,7 @@ void LogicalSwitchesPanel::edited()
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.1);
|
||||
break;
|
||||
case LS_FAMILY_EDGE:
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(no release)"));
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (sender() == cswitchOffset[i]) {
|
||||
model->logicalSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.0);
|
||||
@@ -339,7 +343,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model->logicalSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
updateTimerParam(cswitchOffset[i], model->logicalSw[i].val2, 0.0);
|
||||
updateTimerParam(cswitchOffset2[i], model->logicalSw[i].val2+model->logicalSw[i].val3, ValToTim(TimToVal(cswitchOffset[i]->value())-1));
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(no release)"));
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (model->logicalSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
}
|
||||
|
||||
@@ -19,16 +19,18 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
|
||||
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS |
|
||||
POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->sourceCB->removeItem(0);
|
||||
|
||||
int limit = firmware->getCapability(OffsetWeight);
|
||||
|
||||
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
|
||||
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB,
|
||||
md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
|
||||
|
||||
ui->MixDR_CB->setChecked(md->noExpo==0);
|
||||
ui->MixDR_CB->setChecked(md->noExpo == 0);
|
||||
|
||||
if (!firmware->getCapability(HasNoExpo)) {
|
||||
ui->MixDR_CB->hide();
|
||||
@@ -36,10 +38,9 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(VirtualInputs)) {
|
||||
ui->trimCB->addItem(tr("Rud"));
|
||||
ui->trimCB->addItem(tr("Ele"));
|
||||
ui->trimCB->addItem(tr("Thr"));
|
||||
ui->trimCB->addItem(tr("Ail"));
|
||||
for(int i=0; i < NUM_STICKS; i++) {
|
||||
ui->trimCB->addItem(AnalogString(i));
|
||||
}
|
||||
}
|
||||
|
||||
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
|
||||
@@ -63,14 +64,14 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
}
|
||||
}
|
||||
else {
|
||||
int mask=1;
|
||||
int mask = 1;
|
||||
for (int i=0; i<9 ; i++) {
|
||||
if ((md->phases & mask)==0) {
|
||||
if ((md->flightModes & mask) == 0) {
|
||||
cb_fp[i]->setChecked(true);
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
|
||||
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
@@ -149,29 +150,26 @@ void MixerDialog::valuesChanged()
|
||||
ui->label_MixDR->setEnabled(drVisible);
|
||||
}
|
||||
md->carryTrim = -(ui->trimCB->currentIndex()-1);
|
||||
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
||||
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
||||
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
md->mixWarn = ui->warningCB->currentIndex();
|
||||
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
|
||||
int scale=firmware->getCapability(SlowScale);
|
||||
int scale = firmware->getCapability(SlowScale);
|
||||
md->delayDown = round(ui->delayDownSB->value()*scale);
|
||||
md->delayUp = round(ui->delayUpSB->value()*scale);
|
||||
md->speedDown = round(ui->slowDownSB->value()*scale);
|
||||
md->speedUp = round(ui->slowUpSB->value()*scale);
|
||||
|
||||
int i=0;
|
||||
for (i=0; i<ui->mixerName->text().toAscii().length(); i++) {
|
||||
md->name[i]=ui->mixerName->text().toAscii().at(i);
|
||||
}
|
||||
md->name[i]=0;
|
||||
md->phases=0;
|
||||
strcpy(md->name, ui->mixerName->text().toAscii());
|
||||
|
||||
md->flightModes = 0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
md->phases+=1;
|
||||
md->flightModes++;
|
||||
}
|
||||
md->phases<<=1;
|
||||
md->flightModes <<= 1;
|
||||
}
|
||||
md->phases>>=1;
|
||||
md->flightModes >>= 1;
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
+227
-286
@@ -6,7 +6,8 @@
|
||||
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
mixInserted(false),
|
||||
highlightedSource(0)
|
||||
highlightedSource(0),
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
QGridLayout * mixesLayout = new QGridLayout(this);
|
||||
|
||||
@@ -43,40 +44,21 @@ MixesPanel::~MixesPanel()
|
||||
{
|
||||
}
|
||||
|
||||
QString MixesPanel::getChannelLabel(int curDest)
|
||||
{
|
||||
QString str;
|
||||
str = QObject::tr("CH%1").arg(curDest);
|
||||
// TODO not nice, Qt brings a function for that, I don't remember right now
|
||||
(str.length() < 4) ? str.append(" ") : str.append(" ");
|
||||
if (firmware->getCapability(HasChNames)) {
|
||||
QString name = model->limitData[curDest-1].name;
|
||||
if (!name.isEmpty()) {
|
||||
name = QString("(") + name + QString(")");
|
||||
}
|
||||
name.append(" ");
|
||||
str += name.left(8);
|
||||
}
|
||||
return Qt::escape(str);
|
||||
}
|
||||
|
||||
void MixesPanel::update()
|
||||
{
|
||||
// curDest -> destination channel
|
||||
// i -> mixer number
|
||||
QByteArray qba;
|
||||
MixerlistWidget->clear();
|
||||
firstLine = true;
|
||||
unsigned int curDest = 0;
|
||||
int i;
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
|
||||
for (i=0; i<firmware->getCapability(Mixes); i++) {
|
||||
MixData *md = &model->mixData[i];
|
||||
// qDebug() << "md->destCh: " << md->destCh;
|
||||
if (md->destCh==0 || md->destCh>outputs) continue;
|
||||
for (int i=0; i<firmware->getCapability(Mixes); i++) {
|
||||
MixData & mix = model->mixData[i];
|
||||
// qDebug() << "mix.destCh: " << mix.destCh;
|
||||
if (mix.destCh == 0 || mix.destCh>outputs) continue;
|
||||
QString str = "";
|
||||
while (curDest < md->destCh-1) {
|
||||
while (curDest < mix.destCh-1) {
|
||||
curDest++;
|
||||
AddMixerLine(-curDest);
|
||||
}
|
||||
@@ -139,24 +121,24 @@ bool MixesPanel::AddMixerLine(int dest)
|
||||
QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
{
|
||||
QString str;
|
||||
if (new_ch) *new_ch = 0;
|
||||
bool newChannel = false;
|
||||
if (dest < 0) {
|
||||
str = getChannelLabel(-dest);
|
||||
//highlight channell if needed
|
||||
str = modelPrinter.printMixerName(-dest);
|
||||
//highlight channel if needed
|
||||
if (-dest == (int)highlightedSource) {
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
if (new_ch) *new_ch = 1;
|
||||
newChannel = true;
|
||||
}
|
||||
else {
|
||||
MixData *md = &model->mixData[dest];
|
||||
//md->destCh from 1 to 32
|
||||
str = getChannelLabel(md->destCh);
|
||||
MixData & mix = model->mixData[dest];
|
||||
//mix->destCh from 1 to 32
|
||||
str = modelPrinter.printMixerName(mix.destCh);
|
||||
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != md->destCh)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
//highlight channell if needed
|
||||
if (md->destCh == highlightedSource) {
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
|
||||
newChannel = true;
|
||||
//highlight channel if needed
|
||||
if (mix.destCh == highlightedSource) {
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
}
|
||||
@@ -164,199 +146,155 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
str.fill(' ');
|
||||
}
|
||||
|
||||
switch (md->mltpx) {
|
||||
case (1): str += " *"; break;
|
||||
case (2): str += " R"; break;
|
||||
default: str += " "; break;
|
||||
};
|
||||
|
||||
// highlight source if needed
|
||||
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
|
||||
str += " <b>" + Qt::escape(md->srcRaw.toString(model)) + "</b>";
|
||||
}
|
||||
else {
|
||||
str += " " + Qt::escape(md->srcRaw.toString(model));
|
||||
}
|
||||
|
||||
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
|
||||
|
||||
QString phasesStr = getPhasesStr(md->phases, model);
|
||||
if (!phasesStr.isEmpty()) str += " " + Qt::escape(phasesStr);
|
||||
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) {
|
||||
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
|
||||
}
|
||||
|
||||
if (md->carryTrim > 0)
|
||||
str += " " + Qt::escape(tr("NoTrim"));
|
||||
else if (md->carryTrim<0)
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
|
||||
|
||||
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
|
||||
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
|
||||
int scale = firmware->getCapability(SlowScale);
|
||||
if (scale == 0)
|
||||
scale = 1;
|
||||
if (md->delayDown || md->delayUp)
|
||||
str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
|
||||
if (md->speedDown || md->speedUp)
|
||||
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
|
||||
if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
|
||||
if (firmware->getCapability(HasMixerNames)) {
|
||||
QString MixerName;
|
||||
MixerName.append(md->name);
|
||||
if (!MixerName.isEmpty()) {
|
||||
str += " " + Qt::escape(QString("(%1)").arg(MixerName));
|
||||
}
|
||||
}
|
||||
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
|
||||
}
|
||||
if (new_ch) *new_ch = newChannel;
|
||||
return str.replace(" ", " ");
|
||||
}
|
||||
|
||||
bool MixesPanel::gm_insertMix(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
if (idx < 0 || idx >= firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = model->mixData[idx].destCh;
|
||||
memmove(&model->mixData[idx+1],&model->mixData[idx],
|
||||
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
|
||||
memset(&model->mixData[idx],0,sizeof(MixData));
|
||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model->mixData[idx].destCh = i;
|
||||
model->mixData[idx].weight = 100;
|
||||
return true;
|
||||
int i = model->mixData[idx].destCh;
|
||||
memmove(&model->mixData[idx+1], &model->mixData[idx],
|
||||
(firmware->getCapability(Mixes)-(idx+1)) * sizeof(MixData) );
|
||||
memset(&model->mixData[idx], 0, sizeof(MixData));
|
||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model->mixData[idx].destCh = i;
|
||||
model->mixData[idx].weight = 100;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MixesPanel::gm_deleteMix(int index)
|
||||
{
|
||||
memmove(&model->mixData[index],&model->mixData[index+1],
|
||||
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
|
||||
memset(&model->mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
|
||||
memmove(&model->mixData[index], &model->mixData[index+1],
|
||||
(firmware->getCapability(Mixes)-(index+1)) * sizeof(MixData));
|
||||
memset(&model->mixData[firmware->getCapability(Mixes)-1], 0, sizeof(MixData));
|
||||
}
|
||||
|
||||
void MixesPanel::gm_openMix(int index)
|
||||
{
|
||||
if(index<0 || index>=firmware->getCapability(Mixes)) return;
|
||||
if(index < 0 || index>=firmware->getCapability(Mixes)) return;
|
||||
|
||||
MixData mixd(model->mixData[index]);
|
||||
MixData mixd(model->mixData[index]);
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||
if(g->exec()) {
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||
if(g->exec()) {
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
} else {
|
||||
if (mixInserted) {
|
||||
gm_deleteMix(index);
|
||||
}
|
||||
mixInserted=false;
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
else {
|
||||
if (mixInserted) {
|
||||
gm_deleteMix(index);
|
||||
}
|
||||
mixInserted = false;
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
int MixesPanel::getMixerIndex(unsigned int dch)
|
||||
{
|
||||
int i = 0;
|
||||
while ((model->mixData[i].destCh<=dch) && (model->mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
|
||||
if(i==firmware->getCapability(Mixes)) return -1;
|
||||
return i;
|
||||
int i = 0;
|
||||
while ((model->mixData[i].destCh <= dch) && (model->mixData[i].destCh) && (i < firmware->getCapability(Mixes))) i++;
|
||||
if (i == firmware->getCapability(Mixes)) return -1;
|
||||
return i;
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
||||
{
|
||||
int idx= MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
}
|
||||
gm_openMix(idx);
|
||||
int idx = MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
gm_openMix(idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixersDeleteList(QList<int> list)
|
||||
{
|
||||
qSort(list.begin(), list.end());
|
||||
qSort(list.begin(), list.end());
|
||||
|
||||
int iDec = 0;
|
||||
foreach(int idx, list) {
|
||||
gm_deleteMix(idx-iDec);
|
||||
iDec++;
|
||||
}
|
||||
int iDec = 0;
|
||||
foreach(int idx, list) {
|
||||
gm_deleteMix(idx - iDec);
|
||||
iDec++;
|
||||
}
|
||||
}
|
||||
|
||||
QList<int> MixesPanel::createMixListFromSelected()
|
||||
{
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx>=0 && idx<firmware->getCapability(Mixes)) list << idx;
|
||||
}
|
||||
return list;
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx >= 0 && idx<firmware->getCapability(Mixes)) list << idx;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// TODO duplicated code
|
||||
void MixesPanel::setSelectedByMixList(QList<int> list)
|
||||
{
|
||||
for(int i=0; i<MixerlistWidget->count(); i++) {
|
||||
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(list.contains(t))
|
||||
MixerlistWidget->item(i)->setSelected(true);
|
||||
for(int i=0; i<MixerlistWidget->count(); i++) {
|
||||
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(list.contains(t)) {
|
||||
MixerlistWidget->item(i)->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MixesPanel::mixersDelete(bool ask)
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
if(list.isEmpty()) return;
|
||||
QList<int> list = createMixListFromSelected();
|
||||
if(list.isEmpty()) return;
|
||||
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
|
||||
if(ask)
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Mixes?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(ask) {
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Mixes?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
}
|
||||
|
||||
|
||||
if ((ret == QMessageBox::Yes) || (!ask)) {
|
||||
mixersDeleteList(list);
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
if ((ret == QMessageBox::Yes) || (!ask)) {
|
||||
mixersDeleteList(list);
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void MixesPanel::mixersCut()
|
||||
{
|
||||
mixersCopy();
|
||||
mixersDelete(false);
|
||||
mixersCopy();
|
||||
mixersDelete(false);
|
||||
}
|
||||
|
||||
void MixesPanel::mixersCopy()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model->mixData[idx], sizeof(MixData));
|
||||
}
|
||||
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model->mixData[idx],sizeof(MixData));
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-mix", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-mix", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
@@ -365,10 +303,11 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
int idx; // mixer index
|
||||
int dch;
|
||||
|
||||
if(destIdx<0) {
|
||||
if (destIdx < 0) {
|
||||
dch = -destIdx;
|
||||
idx = getMixerIndex(dch) - 1; //get mixer index to insert
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
idx = destIdx;
|
||||
dch = model->mixData[idx].destCh;
|
||||
}
|
||||
@@ -376,14 +315,13 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
QByteArray mxData = mimeData->data("application/x-companion-mix");
|
||||
|
||||
int i = 0;
|
||||
while(i<mxData.size()) {
|
||||
while (i < mxData.size()) {
|
||||
idx++;
|
||||
if(idx==firmware->getCapability(Mixes)) break;
|
||||
if (idx == firmware->getCapability(Mixes)) break;
|
||||
if (!gm_insertMix(idx)) break;
|
||||
|
||||
if (!gm_insertMix(idx))
|
||||
break;
|
||||
MixData *md = &model->mixData[idx];
|
||||
memcpy(md,mxData.mid(i,sizeof(MixData)).constData(),sizeof(MixData));
|
||||
MixData * md = &model->mixData[idx];
|
||||
memcpy(md, mxData.mid(i, sizeof(MixData)).constData(), sizeof(MixData));
|
||||
md->destCh = dch;
|
||||
i += sizeof(MixData);
|
||||
}
|
||||
@@ -396,34 +334,35 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
|
||||
void MixesPanel::mixersPaste()
|
||||
{
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
QListWidgetItem *item = MixerlistWidget->currentItem();
|
||||
if (item)
|
||||
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
QListWidgetItem *item = MixerlistWidget->currentItem();
|
||||
if (item) {
|
||||
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void MixesPanel::mixersDuplicate()
|
||||
{
|
||||
mixersCopy();
|
||||
mixersPaste();
|
||||
mixersCopy();
|
||||
mixersPaste();
|
||||
}
|
||||
|
||||
void MixesPanel::mixerOpen()
|
||||
{
|
||||
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
}
|
||||
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx < 0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
|
||||
gm_openMix(idx);
|
||||
gm_openMix(idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixerHighlight()
|
||||
@@ -446,135 +385,137 @@ void MixesPanel::mixerHighlight()
|
||||
|
||||
void MixesPanel::mixerAdd()
|
||||
{
|
||||
if (!MixerlistWidget->currentItem())
|
||||
return;
|
||||
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (!MixerlistWidget->currentItem()) return;
|
||||
|
||||
if(index<0) { // if empty then return relavent index
|
||||
int i = -index;
|
||||
index = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
index++;
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||
mixInserted=true;
|
||||
}
|
||||
gm_openMix(index);
|
||||
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
|
||||
if(index < 0) { // if empty then return relavent index
|
||||
int i = -index;
|
||||
index = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(index)) return;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
index++;
|
||||
if (!gm_insertMix(index)) return;
|
||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||
mixInserted = true;
|
||||
}
|
||||
gm_openMix(index);
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"),this,SLOT(mixerHighlight()),tr("Ctrl+T"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"), this, SLOT(mixerAdd()), tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(mixerOpen()), tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"), this, SLOT(mixerHighlight()), tr("Ctrl+T"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"), this, SLOT(mixersDelete()), tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"), this, SLOT(mixersCopy()), tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"), this, SLOT(mixersCut()), tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"), this, SLOT(mixersPaste()), tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(mixersDuplicate()), tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(moveMixUp()), tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveMixDown()), tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
|
||||
{
|
||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
pasteMixerMimeData(data, idx);
|
||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixesEdited()
|
||||
{
|
||||
emit modified();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
|
||||
{
|
||||
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
||||
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
||||
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
||||
if(event->matches(QKeySequence::Cut)) mixersCut();
|
||||
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
||||
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
||||
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
||||
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
||||
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
||||
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
||||
if(event->matches(QKeySequence::Cut)) mixersCut();
|
||||
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
||||
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
||||
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
||||
|
||||
if(event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) mixerOpen();
|
||||
if(event->matches(QKeySequence::MoveToNextLine))
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
||||
if(event->matches(QKeySequence::MoveToPreviousLine))
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
||||
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) mixerOpen();
|
||||
|
||||
if(event->matches(QKeySequence::MoveToNextLine)) {
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
||||
}
|
||||
if(event->matches(QKeySequence::MoveToPreviousLine)) {
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
||||
}
|
||||
}
|
||||
|
||||
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
||||
{
|
||||
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
|
||||
if(idx > firmware->getCapability(Mixes) || (idx == firmware->getCapability(Mixes) && dir)) return idx;
|
||||
|
||||
MixData &src=model->mixData[idx];
|
||||
MixData &src=model->mixData[idx];
|
||||
|
||||
if (idx==0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
if (src.destCh > 1) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
if (idx == 0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
if (src.destCh > 1) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
MixData &tgt=model->mixData[tdx];
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
MixData & tgt = model->mixData[tdx];
|
||||
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
if(src.destCh == 0 || src.destCh > outputs || tgt.destCh > outputs) return idx;
|
||||
|
||||
if (tgt.destCh!=src.destCh) {
|
||||
if ((dir) && (src.destCh<outputs)) src.destCh++;
|
||||
if ((!dir) && (src.destCh>0)) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
if (tgt.destCh != src.destCh) {
|
||||
if (dir && src.destCh < outputs) src.destCh++;
|
||||
if (!dir && src.destCh > 0) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
|
||||
//flip between idx and tgt
|
||||
MixData temp;
|
||||
memcpy(&temp,&src,sizeof(MixData));
|
||||
memcpy(&src,&tgt,sizeof(MixData));
|
||||
memcpy(&tgt,&temp,sizeof(MixData));
|
||||
return tdx;
|
||||
//flip between idx and tgt
|
||||
MixData temp;
|
||||
memcpy(&temp, &src, sizeof(MixData));
|
||||
memcpy(&src, &tgt, sizeof(MixData));
|
||||
memcpy(&tgt, &temp, sizeof(MixData));
|
||||
return tdx;
|
||||
}
|
||||
|
||||
void MixesPanel::moveMixUp()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, false);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, false);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
}
|
||||
|
||||
void MixesPanel::moveMixDown()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, true);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, true);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
}
|
||||
|
||||
void MixesPanel::clearMixes()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "modeledit.h"
|
||||
#include "mixerslist.h"
|
||||
#include "mixerdialog.h"
|
||||
#include "modelprinter.h"
|
||||
|
||||
class MixesPanel : public ModelPanel
|
||||
{
|
||||
@@ -44,6 +45,7 @@ class MixesPanel : public ModelPanel
|
||||
bool mixInserted;
|
||||
unsigned int highlightedSource;
|
||||
bool firstLine;
|
||||
ModelPrinter modelPrinter;
|
||||
|
||||
int getMixerIndex(unsigned int dch);
|
||||
bool gm_insertMix(int idx);
|
||||
@@ -53,7 +55,6 @@ class MixesPanel : public ModelPanel
|
||||
void mixersDeleteList(QList<int> list);
|
||||
QList<int> createMixListFromSelected();
|
||||
void setSelectedByMixList(QList<int> list);
|
||||
QString getChannelLabel(int curDest);
|
||||
bool AddMixerLine(int dest);
|
||||
QString getMixerText(int dest, bool * new_ch);
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user