Compare commits
694 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 |
@@ -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 .
|
||||
@@ -1,3 +0,0 @@
|
||||
<a href="http://3drobotics.com">3D Robotics</a>
|
||||
They sell the Iris+ with a modified version of OpenTX which doesn't fullfil the GPL requirements.
|
||||
No donations, no thanks, we are just free staff for them...
|
||||
+105
-10
@@ -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
|
||||
@@ -789,4 +782,106 @@ 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,5 +1,9 @@
|
||||
##OpenTX 2.1 Branch
|
||||
|
||||
The ongoing development is not done in this branch. It is performed in the branch called next.
|
||||
[](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 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,87 @@
|
||||
<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>
|
||||
@@ -16,7 +100,7 @@
|
||||
<li>Writing model settings to 9XR-PRO did not work (<a href=https://github.com/opentx/opentx/issues/2402>#2402</a>, <a href=https://github.com/opentx/opentx/issues/2517>#2517</a>)</li>
|
||||
<li>Model Print and Model Compare improvements</li>
|
||||
<li>Fixed Companion OSX version (<a href=https://github.com/opentx/opentx/issues/2549>#2549</a>)</li>
|
||||
<li>Firmware nightly builds are now downloadable from nightly builds of Companion (<a href=https://github.com/opentx/opentx/issues/2526>#2526</a>,<a href=https://github.com/opentx/opentx/issues/2634>#2634</a>)</li>
|
||||
<li>Firmware nightly builds are now downloadable from nightly builds of Companion (<a href=https://github.com/opentx/opentx/issues/2526>#2526</a>, <a href=https://github.com/opentx/opentx/issues/2634>#2634</a>)</li>
|
||||
<li>Fixed telemetry item lists (<a href=https://github.com/opentx/opentx/issues/2541>#2541</a>)</li>
|
||||
<li>Fixed missing pots P1..P3 for 9X (<a href=https://github.com/opentx/opentx/issues/2543>#2543</a>)</li>
|
||||
<li>Fixed "Invalid model and settings" error message when writing models and settings to the radio (<a href=https://github.com/opentx/opentx/issues/2544>#2544</a>)</li>
|
||||
|
||||
@@ -2,13 +2,13 @@ PROJECT( companion )
|
||||
|
||||
SET(C9X_VERSION_MAJOR "2")
|
||||
SET(C9X_VERSION_MINOR "1")
|
||||
SET(C9X_VERSION_REVISION "1")
|
||||
SET(C9X_VERSION_REVISION "7")
|
||||
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
|
||||
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
|
||||
MESSAGE(STATUS OpenTX Companion ${C9X_VERSION})
|
||||
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
@@ -33,6 +33,12 @@ IF(DEBUG_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 )
|
||||
@@ -62,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} )
|
||||
@@ -85,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
|
||||
@@ -93,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 )
|
||||
@@ -102,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})
|
||||
@@ -112,6 +126,7 @@ include_directories(
|
||||
${PROJECT_SOURCE_DIR}/shared
|
||||
${SIMU_SRC_DIRECTORY}
|
||||
${XSD_INCLUDE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/qxtcommandoptions
|
||||
)
|
||||
|
||||
add_subdirectory(shared)
|
||||
@@ -120,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
|
||||
@@ -158,6 +174,7 @@ set(companion_SRCS
|
||||
apppreferencesdialog.cpp
|
||||
fwpreferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
multimodelprinter.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
releasenotesdialog.cpp
|
||||
@@ -176,7 +193,7 @@ set(companion_SRCS
|
||||
fusesdialog.cpp
|
||||
logsdialog.cpp
|
||||
downloaddialog.cpp
|
||||
splashlibrary.cpp
|
||||
splashlibrarydialog.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
radionotfound.cpp
|
||||
@@ -196,7 +213,7 @@ set(companion_MOC_HDRS
|
||||
releasenotesdialog.h
|
||||
releasenotesfirmwaredialog.h
|
||||
customizesplashdialog.h
|
||||
splashlibrary.h
|
||||
splashlibrarydialog.h
|
||||
splashlabel.h
|
||||
progresswidget.h
|
||||
progressdialog.h
|
||||
@@ -212,6 +229,8 @@ set(companion_MOC_HDRS
|
||||
radionotfound.h
|
||||
helpers.h
|
||||
wizarddialog.h
|
||||
modelprinter.h
|
||||
multimodelprinter.h
|
||||
)
|
||||
|
||||
set(companion_UIS
|
||||
@@ -226,7 +245,7 @@ set(companion_UIS
|
||||
printdialog.ui
|
||||
htmldialog.ui
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
splashlibrarydialog.ui
|
||||
progresswidget.ui
|
||||
progressdialog.ui
|
||||
flashfirmwaredialog.ui
|
||||
@@ -270,7 +289,6 @@ 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)
|
||||
|
||||
@@ -333,7 +351,7 @@ else()
|
||||
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${SIMULATOR_NAME} 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 ####################
|
||||
|
||||
@@ -412,6 +430,7 @@ IF( APPLE )
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync -r ${XSD_INCLUDE_DIR}/.. companion.app/Contents/Frameworks/
|
||||
COMMAND rsync -r /Library/Frameworks/SDL.framework companion.app/Contents/Frameworks/
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
|
||||
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL companion.app/Contents/MacOS/companion
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
@@ -430,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
|
||||
@@ -441,7 +460,11 @@ ENDIF()
|
||||
SET(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
|
||||
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
SET( CPACK_STRIP_FILES TRUE )
|
||||
|
||||
# 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")
|
||||
@@ -462,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)
|
||||
|
||||
+19
-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));
|
||||
@@ -613,7 +613,10 @@ AppData::AppData()
|
||||
QStringList keys = settings20.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, settings20.value(*i));
|
||||
if (settings20.value(*i) != QString("") && settings20.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, settings20.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
@@ -629,7 +632,10 @@ AppData::AppData()
|
||||
QStringList keys = pre2016settings.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, pre2016settings.value(*i));
|
||||
if (pre2016settings.value(*i) != QString("") && pre2016settings.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, pre2016settings.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
@@ -731,7 +737,7 @@ 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 );
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
@@ -627,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>
|
||||
@@ -637,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>
|
||||
@@ -854,7 +854,7 @@ Mode 4:
|
||||
<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>
|
||||
@@ -874,14 +874,14 @@ 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="16" column="2" colspan="2">
|
||||
<widget class="QPushButton" name="libraryPathButton">
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
<string>Select Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -912,7 +912,17 @@ Mode 4:
|
||||
<string>Simulator Settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="5" column="4">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="joystickCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="joystickcalButton">
|
||||
<property name="text">
|
||||
<string>Calibrate</string>
|
||||
@@ -974,7 +984,7 @@ Mode 4:
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="snapshotClipboardCKB">
|
||||
<property name="text">
|
||||
<string>Only capture to clipboard</string>
|
||||
@@ -989,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>
|
||||
@@ -1055,9 +1042,15 @@ Mode 4:
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -1066,7 +1059,7 @@ Mode 4:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="simuSW">
|
||||
<property name="text">
|
||||
<string>Remember simulator switch values</string>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<file>icon.png</file>
|
||||
<file>../../CREDITS.txt</file>
|
||||
<file>../../DONATIONS.txt</file>
|
||||
<file>../../BLACKLIST.txt</file>
|
||||
<file>../releasenotes.txt</file>
|
||||
<file>images/9xdb.png</file>
|
||||
<file>images/9xdl.png</file>
|
||||
@@ -101,6 +100,8 @@
|
||||
<file>images/library/00018.png</file>
|
||||
<file>images/library/00019.png</file>
|
||||
<file>images/library/00020.png</file>
|
||||
<file>images/library/00021.png</file>
|
||||
<file>images/library/00022.png</file>
|
||||
<file>images/library/00050.png</file>
|
||||
<file>images/library/00051.png</file>
|
||||
<file>images/library/00052.png</file>
|
||||
|
||||
+58
-1031
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,9 @@
|
||||
#ifndef COMPAREDIALOG_H
|
||||
#define COMPAREDIALOG_H
|
||||
#ifndef _COMPAREDIALOG_H
|
||||
#define _COMPAREDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtGui>
|
||||
#include <QDir>
|
||||
#include "eeprominterface.h"
|
||||
#include "modelprinter.h"
|
||||
#include <QLabel>
|
||||
#include "multimodelprinter.h"
|
||||
|
||||
namespace Ui {
|
||||
class CompareDialog;
|
||||
@@ -13,84 +11,32 @@ namespace Ui {
|
||||
|
||||
class CompareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompareDialog(QWidget *parent, Firmware * firmware);
|
||||
~CompareDialog();
|
||||
Firmware * firmware;
|
||||
|
||||
protected:
|
||||
GeneralSettings * settings;
|
||||
ModelData g_model1;
|
||||
ModelData g_model2;
|
||||
MultiModelPrinter multimodelprinter;
|
||||
ModelData model1;
|
||||
ModelData model2;
|
||||
bool model1Valid;
|
||||
bool model2Valid;
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
Ui::CompareDialog *ui;
|
||||
template<class T> QString getColor1(T val1, T val2) {
|
||||
if (val1!=val2)
|
||||
return "green";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
template<class T> QString getColor2(T val1, T val2) {
|
||||
if (val1!=val2)
|
||||
return "red";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
QString getColor1(char * val1, char * val2) {
|
||||
if (strcmp(val1,val2)!=0)
|
||||
return "green";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
QString getColor2(char * val1, char * val2) {
|
||||
if (strcmp(val1,val2)!=0)
|
||||
return "red";
|
||||
else
|
||||
return "grey";
|
||||
}
|
||||
|
||||
bool ChannelHasExpo(ExpoData * expoArray, uint8_t destCh);
|
||||
bool ChannelHasMix(MixData * mixArray, uint8_t destCh);
|
||||
bool handleDroppedModel(const QMimeData * mimeData, ModelData * model, QLabel * label);
|
||||
void applyDiffFont(QString & v1, QString & v2, const QString & font = "", bool eqGrey = false);
|
||||
void diffAndAssembleTableLines(QStringList & i1, QStringList & i2, QString & o1, QString & o2);
|
||||
Ui::CompareDialog * ui;
|
||||
|
||||
QTextEdit * te;
|
||||
QString curvefile1;
|
||||
QString curvefile2;
|
||||
QDir *qd;
|
||||
|
||||
ModelPrinter modelPrinter1;
|
||||
ModelPrinter modelPrinter2;
|
||||
GeneralSettings dummySettings;
|
||||
|
||||
private slots:
|
||||
protected slots:
|
||||
void on_printButton_clicked();
|
||||
void on_printFileButton_clicked();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * event);
|
||||
bool handleDroppedModel(const QMimeData * mimeData, ModelData & model, QLabel * label);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void printDiff();
|
||||
void printSetup();
|
||||
void printPhases();
|
||||
void printLimits();
|
||||
void printInputs();
|
||||
void printMixers();
|
||||
void printCurves();
|
||||
void printGvars();
|
||||
void printLogicalSwitches();
|
||||
void printSafetySwitches();
|
||||
void printCustomFunctions();
|
||||
void printFrSky();
|
||||
};
|
||||
|
||||
#endif // COMPAREDIALOG_H
|
||||
#endif // _COMPAREDIALOG_H
|
||||
|
||||
@@ -8,6 +8,7 @@ enum BoardEnum {
|
||||
BOARD_GRUVIN9X,
|
||||
BOARD_SKY9X,
|
||||
BOARD_9XRPRO,
|
||||
BOARD_AR9X,
|
||||
BOARD_TARANIS,
|
||||
BOARD_TARANIS_PLUS,
|
||||
BOARD_TARANIS_X9E
|
||||
|
||||
@@ -63,12 +63,15 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
|
||||
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
|
||||
"</table>");
|
||||
|
||||
#if 0
|
||||
QFile blacklist(":/BLACKLIST.txt");
|
||||
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QStringList names;
|
||||
names << blacklist.readAll();
|
||||
str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
str.append("</body></html>");
|
||||
ui->textEditor->setHtml(str);
|
||||
ui->textEditor->scroll(0, 0);
|
||||
|
||||
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 ))
|
||||
|
||||
@@ -481,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("----");
|
||||
}
|
||||
@@ -528,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("----");
|
||||
}
|
||||
@@ -536,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));
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ QString CustomFunctionData::funcToString() const
|
||||
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)
|
||||
@@ -810,12 +810,24 @@ QString CustomFunctionData::funcToString() const
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFunctionData::populateResetParams(ModelData * model, QComboBox * b, unsigned int value = 0)
|
||||
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
|
||||
{
|
||||
int val = 0;
|
||||
Firmware * firmware = GetCurrentFirmware();
|
||||
@@ -858,12 +870,12 @@ void CustomFunctionData::populatePlaySoundParams(QStringList & qs)
|
||||
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
|
||||
}
|
||||
|
||||
void CustomFunctionData::populateHapticParams(QStringList & qs)
|
||||
void CustomFunctionData::populateHapticParams(QStringList & qs)
|
||||
{
|
||||
qs << "0" << "1" << "2" << "3";
|
||||
}
|
||||
|
||||
QString CustomFunctionData::paramToString(ModelData * model) const
|
||||
QString CustomFunctionData::paramToString(const ModelData * model) const
|
||||
{
|
||||
QStringList qs;
|
||||
if (func <= FuncInstantTrim) {
|
||||
@@ -892,12 +904,12 @@ QString CustomFunctionData::paramToString(ModelData * model) const
|
||||
int pos = cb.findData(param);
|
||||
if (pos >= 0)
|
||||
return cb.itemText(pos);
|
||||
else
|
||||
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)) {
|
||||
@@ -924,12 +936,15 @@ QString CustomFunctionData::paramToString(ModelData * model) const
|
||||
|
||||
QString CustomFunctionData::repeatToString() const
|
||||
{
|
||||
if (repeatParam==0) {
|
||||
if (repeatParam == -1) {
|
||||
return QObject::tr("played once, not during startup");
|
||||
}
|
||||
else if (repeatParam == 0) {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
return QObject::tr("repeat") + QString("(%1").arg(step*repeatParam) + QObject::tr("s") + ")";
|
||||
return QObject::tr("repeat(%1s)").arg(step*repeatParam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,17 +963,43 @@ QString CustomFunctionData::enabledToString() const
|
||||
return "";
|
||||
}
|
||||
|
||||
QString LimitData::minToString()
|
||||
CurveData::CurveData()
|
||||
{
|
||||
clear(5);
|
||||
}
|
||||
|
||||
void CurveData::clear(int count)
|
||||
{
|
||||
memset(this, 0, sizeof(CurveData));
|
||||
this->count = count;
|
||||
}
|
||||
|
||||
bool CurveData::isEmpty() const
|
||||
{
|
||||
for (int i=0; i<count; i++) {
|
||||
if (points[i].y != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString LimitData::minToString() const
|
||||
{
|
||||
return QString::number((qreal)min/10);
|
||||
}
|
||||
|
||||
QString LimitData::maxToString()
|
||||
QString LimitData::maxToString() const
|
||||
{
|
||||
return QString::number((qreal)max/10);
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString()
|
||||
QString LimitData::revertToString() const
|
||||
{
|
||||
return revert ? QObject::tr("INV") : QObject::tr("NOR");
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString() const
|
||||
{
|
||||
return QString::number((qreal)offset/10, 'f', 1);
|
||||
}
|
||||
@@ -1057,8 +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();
|
||||
@@ -1092,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;
|
||||
@@ -1262,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;
|
||||
@@ -1311,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();
|
||||
@@ -1341,7 +1432,7 @@ void ModelData::clear()
|
||||
sensorData[i].clear();
|
||||
}
|
||||
|
||||
bool ModelData::isempty()
|
||||
bool ModelData::isEmpty() const
|
||||
{
|
||||
return !used;
|
||||
}
|
||||
@@ -1529,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));
|
||||
@@ -1543,7 +1634,7 @@ void unregisterEEpromInterfaces()
|
||||
foreach(EEPROMInterface * intf, eepromInterfaces) {
|
||||
// qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast<uint64_t>(intf), 16 );
|
||||
delete intf;
|
||||
}
|
||||
}
|
||||
OpenTxEepromCleanup();
|
||||
}
|
||||
|
||||
@@ -1551,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)
|
||||
@@ -1608,6 +1773,8 @@ QString getBoardName(BoardEnum board)
|
||||
return "Sky9x";
|
||||
case BOARD_9XRPRO:
|
||||
return "9XR-PRO";
|
||||
case BOARD_AR9X:
|
||||
return "AR9X";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
+117
-65
@@ -24,6 +24,7 @@
|
||||
#include <QtXml>
|
||||
#include <QComboBox>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include "constants.h"
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
@@ -40,7 +41,7 @@ QString getBoardName(BoardEnum board);
|
||||
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
|
||||
#define IS_STOCK(board) (board==BOARD_STOCK)
|
||||
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
|
||||
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
|
||||
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO || board==BOARD_AR9X)
|
||||
#define IS_9XRPRO(board) (board==BOARD_9XRPRO)
|
||||
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
|
||||
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
|
||||
@@ -183,19 +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,
|
||||
@@ -445,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;
|
||||
@@ -468,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 {
|
||||
@@ -489,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();
|
||||
};
|
||||
|
||||
@@ -519,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];
|
||||
|
||||
@@ -609,6 +598,12 @@ enum AssignFunc {
|
||||
FuncBackgroundMusicPause,
|
||||
FuncAdjustGV1,
|
||||
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
|
||||
FuncSetFailsafeInternalModule,
|
||||
FuncSetFailsafeExternalModule,
|
||||
FuncRangeCheckInternalModule,
|
||||
FuncRangeCheckExternalModule,
|
||||
FuncBindInternalModule,
|
||||
FuncBindExternalModule,
|
||||
FuncCount,
|
||||
FuncReserve = -1
|
||||
};
|
||||
@@ -625,11 +620,11 @@ class CustomFunctionData { // Function Switches data
|
||||
int repeatParam;
|
||||
void clear();
|
||||
QString funcToString() const;
|
||||
QString paramToString(ModelData * model) const;
|
||||
QString paramToString(const ModelData * model) const;
|
||||
QString repeatToString() const;
|
||||
QString enabledToString() const;
|
||||
|
||||
static void populateResetParams(ModelData * model, QComboBox * b, unsigned int value);
|
||||
static void populateResetParams(const ModelData * model, QComboBox * b, unsigned int value);
|
||||
static void populatePlaySoundParams(QStringList & qs);
|
||||
static void populateHapticParams(QStringList & qs);
|
||||
|
||||
@@ -760,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(); }
|
||||
@@ -797,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];
|
||||
@@ -808,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 {
|
||||
@@ -847,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
|
||||
@@ -992,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];
|
||||
@@ -1042,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);
|
||||
@@ -1127,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;
|
||||
@@ -1175,7 +1201,6 @@ class GeneralSettings {
|
||||
int speakerVolume;
|
||||
unsigned int backlightBright;
|
||||
int switchesDelay;
|
||||
int currentCalib;
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
@@ -1276,7 +1301,6 @@ enum Capability {
|
||||
HasExpoNames,
|
||||
HasNoExpo,
|
||||
HasMixerNames,
|
||||
HasChNames,
|
||||
HasCvNames,
|
||||
HasPxxCountry,
|
||||
HasPPMStart,
|
||||
@@ -1306,7 +1330,7 @@ enum Capability {
|
||||
PPMCenter,
|
||||
PPMUnitMicroseconds,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
HastxCurrentCalibration,
|
||||
HasVolume,
|
||||
HasBrightness,
|
||||
PerModelTimers,
|
||||
@@ -1318,6 +1342,7 @@ enum Capability {
|
||||
LCDWidth,
|
||||
GetThrSwitch,
|
||||
HasDisplayText,
|
||||
HasTopLcd,
|
||||
GlobalFunctions,
|
||||
VirtualInputs,
|
||||
TrainerInputs,
|
||||
@@ -1337,7 +1362,8 @@ enum Capability {
|
||||
HasInputDiff,
|
||||
HasMixerExpo,
|
||||
MixersMonitor,
|
||||
HasBatMeterRange
|
||||
HasBatMeterRange,
|
||||
DangerousFunctions,
|
||||
};
|
||||
|
||||
class SimulatorInterface;
|
||||
@@ -1354,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;
|
||||
|
||||
@@ -1479,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;
|
||||
@@ -1577,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;
|
||||
|
||||
@@ -122,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
Executable → Regular
@@ -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));
|
||||
@@ -1702,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));
|
||||
@@ -1746,6 +1721,7 @@ class LogicalSwitchField: public TransformedField {
|
||||
{
|
||||
delete andswitchesConversionTable;
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
if (csw.func == LS_FN_TIMER) {
|
||||
@@ -1787,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) {
|
||||
@@ -1801,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) {
|
||||
@@ -1930,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++);
|
||||
@@ -2091,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));
|
||||
}
|
||||
@@ -2206,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);
|
||||
}
|
||||
@@ -2809,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;
|
||||
@@ -2820,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);
|
||||
}
|
||||
}
|
||||
@@ -2830,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;
|
||||
@@ -2843,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());
|
||||
@@ -2857,6 +2864,10 @@ class SensorField: public TransformedField {
|
||||
union {
|
||||
unsigned int _param;
|
||||
uint8_t _sources[4];
|
||||
struct {
|
||||
uint16_t _ratio;
|
||||
int16_t _offset;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2870,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);
|
||||
|
||||
@@ -3006,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));
|
||||
@@ -3148,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>());
|
||||
@@ -3156,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>());
|
||||
@@ -3165,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]));
|
||||
}
|
||||
}
|
||||
@@ -3184,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()
|
||||
@@ -3191,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);
|
||||
}
|
||||
@@ -3208,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);
|
||||
@@ -3224,15 +3238,15 @@ void OpenTxModelData::afterImport()
|
||||
}
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) {
|
||||
if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
|
||||
if (subprotocols[module] >= 0)
|
||||
modelData.moduleData[module].protocol += subprotocols[module];
|
||||
else
|
||||
modelData.moduleData[module].protocol = OFF;
|
||||
modelData.moduleData[module].protocol = PULSES_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != OFF) {
|
||||
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
|
||||
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
|
||||
}
|
||||
}
|
||||
@@ -3243,7 +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);
|
||||
|
||||
@@ -3280,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++)
|
||||
@@ -3364,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));
|
||||
@@ -3407,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>());
|
||||
@@ -3439,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;
|
||||
};
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@ const char * OpenTxEepromInterface::getName()
|
||||
return "OpenTX for Sky9x board / 9X";
|
||||
case BOARD_9XRPRO:
|
||||
return "OpenTX for 9XR-PRO";
|
||||
case BOARD_AR9X:
|
||||
return "OpenTX for ar9x board / 9X";
|
||||
default:
|
||||
return "OpenTX for an unknown board";
|
||||
}
|
||||
@@ -91,6 +93,7 @@ const int OpenTxEepromInterface::getEEpromSize()
|
||||
case BOARD_SKY9X:
|
||||
return EESIZE_SKY9X;
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_AR9X:
|
||||
return EESIZE_9XRPRO;
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_PLUS:
|
||||
@@ -304,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;
|
||||
@@ -323,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);
|
||||
@@ -345,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)
|
||||
@@ -381,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;
|
||||
@@ -414,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;
|
||||
@@ -441,18 +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;
|
||||
|
||||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255/*version max*/);
|
||||
|
||||
OpenTxModelData open9xModel(model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
|
||||
OpenTxModelData open9xModel((ModelData &)model, board, 255/*version max*/, GetCurrentFirmware()->getVariantNumber());
|
||||
|
||||
QByteArray eeprom;
|
||||
open9xModel.Export(eeprom);
|
||||
@@ -463,7 +484,7 @@ int OpenTxEepromInterface::getSize(ModelData &model)
|
||||
return efile->size(0);
|
||||
}
|
||||
|
||||
int OpenTxEepromInterface::getSize(GeneralSettings &settings)
|
||||
int OpenTxEepromInterface::getSize(const GeneralSettings & settings)
|
||||
{
|
||||
if (IS_SKY9X(board))
|
||||
return 0;
|
||||
@@ -471,7 +492,7 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
|
||||
QByteArray tmp(EESIZE_MAX, 0);
|
||||
efile->EeFsCreate((uint8_t *)tmp.data(), EESIZE_MAX, board, 255);
|
||||
|
||||
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmware()->getVariantNumber());
|
||||
OpenTxGeneralData open9xGeneral((GeneralSettings &)settings, board, 255, GetCurrentFirmware()->getVariantNumber());
|
||||
// open9xGeneral.Dump();
|
||||
|
||||
QByteArray eeprom;
|
||||
@@ -557,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;
|
||||
@@ -570,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:
|
||||
@@ -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,8 @@ 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:
|
||||
@@ -776,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;
|
||||
}
|
||||
@@ -793,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;
|
||||
@@ -826,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;
|
||||
@@ -840,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;
|
||||
@@ -854,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;
|
||||
@@ -866,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;
|
||||
@@ -885,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)
|
||||
@@ -987,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;
|
||||
@@ -1009,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];
|
||||
@@ -1024,29 +1043,38 @@ 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()
|
||||
@@ -1069,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:
|
||||
@@ -1111,7 +1140,8 @@ void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
|
||||
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
firmware->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
Option usb_options[] = { { "massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)") }, { "cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface") }, { NULL } };
|
||||
firmware->addOptions(usb_options);
|
||||
firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views"));
|
||||
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015"));
|
||||
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
|
||||
@@ -1329,6 +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"));
|
||||
@@ -1340,6 +1371,29 @@ void registerOpenTxFirmwares()
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* ar9x board */
|
||||
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("ar9x board / 9X"), BOARD_AR9X);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
firmware->addOption("nofp", QObject::tr("No flight modes"));
|
||||
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
|
||||
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
|
||||
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
|
||||
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
|
||||
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
|
||||
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
|
||||
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
|
||||
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
|
||||
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
|
||||
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
|
||||
firmware->addOption("battgraph", QObject::tr("Battery graph"));
|
||||
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
|
||||
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
|
||||
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
|
||||
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
|
||||
addOpenTxCommonOptions(firmware);
|
||||
firmwares.push_back(firmware);
|
||||
|
||||
/* 9XR-Pro */
|
||||
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO);
|
||||
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
|
||||
@@ -1349,6 +1403,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"));
|
||||
@@ -1383,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
|
||||
@@ -33,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);
|
||||
|
||||
@@ -112,7 +110,7 @@ class OpenTxFirmware: public Firmware {
|
||||
}
|
||||
|
||||
virtual Firmware * getFirmwareVariant(const QString & id);
|
||||
|
||||
|
||||
virtual QString getStampUrl();
|
||||
|
||||
virtual QString getReleaseNotesUrl();
|
||||
@@ -122,7 +120,9 @@ 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();
|
||||
@@ -130,5 +130,6 @@ class OpenTxFirmware: public Firmware {
|
||||
};
|
||||
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,10 +20,18 @@ add_custom_target(commondeps
|
||||
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${RADIO_SRC_DIRECTORY}/stamp-opentx.h)
|
||||
|
||||
add_custom_target(lua_exports
|
||||
make PCB=TARANIS lua_exports.inc
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
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
|
||||
@@ -43,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)
|
||||
@@ -75,6 +88,7 @@ add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
@@ -87,9 +101,10 @@ 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-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
|
||||
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
|
||||
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
|
||||
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
|
||||
@@ -100,6 +115,7 @@ set(OPENTX_LIBRARIES
|
||||
opentx-mega2560${SUFFIX}-simulator
|
||||
opentx-sky9x${SUFFIX}-simulator
|
||||
opentx-9xrpro${SUFFIX}-simulator
|
||||
opentx-ar9x${SUFFIX}-simulator
|
||||
opentx-taranis${SUFFIX}-simulator
|
||||
opentx-taranisplus${SUFFIX}-simulator
|
||||
opentx-taranisx9e${SUFFIX}-simulator
|
||||
@@ -149,6 +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})
|
||||
|
||||
@@ -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"
|
||||
@@ -232,7 +233,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/targets/taranis/pulses_driver.cpp"
|
||||
#include "radio/src/targets/taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/taranis/trainer_driver.cpp"
|
||||
#include "radio/src/targets/taranis/uart3_driver.cpp"
|
||||
#include "radio/src/targets/taranis/serial2_driver.cpp"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "radio/src/targets/sky9x/board_sky9x.cpp"
|
||||
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
|
||||
@@ -243,7 +244,7 @@ namespace NAMESPACE {
|
||||
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/coproc_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/haptic_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/second_serial_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/serial2_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pulses_driver.cpp"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
|
||||
@@ -259,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)
|
||||
@@ -277,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"
|
||||
@@ -308,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];
|
||||
@@ -488,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
+11
-9
@@ -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),
|
||||
@@ -104,7 +104,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
|
||||
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 {
|
||||
@@ -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
+2
-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);
|
||||
|
||||
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,424 +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();
|
||||
|
||||
setValues();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
/*void CalibrationPanel::update()
|
||||
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::on_PPM_MultiplierDSB_editingFinished()
|
||||
|
||||
void CalibrationPanel::setCalibrationValue(int row, int column, int value)
|
||||
{
|
||||
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
+93
-134
@@ -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,24 +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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void populateGvSourceCB(QComboBox *b, int value)
|
||||
{
|
||||
QString strings[] = { QObject::tr("---"), QObject::tr("Rud Trim"), QObject::tr("Ele Trim"), QObject::tr("Thr Trim"), QObject::tr("Ail Trim"), QObject::tr("Rot Enc"), QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
||||
@@ -106,20 +90,6 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
|
||||
}
|
||||
}
|
||||
|
||||
QString getProtocolStr(const int proto)
|
||||
{
|
||||
static const char *strings[] = { "OFF",
|
||||
"PPM",
|
||||
"Silverlit A", "Silverlit B", "Silverlit C",
|
||||
"CTP1009",
|
||||
"LP45", "DSM2", "DSMX",
|
||||
"PPM16", "PPMsim",
|
||||
"FrSky XJT - D16", "FrSky XJT - D8", "FrSky XJT - LR12", "FrSky DJT",
|
||||
};
|
||||
|
||||
return CHECK_IN_ARRAY(strings, proto);
|
||||
}
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value)
|
||||
{
|
||||
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||
@@ -205,7 +175,7 @@ void GVarGroup::valuesChanged()
|
||||
else if (sb)
|
||||
weight = sb->value();
|
||||
else
|
||||
weight = dsb->value()/step;
|
||||
weight = round(dsb->value()/step);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,106 +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 getCenterBeepStr(ModelData * g_model)
|
||||
{
|
||||
QStringList strl;
|
||||
if (g_model->beepANACenter & 0x01)
|
||||
strl << QObject::tr("Rudder");
|
||||
if (g_model->beepANACenter & 0x02)
|
||||
strl << QObject::tr("Elevator");
|
||||
if (g_model->beepANACenter & 0x04)
|
||||
strl << QObject::tr("Throttle");
|
||||
if (g_model->beepANACenter & 0x08)
|
||||
strl << QObject::tr("Aileron");
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "S1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "S2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "S3";
|
||||
if (g_model->beepANACenter & 0x80)
|
||||
strl << "LS";
|
||||
if (g_model->beepANACenter & 0x100)
|
||||
strl << "RS";
|
||||
}
|
||||
else {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "P1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "P2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "P3";
|
||||
}
|
||||
return strl.join(", ");
|
||||
}
|
||||
|
||||
QString getTheme()
|
||||
{
|
||||
int theme_set = g.theme();
|
||||
@@ -1018,7 +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('/');
|
||||
@@ -1127,3 +997,92 @@ QStringList extractLatLon(const QString & position)
|
||||
}
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
+59
-8
@@ -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];
|
||||
@@ -100,7 +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);
|
||||
|
||||
#define POPULATE_NONE (1<<0)
|
||||
#define POPULATE_SOURCES (1<<1)
|
||||
@@ -118,16 +120,9 @@ QString getProtocolStr(const int proto);
|
||||
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
|
||||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags);
|
||||
QString getPhaseName(int val, const char * phasename=NULL);
|
||||
QString image2qstring(QImage image);
|
||||
int findmult(float value, float base);
|
||||
|
||||
QString getTrimInc(ModelData * g_model);
|
||||
QString getTimerStr(TimerData & timer);
|
||||
QString getProtocol(ModuleData & module);
|
||||
QString getTrainerMode(const int trainermode, ModuleData & module);
|
||||
QString getCenterBeepStr(ModelData * g_model);
|
||||
|
||||
/* FrSky helpers */
|
||||
QString getFrSkyAlarmType(int alarm);
|
||||
QString getFrSkyUnits(int units);
|
||||
@@ -209,4 +204,60 @@ 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>
|
||||
|
||||
@@ -115,12 +115,12 @@ 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()));
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,17 +292,14 @@ 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(COMPANION_INSTALLER).arg(version));
|
||||
#else
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_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("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(QString(COMPANION_INSTALLER).arg(version)), fileName);
|
||||
@@ -313,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) {
|
||||
@@ -539,19 +536,19 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
|
||||
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::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::information(this, tr("Companion"), tr("The icon size will be used the next time you start Companion."));
|
||||
}
|
||||
@@ -667,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()
|
||||
@@ -757,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");
|
||||
@@ -914,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);
|
||||
@@ -956,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);
|
||||
@@ -977,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;
|
||||
}
|
||||
|
||||
@@ -1011,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()));
|
||||
@@ -1066,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);
|
||||
@@ -1112,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);
|
||||
@@ -1150,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);
|
||||
}
|
||||
@@ -1167,7 +1170,7 @@ void MainWindow::createMenus()
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(contributorsAct);
|
||||
}
|
||||
|
||||
|
||||
QMenu *MainWindow::createRecentFileMenu()
|
||||
{
|
||||
QMenu *recentFileMenu = new QMenu(this);
|
||||
@@ -1208,7 +1211,7 @@ void MainWindow::createToolBars()
|
||||
break;
|
||||
default:
|
||||
size=QSize(24,24);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
fileToolBar = addToolBar(tr("File"));
|
||||
fileToolBar->setIconSize(size);
|
||||
@@ -1254,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);
|
||||
@@ -1311,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);
|
||||
@@ -1319,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())
|
||||
@@ -1346,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()
|
||||
@@ -1390,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);
|
||||
@@ -1400,8 +1403,8 @@ void MainWindow::updateProfilesActions()
|
||||
profileActs[i]->setVisible(true);
|
||||
if (i == g.id())
|
||||
profileActs[i]->setChecked(true);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
profileActs[i]->setVisible(false);
|
||||
}
|
||||
@@ -1415,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"));
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
+129
-107
@@ -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
|
||||
@@ -294,12 +300,14 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
|
||||
|
||||
file.close();
|
||||
|
||||
if (!loadEEprom(radioData, (uint8_t *)eeprom.data(), 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,14 +51,7 @@ 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 = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
|
||||
@@ -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()
|
||||
@@ -383,13 +400,16 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
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);
|
||||
@@ -516,15 +536,8 @@ void CustomFunctionsPanel::update()
|
||||
lock = true;
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
if (!initialized) {
|
||||
populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], functions[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
|
||||
}
|
||||
refreshCustomFunction(i);
|
||||
}
|
||||
initialized = true;
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -604,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
|
||||
|
||||
@@ -66,7 +66,6 @@ class CustomFunctionsPanel : public GenericPanel
|
||||
void populateGVmodeCB(QComboBox *b, unsigned int value);
|
||||
void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||
|
||||
bool initialized;
|
||||
QSet<QString> tracksSet;
|
||||
QSet<QString> scriptsSet;
|
||||
int phononCurrent;
|
||||
|
||||
@@ -11,7 +11,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
firmware(firmware),
|
||||
ed(expoData),
|
||||
inputName(inputName),
|
||||
modelPrinter(firmware, &generalSettings, &model)
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||
@@ -33,7 +33,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
ui->offsetCB->hide();
|
||||
}
|
||||
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
|
||||
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
||||
|
||||
@@ -47,14 +48,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
}
|
||||
}
|
||||
else {
|
||||
int mask=1;
|
||||
for (int i=0; i<9 ; i++) {
|
||||
if ((ed->phases & mask)==0) {
|
||||
int mask = 1;
|
||||
for (int i=0; i<9; i++) {
|
||||
if ((ed->flightModes & mask) == 0) {
|
||||
cb_fp[i]->setChecked(true);
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
|
||||
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
@@ -62,7 +63,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
ui->inputName->setMaxLength(4);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES |
|
||||
POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
ui->sourceCB->removeItem(0);
|
||||
ui->inputName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->inputName->setText(inputName);
|
||||
@@ -76,10 +78,9 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
|
||||
ui->trimCB->addItem(tr("Rud"), 1);
|
||||
ui->trimCB->addItem(tr("Ele"), 2);
|
||||
ui->trimCB->addItem(tr("Thr"), 3);
|
||||
ui->trimCB->addItem(tr("Ail"), 4);
|
||||
for(int i=0; i < NUM_STICKS; i++) {
|
||||
ui->trimCB->addItem(AnalogString(i), i+1);
|
||||
}
|
||||
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
||||
|
||||
int expolength = firmware->getCapability(HasExpoNames);
|
||||
@@ -139,67 +140,68 @@ void ExpoDialog::updateScale()
|
||||
|
||||
void ExpoDialog::valuesChanged()
|
||||
{
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
||||
|
||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||
if (firmware->getCapability(VirtualInputs)) {
|
||||
inputName = ui->inputName->text();
|
||||
}
|
||||
|
||||
ed->flightModes = 0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
ed->flightModes++;
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
||||
|
||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
inputName = ui->inputName->text();
|
||||
|
||||
ed->phases=0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
ed->phases+=1;
|
||||
ed->flightModes <<= 1;
|
||||
}
|
||||
ed->flightModes >>= 1;
|
||||
if (firmware->getCapability(FlightModes)) {
|
||||
int zeros = 0;
|
||||
int ones = 0;
|
||||
int phtemp = ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
ones++;
|
||||
}
|
||||
ed->phases<<=1;
|
||||
else {
|
||||
zeros++;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
ed->phases>>=1;
|
||||
if (firmware->getCapability(FlightModes)) {
|
||||
int zeros=0;
|
||||
int ones=0;
|
||||
int phtemp=ed->phases;
|
||||
if (zeros == 1) {
|
||||
phtemp=ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if ((phtemp & 1) == 0) {
|
||||
break;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
}
|
||||
else if (ones == 1) {
|
||||
phtemp = ed->flightModes;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
ones++;
|
||||
}
|
||||
else {
|
||||
zeros++;
|
||||
}
|
||||
phtemp >>=1;
|
||||
}
|
||||
if (zeros==1) {
|
||||
phtemp=ed->phases;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if ((phtemp & 1)==0) {
|
||||
break;
|
||||
}
|
||||
phtemp >>=1;
|
||||
}
|
||||
}
|
||||
else if (ones==1) {
|
||||
phtemp=ed->phases;
|
||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||
if (phtemp & 1) {
|
||||
break;
|
||||
}
|
||||
phtemp >>=1;
|
||||
break;
|
||||
}
|
||||
phtemp >>= 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ed->phases=0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ed->flightModes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ExpoDialog::shrink()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
expoInserted(false),
|
||||
modelPrinter(firmware, &generalSettings, &model)
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
inputsCount = firmware->getCapability(VirtualInputs);
|
||||
if (inputsCount == 0)
|
||||
@@ -140,14 +140,14 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
||||
if (new_ch) *new_ch = 1;
|
||||
}
|
||||
else {
|
||||
ExpoData *md = &model->expoData[dest];
|
||||
ExpoData & input = model->expoData[dest];
|
||||
|
||||
if ((dest == 0) || (model->expoData[dest-1].chn != md->chn)) {
|
||||
if ((dest == 0) || (model->expoData[dest-1].chn != input.chn)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
str += QString("%1").arg(modelPrinter.printInputName(md->chn), -10, ' ');
|
||||
str += QString("%1").arg(modelPrinter.printInputName(input.chn), -10, ' ');
|
||||
else
|
||||
str = modelPrinter.printInputName(md->chn);
|
||||
str = modelPrinter.printInputName(input.chn);
|
||||
}
|
||||
else {
|
||||
if (firmware->getCapability(VirtualInputs))
|
||||
@@ -156,7 +156,7 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
||||
str = " ";
|
||||
}
|
||||
str.replace(" ", " ");
|
||||
str += modelPrinter.printInputLine(md);
|
||||
str += modelPrinter.printInputLine(input);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+223
-220
@@ -7,7 +7,7 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
mixInserted(false),
|
||||
highlightedSource(0),
|
||||
modelPrinter(firmware, &generalSettings, &model)
|
||||
modelPrinter(firmware, generalSettings, model)
|
||||
{
|
||||
QGridLayout * mixesLayout = new QGridLayout(this);
|
||||
|
||||
@@ -48,19 +48,17 @@ void MixesPanel::update()
|
||||
{
|
||||
// curDest -> destination channel
|
||||
// i -> mixer number
|
||||
QByteArray qba;
|
||||
MixerlistWidget->clear();
|
||||
firstLine = true;
|
||||
unsigned int curDest = 0;
|
||||
int i;
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
|
||||
for (i=0; i<firmware->getCapability(Mixes); i++) {
|
||||
MixData *md = &model->mixData[i];
|
||||
// qDebug() << "md->destCh: " << md->destCh;
|
||||
if (md->destCh==0 || md->destCh>outputs) continue;
|
||||
for (int i=0; i<firmware->getCapability(Mixes); i++) {
|
||||
MixData & mix = model->mixData[i];
|
||||
// qDebug() << "mix.destCh: " << mix.destCh;
|
||||
if (mix.destCh == 0 || mix.destCh>outputs) continue;
|
||||
QString str = "";
|
||||
while (curDest < md->destCh-1) {
|
||||
while (curDest < mix.destCh-1) {
|
||||
curDest++;
|
||||
AddMixerLine(-curDest);
|
||||
}
|
||||
@@ -123,24 +121,24 @@ bool MixesPanel::AddMixerLine(int dest)
|
||||
QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
{
|
||||
QString str;
|
||||
if (new_ch) *new_ch = 0;
|
||||
bool newChannel = false;
|
||||
if (dest < 0) {
|
||||
str = modelPrinter.printMixerName(-dest);
|
||||
//highlight channel if needed
|
||||
if (-dest == (int)highlightedSource) {
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
if (new_ch) *new_ch = 1;
|
||||
newChannel = true;
|
||||
}
|
||||
else {
|
||||
MixData *md = &model->mixData[dest];
|
||||
//md->destCh from 1 to 32
|
||||
str = modelPrinter.printMixerName(md->destCh);
|
||||
MixData & mix = model->mixData[dest];
|
||||
//mix->destCh from 1 to 32
|
||||
str = modelPrinter.printMixerName(mix.destCh);
|
||||
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != md->destCh)) {
|
||||
if (new_ch) *new_ch = 1;
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
|
||||
newChannel = true;
|
||||
//highlight channel if needed
|
||||
if (md->destCh == highlightedSource) {
|
||||
if (mix.destCh == highlightedSource) {
|
||||
str = "<b>" + str + "</b>";
|
||||
}
|
||||
}
|
||||
@@ -148,153 +146,155 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
str.fill(' ');
|
||||
}
|
||||
|
||||
str += modelPrinter.printMixerLine(md, highlightedSource);
|
||||
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
|
||||
}
|
||||
if (new_ch) *new_ch = newChannel;
|
||||
return str.replace(" ", " ");
|
||||
}
|
||||
|
||||
bool MixesPanel::gm_insertMix(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
if (idx < 0 || idx >= firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = model->mixData[idx].destCh;
|
||||
memmove(&model->mixData[idx+1],&model->mixData[idx],
|
||||
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
|
||||
memset(&model->mixData[idx],0,sizeof(MixData));
|
||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model->mixData[idx].destCh = i;
|
||||
model->mixData[idx].weight = 100;
|
||||
return true;
|
||||
int i = model->mixData[idx].destCh;
|
||||
memmove(&model->mixData[idx+1], &model->mixData[idx],
|
||||
(firmware->getCapability(Mixes)-(idx+1)) * sizeof(MixData) );
|
||||
memset(&model->mixData[idx], 0, sizeof(MixData));
|
||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
model->mixData[idx].destCh = i;
|
||||
model->mixData[idx].weight = 100;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MixesPanel::gm_deleteMix(int index)
|
||||
{
|
||||
memmove(&model->mixData[index],&model->mixData[index+1],
|
||||
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
|
||||
memset(&model->mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
|
||||
memmove(&model->mixData[index], &model->mixData[index+1],
|
||||
(firmware->getCapability(Mixes)-(index+1)) * sizeof(MixData));
|
||||
memset(&model->mixData[firmware->getCapability(Mixes)-1], 0, sizeof(MixData));
|
||||
}
|
||||
|
||||
void MixesPanel::gm_openMix(int index)
|
||||
{
|
||||
if(index<0 || index>=firmware->getCapability(Mixes)) return;
|
||||
if(index < 0 || index>=firmware->getCapability(Mixes)) return;
|
||||
|
||||
MixData mixd(model->mixData[index]);
|
||||
MixData mixd(model->mixData[index]);
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||
if(g->exec()) {
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||
if(g->exec()) {
|
||||
model->mixData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
} else {
|
||||
if (mixInserted) {
|
||||
gm_deleteMix(index);
|
||||
}
|
||||
mixInserted=false;
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
else {
|
||||
if (mixInserted) {
|
||||
gm_deleteMix(index);
|
||||
}
|
||||
mixInserted = false;
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
int MixesPanel::getMixerIndex(unsigned int dch)
|
||||
{
|
||||
int i = 0;
|
||||
while ((model->mixData[i].destCh<=dch) && (model->mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
|
||||
if(i==firmware->getCapability(Mixes)) return -1;
|
||||
return i;
|
||||
int i = 0;
|
||||
while ((model->mixData[i].destCh <= dch) && (model->mixData[i].destCh) && (i < firmware->getCapability(Mixes))) i++;
|
||||
if (i == firmware->getCapability(Mixes)) return -1;
|
||||
return i;
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
||||
{
|
||||
int idx= MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
}
|
||||
gm_openMix(idx);
|
||||
int idx = MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
gm_openMix(idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixersDeleteList(QList<int> list)
|
||||
{
|
||||
qSort(list.begin(), list.end());
|
||||
qSort(list.begin(), list.end());
|
||||
|
||||
int iDec = 0;
|
||||
foreach(int idx, list) {
|
||||
gm_deleteMix(idx-iDec);
|
||||
iDec++;
|
||||
}
|
||||
int iDec = 0;
|
||||
foreach(int idx, list) {
|
||||
gm_deleteMix(idx - iDec);
|
||||
iDec++;
|
||||
}
|
||||
}
|
||||
|
||||
QList<int> MixesPanel::createMixListFromSelected()
|
||||
{
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx>=0 && idx<firmware->getCapability(Mixes)) list << idx;
|
||||
}
|
||||
return list;
|
||||
QList<int> list;
|
||||
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx >= 0 && idx<firmware->getCapability(Mixes)) list << idx;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// TODO duplicated code
|
||||
void MixesPanel::setSelectedByMixList(QList<int> list)
|
||||
{
|
||||
for(int i=0; i<MixerlistWidget->count(); i++) {
|
||||
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(list.contains(t))
|
||||
MixerlistWidget->item(i)->setSelected(true);
|
||||
for(int i=0; i<MixerlistWidget->count(); i++) {
|
||||
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(list.contains(t)) {
|
||||
MixerlistWidget->item(i)->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MixesPanel::mixersDelete(bool ask)
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
if(list.isEmpty()) return;
|
||||
QList<int> list = createMixListFromSelected();
|
||||
if(list.isEmpty()) return;
|
||||
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
|
||||
if(ask)
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Mixes?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(ask) {
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Mixes?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
}
|
||||
|
||||
|
||||
if ((ret == QMessageBox::Yes) || (!ask)) {
|
||||
mixersDeleteList(list);
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
if ((ret == QMessageBox::Yes) || (!ask)) {
|
||||
mixersDeleteList(list);
|
||||
emit modified();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void MixesPanel::mixersCut()
|
||||
{
|
||||
mixersCopy();
|
||||
mixersDelete(false);
|
||||
mixersCopy();
|
||||
mixersDelete(false);
|
||||
}
|
||||
|
||||
void MixesPanel::mixersCopy()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model->mixData[idx], sizeof(MixData));
|
||||
}
|
||||
|
||||
QByteArray mxData;
|
||||
foreach(int idx, list) {
|
||||
mxData.append((char*)&model->mixData[idx],sizeof(MixData));
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-mix", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion-mix", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
@@ -303,10 +303,11 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
int idx; // mixer index
|
||||
int dch;
|
||||
|
||||
if(destIdx<0) {
|
||||
if (destIdx < 0) {
|
||||
dch = -destIdx;
|
||||
idx = getMixerIndex(dch) - 1; //get mixer index to insert
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
idx = destIdx;
|
||||
dch = model->mixData[idx].destCh;
|
||||
}
|
||||
@@ -314,14 +315,13 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
QByteArray mxData = mimeData->data("application/x-companion-mix");
|
||||
|
||||
int i = 0;
|
||||
while(i<mxData.size()) {
|
||||
while (i < mxData.size()) {
|
||||
idx++;
|
||||
if(idx==firmware->getCapability(Mixes)) break;
|
||||
if (idx == firmware->getCapability(Mixes)) break;
|
||||
if (!gm_insertMix(idx)) break;
|
||||
|
||||
if (!gm_insertMix(idx))
|
||||
break;
|
||||
MixData *md = &model->mixData[idx];
|
||||
memcpy(md,mxData.mid(i,sizeof(MixData)).constData(),sizeof(MixData));
|
||||
MixData * md = &model->mixData[idx];
|
||||
memcpy(md, mxData.mid(i, sizeof(MixData)).constData(), sizeof(MixData));
|
||||
md->destCh = dch;
|
||||
i += sizeof(MixData);
|
||||
}
|
||||
@@ -334,34 +334,35 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
|
||||
void MixesPanel::mixersPaste()
|
||||
{
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
QListWidgetItem *item = MixerlistWidget->currentItem();
|
||||
if (item)
|
||||
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
QListWidgetItem *item = MixerlistWidget->currentItem();
|
||||
if (item) {
|
||||
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
||||
}
|
||||
}
|
||||
|
||||
void MixesPanel::mixersDuplicate()
|
||||
{
|
||||
mixersCopy();
|
||||
mixersPaste();
|
||||
mixersCopy();
|
||||
mixersPaste();
|
||||
}
|
||||
|
||||
void MixesPanel::mixerOpen()
|
||||
{
|
||||
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx<0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx))
|
||||
return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
mixInserted=false;
|
||||
}
|
||||
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if(idx < 0) {
|
||||
int i = -idx;
|
||||
idx = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(idx)) return;
|
||||
model->mixData[idx].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
mixInserted = false;
|
||||
}
|
||||
|
||||
gm_openMix(idx);
|
||||
gm_openMix(idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixerHighlight()
|
||||
@@ -384,135 +385,137 @@ void MixesPanel::mixerHighlight()
|
||||
|
||||
void MixesPanel::mixerAdd()
|
||||
{
|
||||
if (!MixerlistWidget->currentItem())
|
||||
return;
|
||||
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
if (!MixerlistWidget->currentItem()) return;
|
||||
|
||||
if(index<0) { // if empty then return relavent index
|
||||
int i = -index;
|
||||
index = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted=true;
|
||||
} else {
|
||||
index++;
|
||||
if (!gm_insertMix(index))
|
||||
return;
|
||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||
mixInserted=true;
|
||||
}
|
||||
gm_openMix(index);
|
||||
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||
|
||||
if(index < 0) { // if empty then return relavent index
|
||||
int i = -index;
|
||||
index = getMixerIndex(i); //get mixer index to insert
|
||||
if (!gm_insertMix(index)) return;
|
||||
model->mixData[index].destCh = i;
|
||||
mixInserted = true;
|
||||
}
|
||||
else {
|
||||
index++;
|
||||
if (!gm_insertMix(index)) return;
|
||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||
mixInserted = true;
|
||||
}
|
||||
gm_openMix(index);
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"),this,SLOT(mixerHighlight()),tr("Ctrl+T"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"), this, SLOT(mixerAdd()), tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(mixerOpen()), tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"), this, SLOT(mixerHighlight()), tr("Ctrl+T"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"), this, SLOT(mixersDelete()), tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"), this, SLOT(mixersCopy()), tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"), this, SLOT(mixersCut()), tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"), this, SLOT(mixersPaste()), tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(mixersDuplicate()), tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(moveMixUp()), tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveMixDown()), tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
|
||||
{
|
||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
pasteMixerMimeData(data, idx);
|
||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||
pasteMixerMimeData(data, idx);
|
||||
}
|
||||
|
||||
void MixesPanel::mixesEdited()
|
||||
{
|
||||
emit modified();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
|
||||
{
|
||||
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
||||
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
||||
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
||||
if(event->matches(QKeySequence::Cut)) mixersCut();
|
||||
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
||||
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
||||
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
||||
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
||||
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
||||
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
||||
if(event->matches(QKeySequence::Cut)) mixersCut();
|
||||
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
||||
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
||||
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
||||
|
||||
if(event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) mixerOpen();
|
||||
if(event->matches(QKeySequence::MoveToNextLine))
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
||||
if(event->matches(QKeySequence::MoveToPreviousLine))
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
||||
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) mixerOpen();
|
||||
|
||||
if(event->matches(QKeySequence::MoveToNextLine)) {
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
||||
}
|
||||
if(event->matches(QKeySequence::MoveToPreviousLine)) {
|
||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
||||
}
|
||||
}
|
||||
|
||||
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
||||
{
|
||||
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
|
||||
if(idx > firmware->getCapability(Mixes) || (idx == firmware->getCapability(Mixes) && dir)) return idx;
|
||||
|
||||
MixData &src=model->mixData[idx];
|
||||
MixData &src=model->mixData[idx];
|
||||
|
||||
if (idx==0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
if (src.destCh > 1) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
if (idx == 0 && !dir) {
|
||||
//special case: topmost mixer moving up
|
||||
if (src.destCh > 1) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
MixData &tgt=model->mixData[tdx];
|
||||
int tdx = dir ? idx+1 : idx-1;
|
||||
MixData & tgt = model->mixData[tdx];
|
||||
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
|
||||
unsigned int outputs = firmware->getCapability(Outputs);
|
||||
if(src.destCh == 0 || src.destCh > outputs || tgt.destCh > outputs) return idx;
|
||||
|
||||
if (tgt.destCh!=src.destCh) {
|
||||
if ((dir) && (src.destCh<outputs)) src.destCh++;
|
||||
if ((!dir) && (src.destCh>0)) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
if (tgt.destCh != src.destCh) {
|
||||
if (dir && src.destCh < outputs) src.destCh++;
|
||||
if (!dir && src.destCh > 0) src.destCh--;
|
||||
return idx;
|
||||
}
|
||||
|
||||
//flip between idx and tgt
|
||||
MixData temp;
|
||||
memcpy(&temp,&src,sizeof(MixData));
|
||||
memcpy(&src,&tgt,sizeof(MixData));
|
||||
memcpy(&tgt,&temp,sizeof(MixData));
|
||||
return tdx;
|
||||
//flip between idx and tgt
|
||||
MixData temp;
|
||||
memcpy(&temp, &src, sizeof(MixData));
|
||||
memcpy(&src, &tgt, sizeof(MixData));
|
||||
memcpy(&tgt, &temp, sizeof(MixData));
|
||||
return tdx;
|
||||
}
|
||||
|
||||
void MixesPanel::moveMixUp()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, false);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, false);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
}
|
||||
|
||||
void MixesPanel::moveMixDown()
|
||||
{
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, true);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
QList<int> list = createMixListFromSelected();
|
||||
QList<int> highlightList;
|
||||
foreach(int idx, list) {
|
||||
highlightList << gm_moveMix(idx, true);
|
||||
}
|
||||
emit modified();
|
||||
update();
|
||||
setSelectedByMixList(highlightList);
|
||||
}
|
||||
|
||||
void MixesPanel::clearMixes()
|
||||
|
||||
@@ -23,6 +23,9 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
||||
generalSettings(radioData.generalSettings),
|
||||
firmware(firmware)
|
||||
{
|
||||
Stopwatch s1("ModelEdit");
|
||||
gStopwatch.report("ModelEdit start constructor");
|
||||
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("edit.png"));
|
||||
restoreGeometry(g.modelEditGeo());
|
||||
@@ -33,16 +36,23 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
|
||||
addTab(new HeliPanel(this, model, generalSettings, firmware), tr("Heli"));
|
||||
addTab(new FlightModesPanel(this, model, generalSettings, firmware), tr("Flight Modes"));
|
||||
addTab(new InputsPanel(this, model, generalSettings, firmware), tr("Inputs"));
|
||||
s1.report("inputs");
|
||||
addTab(new MixesPanel(this, model, generalSettings, firmware), tr("Mixes"));
|
||||
s1.report("Mixes");
|
||||
Channels * chnPanel = new Channels(this, model, generalSettings, firmware);
|
||||
addTab(chnPanel, tr("Outputs"));
|
||||
s1.report("Outputs");
|
||||
addTab(new Curves(this, model, generalSettings, firmware), tr("Curves"));
|
||||
addTab(new LogicalSwitchesPanel(this, model, generalSettings, firmware), tr("Logical Switches"));
|
||||
s1.report("LS");
|
||||
addTab(new CustomFunctionsPanel(this, &model, generalSettings, firmware), tr("Special Functions"));
|
||||
s1.report("CF");
|
||||
if (firmware->getCapability(Telemetry) & TM_HASTELEMETRY)
|
||||
addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry"));
|
||||
|
||||
connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits()));
|
||||
s1.report("end");
|
||||
gStopwatch.report("ModelEdit end constructor");
|
||||
}
|
||||
|
||||
ModelEdit::~ModelEdit()
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
#include "ui_setup_module.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "modelprinter.h"
|
||||
|
||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget *prevFocus):
|
||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware, QWidget * prevFocus):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
timer(timer),
|
||||
ui(new Ui::Timer)
|
||||
@@ -35,10 +36,11 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
}
|
||||
|
||||
ui->countdownBeep->setField(timer.countdownBeep, this);
|
||||
ui->countdownBeep->addItem(tr("Silent"), 0);
|
||||
ui->countdownBeep->addItem(tr("Beeps"), 1);
|
||||
ui->countdownBeep->addItem(tr("Silent"), TimerData::COUNTDOWN_SILENT);
|
||||
ui->countdownBeep->addItem(tr("Beeps"), TimerData::COUNTDOWN_BEEPS);
|
||||
if (IS_ARM(board) || IS_2560(board)) {
|
||||
ui->countdownBeep->addItem(tr("Voice"), 2);
|
||||
ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE);
|
||||
ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC);
|
||||
}
|
||||
|
||||
ui->persistent->setField(timer.persistent, this);
|
||||
@@ -135,6 +137,9 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
||||
QString label;
|
||||
if (moduleIdx < 0) {
|
||||
label = tr("Trainer Port");
|
||||
if (generalSettings.hw_uartMode != UART_MODE_SBUS_TRAINER) {
|
||||
ui->trainerMode->setItemData(TRAINER_MODE_MASTER_BATTERY_COMPARTMENT, 0, Qt::UserRole - 1);
|
||||
}
|
||||
ui->trainerMode->setCurrentIndex(model.trainerMode);
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
ui->label_trainerMode->hide();
|
||||
@@ -165,9 +170,9 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
||||
ui->label_module->setText(label);
|
||||
|
||||
// The protocols available on this board
|
||||
for (int i=0; i<PROTO_LAST; i++) {
|
||||
if (GetEepromInterface()->isAvailable((Protocol)i, moduleIdx)) {
|
||||
ui->protocol->addItem(getProtocolStr(i), (QVariant)i);
|
||||
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
|
||||
if (firmware->isAvailable((PulsesProtocol)i, moduleIdx)) {
|
||||
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
|
||||
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
|
||||
}
|
||||
}
|
||||
@@ -188,12 +193,12 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
||||
spinbox->setDecimals(1);
|
||||
label->setProperty("index", i);
|
||||
spinbox->setProperty("index", i);
|
||||
failsafeSpins << spinbox;
|
||||
ui->failsafesLayout->addWidget(label, 3*(i/8), i%8, Qt::AlignHCenter);
|
||||
ui->failsafesLayout->addWidget(combo, 1+3*(i/8), i%8, Qt::AlignHCenter);
|
||||
ui->failsafesLayout->addWidget(spinbox, 2+3*(i/8), i%8, Qt::AlignHCenter);
|
||||
failsafeGroups[i].combo = combo;
|
||||
failsafeGroups[i].spinbox = spinbox;
|
||||
failsafeGroups[i].label = label;
|
||||
updateFailsafe(i);
|
||||
connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(onFailsafeComboIndexChanged(int)));
|
||||
connect(spinbox, SIGNAL(valueChanged(double)), this, SLOT(onFailsafeSpinChanged(double)));
|
||||
@@ -221,50 +226,48 @@ ModulePanel::~ModulePanel()
|
||||
void ModulePanel::update()
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
Protocol protocol = (Protocol)module.protocol;
|
||||
PulsesProtocol protocol = (PulsesProtocol)module.protocol;
|
||||
unsigned int max_rx_num = 63;
|
||||
|
||||
if (moduleIdx >= 0) {
|
||||
mask |= MASK_PROTOCOL;
|
||||
switch (protocol) {
|
||||
case PXX_XJT_X16:
|
||||
case PXX_XJT_D8:
|
||||
case PXX_XJT_LR12:
|
||||
case PXX_DJT:
|
||||
case PULSES_PXX_XJT_X16:
|
||||
case PULSES_PXX_XJT_D8:
|
||||
case PULSES_PXX_XJT_LR12:
|
||||
case PULSES_PXX_DJT:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
if ((protocol==PXX_XJT_X16) || (protocol==PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
|
||||
if (protocol==PULSES_PXX_XJT_X16) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
|
||||
if (protocol==PULSES_PXX_XJT_LR12) mask |= MASK_RX_NUMBER;
|
||||
break;
|
||||
case LP45:
|
||||
case DSM2:
|
||||
case DSMX:
|
||||
case PULSES_LP45:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_DSMX:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER;
|
||||
module.channelsCount = 6;
|
||||
max_rx_num = 20;
|
||||
break;
|
||||
case PPM:
|
||||
case PULSES_CROSSFIRE:
|
||||
mask |= MASK_CHANNELS_RANGE;
|
||||
module.channelsCount = 16;
|
||||
break;
|
||||
case PULSES_PPM:
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
|
||||
if (IS_9XRPRO(firmware->getBoard())) {
|
||||
mask |= MASK_OPEN_DRAIN;
|
||||
}
|
||||
break;
|
||||
case OFF:
|
||||
case PULSES_OFF:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS(firmware->getBoard())) {
|
||||
switch(model->trainerMode) {
|
||||
case MASTER_JACK:
|
||||
break;
|
||||
case SLAVE_JACK:
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
break;
|
||||
default:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
break;
|
||||
if (model->trainerMode == TRAINER_SLAVE_JACK) {
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
}
|
||||
}
|
||||
else if (model->trainerMode != MASTER_JACK) {
|
||||
else if (model->trainerMode != TRAINER_MASTER_JACK) {
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
|
||||
}
|
||||
|
||||
@@ -304,6 +307,17 @@ void ModulePanel::update()
|
||||
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
|
||||
ui->failsafesFrame->setEnabled(module.failsafeMode == FAILSAFE_CUSTOM);
|
||||
if (firmware->getCapability(ChannelsName) > 0) {
|
||||
for(int i=0; i<maxChannels;i++) {
|
||||
QString name = QString(model->limitData[i+module.channelsStart].name).trimmed();
|
||||
if (!name.isEmpty()) {
|
||||
failsafeGroups[i].label->setText(name);
|
||||
}
|
||||
else {
|
||||
failsafeGroups[i].label->setText(QString::number(i+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
mask = 0;
|
||||
@@ -311,6 +325,11 @@ void ModulePanel::update()
|
||||
|
||||
ui->failsafesLayoutLabel->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
|
||||
|
||||
if (mask & MASK_CHANNELS_RANGE) {
|
||||
ui->channelsStart->setMaximum(32 - ui->channelsCount->value());
|
||||
ui->channelsCount->setMaximum(qMin(16, 32-ui->channelsStart->value()));
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::on_trainerMode_currentIndexChanged(int index)
|
||||
@@ -514,6 +533,19 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||
}
|
||||
}
|
||||
|
||||
if (firmware->getCapability(HasTopLcd)) {
|
||||
ui->toplcdTimer->setField(model.toplcdTimer, this);
|
||||
for (int i=0; i<C9X_MAX_TIMERS; i++) {
|
||||
if (i<firmware->getCapability(Timers)) {
|
||||
ui->toplcdTimer->addItem(tr("Timer %1").arg(i+1), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->toplcdTimerLabel->hide();
|
||||
ui->toplcdTimer->hide();
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(HasDisplayText)) {
|
||||
ui->displayText->hide();
|
||||
}
|
||||
@@ -641,6 +673,7 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||
if (firmware->getCapability(ModelTrainerEnable)) {
|
||||
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
|
||||
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
||||
connect(modules[C9X_NUM_MODULES], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
@@ -687,7 +720,7 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
|
||||
void SetupPanel::on_throttleSource_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
model->thrTraceSrc = ui->throttleSource->itemData(index).toInt();
|
||||
model->thrTraceSrc = index;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -733,34 +766,39 @@ void SetupPanel::on_image_currentIndexChanged(int index)
|
||||
|
||||
void SetupPanel::populateThrottleSourceCB()
|
||||
{
|
||||
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
||||
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
|
||||
const QString pots9x[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
|
||||
const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
|
||||
const QString potsTaranisX9E[] = { QObject::tr("F1"), QObject::tr("F2"), QObject::tr("F3"), QObject::tr("F4"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
|
||||
|
||||
unsigned int i;
|
||||
|
||||
lock = true;
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
for (i=0; i<6; i++) {
|
||||
ui->throttleSource->addItem(sourcesTaranis[i], i);
|
||||
ui->throttleSource->addItem(QObject::tr("THR"));
|
||||
|
||||
if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
|
||||
for (i=0; i<8; i++) {
|
||||
ui->throttleSource->addItem(potsTaranisX9E[i], i);
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
for (i=0; i<5; i++) {
|
||||
ui->throttleSource->addItem(potsTaranis[i], i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i=0; i<4; i++) {
|
||||
ui->throttleSource->addItem(sources9x[i], i);
|
||||
for (i=0; i<3; i++) {
|
||||
ui->throttleSource->addItem(pots9x[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
if (model->thrTraceSrc < i)
|
||||
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
|
||||
|
||||
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
|
||||
for (int i=0; i<channels; i++) {
|
||||
ui->throttleSource->addItem(QObject::tr("CH%1").arg(i+1, 2, 10, QChar('0')), THROTTLE_SOURCE_FIRST_CHANNEL+i);
|
||||
if (model->thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
|
||||
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
|
||||
ui->throttleSource->addItem(ModelPrinter::printChannelName(i));
|
||||
}
|
||||
|
||||
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class ModulePanel : public ModelPanel
|
||||
struct ChannelFailsafeWidgetsGroup {
|
||||
QComboBox * combo;
|
||||
QDoubleSpinBox * spinbox;
|
||||
QLabel * label;
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
@@ -75,7 +76,6 @@ class ModulePanel : public ModelPanel
|
||||
ModuleData & module;
|
||||
int moduleIdx;
|
||||
Ui::Module *ui;
|
||||
QVector<QDoubleSpinBox *> failsafeSpins;
|
||||
ChannelFailsafeWidgetsGroup failsafeGroups[maxChannels];
|
||||
};
|
||||
|
||||
|
||||
+318
-292
@@ -16,22 +16,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_timer3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timer 3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_timer1">
|
||||
<property name="font">
|
||||
@@ -48,8 +32,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
|
||||
<widget class="QLabel" name="label_timer2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="toplcdTimerLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
@@ -57,14 +41,307 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timer 2</string>
|
||||
<string>Top LCD Timer</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="modelImage_label">
|
||||
<property name="text">
|
||||
<string>Model Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imagePreview">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="image"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_26">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="10" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||
<widget class="QLabel" name="swwarn_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Switch Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QLabel" name="label_potWarning">
|
||||
<property name="text">
|
||||
<string>Pot Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="potWarningLayout">
|
||||
<item row="0" column="0" alignment="Qt::AlignTop">
|
||||
<widget class="QComboBox" name="potWarningMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OFF</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Manual</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Model</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="centerBeepLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center beep</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="extendedTrims">
|
||||
@@ -224,7 +501,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_ttrace">
|
||||
@@ -276,42 +553,15 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="centerBeepLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
|
||||
<widget class="QLabel" name="label_timer2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
@@ -319,261 +569,37 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center beep</string>
|
||||
<string>Timer 2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_timer3_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timer 3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="modelImage_label">
|
||||
<property name="text">
|
||||
<string>Model Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imagePreview">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="image"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_26">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||
<widget class="QLabel" name="swwarn_label">
|
||||
<item row="4" column="1">
|
||||
<widget class="AutoComboBox" name="toplcdTimer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Switch Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QLabel" name="label_potWarning">
|
||||
<property name="text">
|
||||
<string>Pot Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="potWarningLayout">
|
||||
<item row="0" column="0" alignment="Qt::AlignTop">
|
||||
<widget class="QComboBox" name="potWarningMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OFF</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Manual</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Model</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -67,12 +67,12 @@
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_69" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0,0,0,0">
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="2" column="3" alignment="Qt::AlignLeft">
|
||||
<widget class="QSpinBox" name="channelsStart">
|
||||
<property name="maximumSize">
|
||||
@@ -353,7 +353,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16</number>
|
||||
|
||||
@@ -29,20 +29,10 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, Mod
|
||||
update();
|
||||
|
||||
ui->UnitCB->setCurrentIndex(analog.type);
|
||||
if (!IS_TARANIS(firmware->getBoard())) {
|
||||
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
|
||||
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
|
||||
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
|
||||
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
|
||||
}
|
||||
else {
|
||||
ui->alarm1LevelCB->hide();
|
||||
ui->alarm2LevelCB->hide();
|
||||
ui->alarm1GreaterCB->hide();
|
||||
ui->alarm2GreaterCB->hide();
|
||||
ui->alarm1Label->setText(tr("Low Alarm"));
|
||||
ui->alarm2Label->setText(tr("Critical Alarm"));
|
||||
}
|
||||
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
|
||||
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
|
||||
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
|
||||
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
|
||||
|
||||
if (!(firmware->getCapability(Telemetry) & TM_HASOFFSET)) {
|
||||
ui->CalibSB->hide();
|
||||
@@ -543,6 +533,7 @@ void TelemetrySensorPanel::update()
|
||||
bool cellsFieldsDisplayed = false;
|
||||
bool consFieldsDisplayed = false;
|
||||
bool ratioFieldsDisplayed = false;
|
||||
bool totalizeFieldsDisplayed = false;
|
||||
bool sources12FieldsDisplayed = false;
|
||||
bool sources34FieldsDisplayed = false;
|
||||
|
||||
@@ -566,6 +557,7 @@ void TelemetrySensorPanel::update()
|
||||
consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
|
||||
sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
|
||||
sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
|
||||
totalizeFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
|
||||
updateSourcesComboBox(ui->source1, true);
|
||||
updateSourcesComboBox(ui->source2, true);
|
||||
updateSourcesComboBox(ui->source3, true);
|
||||
@@ -588,14 +580,18 @@ void TelemetrySensorPanel::update()
|
||||
|
||||
if (sensor.unit == SensorData::UNIT_RPMS) {
|
||||
ui->offset->setDecimals(0);
|
||||
ui->offset->setSingleStep(1);
|
||||
ui->ratio->setDecimals(0);
|
||||
ui->ratio->setSingleStep(1);
|
||||
ui->autoOffset->hide();
|
||||
ui->ratio->setMinimum(1);
|
||||
ui->offset->setMinimum(1);
|
||||
}
|
||||
else {
|
||||
ui->offset->setDecimals(sensor.prec);
|
||||
ui->offset->setSingleStep(pow(0.1, (int)sensor.prec));
|
||||
ui->ratio->setDecimals(1);
|
||||
ui->ratio->setSingleStep(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,15 +601,15 @@ void TelemetrySensorPanel::update()
|
||||
ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS);
|
||||
ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS);
|
||||
ui->offset->setVisible(ratioFieldsDisplayed);
|
||||
ui->precLabel->setVisible(isConfigurable);
|
||||
ui->precLabel->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
|
||||
ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
|
||||
ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable);
|
||||
ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed);
|
||||
ui->gpsSensor->setVisible(gpsFieldsDisplayed);
|
||||
ui->altSensorLabel->setVisible(gpsFieldsDisplayed);
|
||||
ui->altSensor->setVisible(gpsFieldsDisplayed);
|
||||
ui->ampsSensorLabel->setVisible(consFieldsDisplayed);
|
||||
ui->ampsSensor->setVisible(consFieldsDisplayed);
|
||||
ui->ampsSensorLabel->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
|
||||
ui->ampsSensor->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
|
||||
ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed);
|
||||
ui->cellsSensor->setVisible(cellsFieldsDisplayed);
|
||||
ui->cellsIndex->setVisible(cellsFieldsDisplayed);
|
||||
@@ -653,7 +649,7 @@ void TelemetrySensorPanel::on_name_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
strcpy(sensor.label, ui->name->text().toAscii());
|
||||
emit nameModified();
|
||||
emit dataModified();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -675,7 +671,15 @@ void TelemetrySensorPanel::on_formula_currentIndexChanged(int index)
|
||||
sensor.prec = 2;
|
||||
sensor.unit = SensorData::UNIT_VOLTS;
|
||||
}
|
||||
update();
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION) {
|
||||
sensor.prec = 0;
|
||||
sensor.unit = SensorData::UNIT_MAH;
|
||||
}
|
||||
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST) {
|
||||
sensor.prec = 0;
|
||||
sensor.unit = SensorData::UNIT_METERS;
|
||||
}
|
||||
emit dataModified();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -684,6 +688,9 @@ void TelemetrySensorPanel::on_unit_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
sensor.unit = index;
|
||||
if (sensor.unit == SensorData::UNIT_FAHRENHEIT) {
|
||||
sensor.prec = 0;
|
||||
}
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
@@ -693,7 +700,7 @@ void TelemetrySensorPanel::on_prec_valueChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
sensor.prec = ui->prec->value();
|
||||
update();
|
||||
emit dataModified();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
@@ -717,7 +724,8 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model.sensorData[i], model, generalSettings, firmware);
|
||||
ui->sensorsLayout->addWidget(panel);
|
||||
sensorPanels[i] = panel;
|
||||
connect(panel, SIGNAL(nameModified()), this, SLOT(update()));
|
||||
connect(panel, SIGNAL(dataModified()), this, SLOT(update()));
|
||||
connect(panel, SIGNAL(modified()), this, SLOT(onModified()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -727,14 +735,14 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1], model, generalSettings, firmware);
|
||||
ui->A2Layout->addWidget(analogs[1]);
|
||||
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||
connect(analogs[1], SIGNAL(modified()), this, SLOT(onModified()));
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
ui->voltsSource->setField(model.frsky.voltsSource);
|
||||
ui->altitudeSource->setField(model.frsky.altitudeSource);
|
||||
ui->varioSource->setField(model.frsky.varioSource);
|
||||
ui->varioCenterSilent->setField(model.frsky.varioCenterSilent);
|
||||
ui->voltsSource->setField(model.frsky.voltsSource, this);
|
||||
ui->altitudeSource->setField(model.frsky.altitudeSource, this);
|
||||
ui->varioSource->setField(model.frsky.varioSource, this);
|
||||
ui->varioCenterSilent->setField(model.frsky.varioCenterSilent, this);
|
||||
}
|
||||
else {
|
||||
ui->topbarGB->hide();
|
||||
@@ -744,6 +752,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
|
||||
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
|
||||
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
|
||||
telemetryCustomScreens[i] = tab;
|
||||
connect(tab, SIGNAL(modified()), this, SLOT(onModified()));
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
@@ -759,7 +768,7 @@ TelemetryPanel::~TelemetryPanel()
|
||||
void TelemetryPanel::update()
|
||||
{
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
if (model->moduleData[0].protocol == OFF && model->moduleData[1].protocol == PPM) {
|
||||
if (model->moduleData[0].protocol == PULSES_OFF && model->moduleData[1].protocol == PULSES_PPM) {
|
||||
ui->telemetryProtocol->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
@@ -945,7 +954,7 @@ void TelemetryPanel::on_telemetryProtocol_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::onAnalogModified()
|
||||
void TelemetryPanel::onModified()
|
||||
{
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class TelemetrySensorPanel: public ModelPanel
|
||||
void update();
|
||||
|
||||
signals:
|
||||
void nameModified();
|
||||
void dataModified();
|
||||
|
||||
protected slots:
|
||||
void on_name_editingFinished();
|
||||
@@ -118,7 +118,7 @@ class TelemetryPanel : public ModelPanel
|
||||
|
||||
private slots:
|
||||
void on_telemetryProtocol_currentIndexChanged(int index);
|
||||
void onAnalogModified();
|
||||
void onModified();
|
||||
void on_frskyProtoCB_currentIndexChanged(int index);
|
||||
void on_bladesCount_editingFinished();
|
||||
void on_rssiAlarm1CB_currentIndexChanged(int index);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user