From 2f8f2df3c73e524b6ccdabbac19332012f0560ba Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 2 Dec 2013 18:47:43 +0100 Subject: [PATCH] Companion build on Linux --- CREDITS.txt | 235 + DONATIONS.txt | 11 + GPLv2.txt | 339 + README.txt | 1 + companion/releasenotes.txt | 143 + companion/src/CMakeLists.txt | 418 + companion/src/avroutputdialog.cpp | 481 + companion/src/avroutputdialog.h | 67 + companion/src/avroutputdialog.ui | 115 + companion/src/burnconfigdialog.cpp | 423 + companion/src/burnconfigdialog.h | 76 + companion/src/burnconfigdialog.ui | 799 + companion/src/burndialog.cpp | 728 + companion/src/burndialog.h | 60 + companion/src/burndialog.ui | 494 + companion/src/cmake/FindPhonon.cmake | 67 + companion/src/cmake/FindSdl.cmake | 165 + companion/src/cmake/FindXercesC.cmake | 68 + companion/src/cmake/FindXsd.cmake | 52 + companion/src/companion9x.desktop | 11 + companion/src/companion9x.png | Bin 0 -> 5302 bytes companion/src/companion9x.qrc | 335 + companion/src/comparedialog.cpp | 1476 + companion/src/comparedialog.h | 95 + companion/src/comparedialog.ui | 152 + companion/src/contributorsdialog.cpp | 82 + companion/src/contributorsdialog.h | 31 + companion/src/contributorsdialog.ui | 30 + companion/src/cursorwidget.h | 106 + companion/src/customizesplashdialog.cpp | 187 + companion/src/customizesplashdialog.h | 33 + companion/src/customizesplashdialog.ui | 270 + companion/src/downloaddialog.cpp | 88 + companion/src/downloaddialog.h | 38 + companion/src/downloaddialog.ui | 90 + companion/src/edge.cpp | 132 + companion/src/edge.h | 78 + companion/src/eepromimportexport.h | 663 + companion/src/eeprominterface.cpp | 766 + companion/src/eeprominterface.h | 1264 + companion/src/expodialog.cpp | 334 + companion/src/expodialog.h | 30 + companion/src/expodialog.ui | 443 + companion/src/file.cpp | 611 + companion/src/file.h | 155 + companion/src/firmwares/er9x/er9xeeprom.cpp | 955 + companion/src/firmwares/er9x/er9xeeprom.h | 276 + .../src/firmwares/er9x/er9xinterface.cpp | 474 + companion/src/firmwares/er9x/er9xinterface.h | 76 + .../src/firmwares/er9x/er9xsimulator.cpp | 228 + companion/src/firmwares/er9x/er9xsimulator.h | 60 + .../src/firmwares/ersky9x/ersky9xeeprom.cpp | 1494 + .../src/firmwares/ersky9x/ersky9xeeprom.h | 456 + .../firmwares/ersky9x/ersky9xinterface.cpp | 503 + .../src/firmwares/ersky9x/ersky9xinterface.h | 77 + .../firmwares/ersky9x/ersky9xsimulator.cpp | 251 + .../src/firmwares/ersky9x/ersky9xsimulator.h | 60 + .../src/firmwares/gruvin9x/gruvin9xeeprom.cpp | 1153 + .../src/firmwares/gruvin9x/gruvin9xeeprom.h | 453 + .../firmwares/gruvin9x/gruvin9xinterface.cpp | 341 + .../firmwares/gruvin9x/gruvin9xinterface.h | 68 + .../firmwares/opentx/open9xGruvin9xeeprom.cpp | 1854 ++ .../firmwares/opentx/open9xGruvin9xeeprom.h | 395 + .../opentx/open9xGruvin9xsimulator.cpp | 202 + .../opentx/open9xGruvin9xsimulator.h | 60 + .../firmwares/opentx/open9xM128simulator.cpp | 195 + .../firmwares/opentx/open9xM128simulator.h | 60 + .../firmwares/opentx/open9xSky9xeeprom.cpp | 2521 ++ .../src/firmwares/opentx/open9xSky9xeeprom.h | 562 + .../firmwares/opentx/open9xSky9xsimulator.cpp | 235 + .../firmwares/opentx/open9xSky9xsimulator.h | 60 + .../firmwares/opentx/open9xStockeeprom.cpp | 3416 +++ .../src/firmwares/opentx/open9xStockeeprom.h | 891 + .../src/firmwares/opentx/open9xeeprom.cpp | 1944 ++ companion/src/firmwares/opentx/open9xeeprom.h | 136 + .../src/firmwares/opentx/open9xinterface.cpp | 1336 + .../src/firmwares/opentx/open9xinterface.h | 166 + .../src/firmwares/opentx/open9xsimulator.cpp | 199 + .../src/firmwares/opentx/open9xsimulator.h | 60 + .../opentx/opentxTaranisSimulator.cpp | 242 + .../firmwares/opentx/opentxTaranisSimulator.h | 60 + .../src/firmwares/opentx/stamp-opentx.h.in | 6 + companion/src/firmwares/th9x/th9xeeprom.cpp | 538 + companion/src/firmwares/th9x/th9xeeprom.h | 195 + .../src/firmwares/th9x/th9xinterface.cpp | 248 + companion/src/firmwares/th9x/th9xinterface.h | 61 + .../src/firmwares/th9x/th9xsimulator.cpp | 237 + companion/src/firmwares/th9x/th9xsimulator.h | 60 + companion/src/flashinterface.cpp | 502 + companion/src/flashinterface.h | 96 + companion/src/fusesdialog.cpp | 34 + companion/src/fusesdialog.h | 27 + companion/src/fusesdialog.ui | 122 + companion/src/generaledit.cpp | 1418 + companion/src/generaledit.h | 157 + companion/src/generaledit.ui | 3682 +++ companion/src/helpers.cpp | 1367 + companion/src/helpers.h | 98 + companion/src/hexinterface.cpp | 131 + companion/src/hexinterface.h | 38 + companion/src/icon.ico | Bin 0 -> 10494 bytes companion/src/icon.png | Bin 0 -> 5302 bytes companion/src/icon.rc | 1 + companion/src/icon.svg | 157 + companion/src/images/9CX.png | Bin 0 -> 113658 bytes companion/src/images/9xcurs.png | Bin 0 -> 31573 bytes companion/src/images/9xcursdown.png | Bin 0 -> 30308 bytes companion/src/images/9xcursmin.png | Bin 0 -> 30427 bytes companion/src/images/9xcursphoto.png | Bin 0 -> 31489 bytes companion/src/images/9xcursplus.png | Bin 0 -> 30460 bytes companion/src/images/9xcursup.png | Bin 0 -> 30296 bytes companion/src/images/9xdb-bl.png | Bin 0 -> 9141 bytes companion/src/images/9xdb-gr.png | Bin 0 -> 9027 bytes companion/src/images/9xdb-or.png | Bin 0 -> 8015 bytes companion/src/images/9xdb-rd.png | Bin 0 -> 8923 bytes companion/src/images/9xdb-yl.png | Bin 0 -> 8929 bytes companion/src/images/9xdb.png | Bin 0 -> 7163 bytes companion/src/images/9xdl-bl.png | Bin 0 -> 9098 bytes companion/src/images/9xdl-gr.png | Bin 0 -> 9006 bytes companion/src/images/9xdl-or.png | Bin 0 -> 8486 bytes companion/src/images/9xdl-rd.png | Bin 0 -> 8964 bytes companion/src/images/9xdl-yl.png | Bin 0 -> 9151 bytes companion/src/images/9xdl.png | Bin 0 -> 6128 bytes companion/src/images/9xdr-bl.png | Bin 0 -> 12202 bytes companion/src/images/9xdr-gr.png | Bin 0 -> 11938 bytes companion/src/images/9xdr-or.png | Bin 0 -> 11588 bytes companion/src/images/9xdr-rd.png | Bin 0 -> 11889 bytes companion/src/images/9xdr-yl.png | Bin 0 -> 12014 bytes companion/src/images/9xdr.png | Bin 0 -> 6549 bytes companion/src/images/9xdt-bl.png | Bin 0 -> 2478 bytes companion/src/images/9xdt-gr.png | Bin 0 -> 2302 bytes companion/src/images/9xdt-or.png | Bin 0 -> 1915 bytes companion/src/images/9xdt-rd.png | Bin 0 -> 2301 bytes companion/src/images/9xdt-yl.png | Bin 0 -> 2360 bytes companion/src/images/9xdt.png | Bin 0 -> 2385 bytes companion/src/images/9xmenu.png | Bin 0 -> 20558 bytes companion/src/images/9xmenuexit.png | Bin 0 -> 20468 bytes companion/src/images/9xmenumenu.png | Bin 0 -> 20407 bytes companion/src/images/add.png | Bin 0 -> 5539 bytes companion/src/images/arrow-left.png | Bin 0 -> 14365 bytes companion/src/images/arrow-right.png | Bin 0 -> 14387 bytes companion/src/images/changelog.png | Bin 0 -> 19817 bytes companion/src/images/clear.png | Bin 0 -> 9656 bytes companion/src/images/companion9x-title.png | Bin 0 -> 42644 bytes companion/src/images/compare.png | Bin 0 -> 2163 bytes companion/src/images/configure.png | Bin 0 -> 13703 bytes companion/src/images/contributors.png | Bin 0 -> 12829 bytes companion/src/images/copy.png | Bin 0 -> 1338 bytes companion/src/images/currentmodel.png | Bin 0 -> 10941 bytes companion/src/images/customize.png | Bin 0 -> 864 bytes companion/src/images/cut.png | Bin 0 -> 1323 bytes companion/src/images/duplicate.png | Bin 0 -> 6684 bytes companion/src/images/edit.png | Bin 0 -> 9626 bytes companion/src/images/er9x_manual.png | Bin 0 -> 5765 bytes companion/src/images/exit.png | Bin 0 -> 10601 bytes companion/src/images/fuses.png | Bin 0 -> 11183 bytes companion/src/images/iconmac.icns | Bin 0 -> 464053 bytes companion/src/images/library.png | Bin 0 -> 16242 bytes companion/src/images/library/00001.png | Bin 0 -> 662 bytes companion/src/images/library/00002.png | Bin 0 -> 554 bytes companion/src/images/library/00003.png | Bin 0 -> 764 bytes companion/src/images/library/00004.png | Bin 0 -> 831 bytes companion/src/images/library/00005.png | Bin 0 -> 451 bytes companion/src/images/library/00006.png | Bin 0 -> 3469 bytes companion/src/images/library/00007.png | Bin 0 -> 3760 bytes companion/src/images/library/00008.png | Bin 0 -> 3485 bytes companion/src/images/library/00009.png | Bin 0 -> 4665 bytes companion/src/images/library/00010.png | Bin 0 -> 3727 bytes companion/src/images/library/00011.png | Bin 0 -> 3692 bytes companion/src/images/library/00012.png | Bin 0 -> 3151 bytes companion/src/images/library/00013.png | Bin 0 -> 425 bytes companion/src/images/library/00014.png | Bin 0 -> 341 bytes companion/src/images/library/00015.png | Bin 0 -> 325 bytes companion/src/images/library/00016.png | Bin 0 -> 603 bytes companion/src/images/library/01001.png | Bin 0 -> 911 bytes companion/src/images/library/01002.png | Bin 0 -> 855 bytes companion/src/images/library/01003.png | Bin 0 -> 840 bytes companion/src/images/library/01004.png | Bin 0 -> 883 bytes companion/src/images/library/01005.png | Bin 0 -> 883 bytes companion/src/images/library/01006.png | Bin 0 -> 840 bytes companion/src/images/library/01007.png | Bin 0 -> 855 bytes companion/src/images/library/01008.png | Bin 0 -> 911 bytes companion/src/images/library/10001.png | Bin 0 -> 682 bytes companion/src/images/library/10002.png | Bin 0 -> 566 bytes companion/src/images/library/10003.png | Bin 0 -> 857 bytes companion/src/images/library/10004.png | Bin 0 -> 752 bytes companion/src/images/library/10005.png | Bin 0 -> 889 bytes companion/src/images/library/10006.png | Bin 0 -> 677 bytes companion/src/images/library/10007.png | Bin 0 -> 546 bytes companion/src/images/library/10008.png | Bin 0 -> 606 bytes companion/src/images/library/10009.png | Bin 0 -> 653 bytes companion/src/images/library/10010.png | Bin 0 -> 645 bytes companion/src/images/library/10011.png | Bin 0 -> 537 bytes companion/src/images/library/10012.png | Bin 0 -> 664 bytes companion/src/images/library/10013.png | Bin 0 -> 612 bytes companion/src/images/library/10014.png | Bin 0 -> 656 bytes companion/src/images/library/10015.png | Bin 0 -> 535 bytes companion/src/images/library/10016.png | Bin 0 -> 601 bytes companion/src/images/library/10017.png | Bin 0 -> 659 bytes companion/src/images/library/10018.png | Bin 0 -> 712 bytes companion/src/images/library/10019.png | Bin 0 -> 752 bytes companion/src/images/library/10020.png | Bin 0 -> 783 bytes companion/src/images/library/10021.png | Bin 0 -> 744 bytes companion/src/images/library/10022.png | Bin 0 -> 812 bytes companion/src/images/library/10023.png | Bin 0 -> 451 bytes companion/src/images/library/10024.png | Bin 0 -> 555 bytes companion/src/images/library/10025.png | Bin 0 -> 601 bytes companion/src/images/library/10026.png | Bin 0 -> 732 bytes companion/src/images/library/10027.png | Bin 0 -> 799 bytes companion/src/images/library/10028.png | Bin 0 -> 748 bytes companion/src/images/library/10029.png | Bin 0 -> 755 bytes companion/src/images/library/10030.png | Bin 0 -> 746 bytes companion/src/images/library/10031.png | Bin 0 -> 675 bytes companion/src/images/library/10032.png | Bin 0 -> 600 bytes companion/src/images/library/10033.png | Bin 0 -> 709 bytes companion/src/images/library/10034.png | Bin 0 -> 690 bytes companion/src/images/library/10035.png | Bin 0 -> 721 bytes companion/src/images/library/10036.png | Bin 0 -> 716 bytes companion/src/images/library/10037.png | Bin 0 -> 715 bytes companion/src/images/library/10038.png | Bin 0 -> 764 bytes companion/src/images/library/10039.png | Bin 0 -> 724 bytes companion/src/images/library/10040.png | Bin 0 -> 450 bytes companion/src/images/library/10041.png | Bin 0 -> 819 bytes companion/src/images/library/10042.png | Bin 0 -> 695 bytes companion/src/images/library/10043.png | Bin 0 -> 638 bytes companion/src/images/library/10044.png | Bin 0 -> 602 bytes companion/src/images/library/10045.png | Bin 0 -> 762 bytes companion/src/images/library/10046.png | Bin 0 -> 666 bytes companion/src/images/library/10047.png | Bin 0 -> 650 bytes companion/src/images/library/10048.png | Bin 0 -> 594 bytes companion/src/images/library/10049.png | Bin 0 -> 706 bytes companion/src/images/library/10050.png | Bin 0 -> 701 bytes companion/src/images/library/10051.png | Bin 0 -> 678 bytes companion/src/images/library/10052.png | Bin 0 -> 690 bytes companion/src/images/library/10053.png | Bin 0 -> 529 bytes companion/src/images/library/10054.png | Bin 0 -> 548 bytes companion/src/images/library/10055.png | Bin 0 -> 659 bytes companion/src/images/library/10056.png | Bin 0 -> 563 bytes companion/src/images/library/10057.png | Bin 0 -> 855 bytes companion/src/images/library/10058.png | Bin 0 -> 337 bytes companion/src/images/library/10059.png | Bin 0 -> 703 bytes companion/src/images/library/10060.png | Bin 0 -> 1567 bytes companion/src/images/library/10061.png | Bin 0 -> 732 bytes companion/src/images/library/10062.png | Bin 0 -> 647 bytes companion/src/images/library/10063.png | Bin 0 -> 543 bytes companion/src/images/library/10064.png | Bin 0 -> 641 bytes companion/src/images/library/10065.png | Bin 0 -> 587 bytes companion/src/images/library/10066.png | Bin 0 -> 658 bytes companion/src/images/library/10067.png | Bin 0 -> 524 bytes companion/src/images/library/10068.png | Bin 0 -> 560 bytes companion/src/images/library/10069.png | Bin 0 -> 746 bytes companion/src/images/library/10070.png | Bin 0 -> 720 bytes companion/src/images/library/10071.png | Bin 0 -> 695 bytes companion/src/images/library/10072.png | Bin 0 -> 705 bytes companion/src/images/library/10073.png | Bin 0 -> 734 bytes companion/src/images/library/10074.png | Bin 0 -> 762 bytes companion/src/images/library/10075.png | Bin 0 -> 651 bytes companion/src/images/library/10076.png | Bin 0 -> 704 bytes companion/src/images/library/10077.png | Bin 0 -> 479 bytes companion/src/images/library/10078.png | Bin 0 -> 654 bytes companion/src/images/library/10079.png | Bin 0 -> 594 bytes companion/src/images/library/10080.png | Bin 0 -> 657 bytes companion/src/images/library/10081.png | Bin 0 -> 521 bytes companion/src/images/library/10082.png | Bin 0 -> 949 bytes companion/src/images/library/10083.png | Bin 0 -> 576 bytes companion/src/images/library/10084.png | Bin 0 -> 755 bytes companion/src/images/library/10085.png | Bin 0 -> 568 bytes companion/src/images/library/10086.png | Bin 0 -> 713 bytes companion/src/images/library/10087.png | Bin 0 -> 611 bytes companion/src/images/library/10088.png | Bin 0 -> 438 bytes companion/src/images/library/10089.png | Bin 0 -> 573 bytes companion/src/images/library/10090.png | Bin 0 -> 580 bytes companion/src/images/library/10091.png | Bin 0 -> 825 bytes companion/src/images/library/10092.png | Bin 0 -> 623 bytes companion/src/images/library/10093.png | Bin 0 -> 618 bytes companion/src/images/library/10094.png | Bin 0 -> 872 bytes companion/src/images/library/10095.png | Bin 0 -> 892 bytes companion/src/images/library/10096.png | Bin 0 -> 929 bytes companion/src/images/library/10097.png | Bin 0 -> 953 bytes companion/src/images/library/10098.png | Bin 0 -> 808 bytes companion/src/images/library/10099.png | Bin 0 -> 584 bytes companion/src/images/library/10100.png | Bin 0 -> 806 bytes companion/src/images/library/10101.png | Bin 0 -> 888 bytes companion/src/images/library/10102.png | Bin 0 -> 941 bytes companion/src/images/library/10103.png | Bin 0 -> 737 bytes companion/src/images/library/10104.png | Bin 0 -> 670 bytes companion/src/images/library/20001.png | Bin 0 -> 751 bytes companion/src/images/library/20002.png | Bin 0 -> 945 bytes companion/src/images/library/20003.png | Bin 0 -> 882 bytes companion/src/images/library/20004.png | Bin 0 -> 878 bytes companion/src/images/library/30001.png | Bin 0 -> 2879 bytes companion/src/images/library/30002.png | Bin 0 -> 2767 bytes companion/src/images/library/30003.png | Bin 0 -> 4233 bytes companion/src/images/library/30004.png | Bin 0 -> 3049 bytes companion/src/images/library/30005.png | Bin 0 -> 3152 bytes companion/src/images/library/30006.png | Bin 0 -> 3600 bytes companion/src/images/list.png | Bin 0 -> 20365 bytes companion/src/images/logs.png | Bin 0 -> 3302 bytes companion/src/images/mcw/aicon.png | Bin 0 -> 1125 bytes companion/src/images/mcw/at1e1r.png | Bin 0 -> 8860 bytes companion/src/images/mcw/at2e1r.png | Bin 0 -> 8856 bytes companion/src/images/mcw/atailv.png | Bin 0 -> 8940 bytes companion/src/images/mcw/aw0a0f.png | Bin 0 -> 12078 bytes companion/src/images/mcw/aw1a0f.png | Bin 0 -> 14005 bytes companion/src/images/mcw/aw1a1f.png | Bin 0 -> 15477 bytes companion/src/images/mcw/aw1a2f.png | Bin 0 -> 15429 bytes companion/src/images/mcw/aw2a0f.png | Bin 0 -> 14008 bytes companion/src/images/mcw/aw2a1f.png | Bin 0 -> 15468 bytes companion/src/images/mcw/aw2a2f.png | Bin 0 -> 15477 bytes companion/src/images/mcw/db0t2e0f0r.png | Bin 0 -> 1183 bytes companion/src/images/mcw/db0t2e0f1r.png | Bin 0 -> 1218 bytes companion/src/images/mcw/db0t2e0f2r.png | Bin 0 -> 1187 bytes companion/src/images/mcw/db0t2e1f0r.png | Bin 0 -> 1210 bytes companion/src/images/mcw/db0t2e1f1r.png | Bin 0 -> 1207 bytes companion/src/images/mcw/db0t2e1f2r.png | Bin 0 -> 1214 bytes companion/src/images/mcw/db0t2e2f0r.png | Bin 0 -> 1215 bytes companion/src/images/mcw/db0t2e2f1r.png | Bin 0 -> 1213 bytes companion/src/images/mcw/db0t2e2f2r.png | Bin 0 -> 1220 bytes companion/src/images/mcw/db1t2e0f0r.png | Bin 0 -> 1138 bytes companion/src/images/mcw/db1t2e0f1r.png | Bin 0 -> 1218 bytes companion/src/images/mcw/db1t2e0f2r.png | Bin 0 -> 1143 bytes companion/src/images/mcw/db1t2e1f0r.png | Bin 0 -> 1163 bytes companion/src/images/mcw/db1t2e1f1r.png | Bin 0 -> 1207 bytes companion/src/images/mcw/db1t2e1f2r.png | Bin 0 -> 1168 bytes companion/src/images/mcw/db1t2e2f0r.png | Bin 0 -> 1173 bytes companion/src/images/mcw/db1t2e2f1r.png | Bin 0 -> 1213 bytes companion/src/images/mcw/db1t2e2f2r.png | Bin 0 -> 1178 bytes companion/src/images/mcw/dicon.png | Bin 0 -> 1360 bytes companion/src/images/mcw/dt0t2e0f0r.png | Bin 0 -> 1311 bytes companion/src/images/mcw/dt0t2e0f1r.png | Bin 0 -> 1311 bytes companion/src/images/mcw/dt0t2e0f2r.png | Bin 0 -> 1311 bytes companion/src/images/mcw/dt0t2e1f0r.png | Bin 0 -> 1315 bytes companion/src/images/mcw/dt0t2e1f1r.png | Bin 0 -> 1315 bytes companion/src/images/mcw/dt0t2e1f2r.png | Bin 0 -> 1315 bytes companion/src/images/mcw/dt0t2e2f0r.png | Bin 0 -> 1327 bytes companion/src/images/mcw/dt0t2e2f1r.png | Bin 0 -> 1327 bytes companion/src/images/mcw/dt0t2e2f2r.png | Bin 0 -> 1327 bytes companion/src/images/mcw/dt1t2e0f0r.png | Bin 0 -> 1325 bytes companion/src/images/mcw/dt1t2e0f1r.png | Bin 0 -> 1399 bytes companion/src/images/mcw/dt1t2e0f2r.png | Bin 0 -> 1325 bytes companion/src/images/mcw/dt1t2e1f0r.png | Bin 0 -> 1326 bytes companion/src/images/mcw/dt1t2e1f1r.png | Bin 0 -> 1402 bytes companion/src/images/mcw/dt1t2e1f2r.png | Bin 0 -> 1326 bytes companion/src/images/mcw/dt1t2e2f0r.png | Bin 0 -> 1333 bytes companion/src/images/mcw/dt1t2e2f1r.png | Bin 0 -> 1416 bytes companion/src/images/mcw/dt1t2e2f2r.png | Bin 0 -> 1333 bytes companion/src/images/mcw/gicon.png | Bin 0 -> 1233 bytes companion/src/images/mcw/gt1e1r.png | Bin 0 -> 1448 bytes companion/src/images/mcw/gt2e1r.png | Bin 0 -> 1444 bytes companion/src/images/mcw/gtailv.png | Bin 0 -> 2075 bytes companion/src/images/mcw/gw0t0a0f0s.png | Bin 0 -> 2883 bytes companion/src/images/mcw/gw0t1a0f0s.png | Bin 0 -> 3007 bytes companion/src/images/mcw/gw0t1a0f1s.png | Bin 0 -> 2925 bytes companion/src/images/mcw/gw0t1a0f2s.png | Bin 0 -> 2938 bytes companion/src/images/mcw/gw0t1a1f0s.png | Bin 0 -> 2966 bytes companion/src/images/mcw/gw0t1a1f1s.png | Bin 0 -> 2961 bytes companion/src/images/mcw/gw0t1a1f2s.png | Bin 0 -> 2974 bytes companion/src/images/mcw/gw0t1a2f0s.png | Bin 0 -> 2968 bytes companion/src/images/mcw/gw0t1a2f1s.png | Bin 0 -> 2963 bytes companion/src/images/mcw/gw0t1a2f2s.png | Bin 0 -> 2977 bytes companion/src/images/mcw/gw0t2a0f0s.png | Bin 0 -> 3021 bytes companion/src/images/mcw/gw0t2a0f1s.png | Bin 0 -> 2940 bytes companion/src/images/mcw/gw0t2a0f2s.png | Bin 0 -> 2952 bytes companion/src/images/mcw/gw0t2a1f0s.png | Bin 0 -> 2984 bytes companion/src/images/mcw/gw0t2a1f1s.png | Bin 0 -> 2978 bytes companion/src/images/mcw/gw0t2a1f2s.png | Bin 0 -> 2991 bytes companion/src/images/mcw/gw0t2a2f0s.png | Bin 0 -> 2988 bytes companion/src/images/mcw/gw0t2a2f1s.png | Bin 0 -> 2983 bytes companion/src/images/mcw/gw0t2a2f2s.png | Bin 0 -> 2996 bytes companion/src/images/mcw/gw1t0a0f0s.png | Bin 0 -> 2863 bytes companion/src/images/mcw/gw1t1a0f0s.png | Bin 0 -> 2977 bytes companion/src/images/mcw/gw1t1a0f1s.png | Bin 0 -> 2897 bytes companion/src/images/mcw/gw1t1a0f2s.png | Bin 0 -> 2902 bytes companion/src/images/mcw/gw1t1a1f0s.png | Bin 0 -> 2938 bytes companion/src/images/mcw/gw1t1a1f1s.png | Bin 0 -> 2932 bytes companion/src/images/mcw/gw1t1a1f2s.png | Bin 0 -> 2945 bytes companion/src/images/mcw/gw1t1a2f0s.png | Bin 0 -> 2941 bytes companion/src/images/mcw/gw1t1a2f1s.png | Bin 0 -> 2934 bytes companion/src/images/mcw/gw1t1a2f2s.png | Bin 0 -> 2947 bytes companion/src/images/mcw/gw1t2a0f0s.png | Bin 0 -> 2992 bytes companion/src/images/mcw/gw1t2a0f1s.png | Bin 0 -> 2902 bytes companion/src/images/mcw/gw1t2a0f2s.png | Bin 0 -> 2916 bytes companion/src/images/mcw/gw1t2a1f0s.png | Bin 0 -> 2956 bytes companion/src/images/mcw/gw1t2a1f1s.png | Bin 0 -> 2949 bytes companion/src/images/mcw/gw1t2a1f2s.png | Bin 0 -> 2962 bytes companion/src/images/mcw/gw1t2a2f0s.png | Bin 0 -> 2960 bytes companion/src/images/mcw/gw1t2a2f1s.png | Bin 0 -> 2954 bytes companion/src/images/mcw/gw1t2a2f2s.png | Bin 0 -> 2966 bytes companion/src/images/mcw/h120.png | Bin 0 -> 10372 bytes companion/src/images/mcw/h120x.png | Bin 0 -> 10561 bytes companion/src/images/mcw/h140.png | Bin 0 -> 10598 bytes companion/src/images/mcw/h90.png | Bin 0 -> 10381 bytes companion/src/images/mcw/hfbl.png | Bin 0 -> 10413 bytes companion/src/images/mcw/hicon.png | Bin 0 -> 1465 bytes companion/src/images/mcw/htailfblg.png | Bin 0 -> 3090 bytes companion/src/images/mcw/htailfblng.png | Bin 0 -> 2964 bytes companion/src/images/mcw/htailg.png | Bin 0 -> 3096 bytes companion/src/images/mcw/htailng.png | Bin 0 -> 2971 bytes companion/src/images/movedown.png | Bin 0 -> 10774 bytes companion/src/images/moveup.png | Bin 0 -> 10463 bytes companion/src/images/new.png | Bin 0 -> 852 bytes companion/src/images/open.png | Bin 0 -> 2073 bytes companion/src/images/paste.png | Bin 0 -> 1645 bytes companion/src/images/play.png | Bin 0 -> 534 bytes companion/src/images/preferences.png | Bin 0 -> 11170 bytes companion/src/images/print.png | Bin 0 -> 7282 bytes companion/src/images/profiles.png | Bin 0 -> 2312 bytes companion/src/images/read_eeprom.png | Bin 0 -> 18174 bytes companion/src/images/read_eeprom_file.png | Bin 0 -> 27588 bytes companion/src/images/read_flash.png | Bin 0 -> 25584 bytes companion/src/images/recentdocument.png | Bin 0 -> 9874 bytes companion/src/images/save.png | Bin 0 -> 5753 bytes companion/src/images/saveas.png | Bin 0 -> 6839 bytes companion/src/images/screenshot.png | Bin 0 -> 2466 bytes companion/src/images/simulate.png | Bin 0 -> 10065 bytes companion/src/images/splash-2012.png | Bin 0 -> 403007 bytes companion/src/images/splash-2013.png | Bin 0 -> 386571 bytes companion/src/images/splash-ambroise.png | Bin 0 -> 39575 bytes companion/src/images/splash-hb.png | Bin 0 -> 171149 bytes companion/src/images/splash-old.png | Bin 0 -> 42569 bytes companion/src/images/splash-orig.png | Bin 0 -> 122847 bytes companion/src/images/splash.png | Bin 0 -> 72534 bytes companion/src/images/splasht.png | Bin 0 -> 106369 bytes companion/src/images/stop.png | Bin 0 -> 312 bytes companion/src/images/switch_dir.png | Bin 0 -> 6210 bytes companion/src/images/update.png | Bin 0 -> 12332 bytes companion/src/images/wizard.png | Bin 0 -> 13364 bytes companion/src/images/write_eeprom.png | Bin 0 -> 17348 bytes companion/src/images/write_eeprom_file.png | Bin 0 -> 26192 bytes companion/src/images/write_flash.png | Bin 0 -> 21730 bytes companion/src/images/x9b0.png | Bin 0 -> 20152 bytes companion/src/images/x9l0.png | Bin 0 -> 28497 bytes companion/src/images/x9l1.png | Bin 0 -> 27947 bytes companion/src/images/x9l2.png | Bin 0 -> 28017 bytes companion/src/images/x9l3.png | Bin 0 -> 27914 bytes companion/src/images/x9l4.png | Bin 0 -> 28371 bytes companion/src/images/x9r0.png | Bin 0 -> 31317 bytes companion/src/images/x9r1.png | Bin 0 -> 30773 bytes companion/src/images/x9r2.png | Bin 0 -> 30786 bytes companion/src/images/x9r3.png | Bin 0 -> 30739 bytes companion/src/images/x9s0.png | Bin 0 -> 595 bytes companion/src/images/x9t0.png | Bin 0 -> 13703 bytes companion/src/joystick.cpp | 129 + companion/src/joystick.h | 60 + companion/src/joystickdialog.cpp | 156 + companion/src/joystickdialog.h | 36 + companion/src/joystickdialog.ui | 915 + companion/src/lcdwidget.h | 161 + companion/src/logsdialog.cpp | 600 + companion/src/logsdialog.h | 47 + companion/src/logsdialog.ui | 256 + companion/src/main.cpp | 129 + companion/src/mainwindow.cpp | 2169 ++ companion/src/mainwindow.h | 237 + companion/src/mdichild.cpp | 723 + companion/src/mdichild.h | 120 + companion/src/mdichild.ui | 44 + companion/src/menuwidget.h | 73 + companion/src/mixerdialog.cpp | 361 + companion/src/mixerdialog.h | 31 + companion/src/mixerdialog.ui | 685 + companion/src/mixerslist.cpp | 54 + companion/src/mixerslist.h | 32 + companion/src/modelconfigdialog.cpp | 933 + companion/src/modelconfigdialog.h | 59 + companion/src/modelconfigdialog.ui | 1268 + companion/src/modeledit.cpp | 7433 +++++ companion/src/modeledit.h | 393 + companion/src/modeledit.ui | 24504 ++++++++++++++++ companion/src/modelslist.cpp | 578 + companion/src/modelslist.h | 109 + companion/src/mountlist.cpp | 925 + companion/src/mountlist.h | 54 + companion/src/myslider.h | 34 + companion/src/node.cpp | 246 + companion/src/node.h | 108 + companion/src/preferencesdialog.cpp | 829 + companion/src/preferencesdialog.h | 64 + companion/src/preferencesdialog.ui | 1663 ++ companion/src/printdialog.cpp | 1020 + companion/src/printdialog.h | 57 + companion/src/printdialog.ui | 101 + companion/src/qcustomplot.cpp | 15033 ++++++++++ companion/src/qcustomplot.h | 2171 ++ companion/src/radio.xsd | 685 + companion/src/simulatordialog.cpp | 742 + companion/src/simulatordialog.h | 118 + companion/src/simulatordialog.ui | 3714 +++ companion/src/simulatorimport.h | 88 + companion/src/simulatorinterface.h | 76 + companion/src/splash.h | 60 + companion/src/splashlabel.h | 81 + companion/src/splashlibrary.cpp | 147 + companion/src/splashlibrary.h | 36 + companion/src/splashlibrary.ui | 973 + companion/src/translations.qrc.in | 12 + companion/src/translations/companion9x_cs.ts | 12339 ++++++++ companion/src/translations/companion9x_de.ts | 12900 ++++++++ companion/src/translations/companion9x_fr.ts | 11273 +++++++ companion/src/translations/companion9x_he.ts | 11040 +++++++ companion/src/translations/companion9x_it.ts | 11285 +++++++ companion/src/translations/companion9x_pt.ts | 11989 ++++++++ companion/src/translations/companion9x_ru.ts | 11567 ++++++++ companion/src/translations/companion9x_sv.ts | 11276 +++++++ companion/src/version.h.in | 3 + companion/src/warnings.h | 8 + companion/src/xcursorwidget.h | 100 + companion/src/xmenuwidget.h | 95 + companion/src/xmlinterface.cpp | 223 + companion/src/xmlinterface.h | 42 + companion/src/xsimulatordialog.cpp | 634 + companion/src/xsimulatordialog.h | 104 + companion/src/xsimulatordialog.ui | 3906 +++ companion/targets/linux/45-taranis.rules | 1 + companion/targets/linux/45-usbasp.rules | 1 + companion/targets/mac/libcrypto.1.0.0.dylib | Bin 0 -> 1714528 bytes companion/targets/mac/libssl.1.0.0.dylib | Bin 0 -> 380888 bytes companion/targets/mac/qt_menu.nib/classes.nib | 59 + companion/targets/mac/qt_menu.nib/info.nib | 18 + .../targets/mac/qt_menu.nib/keyedobjects.nib | Bin 0 -> 5560 bytes companion/targets/windows/FileAssociation.nsh | 190 + companion/targets/windows/avrdude.conf | 16949 +++++++++++ companion/targets/windows/avrdude.exe | Bin 0 -> 344078 bytes .../targets/windows/companion9x-msys.nsi.in | 186 + .../targets/windows/companion9x-vs.nsi.in | 214 + companion/targets/windows/dfu-util.exe | Bin 0 -> 117269 bytes companion/targets/windows/libusb-1.0.dll | Bin 0 -> 286342 bytes companion/targets/windows/libusb0.dll | Bin 0 -> 43520 bytes companion/targets/windows/license.txt | 12 + companion/targets/windows/winbuild.h | 28 + 530 files changed, 230710 insertions(+) create mode 100644 CREDITS.txt create mode 100644 DONATIONS.txt create mode 100644 GPLv2.txt create mode 100644 README.txt create mode 100644 companion/releasenotes.txt create mode 100644 companion/src/CMakeLists.txt create mode 100644 companion/src/avroutputdialog.cpp create mode 100644 companion/src/avroutputdialog.h create mode 100644 companion/src/avroutputdialog.ui create mode 100644 companion/src/burnconfigdialog.cpp create mode 100644 companion/src/burnconfigdialog.h create mode 100644 companion/src/burnconfigdialog.ui create mode 100644 companion/src/burndialog.cpp create mode 100644 companion/src/burndialog.h create mode 100644 companion/src/burndialog.ui create mode 100644 companion/src/cmake/FindPhonon.cmake create mode 100644 companion/src/cmake/FindSdl.cmake create mode 100644 companion/src/cmake/FindXercesC.cmake create mode 100644 companion/src/cmake/FindXsd.cmake create mode 100644 companion/src/companion9x.desktop create mode 100644 companion/src/companion9x.png create mode 100644 companion/src/companion9x.qrc create mode 100644 companion/src/comparedialog.cpp create mode 100644 companion/src/comparedialog.h create mode 100644 companion/src/comparedialog.ui create mode 100644 companion/src/contributorsdialog.cpp create mode 100644 companion/src/contributorsdialog.h create mode 100644 companion/src/contributorsdialog.ui create mode 100644 companion/src/cursorwidget.h create mode 100644 companion/src/customizesplashdialog.cpp create mode 100644 companion/src/customizesplashdialog.h create mode 100644 companion/src/customizesplashdialog.ui create mode 100644 companion/src/downloaddialog.cpp create mode 100644 companion/src/downloaddialog.h create mode 100644 companion/src/downloaddialog.ui create mode 100644 companion/src/edge.cpp create mode 100644 companion/src/edge.h create mode 100644 companion/src/eepromimportexport.h create mode 100644 companion/src/eeprominterface.cpp create mode 100644 companion/src/eeprominterface.h create mode 100644 companion/src/expodialog.cpp create mode 100644 companion/src/expodialog.h create mode 100644 companion/src/expodialog.ui create mode 100644 companion/src/file.cpp create mode 100644 companion/src/file.h create mode 100644 companion/src/firmwares/er9x/er9xeeprom.cpp create mode 100644 companion/src/firmwares/er9x/er9xeeprom.h create mode 100644 companion/src/firmwares/er9x/er9xinterface.cpp create mode 100644 companion/src/firmwares/er9x/er9xinterface.h create mode 100644 companion/src/firmwares/er9x/er9xsimulator.cpp create mode 100644 companion/src/firmwares/er9x/er9xsimulator.h create mode 100644 companion/src/firmwares/ersky9x/ersky9xeeprom.cpp create mode 100644 companion/src/firmwares/ersky9x/ersky9xeeprom.h create mode 100644 companion/src/firmwares/ersky9x/ersky9xinterface.cpp create mode 100644 companion/src/firmwares/ersky9x/ersky9xinterface.h create mode 100644 companion/src/firmwares/ersky9x/ersky9xsimulator.cpp create mode 100644 companion/src/firmwares/ersky9x/ersky9xsimulator.h create mode 100644 companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp create mode 100644 companion/src/firmwares/gruvin9x/gruvin9xeeprom.h create mode 100644 companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp create mode 100644 companion/src/firmwares/gruvin9x/gruvin9xinterface.h create mode 100644 companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp create mode 100644 companion/src/firmwares/opentx/open9xGruvin9xeeprom.h create mode 100644 companion/src/firmwares/opentx/open9xGruvin9xsimulator.cpp create mode 100644 companion/src/firmwares/opentx/open9xGruvin9xsimulator.h create mode 100644 companion/src/firmwares/opentx/open9xM128simulator.cpp create mode 100644 companion/src/firmwares/opentx/open9xM128simulator.h create mode 100644 companion/src/firmwares/opentx/open9xSky9xeeprom.cpp create mode 100644 companion/src/firmwares/opentx/open9xSky9xeeprom.h create mode 100644 companion/src/firmwares/opentx/open9xSky9xsimulator.cpp create mode 100644 companion/src/firmwares/opentx/open9xSky9xsimulator.h create mode 100644 companion/src/firmwares/opentx/open9xStockeeprom.cpp create mode 100644 companion/src/firmwares/opentx/open9xStockeeprom.h create mode 100644 companion/src/firmwares/opentx/open9xeeprom.cpp create mode 100644 companion/src/firmwares/opentx/open9xeeprom.h create mode 100644 companion/src/firmwares/opentx/open9xinterface.cpp create mode 100644 companion/src/firmwares/opentx/open9xinterface.h create mode 100644 companion/src/firmwares/opentx/open9xsimulator.cpp create mode 100644 companion/src/firmwares/opentx/open9xsimulator.h create mode 100644 companion/src/firmwares/opentx/opentxTaranisSimulator.cpp create mode 100644 companion/src/firmwares/opentx/opentxTaranisSimulator.h create mode 100644 companion/src/firmwares/opentx/stamp-opentx.h.in create mode 100644 companion/src/firmwares/th9x/th9xeeprom.cpp create mode 100644 companion/src/firmwares/th9x/th9xeeprom.h create mode 100644 companion/src/firmwares/th9x/th9xinterface.cpp create mode 100644 companion/src/firmwares/th9x/th9xinterface.h create mode 100644 companion/src/firmwares/th9x/th9xsimulator.cpp create mode 100644 companion/src/firmwares/th9x/th9xsimulator.h create mode 100644 companion/src/flashinterface.cpp create mode 100644 companion/src/flashinterface.h create mode 100644 companion/src/fusesdialog.cpp create mode 100644 companion/src/fusesdialog.h create mode 100644 companion/src/fusesdialog.ui create mode 100644 companion/src/generaledit.cpp create mode 100644 companion/src/generaledit.h create mode 100644 companion/src/generaledit.ui create mode 100644 companion/src/helpers.cpp create mode 100644 companion/src/helpers.h create mode 100644 companion/src/hexinterface.cpp create mode 100644 companion/src/hexinterface.h create mode 100644 companion/src/icon.ico create mode 100644 companion/src/icon.png create mode 100644 companion/src/icon.rc create mode 100644 companion/src/icon.svg create mode 100644 companion/src/images/9CX.png create mode 100644 companion/src/images/9xcurs.png create mode 100644 companion/src/images/9xcursdown.png create mode 100644 companion/src/images/9xcursmin.png create mode 100644 companion/src/images/9xcursphoto.png create mode 100644 companion/src/images/9xcursplus.png create mode 100644 companion/src/images/9xcursup.png create mode 100644 companion/src/images/9xdb-bl.png create mode 100644 companion/src/images/9xdb-gr.png create mode 100644 companion/src/images/9xdb-or.png create mode 100644 companion/src/images/9xdb-rd.png create mode 100644 companion/src/images/9xdb-yl.png create mode 100644 companion/src/images/9xdb.png create mode 100644 companion/src/images/9xdl-bl.png create mode 100644 companion/src/images/9xdl-gr.png create mode 100644 companion/src/images/9xdl-or.png create mode 100644 companion/src/images/9xdl-rd.png create mode 100644 companion/src/images/9xdl-yl.png create mode 100644 companion/src/images/9xdl.png create mode 100644 companion/src/images/9xdr-bl.png create mode 100644 companion/src/images/9xdr-gr.png create mode 100644 companion/src/images/9xdr-or.png create mode 100644 companion/src/images/9xdr-rd.png create mode 100644 companion/src/images/9xdr-yl.png create mode 100644 companion/src/images/9xdr.png create mode 100644 companion/src/images/9xdt-bl.png create mode 100644 companion/src/images/9xdt-gr.png create mode 100644 companion/src/images/9xdt-or.png create mode 100644 companion/src/images/9xdt-rd.png create mode 100644 companion/src/images/9xdt-yl.png create mode 100644 companion/src/images/9xdt.png create mode 100644 companion/src/images/9xmenu.png create mode 100644 companion/src/images/9xmenuexit.png create mode 100644 companion/src/images/9xmenumenu.png create mode 100644 companion/src/images/add.png create mode 100644 companion/src/images/arrow-left.png create mode 100644 companion/src/images/arrow-right.png create mode 100644 companion/src/images/changelog.png create mode 100644 companion/src/images/clear.png create mode 100644 companion/src/images/companion9x-title.png create mode 100644 companion/src/images/compare.png create mode 100644 companion/src/images/configure.png create mode 100644 companion/src/images/contributors.png create mode 100644 companion/src/images/copy.png create mode 100644 companion/src/images/currentmodel.png create mode 100644 companion/src/images/customize.png create mode 100644 companion/src/images/cut.png create mode 100644 companion/src/images/duplicate.png create mode 100644 companion/src/images/edit.png create mode 100644 companion/src/images/er9x_manual.png create mode 100644 companion/src/images/exit.png create mode 100644 companion/src/images/fuses.png create mode 100644 companion/src/images/iconmac.icns create mode 100644 companion/src/images/library.png create mode 100644 companion/src/images/library/00001.png create mode 100644 companion/src/images/library/00002.png create mode 100644 companion/src/images/library/00003.png create mode 100644 companion/src/images/library/00004.png create mode 100644 companion/src/images/library/00005.png create mode 100644 companion/src/images/library/00006.png create mode 100644 companion/src/images/library/00007.png create mode 100644 companion/src/images/library/00008.png create mode 100644 companion/src/images/library/00009.png create mode 100644 companion/src/images/library/00010.png create mode 100644 companion/src/images/library/00011.png create mode 100644 companion/src/images/library/00012.png create mode 100644 companion/src/images/library/00013.png create mode 100644 companion/src/images/library/00014.png create mode 100644 companion/src/images/library/00015.png create mode 100644 companion/src/images/library/00016.png create mode 100644 companion/src/images/library/01001.png create mode 100644 companion/src/images/library/01002.png create mode 100644 companion/src/images/library/01003.png create mode 100644 companion/src/images/library/01004.png create mode 100644 companion/src/images/library/01005.png create mode 100644 companion/src/images/library/01006.png create mode 100644 companion/src/images/library/01007.png create mode 100644 companion/src/images/library/01008.png create mode 100644 companion/src/images/library/10001.png create mode 100644 companion/src/images/library/10002.png create mode 100644 companion/src/images/library/10003.png create mode 100644 companion/src/images/library/10004.png create mode 100644 companion/src/images/library/10005.png create mode 100644 companion/src/images/library/10006.png create mode 100644 companion/src/images/library/10007.png create mode 100644 companion/src/images/library/10008.png create mode 100644 companion/src/images/library/10009.png create mode 100644 companion/src/images/library/10010.png create mode 100644 companion/src/images/library/10011.png create mode 100644 companion/src/images/library/10012.png create mode 100644 companion/src/images/library/10013.png create mode 100644 companion/src/images/library/10014.png create mode 100644 companion/src/images/library/10015.png create mode 100644 companion/src/images/library/10016.png create mode 100644 companion/src/images/library/10017.png create mode 100644 companion/src/images/library/10018.png create mode 100644 companion/src/images/library/10019.png create mode 100644 companion/src/images/library/10020.png create mode 100644 companion/src/images/library/10021.png create mode 100644 companion/src/images/library/10022.png create mode 100644 companion/src/images/library/10023.png create mode 100644 companion/src/images/library/10024.png create mode 100644 companion/src/images/library/10025.png create mode 100644 companion/src/images/library/10026.png create mode 100644 companion/src/images/library/10027.png create mode 100644 companion/src/images/library/10028.png create mode 100644 companion/src/images/library/10029.png create mode 100644 companion/src/images/library/10030.png create mode 100644 companion/src/images/library/10031.png create mode 100644 companion/src/images/library/10032.png create mode 100644 companion/src/images/library/10033.png create mode 100644 companion/src/images/library/10034.png create mode 100644 companion/src/images/library/10035.png create mode 100644 companion/src/images/library/10036.png create mode 100644 companion/src/images/library/10037.png create mode 100644 companion/src/images/library/10038.png create mode 100644 companion/src/images/library/10039.png create mode 100644 companion/src/images/library/10040.png create mode 100644 companion/src/images/library/10041.png create mode 100644 companion/src/images/library/10042.png create mode 100644 companion/src/images/library/10043.png create mode 100644 companion/src/images/library/10044.png create mode 100644 companion/src/images/library/10045.png create mode 100644 companion/src/images/library/10046.png create mode 100644 companion/src/images/library/10047.png create mode 100644 companion/src/images/library/10048.png create mode 100644 companion/src/images/library/10049.png create mode 100644 companion/src/images/library/10050.png create mode 100644 companion/src/images/library/10051.png create mode 100644 companion/src/images/library/10052.png create mode 100644 companion/src/images/library/10053.png create mode 100644 companion/src/images/library/10054.png create mode 100644 companion/src/images/library/10055.png create mode 100644 companion/src/images/library/10056.png create mode 100644 companion/src/images/library/10057.png create mode 100644 companion/src/images/library/10058.png create mode 100644 companion/src/images/library/10059.png create mode 100644 companion/src/images/library/10060.png create mode 100644 companion/src/images/library/10061.png create mode 100644 companion/src/images/library/10062.png create mode 100644 companion/src/images/library/10063.png create mode 100644 companion/src/images/library/10064.png create mode 100644 companion/src/images/library/10065.png create mode 100644 companion/src/images/library/10066.png create mode 100644 companion/src/images/library/10067.png create mode 100644 companion/src/images/library/10068.png create mode 100644 companion/src/images/library/10069.png create mode 100644 companion/src/images/library/10070.png create mode 100644 companion/src/images/library/10071.png create mode 100644 companion/src/images/library/10072.png create mode 100644 companion/src/images/library/10073.png create mode 100644 companion/src/images/library/10074.png create mode 100644 companion/src/images/library/10075.png create mode 100644 companion/src/images/library/10076.png create mode 100644 companion/src/images/library/10077.png create mode 100644 companion/src/images/library/10078.png create mode 100644 companion/src/images/library/10079.png create mode 100644 companion/src/images/library/10080.png create mode 100644 companion/src/images/library/10081.png create mode 100644 companion/src/images/library/10082.png create mode 100644 companion/src/images/library/10083.png create mode 100644 companion/src/images/library/10084.png create mode 100644 companion/src/images/library/10085.png create mode 100644 companion/src/images/library/10086.png create mode 100644 companion/src/images/library/10087.png create mode 100644 companion/src/images/library/10088.png create mode 100644 companion/src/images/library/10089.png create mode 100644 companion/src/images/library/10090.png create mode 100644 companion/src/images/library/10091.png create mode 100644 companion/src/images/library/10092.png create mode 100644 companion/src/images/library/10093.png create mode 100644 companion/src/images/library/10094.png create mode 100644 companion/src/images/library/10095.png create mode 100644 companion/src/images/library/10096.png create mode 100644 companion/src/images/library/10097.png create mode 100644 companion/src/images/library/10098.png create mode 100644 companion/src/images/library/10099.png create mode 100644 companion/src/images/library/10100.png create mode 100644 companion/src/images/library/10101.png create mode 100644 companion/src/images/library/10102.png create mode 100644 companion/src/images/library/10103.png create mode 100644 companion/src/images/library/10104.png create mode 100644 companion/src/images/library/20001.png create mode 100644 companion/src/images/library/20002.png create mode 100644 companion/src/images/library/20003.png create mode 100644 companion/src/images/library/20004.png create mode 100644 companion/src/images/library/30001.png create mode 100644 companion/src/images/library/30002.png create mode 100644 companion/src/images/library/30003.png create mode 100644 companion/src/images/library/30004.png create mode 100644 companion/src/images/library/30005.png create mode 100644 companion/src/images/library/30006.png create mode 100644 companion/src/images/list.png create mode 100644 companion/src/images/logs.png create mode 100644 companion/src/images/mcw/aicon.png create mode 100644 companion/src/images/mcw/at1e1r.png create mode 100644 companion/src/images/mcw/at2e1r.png create mode 100644 companion/src/images/mcw/atailv.png create mode 100644 companion/src/images/mcw/aw0a0f.png create mode 100644 companion/src/images/mcw/aw1a0f.png create mode 100644 companion/src/images/mcw/aw1a1f.png create mode 100644 companion/src/images/mcw/aw1a2f.png create mode 100644 companion/src/images/mcw/aw2a0f.png create mode 100644 companion/src/images/mcw/aw2a1f.png create mode 100644 companion/src/images/mcw/aw2a2f.png create mode 100644 companion/src/images/mcw/db0t2e0f0r.png create mode 100644 companion/src/images/mcw/db0t2e0f1r.png create mode 100644 companion/src/images/mcw/db0t2e0f2r.png create mode 100644 companion/src/images/mcw/db0t2e1f0r.png create mode 100644 companion/src/images/mcw/db0t2e1f1r.png create mode 100644 companion/src/images/mcw/db0t2e1f2r.png create mode 100644 companion/src/images/mcw/db0t2e2f0r.png create mode 100644 companion/src/images/mcw/db0t2e2f1r.png create mode 100644 companion/src/images/mcw/db0t2e2f2r.png create mode 100644 companion/src/images/mcw/db1t2e0f0r.png create mode 100644 companion/src/images/mcw/db1t2e0f1r.png create mode 100644 companion/src/images/mcw/db1t2e0f2r.png create mode 100644 companion/src/images/mcw/db1t2e1f0r.png create mode 100644 companion/src/images/mcw/db1t2e1f1r.png create mode 100644 companion/src/images/mcw/db1t2e1f2r.png create mode 100644 companion/src/images/mcw/db1t2e2f0r.png create mode 100644 companion/src/images/mcw/db1t2e2f1r.png create mode 100644 companion/src/images/mcw/db1t2e2f2r.png create mode 100644 companion/src/images/mcw/dicon.png create mode 100644 companion/src/images/mcw/dt0t2e0f0r.png create mode 100644 companion/src/images/mcw/dt0t2e0f1r.png create mode 100644 companion/src/images/mcw/dt0t2e0f2r.png create mode 100644 companion/src/images/mcw/dt0t2e1f0r.png create mode 100644 companion/src/images/mcw/dt0t2e1f1r.png create mode 100644 companion/src/images/mcw/dt0t2e1f2r.png create mode 100644 companion/src/images/mcw/dt0t2e2f0r.png create mode 100644 companion/src/images/mcw/dt0t2e2f1r.png create mode 100644 companion/src/images/mcw/dt0t2e2f2r.png create mode 100644 companion/src/images/mcw/dt1t2e0f0r.png create mode 100644 companion/src/images/mcw/dt1t2e0f1r.png create mode 100644 companion/src/images/mcw/dt1t2e0f2r.png create mode 100644 companion/src/images/mcw/dt1t2e1f0r.png create mode 100644 companion/src/images/mcw/dt1t2e1f1r.png create mode 100644 companion/src/images/mcw/dt1t2e1f2r.png create mode 100644 companion/src/images/mcw/dt1t2e2f0r.png create mode 100644 companion/src/images/mcw/dt1t2e2f1r.png create mode 100644 companion/src/images/mcw/dt1t2e2f2r.png create mode 100644 companion/src/images/mcw/gicon.png create mode 100644 companion/src/images/mcw/gt1e1r.png create mode 100644 companion/src/images/mcw/gt2e1r.png create mode 100644 companion/src/images/mcw/gtailv.png create mode 100644 companion/src/images/mcw/gw0t0a0f0s.png create mode 100644 companion/src/images/mcw/gw0t1a0f0s.png create mode 100644 companion/src/images/mcw/gw0t1a0f1s.png create mode 100644 companion/src/images/mcw/gw0t1a0f2s.png create mode 100644 companion/src/images/mcw/gw0t1a1f0s.png create mode 100644 companion/src/images/mcw/gw0t1a1f1s.png create mode 100644 companion/src/images/mcw/gw0t1a1f2s.png create mode 100644 companion/src/images/mcw/gw0t1a2f0s.png create mode 100644 companion/src/images/mcw/gw0t1a2f1s.png create mode 100644 companion/src/images/mcw/gw0t1a2f2s.png create mode 100644 companion/src/images/mcw/gw0t2a0f0s.png create mode 100644 companion/src/images/mcw/gw0t2a0f1s.png create mode 100644 companion/src/images/mcw/gw0t2a0f2s.png create mode 100644 companion/src/images/mcw/gw0t2a1f0s.png create mode 100644 companion/src/images/mcw/gw0t2a1f1s.png create mode 100644 companion/src/images/mcw/gw0t2a1f2s.png create mode 100644 companion/src/images/mcw/gw0t2a2f0s.png create mode 100644 companion/src/images/mcw/gw0t2a2f1s.png create mode 100644 companion/src/images/mcw/gw0t2a2f2s.png create mode 100644 companion/src/images/mcw/gw1t0a0f0s.png create mode 100644 companion/src/images/mcw/gw1t1a0f0s.png create mode 100644 companion/src/images/mcw/gw1t1a0f1s.png create mode 100644 companion/src/images/mcw/gw1t1a0f2s.png create mode 100644 companion/src/images/mcw/gw1t1a1f0s.png create mode 100644 companion/src/images/mcw/gw1t1a1f1s.png create mode 100644 companion/src/images/mcw/gw1t1a1f2s.png create mode 100644 companion/src/images/mcw/gw1t1a2f0s.png create mode 100644 companion/src/images/mcw/gw1t1a2f1s.png create mode 100644 companion/src/images/mcw/gw1t1a2f2s.png create mode 100644 companion/src/images/mcw/gw1t2a0f0s.png create mode 100644 companion/src/images/mcw/gw1t2a0f1s.png create mode 100644 companion/src/images/mcw/gw1t2a0f2s.png create mode 100644 companion/src/images/mcw/gw1t2a1f0s.png create mode 100644 companion/src/images/mcw/gw1t2a1f1s.png create mode 100644 companion/src/images/mcw/gw1t2a1f2s.png create mode 100644 companion/src/images/mcw/gw1t2a2f0s.png create mode 100644 companion/src/images/mcw/gw1t2a2f1s.png create mode 100644 companion/src/images/mcw/gw1t2a2f2s.png create mode 100644 companion/src/images/mcw/h120.png create mode 100644 companion/src/images/mcw/h120x.png create mode 100644 companion/src/images/mcw/h140.png create mode 100644 companion/src/images/mcw/h90.png create mode 100644 companion/src/images/mcw/hfbl.png create mode 100644 companion/src/images/mcw/hicon.png create mode 100644 companion/src/images/mcw/htailfblg.png create mode 100644 companion/src/images/mcw/htailfblng.png create mode 100644 companion/src/images/mcw/htailg.png create mode 100644 companion/src/images/mcw/htailng.png create mode 100644 companion/src/images/movedown.png create mode 100644 companion/src/images/moveup.png create mode 100644 companion/src/images/new.png create mode 100644 companion/src/images/open.png create mode 100644 companion/src/images/paste.png create mode 100644 companion/src/images/play.png create mode 100644 companion/src/images/preferences.png create mode 100644 companion/src/images/print.png create mode 100644 companion/src/images/profiles.png create mode 100644 companion/src/images/read_eeprom.png create mode 100644 companion/src/images/read_eeprom_file.png create mode 100644 companion/src/images/read_flash.png create mode 100644 companion/src/images/recentdocument.png create mode 100644 companion/src/images/save.png create mode 100644 companion/src/images/saveas.png create mode 100644 companion/src/images/screenshot.png create mode 100644 companion/src/images/simulate.png create mode 100644 companion/src/images/splash-2012.png create mode 100644 companion/src/images/splash-2013.png create mode 100644 companion/src/images/splash-ambroise.png create mode 100644 companion/src/images/splash-hb.png create mode 100644 companion/src/images/splash-old.png create mode 100644 companion/src/images/splash-orig.png create mode 100644 companion/src/images/splash.png create mode 100644 companion/src/images/splasht.png create mode 100644 companion/src/images/stop.png create mode 100644 companion/src/images/switch_dir.png create mode 100644 companion/src/images/update.png create mode 100644 companion/src/images/wizard.png create mode 100644 companion/src/images/write_eeprom.png create mode 100644 companion/src/images/write_eeprom_file.png create mode 100644 companion/src/images/write_flash.png create mode 100644 companion/src/images/x9b0.png create mode 100644 companion/src/images/x9l0.png create mode 100644 companion/src/images/x9l1.png create mode 100644 companion/src/images/x9l2.png create mode 100644 companion/src/images/x9l3.png create mode 100644 companion/src/images/x9l4.png create mode 100644 companion/src/images/x9r0.png create mode 100644 companion/src/images/x9r1.png create mode 100644 companion/src/images/x9r2.png create mode 100644 companion/src/images/x9r3.png create mode 100644 companion/src/images/x9s0.png create mode 100644 companion/src/images/x9t0.png create mode 100644 companion/src/joystick.cpp create mode 100644 companion/src/joystick.h create mode 100644 companion/src/joystickdialog.cpp create mode 100644 companion/src/joystickdialog.h create mode 100644 companion/src/joystickdialog.ui create mode 100644 companion/src/lcdwidget.h create mode 100644 companion/src/logsdialog.cpp create mode 100644 companion/src/logsdialog.h create mode 100644 companion/src/logsdialog.ui create mode 100644 companion/src/main.cpp create mode 100644 companion/src/mainwindow.cpp create mode 100644 companion/src/mainwindow.h create mode 100644 companion/src/mdichild.cpp create mode 100644 companion/src/mdichild.h create mode 100644 companion/src/mdichild.ui create mode 100644 companion/src/menuwidget.h create mode 100644 companion/src/mixerdialog.cpp create mode 100644 companion/src/mixerdialog.h create mode 100644 companion/src/mixerdialog.ui create mode 100644 companion/src/mixerslist.cpp create mode 100644 companion/src/mixerslist.h create mode 100644 companion/src/modelconfigdialog.cpp create mode 100644 companion/src/modelconfigdialog.h create mode 100644 companion/src/modelconfigdialog.ui create mode 100644 companion/src/modeledit.cpp create mode 100644 companion/src/modeledit.h create mode 100644 companion/src/modeledit.ui create mode 100644 companion/src/modelslist.cpp create mode 100644 companion/src/modelslist.h create mode 100644 companion/src/mountlist.cpp create mode 100644 companion/src/mountlist.h create mode 100644 companion/src/myslider.h create mode 100644 companion/src/node.cpp create mode 100644 companion/src/node.h create mode 100644 companion/src/preferencesdialog.cpp create mode 100644 companion/src/preferencesdialog.h create mode 100644 companion/src/preferencesdialog.ui create mode 100644 companion/src/printdialog.cpp create mode 100644 companion/src/printdialog.h create mode 100644 companion/src/printdialog.ui create mode 100644 companion/src/qcustomplot.cpp create mode 100644 companion/src/qcustomplot.h create mode 100644 companion/src/radio.xsd create mode 100644 companion/src/simulatordialog.cpp create mode 100644 companion/src/simulatordialog.h create mode 100644 companion/src/simulatordialog.ui create mode 100644 companion/src/simulatorimport.h create mode 100644 companion/src/simulatorinterface.h create mode 100644 companion/src/splash.h create mode 100644 companion/src/splashlabel.h create mode 100644 companion/src/splashlibrary.cpp create mode 100644 companion/src/splashlibrary.h create mode 100644 companion/src/splashlibrary.ui create mode 100644 companion/src/translations.qrc.in create mode 100644 companion/src/translations/companion9x_cs.ts create mode 100644 companion/src/translations/companion9x_de.ts create mode 100644 companion/src/translations/companion9x_fr.ts create mode 100644 companion/src/translations/companion9x_he.ts create mode 100644 companion/src/translations/companion9x_it.ts create mode 100644 companion/src/translations/companion9x_pt.ts create mode 100644 companion/src/translations/companion9x_ru.ts create mode 100644 companion/src/translations/companion9x_sv.ts create mode 100644 companion/src/version.h.in create mode 100644 companion/src/warnings.h create mode 100644 companion/src/xcursorwidget.h create mode 100644 companion/src/xmenuwidget.h create mode 100644 companion/src/xmlinterface.cpp create mode 100644 companion/src/xmlinterface.h create mode 100644 companion/src/xsimulatordialog.cpp create mode 100644 companion/src/xsimulatordialog.h create mode 100644 companion/src/xsimulatordialog.ui create mode 100644 companion/targets/linux/45-taranis.rules create mode 100644 companion/targets/linux/45-usbasp.rules create mode 100644 companion/targets/mac/libcrypto.1.0.0.dylib create mode 100644 companion/targets/mac/libssl.1.0.0.dylib create mode 100644 companion/targets/mac/qt_menu.nib/classes.nib create mode 100644 companion/targets/mac/qt_menu.nib/info.nib create mode 100644 companion/targets/mac/qt_menu.nib/keyedobjects.nib create mode 100644 companion/targets/windows/FileAssociation.nsh create mode 100644 companion/targets/windows/avrdude.conf create mode 100644 companion/targets/windows/avrdude.exe create mode 100644 companion/targets/windows/companion9x-msys.nsi.in create mode 100644 companion/targets/windows/companion9x-vs.nsi.in create mode 100644 companion/targets/windows/dfu-util.exe create mode 100644 companion/targets/windows/libusb-1.0.dll create mode 100644 companion/targets/windows/libusb0.dll create mode 100644 companion/targets/windows/license.txt create mode 100644 companion/targets/windows/winbuild.h diff --git a/CREDITS.txt b/CREDITS.txt new file mode 100644 index 000000000..434f81862 --- /dev/null +++ b/CREDITS.txt @@ -0,0 +1,235 @@ +Mario Sette +Felice Baratto +Alessandro Mari +Gianpiero Spontina +Ingo Kuzniak +Hans-Åke Rahm +Tamas Varga +Thomas Gregg +Didier Christien +Alain Pinard +Sergio Melas +Paul Montenot +Chris Guy +Adrien Gravouille +Thomas Black +Marc Lucht +Michel Baily +Zdenek Trojanek +Martin Hotar +[Devo] Stefan Grundevik +[Devo] Fabio Eboli +Federico Zotti +Albin Esbjörnsson +Kilian Hüttenhofer +Stephen Stough +Adilson Oliveira +Robert Saint Marie +Tad Leake +Andreas Weitl +Chan Lofland +Dirk Kasten +Denisov Alexander +Timo Varppee +Ondrej Hatapka +Valérie Billon +R. Scott Page +Johan Cronje +Renato Aranghelovici +Jeffrey Irvin +Aloft Hobbies +John Rodgers +Kenneth Crump +Damjan Adamic +Martin Wilson +Joe Street +John Holdsworth +Daniel Schwartz +Dean Church +Michael Halse +David Mark +Ted Moss +Jim Wagner +Nicola Porzi +Michael Halse +Chewytm +Espen Solbu +Mike Frizell +Bruce Jones +Kenneth Crump +Stefano Airaghi +Dan Eeckhout +Alex Calderhead +Leonard MacKey +Heung Jin Choi +Mike Retterer +Keith Wood +Viljo Liukku +Eric Beier +Burt Pickard-Richardson +Helmut Renz +Rick Harms +Vincenzo Vavala +Patricia Martin +Harald Klein +Carl Petersen +Douglas Burkett +Clifford Evans +Teodor Yantchev +Jarad Berkman +Christian Schulz +Gregory J Shepherd +Michael Shellim +Ming Wang +R. Scott Page +Bernard Lukaschek +Nigel Chippindale +Mike Perkins +Ted Hammond +Kenneth Crump +David Beanland +Bernd Koehler +Frédéric Duflos +Dave Fasken +Heinrich Illig +Michael Collins +Michael Manning +Craig Lorentz +Jonathan Modellismo - http://jonathan.it +Aviomotive - http://www.aviomotive.com +André Lasseret +Felipe Alexandre de Oliveira +Brian Harris +Philippe Herbots +Rainer Nelte +Franck Bernhard +Erhard Werner +Stig Jøran Moen +Keith Hertzog +Christophe Dauvergne +Michel Baily +Tauno Rautakorpi +Sven Assmus +Paul Dittman +Mike Matheny +Cheryl Wynne +Emay Toha +Don Nolder +André Lasseret +Filip Lowette +Arnaldo Gabella +Fiorenzo Agnelli +Michele Villa +Christophe Rodriguez +Harald Klein +Larisa Filocamo +Alex Calderhead +Hartmut Sahm +Åke Brodin +Aloft Hobbies - http://www.alofthobbies.com +Ted Moss +Filippos Tigarakis +Chewytm +Eric Burdis +Nigel Chippindale +Michael Deasy +Stephen Stough +Kenneth Lilja +Robert Jero +Gary Bancroft +Robert Cotsford +Rafael Eric Suarez Nordlow +Gordon Stahl +NorthSide +George Constandinides +Robert Schonk Jr +Kevin Berkefeld +Peter Webster +Mike Matheny +Martin Sniedze +Fernando Rimoldi +Sidney Fisher +Bruce Anderson +John Rodgers +Ed Pare +Thomas Kilduff +Robert Ferguson +Bryan Green +Kevin Berkefeld +Julien Michel +Krittikun Chiraphanda +Douglas Law +Alberto Scotti +Oliver Kunkel +D. Joseph Frazier +Heiko Polig +Andrew Fernie +Marco Lange +Nick McMillan +Michel Baily (mensual) +Patrick Mullen +Scott Campbell +Erich Roeder +Wayne Davy +Michael Fontenot +Willie Swanepoel +Satoru Sasaki +Tyler Darby +Nicholas Crego +Keith Hertzog +Johan Moelich +Timo Esser +Dean Church (mensual) +Brian Paddock (mensual) +Jean Pierre Parisy +Norbert Martsch +Jean-Marie Guitard +Eric Beier +Mike Perkins +Tilman Baumann (mensual) +Fred Larssen +Ari Aalto +Robert Sams +Kirk Robertson +John Koontz +Jeffery Golias +Paul Robinson +Kenneth Crump +Dave Matison +Mike Matheny +Pino Agostino +Graham Boucher (mensual) +Nelson Noura +Joel Allamy +Philip David Martin +Sean Stephen +Bruce Mackay +Blake Spilman +Timothy Pelletier +Glen Roe (ShowMaster) +Jan Van Ooteghem +David Ankers - Special thanks here to the OpenPilot project! +Lawrence Christensen (mensual) +Leo Duflou +Bruce Wood +Arnd Feige +Tauno Rautakorpi +Steve Coley +Stefan Kiendl +Gregory Nuspel +Mitchell Brenner +Ronnnie DePrez +Ferenc Koller +Robert Sessler +Didier Lanot +Rodney Hunt +Steve Bernard +Paul Nazaroff +Gordon Ernenputsch +Ksamak +Marc Gittelman +David Poole +Ralph Sauer +Karl-Heinz Gansel +Michels Bernhard +Thomas Demmelbauer diff --git a/DONATIONS.txt b/DONATIONS.txt new file mode 100644 index 000000000..b869d4867 --- /dev/null +++ b/DONATIONS.txt @@ -0,0 +1,11 @@ +Bertrand Songis +Romolo Manfredini +Bryan Rentoul (aka Gruvin) +Cameron Weeks +Andrè Bernet (mac) +Michael Byrne (logos and official splashes) +Severino Anedda (splash screens) +Grootwitbaas - 9xforums.com (mac) +Adrian Amberg (splash screens) +Wallaguest1 - 9xforums.com (splash screens) +HC1969 - 9xforums.com (splash screens) \ No newline at end of file diff --git a/GPLv2.txt b/GPLv2.txt new file mode 100644 index 000000000..d159169d1 --- /dev/null +++ b/GPLv2.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.txt b/README.txt new file mode 100644 index 000000000..8f6415cbd --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +[to be written] diff --git a/companion/releasenotes.txt b/companion/releasenotes.txt new file mode 100644 index 000000000..de7615df8 --- /dev/null +++ b/companion/releasenotes.txt @@ -0,0 +1,143 @@ +

Version 1.51

+
    +
  • Wrong DFU-Util default path (MAC)
  • +
  • new voices download server (ip address changed to new fiber connection)
  • +
  • Fixed contributor list
  • +
+ +

Version 1.50

+
    +
  • solved issue with taranis radio with some linux distributions
  • +
  • blank eeprom created using a radio profile that holds calibration data, will contain calibration data from the profile
  • +
  • new opentx compilation server (ip address changed to new fiber connection)
  • +
+ +

Version 1.49

+
    +
  • Stack usage optimizations
  • +
  • Playsound order is misaligned between companion9x and the TX
  • +
  • Model image could not be reset.
  • +
+ +

Version 1.48

+
    +
  • Interface fixes
  • +
  • Hide include dr/expo when not applicable
  • +
  • Fix extraction of grayscale images from taranis firmwares
  • +
  • No TX and RX in Taranis telemetry fields
  • +
  • Issue 255 fixed - "No GVAR selection possible for PLAY VALUE"
  • +
  • Issue 254 fixed - "SE Language for building opentx"
  • +
  • Issue 253 fixed - "OpenTX doesn't accept this protocol (DSM2 on Sky9x)"
  • +
  • Prevent segfault while parsing wrong log files or files with broken lines
  • +
  • Small bug in model printout
  • +
  • Fixed wrong display of values in custom functions
  • +
  • Image in preferences was saved only black & white
  • +
  • Issue 247 fixed - "Labelled items on radio should not be translated."
  • +
  • Added support of tstick (taranis like stick) compile option for sky9x opentx firmware
  • +
+ +

Version 1.47

+
    +
  • Interface fixes (issues 232,233,238,241)
  • +
  • Fix for print/compare models
  • +
  • Function switch parameter on screen different than printout.
  • +
  • Translations fixes
  • +
  • Command line print mode
  • +
  • Better mavlink support
  • +
  • SE tts language added for taranis
  • +
  • Alternate font option for opentx added
  • + +
+ +

Version 1.46

+
    +
  • Interface fixes (issues 224,225)
  • +
  • Show persistent timers value in modeledit
  • +
  • Consistent naming of Custom Switches in c9x
  • +
+ +

Version 1.45

+
    +
  • Various fixes
  • +
+ +

Version 1.44

+
    +
  • Fix regression on AND parameter in custom functions
  • +
  • Add mavlink support for stock and m128 boards
  • +
+ +

Version 1.43

+
    +
  • Copy Malfunctions in Custom Functions (Issue 205)
  • +
  • Enable repeat parameter in functions for all boards
  • +
  • Remove sink tones from vario for stock/m128 board
  • +
  • Fix for wrongly named channels in mixerlist (Issue 210)
  • +
  • Fix badly exported gvars in mixers
  • +
  • Fix while editing custom switches
  • +
  • Add access to the release notes of currently selected firmware
  • +
+ +

Version 1.42

+
    +
  • Add Companion9X changelog
  • +
  • Add Fw release notes browser
  • +
  • Simplify burn menu for sky9x and Taranis.
  • +
  • Fix in telemetry conversion (rssi alarm) for stock board
  • +
  • Drop support of sky9x boards on MacOS due to missing SAM-BA tool.
  • +
+ +

Version 1.41

+
    +
  • Fix unneeded rescaling of splash images
  • +
  • Fix for telemetry screens for Taranis
  • +
+ +

Version 1.40

+
    +
  • Log dialog - Split of logging sessions.
  • +
  • Telemetry screen 1 as default (issue 206)
  • +
  • Rename all channels in mixer tab accordingly to limits names
  • +
  • Fix a segfault in phases tabs (Issue 203 regression introduced in release 2140)
  • +
+ +

Version 1.39

+
    +
  • Custom functions cut&paste
  • +
  • Custom switches cut&paste
  • +
  • Color button text in curve editor for MACOSX
  • +
  • Adjust name lengths for Taranis
  • +
+ +

Version 1.38

+
    +
  • Core when model names were > 10 chars
  • +
+ +

Version 1.37

+
    +
  • Fix OpenTX segfault in Taranis simulator
  • +
  • Implement brightness control for Taranis
  • +
  • Reduce modeledit windows size
  • +
  • Taranis splash screen in grayscale
  • +
+ +

Version 1.36

+
    +
  • Burning windows (with progress bar) now in foreground (Issue 197)
  • +
  • Allow a selection of tracks for Background Music (Issue 199)
  • +
+ +

Version 1.35

+
    +
  • Country names mismatch between Taranis and Companion 9X (Issue 198)
  • +
  • TIM function in custom switches
  • +
  • Fix timer switches.
  • +
  • Taranis LCD adjustment in general settings.
  • +
  • New tool in curve editor
  • +
  • Minor fixes
  • +
  • Expo move bug + invalid chars in channels, expo and mixer names
  • +
  • Try to reduce modeledit window form MAC
  • +
  • Wrong init of RF-Module data
  • +
  • Read flash from TX didn't worked for Taranis
  • +
\ No newline at end of file diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt new file mode 100644 index 000000000..da66c18a9 --- /dev/null +++ b/companion/src/CMakeLists.txt @@ -0,0 +1,418 @@ +PROJECT( companion9x ) + +SET( C9X_VERSION_MAJOR "1" ) +SET( C9X_VERSION_MINOR "51" ) +SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR} ) + +CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) + +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +MESSAGE( STATUS "Looking for XercesC " ) +FIND_PACKAGE(XercesC) +IF ( XERCESC_FOUND ) + INCLUDE_DIRECTORIES( ${XERCESC_INCLUDE_DIR} ) + SET(LidarFormat_LIBRAIRIES ${LidarFormat_LIBRAIRIES} ${XERCESC_LIBRARIES}) +ELSE() + MESSAGE( FATAL_ERROR "XercesC not found! Please set XercesC path ..." ) +ENDIF() + +MESSAGE( STATUS "Looking for Xsd " ) +FIND_PACKAGE(Xsd) +IF ( XSD_FOUND ) + INCLUDE_DIRECTORIES( ${XSD_INCLUDE_DIR} ) + MESSAGE("XSD Include Path: " ${XSD_INCLUDE_DIR} ) +ELSE() + MESSAGE( FATAL_ERROR "XSD not found! Please set XSD path ..." ) +ENDIF() + +MESSAGE( STATUS "Looking for SDL " ) +FIND_PACKAGE(Sdl) +IF ( SDL_FOUND ) + INCLUDE_DIRECTORIES( ${SDL_INCLUDE_DIR} ) + MESSAGE("SDL Include Path: " ${SDL_INCLUDE_DIR} ) + ADD_DEFINITIONS( -DJOYSTICKS ) +ELSE() + MESSAGE( "SDL not found! Joysticks support will be disabled" ) +ENDIF() + +FIND_PACKAGE( Qt4 REQUIRED ) +SET( QT_USE_QTNETWORK True ) +SET( QT_USE_QTXML True ) +INCLUDE( ${QT_USE_FILE} ) + +IF ( APPLE ) + MESSAGE( STATUS "Phonon still not supported on APPLE " ) +ELSE() + MESSAGE( STATUS "Looking for PHONON " ) + FIND_PACKAGE(Phonon) + IF ( PHONON_FOUND ) + INCLUDE_DIRECTORIES( ${PHONO_INCLUDE_DIR} ) + MESSAGE("PHONON Include Path: " ${PHONON_INCLUDE_DIR} ) + ADD_DEFINITIONS( -DPHONON ) + ELSE() + MESSAGE( "PHONON not found!" ) + ENDIF() +ENDIF() + +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 + DEPENDS ${PROJECT_SOURCE_DIR}/radio.xsd +) + +IF( MSVC ) + SET(CMAKE_CXX_FLAGS "/EHsc /LD") + 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 ) +ELSE( ) + SET( PTHREAD_LIBRARY pthread ) + ADD_DEFINITIONS( -Wall ) + LINK_DIRECTORIES( /usr/local/lib ) +ENDIF( ) + +INCLUDE_DIRECTORIES( ${XSD_INCLUDE_DIR} ) + +FIND_PACKAGE( Subversion ) +SET( C9X_WC_REVISION 0 ) +IF( Subversion_FOUND ) + # Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} C9X ) +ENDIF( ) + +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/../.. ${PROJECT_SOURCE_DIR}/../../radio/src/fonts/std ) + +set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x) +add_custom_command( + OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY} + COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 . + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp +) + +set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x) +add_custom_command( + OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY} + COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 . + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp +) + +set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x) +add_custom_command( + OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY} + COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 . + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp +) + +SET( companion9x_SRCS + eeprominterface.cpp + hexinterface.cpp + flashinterface.cpp + file.cpp + xmlinterface.cpp + ${PROJECT_BINARY_DIR}/radio.cxx + firmwares/th9x/th9xeeprom.cpp + firmwares/th9x/th9xinterface.cpp + ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp + firmwares/er9x/er9xeeprom.cpp + firmwares/er9x/er9xinterface.cpp + ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp + firmwares/gruvin9x/gruvin9xeeprom.cpp + firmwares/gruvin9x/gruvin9xinterface.cpp + firmwares/opentx/open9xeeprom.cpp + firmwares/opentx/open9xStockeeprom.cpp + firmwares/opentx/open9xinterface.cpp + firmwares/opentx/open9xGruvin9xeeprom.cpp + firmwares/opentx/open9xSky9xeeprom.cpp + firmwares/opentx/opentxTaranisSimulator.cpp + firmwares/opentx/open9xSky9xsimulator.cpp + firmwares/opentx/open9xGruvin9xsimulator.cpp + firmwares/opentx/open9xM128simulator.cpp + firmwares/opentx/open9xsimulator.cpp + firmwares/ersky9x/ersky9xeeprom.cpp + firmwares/ersky9x/ersky9xinterface.cpp + ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp + node.cpp + edge.cpp + helpers.cpp + mdichild.cpp + generaledit.cpp + modeledit.cpp + modelslist.cpp + mountlist.cpp + mixerslist.cpp + avroutputdialog.cpp + preferencesdialog.cpp + burnconfigdialog.cpp + comparedialog.cpp + contributorsdialog.cpp + customizesplashdialog.cpp + burndialog.cpp + printdialog.cpp + fusesdialog.cpp + expodialog.cpp + mixerdialog.cpp + logsdialog.cpp + downloaddialog.cpp + simulatordialog.cpp + xsimulatordialog.cpp + splashlibrary.cpp + mainwindow.cpp + main.cpp + modelconfigdialog.cpp + qcustomplot.cpp +) + +SET( companion9x_MOC_HDRS + avroutputdialog.h + preferencesdialog.h + burnconfigdialog.h + comparedialog.h + printdialog.h + fusesdialog.h + mixerdialog.h + logsdialog.h + expodialog.h + contributorsdialog.h + customizesplashdialog.h + splashlibrary.h + splashlabel.h + burndialog.h + downloaddialog.h + cursorwidget.h + menuwidget.h + simulatordialog.h + xcursorwidget.h + xmenuwidget.h + xsimulatordialog.h + generaledit.h + modeledit.h + modelslist.h + mixerslist.h + mdichild.h + mainwindow.h + myslider.h + modelconfigdialog.h + qcustomplot.h +) + +SET( companion9x_UIS + mdichild.ui + avroutputdialog.ui + comparedialog.ui + fusesdialog.ui + expodialog.ui + logsdialog.ui + mixerdialog.ui + preferencesdialog.ui + simulatordialog.ui + xsimulatordialog.ui + burnconfigdialog.ui + downloaddialog.ui + generaledit.ui + modeledit.ui + printdialog.ui + contributorsdialog.ui + customizesplashdialog.ui + splashlibrary.ui + burndialog.ui + modelconfigdialog.ui +) + +IF ( SDL_FOUND ) + SET( companion9x_SRCS + ${companion9x_SRCS} + joystick.cpp + joystickdialog.cpp + ) + + SET( companion9x_MOC_HDRS + ${companion9x_MOC_HDRS} + joystick.h + joystickdialog.h + ) + + SET( companion9x_UIS + ${companion9x_UIS} + joystickdialog.ui + ) +ENDIF( ) + +SET( companion9x_RCS + companion9x.qrc + ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc +) + +MACRO (TODAY RESULT) + IF (WIN32) + EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/(....).*" "\\1.\\2.\\3" ${RESULT} ${${RESULT}}) + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/(....).*" "\\1.\\2.\\3" ${RESULT} ${${RESULT}}) + ELSE (WIN32) + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} 00.00.0000) + ENDIF (WIN32) +ENDMACRO (TODAY) + +MACRO (NOW RESULT) + IF (WIN32) + EXECUTE_PROCESS(COMMAND "cmd" " /C time /T" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..):(..).*" "\\1:\\2:00" ${RESULT} ${${RESULT}}) + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%H:%M:%S" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..):(..):(..).*" "\\1:\\2:\\3" ${RESULT} ${${RESULT}}) + ELSE (WIN32) + MESSAGE(SEND_ERROR "time not implemented") + SET(${RESULT} 00:00:00) + ENDIF (WIN32) +ENDMACRO (NOW) + +TODAY(DATE) +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) + +# Subversion_WC_INFO( ${PROJECT_SOURCE_DIR}/../${FIRMWARE} G9X ) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${CMAKE_CURRENT_BINARY_DIR}/stamp-opentx.h @ONLY) + +SET( PATCH_FLAGS "--binary" ) + +IF( WIN32 ) + SET( companion9x_SRCS ${companion9x_SRCS} icon.rc ) + IF ( NOT MSVC ) + SET(CMAKE_EXE_LINKER_FLAGS -mwindows) + ENDIF( ) +ENDIF( ) + +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ) +INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ) + + +SET( LANGUAGES he pt ru de fr it sv cs ) +FOREACH( language ${LANGUAGES} ) + SET( companion9x_TS ${companion9x_TS} translations/companion9x_${language}.ts ) +ENDFOREACH( language ) + +QT4_WRAP_UI( companion9x_SRCS ${companion9x_UIS} ) +QT4_WRAP_CPP( companion9x_SRCS ${companion9x_MOC_HDRS} ) +QT4_ADD_TRANSLATION( companion9x_QM ${companion9x_TS} ) +QT4_ADD_RESOURCES( companion9x_SRCS ${companion9x_RCS} ) + +ADD_DEFINITIONS( -DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" ) + +IF( APPLE ) + ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion9x_SRCS} ${companion9x_QM} ) +ELSE( ) + ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion9x_SRCS} ${companion9x_QM} ) +ENDIF( ) + +TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ) + +IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) + INSTALL( FILES companion9x.desktop DESTINATION share/applications ) + INSTALL( FILES companion9x.png DESTINATION share/icons ) + INSTALL( FILES ../linuxtools/45-taranis.rules DESTINATION /etc/udev/rules.d/ ) + # Linux specific code + SET(OperatingSystem "Linux") +ELSE (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${QT_BINARY_DIR} ) +ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + +IF( WIN32 ) + IF( MSVC ) + SET( NSI_IN_FILE companion9x-vs.nsi.in ) + ELSE( ) + SET( NSI_IN_FILE companion9x-msys.nsi.in ) + ENDIF( ) + + SET( SYSDIR "$ENV{windir}/system32" ) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../winbuild/${NSI_IN_FILE} ${CMAKE_CURRENT_BINARY_DIR}/companion9x.nsi @ONLY) + + FIND_PROGRAM(NSIS_EXE makensis.exe PATHS + "C:/Program Files/NSIS" + "C:/Program Files (x86)/NSIS" + "C:/Programs/NSIS" + ) + + ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companion9xInstall.exe + COMMAND "${NSIS_EXE}" ARGS companion9x.nsi + DEPENDS ${PROJECT_NAME} ${PROJECT_BINARY_DIR}/companion9x.nsi + COMMENT "Windows NSIS Installer") + + ADD_CUSTOM_TARGET( installer + DEPENDS ${PROJECT_BINARY_DIR}/companion9xInstall.exe + SOURCES ${PROJECT_BINARY_DIR}/companion9x.nsi) +ENDIF( ) + +IF( APPLE ) + SET(MACOSX_BUNDLE_ICON_FILE iconmac.icns) + IF( CMAKE_GENERATOR STREQUAL Xcode ) + SET( WORK_DIR ${CMAKE_BINARY_DIR}/Debug ) + ELSE( ) + SET( WORK_DIR ${PROJECT_BINARY_DIR} ) + ENDIF() + + ADD_CUSTOM_TARGET( addframeworks ALL + COMMAND mkdir -p companion9x.app/Contents/Frameworks + COMMAND mkdir -p companion9x.app/Contents/Resources + COMMAND mkdir -p companion9x.app/Contents/translations + COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion9x.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files + COMMAND rsync ${PROJECT_SOURCE_DIR}/../macbuild/lib* companion9x.app/Contents/Frameworks + #COMMAND rsync ${PROJECT_SOURCE_DIR}/../macbuild/libcrypto.1.0.0.dylib companion9x.app/Contents/Frameworks + COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../macbuild/qt_menu.nib companion9x.app/Contents/Resources/ + COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion9x.app/Contents/translations + COMMAND ${QT_BINARY_DIR}/macdeployqt companion9x.app + WORKING_DIRECTORY ${WORK_DIR} + DEPENDS ${PROJECT_NAME} ) + + + ADD_CUSTOM_TARGET( makedmg + COMMAND ${QT_BINARY_DIR}/macdeployqt companion9x.app -dmg -no-plugins + WORKING_DIRECTORY ${WORK_DIR} + DEPENDS addframeworks ) + +ENDIF( ) + +ADD_CUSTOM_TARGET( stamp + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/version.h ${CMAKE_SOURCE_DIR}/../companion9x.stamp + DEPENDS ${CMAKE_BINARY_DIR}/version.h ) + +ADD_CUSTOM_TARGET( translations + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND lupdate-qt4 ${CMAKE_SOURCE_DIR} -ts ${companion9x_TS} ) + +SET(CPACK_PACKAGE_NAME "COMPANION9X") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "EEPROM Editor for the openTx open source firmware") +string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE) +find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") +if(DPKG_PROGRAM) + SET(CPACK_GENERATOR "DEB") + execute_process( + COMMAND ${DPKG_PROGRAM} --print-architecture + OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${C9X_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Romolo Manfredini ") + SET(CPACK_DEBIAN_PACKAGE_VERSION ${C9X_VERSION}) + SET(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${C9X_VERSION_MAJOR}) + SET(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${C9X_VERSION_MINOR}) + SET(CPACK_DEBIAN_ARCHITECTURE $(CMAKE_SYSTEM_PROCESSOR)) + SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +else(DPKG_PROGRAM) + SET(CPACK_GENERATOR "RPM") + 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}") +endif(DPKG_PROGRAM) + +INCLUDE(CPack) diff --git a/companion/src/avroutputdialog.cpp b/companion/src/avroutputdialog.cpp new file mode 100644 index 000000000..a125d8e99 --- /dev/null +++ b/companion/src/avroutputdialog.cpp @@ -0,0 +1,481 @@ +#include "avroutputdialog.h" +#include "ui_avroutputdialog.h" +#include +#include "eeprominterface.h" +#include "flashinterface.h" + +#if defined WIN32 || !defined __GNUC__ +#include +#include +#include +#define sleep(x) Sleep(x*1000) +#else +#include +#include "mountlist.h" +#endif + +avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg, QString wTitle, int closeBehaviour, bool displayDetails) : + QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), + ui(new Ui::avrOutputDialog), + kill_timer(NULL), + hasErrors(false) +{ + ui->setupUi(this); + +#ifdef __APPLE__ + QFont newFont("Courier", 13); + ui->plainTextEdit->setFont(newFont); + ui->plainTextEdit->setAttribute(Qt::WA_MacNormalSize); +#endif +#if defined WIN32 || !defined __GNUC__ + QFont newFont("Courier", 9); + ui->plainTextEdit->setFont(newFont); +#endif + + cmdLine = prog; + closeOpt = closeBehaviour; + if (cmdLine.isEmpty()) { + if (arg.count()<2) { + closeOpt = AVR_DIALOG_FORCE_CLOSE; + QTimer::singleShot(0, this, SLOT(forceClose())); + } else { + sourceFile=arg.at(0); + destFile=arg.at(1); + if (!displayDetails) { + ui->plainTextEdit->hide(); + QTimer::singleShot(0, this, SLOT(shrink())); + } else { + ui->checkBox->setChecked(true); + } + ui->progressBar->setMaximum(127); + QTimer::singleShot(500, this, SLOT(doCopy())); + } + } else { + if(wTitle.isEmpty()) + setWindowTitle(getProgrammer() + " " + tr("result")); + else + setWindowTitle(getProgrammer() + " - " + wTitle); + QFile exec; + winTitle=wTitle; + if (!(exec.exists(prog))) { + QMessageBox::critical(this, "companion9x", getProgrammer() + " " + tr("executable not found")); + closeOpt = AVR_DIALOG_FORCE_CLOSE; + QTimer::singleShot(0, this, SLOT(forceClose())); + } else { + foreach(QString str, arg) cmdLine.append(" " + str); + lfuse = 0; + hfuse = 0; + efuse = 0; + phase=0; + currLine.clear(); + prevLine.clear(); + if (!displayDetails) { + ui->plainTextEdit->hide(); + QTimer::singleShot(0, this, SLOT(shrink())); + } else { + ui->checkBox->setChecked(true); + } + process = new QProcess(this); + connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr())); + connect(process,SIGNAL(started()),this,SLOT(doProcessStarted())); + connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(doAddTextStdOut())); + connect(process,SIGNAL(finished(int)),this,SLOT(doFinished(int))); + + #if !__GNUC__ + kill_timer = new QTimer(this); + connect(kill_timer, SIGNAL(timeout()), this, SLOT(killTimerElapsed())); + kill_timer->start(2000); + #endif + + process->start(prog,arg); + } + } +} + +# if !__GNUC__ +BOOL KillProcessByName(char *szProcessToKill){ + HANDLE hProcessSnap; + HANDLE hProcess; + PROCESSENTRY32 pe32; + DWORD dwPriorityClass; + + hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // Takes a snapshot of all the processes + + if(hProcessSnap == INVALID_HANDLE_VALUE){ + return( FALSE ); + } + + pe32.dwSize = sizeof(PROCESSENTRY32); + + if(!Process32First(hProcessSnap, &pe32)){ + CloseHandle(hProcessSnap); + return( FALSE ); + } + + do{ + if(!strcmp(pe32.szExeFile,szProcessToKill)){ // checks if process at current position has the name of to be killed app + hProcess = OpenProcess(PROCESS_TERMINATE,0, pe32.th32ProcessID); // gets handle to process + TerminateProcess(hProcess,0); // Terminate process by handle + CloseHandle(hProcess); // close the handle + } + }while(Process32Next(hProcessSnap,&pe32)); // gets next member of snapshot + + CloseHandle(hProcessSnap); // closes the snapshot handle + return( TRUE ); +} +#endif + +void avrOutputDialog::doCopy() +{ + hasErrors=false; + char buf[READBUF]; + char * pointer=buf; + QFile source(sourceFile); + int blocks=(source.size()/BLKSIZE); + ui->progressBar->setMaximum(blocks-1); + if (!source.open(QIODevice::ReadOnly)) { + QMessageBox::warning(this, tr("Error"),tr("Cannot open source file")); + hasErrors=true; + } else { + source.read(buf,READBUF); + source.close(); + QFile dest(destFile); + if (!dest.open(QIODevice::WriteOnly)) { + QMessageBox::warning(this, tr("Error"),tr("Cannot write destination")); + hasErrors=true; + } else { + addText(tr("Writing file: ")); + for (int i=0;iprogressBar->setValue(i); + if ((i%2)!=0) + addText("#"); + } + dest.close(); + } + } + doFinished(0); +} + +void avrOutputDialog::killTimerElapsed() +{ + delete kill_timer; + kill_timer = NULL; +# if !__GNUC__ + KillProcessByName("tasklist.exe"); +#endif +} + +avrOutputDialog::~avrOutputDialog() +{ + delete ui; + delete kill_timer; +} + +void avrOutputDialog::runAgain(QString prog, QStringList arg, int closeBehaviour) +{ + cmdLine = prog; + foreach(QString str, arg) cmdLine.append(" " + str); + closeOpt = closeBehaviour; + currLine.clear(); + prevLine.clear(); + process->start(prog,arg); +} + +void avrOutputDialog::waitForFinish() +{ + process->waitForFinished(); +} + +void avrOutputDialog::addText(const QString &text) +{ + int val = ui->plainTextEdit->verticalScrollBar()->maximum(); + ui->plainTextEdit->insertPlainText(text); + if(val!=ui->plainTextEdit->verticalScrollBar()->maximum()) + ui->plainTextEdit->verticalScrollBar()->setValue(ui->plainTextEdit->verticalScrollBar()->maximum()); +} + + +void avrOutputDialog::doAddTextStdOut() +{ + QByteArray data = process->readAllStandardOutput(); + QString text = QString(data); + QString temp; + int nlPos, pos, size; + + addText(text); + currStdLine.append(text); + if (currStdLine.contains("size = ")) { + pos=currStdLine.lastIndexOf("size = "); + temp=currStdLine.mid(pos+7); + pos=temp.lastIndexOf("\n"); + size=temp.left(pos).toInt(); + ui->progressBar->setMaximum(size/2048); + } + if (currStdLine.contains("\n")) { + nlPos=currStdLine.lastIndexOf("\n"); + prevStdLine=currStdLine.left(nlPos).trimmed(); + currStdLine=currStdLine.mid(nlPos+1); + } + if (!currStdLine.isEmpty()) { + if (currStdLine.at(0)==QChar('.')) { + pos=currStdLine.lastIndexOf("."); + ui->progressBar->setValue(pos); + } + } + if (!currStdLine.isEmpty()) { + if (currStdLine.startsWith("Starting upload: [")) { + pos=(currStdLine.lastIndexOf("#")-19)/(MAX_FSIZE/204800.0); + ui->progressBar->setValue(pos); + } + } + if (text.contains("Complete ")) { +#if !__GNUC__ + if (kill_timer) { + delete kill_timer; + kill_timer = NULL; + } +#endif + int start = text.indexOf("Complete "); + int end = text.indexOf("%"); + if (start > 0) { + start += 9; + int value = text.mid(start, end-start).toInt(); + ui->progressBar->setValue(value); + } + } + + //addText("\n=====\n" + text + "\n=====\n"); + + if(text.contains(":010000")) //contains fuse info + { + QStringList stl = text.split(":01000000"); + + foreach (QString t, stl) + { + bool ok = false; + if(!lfuse) lfuse = t.left(2).toInt(&ok,16); + if(!hfuse && !ok) hfuse = t.left(2).toInt(&ok,16); + if(!efuse && !ok) efuse = t.left(2).toInt(&ok,16); + } + } + + if (text.contains("-E-")) { + hasErrors = true; + } + +} + +QString avrOutputDialog::getProgrammer() +{ + EEPROMInterface *eepromInterface = GetEepromInterface(); + if (IS_TARANIS(eepromInterface->getBoard())) { + return "DFU Util"; + } else if (eepromInterface->getBoard()==BOARD_SKY9X) { + return "SAM-BA"; + } else { + return "AVRDUDE"; + } +} + +void avrOutputDialog::errorWizard() +{ + QString output=ui->plainTextEdit->toPlainText(); + if (output.contains("avrdude: Expected signature for")) { // wrong signature + int pos=output.indexOf("avrdude: Device signature = "); + bool fwexist=false; + QString DeviceStr="Unknown"; + QString FwStr=""; + + if (pos>0) { + QString DeviceId=output.mid(pos+28,8); + if (DeviceId=="0x1e9602") { + DeviceStr="Atmega 64"; + FwStr="\n"+tr("ie: OpenTX for 9X board or OpenTX for 9XR board"); + fwexist=true; + } else if (DeviceId=="0x1e9702") { + DeviceStr="Atmega 128"; + FwStr="\n"+tr("ie: OpenTX for M128 / 9X board or OpenTX for 9XR board with M128 chip"); + fwexist=true; + } else if (DeviceId=="0x1e9703") { + DeviceStr="Atmega 1280"; + } else if (DeviceId=="0x1e9704") { + DeviceStr="Atmega 1281"; + } else if (DeviceId=="0x1e9801") { + DeviceStr="Atmega 2560"; + FwStr="\n"+tr("ie: OpenTX for Gruvin9X board"); + fwexist=true; + } else if (DeviceId=="0x1e9802") { + DeviceStr="Atmega 2561"; + } + } + if (fwexist==false) { + QMessageBox::warning(this, "companion9x - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr)); + } else { + FirmwareInfo *firmware = GetCurrentFirmware(); + QMessageBox::warning(this, "companion9x - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name)); + } + } +} + +void avrOutputDialog::doAddTextStdErr() +{ + int nlPos; + int pbvalue; + QString avrphase; + QByteArray data = process->readAllStandardError(); + QString text = QString(data); + + currLine.append(text); + if (currLine.contains("#")) { + avrphase=currLine.left(1).toLower(); + if (avrphase=="w") { + ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #ff0000; text-align:center;}:"); + phase=1; + if(winTitle.isEmpty()) + setWindowTitle(getProgrammer() + " - " + tr("Writing")); + else + setWindowTitle(getProgrammer() + " - " + winTitle + " - " + tr("Writing")); + pbvalue=currLine.count("#")*2; + ui->progressBar->setValue(pbvalue); + } + if (avrphase=="r") { + if (phase==0) { + ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #00ff00; text-align:center;}:"); + if(winTitle.isEmpty()) + setWindowTitle(getProgrammer() + " - " + tr("Reading")); + else + setWindowTitle(getProgrammer() + " - " + winTitle + " - " + tr("Reading")); + } else { + ui->progressBar->setStyleSheet("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: #0000ff; text-align:center;}:"); + phase=2; + if(winTitle.isEmpty()) + setWindowTitle(getProgrammer() + " - " + tr("Verifying")); + else + setWindowTitle(getProgrammer() + " - " + winTitle + " - " + tr("Verifying")); + } + pbvalue=currLine.count("#")*2; + ui->progressBar->setValue(pbvalue); + } + } + if (currLine.contains("\n")) { + nlPos=currLine.lastIndexOf("\n"); + prevLine=currLine.left(nlPos).trimmed(); + currLine=currLine.mid(nlPos+1); + } + if (text.contains("-E-") && !text.contains("-E- No receive file name")) { + hasErrors = true; + } + + addText(text); +} + +#define HLINE_SEPARATOR "=================================================================================" +void avrOutputDialog::doFinished(int code=0) +{ + addText("\n" HLINE_SEPARATOR); + if (code==1 && getProgrammer()=="SAM-BA") + code=0; + + if (code) { + ui->checkBox->setChecked(true); + addText("\n" + getProgrammer() + " " + tr("done - exit code %1").arg(code)); + } else if (hasErrors) { + ui->checkBox->setChecked(true); + addText("\n" + getProgrammer() + " " + tr("done with errors")); + } else if (!cmdLine.isEmpty()) { + addText("\n" + getProgrammer() + " " + tr("done - SUCCESSFUL")); + } else { + addText(tr("done - SUCCESSFUL")); + } + addText("\n" HLINE_SEPARATOR "\n"); + + if(lfuse || hfuse || efuse) addReadFuses(); + + switch(closeOpt) + { + case AVR_DIALOG_CLOSE_IF_SUCCESSFUL: + if (!hasErrors && !code) accept(); + if (code) { + errorWizard(); + } + break; + case AVR_DIALOG_FORCE_CLOSE: + if (hasErrors || code) + reject(); + else + accept(); + break; + + case AVR_DIALOG_SHOW_DONE: + if (hasErrors || code) { + if (!cmdLine.isEmpty()) { + if (getProgrammer()!="AVRDUDE") { + QMessageBox::critical(this, "companion9x", getProgrammer() + " " + tr("did not finish correctly")); + } else { + int res = QMessageBox::question(this, "companion9x",getProgrammer() + " " + tr("did not finish correctly!\nDo you want some help ?"),QMessageBox::Yes | QMessageBox::No); + if (res != QMessageBox::No) { + errorWizard(); + } + } + } else { + QMessageBox::critical(this, "companion9x", tr("Copy did not finish correctly")); + } + // reject(); + } else { + if (!cmdLine.isEmpty()) { + ui->progressBar->setValue(100); + QMessageBox::information(this, "companion9x", getProgrammer() + " " + tr("finished correctly")); + accept(); + } else { + QMessageBox::information(this, "companion9x", tr("Copy finished correctly")); + accept(); + } + } + break; + + default: //AVR_DIALOG_KEEP_OPEN + break; + } + + +} + +void avrOutputDialog::doProcessStarted() +{ + addText(HLINE_SEPARATOR "\n"); + addText(tr("Started") + " " + getProgrammer() + "\n"); + addText(cmdLine); + addText("\n" HLINE_SEPARATOR "\n"); +} + + + +void avrOutputDialog::addReadFuses() +{ + addText(HLINE_SEPARATOR "\n"); + addText(tr("FUSES: Low=%1 High=%2 Ext=%3").arg(lfuse,2,16,QChar('0')).arg(hfuse,2,16,QChar('0')).arg(efuse,2,16,QChar('0'))); + addText("\n" HLINE_SEPARATOR "\n"); +} + +void avrOutputDialog::on_checkBox_toggled(bool checked) { + if (checked) { + ui->plainTextEdit->show(); + } else { + ui->plainTextEdit->hide(); + QTimer::singleShot(0, this, SLOT(shrink())); + } +} + +void avrOutputDialog::shrink() { + resize(0,0); +} + +void avrOutputDialog::forceClose() { + accept();; +} diff --git a/companion/src/avroutputdialog.h b/companion/src/avroutputdialog.h new file mode 100644 index 000000000..0eedabcc2 --- /dev/null +++ b/companion/src/avroutputdialog.h @@ -0,0 +1,67 @@ +#ifndef AVROUTPUTDIALOG_H +#define AVROUTPUTDIALOG_H + +#include +#include + +#define AVR_DIALOG_CLOSE_IF_SUCCESSFUL 0x00 +#define AVR_DIALOG_KEEP_OPEN 0x01 +#define AVR_DIALOG_FORCE_CLOSE 0x02 +#define AVR_DIALOG_SHOW_DONE 0x04 +#define READBUF 65536 +#define BLKSIZE 512 + + +namespace Ui { + class avrOutputDialog; +} + +class avrOutputDialog : public QDialog +{ + Q_OBJECT + +public: + explicit avrOutputDialog(QWidget *parent, QString prog, QStringList arg, QString wTitle, int closeBehaviour=AVR_DIALOG_CLOSE_IF_SUCCESSFUL, bool displayDetails=false); + ~avrOutputDialog(); + + void addText(const QString &text); + void runAgain(QString prog, QStringList arg, int closeBehaviour=AVR_DIALOG_CLOSE_IF_SUCCESSFUL); + void waitForFinish(); + void addReadFuses(); + +protected slots: + void doAddTextStdOut(); + void doAddTextStdErr(); + void doProcessStarted(); + void doCopy(); + void doFinished(int code); + void on_checkBox_toggled(bool checked); + void shrink(); + void forceClose(); + void killTimerElapsed(); + void errorWizard(); + +private: + QString getProgrammer(); + Ui::avrOutputDialog *ui; + + QProcess *process; + QTimer *kill_timer; + QString cmdLine; + int closeOpt; + quint8 lfuse; + quint8 hfuse; + quint8 efuse; + QString prevLine; + QString currLine; + QString prevStdLine; + QString currStdLine; + int phase; + QString winTitle; + bool hasErrors; + QString sourceFile; + QString destFile; + +}; + +#endif // AVROUTPUTDIALOG_H diff --git a/companion/src/avroutputdialog.ui b/companion/src/avroutputdialog.ui new file mode 100644 index 000000000..54ecf8d74 --- /dev/null +++ b/companion/src/avroutputdialog.ui @@ -0,0 +1,115 @@ + + + avrOutputDialog + + + + 0 + 0 + 700 + 348 + + + + + 0 + 0 + + + + + 700 + 0 + + + + + 16777215 + 16777215 + + + + Dialog + + + + :/icon.png:/icon.png + + + + + + + + + 0 + 0 + + + + + 480 + 0 + + + + 0 + + + + + + + Show Details + + + + + + + + + true + + + + 0 + 0 + + + + + 0 + 312 + + + + + Courier + 10 + + + + Qt::ScrollBarAlwaysOn + + + QPlainTextEdit::WidgetWidth + + + true + + + + + + Qt::TextSelectableByMouse + + + + + + + + + + diff --git a/companion/src/burnconfigdialog.cpp b/companion/src/burnconfigdialog.cpp new file mode 100644 index 000000000..71887d4da --- /dev/null +++ b/companion/src/burnconfigdialog.cpp @@ -0,0 +1,423 @@ +#include "burnconfigdialog.h" +#include "ui_burnconfigdialog.h" +#include "avroutputdialog.h" +#include "eeprominterface.h" +#include + +#if !defined WIN32 && defined __GNUC__ +#include +#endif + +burnConfigDialog::burnConfigDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::burnConfigDialog) +{ + ui->setupUi(this); + ui->avrdude_programmer->model()->sort(0); + + getSettings(); + populateProgrammers(); + EEPROMInterface *eepromInterface = GetEepromInterface(); + if (IS_TARANIS(eepromInterface->getBoard())) { + setWindowTitle(tr("DFU-UTIL Configuration")); + ui->avrArgs->hide(); + ui->avrdude_location->hide(); + ui->avrdude_port->hide(); + ui->avrdude_programmer->hide(); + ui->label_av1->hide(); + ui->label_av2->hide(); + ui->label_av4->hide(); + ui->label_av5->hide(); + ui->pushButton->hide(); + ui->pushButton_3->hide(); + ui->pushButton_4->hide(); + ui->label_sb1->hide(); + ui->label_sb3->hide(); + ui->samba_location->hide(); + ui->samba_port->hide(); + ui->sb_browse->hide(); + } else if (eepromInterface->getBoard()==BOARD_SKY9X) { + setWindowTitle(tr("SAM-BA Configuration")); + ui->avrArgs->hide(); + ui->avrdude_location->hide(); + ui->avrdude_port->hide(); + ui->avrdude_programmer->hide(); + ui->label_av1->hide(); + ui->label_av2->hide(); + ui->label_av4->hide(); + ui->label_av5->hide(); + ui->pushButton->hide(); + ui->pushButton_3->hide(); + ui->pushButton_4->hide(); + ui->label_dfu1->hide(); + ui->dfu_location->hide(); + ui->dfu_browse->hide(); + } else { + setWindowTitle(tr("AVRDUDE Configuration")); + ui->label_sb1->hide(); + ui->label_sb3->hide(); + ui->samba_location->hide(); + ui->samba_port->hide(); + ui->sb_browse->hide(); + ui->label_dfu1->hide(); + ui->label_dfu2->hide(); + ui->dfu_location->hide(); + ui->dfu_browse->hide(); + } + ui->label_av3->hide(); + ui->avrdude_mcu->hide(); + ui->label_sb2->hide(); + ui->arm_mcu->hide(); + ui->label_dfu2->hide(); + ui->dfuArgs->hide(); + + QTimer::singleShot(0, this, SLOT(shrink())); + connect(this,SIGNAL(accepted()),this,SLOT(putSettings())); +} + +burnConfigDialog::~burnConfigDialog() +{ + delete ui; +} + +void burnConfigDialog::getSettings() +{ + QSettings settings("companion9x", "companion9x"); +#if defined WIN32 || !defined __GNUC__ + avrLoc = settings.value("avrdude_location", QFileInfo("avrdude.exe").absoluteFilePath()).toString(); + sambaLoc = settings.value("samba_location", QFileInfo("sam-ba.exe").absoluteFilePath()).toString(); + dfuLoc = settings.value("dfu_location", QFileInfo("dfu-util.exe").absoluteFilePath()).toString(); +#elif defined __APPLE__ + avrLoc = settings.value("avrdude_location", "/usr/local/bin/avrdude").toString(); + sambaLoc = settings.value("samba_location", "/usr/local/bin/sam-ba").toString(); + dfuLoc = settings.value("dfu_location", QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath()).toString(); +#else + avrLoc = settings.value("avrdude_location", "/usr/bin/avrdude").toString(); + sambaLoc = settings.value("samba_location", "/usr/bin/sam-ba").toString(); + dfuLoc = settings.value("dfu_location", QFileInfo("/usr/bin/dfu-util").absoluteFilePath()).toString(); +#endif + QString str = settings.value("avr_arguments").toString(); + avrArgs = str.split(" ", QString::SkipEmptyParts); + + avrProgrammer = settings.value("programmer", QString("usbasp")).toString(); + + avrMCU = settings.value("mcu", QString("m64")).toString(); + armMCU = settings.value("arm_mcu", QString("at91sam3s4-9x")).toString(); + + avrPort = settings.value("avr_port", "").toString(); + sambaPort = settings.value("samba_port", "\\USBserial\\COM23").toString(); + + str = settings.value("dfu_arguments", "-a 0").toString(); + dfuArgs = str.split(" ", QString::SkipEmptyParts); + ui->avrdude_location->setText(getAVRDUDE()); + ui->avrArgs->setText(getAVRArgs().join(" ")); + + ui->samba_location->setText(getSAMBA()); + ui->samba_port->setText(getSambaPort()); + + ui->dfu_location->setText(getDFU()); + ui->dfuArgs->setText(getDFUArgs().join(" ")); + + int idx1 = ui->avrdude_programmer->findText(getProgrammer()); + int idx2 = ui->avrdude_port->findText(getPort()); + int idx3 = ui->avrdude_mcu->findText(getMCU()); + int idx4 = ui->arm_mcu->findText(getArmMCU()); + if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1); + if(idx2>=0) ui->avrdude_port->setCurrentIndex(idx2); + if(idx3>=0) ui->avrdude_mcu->setCurrentIndex(idx3); + if(idx4>=0) ui->arm_mcu->setCurrentIndex(idx4); + QFile file; + if (file.exists(avrLoc)) { + ui->pushButton_3->setEnabled(true); + } else { + ui->pushButton_3->setDisabled(true); + } +} + +void burnConfigDialog::putSettings() +{ + QSettings settings("companion9x", "companion9x"); + settings.setValue("avrdude_location", avrLoc); + settings.setValue("programmer", avrProgrammer); + settings.setValue("mcu", avrMCU); + settings.setValue("avr_port", avrPort); + settings.setValue("avr_arguments", avrArgs.join(" ")); + settings.setValue("samba_location", sambaLoc); + settings.setValue("samba_port", sambaPort); + settings.setValue("arm_mcu", armMCU); + settings.setValue("dfu_location", dfuLoc); + settings.setValue("dfu_arguments", dfuArgs.join(" ")); +} + +void burnConfigDialog::populateProgrammers() +{ + QString fileName = QFileInfo(avrLoc).canonicalPath() + "/avrdude.conf"; //for windows + if(!QFileInfo(fileName).exists()) fileName = "/etc/avrdude.conf"; //for linux + if(!QFileInfo(fileName).exists()) fileName = "/etc/avrdude/avrdude.conf"; //for linux + if(!QFileInfo(fileName).exists()) return; // not found avrdude.conf - returning + + QFile file(fileName); + + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; + + QStringList items; + QString line = ""; + QString prevline = ""; + QTextStream in(&file); + while (!in.atEnd()) + { + prevline = line; + line = in.readLine(); + + if(prevline.left(10).toLower()=="programmer") + items << line.section('"',1,1); + } + file.close(); + + items.sort(); + + QString avrProgrammer_temp = avrProgrammer; + ui->avrdude_programmer->clear(); + ui->avrdude_programmer->addItems(items); + int idx1 = ui->avrdude_programmer->findText(avrProgrammer_temp); + if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1); +} + +void burnConfigDialog::on_avrdude_programmer_currentIndexChanged(QString ) +{ + avrProgrammer = ui->avrdude_programmer->currentText(); +} + +void burnConfigDialog::on_avrdude_mcu_currentIndexChanged(QString ) +{ + avrMCU = ui->avrdude_mcu->currentText(); +} + +void burnConfigDialog::on_avrdude_location_editingFinished() +{ + avrLoc = ui->avrdude_location->text(); + if (avrLoc.isEmpty()) { + ui->pushButton_3->setDisabled(true); + } else { + QFile file; + if (file.exists(avrLoc)) { + ui->pushButton_3->setEnabled(true); + } + } +} + +void burnConfigDialog::on_avrArgs_editingFinished() +{ + avrArgs = ui->avrArgs->text().split(" ", QString::SkipEmptyParts); +} + +void burnConfigDialog::on_avrdude_port_currentIndexChanged(QString ) +{ + avrPort = ui->avrdude_port->currentText(); +} + +void burnConfigDialog::on_samba_location_editingFinished() +{ + sambaLoc = ui->samba_location->text(); +} + +void burnConfigDialog::on_samba_port_editingFinished() +{ + sambaPort = ui->samba_port->text(); +} + +void burnConfigDialog::on_arm_mcu_currentIndexChanged(QString ) +{ + armMCU = ui->arm_mcu->currentText(); +} + +void burnConfigDialog::on_pushButton_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->avrdude_location->text()); + + if(!fileName.isEmpty()) + { + ui->avrdude_location->setText(fileName); + avrLoc = fileName; + } +} + +void burnConfigDialog::on_sb_browse_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->samba_location->text()); + if(!fileName.isEmpty()) + { + ui->samba_location->setText(fileName); + sambaLoc = fileName; + } +} + +void burnConfigDialog::on_dfu_browse_clicked() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->dfu_location->text()); + + if(!fileName.isEmpty()) + { + ui->dfu_location->setText(fileName); + dfuLoc = fileName; + } +} + +void burnConfigDialog::on_dfu_location_editingFinished() +{ + dfuLoc = ui->dfu_location->text(); +} + +void burnConfigDialog::on_dfuArgs_editingFinished() +{ + dfuArgs = ui->dfuArgs->text().split(" ", QString::SkipEmptyParts); +} + +void burnConfigDialog::listProgrammers() +{ + QStringList arguments; + arguments << "-c?"; + avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "List available programmers", AVR_DIALOG_KEEP_OPEN, TRUE); + ad->setWindowIcon(QIcon(":/images/list.png")); + ad->show(); +} + +void burnConfigDialog::on_pushButton_3_clicked() +{ + listProgrammers(); +} + + + +void burnConfigDialog::on_pushButton_4_clicked() +{ + QStringList arguments; + arguments << "-?"; + + avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "Show help", AVR_DIALOG_KEEP_OPEN,TRUE); + ad->setWindowIcon(QIcon(":/images/configure.png")); + ad->show(); +} + + +void burnConfigDialog::readFuses() +{ + QStringList args = avrArgs; + if(!avrPort.isEmpty()) args << "-P" << avrPort; + + QStringList str; + str << "-U" << "lfuse:r:-:i" << "-U" << "hfuse:r:-:i" << "-U" << "efuse:r:-:i"; + + QStringList arguments; + arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << str; + + avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Read Fuses",AVR_DIALOG_KEEP_OPEN,TRUE); + ad->setWindowIcon(QIcon(":/images/fuses.png")); + ad->show(); +} + +void burnConfigDialog::restFuses(bool eeProtect) +{ + //fuses + //avrdude -c usbasp -p m64 -U lfuse:w:<0x0E>:m + //avrdude -c usbasp -p m64 -U hfuse:w:<0x89>:m 0x81 for eeprom protection + //avrdude -c usbasp -p m64 -U efuse:w:<0xFF>:m + + QMessageBox::StandardButton ret = QMessageBox::No; + + ret = QMessageBox::warning(this, tr("companion9x"), + tr("WARNING!
This will reset the fuses of %1 to the factory settings.
Writing fuses can mess up your radio.
Do this only if you are sure they are wrong!
Are you sure you want to continue?").arg(avrMCU), + QMessageBox::Yes | QMessageBox::No); + if (ret == QMessageBox::Yes) + { + QStringList args = avrArgs; + if(!avrPort.isEmpty()) args << "-P" << avrPort; + QStringList str; + if (avrMCU=="m2560") { + args << "-B8"; + QString erStr = eeProtect ? "hfuse:w:0x11:m" : "hfuse:w:0x19:m"; + str << "-U" << "lfuse:w:0xD7:m" << "-U" << erStr << "-U" << "efuse:w:0xFC:m"; + //use hfuse = 0x81 to prevent eeprom being erased with every flashing + } else { + QString tempDir = QDir::tempPath(); + QString tempFile; + QString lfuses; + tempFile = tempDir + "/ftemp.bin"; + QStringList argread; + argread << "-c" << avrProgrammer << "-p" << avrMCU << args <<"-U" << "lfuse:r:"+tempFile+":r" ; + avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, argread, "Reset Fuses",AVR_DIALOG_CLOSE_IF_SUCCESSFUL,FALSE); + ad->setWindowIcon(QIcon(":/images/fuses.png")); + ad->exec(); + QFile file(tempFile); + if (file.exists() && file.size()==1) { + file.open(QIODevice::ReadOnly); + char bin_flash[1]; + file.read(bin_flash, 1); + if (bin_flash[0]==0x0E) { + lfuses="lfuse:w:0x0E:m"; + } else { + lfuses="lfuse:w:0x3F:m"; + } + file.close(); + unlink(tempFile.toAscii()); + } else { + lfuses="lfuse:w:0x3F:m"; + } + + QString erStr = eeProtect ? "hfuse:w:0x81:m" : "hfuse:w:0x89:m"; + str << "-U" << lfuses << "-U" << erStr << "-U" << "efuse:w:0xFF:m"; + //use hfuse = 0x81 to prevent eeprom being erased with every flashing + } + QStringList arguments; + if (avrMCU=="m2560") { + arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-u" << str; + } else { + arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-B" << "100" << "-u" << str; + } + avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Reset Fuses",AVR_DIALOG_KEEP_OPEN,TRUE); + ad->setWindowIcon(QIcon(":/images/fuses.png")); + ad->show(); + } + +} + +void burnConfigDialog::on_advCtrChkB_toggled(bool checked) +{ + EEPROMInterface *eepromInterface = GetEepromInterface(); + if (checked) { + if (IS_TARANIS(eepromInterface->getBoard())) { + ui->label_dfu2->show(); + ui->dfuArgs->show(); + } else if (eepromInterface->getBoard()==BOARD_SKY9X) { + ui->label_sb2->show(); + ui->arm_mcu->show(); + } else { + ui->label_av3->show(); + ui->avrdude_mcu->show(); + QMessageBox::warning(this, tr("companion9x"), + tr("WARNING!
Normally CPU type is automatically selected according to the chosen firmware.
If you change the CPU type the resulting eeprom could be inconsistent."), + QMessageBox::Ok); + } + } else { + if (IS_TARANIS(eepromInterface->getBoard())) { + ui->label_dfu2->hide(); + ui->dfuArgs->hide(); + } else if (eepromInterface->getBoard()==BOARD_SKY9X) { + ui->label_sb2->hide(); + ui->arm_mcu->hide(); + } else { + ui->label_av3->hide(); + ui->avrdude_mcu->hide(); + } + } + QTimer::singleShot(0, this, SLOT(shrink())); +} + + +void burnConfigDialog::shrink() +{ + resize(0,0); +} + + + diff --git a/companion/src/burnconfigdialog.h b/companion/src/burnconfigdialog.h new file mode 100644 index 000000000..fd99a2925 --- /dev/null +++ b/companion/src/burnconfigdialog.h @@ -0,0 +1,76 @@ +#ifndef BURNCONFIGDIALOG_H +#define BURNCONFIGDIALOG_H + +#include +#include + +#define MEM_TYPE_EEPROM 1 +#define MEM_TYPE_FLASH 2 + +#define OPR_TYPE_READ 1 +#define OPR_TYPE_WRITE 2 + +namespace Ui { + class burnConfigDialog; +} + +class burnConfigDialog : public QDialog { + Q_OBJECT +public: + burnConfigDialog(QWidget *parent = 0); + ~burnConfigDialog(); + + QString getAVRDUDE() {return avrLoc;} + QString getSAMBA() {return sambaLoc;} + QString getDFU() {return dfuLoc;} + QStringList getAVRArgs() {return avrArgs;} + QStringList getDFUArgs() {return dfuArgs;} + QString getProgrammer() {return avrProgrammer;} + QString getMCU() {return avrMCU;} + QString getArmMCU() {return armMCU;} + QString getPort() {return avrPort;} + QString getSambaPort() {return sambaPort;} + + void listProgrammers(); + void restFuses(bool eeProtect); + void readFuses(); + +private: + Ui::burnConfigDialog *ui; + + void populateProgrammers(); + + QString avrLoc; + QString sambaLoc; + QString dfuLoc; + QStringList avrArgs; + QString avrProgrammer; + QString avrMCU; + QString armMCU; + QString avrPort; + QString sambaPort; + QStringList dfuArgs; + +private slots: + void shrink(); + void on_avrArgs_editingFinished(); + void on_pushButton_4_clicked(); + void on_pushButton_3_clicked(); + void on_pushButton_clicked(); + void on_avrdude_location_editingFinished(); + void on_avrdude_programmer_currentIndexChanged(QString ); + void on_avrdude_mcu_currentIndexChanged(QString ); + void on_avrdude_port_currentIndexChanged(QString ); + void on_samba_location_editingFinished(); + void on_samba_port_editingFinished(); + void on_arm_mcu_currentIndexChanged(QString ); + void on_sb_browse_clicked(); + void on_dfu_browse_clicked(); + void on_dfu_location_editingFinished(); + void on_dfuArgs_editingFinished(); + void on_advCtrChkB_toggled(bool checked); + void getSettings(); + void putSettings(); +}; + +#endif // BURNCONFIGDIALOG_H diff --git a/companion/src/burnconfigdialog.ui b/companion/src/burnconfigdialog.ui new file mode 100644 index 000000000..ba1adbf17 --- /dev/null +++ b/companion/src/burnconfigdialog.ui @@ -0,0 +1,799 @@ + + + burnConfigDialog + + + + 0 + 0 + 531 + 335 + + + + + 0 + 0 + + + + + 531 + 0 + + + + Programmer Configuration + + + + :/images/configure.png:/images/configure.png + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + false + + + + + + + + + Location of sam-ba executable + + + The location of the AVRDUDE executable. + + + dfu-util + + + + + + + DFU-Util Location + + + + + + + Location of AVRDUDE executable + + + The location of the AVRDUDE executable. + + + + + + + + + + Use this button to browse and look for the AVRDUDE executable file. + + + Browse... + + + + + + + Programmer + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Programmer used for communicating with the controller. +Please consult the programmer's documentation and the AVRDUDE documentation to select the appropriate programmer. + + + QComboBox::InsertAlphabetically + + + + c2n232i + + + + + dasa3 + + + + + dasa + + + + + siprog + + + + + ponyser + + + + + 89isp + + + + + frank-stk200 + + + + + blaster + + + + + ere-isp-avr + + + + + atisp + + + + + dapa + + + + + xil + + + + + futurlec + + + + + abcmini + + + + + picoweb + + + + + sp12 + + + + + alf + + + + + bascom + + + + + dt006 + + + + + pony-stk200 + + + + + stk200 + + + + + bsd + + + + + pavr + + + + + dragon_pdi + + + + + dragon_dw + + + + + dragon_hvsp + + + + + dragon_pp + + + + + dragon_isp + + + + + dragon_jtag + + + + + jtag2pdi + + + + + jtag2avr32 + + + + + jtagmkII_avr32 + + + + + jtag2dw + + + + + jtag2isp + + + + + jtag2 + + + + + jtag2fast + + + + + jtag2slow + + + + + jtagmkII + + + + + jtag1slow + + + + + jtag1 + + + + + jtagmkI + + + + + avr911 + + + + + avr109 + + + + + butterfly + + + + + usbtiny + + + + + usbasp + + + + + avr910 + + + + + stk600hvsp + + + + + stk600pp + + + + + stk600 + + + + + stk500hvsp + + + + + stk500pp + + + + + stk500v2 + + + + + mib510 + + + + + stk500v1 + + + + + stk500 + + + + + buspirate + + + + + avrisp2 + + + + + avrispmkII + + + + + avrispv2 + + + + + avrisp + + + + + arduino + + + + + + + + List all available programmers. + + + List Available + + + + + + + Extra arguments that will be passed to AVRDUDE on every call + + + Extra arguments used in AVRDUDE. +This can be used for providing extra information to AVRDUDE. + +Please only use this if you know what you are doing. There are no error checks and you could cripple your controller. + + + + + + + + + + Extra Arguments + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Show AVRDUDE help + + + Show Help + + + + + + + Communication port to the programmer. + + + + + + + + + + usb + + + + + com1 + + + + + com2 + + + + + com3 + + + + + com4 + + + + + lpt1 + + + + + lpt2 + + + + + lpt3 + + + + + lpt4 + + + + + avrdoper + + + + + /dev/ttyUSB0 + + + + + /dev/ttyUSB1 + + + + + + + + Port + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + AVRDUDE Location + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + MCU + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + CPU of your TX + + + CPU present on your 9x radio +Should be m64 for stock radios +m2560 for v4.1 boards + + + QComboBox::InsertAlphabetically + + + + m64 + + + + + m128 + + + + + m2560 + + + + + + + + CPU of your TX + + + CPU present on your 9x radio +Should be m64 for stock radios +m2560 for v4.1 boards + + + QComboBox::InsertAlphabetically + + + + at91sam3s4-9x + + + + + + + + SAM-BA Location + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Location of sam-ba executable + + + The location of the AVRDUDE executable. + + + sam-ba.exe + + + + + + + ARM MCU + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Port + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + sam-ba serial port + + + The location of the AVRDUDE executable. + + + \USBserial\COM23 + + + + + + + Alternate device + + + + + + + Extra arguments that will be passed to AVRDUDE on every call + + + Extra arguments used in AVRDUDE. +This can be used for providing extra information to AVRDUDE. + +Please only use this if you know what you are doing. There are no error checks and you could cripple your controller. + + + 0 + + + + + + + Use this button to browse and look for the AVRDUDE executable file. + + + Browse... + + + + + + + Use this button to browse and look for the AVRDUDE executable file. + + + Browse... + + + + + + + + + + + + + + Use advanced controls + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + avrdude_location + pushButton + avrdude_programmer + pushButton_3 + avrdude_mcu + avrdude_port + avrArgs + pushButton_4 + buttonBox + + + + + + + buttonBox + rejected() + burnConfigDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + buttonBox + accepted() + burnConfigDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp new file mode 100644 index 000000000..891549790 --- /dev/null +++ b/companion/src/burndialog.cpp @@ -0,0 +1,728 @@ +#include "burndialog.h" +#include "ui_burndialog.h" + +#include +#include "eeprominterface.h" +#include "helpers.h" +#include "splashlibrary.h" +#include "flashinterface.h" +#include "hexinterface.h" + +burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * backupEE, QString DocName): + QDialog(parent), + ui(new Ui::burnDialog), + hexfileName(fileName), + backup(backupEE), + hexType(Type) +{ + ui->setupUi(this); + ui->SplashFrame->hide(); + ui->FramFWInfo->hide(); + ui->EEbackupCB->hide(); + ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked); + if (Type == 2) { + ui->EEpromCB->hide(); + ui->profile_label->hide(); + ui->patchcalib_CB->hide(); + ui->patchhw_CB->hide(); + ui->InvertColorButton->setDisabled(true); + this->setWindowTitle(tr("Write firmware to TX")); + if (IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->EEbackupCB->hide(); + } + } else { + ui->FlashLoadButton->setText(tr("Load eEprom")); + ui->profile_label->hide(); + ui->patchcalib_CB->hide(); + ui->patchhw_CB->hide(); + ui->EEpromCB->hide(); + ui->ImageLoadButton->setDisabled(true); + ui->libraryButton->setDisabled(true); + ui->InvertColorButton->setDisabled(true); + ui->BurnFlashButton->setDisabled(true); + ui->ImageFileName->clear(); + ui->FwImage->clear(); + ui->FWFileName->clear(); + ui->DateField->clear(); + ui->SVNField->clear(); + ui->ModField->clear(); + ui->FramFWInfo->hide(); + ui->SplashFrame->hide(); + ui->BurnFlashButton->setDisabled(true); + ui->EEbackupCB->hide(); + if (DocName.isEmpty()) { + this->setWindowTitle(tr("Write models to TX")); + } else { + this->setWindowTitle(tr("Write %1 to TX").arg(DocName)); + } + QSettings settings("companion9x", "companion9x"); + int profileid=settings.value("profileId", 1).toInt(); + settings.beginGroup("Profiles"); + QString profile=QString("profile%1").arg(profileid); + settings.beginGroup(profile); + QString Name=settings.value("Name","").toString(); + settings.endGroup(); + settings.endGroup(); + ui->profile_label->setText(tr("Current profile")+QString(": ")+Name); + } + if (!hexfileName->isEmpty()) { + ui->FWFileName->setText(*hexfileName); + if (Type==2) { + checkFw(*hexfileName); + } else { + burnraw=false; + if (checkeEprom(*hexfileName)) { + QSettings settings("companion9x", "companion9x"); + int profileid=settings.value("profileId", 1).toInt(); + settings.beginGroup("Profiles"); + QString profile=QString("profile%1").arg(profileid); + settings.beginGroup(profile); + QString Name=settings.value("Name","").toString(); + QString calib=settings.value("StickPotCalib","").toString(); + QString trainercalib=settings.value("TrainerCalib","").toString(); + QString DisplaySet=settings.value("Display","").toString(); + QString BeeperSet=settings.value("Beeper","").toString(); + QString HapticSet=settings.value("Haptic","").toString(); + QString SpeakerSet=settings.value("Speaker","").toString(); + settings.endGroup(); + settings.endGroup(); + if (!Name.isEmpty()) { + ui->profile_label->show(); + ui->patchcalib_CB->show(); + ui->patchhw_CB->show(); + // TODO I hardcode the number of pots here, should be dependant on the board? + if (!((calib.length()==(NUM_STICKS+3)*12) && (trainercalib.length()==16))) { + ui->patchcalib_CB->setDisabled(true); + } + if (!((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6))) { + ui->patchhw_CB->setDisabled(true); + } + } else { + ui->profile_label->hide(); + } + if (!IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->EEpromCB->show(); + } else { + ui->EEpromCB->setChecked(false); + } + ui->BurnFlashButton->setEnabled(true); + } + } + ui->FWFileName->hide(); + ui->FlashLoadButton->hide(); + hexfileName->clear(); + } + else if (Type==2) { + QSettings settings("companion9x", "companion9x"); + QString FileName; + FileName = settings.value("lastFw").toString(); + QFile file(FileName); + if (file.exists()) { + checkFw(FileName); + } + } + resize(0, 0); +} + +burnDialog::~burnDialog() { + delete ui; +} + +void burnDialog::on_FlashLoadButton_clicked() +{ + QString fileName; + QSettings settings("companion9x", "companion9x"); + ui->ImageLoadButton->setDisabled(true); + ui->libraryButton->setDisabled(true); + ui->InvertColorButton->setDisabled(true); + ui->BurnFlashButton->setDisabled(true); + ui->ImageFileName->clear(); + ui->FwImage->clear(); + ui->FWFileName->clear(); + ui->DateField->clear(); + ui->SVNField->clear(); + ui->ModField->clear(); + ui->FramFWInfo->hide(); + ui->SplashFrame->hide(); + ui->BurnFlashButton->setDisabled(true); + ui->EEbackupCB->hide(); + QTimer::singleShot(0, this, SLOT(shrink())); + if (hexType==2) { + fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER); + checkFw(fileName); + } else { + QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to write to EEPROM memory"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER)); + if (checkeEprom(fileName)) { + if (burnraw==false) { + ui->BurnFlashButton->setEnabled(true); + ui->profile_label->show(); + ui->patchcalib_CB->show(); + ui->patchhw_CB->show(); + if (!IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->EEpromCB->show(); + } else { + ui->EEpromCB->setChecked(false); + } + } else { + ui->BurnFlashButton->setEnabled(true); + ui->profile_label->hide(); + ui->patchcalib_CB->setChecked(false); + ui->patchhw_CB->setChecked(false); + ui->patchhw_CB->hide(); + ui->patchcalib_CB->hide(); + } + QTimer::singleShot(0, this, SLOT(shrink())); + } + } +} + +void burnDialog::checkFw(QString fileName) +{ + if (fileName.isEmpty()) { + return; + } + QSettings settings("companion9x", "companion9x"); + if (!IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->EEbackupCB->show(); + } else { + ui->EEbackupCB->setChecked(false); + *backup=false; + } + ui->FWFileName->setText(fileName); + FlashInterface flash(fileName); + if (flash.isValid()) { + ui->FramFWInfo->show(); + ui->DateField->setText(flash.getDate() + " " + flash.getTime()); + ui->SVNField->setText(flash.getSvn()); + ui->ModField->setText(flash.getBuild()); + ui->BurnFlashButton->setEnabled(true); + ui->BurnFlashButton->setText(tr("Burn to TX")); + if (flash.hasSplash()) { + ui->SplashFrame->show(); + ui->ImageLoadButton->setEnabled(true); + ui->libraryButton->setEnabled(true); + ui->FwImage->setFixedSize(flash.getSplashWidth(),flash.getSplashHeight()); + ui->imageLabel->setFixedSize(flash.getSplashWidth(),flash.getSplashHeight()); + ui->FwImage->show(); + ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash())); + QString ImageStr = settings.value("SplashImage", "").toString(); + bool PatchFwCB = settings.value("patchImage", false).toBool(); + if (!ImageStr.isEmpty()) { + QImage Image = qstring2image(ImageStr); + ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat()))); + ui->InvertColorButton->setEnabled(true); + ui->PreferredImageCB->setChecked(true); + ui->PatchFWCB->setChecked(PatchFwCB); + } + else { + QString fileName=ui->ImageFileName->text(); + if (!fileName.isEmpty()) { + QImage image(fileName); + if (!image.isNull()) { + ui->InvertColorButton->setEnabled(true); + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat()))); + ui->PatchFWCB->setEnabled(true); + ui->PatchFWCB->setChecked(PatchFwCB); + } else { + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + ui->PreferredImageCB->setDisabled(true); + } + } else { + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + ui->PreferredImageCB->setDisabled(true); + } + } + } else { + ui->FwImage->hide(); + ui->ImageFileName->setText(""); + ui->SplashFrame->hide(); + } + } else { + QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName)); + ui->BurnFlashButton->setText(tr("Burn anyway !")); + ui->BurnFlashButton->setEnabled(true); + } + QTimer::singleShot(0, this, SLOT(shrink())); + settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); +} + +bool burnDialog::checkeEprom(QString fileName) +{ + if (fileName.isEmpty()) { + return false; + } + QFile file(fileName); + if (!file.exists()) { + QMessageBox::critical(this, tr("Error"), tr("Unable to find file %1!").arg(fileName)); + return false; + } + burnraw=false; + int fileType = getFileType(fileName); + if (fileType==FILE_TYPE_XML) { + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file + QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString())); + return false; + } + QTextStream inputStream(&file); + XmlInterface(inputStream).load(radioData); + } else 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"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString())); + return false; + } + QDomDocument doc(ER9X_EEPROM_FILE_TYPE); + bool xmlOK = doc.setContent(&file); + if(xmlOK) { + if (!LoadEepromXml(radioData, doc)){ + return false; + } + } + file.reset(); + + QTextStream inputStream(&file); + if (fileType==FILE_TYPE_EEPE) { // read EEPE file header + QString hline = inputStream.readLine(); + if (hline!=EEPE_EEPROM_FILE_HEADER) { + file.close(); + return false; + } + } + uint8_t eeprom[EESIZE_RLC_MAX]; + int eeprom_size = HexInterface(inputStream).load(eeprom, EESIZE_RLC_MAX); + if (!eeprom_size) { + int res = QMessageBox::question(this, "companion9x",tr("Invalid binary EEPROM File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No); + if (res == QMessageBox::No) { + return false; + } + burnraw=true; + ui->FWFileName->setText(fileName); + return true; + } + file.close(); + if (!LoadEeprom(radioData, eeprom, eeprom_size)) { + int res = QMessageBox::question(this, "companion9x",tr("Invalid binary EEPROM File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No); + if (res == QMessageBox::No) { + return false; + } + burnraw=true; + ui->FWFileName->setText(fileName); + return true; + } + } else if (fileType==FILE_TYPE_BIN) { //read binary + 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; + } + uint8_t *eeprom = (uint8_t *)malloc(eeprom_size); + memset(eeprom, 0, eeprom_size); + long result = file.read((char*)eeprom, 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 (!LoadEeprom(radioData, eeprom, eeprom_size)) { + int res = QMessageBox::question(this, "companion9x",tr("Invalid binary EEPROM File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No); + if (res == QMessageBox::No) { + return false; + } + burnraw=true; + } + } + ui->FWFileName->setText(fileName); + return true; +} + +void burnDialog::on_ImageLoadButton_clicked() +{ + QString supportedImageFormats; + for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { + supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; + } + + QSettings settings("companion9x", "companion9x"); + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats)); + + if (!fileName.isEmpty()) { + settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + ui->InvertColorButton->setDisabled(true); + return; + } + ui->ImageFileName->setText(fileName); + ui->InvertColorButton->setEnabled(true); + if (ui->imageLabel->width()!=128) { + image=image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = image.width(); + int height = image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); + } else { + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono))); + } + ui->PatchFWCB->setEnabled(true); + } +} + +void burnDialog::on_libraryButton_clicked() +{ + QString fileName; + splashLibrary *ld = new splashLibrary(this,&fileName); + ld->exec(); + if (!fileName.isEmpty()) { + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + ui->InvertColorButton->setDisabled(true); + return; + } + ui->ImageFileName->setText(fileName); + ui->InvertColorButton->setEnabled(true); + if (ui->imageLabel->width()!=128) { + image=image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = image.width(); + int height = image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); + } else { + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono))); + } + ui->PatchFWCB->setEnabled(true); + } +} + +void burnDialog::on_BurnFlashButton_clicked() +{ + if (hexType==2) { + QString fileName=ui->FWFileName->text(); + if (!fileName.isEmpty()) { + QSettings settings("companion9x", "companion9x"); + settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); + settings.setValue("lastFw", fileName); + if (ui->PatchFWCB->isChecked()) { + settings.setValue("patchImage", true); + QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height()); + if (!image.isNull()) { + QString tempDir = QDir::tempPath(); + QString tempFile; + if (getFileType(fileName) == FILE_TYPE_HEX) + tempFile = tempDir + "/flash.hex"; + else + tempFile = tempDir + "/flash.bin"; + FlashInterface flash(fileName); + flash.setSplash(image); + if (flash.saveFlash(tempFile) > 0) { + hexfileName->clear(); + hexfileName->append(tempFile); + } else { + hexfileName->clear(); + QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware")); + } + } else { + hexfileName->clear(); + QMessageBox::critical(this, tr("Warning"), tr("Custom image not found")); + } + } else { + settings.setValue("patchImage", false); + hexfileName->clear(); + hexfileName->append(fileName); + } + } else { + QMessageBox::critical(this, tr("Warning"), tr("No firmware selected")); + hexfileName->clear(); + } + } + if (hexType==1) { + QSettings settings("companion9x", "companion9x"); + int profileid=settings.value("profileId", 1).toInt(); + settings.beginGroup("Profiles"); + QString profile=QString("profile%1").arg(profileid); + settings.beginGroup(profile); + QString calib=settings.value("StickPotCalib","").toString(); + QString trainercalib=settings.value("TrainerCalib","").toString(); + int potsnum=GetEepromInterface()->getCapability(Pots); + int8_t vBatCalib=(int8_t)settings.value("VbatCalib", radioData.generalSettings.vBatCalib).toInt(); + int8_t currentCalib=(int8_t)settings.value("currentCalib", radioData.generalSettings.currentCalib).toInt(); + int8_t PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", radioData.generalSettings.PPM_Multiplier).toInt(); + uint8_t GSStickMode=(uint8_t)settings.value("GSStickMode", radioData.generalSettings.stickMode).toUInt(); + uint8_t vBatWarn=(uint8_t)settings.value("vBatWarn",radioData.generalSettings.vBatWarn).toUInt(); + + QString DisplaySet=settings.value("Display","").toString(); + QString BeeperSet=settings.value("Beeper","").toString(); + QString HapticSet=settings.value("Haptic","").toString(); + QString SpeakerSet=settings.value("Speaker","").toString(); + settings.endGroup(); + settings.endGroup(); + bool patch=false; + if (ui->patchcalib_CB->isChecked()) { + if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { + QString Byte; + int16_t byte16; + bool ok; + for (int i=0; i<(NUM_STICKS+potsnum); i++) { + Byte=calib.mid(i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + radioData.generalSettings.calibMid[i]=byte16; + Byte=calib.mid(4+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + radioData.generalSettings.calibSpanNeg[i]=byte16; + Byte=calib.mid(8+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + radioData.generalSettings.calibSpanPos[i]=byte16; + } + for (int i=0; i<4; i++) { + Byte=trainercalib.mid(i*4,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + radioData.generalSettings.trainer.calib[i]=byte16; + } + radioData.generalSettings.currentCalib=currentCalib; + radioData.generalSettings.vBatCalib=vBatCalib; + radioData.generalSettings.PPM_Multiplier=PPM_Multiplier; + patch=true; + } else { + QMessageBox::critical(this, tr("Warning"), tr("Wrong radio calibration data in profile, eeprom not patched")); + } + } + if (ui->patchhw_CB->isChecked()) { + if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) { + radioData.generalSettings.vBatWarn=vBatWarn; + radioData.generalSettings.stickMode=GSStickMode; + uint8_t byte8u; + int8_t byte8; + bool ok; + byte8=(int8_t)DisplaySet.mid(0,2).toInt(&ok,16); + if (ok) + radioData.generalSettings.optrexDisplay=(byte8==1 ? true : false); + byte8u=(uint8_t)DisplaySet.mid(2,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.contrast=byte8u; + + byte8u=(uint8_t)DisplaySet.mid(4,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.backlightBright=byte8u; + + byte8u=(uint8_t)BeeperSet.mid(0,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.beeperMode=(BeeperMode)byte8u; + + byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16); + if (ok) + radioData.generalSettings.beeperLength=byte8; + + byte8u=(uint8_t)HapticSet.mid(0,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.hapticMode=(BeeperMode)byte8u; + + byte8u=(uint8_t)HapticSet.mid(2,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.hapticStrength=byte8u; + + byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16); + if (ok) + radioData.generalSettings.hapticLength=byte8; + + byte8u=(uint8_t)SpeakerSet.mid(0,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.speakerMode=byte8u; + + byte8u=(uint8_t)SpeakerSet.mid(2,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.speakerPitch=byte8u; + + byte8u=(uint8_t)SpeakerSet.mid(4,2).toUInt(&ok,16); + if (ok) + radioData.generalSettings.speakerVolume=byte8u; + patch=true; + } else { + QMessageBox::critical(this, tr("Warning"), tr("Wrong radio setting data in profile, eeprom not patched")); + } + + QString fileName; + if (patch) { + QString tempDir = QDir::tempPath(); + fileName = tempDir + "/temp.bin"; + QFile file(fileName); + + uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize()); + int eeprom_size = 0; + + eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmwareVariant()); + if (!eeprom_size) { + QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString())); + hexfileName->clear(); + } + + if (!file.open(QIODevice::WriteOnly)) { + QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString())); + hexfileName->clear(); + } + + QTextStream outputStream(&file); + + 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(fileName).arg(file.errorString())); + hexfileName->clear(); + } + hexfileName->clear(); + hexfileName->append(fileName); + } else { + hexfileName->clear(); + hexfileName->append(ui->FWFileName->text()); + } + } else { + hexfileName->clear(); + hexfileName->append(ui->FWFileName->text()); + } + } + this->close(); +} + +void burnDialog::on_cancelButton_clicked() +{ + hexfileName->clear(); + this->close(); +} + +void burnDialog::on_InvertColorButton_clicked() +{ + if (ui->imageLabel->pixmap()) { + QImage image = ui->imageLabel->pixmap()->toImage(); + image.invertPixels(); + ui->imageLabel->setPixmap(QPixmap::fromImage(image)); + } +} + +void burnDialog::on_EEpromCB_toggled(bool checked) +{ + if (ui->EEpromCB->isChecked()) { + *backup=true; + } else { + *backup=false; + } +} + +void burnDialog::on_PreferredImageCB_toggled(bool checked) +{ + QString tmpFileName; + if (checked) { + QSettings settings("companion9x", "companion9x"); + QString ImageStr = settings.value("SplashImage", "").toString(); + if (!ImageStr.isEmpty()) { + QImage Image = qstring2image(ImageStr); + if (ui->imageLabel->width()!=128) { + Image=Image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = Image.width(); + int height = Image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = Image.pixel(i, j); + gray = qGray(col); + Image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + } else { + Image=Image.convertToFormat(QImage::Format_Mono); + } + ui->imageLabel->setPixmap(QPixmap::fromImage(Image)); + ui->InvertColorButton->setEnabled(true); + ui->PreferredImageCB->setChecked(true); + ui->ImageFileName->setDisabled(true); + ui->ImageLoadButton->setDisabled(true); + ui->libraryButton->setDisabled(true); + ui->PatchFWCB->setEnabled(true); + } + } else { + ui->imageLabel->clear(); + ui->ImageLoadButton->setEnabled(true); + ui->libraryButton->setEnabled(true); + tmpFileName = ui->ImageFileName->text(); + if (!tmpFileName.isEmpty()) { + QImage image(tmpFileName); + if (!image.isNull()) { + if (ui->imageLabel->width()!=128) { + image=image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = image.width(); + int height = image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + } else { + image=image.convertToFormat(QImage::Format_Mono); + } + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); + ui->InvertColorButton->setEnabled(true); + ui->ImageFileName->setEnabled(true); + ui->PatchFWCB->setDisabled(false); + } else { + ui->InvertColorButton->setDisabled(true); + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + } + } else { + ui->InvertColorButton->setDisabled(true); + ui->PatchFWCB->setDisabled(true); + ui->PatchFWCB->setChecked(false); + } + } +} + +void burnDialog::shrink() +{ + resize(0,0); +} + +void burnDialog::on_EEbackupCB_clicked() +{ + if (ui->EEbackupCB->isChecked()) { + *backup=true; + } else { + *backup=false; + } +} diff --git a/companion/src/burndialog.h b/companion/src/burndialog.h new file mode 100644 index 000000000..40068f3ac --- /dev/null +++ b/companion/src/burndialog.h @@ -0,0 +1,60 @@ +#ifndef BURNDIALOG_H +#define BURNDIALOG_H + +#include +#include +#include "eeprominterface.h" +#include "flashinterface.h" +#include "xmlinterface.h" + +#define XML_FILES_FILTER "XML files (*.xml);;" +#define HEX_FILES_FILTER "HEX files (*.hex);;" +#define BIN_FILES_FILTER "BIN files (*.bin);;" +#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;" +#define EEPM_FILES_FILTER "EEPE MODEL files (*.eepm);;" +// #define EEPROM_FILES_FILTER "EEPE files (*.xml *.eepe *.eepm *.bin *.hex);;" XML_FILES_FILTER EEPE_FILES_FILTER EEPM_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER +#define EEPROM_FILES_FILTER "EEPE files (*.eepe *.bin *.hex);;" EEPE_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER +#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER +#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER +#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" +#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" +#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE" + + +namespace Ui +{ + class burnDialog; +} + +class burnDialog : public QDialog +{ + Q_OBJECT + +public: + explicit burnDialog(QWidget *parent = 0, int Type = 2, QString * fileName = NULL, bool * backupEE=NULL, QString docname=""); + ~burnDialog(); + +private slots: + void on_FlashLoadButton_clicked(); + void on_ImageLoadButton_clicked(); + void on_libraryButton_clicked(); + void on_BurnFlashButton_clicked(); + void on_cancelButton_clicked(); + void on_InvertColorButton_clicked(); + void on_EEbackupCB_clicked(); + void on_PreferredImageCB_toggled(bool checked); + void on_EEpromCB_toggled(bool checked); + void checkFw(QString fileName); + bool checkeEprom(QString fileName); + void shrink(); + +private: + Ui::burnDialog *ui; + QString * hexfileName; + bool * backup; + int hexType; + RadioData radioData; + bool burnraw; +}; + +#endif // BURNDIALOG_H diff --git a/companion/src/burndialog.ui b/companion/src/burndialog.ui new file mode 100644 index 000000000..d863d1b48 --- /dev/null +++ b/companion/src/burndialog.ui @@ -0,0 +1,494 @@ + + + burnDialog + + + + 0 + 0 + 440 + 418 + + + + + 0 + 0 + + + + + 440 + 0 + + + + Customize Splash + + + + :/images/c_home.png:/images/c_home.png + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 90 + 0 + + + + Cancel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + + 90 + 0 + + + + Burn to TX + + + + + + + Qt::Horizontal + + + + 48 + 20 + + + + + + + + + + + + <html><head/><body><p>Modify calibration parameters using settings from current profile</p></body></html> + + + Patch calibration setting from profile + + + + + + + <html><head/><body><p>Modify HW parameters using settings from current profile</p></body></html> + + + Patch HW setting from profile + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + + 128 + 64 + + + + + 212 + 64 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + true + + + + + + + true + + + + + + + Date & Time + + + + + + + true + + + + + + + SVN + + + + + + + true + + + + + + + Variant + + + + + + + + + + + + true + + + + 0 + 0 + + + + true + + + + + + + + 0 + 0 + + + + Load Firmware + + + + + + + + + + 0 + 0 + + + + Allows companion9x to write to older version of the firmware + + + Check Firmware compatibility + + + + + + + true + + + Backup and restore existing eeprom + + + false + + + + + + + + 75 + true + + + + Current Profile + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + Invert Color + + + + + + + + 0 + 0 + + + + + 128 + 64 + + + + + 212 + 64 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + true + + + + + + + + + + 0 + 0 + + + + Use image in settings + + + + + + + Substitute image in firmware + + + + + + + Qt::Vertical + + + + 20 + 13 + + + + + + + + Qt::Vertical + + + + 20 + 13 + + + + + + + + + + + + true + + + + 0 + 0 + + + + true + + + + + + + false + + + Load Image + + + + + + + Open Splash Library + + + ... + + + + :/images/library.png:/images/library.png + + + + 16 + 16 + + + + + + + + + + + + + + + FWFileName + FlashLoadButton + ImageFileName + ImageLoadButton + libraryButton + EEbackupCB + EEpromCB + cancelButton + BurnFlashButton + + + + + + diff --git a/companion/src/cmake/FindPhonon.cmake b/companion/src/cmake/FindPhonon.cmake new file mode 100644 index 000000000..81de6b14e --- /dev/null +++ b/companion/src/cmake/FindPhonon.cmake @@ -0,0 +1,67 @@ +# Find libphonon +# Once done this will define +# +# PHONON_FOUND - system has Phonon Library +# PHONON_INCLUDES - the Phonon include directory +# PHONON_LIBS - link these to use Phonon +# PHONON_VERSION - the version of the Phonon Library + +# Copyright (c) 2008, Matthias Kretz +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(_phonon_find_version) + file(READ "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h" _phonon_header LIMIT 5000 OFFSET 1000) + string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") + set(PHONON_VERSION "${CMAKE_MATCH_1}") + message(STATUS "Phonon Version: ${PHONON_VERSION}") +endmacro(_phonon_find_version) + +if(PHONON_FOUND) + # Already found, nothing more to do except figuring out the version + _phonon_find_version() +else(PHONON_FOUND) + if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_FIND_QUIETLY TRUE) + endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + + # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir) + find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.) + find_library(PHONON_LIBRARY NAMES phonon) + + find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h) + + if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) + set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) + set(PHONON_FOUND TRUE) + _phonon_find_version() + else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_FOUND FALSE) + endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + + if(PHONON_FOUND) + if(NOT PHONON_FIND_QUIETLY) + message(STATUS "Found Phonon: ${PHONON_LIBRARY}") + message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}") + endif(NOT PHONON_FIND_QUIETLY) + else(PHONON_FOUND) + if(Phonon_FIND_REQUIRED) + if(NOT PHONON_INCLUDE_DIR) + message(STATUS "Phonon includes NOT found!") + endif(NOT PHONON_INCLUDE_DIR) + if(NOT PHONON_LIBRARY) + message(STATUS "Phonon library NOT found!") + endif(NOT PHONON_LIBRARY) + message(FATAL_ERROR "Phonon library or includes NOT found!") + else(Phonon_FIND_REQUIRED) + message(STATUS "Unable to find Phonon") + endif(Phonon_FIND_REQUIRED) + endif(PHONON_FOUND) + + + mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES) +endif(PHONON_FOUND) diff --git a/companion/src/cmake/FindSdl.cmake b/companion/src/cmake/FindSdl.cmake new file mode 100644 index 000000000..37e5824e9 --- /dev/null +++ b/companion/src/cmake/FindSdl.cmake @@ -0,0 +1,165 @@ +# - Locate the SDL library +# This module defines +# SDL_LIBRARY, the library to link against +# SDL_FOUND, if false, do not try to link to SDL +# SDL_INCLUDE_DIR, where to find SDL.h +# +# Don't forget to include SDLmain.h and SDLmain.m your project for the +# OS X framework based version. (Other versions link to -lSDLmain which +# this module will try to find on your behalf.) Also for OS X, this +# module will automatically add the -framework Cocoa on your behalf. +# $SDLDIR is an environment variable that would +# correspond to the ./configure --prefix=$SDLDIR +# used in building SDL. +# l.e.galup 9-20-02 +# +# Modified by Eric Wing. +# Added new modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). +# Also corrected the header search path to follow "proper" SDL guidelines. +# Added a search for SDLmain which is needed by some platforms. +# Added a search for threads which is needed by some platforms. +# Added needed compile switches for MinGW. +# +# On OSX, this will prefer the Framework version (if found) over others. +# People will have to manually change the cache values of +# SDL_LIBRARY to override this selection. +# +# Note that the header path has changed from SDL/SDL.h to just SDL.h +# This needed to change because "proper" SDL convention +# is #include "SDL.h", not . This is done for portability +# reasons because not all systems place things in SDL/ (see FreeBSD). +FIND_PATH(SDL_INCLUDE_DIR SDL.h + $ENV{SDLDIR}/include + ~/Library/Frameworks/SDL.framework/Headers + /Library/Frameworks/SDL.framework/Headers + /usr/local/include/SDL + /usr/include/SDL + /usr/local/include/SDL12 + /usr/local/include/SDL11 # FreeBSD ports + /usr/include/SDL12 + /usr/include/SDL11 + /usr/local/include + /usr/include + /sw/include/SDL # Fink + /sw/include + /opt/local/include/SDL # DarwinPorts + /opt/local/include + /opt/csw/include/SDL # Blastwave + /opt/csw/include + /opt/include/SDL + /opt/include + C:/Programs/SDL/include + ) +# I'm not sure if I should do a special casing for Apple. It is +# unlikely that other Unix systems will find the framework path. +# But if they do ([Next|Open|GNU]Step?), +# do they want the -framework option also? +IF(${SDL_INCLUDE_DIR} MATCHES ".framework") + # The Cocoa framework must be linked into SDL because SDL is Cocoa based. + # Remember that the OS X framework version expects you to drop in + # SDLmain.h and SDLmain.m directly into your project. + # (Cocoa link moved to bottom of this script.) + # SET (SDL_LIBRARY "-framework SDL -framework Cocoa" CACHE STRING "SDL framework for OSX") + # SET(SDL_LIBRARY "-framework SDL" CACHE STRING "SDL framework for OSX") + # Extract the path the framework resides in so we can use it for the -F flag + STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDL_FRAMEWORK_PATH_TEMP ${SDL_INCLUDE_DIR}) + IF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" + OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" + ) + # String is in default search path, don't need to use -F + SET(SDL_LIBRARY_TEMP "-framework SDL") + ELSE("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" + OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" + ) + # String is not /Library/Frameworks, need to use -F + SET(SDL_LIBRARY_TEMP "-F${SDL_FRAMEWORK_PATH_TEMP} -framework SDL") + ENDIF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks" + OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks" + ) + # Clear the temp variable so nobody can see it + SET(SDL_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "") + +ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework") + # SDL-1.1 is the name used by FreeBSD ports... + # don't confuse it for the version number. + FIND_LIBRARY(SDL_LIBRARY_TEMP + NAMES SDL SDL-1.1 + PATHS + $ENV{SDLDIR}/lib + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + C:/Programs/SDL/lib + ) + # Non-OS X framework versions expect you to also dynamically link to + # SDLmain. This is mainly for Windows and OS X. Other platforms + # seem to provide SDLmain for compatibility even though they don't + # necessarily need it. + FIND_LIBRARY(SDLMAIN_LIBRARY + NAMES SDLmain SDLmain-1.1 + PATHS + $ENV{SDLDIR}/lib + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + C:/Programs/SDL/lib + ) +ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework") + +# SDL may require threads on your system. +# The Apple build may not need an explicit flag because one of the +# frameworks may already provide it. +# But for non-OSX systems, I will use the CMake Threads package. +IF(NOT APPLE) + FIND_PACKAGE(Threads) +ENDIF(NOT APPLE) + +# MinGW needs an additional library, mwindows +# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows +# (Actually on second look, I think it only needs one of the m* libraries.) +IF(MINGW) + SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") +ENDIF(MINGW) + +SET(SDL_FOUND "NO") +IF(SDL_LIBRARY_TEMP) + # For SDLmain + IF(SDLMAIN_LIBRARY) + SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) + ENDIF(SDLMAIN_LIBRARY) + + # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. + # CMake doesn't display the -framework Cocoa string in the UI even + # though it actually is there. I think it has something to do + # with the CACHE STRING. Maybe somebody else knows how to fix this. + # The problem is mainly cosmetic, and not a functional issue. + IF(APPLE) + SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") + ENDIF(APPLE) + + # For threads, as mentioned Apple doesn't need this. + # In fact, there seems to be a problem if Find the threads package + # and try using this line, so I'm just skipping it entirely for OS X. + IF(NOT APPLE) + SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) + ENDIF(NOT APPLE) + + # For MinGW library + IF(MINGW) + SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP}) + ENDIF(MINGW) + + # Set the final string here so the GUI reflects the final state. + SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") + + SET(SDL_FOUND "YES") +ENDIF(SDL_LIBRARY_TEMP) + +MARK_AS_ADVANCED(SDL_LIBRARY_TEMP) \ No newline at end of file diff --git a/companion/src/cmake/FindXercesC.cmake b/companion/src/cmake/FindXercesC.cmake new file mode 100644 index 000000000..cb28a49d9 --- /dev/null +++ b/companion/src/cmake/FindXercesC.cmake @@ -0,0 +1,68 @@ +# Find Xerces-C +# The following setings are defined +# XERCESC_ROOT_DIR, the root of the include and lib directory +# XERCESC_INCLUDE_DIR, the full path of the include dir (ADVANCED) +# XERCESC_LIBRARIES, the name of the xerces-c library (ADVANCED) + +# Look for a root installation +IF( MSVC ) +SET( XERCES_WINDIR C:/Programs/xerces-vc ) +ELSE( ) +SET( XERCES_WINDIR C:/Programs/xerces ) +ENDIF( ) + +FIND_PATH(XERCESC_ROOT_DIR include/xercesc/parsers/SAXParser.hpp + ${XERCES_WINDIR} + "C:/mingw/msys/1.0/local" + "C:/Program Files/CodeSynthesis XSD 3.2" + /usr + /usr/local + "C:/MinGW" + $ENV{CODESYNTH} + DOC "The root of an installed xerces-c installation" +) + +# try to find the header +FIND_PATH(XERCESC_INCLUDE_DIR xercesc/parsers/SAXParser.hpp + ${XERCESC_ROOT_DIR}/include + /usr/include + /usr/local/include +) + +# Find the library +FIND_LIBRARY(XERCESC_LIBRARY + NAMES xerces-c xerces-c_3 + PATHS + ${XERCESC_ROOT_DIR}/lib + ${XERCESC_ROOT_DIR}/lib/vc-9.0 + ${XERCESC_ROOT_DIR}/lib64/vc-9.0 + /usr/lib + /usr/local/lib + DOC "The name of the xerces-c library" +) + +IF (XERCESC_ROOT_DIR) + IF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY) + SET (XERCESC_FOUND TRUE) + SET (XERCESC_LIBRARIES "${XERCESC_LIBRARY}") + # FIXME: There should be a better way of handling this? + # FIXME: How can we test to see if the lib dir isn't + # FIXME: one of the default dirs? + LINK_DIRECTORIES(${XERCESC_ROOT_DIR}/lib) + ENDIF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY) +ENDIF (XERCESC_ROOT_DIR) + +IF (XERCESC_FOUND) + IF (NOT XERCESC_FIND_QUIETLY) + MESSAGE (STATUS " found xerces-c: ${XERCESC_LIBRARY}") + ENDIF (NOT XERCESC_FIND_QUIETLY) +ELSE (XERCESC_FOUND) + IF (XERCESC_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Xerces-C") + ENDIF (XERCESC_FIND_REQUIRED) +ENDIF (XERCESC_FOUND) + +MARK_AS_ADVANCED( + XERCESC_INCLUDE_DIR + XERCESC_LIBRARY +) \ No newline at end of file diff --git a/companion/src/cmake/FindXsd.cmake b/companion/src/cmake/FindXsd.cmake new file mode 100644 index 000000000..d75882a07 --- /dev/null +++ b/companion/src/cmake/FindXsd.cmake @@ -0,0 +1,52 @@ +# Locate Xsd from code synthesis include paths and binary +# Xsd can be found at http://codesynthesis.com/products/xsd/ +# Written by Frederic Heem, frederic.heem _at_ telsey.it + +# This module defines +# XSD_INCLUDE_DIR, where to find elements.hxx, etc. +# XSD_EXECUTABLE, where is the xsd compiler +# XSD_FOUND, If false, don't try to use xsd + +FIND_PATH( XSD_INCLUDE_DIR xsd/cxx/parser/elements.hxx + "/opt/local/xsd-3.3.0-i686-macosx/libxsd" + "C:/Programs/xsd-3.3.0/libxsd" + "C:/Program Files/CodeSynthesis XSD 3.2/include" + "C:/mingw/xsd-3.3.0-i686-windows/libxsd" + $ENV{XSDDIR}/include + $ENV{CODESYNTH}/include + /usr/local/include /usr/include +) + +IF( WIN32 ) + SET( XSDCXX_FILENAME1 xsd-cxx.exe ) +ELSE( ) + SET( XSDCXX_FILENAME1 xsdcxx ) + SET( XSDCXX_FILENAME2 xsd ) +ENDIF( ) + +FIND_PROGRAM( XSDCXX_EXECUTABLE + NAMES + ${XSDCXX_FILENAME1} ${XSDCXX_FILENAME2} + PATHS + "/opt/local/xsd-3.3.0-i686-macosx/bin" + "C:/Programs/xsd-3.3.0/bin" + "C:/mingw/xsd-3.3.0-i686-windows/bin" + "C:/Program Files/CodeSynthesis XSD 3.2/bin" + $ENV{XSDDIR}/bin + /usr/local/bin + /usr/bin +) + +MESSAGE(STATUS ${XSDCXX_EXECUTABLE}) + +# if the include and the program are found then we have it +IF( XSD_INCLUDE_DIR ) + IF( XSDCXX_EXECUTABLE ) + SET( XSD_FOUND "YES" ) + ENDIF( XSDCXX_EXECUTABLE ) +ENDIF( XSD_INCLUDE_DIR ) + +MARK_AS_ADVANCED( + XSD_INCLUDE_DIR + XSDCXX_EXECUTABLE +) \ No newline at end of file diff --git a/companion/src/companion9x.desktop b/companion/src/companion9x.desktop new file mode 100644 index 000000000..e50e1551a --- /dev/null +++ b/companion/src/companion9x.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=companion9x +GenericName=COMPANION9X +Comment=9x EeProm Editor +Icon=/usr/share/icons/companion9x.png +Exec='companion9x' +Terminal=false +StartupNotify=false +Categories=Application \ No newline at end of file diff --git a/companion/src/companion9x.png b/companion/src/companion9x.png new file mode 100644 index 0000000000000000000000000000000000000000..90a961731b0f1581d938f49ced35c66fd7a8bf3f GIT binary patch literal 5302 zcmV;n6iMreP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01hMo01hMp-4W(>00007bV*G`2ipuB z016%Q`^Px|02DS!L_t(&-tC!bkX^-jhTrb9-gEb5?%bKVvuajtBZM^CkdO>=32fuU zE@3A&sW_=np>cacsxNHnM{a0W2dH2_&HnjU+~+(d^ru znS1B%%h~#z&JU>+97t6tha^Av{-4wR^w-_r+wTW_5Ff;E6y$&MXPk5T_~VaD02JG{ zWz#eTuh$FPwmDbWE$xWjx53 zs}e#8C!7g_P?2RhtE%c^G#XvdG%ZuB)v5;$9B}{70Pa0_P>N+{VwvSkZ>e0l35@kg zs@mlB`-48eS5ahHlpztFn*xS2xZS#hKo5Jgx z`n(BWT&V~qoyQ7UAQ@6b1rZ+L0ceQ2e%Eg(b|#&vo;r8B@a&Q2Q|I11_ww>|>gUkx zE11E1&V=}0KX~e?{lckHxp97O>2@lK`?lP9OY7Dx+hQ9cJ>D5{Mfi&GBwjf8GA2gG zQO%X$P!~c(A!>IBkw*$d%!s$B9TFO48-*Vpzj-ihN^F|TIuk`1M!yD7H>fD zNq_EqAKByMATthlKybi$9@BaX1?LPnPJxgTfL3a{yXFf zTLd9X5QzbRzb{*8aBz^$n;D;N+fBiSs5c&}Q|5&g@@no3Fk%6Oa0CPs<9Z2YcN8jp z8b0Mb0s&nOxUra{tt>4pf5gccogh>NgALm)gYgU~-h#kSK(jLMW%b`{1}I~e&!s%< zkNV|+;+2NU3`wml0T~8(D2GH$R9FQfMj+EsTrTB-5;ykmPi505j`_lYVvW$%j=_9f zbV{x(EJ5NaaJ~TDTE;BO?^^~g<1&>UO{J82B%dlOqD&@`0;?Dx766R`B4J=$he(#; zk*k1yZ8C=rIXbYYcZAE)MBsdtFwxLl168J@kTr1`?7go1dj?p&W;Mo6Obad`QBfcq zpm|;fOa>4FcqxZUI4EHdhynVJm2~($50oFzMT}{2n%)%%*n18f_>D!~e}4;bz;gz27aBEB8Nqe@0}H zJd5P2PdxCr1w#1$D8S(0AZ-NHa=EP8zbFPm)Kg#O6~(TZG~?u95*tuNK&3!LBJdLm zMUbGnUY|#i9~>N1frwnGSn6_lv8j|RZLe0#TOp8;!|cjZEbZ+cNZ~XMgl`CVf|L%SF6(t%?j*X?e zENi9?aAd~;OcPKP+3M(sX6EL^$+ouL(*TO^0Ql0EzT_W1d9trkDBNDo=Xbic-KC0R z*sH3tAPNF^U9pzR33gs5&5=5YJ{2sfz&&3f$@N`|+a~xXj-FrJ&>z<=qms}KbDgF| z;)Duy5XFGz^-4aMyCte6Fyfw}O@kCl-Ff+x}Z2;Ni^+rRSs}iLI zu^8u~=vc$UQ<*boMqXc9ntuU6_16Ht`qi&`3$wG^mNS{p=+)|;=0qaiw{D%(($_~~ zi3F%o!|?et2P4I(*5(g?dc*G{F{DM0 zoIa@uvZS@NG|2-4jg&$}u}JaC%ND-#&DSw|B?A(bs1WlD0Zz;YE#4qfaZ^vvhw9g_ zzol+qz^^SVQ1axHbNImzo@bXY|I!8YydXp?et&DVQ1G)G0Qpp^A)Cp3)YSDox9!>$ z-216d(Rd<3a^L?hg+P__RZZ1Ufi)0?W%k1u*LnBG!DqP&yn|&)c?Vu~0bVh&K-H@#AYsg~INh z_V(zGefxxXB0(~L@fR2z9KyKa0djqF9HvqC1PZL5c^mX6P*RPAkBcXn^y}c{k z)Tl~-_NNsT3jYQ`;+r>bt*u&hHh<~T>{Z6ZW4f-)0*9O%03u_-TCKJ!5U$mD2b7j=MR{YqR9e}zann}MwykYF5kFm=&5&Yh2*le8^aW6L4OB7} z&N4bL%`I_Pt`V0c$SZH2BzNy?<9B?_Prm!@demwiaNQh4F-CXp*yG)Mn~!I+QEgx# ztUdcIq0c>c48RPM$(`0sH{}Xv&YVqED*QFq)!tfOezE#%g^U`8-!{!?u&z$@$6^H2 z)0jDX7Uk>WTmT@d>QbRr``0z=)?Hn*V;i3s8ELp{-yPELeEvR?{L4YSe$;?5?t#+k zM<(v)#Wu566^)up2-j=axNa3LHfG!VrdX6$Ga>RD(WlN_NFn zohgG_Rg+f5Ds=*<3KtSRA7DD2cD@hWKs^q1Y6fqi=5DpVO`D6`aW6uJx zd3SfOUag+WPfbmZbFRGVIMUSE*k$V-05<200;XY_+_r7NG~puzDgZ_Z>IH$E(e-F= zXXj?Fs-g1qbWcK2q=3f*zb}Ah$3=6wiZP3!2ZRfes9UQ!OPt|Z9qg(tI<6cN!__L^ za^mEhTkidXH4R_wYLL5 z{V8&DbEsT58fDHQI}V6tQ@LV0iDE*ZIXYw9($P^4Xublo-P+~LHK$nQ?)L2jiXwus zA^-`13_t*-E|!+EP9{@kuIm(QHL*A|6Sx0MHCn6Hs-Zw&sAyRuXNQKO9pNyoa!%8t zh(1L@#ImrtP!N=L>nMxIA^817FbuHA9z*_XU&D;+!oKd3i2z*20L$VKgc}3p^K!UU zTI$m@Uz4h~c~(|rsaB(KT^B$NfCNqJfMv~t^H+&w4M~heRY_7?D7D)ok@8&bT`U(7 z01g~D;Qr+U4~)bb8V)Z^PPTr3WTb7;Fpw5S+Fh-};2bah<3A$tt6vev=R>(x17BLg zt(6KkDGG$^??8Udp$0Py4$EQ;U;=;#AN;B}pHHtgjLNQ_p52XIU8{o4&5HEsqkw5% z0dO9G2)|!KD0DMMN9Um^!wO@bpk+0+3Bt@y+r})g{|a!(de`@W6%J8z~dn~&apH;4oi~wify|Y0DJGgTS$1lV22LDsZ>C&0dT!q(EdYc*@v$3O1=_G6C;fz6wVdE^M5&ty;o&>;wz0IZU24{3t%QheQ=&dN&W zR)F5IcI}mt3q z9_68jIJtD`Fo0zMH{0cMrl{*frm9AKiA0-!X-O6=%LHS+RF=aXm@TCK8f^X8Rc zeZ4f^aoJX(HyjE1QAJ zBruY>PX8YOE+Nr!wYpZ5<>rrV+otqw+9dcpJBcVs$cMu`a?d@&DZ^+gRI7EZisBha zCdIn#+ez+`NAO%O2LV6;a7Q_3w&P63;|+^UQPy&uZtd*cRkveDOOP>HIB=kVTI~e@ zDhCuDcrgb|&Hz>_nVj$0x^>(mitE(5xv;#jP!GrH2Bif>lI*Z$Rg;`wycKY#fSb#} zx!Mf?NfZqbVv4HDWBvW4vA&+r!-rv?u2n?$5}@0JoKCj2T__7$d&nQ|{lq7>2N_eed+vFSJontI0G7ddn*+?1f%7>) zzX&L=)z{0ju~<|-d2+N((}ui2Srx_Sysn!kO-;WAT~7+x>;)gt7zT110rMhoE_DN- zb6NFSekDIV{38)?Ye0wsUI1e*kkx_eJV0Iqa1NL+9z8nmY}|O)ay)Jy{qc_v zM>3hY?Ub&Ml}bnCTyBW~1^~wa$~s_V0HFYI{%$=oUjSH5f!hJ>aSOI1# zZ~NwL(W(M%K48gr&H9n9yK@!?1O^B-z$gQY20n-n;x~(b2XvO>WK}4M+5i9m07*qo IM6N<$f@Tr@DF6Tf literal 0 HcmV?d00001 diff --git a/companion/src/companion9x.qrc b/companion/src/companion9x.qrc new file mode 100644 index 000000000..103a05dee --- /dev/null +++ b/companion/src/companion9x.qrc @@ -0,0 +1,335 @@ + + + icon.png + ../../CREDITS.txt + ../../DONATIONS.txt + ../releasenotes.txt + images/9xdb.png + images/9xdl.png + images/9xdr.png + images/9xdt.png + images/9xdb-bl.png + images/9xdl-bl.png + images/9xdr-bl.png + images/9xdt-bl.png + images/9xdb-gr.png + images/9xdl-gr.png + images/9xdr-gr.png + images/9xdt-gr.png + images/9xdb-or.png + images/9xdl-or.png + images/9xdr-or.png + images/9xdt-or.png + images/9xdb-yl.png + images/9xdl-yl.png + images/9xdr-yl.png + images/9xdt-yl.png + images/9xdb-rd.png + images/9xdl-rd.png + images/9xdr-rd.png + images/9xdt-rd.png + images/9xmenu.png + images/9xmenumenu.png + images/9xmenuexit.png + images/9xcurs.png + images/9xcursup.png + images/9xcursplus.png + images/9xcursmin.png + images/9xcursdown.png + images/9xcursphoto.png + images/copy.png + images/cut.png + images/currentmodel.png + images/new.png + images/open.png + images/paste.png + images/save.png + images/saveas.png + images/screenshot.png + images/splash.png + images/splasht.png + images/companion9x-title.png + images/read_eeprom.png + images/write_eeprom.png + images/write_flash.png + images/read_flash.png + images/simulate.png + images/configure.png + images/customize.png + images/print.png + images/clear.png + images/add.png + images/edit.png + images/wizard.png + images/duplicate.png + images/fuses.png + images/list.png + images/play.png + images/stop.png + images/read_eeprom_file.png + images/write_eeprom_file.png + images/moveup.png + images/movedown.png + images/update.png + images/contributors.png + images/changelog.png + images/preferences.png + images/switch_dir.png + images/exit.png + images/recentdocument.png + images/profiles.png + images/library.png + images/logs.png + images/arrow-left.png + images/arrow-right.png + images/compare.png + images/x9b0.png + images/x9l0.png + images/x9l1.png + images/x9l2.png + images/x9l3.png + images/x9l4.png + images/x9r0.png + images/x9r1.png + images/x9r2.png + images/x9r3.png + images/x9s0.png + images/x9t0.png + images/mcw/aicon.png + images/mcw/dicon.png + images/mcw/gicon.png + images/mcw/hicon.png + images/mcw/at1e1r.png + images/mcw/at2e1r.png + images/mcw/atailv.png + images/mcw/aw0a0f.png + images/mcw/aw1a0f.png + images/mcw/aw1a1f.png + images/mcw/aw1a2f.png + images/mcw/aw2a0f.png + images/mcw/aw2a1f.png + images/mcw/aw2a2f.png + images/mcw/h90.png + images/mcw/h120.png + images/mcw/h120x.png + images/mcw/h140.png + images/mcw/hfbl.png + images/mcw/htailg.png + images/mcw/htailng.png + images/mcw/htailfblg.png + images/mcw/htailfblng.png + images/mcw/gt1e1r.png + images/mcw/gt2e1r.png + images/mcw/gtailv.png + images/mcw/gw0t0a0f0s.png + images/mcw/gw0t1a0f0s.png + images/mcw/gw0t1a0f1s.png + images/mcw/gw0t1a0f2s.png + images/mcw/gw0t1a1f0s.png + images/mcw/gw0t1a1f1s.png + images/mcw/gw0t1a1f2s.png + images/mcw/gw0t1a2f0s.png + images/mcw/gw0t1a2f1s.png + images/mcw/gw0t1a2f2s.png + images/mcw/gw0t2a0f0s.png + images/mcw/gw0t2a0f1s.png + images/mcw/gw0t2a0f2s.png + images/mcw/gw0t2a1f0s.png + images/mcw/gw0t2a1f1s.png + images/mcw/gw0t2a1f2s.png + images/mcw/gw0t2a2f0s.png + images/mcw/gw0t2a2f1s.png + images/mcw/gw0t2a2f2s.png + images/mcw/gw1t0a0f0s.png + images/mcw/gw1t1a0f0s.png + images/mcw/gw1t1a0f1s.png + images/mcw/gw1t1a0f2s.png + images/mcw/gw1t1a1f0s.png + images/mcw/gw1t1a1f1s.png + images/mcw/gw1t1a1f2s.png + images/mcw/gw1t1a2f0s.png + images/mcw/gw1t1a2f1s.png + images/mcw/gw1t1a2f2s.png + images/mcw/gw1t2a0f0s.png + images/mcw/gw1t2a0f1s.png + images/mcw/gw1t2a0f2s.png + images/mcw/gw1t2a1f0s.png + images/mcw/gw1t2a1f1s.png + images/mcw/gw1t2a1f2s.png + images/mcw/gw1t2a2f0s.png + images/mcw/gw1t2a2f1s.png + images/mcw/gw1t2a2f2s.png + images/mcw/db0t2e0f0r.png + images/mcw/db0t2e0f1r.png + images/mcw/db0t2e0f2r.png + images/mcw/db0t2e1f0r.png + images/mcw/db0t2e1f1r.png + images/mcw/db0t2e1f2r.png + images/mcw/db0t2e2f0r.png + images/mcw/db0t2e2f1r.png + images/mcw/db0t2e2f2r.png + images/mcw/db1t2e0f0r.png + images/mcw/db1t2e0f1r.png + images/mcw/db1t2e0f2r.png + images/mcw/db1t2e1f0r.png + images/mcw/db1t2e1f1r.png + images/mcw/db1t2e1f2r.png + images/mcw/db1t2e2f0r.png + images/mcw/db1t2e2f1r.png + images/mcw/db1t2e2f2r.png + images/mcw/dt0t2e0f0r.png + images/mcw/dt0t2e0f1r.png + images/mcw/dt0t2e0f2r.png + images/mcw/dt0t2e1f0r.png + images/mcw/dt0t2e1f1r.png + images/mcw/dt0t2e1f2r.png + images/mcw/dt0t2e2f0r.png + images/mcw/dt0t2e2f1r.png + images/mcw/dt0t2e2f2r.png + images/mcw/dt1t2e0f0r.png + images/mcw/dt1t2e0f1r.png + images/mcw/dt1t2e0f2r.png + images/mcw/dt1t2e1f0r.png + images/mcw/dt1t2e1f1r.png + images/mcw/dt1t2e1f2r.png + images/mcw/dt1t2e2f0r.png + images/mcw/dt1t2e2f1r.png + images/mcw/dt1t2e2f2r.png + images/library/00001.png + images/library/00002.png + images/library/00003.png + images/library/00004.png + images/library/00005.png + images/library/00006.png + images/library/00007.png + images/library/00008.png + images/library/00009.png + images/library/00010.png + images/library/00011.png + images/library/00012.png + images/library/00013.png + images/library/00014.png + images/library/00015.png + images/library/00016.png + images/library/01001.png + images/library/01002.png + images/library/01003.png + images/library/01004.png + images/library/01005.png + images/library/01006.png + images/library/01007.png + images/library/01008.png + images/library/10001.png + images/library/10002.png + images/library/10003.png + images/library/10004.png + images/library/10005.png + images/library/10006.png + images/library/10007.png + images/library/10008.png + images/library/10009.png + images/library/10010.png + images/library/10011.png + images/library/10012.png + images/library/10013.png + images/library/10014.png + images/library/10015.png + images/library/10016.png + images/library/10017.png + images/library/10018.png + images/library/10019.png + images/library/10020.png + images/library/10021.png + images/library/10022.png + images/library/10023.png + images/library/10024.png + images/library/10033.png + images/library/10034.png + images/library/10035.png + images/library/10036.png + images/library/10049.png + images/library/10050.png + images/library/10051.png + images/library/10052.png + images/library/10037.png + images/library/10038.png + images/library/10039.png + images/library/10040.png + images/library/10053.png + images/library/10054.png + images/library/10055.png + images/library/10056.png + images/library/10025.png + images/library/10026.png + images/library/10027.png + images/library/10028.png + images/library/10029.png + images/library/10030.png + images/library/10031.png + images/library/10032.png + images/library/10041.png + images/library/10042.png + images/library/10043.png + images/library/10044.png + images/library/10057.png + images/library/10058.png + images/library/10059.png + images/library/10060.png + images/library/10045.png + images/library/10046.png + images/library/10047.png + images/library/10048.png + images/library/10061.png + images/library/10062.png + images/library/10063.png + images/library/10064.png + images/library/10065.png + images/library/10066.png + images/library/10067.png + images/library/10068.png + images/library/10081.png + images/library/10082.png + images/library/10083.png + images/library/10084.png + images/library/10069.png + images/library/10070.png + images/library/10071.png + images/library/10072.png + images/library/10085.png + images/library/10086.png + images/library/10087.png + images/library/10088.png + images/library/10073.png + images/library/10074.png + images/library/10075.png + images/library/10076.png + images/library/10089.png + images/library/10090.png + images/library/10091.png + images/library/10092.png + images/library/10077.png + images/library/10078.png + images/library/10079.png + images/library/10080.png + images/library/10093.png + images/library/10094.png + images/library/10095.png + images/library/10096.png + images/library/10097.png + images/library/10098.png + images/library/10099.png + images/library/10100.png + images/library/10101.png + images/library/10102.png + images/library/10103.png + images/library/10104.png + images/library/20001.png + images/library/20002.png + images/library/20003.png + images/library/20004.png + images/library/30001.png + images/library/30002.png + images/library/30003.png + images/library/30004.png + + diff --git a/companion/src/comparedialog.cpp b/companion/src/comparedialog.cpp new file mode 100644 index 000000000..ded52c41c --- /dev/null +++ b/companion/src/comparedialog.cpp @@ -0,0 +1,1476 @@ +#include "comparedialog.h" +#include "ui_comparedialog.h" +#include "helpers.h" +#include "eeprominterface.h" +#include +#include +#include +#include + +#if !defined WIN32 && defined __GNUC__ +#include +#endif + +#define ISIZE 200 // curve image size +class DragDropHeader { +public: + DragDropHeader(): + general_settings(false), + models_count(0) + { + } + bool general_settings; + uint8_t models_count; + uint8_t models[C9XMAX_MODELS]; +}; + +compareDialog::compareDialog(QWidget *parent, GeneralSettings *gg) : + QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), + ui(new Ui::compareDialog) +{ + ui->setupUi(this); + g_eeGeneral = gg; + eepromInterface = GetEepromInterface(); + te = ui->textEdit; + this->setAcceptDrops(true); + model1=0; + model2=0; + g_model1=(ModelData *)malloc(sizeof(ModelData)); + g_model2=(ModelData *)malloc(sizeof(ModelData)); + modeltemp=(ModelData *)malloc(sizeof(ModelData)); + //setDragDropOverwriteMode(true); + //setDropIndicatorShown(true); +/* + printFrSky(); +*/ + te->scrollToAnchor("1"); +} + +void compareDialog::dragMoveEvent(QDragMoveEvent *event) +{ + if (event->mimeData()->hasFormat("application/x-companion9x")) { + event->acceptProposedAction(); + } else { + event->ignore(); + } +} + +void compareDialog::dragEnterEvent(QDragEnterEvent *event) +{ + // accept just text/uri-list mime format + if (event->mimeData()->hasFormat("application/x-companion9x")) { + event->acceptProposedAction(); + } else { + event->ignore(); + } +} + +void compareDialog::dragLeaveEvent(QDragLeaveEvent *event) +{ + event->accept(); +} + +void compareDialog::printDiff() +{ + te->clear(); + printSetup(); + if (GetEepromInterface()->getCapability(FlightPhases)) { + printPhases(); + } + printExpos(); + printMixers(); + printLimits(); + printCurves(); + printGvars(); + printSwitches(); + printSafetySwitches(); + printFSwitches(); + printFrSky(); + te->scrollToAnchor("1"); +} + +void compareDialog::dropEvent(QDropEvent *event) +{ + QLabel *child = qobject_cast(childAt(event->pos())); + const QMimeData *mimeData = event->mimeData(); + if (child) { + if (child->objectName().contains("label_1")) { + if(mimeData->hasFormat("application/x-companion9x")) { + QByteArray gmData = mimeData->data("application/x-companion9x"); + DragDropHeader *header = (DragDropHeader *)gmData.data(); + if (!header->general_settings) { + char *gData = gmData.data()+sizeof(DragDropHeader);//new char[gmData.size() + 1]; + char c = *gData; + gData++; + if(c=='M') { + memcpy(modeltemp,(ModelData *)gData,sizeof(ModelData)); + if (modeltemp->used) { + memcpy(g_model1,(ModelData *)gData,sizeof(ModelData)); + QString name; + name.append(g_model1->name); + if (!name.isEmpty()) { + ui->label_1->setText(name); + } else { + ui->label_1->setText(tr("No name")); + } + model1=1; + } + } + } + } + } + else if (child->objectName().contains("label_2")) { + if(mimeData->hasFormat("application/x-companion9x")) { + QByteArray gmData = mimeData->data("application/x-companion9x"); + DragDropHeader *header = (DragDropHeader *)gmData.data(); + if (!header->general_settings) { + char *gData = gmData.data()+sizeof(DragDropHeader);//new char[gmData.size() + 1]; + char c = *gData; + gData++; + if(c=='M') { + memcpy(modeltemp,(ModelData *)gData,sizeof(ModelData)); + if (modeltemp->used) { + memcpy(g_model2,(ModelData *)gData,sizeof(ModelData)); + QString name; + name.append(g_model2->name); + if (!name.isEmpty()) { + ui->label_2->setText(name); + } else { + ui->label_2->setText(tr("No name")); + } + model2=1; + } + } + } + } + } + } else { + return; + } + event->accept(); + if ((model1==1) & (model2==1)) { + printDiff(); + } +} + +void compareDialog::closeEvent(QCloseEvent *event) +{ + QByteArray ba = curvefile5.toLatin1(); + char *name = ba.data(); + unlink(name); + ba = curvefile9.toLatin1(); + name = ba.data(); + unlink(name); +} + +compareDialog::~compareDialog() +{ + delete ui; +} + +QString compareDialog::doTC(const QString s, const QString color="", bool bold=false) +{ + QString str = s; + if(bold) str = "" + str + ""; + if(!color.isEmpty()) str = "" + str + ""; + return "" + str + ""; +} + +QString compareDialog::doTR(const QString s, const QString color="", bool bold=false) +{ + QString str = s; + if(bold) str = "" + str + ""; + if(!color.isEmpty()) str = "" + str + ""; + return "" + str + ""; +} + +QString compareDialog::doTL(const QString s, const QString color="", bool bold=false) +{ + QString str = s; + if(bold) str = "" + str + ""; + if(!color.isEmpty()) str = "" + str + ""; + return "" + str + ""; +} + +QString compareDialog::fv(const QString name, const QString value, const QString color="green") +{ + return "" + name + ": " + value + "
"; +} + + + +int compareDialog::ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused) +{ + for (int i=0; i< C9X_MAX_EXPOS; i++) { + if ((memcmp(&expo,&ExpoArray[i],sizeof(ExpoData))==0) && (expoused[i]==false)) { + return i; + } + } + return -1; +} + +bool compareDialog::ChannelHasExpo(ExpoData * expoArray, uint8_t destCh) +{ + for (int i=0; i< C9X_MAX_EXPOS; i++) { + if ((expoArray[i].chn==destCh)&&(expoArray[i].mode!=0)) { + return true; + } + } + return false; +} + +int compareDialog::ModelHasMix(MixData * mixArray, MixData mix, bool * mixused) +{ + for (int i=0; i< C9X_MAX_MIXERS; i++) { + if ((memcmp(&mix,&mixArray[i],sizeof(MixData))==0) && (mixused[i]==false)) { + return i; + } + } + return -1; +} + +bool compareDialog::ChannelHasMix(MixData * mixArray, uint8_t destCh) +{ + for (int i=0; i< C9X_MAX_MIXERS; i++) { + if (mixArray[i].destCh==destCh) { + return true; + } + } + return false; +} + +void compareDialog::printSetup() +{ + QString color; + QString str = ""; + str.append(""); + str.append(""); + str.append("

"+tr("General Model Settings")+"

"); + color=getColor1(g_model1->name,g_model2->name); + str.append(fv(tr("Name"), g_model1->name, color)); + color=getColor1(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2)); + str.append(""+tr("EEprom Size")+QString(": %1
").arg(eepromInterface->getSize(*g_model1)).arg(color)); + color=getColor1(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0])); + str.append(fv(tr("Timer1"), getTimerStr(g_model1->timers[0]), color)); //value, mode, count up/down + color=getColor1(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1])); + str.append(fv(tr("Timer2"), getTimerStr(g_model1->timers[1]), color)); //value, mode, count up/down + color=getColor1(getProtocol(g_model1),getProtocol(g_model2)); + str.append(fv(tr("Protocol"), getProtocol(g_model1), color)); //proto, numch, delay, + color=getColor1(g_model1->moduleData[0].ppmPulsePol,g_model2->moduleData[0].ppmPulsePol); + str.append(fv(tr("Pulse Polarity"), g_model1->moduleData[0].ppmPulsePol ? "NEG" : "POS", color)); + color=getColor1(g_model1->thrTrim,g_model2->thrTrim); + str.append(fv(tr("Throttle Trim"), g_model1->thrTrim ? tr("Enabled") : tr("Disabled"), color)); + color=getColor1(g_model1->thrExpo,g_model2->thrExpo); + str.append(fv(tr("Throttle Expo"), g_model1->thrExpo ? tr("Enabled") : tr("Disabled"),color)); + // TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw))); + color=getColor1(getTrimInc(g_model1),getTrimInc(g_model2)); + str.append(fv(tr("Trim Increment"), getTrimInc(g_model1),color)); + color=getColor1(getCenterBeep(g_model1),getCenterBeep(g_model2)); + str.append(fv(tr("Center Beep"), getCenterBeep(g_model1),color)); // specify which channels beep + str.append("
"); + color=getColor2(g_model1->name,g_model2->name); + str.append(fv(tr("Name"), g_model2->name, color)); + color=getColor2(eepromInterface->getSize(*g_model1),eepromInterface->getSize(*g_model2)); + str.append(""+tr("EEprom Size")+QString(": %1
").arg(eepromInterface->getSize(*g_model2)).arg(color)); + color=getColor2(getTimerStr(g_model1->timers[0]), getTimerStr(g_model2->timers[0])); + str.append(fv(tr("Timer1"), getTimerStr(g_model2->timers[0]),color)); //value, mode, count up/down + color=getColor2(getTimerStr(g_model1->timers[1]), getTimerStr(g_model2->timers[1])); + str.append(fv(tr("Timer2"), getTimerStr(g_model2->timers[1]),color)); //value, mode, count up/down + color=getColor2(getProtocol(g_model1),getProtocol(g_model2)); + str.append(fv(tr("Protocol"), getProtocol(g_model2), color)); //proto, numch, delay, + color=getColor2(g_model1->moduleData[0].ppmPulsePol,g_model2->moduleData[0].ppmPulsePol); + str.append(fv(tr("Pulse Polarity"), g_model2->moduleData[0].ppmPulsePol ? "NEG" : "POS", color)); + color=getColor2(g_model1->thrTrim,g_model2->thrTrim); + str.append(fv(tr("Throttle Trim"), g_model2->thrTrim ? tr("Enabled") : tr("Disabled"), color)); + color=getColor2(g_model1->thrExpo,g_model2->thrExpo); + str.append(fv(tr("Throttle Expo"), g_model2->thrExpo ? tr("Enabled") : tr("Disabled"),color)); + // TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw))); + color=getColor2(getTrimInc(g_model1),getTrimInc(g_model2)); + str.append(fv(tr("Trim Increment"), getTrimInc(g_model2),color)); + color=getColor2(getCenterBeep(g_model1),getCenterBeep(g_model2)); + str.append(fv(tr("Center Beep"), getCenterBeep(g_model2),color)); // specify which channels beep + str.append("
"); + te->append(str); +} + +void compareDialog::printPhases() +{ + QString color; + int i,k; + QString str = ""; + str.append(""); + str.append(""); + + str.append("

"+tr("Flight modes Settings")+"

"); + str.append(""); + for (i=0; i<4; i++) { + str.append(QString("").arg(getStickStr(i))); + } + str.append(""); + for (i=0; igetCapability(FlightPhases); i++) { + PhaseData *pd1=&g_model1->phaseData[i]; + PhaseData *pd2=&g_model2->phaseData[i]; + str.append("").arg(pd1->name).arg(color)); + color=getColor1(pd1->fadeIn,pd2->fadeIn); + str.append(QString("").arg(pd1->fadeIn).arg(color)); + color=getColor1(pd1->fadeOut,pd2->fadeOut); + str.append(QString("").arg(pd1->fadeOut).arg(color)); + for (k=0; k<4; k++) { + if (pd1->trimRef[k]==-1) { + color=getColor1(pd1->trim[k],pd2->trim[k]); + str.append(QString("").arg(pd1->trim[k]).arg(color)); + } else { + color=getColor1(pd1->trimRef[k],pd2->trimRef[k]); + str.append(QString("").arg(pd1->trimRef[k])); + } + } + color=getColor1(pd1->swtch,pd2->swtch); + str.append(QString("").arg(pd1->swtch.toString()).arg(color)); + str.append(""); + } + str.append("
 "); + str.append(tr("Fades")+""+tr("Trims")); + str.append(""+tr("Switch")+"
"+tr("Flight mode name")); + str.append(""+tr("IN")+""+tr("OUT")+"%1
"+tr("FM")+QString("%1 ").arg(i)); + color=getColor1(pd1->name,pd2->name); + str.append(QString("%1%1%1%1").arg(color)+tr("FM")+QString("%1%1
"); + int gvars=0; + int gvarnum=0; + if (GetEepromInterface()->getCapability(HasVariants)) { + if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) { + gvars=1; + } + } else { + gvars=1; + } + if (gvars==1) { + gvarnum=GetEepromInterface()->getCapability(GvarsNum); + } + if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) { + str.append("
"); + str.append(""); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + + str.append(QString(""); + } + if (GetEepromInterface()->getCapability(RotaryEncoders)) { + str.append(QString(""); + } + str.append(""); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + for (i=0; iGV%1
%2").arg(i+1).arg(g_model1->gvars_names[i])); + } + } + for (i=0; igetCapability(RotaryEncoders); i++) { + str.append(QString("
").arg((i==0 ? 'A': 'B'))); + } + str.append(""); + for (i=0; igetCapability(FlightPhases); i++) { + PhaseData *pd1=&g_model1->phaseData[i]; + PhaseData *pd2=&g_model2->phaseData[i]; + str.append("").arg(pd1->name).arg(color)); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + for (k=0; kgvars[k],pd2->gvars[k]); + if (pd1->gvars[k]<=1024) { + str.append(QString(""); + } + else { + int num = pd1->gvars[k] - 1025; + if (num>=i) num++; + str.append(QString("").arg(num)); + } + } + } + for (k=0; kgetCapability(RotaryEncoders); k++) { + color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]); + if (pd1->rotaryEncoders[k]<=1024) { + str.append(QString(""); + } + else { + int num = pd1->rotaryEncoders[k] - 1025; + if (num>=i) num++; + str.append(QString("").arg(num)); + } + } + str.append(""); + } + str.append("
 ").arg(gvarnum)+tr("Gvars")+"").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"
"+tr("Flight mode name")+"RE%1
"+tr("FM")+QString("%1 ").arg(i)); + color=getColor1(pd1->name,pd2->name); + str.append(QString("%1%1").arg(pd1->gvars[k]).arg(color)+"").arg(color)+tr("FM")+QString("%1%1").arg(pd1->rotaryEncoders[k]).arg(color)+"").arg(color)+tr("FM")+QString("%1
"); + } + str.append("
"); + str.append(""); + for (i=0; i<4; i++) { + str.append(QString("").arg(getStickStr(i))); + } + str.append(""); + for (i=0; igetCapability(FlightPhases); i++) { + PhaseData *pd1=&g_model1->phaseData[i]; + PhaseData *pd2=&g_model2->phaseData[i]; + str.append("").arg(pd2->name).arg(color)); + color=getColor2(pd1->fadeIn,pd2->fadeIn); + str.append(QString("").arg(pd2->fadeIn).arg(color)); + color=getColor2(pd1->fadeOut,pd2->fadeOut); + str.append(QString("").arg(pd2->fadeOut).arg(color)); + for (k=0; k<4; k++) { + if (pd2->trimRef[k]==-1) { + color=getColor2(pd1->trim[k],pd2->trim[k]); + str.append(QString("").arg(pd2->trim[k]).arg(color)); + } else { + color=getColor2(pd1->trimRef[k],pd2->trimRef[k]); + str.append(QString("").arg(pd2->trimRef[k])); + } + } + color=getColor2(pd1->swtch,pd2->swtch); + str.append(QString("").arg(pd2->swtch.toString()).arg(color)); + str.append(""); + } + str.append("
 "); + str.append(tr("Fades")+""+tr("Trims")); + str.append(""+tr("Switch")+"
"+tr("Flight mode name")); + str.append(""+tr("IN")+""+tr("OUT")+"%1
"+tr("FM")+QString("%1 ").arg(i)); + color=getColor2(pd1->name,pd2->name); + str.append(QString("%1%1%1%1").arg(color)+tr("FM")+QString("%1%1
"); + + if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) { + str.append("
"); + str.append(""); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + str.append(QString(""); + } + if (GetEepromInterface()->getCapability(RotaryEncoders)) { + str.append(QString(""); + } + str.append(""); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + for (i=0; iGV%1
%2").arg(i+1).arg(g_model2->gvars_names[i])); + } + } + for (i=0; igetCapability(RotaryEncoders); i++) { + str.append(QString("
").arg((i==0 ? 'A': 'B'))); + } + str.append(""); + for (i=0; igetCapability(FlightPhases); i++) { + PhaseData *pd1=&g_model1->phaseData[i]; + PhaseData *pd2=&g_model2->phaseData[i]; + str.append("").arg(pd2->name).arg(color)); + if (GetEepromInterface()->getCapability(GvarsFlightPhases)) { + for (k=0; kgvars[k],pd2->gvars[k]); + if (pd2->gvars[k]<=1024) { + str.append(QString(""); + } + else { + int num = pd2->gvars[k] - 1025; + if (num>=i) num++; + str.append(QString("").arg(num)); + } + } + } + for (k=0; kgetCapability(RotaryEncoders); k++) { + color=getColor1(pd1->rotaryEncoders[k],pd2->rotaryEncoders[k]); + if (pd2->rotaryEncoders[k]<=1024) { + str.append(QString(""); + } + else { + int num = pd2->rotaryEncoders[k] - 1025; + if (num>=i) num++; + str.append(QString("").arg(num)); + } + } + str.append(""); + } + str.append("
 ").arg(gvarnum)+tr("Gvars")+"").arg(GetEepromInterface()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"
"+tr("Flight mode name")+"RE%1
"+tr("FM")+QString("%1 ").arg(i)); + color=getColor1(pd1->name,pd2->name); + str.append(QString("%1%1").arg(pd2->gvars[k]).arg(color)+"").arg(color)+tr("FM")+QString("%1%1").arg(pd2->rotaryEncoders[k]).arg(color)+"").arg(color)+tr("FM")+QString("%1
"); + } + str.append("
"); + te->append(str); +} + +void compareDialog::printLimits() +{ + QString color; + QString str = ""; + str.append(""); + str.append(""); + str.append("

"+tr("Limits")+"

"); + if (GetEepromInterface()->getCapability(HasChNames)) { + str.append(""); + } else { + str.append(""); + } + for(int i=0; igetCapability(Outputs); i++) { + str.append(""); + if (GetEepromInterface()->getCapability(HasChNames)) { + QString name1=g_model1->limitData[i].name; + QString name2=g_model2->limitData[i].name; + color=getColor1(name1,name2); + if (name1.trimmed().isEmpty()) { + str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),color,true)); + } else { + str.append(doTC(name1,color,true)); + } + } else { + str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true)); + } + color=getColor1(g_model1->limitData[i].offset,g_model2->limitData[i].offset); + str.append(doTR(QString::number((qreal)g_model1->limitData[i].offset/10, 'f', 1),color)); + color=getColor1(g_model1->limitData[i].min,g_model2->limitData[i].min); + str.append(doTR(QString::number(g_model1->limitData[i].min),color)); + color=getColor1(g_model1->limitData[i].max,g_model2->limitData[i].max); + str.append(doTR(QString::number(g_model1->limitData[i].max),color)); + color=getColor1(g_model1->limitData[i].revert,g_model2->limitData[i].revert); + str.append(doTR(QString(g_model1->limitData[i].revert ? tr("INV") : tr("NOR")),color)); + str.append(""); + } + str.append("
"+tr("Name")+""+tr("Offset")+""+tr("Min")+""+tr("Max")+""+tr("Invert")+"
"+tr("Offset")+""+tr("Min")+""+tr("Max")+""+tr("Invert")+"
"); + str.append(""); + for(int i=0; igetCapability(Outputs); i++) { + str.append(""); + if (GetEepromInterface()->getCapability(HasChNames)) { + QString name1=g_model1->limitData[i].name; + QString name2=g_model2->limitData[i].name; + color=getColor2(name1,name2); + if (name2.trimmed().isEmpty()) { + str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),color,true)); + } else { + str.append(doTC(name2,color,true)); + } + } else { + str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true)); + } + color=getColor2(g_model1->limitData[i].offset,g_model2->limitData[i].offset); + str.append(doTR(QString::number((qreal)g_model2->limitData[i].offset/10, 'f', 1),color)); + color=getColor2(g_model1->limitData[i].min,g_model2->limitData[i].min); + str.append(doTR(QString::number(g_model2->limitData[i].min),color)); + color=getColor2(g_model1->limitData[i].max,g_model2->limitData[i].max); + str.append(doTR(QString::number(g_model2->limitData[i].max),color)); + color=getColor2(g_model1->limitData[i].revert,g_model2->limitData[i].revert); + str.append(doTR(QString(g_model2->limitData[i].revert ? tr("INV") : tr("NOR")),color)); + str.append(""); + } + str.append("
"+tr("Offset")+""+tr("Min")+""+tr("Max")+""+tr("Invert")+"
"); + te->append(str); +} + +void compareDialog::printGvars() +{ + QString color; + int gvars=0; + int gvarnum=0; + if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) { + gvars=1; + gvarnum=GetEepromInterface()->getCapability(GvarsNum); + } + + if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) { + QString str = ""; + str.append(""); + str.append(""); + str.append("

"+tr("Global Variables")+"

"); + str.append(""); + PhaseData *pd1=&g_model1->phaseData[0]; + PhaseData *pd2=&g_model2->phaseData[0]; + int width=100/gvarnum; + str.append(""); + for(int i=0; i").arg(width)+tr("GV")+QString("%1").arg(i+1)); + } + str.append(""); + str.append(""); + for(int i=0; igvars[i],pd2->gvars[i]); + str.append(QString("").arg(pd1->gvars[i])); + } + str.append(""); + str.append("
").arg(width).arg(color)+QString("%1
"); + str.append(""); + str.append(""); + for(int i=0; i").arg(width)+tr("GV")+QString("%1").arg(i+1)); + } + str.append(""); + str.append(""); + for(int i=0; igvars[i],pd2->gvars[i]); + str.append(QString("").arg(pd2->gvars[i])); + } + str.append(""); + str.append("
").arg(width).arg(color)+QString("%1
"); + te->append(str); + } +} + +void compareDialog::printExpos() +{ + QString color; + bool expoused[C9X_MAX_EXPOS]={false}; + bool expoused2[C9X_MAX_EXPOS]={false}; + + QString str = "

"; + str.append(tr("Expo/Dr Settings")); + str.append("

"); + for(uint8_t i=0; igetCapability(Outputs); i++) { + if (ChannelHasExpo(g_model1->expoData, i) || ChannelHasExpo(g_model2->expoData, i)) { + str.append(""); + str.append(""); + str.append(""); + str.append(""); + } + } + str.append("
"); + str.append(""); + for (int j=0; jexpoData[j].chn==i){ + int expo=ModelHasExpo(g_model2->expoData, g_model1->expoData[j],expoused); + if (expo>-1) { + if (expoused[expo]==false) { + color="grey"; + expoused[expo]=true; + } else { + color="green"; + } + } else { + color="green"; + } + ExpoData *ed=&g_model1->expoData[j]; + if(ed->mode==0) + continue; + str.append(""; + } + } + str.append("
"); + switch(ed->mode) { + case (1): + str += "<- "; + break; + case (2): + str += "-> "; + break; + default: + str += "   "; + break; + }; + + str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' '); + str += " " + tr("Expo") + QString("%1").arg(getGVarString(ed->expo)).rightJustified(7, ' '); + if (GetEepromInterface()->getCapability(FlightPhases)) { + if(ed->phases) { + if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) { + int mask=1; + int first=0; + for (int i=0; igetCapability(FlightPhases);i++) { + if (!(ed->phases & mask)) { + first++; + } + mask <<=1; + } + if (first>1) { + str += " " + tr("Flight modes") + QString("("); + } else { + str += " " + tr("Flight mode") + QString("("); + } + mask=1; + first=1; + for (int j=0; jgetCapability(FlightPhases);j++) { + if (!(ed->phases & mask)) { + PhaseData *pd = &g_model1->phaseData[j]; + if (!first) { + str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name)); + } else { + str += QString("%1").arg(getPhaseName(j+1,pd->name)); + first=0; + } + } + mask <<=1; + } + str += QString(")"); + } else { + str += tr("DISABLED")+QString(" !!!"); + } + } + } + if (ed->swtch.type) + str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString()); + if (ed->curveMode) + if (ed->curveParam) + str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(ed->curveParam).replace("<", "<").replace(">", ">")); + str += "
"+getStickStr(i)+""); + str.append(""); + for (int j=0; jexpoData[j].chn==i){ + int expo=ModelHasExpo(g_model1->expoData, g_model2->expoData[j], expoused2); + if (expo>-1) { + if (expoused2[expo]==false) { + color="grey"; + expoused2[expo]=true; + } else { + color="red"; + } + } else { + color="red"; + } + ExpoData *ed=&g_model2->expoData[j]; + if(ed->mode==0) + continue; + str.append(""; + } + } + str.append("
"); + switch(ed->mode) { + case (1): + str += "<- "; + break; + case (2): + str += "-> "; + break; + default: + str += "   "; + break; + } + + str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' '); + str += " " + tr("Expo") + QString("%1").arg(getGVarString(ed->expo)).rightJustified(7, ' '); + if (GetEepromInterface()->getCapability(FlightPhases)) { + if(ed->phases) { + if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) { + int mask=1; + int first=0; + for (int i=0; igetCapability(FlightPhases);i++) { + if (!(ed->phases & mask)) { + first++; + } + mask <<=1; + } + if (first>1) { + str += " " + tr("Flight modes") + QString("("); + } else { + str += " " + tr("Flight mode") + QString("("); + } + mask=1; + first=1; + for (int j=0; jgetCapability(FlightPhases);j++) { + if (!(ed->phases & mask)) { + PhaseData *pd = &g_model2->phaseData[j]; + if (!first) { + str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name)); + } else { + str += QString("%1").arg(getPhaseName(j+1,pd->name)); + first=0; + } + } + mask <<=1; + } + str += QString(")"); + } else { + str += tr("DISABLED")+QString(" !!!"); + } + } + } + if (ed->swtch.type) + str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString()); + if (ed->curveMode) + if (ed->curveParam) + str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(ed->curveParam).replace("<", "<").replace(">", ">")); + str += "
"); + te->append(str); +} + +void compareDialog::printMixers() +{ + QString color; + QString str = "

"; + str.append(tr("Mixers")); + str.append("

"); + float scale=GetEepromInterface()->getCapability(SlowScale); + bool mixused[64]={false}; + bool mixused2[64]={false}; + for(uint8_t i=1; i<=GetEepromInterface()->getCapability(Outputs); i++) { + if (ChannelHasMix(g_model1->mixData, i) || ChannelHasMix(g_model2->mixData, i)) { + str.append(""); + str.append(""); + str.append("").arg(i,2,10,QChar('0'))); + str.append(""); + str.append(""); + } + } + str.append("
"); + str.append(""); + for (int j=0; jgetCapability(Mixes); j++) { + if (g_model1->mixData[j].destCh==i) { + int mix=ModelHasMix(g_model2->mixData, g_model1->mixData[j], mixused); + if (mix>-1) { + if (mixused[mix]==false) { + color="grey"; + mixused[mix]=true; + } else { + color="green"; + } + } else { + color="green"; + } + MixData *md = &g_model1->mixData[j]; + str.append(""); + } + } + str.append("
"); + switch(md->mltpx) { + case (1): + str += " *"; + break; + case (2): + str += " R"; + break; + default: + str += "  "; + break; + }; + str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' '); + str += md->srcRaw.toString(); + if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString()); + if (md->carryTrim) str += " " + tr("noTrim"); + if(GetEepromInterface()->getCapability(MixFmTrim) && md->enableFmTrim==1){ + if (md->sOffset) str += " "+ tr("FMTrim") + QString(" (%1%)").arg(md->sOffset); + } else { + if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset)); + } + if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential)); + if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">")); + if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale); + if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale); + if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn); + if (GetEepromInterface()->getCapability(FlightPhases)) { + if(md->phases) { + if (md->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) { + int mask=1; + int first=0; + for (int i=0; igetCapability(FlightPhases);i++) { + if (!(md->phases & mask)) { + first++; + } + mask <<=1; + } + if (first>1) { + str += " " + tr("Flight modes") + QString("("); + } else { + str += " " + tr("Flight mode") + QString("("); + } + mask=1; + first=1; + for (int j=0; jgetCapability(FlightPhases);j++) { + if (!(md->phases & mask)) { + PhaseData *pd = &g_model1->phaseData[j]; + if (!first) { + str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name)); + } else { + str += QString("%1").arg(getPhaseName(j+1,pd->name)); + first=0; + } + } + mask <<=1; + } + str += QString(")"); + } else { + str += tr("DISABLED")+QString(" !!!"); + } + } + } + str.append("
"+tr("CH")+QString("%1"); + str.append(""); + for (int j=0; jgetCapability(Mixes); j++) { + if (g_model2->mixData[j].destCh==i) { + int mix=ModelHasMix(g_model1->mixData, g_model2->mixData[j],mixused2); + if (mix>-1) { + if (mixused2[mix]==false) { + color="grey"; + mixused2[mix]=true; + } else { + color="red"; + } + } else { + color="red"; + } + MixData *md = &g_model2->mixData[j]; + str.append(""); + } + } + str.append("
"); + switch(md->mltpx) { + case (1): + str += " *"; + break; + case (2): + str += " R"; + break; + default: + str += "  "; + break; + }; + str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' '); + str += md->srcRaw.toString(); + if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString()); + if (md->carryTrim) str += " " + tr("noTrim"); + if(GetEepromInterface()->getCapability(MixFmTrim) && md->enableFmTrim==1){ + if (md->sOffset) str += " "+ tr("FMTrim") + QString(" (%1%)").arg(getGVarString(md->sOffset)); + } else { + if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset)); + } + if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential)); + if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">")); + if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale); + if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale); + if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn); + if (GetEepromInterface()->getCapability(FlightPhases)) { + if(md->phases) { + if (md->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) { + int mask=1; + int first=0; + for (int i=0; igetCapability(FlightPhases);i++) { + if (!(md->phases & mask)) { + first++; + } + mask <<=1; + } + if (first>1) { + str += " " + tr("Flight modes") + QString("("); + } else { + str += " " + tr("Flight mode") + QString("("); + } + mask=1; + first=1; + for (int j=0; jgetCapability(FlightPhases);j++) { + if (!(md->phases & mask)) { + PhaseData *pd = &g_model2->phaseData[j]; + if (!first) { + str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name)); + } else { + str += QString("%1").arg(getPhaseName(j+1,pd->name)); + first=0; + } + } + mask <<=1; + } + str += QString(")"); + } else { + str += tr("DISABLED")+QString(" !!!"); + } + } + } + str.append("
"); + te->append(str); +} + +void compareDialog::printCurves() +{ +#if 0 + int i,r,g,b,c; + char buffer [16]; + QString color; + QColor * qplot_color[8]; + qplot_color[0]=new QColor(0,0,127); + qplot_color[1]=new QColor(0,127,0); + qplot_color[2]=new QColor(127,0,0); + qplot_color[3]=new QColor(127,127,0); + qplot_color[4]=new QColor(0,0,255); + qplot_color[5]=new QColor(0,255,0); + qplot_color[6]=new QColor(255,0,0); + qplot_color[7]=new QColor(255,255,0); + QString str = "

"; + str.append(tr("Curves")); + str.append("

"); + str.append(""); + for(i=0; i<5; i++) + str.append(doTC(tr("pt %1").arg(i+1), "", true)); + str.append(""); + for(i=0; i<5; i++) + str.append(doTC(tr("pt %1").arg(i+1), "", true)); + str.append(""); + + for(i=0; igetRgb(&r,&g,&b); + c=r; + c*=256; + c+=g; + c*=256; + c+=b; + sprintf(buffer,"%06x",c); + str.append(""); + for(int j=0; j<5; j++) { + color=getColor1(g_model2->curves5[i][j],g_model2->curves5[i][j]); + str.append(doTR(QString::number(g_model1->curves5[i][j]),color)); + } + str.append(QString("").arg(i+1)); + for(int j=0; j<5; j++) { + color=getColor1(g_model2->curves5[i][j],g_model2->curves5[i][j]); + str.append(doTR(QString::number(g_model2->curves5[i][j]),color)); + } + str.append(""); + } + str.append("
"+tr("5 Points Curves")+"
").arg(buffer)+tr("Curve")+QString(" %1
"); + + str.append(""); + for(i=0; i<9; i++) + str.append(doTC(tr("pt %1").arg(i+1), "", true)); + str.append(""); + for(i=0; i<9; i++) + str.append(doTC(tr("pt %1").arg(i+1), "", true)); + str.append(""); + for(i=0; igetRgb(&r,&g,&b); + c=r; + c*=256; + c+=g; + c*=256; + c+=b; + sprintf(buffer,"%06x",c); + str.append(""); + for(int j=0; j<9; j++) { + color=getColor1(g_model2->curves9[i][j],g_model2->curves9[i][j]); + str.append(doTR(QString::number(g_model1->curves5[i][j]),color)); + } + str.append(QString("").arg(i+1+MAX_CURVE5)); + for(int j=0; j<9; j++) { + color=getColor1(g_model2->curves9[i][j],g_model2->curves9[i][j]); + str.append(doTR(QString::number(g_model2->curves9[i][j]),color)); + } + str.append(""); + } + str.append("
"+tr("9 Points Curves")+"
").arg(buffer)+tr("Curve")+QString(" %1
"); + te->append(str); +#endif +} + +void compareDialog::printSwitches() +{ + int sc=0; + QString color; + QString str = ""; + str.append(""); + str.append("

"+tr("Custom Switches")+"

"); + for (int i=0; igetCapability(CustomSwitches); i++) { + QString sw1 = getCustomSwitchStr(&g_model1->customSw[i], *g_model1); + QString sw2 = getCustomSwitchStr(&g_model2->customSw[i], *g_model2); + if (!(sw1.isEmpty() && sw2.isEmpty())) { + str.append(""); + color=getColor1(sw1,sw2); + str.append(QString(""); + if (i<9) { + str.append("").arg(i+1)); + } else { + str.append(""); + } + color=getColor2(sw1,sw2); + str.append(QString(""); + str.append(""); + sc++; + } + } + str.append("
").arg(color)+sw1+""+tr("CS")+QString("%1"+tr("CS")+('A'+(i-9))+"").arg(color)+sw2+"
"); + if (sc>0) + te->append(str); +} + +void compareDialog::printFSwitches() +{ + QString color1; + QString color2; + int sc=0; + QString str = ""; + str.append(""); + str.append("

"+tr("Custom Functions")+"

"); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + for(int i=0; igetCapability(CustomFunctions); i++) + { + if (g_model1->funcSw[i].swtch.type || g_model2->funcSw[i].swtch.type) { + if ((g_model1->funcSw[i].swtch != g_model2->funcSw[i].swtch) || (g_model1->funcSw[i].func!=g_model2->funcSw[i].func) || (g_model1->funcSw[i].adjustMode!=g_model2->funcSw[i].adjustMode) || (g_model1->funcSw[i].param!=g_model2->funcSw[i].param)) { + color1="green"; + color2="red"; + } else { + color1="grey"; + color2="grey"; + } + str.append(""); + if (g_model1->funcSw[i].swtch.type) { + str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1)); + str.append(doTC(getFuncName(g_model1->funcSw[i].func),color1)); + str.append(doTC(FuncParam(g_model1->funcSw[i].func,g_model1->funcSw[i].param,g_model1->funcSw[i].paramarm, g_model1->funcSw[i].adjustMode),color1)); + int index=g_model1->funcSw[i].func; + if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { + str.append(doTC(QString("%1").arg(g_model1->funcSw[i].repeatParam),color1)); + } else { + str.append(doTC( "---",color1)); + } + if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) { + str.append(doTC((g_model1->funcSw[i].enabled ? "ON" : "OFF"),color1)); + } else { + str.append(doTC( "---",color1)); + } + } else { + str.append(""); + } + str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true)); + if (g_model2->funcSw[i].swtch.type) { + str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2)); + str.append(doTC(getFuncName(g_model2->funcSw[i].func),color2)); + str.append(doTC(FuncParam(g_model2->funcSw[i].func,g_model2->funcSw[i].param,g_model2->funcSw[i].paramarm, g_model2->funcSw[i].adjustMode),color2)); + int index=g_model2->funcSw[i].func; + if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { + str.append(doTC(QString("%1").arg(g_model2->funcSw[i].repeatParam),color2)); + } else { + str.append(doTC( "---",color2)); + } + if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) { + str.append(doTC((g_model2->funcSw[i].enabled ? "ON" : "OFF"),color2)); + } else { + str.append(doTC( "---",color2)); + } + } + else { + str.append(""); + } + str.append(""); + sc++; + } +} + str.append("
"+tr("Switch")+""+tr("Function")+""+tr("Param")+""+tr("Repeat")+""+tr("Enable")+" "+tr("Switch")+""+tr("Function")+""+tr("Param")+""+tr("Repeat")+""+tr("Enable")+"
       
"); + str.append("
"); + if (sc!=0) + te->append(str); +} + +void compareDialog::printSafetySwitches() +{ + QString color1; + QString color2; + int sc=0; + QString str = ""; + str.append(""); + str.append("

"+tr("Safety Switches")+"

"); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + for(int i=0; igetCapability(Outputs); i++) + { + if ((g_model1->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)||(g_model2->safetySw[i].swtch.type!=SWITCH_TYPE_NONE)) { + if ((g_model1->safetySw[i].swtch!=g_model2->safetySw[i].swtch)||(g_model1->safetySw[i].val!=g_model2->safetySw[i].val)) { + color1="green"; + color2="red"; + } else { + color1="grey"; + color2="grey"; + } + str.append(""); + if (g_model1->safetySw[i].swtch.type) { + str.append(doTC(g_model1->safetySw[i].swtch.toString(),color1)); + str.append(doTC(QString::number(g_model1->safetySw[i].val),color1)); + } + else { + str.append(""); + } + str.append(doTC(tr("CH")+QString("%1").arg(i+1),"",true)); + if (g_model2->safetySw[i].swtch.type) { + str.append(doTC(g_model2->safetySw[i].swtch.toString(),color2)); + str.append(doTC(QString::number(g_model2->safetySw[i].val),color2)); + } else { + str.append(""); + } + str.append(""); + sc++; + } +} + str.append("
"+tr("Switch")+""+tr("Value")+" "+tr("Switch")+""+tr("Value")+"
    
"); + str.append("
"); + if (sc!=0) + te->append(str); +} + +void compareDialog::printFrSky() +{ + QString color; + float value1,value2; + QString str = ""; + str.append(""); + str.append("

"+tr("Telemetry Settings")+"

"); + str.append(""); + FrSkyData *fd1=&g_model1->frsky; + FrSkyData *fd2=&g_model2->frsky; + str.append(""); + for (int i=0; i<2; i++) { + str.append(""); + float ratio=(fd1->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + str.append(""); + color=getColor1(fd1->channels[i].type,fd2->channels[i].type); + str.append(""); + color=getColor1(fd1->channels[i].ratio,fd2->channels[i].ratio); + str.append(""); + color=getColor1(fd1->channels[i].offset*fd1->channels[i].ratio,fd2->channels[i].offset*fd2->channels[i].ratio); + str.append(""); + str.append(""); + } + str.append("
"+tr("Analog")+""+tr("Unit")+""+tr("Scale")+""+tr("Offset")+"
"+tr("A%1").arg(i+1)+""+getFrSkyUnits(fd1->channels[i].type)+""+QString::number(ratio,10,(fd1->channels[i].type==0 ? 1:0))+""+QString::number((fd1->channels[i].offset*ratio)/255,10,(fd1->channels[i].type==0 ? 1:0))+"

"); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + for (int i=0; i<2; i++) { + float ratio1=(fd1->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + float ratio2=(fd1->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + str.append(""); + str.append(""); + color=getColor1(fd1->channels[i].alarms[0].level,fd2->channels[i].alarms[0].level); + str.append(""); + color=getColor1(fd1->channels[i].alarms[0].greater,fd2->channels[i].alarms[0].greater); + str.append(""); + color=getColor1(fd1->channels[i].alarms[1].level,fd2->channels[i].alarms[1].level); + str.append(""); + color=getColor1(fd1->channels[i].alarms[1].greater,fd2->channels[i].alarms[1].greater); + str.append(""); + } + str.append(""); + color=getColor1(fd1->rssiAlarms[0].level,fd2->rssiAlarms[0].level); + str.append(""); + str.append(""); + color=getColor1(fd1->rssiAlarms[0].value,fd2->rssiAlarms[0].value); + str.append(""); + color=getColor1(fd1->rssiAlarms[1].level,fd2->rssiAlarms[1].level); + str.append(""); + str.append(""); + color=getColor1(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value); + str.append(""); + str.append("
"+tr("Alarm 1")+""+tr("Alarm 2")+"
"+tr("Type")+""+tr("Condition")+""+tr("Value")+""+tr("Type")+""+tr("Condition")+""+tr("Value")+"
"+tr("A%1").arg(i+1)+""+getFrSkyAlarmType(fd1->channels[i].alarms[0].level)+""); + str.append((fd1->channels[i].alarms[0].greater==1) ? ">" : "<"); + value1=ratio1*(fd1->channels[i].alarms[0].value/255.0+fd1->channels[i].offset/255.0); + value2=ratio2*(fd2->channels[i].alarms[0].value/255.0+fd2->channels[i].offset/255.0); + color=getColor1(value1,value2); + str.append(""+QString::number(value1,10,(fd1->channels[i].type==0 ? 1:0))+""+getFrSkyAlarmType(fd1->channels[i].alarms[1].level)+""); + str.append((fd1->channels[i].alarms[1].greater==1) ? ">" : "<"); + value1=ratio1*(fd1->channels[i].alarms[1].value/255.0+fd1->channels[i].offset/255.0); + value2=ratio2*(fd2->channels[i].alarms[1].value/255.0+fd2->channels[i].offset/255.0); + color=getColor1(value1,value2); + str.append(""+QString::number(value1,10,(fd1->channels[i].type==0 ? 1:0))+"
"+tr("RSSI Alarm")+""+getFrSkyAlarmType(fd1->rssiAlarms[0].level)+"<"+QString::number(fd1->rssiAlarms[0].value,10)+""+getFrSkyAlarmType(fd1->rssiAlarms[1].level)+"<"+QString::number(fd1->rssiAlarms[1].value,10)+"
"); + if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { + int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); + if (cols==0) cols=2; + for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) { + QString tcols; + QString cwidth; + QString swidth; + if (cols==2) { + tcols="3"; + cwidth="45"; + swidth="10"; + } else { + tcols="5"; + cwidth="30"; + swidth="5"; + } + color=getColor1(fd1->screens[j].type,fd2->screens[j].type); + if (fd1->screens[j].type==0) { + str.append("
"); + for (int r=0; r<4; r++) { + str.append(""); + for (int c=0; cscreens[j].type==fd2->screens[j].type) + color=getColor1(fd1->screens[j].body.lines[r].source[c],fd2->screens[j].body.lines[r].source[c]); + str.append(""); + if (c<(cols-1)) { + str.append(""); + } + } + str.append(""); + } + str.append("
"+tr("Custom Telemetry View")+"
 
"+getFrSkySrc(fd1->screens[j].body.lines[r].source[c])+" 
"); + } else { + str.append("
"); + str.append(""); + for (int i=0; i<4; i++) { + str.append(""); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor1(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source); + str.append(""); + value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1); + value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor1(value1,value2); + str.append(""); + value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1); + value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor1(value1,value2); + str.append(""); + } + str.append("
"+tr("Telemetry Bars")+"
"+tr("Bar Number")+""+tr("Source")+""+tr("Min")+""+tr("Max")+"
"+QString::number(i+1,10)+""+getFrSkySrc(fd1->screens[0].body.bars[i].source)+""+QString::number(value1)+""+QString::number(value1)+"
"); + } + } + } + + str.append("
"); + str.append(""); + str.append(""); + for (int i=0; i<2; i++) { + str.append(""); + float ratio=(fd2->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + str.append(""); + color=getColor2(fd1->channels[i].type,fd2->channels[i].type); + str.append(""); + color=getColor2(fd1->channels[i].ratio,fd2->channels[i].ratio); + str.append(""); + color=getColor2(fd1->channels[i].offset*fd1->channels[i].ratio,fd2->channels[i].offset*fd2->channels[i].ratio); + str.append(""); + str.append(""); + } + str.append("
"+tr("Analog")+""+tr("Unit")+""+tr("Scale")+""+tr("Offset")+"
"+tr("A%1").arg(i+1)+""+getFrSkyUnits(fd2->channels[i].type)+""+QString::number(ratio,10,(fd2->channels[i].type==0 ? 1:0))+""+QString::number((fd2->channels[i].offset*ratio)/255,10,(fd2->channels[i].type==0 ? 1:0))+"

"); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + str.append(""); + for (int i=0; i<2; i++) { + float ratio1=(fd1->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + float ratio2=(fd1->channels[i].ratio/(fd1->channels[i].type==0 ?10.0:1)); + str.append(""); + str.append(""); + color=getColor2(fd1->channels[i].alarms[0].level,fd2->channels[i].alarms[0].level); + str.append(""); + color=getColor2(fd1->channels[i].alarms[0].greater,fd2->channels[i].alarms[0].greater); + str.append(""); + color=getColor2(fd1->channels[i].alarms[1].level,fd2->channels[i].alarms[1].level); + str.append(""); + color=getColor2(fd1->channels[i].alarms[1].greater,fd2->channels[i].alarms[1].greater); + str.append(""); + } + str.append(""); + color=getColor2(fd1->rssiAlarms[0].level,fd2->rssiAlarms[0].level); + str.append(""); + str.append(""); + color=getColor2(fd1->rssiAlarms[0].value,fd2->rssiAlarms[0].value); + str.append(""); + color=getColor2(fd1->rssiAlarms[1].level,fd2->rssiAlarms[1].level); + str.append(""); + str.append(""); + color=getColor2(fd1->rssiAlarms[1].value,fd2->rssiAlarms[1].value); + str.append(""); + str.append("
"+tr("Alarm 1")+""+tr("Alarm 2")+"
"+tr("Type")+""+tr("Condition")+""+tr("Value")+""+tr("Type")+""+tr("Condition")+""+tr("Value")+"
"+tr("A%1").arg(i+1)+""+getFrSkyAlarmType(fd2->channels[i].alarms[0].level)+""); + str.append((fd2->channels[i].alarms[0].greater==1) ? ">" : "<"); + value1=ratio1*(fd1->channels[i].alarms[0].value/255.0+fd1->channels[i].offset/255.0); + value2=ratio2*(fd2->channels[i].alarms[0].value/255.0+fd2->channels[i].offset/255.0); + color=getColor2(value1,value2); + str.append(""+QString::number(value2,10,(fd2->channels[i].type==0 ? 1:0))+""+getFrSkyAlarmType(fd2->channels[i].alarms[1].level)+""); + str.append((fd2->channels[i].alarms[1].greater==1) ? ">" : "<"); + value1=ratio1*(fd1->channels[i].alarms[1].value/255.0+fd1->channels[i].offset/255.0); + value2=ratio2*(fd2->channels[i].alarms[1].value/255.0+fd2->channels[i].offset/255.0); + color=getColor2(value1,value2); + str.append(""+QString::number(value2,10,(fd2->channels[i].type==0 ? 1:0))+"
"+tr("RSSI Alarm")+""+getFrSkyAlarmType(fd2->rssiAlarms[0].level)+"<"+QString::number(fd2->rssiAlarms[0].value,10)+""+getFrSkyAlarmType(fd2->rssiAlarms[1].level)+"<"+QString::number(fd2->rssiAlarms[1].value,10)+"

"); + + if (GetEepromInterface()->getCapability(TelemetryBars) || GetEepromInterface()->getCapability(TelemetryCSFields)) { + int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields); + if (cols==0) cols=2; + for (int j=0; jgetCapability(TelemetryCSFields)/(4*cols); j++) { + QString tcols; + QString cwidth; + QString swidth; + if (cols==2) { + tcols="3"; + cwidth="45"; + swidth="10"; + } else { + tcols="5"; + cwidth="30"; + swidth="5"; + } + color=getColor2(fd1->screens[j].type,fd2->screens[j].type); + if (fd2->screens[j].type==0) { + str.append("
"); + for (int r=0; r<4; r++) { + str.append(""); + for (int c=0; cscreens[j].type==fd2->screens[j].type) + color=getColor2(fd1->screens[j].body.lines[r].source[c],fd2->screens[j].body.lines[r].source[c]); + str.append(""); + if (c<(cols-1)) { + str.append(""); + } + } + str.append(""); + } + str.append("
"+tr("Custom Telemetry View")+"
 
"+getFrSkySrc(fd2->screens[j].body.lines[r].source[c])+" 
"); + } else { + str.append("
"); + str.append(""); + for (int i=0; i<4; i++) { + str.append(""); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor2(fd1->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].source); + str.append(""); + value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMin,fd1); + value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMin,fd2); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor2(value1,value2); + str.append(""); + value1=getBarValue(fd1->screens[0].body.bars[i].source,fd1->screens[0].body.bars[i].barMax,fd1); + value2=getBarValue(fd2->screens[0].body.bars[i].source,fd2->screens[0].body.bars[i].barMax,fd2); + if (fd1->screens[0].type==fd2->screens[0].type) + color=getColor2(value1,value2); + str.append(""); + } + str.append("
"+tr("Telemetry Bars")+"
"+tr("Bar Number")+""+tr("Source")+""+tr("Min")+""+tr("Max")+"
"+QString::number(i+1,10)+""+getFrSkySrc(fd2->screens[0].body.bars[i].source)+""+QString::number(value2)+""+QString::number(value2)+"
"); + } + } + } + str.append("
"); + te->append(str); +} + +void compareDialog::on_printButton_clicked() +{ + QPrinter printer; + printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter); + QPrintDialog *dialog = new QPrintDialog(&printer, this); + dialog->setWindowTitle(tr("Print Document")); + if (dialog->exec() != QDialog::Accepted) + return; + te->print(&printer); +} + +void compareDialog::on_printFileButton_clicked() +{ + QPrinter printer; + QString filename = QFileDialog::getSaveFileName(this,tr("Select PDF output file"),QString(),"Pdf File(*.pdf)"); + printer.setPageMargins(10.0,10.0,10.0,10.0,printer.Millimeter); + printer.setOutputFormat(QPrinter::PdfFormat); + printer.setOrientation(QPrinter::Landscape); + printer.setColorMode(QPrinter::Color); + if(!filename.isEmpty()) { + if(QFileInfo(filename).suffix().isEmpty()) + filename.append(".pdf"); + printer.setOutputFileName(filename); + te->print(&printer); + } +} diff --git a/companion/src/comparedialog.h b/companion/src/comparedialog.h new file mode 100644 index 000000000..e955ea2db --- /dev/null +++ b/companion/src/comparedialog.h @@ -0,0 +1,95 @@ +#ifndef COMPAREDIALOG_H +#define COMPAREDIALOG_H + +#include +#include +#include +#include "eeprominterface.h" + +namespace Ui { + class compareDialog; +} + +class compareDialog : public QDialog +{ + Q_OBJECT + +public: + explicit compareDialog(QWidget *parent = 0, GeneralSettings *gg = 0); + + ~compareDialog(); + void closeEvent(QCloseEvent *event); + + ModelData * g_model1; + ModelData * g_model2; + ModelData * modeltemp; + int model1; + int model2; + GeneralSettings *g_eeGeneral; + EEPROMInterface *eepromInterface; + +private: + Ui::compareDialog *ui; + QString doTC(const QString s, const QString color, bool bold); + QString doTR(const QString s, const QString color, bool bold); + QString doTL(const QString s, const QString color, bool bold); + QString fv(const QString name, const QString value,const QString color); + template QString getColor1(T val1, T val2) { + if (val1!=val2) + return "green"; + else + return "grey"; + } + template QString getColor2(T val1, T val2) { + if (val1!=val2) + return "red"; + else + return "grey"; + } + QString getColor1(char * val1, char * val2) { + if (strcmp(val1,val2)!=0) + return "green"; + else + return "grey"; + } + QString getColor2(char * val1, char * val2) { + if (strcmp(val1,val2)!=0) + return "red"; + else + return "grey"; + } + + int ModelHasExpo(ExpoData * ExpoArray, ExpoData expo, bool * expoused); + bool ChannelHasExpo(ExpoData * expoArray, uint8_t destCh); + int ModelHasMix(MixData * mixArray, MixData mix, bool * mixused); + bool ChannelHasMix(MixData * mixArray, uint8_t destCh); + + QTextEdit * te; + QString curvefile5; + QString curvefile9; + QDir *qd; + +private slots: + void on_printButton_clicked(); + void on_printFileButton_clicked(); + +protected: + void dropEvent(QDropEvent *event); + void dragMoveEvent(QDragMoveEvent *event); + void dragEnterEvent(QDragEnterEvent *event); + void dragLeaveEvent(QDragLeaveEvent *event); + void printDiff(); + void printSetup(); + void printPhases(); + void printLimits(); + void printExpos(); + void printMixers(); + void printCurves(); + void printGvars(); + void printSwitches(); + void printSafetySwitches(); + void printFSwitches(); + void printFrSky(); +}; + +#endif // COMPAREDIALOG_H diff --git a/companion/src/comparedialog.ui b/companion/src/comparedialog.ui new file mode 100644 index 000000000..456d1db87 --- /dev/null +++ b/companion/src/comparedialog.ui @@ -0,0 +1,152 @@ + + + compareDialog + + + + 0 + 0 + 800 + 580 + + + + + 0 + 0 + + + + + 780 + 0 + + + + false + + + Dialog + + + + :/images/print.png:/images/print.png + + + + + + + + + 75 + true + + + + true + + + color:green; + + + Drag first model here + + + Qt::AlignCenter + + + + + + + + 75 + true + + + + true + + + color:red; + + + Drag second model here + + + Qt::AlignCenter + + + + + + + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + Print + + + + + + + Print to file + + + + + + + + + + + + + closeButton + clicked() + compareDialog + reject() + + + 739 + 636 + + + 565 + 623 + + + + + diff --git a/companion/src/contributorsdialog.cpp b/companion/src/contributorsdialog.cpp new file mode 100644 index 000000000..d60a682db --- /dev/null +++ b/companion/src/contributorsdialog.cpp @@ -0,0 +1,82 @@ +#include "contributorsdialog.h" +#include "ui_contributorsdialog.h" +#include +#define CLINESEP "=====================================================\n" + +contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnurl) : + QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), + ui(new Ui::contributorsDialog) +{ + ui->setupUi(this); + switch (contest) { + case 0: { + ui->textBrowser->insertPlainText(CLINESEP); + ui->textBrowser->insertPlainText(tr("People who have contributed to this project")+"\n"); + ui->textBrowser->insertPlainText(CLINESEP); + QFile file(":/contributors"); + if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { + ui->textBrowser->insertPlainText(file.readAll()); + } + ui->textBrowser->insertPlainText("\n"); + ui->textBrowser->insertPlainText(CLINESEP); + ui->textBrowser->insertPlainText(tr("Coders")+"\n"); + ui->textBrowser->insertPlainText(CLINESEP); + QFile file2(":/coders"); + if(file2.open( QIODevice::ReadOnly | QIODevice::Text ) ) { + ui->textBrowser->insertPlainText(file2.readAll()); + } + ui->textBrowser->insertPlainText("\n\n\n"); + ui->textBrowser->insertPlainText(tr("Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and it's fantastic eePe, from which\ncompanion9x was forked out.")); + ui->textBrowser->insertPlainText("\n\n"); + ui->textBrowser->insertPlainText(tr("Thank you all !!!")); + ui->textBrowser->setReadOnly(true); + ui->textBrowser->verticalScrollBar()->setValue(0); + this->setWindowTitle(tr("Contributors")); + } + break; + + case 1:{ + QFile file(":/releasenotes"); + if(file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { + ui->textBrowser->insertHtml(file.readAll()); + } + ui->textBrowser->setReadOnly(true); + ui->textBrowser->verticalScrollBar()->setValue(0); + this->setWindowTitle(tr("Companion9x Release Notes")); + } + break; + case 2:{ + if (!rnurl.isEmpty()) { + this->setWindowTitle(tr("OpenTX Release Notes")); + manager = new QNetworkAccessManager(this); + connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); + QUrl url(rnurl); + QNetworkRequest request(url); + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); + manager->get(request); + } else { + QTimer::singleShot(0, this, SLOT(forceClose())); + } + break; + } + } +} + +void contributorsDialog::showEvent ( QShowEvent * ) +{ + ui->textBrowser->verticalScrollBar()->setValue(0); +} + +contributorsDialog::~contributorsDialog() +{ + delete ui; +} + +void contributorsDialog::replyFinished(QNetworkReply * reply) +{ + ui->textBrowser->insertHtml(reply->readAll()); +} + +void contributorsDialog::forceClose() { + accept();; +} diff --git a/companion/src/contributorsdialog.h b/companion/src/contributorsdialog.h new file mode 100644 index 000000000..51c772499 --- /dev/null +++ b/companion/src/contributorsdialog.h @@ -0,0 +1,31 @@ +#ifndef CONTRIBUTORSDIALOG_H +#define CONTRIBUTORSDIALOG_H + +#include +#include "eeprominterface.h" +#include "downloaddialog.h" + +namespace Ui { + class contributorsDialog; +} + +class contributorsDialog : public QDialog +{ + Q_OBJECT +public: + explicit contributorsDialog(QWidget *parent = 0, int contest = 0, QString rnurl = QString() ); + ~contributorsDialog(); + +private: + Ui::contributorsDialog *ui; + QNetworkAccessManager *manager; + + void showEvent ( QShowEvent * ); + +private slots: + void forceClose(); + void replyFinished(QNetworkReply * reply); + +}; + +#endif // CONTRIBUTORSDIALOG_H diff --git a/companion/src/contributorsdialog.ui b/companion/src/contributorsdialog.ui new file mode 100644 index 000000000..1c09ba66d --- /dev/null +++ b/companion/src/contributorsdialog.ui @@ -0,0 +1,30 @@ + + + contributorsDialog + + + + 0 + 0 + 926 + 333 + + + + Dialog + + + + :/icon.png:/icon.png + + + + + + + + + + + + diff --git a/companion/src/cursorwidget.h b/companion/src/cursorwidget.h new file mode 100644 index 000000000..7d35b343e --- /dev/null +++ b/companion/src/cursorwidget.h @@ -0,0 +1,106 @@ +/* + * Author - Bertrand Songis + * + * Based on th9x -> http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#ifndef CURSORWIDGET_H +#define CURSORWIDGET_H + +#include +#include + +class cursorWidget : public QWidget { + + Q_OBJECT + + public: + + explicit cursorWidget(QWidget * parent = 0): + QWidget(parent) + { + } + + protected: + + virtual void mousePressEvent(QMouseEvent * event) + { + float upx[] = {68,28,51,83,105,68}; + float upy[] = {83,45,32,32,45,83}; + float minx[] = {74,114,127,127,114,74}; + float miny[] = {90,51,80,106,130,90}; + float dox[] = {68,28,51,83,105,68}; + float doy[] = {98,137,151,151,137,98}; + float plusx[] = { 80,20,7,7,20,80}; + float plusy[] = {90,51,80,106,130,90}; + + int x=event->x(); + int y=event->y(); + setFocus(); + if (event->button()==Qt::LeftButton) { + if (pnpoly(6,upx,upy,(float)x,(float)y)==1) { + setStyleSheet("background:url(:/images/9xcursup.png);"); + emit buttonPressed(Qt::Key_Up); + } + else if (pnpoly(6,minx,miny,(float)x,(float)y)==1) { + setStyleSheet("background:url(:/images/9xcursmin.png);"); + emit buttonPressed(Qt::Key_Right); + } + else if (pnpoly(6,dox,doy,(float)x,(float)y)==1) { + setStyleSheet("background:url(:/images/9xcursdown.png);"); + emit buttonPressed(Qt::Key_Down); + } + else if (pnpoly(6,plusx,plusy,(float)x,(float)y)==1) { + setStyleSheet("background:url(:/images/9xcursplus.png);"); + emit buttonPressed(Qt::Key_Left); + } else if (sqrt(((float)x-22)*((float)x-22)+((float)y-165)*((float)y-165))<17) { + setStyleSheet("background:url(:/images/9xcursphoto.png);"); + emit buttonPressed(Qt::Key_Print); + } + } + // QWidget::mousePressEvent(event); + } + + virtual void mouseReleaseEvent(QMouseEvent * event) + { + setStyleSheet("background:url(:/images/9xcurs.png);"); + emit buttonPressed(0); + setFocus(); + //QWidget::mouseReleaseEvent(event); + } + + void paintEvent(QPaintEvent *) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + } + + inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy) + { + int i, j, c = 0; + for (i = 0, j = nvert-1; i < nvert; j = i++) { + if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) ) + c = !c; + } + return c; + } + + signals: + void buttonPressed(int button); + +}; + + +#endif /* CURSORWIDGET_H */ + diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp new file mode 100644 index 000000000..2358e1c7a --- /dev/null +++ b/companion/src/customizesplashdialog.cpp @@ -0,0 +1,187 @@ +#include "customizesplashdialog.h" +#include "ui_customizesplashdialog.h" + +#include +#include "helpers.h" +#include "burndialog.h" +#include "splashlibrary.h" +#include "flashinterface.h" + +customizeSplashDialog::customizeSplashDialog(QWidget *parent) : +QDialog(parent), +ui(new Ui::customizeSplashDialog) { + ui->setupUi(this); + ui->HowToLabel->clear(); + ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); +} + +customizeSplashDialog::~customizeSplashDialog() { + delete ui; +} + +void customizeSplashDialog::on_FlashLoadButton_clicked() +{ + QString fileName; + QSettings settings("companion9x", "companion9x"); + ui->ImageLoadButton->setDisabled(true); + ui->libraryButton->setDisabled(true); + ui->SaveFlashButton->setDisabled(true); + ui->SaveImageButton->setDisabled(true); + ui->ImageFileName->clear(); + ui->imageLabel->clear(); + ui->HowToLabel->clear(); + ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)"); + fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER); + QFile file(fileName); + if (!file.exists()) { + ui->FWFileName->clear(); + ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); + return; + } + if (fileName.isEmpty()) { + ui->FWFileName->clear(); + ui->HowToLabel->append("
" + tr("Select an original firmware file") + "
"); + return; + } + + ui->FWFileName->setText(fileName); + FlashInterface flash(fileName); + if (flash.hasSplash()) { + ui->HowToLabel->append("
" + tr("Select an image to customize your splash
or save actual firmware splash") + "
"); + ui->ImageLoadButton->setEnabled(true); + ui->libraryButton->setEnabled(true); + ui->SaveImageButton->setEnabled(true); + ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash())); + ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2); + } else { + QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file")); + return; + } + settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); +} + +void customizeSplashDialog::on_ImageLoadButton_clicked() { + QString supportedImageFormats; + for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { + supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; + } + + QSettings settings("companion9x", "companion9x"); + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats)); + + if (!fileName.isEmpty()) { + settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); + return; + } + ui->HowToLabel->clear(); + ui->ImageFileName->setText(fileName); + if (ui->imageLabel->width()==424) { + image=image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = image.width(); + int height = image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2))); + } else { + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); + } + ui->SaveFlashButton->setEnabled(true); + ui->HowToLabel->append("
" + tr("Save your custimized firmware") + "
"); + } +} + +void customizeSplashDialog::on_libraryButton_clicked() { + QString fileName; + + splashLibrary *ld = new splashLibrary(this,&fileName); + ld->exec(); + if (!fileName.isEmpty()) { + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); + return; + } + ui->HowToLabel->clear(); + ui->ImageFileName->setText(fileName); + if (ui->imageLabel->width()==424) { + image=image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + int width = image.width(); + int height = image.height(); + for (int i = 0; i < width; ++i) + { + for (int j = 0; j < height; ++j) + { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2))); + } else { + ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); + } + ui->SaveFlashButton->setEnabled(true); + ui->HowToLabel->append("
" + tr("Save your custimized firmware") + "
"); + } +} + +void customizeSplashDialog::on_SaveFlashButton_clicked() +{ + QString fileName; + QSettings settings("companion9x", "companion9x"); + ui->HowToLabel->clear(); + fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER, 0, QFileDialog::DontConfirmOverwrite); + if (fileName.isEmpty()) { + return; + } + FlashInterface flash(ui->FWFileName->text()); + if (!flash.hasSplash()) { + QMessageBox::critical(this, tr("Error"), tr("Error reading file %1").arg(fileName)); + return; + } + settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath()); + QImage image = ui->imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight()); + flash.setSplash(image); + if (flash.saveFlash(fileName) > 0) { + ui->HowToLabel->setStyleSheet("background:rgb(0,255.0);"); + ui->HowToLabel->append("
" + tr("Firmware correctly saved.") + "
"); + } else { + ui->HowToLabel->setStyleSheet("background:rgb(255.0.0);"); + ui->HowToLabel->append("
" + tr("Firmware not saved.") + "
"); + } +} + +void customizeSplashDialog::on_InvertColorButton_clicked() +{ + QImage image = ui->imageLabel->pixmap()->toImage(); + image.invertPixels(); + ui->imageLabel->setPixmap(QPixmap::fromImage(image)); +} + +void customizeSplashDialog::on_SaveImageButton_clicked() +{ + QString fileName; + QSettings settings("companion9x", "companion9x"); + + fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite); + if (!fileName.isEmpty()) { + settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath()); + QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8); + image.save(fileName, "PNG"); + } +} diff --git a/companion/src/customizesplashdialog.h b/companion/src/customizesplashdialog.h new file mode 100644 index 000000000..f5a7acd6d --- /dev/null +++ b/companion/src/customizesplashdialog.h @@ -0,0 +1,33 @@ +#ifndef CUSTOMIZESPLASHDIALOG_H +#define CUSTOMIZESPLASHDIALOG_H + +#include +#include +#include "flashinterface.h" + +namespace Ui +{ + class customizeSplashDialog; +} + +class customizeSplashDialog : public QDialog +{ + Q_OBJECT + +public: + explicit customizeSplashDialog(QWidget *parent = 0); + ~customizeSplashDialog(); + +private slots: + void on_FlashLoadButton_clicked(); + void on_ImageLoadButton_clicked(); + void on_libraryButton_clicked(); + void on_SaveFlashButton_clicked(); + void on_InvertColorButton_clicked(); + void on_SaveImageButton_clicked(); + +private: + Ui::customizeSplashDialog *ui; +}; + +#endif // CUSTOMIZESPLASHDIALOG_H diff --git a/companion/src/customizesplashdialog.ui b/companion/src/customizesplashdialog.ui new file mode 100644 index 000000000..69762f1ba --- /dev/null +++ b/companion/src/customizesplashdialog.ui @@ -0,0 +1,270 @@ + + + customizeSplashDialog + + + + 0 + 0 + 366 + 303 + + + + + 0 + 0 + + + + Customize Splash + + + + :/images/c_home.png:/images/c_home.png + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + 256 + 128 + + + + + 424 + 128 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + :/images/customize.png + + + true + + + + + + + + + Save Image + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Invert Color + + + + + + + + + + + Qt::Horizontal + + + + 50 + 20 + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 40 + + + + background:rgb(255, 255, 0); + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + true + + + + + + + + + true + + + true + + + + + + + Load Firmware + + + + + + + true + + + true + + + + + + + false + + + Load Image + + + + + + + Open Splash Library + + + ... + + + + :/images/library.png:/images/library.png + + + + 16 + 16 + + + + + + + + Qt::Horizontal + + + + 208 + 20 + + + + + + + + false + + + Save Firmware + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + + + + diff --git a/companion/src/downloaddialog.cpp b/companion/src/downloaddialog.cpp new file mode 100644 index 000000000..83da451bd --- /dev/null +++ b/companion/src/downloaddialog.cpp @@ -0,0 +1,88 @@ +#include "downloaddialog.h" +#include "ui_downloaddialog.h" +#include +#include + +downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) : + QDialog(parent), + ui(new Ui::downloadDialog) +{ + ui->setupUi(this); + + ui->progressBar->setValue(1); + ui->progressBar->setMinimum(0); + ui->progressBar->setMaximum(0); + + if(tgt.isEmpty()) + { + setWindowTitle(src); + return; // just show wait dialog. + } + + file = new QFile(tgt); + if (!file->open(QIODevice::WriteOnly)) { + QMessageBox::critical(this, "companion9x", + tr("Unable to save the file %1: %2.") + .arg(tgt).arg(file->errorString())); + QTimer::singleShot(0, this, SLOT(fileError())); + } else { + + reply = qnam.get(QNetworkRequest(QUrl(src))); + connect(reply, SIGNAL(finished()), + this, SLOT(httpFinished())); + connect(reply, SIGNAL(readyRead()), + this, SLOT(httpReadyRead())); + connect(reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(updateDataReadProgress(qint64,qint64))); + + } +} +downloadDialog::~downloadDialog() +{ + delete ui; +} + +void downloadDialog::httpFinished() +{ + file->flush(); + file->close(); + + bool ok = true; + if (reply->error()) + { + file->remove(); + QMessageBox::information(this, tr("companion9x"), + tr("Download failed: %1.") + .arg(reply->errorString())); + ok = false; + } + + reply->deleteLater(); + reply = 0; + delete file; + file = 0; + + if(ok) + accept(); + else + reject(); +} + +void downloadDialog::httpReadyRead() +{ + if (file) + file->write(reply->readAll()); +} + +void downloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes) +{ + ui->progressBar->setMaximum(totalBytes); + ui->progressBar->setValue(bytesRead); +} + +void downloadDialog::fileError() +{ + delete file; + file = 0; + reject(); +} diff --git a/companion/src/downloaddialog.h b/companion/src/downloaddialog.h new file mode 100644 index 000000000..596002250 --- /dev/null +++ b/companion/src/downloaddialog.h @@ -0,0 +1,38 @@ +#ifndef DOWNLOADDIALOG_H +#define DOWNLOADDIALOG_H + +#include +#include +#include +#include +#include + + +namespace Ui { + class downloadDialog; +} + +class downloadDialog : public QDialog +{ + Q_OBJECT + +public: + explicit downloadDialog(QWidget *parent = 0, QString src = "", QString tgt = ""); + ~downloadDialog(); + +private slots: + void fileError(); + void httpFinished(); + void httpReadyRead(); + void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes); + +private: + Ui::downloadDialog *ui; + + QNetworkAccessManager qnam; + QNetworkReply *reply; + QFile *file; + +}; + +#endif // DOWNLOADDIALOG_H diff --git a/companion/src/downloaddialog.ui b/companion/src/downloaddialog.ui new file mode 100644 index 000000000..9f5681542 --- /dev/null +++ b/companion/src/downloaddialog.ui @@ -0,0 +1,90 @@ + + + downloadDialog + + + + 0 + 0 + 562 + 82 + + + + Downloading: + + + + :/icon.png:/icon.png + + + + + + 0 + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + buttonBox + accepted() + downloadDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + downloadDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/companion/src/edge.cpp b/companion/src/edge.cpp new file mode 100644 index 000000000..028a2c604 --- /dev/null +++ b/companion/src/edge.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "edge.h" +#include "node.h" + +#include + +static const double Pi = 3.14159265358979323846264338327950288419717; + +Edge::Edge(Node *sourceNode, Node *destNode) + : arrowSize(10) +{ + setAcceptedMouseButtons(0); + source = sourceNode; + dest = destNode; + source->addEdge(this); + dest->addEdge(this); + adjust(); +} + +Edge::~Edge() +{ +} + +Node *Edge::sourceNode() const +{ + return source; +} + +void Edge::setSourceNode(Node *node) +{ + source = node; + adjust(); +} + +Node *Edge::destNode() const +{ + return dest; +} + +void Edge::setDestNode(Node *node) +{ + dest = node; + adjust(); +} + +void Edge::adjust() +{ + if (!source || !dest) + return; + + QLineF line(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0)); + qreal length = line.length(); + prepareGeometryChange(); + int ballSize = source->getBallSize(); + if (length > qreal(ballSize)) { + QPointF edgeOffset((line.dx() * ballSize / 2) / length, (line.dy() * ballSize / 2) / length); + sourcePoint = line.p1() + edgeOffset; + destPoint = line.p2() - edgeOffset; + } else { + sourcePoint = destPoint = line.p1(); + } +} + +QRectF Edge::boundingRect() const +{ + if (!source || !dest) + return QRectF(); + + qreal penWidth = 1; + qreal extra = (penWidth + arrowSize) / 2.0; + + return QRectF(sourcePoint, QSizeF(destPoint.x() - sourcePoint.x(), + destPoint.y() - sourcePoint.y())) + .normalized() + .adjusted(-extra, -extra, extra, extra); +} + +void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + if (!source || !dest) + return; + + QLineF line(sourcePoint, destPoint); + if (qFuzzyCompare(line.length(), qreal(0.))) + return; + + // Draw the line itself + painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter->drawLine(line); +} diff --git a/companion/src/edge.h b/companion/src/edge.h new file mode 100644 index 000000000..0890f0d9d --- /dev/null +++ b/companion/src/edge.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EDGE_H +#define EDGE_H + +#include + +class Node; + +class Edge : public QGraphicsItem +{ +public: + Edge(Node *sourceNode, Node *destNode); + ~Edge(); + + Node *sourceNode() const; + void setSourceNode(Node *node); + + Node *destNode() const; + void setDestNode(Node *node); + + void adjust(); + + enum { Type = UserType + 2 }; + int type() const { return Type; } + +protected: + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +private: + Node *source, *dest; + + QPointF sourcePoint; + QPointF destPoint; + qreal arrowSize; +}; + +#endif diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h new file mode 100644 index 000000000..370287851 --- /dev/null +++ b/companion/src/eepromimportexport.h @@ -0,0 +1,663 @@ +/* + * Author - Bertrand Songis + * + * Based on th9x -> http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef eeprom_importexport_h +#define eeprom_importexport_h + +#define DIM(arr) (sizeof((arr))/sizeof((arr)[0])) + +class DataField { + public: + DataField(const char *name=""): + name(name) + { + } + virtual const char *getName() { return name; } + virtual ~DataField() { } + virtual void ExportBits(QBitArray & output) = 0; + virtual void ImportBits(QBitArray & input) = 0; + virtual unsigned int size() = 0; + + QBitArray bytesToBits(QByteArray bytes) + { + QBitArray bits(bytes.count()*8); + // Convert from QByteArray to QBitArray + for (int i=0; i +class UnsignedField: public DataField { + public: + explicit UnsignedField(unsigned int & field): + DataField("Unsigned"), + field(field), + min(0), + max(UINT_MAX) + { + } + + UnsignedField(unsigned int & field, const char *name): + DataField(name), + field(field), + min(0), + max(UINT_MAX) + { + } + + UnsignedField(unsigned int & field, unsigned int min, unsigned int max, const char *name="Unsigned"): + DataField(name), + field(field), + min(min), + max(max) + { + } + + virtual void ExportBits(QBitArray & output) + { + unsigned int value = field; + if (value > max) value = max; + if (value < min) value = min; + + output.resize(N); + for (int i=0; i +class BoolField: public DataField { + public: + explicit BoolField(bool & field): + DataField("Bool"), + field(field) + { + } + + virtual void ExportBits(QBitArray & output) + { + output.resize(N); + if (field) { + output.setBit(0); + } + } + + virtual void ImportBits(QBitArray & input) + { + field = input[0] ? true : false; + } + + virtual unsigned int size() + { + return N; + } + + protected: + bool & field; + + private: + BoolField(); +}; + +template +class SignedField: public DataField { + public: + SignedField(int & field): + DataField("Signed"), + field(field), + min(INT_MIN), + max(INT_MAX) + { + } + + SignedField(int & field, const char *name): + DataField(name), + field(field), + min(INT_MIN), + max(INT_MAX) + { + } + + SignedField(int & field, int min, int max, const char *name="Signed"): + DataField(name), + field(field), + min(min), + max(max) + { + } + + virtual void ExportBits(QBitArray & output) + { + int value = field; + if (value > max) value = max; + if (value < min) value = min; + + output.resize(N); + for (int i=0; i +class SpareBitsField: public UnsignedField { + public: + SpareBitsField(): + UnsignedField(spare, 0, 0, "Spare"), + spare(0) + { + } + protected: + unsigned int spare; +}; + +template +class CharField: public DataField { + public: + CharField(char *field): + DataField("Char"), + field(field) + { + } + + virtual void ExportBits(QBitArray & output) + { + output.resize(N*8); + int b = 0; + int len = strlen(field); + for (int i=0; i=len ? 0 : field[i]); + for (int j=0; j<8; j++, b++) { + if (idx & (1< +class ZCharField: public DataField { + public: + ZCharField(char *field): + DataField("ZChar"), + field(field) + { + } + + virtual void ExportBits(QBitArray & output) + { + output.resize(N*8); + int b = 0; + int len = strlen(field); + for (int i=0; i=len ? 0 : char2idx(field[i]); + for (int j=0; j<8; j++, b++) { + if (idx & (1<=0; i--) { + if (field[i] == ' ') + field[i] = '\0'; + else + break; + } + } + + virtual unsigned int size() + { + return 8*N; + } + + protected: + char * field; +}; + +class StructField: public DataField { + public: + StructField(const char *name="Struct"): + DataField(name) + { + } + + ~StructField() { + foreach(DataField *field, fields) { + delete field; + } + } + + inline void Append(DataField *field) { + fields.append(field); + } + + virtual void ExportBits(QBitArray & output) + { + int offset = 0; + output.resize(size()); + foreach(DataField *field, fields) { + QBitArray bits; + field->ExportBits(bits); + for (int i=0; isize(); + QBitArray bits(size); + for (unsigned int i=0; iImportBits(bits); + } + } + + virtual unsigned int size() + { + unsigned int result = 0; + foreach(DataField *field, fields) { + result += field->size(); + } + return result; + } + + virtual int Dump(int level=0, int offset=0) + { + for (int i=0; iDump(level+1, offset); + } + return offset; + } + + protected: + QList fields; +}; + +class TransformedField: public DataField { + public: + TransformedField(DataField & field): + DataField(), + field(field) + { + } + + virtual ~TransformedField() + { + } + + virtual void ExportBits(QBitArray & output) + { + beforeExport(); + field.ExportBits(output); + } + + virtual void ImportBits(QBitArray & input) + { + field.ImportBits(input); + afterImport(); + } + + + virtual const char *getName() + { + return field.getName(); + } + + virtual unsigned int size() + { + return field.size(); + } + + virtual void beforeExport() = 0; + + virtual void afterImport() = 0; + + virtual int Dump(int level=0, int offset=0) + { + beforeExport(); + return field.Dump(level, offset); + } + + protected: + DataField & field; +}; + +class ConversionTable { + + public: + bool exportValue(const int before, int &after) + { + after = 0; + + for (std::list::iterator it=internalTable.begin(); it!=internalTable.end(); it++) { + ConversionTuple tuple = *it; + if (before == tuple.a) { + after = tuple.b; + return true; + } + } + + return false; + } + + bool importValue(const int before, int &after) + { + after = 0; + + for (std::list::iterator it=internalTable.begin(); it!=internalTable.end(); it++) { + ConversionTuple tuple = *it; + if (before == tuple.b) { + after = tuple.a; + return true; + } + } + + return false; + } + + protected: + + class ConversionTuple { + public: + ConversionTuple(const int a, const int b): + a(a), + b(b) + { + } + + int a; + int b; + }; + + void addConversion(const int a, const int b) + { + internalTable.push_back(ConversionTuple(a, b)); + } + + std::list internalTable; +}; + +template +class ConversionField: public TransformedField { + public: + ConversionField(int & field, ConversionTable *table, const char *name, const QString & error = ""): + TransformedField(internalField), + internalField(_field, name), + field(field), + _field(0), + table(table), + shift(0), + min(INT_MIN), + max(INT_MAX), + exportFunc(NULL), + importFunc(NULL), + error(error) + { + } + + ConversionField(unsigned int & field, ConversionTable *table, const char *name, const QString & error = ""): + TransformedField(internalField), + internalField((unsigned int &)_field, name), + field((int &)field), + _field(0), + table(table), + shift(0), + min(INT_MIN), + max(INT_MAX), + exportFunc(NULL), + importFunc(NULL), + error(error) + { + } + + ConversionField(int & field, int (*exportFunc)(int), int (*importFunc)(int)): + TransformedField(internalField), + internalField(_field), + field(field), + _field(0), + table(NULL), + shift(0), + min(INT_MIN), + max(INT_MAX), + exportFunc(exportFunc), + importFunc(importFunc), + error("") + { + } + + ConversionField(int & field, int shift, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"): + TransformedField(internalField), + internalField(_field, name), + field(field), + _field(0), + table(NULL), + shift(shift), + min(min), + max(max), + exportFunc(NULL), + importFunc(NULL), + error("") + { + } + + ConversionField(unsigned int & field, int shift): + TransformedField(internalField), + internalField((unsigned int &)_field), + field((int &)field), + _field(0), + table(NULL), + shift(shift), + min(INT_MIN), + max(INT_MAX), + exportFunc(NULL), + importFunc(NULL), + error("") + { + } + + virtual void beforeExport() + { + if (table) { + if (table->exportValue(field, _field)) + return; + if (!error.isEmpty()) + EEPROMWarnings += error + "\n"; + } + else if (shift) { + if (field < min) _field = min + shift; + else if (field > max) _field = max + shift; + else _field = field + shift; + } + else { + _field = exportFunc(field); + } + } + + virtual void afterImport() + { + if (table) { + if (table->importValue(_field, field)) + return; + } + else if (shift) { + field = _field - shift; + } + else { + field = importFunc(_field); + } + } + + protected: + T internalField; + int & field; + int _field; + ConversionTable * table; + int shift; + int min; + int max; + int (*exportFunc)(int); + int (*importFunc)(int); + const QString error; +}; + +#endif diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp new file mode 100644 index 000000000..497149ca2 --- /dev/null +++ b/companion/src/eeprominterface.cpp @@ -0,0 +1,766 @@ +#include +#include +#include "eeprominterface.h" +#include "firmwares/er9x/er9xinterface.h" +#include "firmwares/th9x/th9xinterface.h" +#include "firmwares/gruvin9x/gruvin9xinterface.h" +#include "firmwares/opentx/open9xinterface.h" +#include "firmwares/ersky9x/ersky9xinterface.h" +#include "qsettings.h" + +QString EEPROMWarnings; + +void setEEPROMString(char *dst, const char *src, int size) +{ + memcpy(dst, src, size); + for (int i=size-1; i>=0; i--) { + if (dst[i] == '\0') + dst[i] = ' '; + else + break; + } +} + +void getEEPROMString(char *dst, const char *src, int size) +{ + memcpy(dst, src, size); + dst[size] = '\0'; + for (int i=size-1; i>=0; i--) { + if (dst[i] == ' ') + dst[i] = '\0'; + else + break; + } +} + +int RawSource::getDecimals(const ModelData & Model) +{ + if(type==SOURCE_TYPE_TELEMETRY) { + switch (index) { + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0 ? 2: 0); + case TELEMETRY_SOURCE_CELL: + return 2; + case TELEMETRY_SOURCE_CELLS_SUM: + case TELEMETRY_SOURCE_VFAS: + case TELEMETRY_SOURCE_CURRENT: + return 1; + default: + return 0; + } + } + return 0; +} + +double RawSource::getMin(const ModelData & Model) +{ + switch (type) { + case SOURCE_TYPE_TELEMETRY: + switch (index) { + /*case TELEMETRY_SOURCE_NONE: + case TELEMETRY_SOURCE_TX_BATT: + case TELEMETRY_SOURCE_TIMER1: + case TELEMETRY_SOURCE_TIMER2: + return 0; */ + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/2550.0; + } + else { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0; + } + case TELEMETRY_SOURCE_ALT: + case TELEMETRY_SOURCE_GPS_ALT: + return -500; + case TELEMETRY_SOURCE_T1: + case TELEMETRY_SOURCE_T2: + return -30; + default: + return 0; + } + break; + default: + return (Model.extendedLimits ? -125 :-100); + } +} + +double RawSource::getMax(const ModelData & Model) +{ + switch (type) { + case SOURCE_TYPE_TELEMETRY: + switch (index) { + case TELEMETRY_SOURCE_TIMER1: + case TELEMETRY_SOURCE_TIMER2: + return 765; + case TELEMETRY_SOURCE_RSSI_TX: + case TELEMETRY_SOURCE_RSSI_RX: + return 100; + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio-(Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0)/10; + } else { + return Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio-(Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0; + } + case TELEMETRY_SOURCE_ALT: + case TELEMETRY_SOURCE_GPS_ALT: + return 1540; + case TELEMETRY_SOURCE_RPM: + return 12750; + case TELEMETRY_SOURCE_FUEL: + return 100; + case TELEMETRY_SOURCE_T1: + case TELEMETRY_SOURCE_T2: + return 225; + case TELEMETRY_SOURCE_SPEED: + return 944; + case TELEMETRY_SOURCE_DIST: + return 2040; + case TELEMETRY_SOURCE_CELL: + return 5.1; + case TELEMETRY_SOURCE_CELLS_SUM: + case TELEMETRY_SOURCE_VFAS: + return 25.5; + case TELEMETRY_SOURCE_CURRENT: + return 127.5; + case TELEMETRY_SOURCE_CONSUMPTION: + return 5100; + case TELEMETRY_SOURCE_POWER: + return 1275; + default: + return 125; + } + break; + default: + return (Model.extendedLimits ? 125 :100); + } +} + +double RawSource::getOffset(const ModelData & Model) +{ + if (type==SOURCE_TYPE_TELEMETRY) { + switch (index) { + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/2550.0; + } + else { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].offset*Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio)/255.0; + } + case TELEMETRY_SOURCE_ALT: + case TELEMETRY_SOURCE_GPS_ALT: + return 524; + case TELEMETRY_SOURCE_RPM: + return 6400; + case TELEMETRY_SOURCE_FUEL: + return 0; + case TELEMETRY_SOURCE_T1: + case TELEMETRY_SOURCE_T2: + return 98; + case TELEMETRY_SOURCE_SPEED: + return 474; + case TELEMETRY_SOURCE_DIST: + return 1024; + case TELEMETRY_SOURCE_CELL: + return 2.56; + default: + return 0; + } + } + return 0; +} + +int RawSource::getRawOffset(const ModelData & Model) +{ + switch (type) { + case SOURCE_TYPE_TELEMETRY: + switch (index) { + case TELEMETRY_SOURCE_TIMER1: + case TELEMETRY_SOURCE_TIMER2: + case TELEMETRY_SOURCE_RSSI_TX: + case TELEMETRY_SOURCE_RSSI_RX: + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + case TELEMETRY_SOURCE_FUEL: + case TELEMETRY_SOURCE_CELLS_SUM: + case TELEMETRY_SOURCE_VFAS: + case TELEMETRY_SOURCE_CURRENT: + case TELEMETRY_SOURCE_CONSUMPTION: + case TELEMETRY_SOURCE_POWER: + return 128; + default: + return 0; + } + default: + return 0; + } +} + +double RawSource::getStep(const ModelData & Model) +{ + switch (type) { + case SOURCE_TYPE_TELEMETRY: + switch (index) { + case TELEMETRY_SOURCE_TIMER1: + case TELEMETRY_SOURCE_TIMER2: + return 3; + case TELEMETRY_SOURCE_A1: + case TELEMETRY_SOURCE_A2: + if (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].type==0) { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio/2550.0); + } + else { + return (Model.frsky.channels[index-TELEMETRY_SOURCE_A1].ratio/255.0); + } + case TELEMETRY_SOURCE_ALT: + case TELEMETRY_SOURCE_GPS_ALT: + return 8; + case TELEMETRY_SOURCE_RPM: + return 50; + case TELEMETRY_SOURCE_SPEED: + return 4; + case TELEMETRY_SOURCE_DIST: + return 8; + case TELEMETRY_SOURCE_CELL: + return 0.02; + case TELEMETRY_SOURCE_CELLS_SUM: + case TELEMETRY_SOURCE_VFAS: + return 0.1; + case TELEMETRY_SOURCE_CURRENT: + return 0.5; + case TELEMETRY_SOURCE_CONSUMPTION: + return 20; + case TELEMETRY_SOURCE_POWER: + return 5; + default: + return 1; + } + break; + default: + return 1; + } +} + +QString RawSource::toString() +{ + static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") }; + + static const QString trims[] = { QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")}; + + static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") }; + + static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") }; + + static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") }; + + static const QString switches9X[] = { QObject::tr("3POS"), + QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"), + QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN"), + }; + + static const QString switchesX9D[] = { QObject::tr("SA"), QObject::tr("SB"), QObject::tr("SC"), QObject::tr("SD"), + QObject::tr("SE"), QObject::tr("SF"), QObject::tr("SG"), QObject::tr("SH"), + }; + + static const QString telemetry[] = { QObject::tr("Batt"), QObject::tr("Timer1"), QObject::tr("Timer2"), + (IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("SWR") : QObject::tr("Tx")), (IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("RSSI") : QObject::tr("Rx")), QObject::tr("A1"), QObject::tr("A2"), QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), + QObject::tr("T2"), QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"), QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"), + QObject::tr("Cnsp"), QObject::tr("Powr"), QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"), QObject::tr("HDG "), QObject::tr("VSpd"), QObject::tr("A1-"), + QObject::tr("A2-"), QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Spd+"), QObject::tr("Dst+"), + QObject::tr("Cur+"), QObject::tr("Pwr+"), QObject::tr("ACC "), QObject::tr("Time"), + }; + + static const QString virtualSwitches[] = { QObject::tr("CS1"), QObject::tr("CS2"), QObject::tr("CS3"), QObject::tr("CS4"), QObject::tr("CS5"), QObject::tr("CS6"), QObject::tr("CS7"), QObject::tr("CS8"), QObject::tr("CS9"), QObject::tr("CSA"), + QObject::tr("CSB"), QObject::tr("CSC"), QObject::tr("CSD"), QObject::tr("CSE"), QObject::tr("CSF"), QObject::tr("CSG"), QObject::tr("CSH"), QObject::tr("CSI"), QObject::tr("CSJ"), QObject::tr("CSK"), + QObject::tr("CSL"), QObject::tr("CSM"), QObject::tr("CSN"), QObject::tr("CSO"), QObject::tr("CSP"), QObject::tr("CSQ"), QObject::tr("CSR"), QObject::tr("CSS"), QObject::tr("CST"), QObject::tr("CSU"), + QObject::tr("CSV"), QObject::tr("CSW") + }; + + if (index<0) { + return QObject::tr("----"); + } + switch(type) { + case SOURCE_TYPE_STICK: + if (index < 4) + return CHECK_IN_ARRAY(sticks, index); + else + return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4)); + case SOURCE_TYPE_TRIM: + return CHECK_IN_ARRAY(trims, index); + case SOURCE_TYPE_ROTARY_ENCODER: + return CHECK_IN_ARRAY(rotary, index); + case SOURCE_TYPE_MAX: + return QObject::tr("MAX"); + case SOURCE_TYPE_SWITCH: + return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(switchesX9D, index) : CHECK_IN_ARRAY(switches9X, index)); + case SOURCE_TYPE_CUSTOM_SWITCH: + return virtualSwitches[index]; + case SOURCE_TYPE_CYC: + return QObject::tr("CYC%1").arg(index+1); + case SOURCE_TYPE_PPM: + return QObject::tr("PPM%1").arg(index+1); + case SOURCE_TYPE_CH: + if (index < GetEepromInterface()->getCapability(Outputs)) + return QObject::tr("CH%1%2").arg((index+1)/10).arg((index+1)%10); + else + return QObject::tr("X%1").arg(index-GetEepromInterface()->getCapability(Outputs)+1); + case SOURCE_TYPE_TELEMETRY: + return CHECK_IN_ARRAY(telemetry, index); + case SOURCE_TYPE_GVAR: + return QObject::tr("GV%1").arg(index+1); + default: + return QObject::tr("----"); + } +} + +QString SwitchUp(const char sw) +{ + const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x91, 0}; + return QString::fromUtf8(result); +} + +QString SwitchDn(const char sw) +{ + const char result[] = {'S', sw, (char)0xE2, (char)0x86, (char)0x93, 0}; + return QString::fromUtf8(result); +} + +QString RawSwitch::toString() +{ + static const QString switches9X[] = { QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"), + QObject::tr("ID0"), QObject::tr("ID1"), QObject::tr("ID2"), + QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN") + }; + + static const QString switchesX9D[] = { SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'), + SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'), + SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'), + SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'), + SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'), + SwitchUp('F'), SwitchDn('F'), + SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'), + SwitchUp('H'), SwitchDn('H'), + }; + + static const QString virtualSwitches[] = { QObject::tr("CS1"), QObject::tr("CS2"), QObject::tr("CS3"), QObject::tr("CS4"), QObject::tr("CS5"), QObject::tr("CS6"), QObject::tr("CS7"), QObject::tr("CS8"), QObject::tr("CS9"), QObject::tr("CSA"), + QObject::tr("CSB"), QObject::tr("CSC"), QObject::tr("CSD"), QObject::tr("CSE"), QObject::tr("CSF"), QObject::tr("CSG"), QObject::tr("CSH"), QObject::tr("CSI"), QObject::tr("CSJ"), QObject::tr("CSK"), + QObject::tr("CSL"), QObject::tr("CSM"), QObject::tr("CSN"), QObject::tr("CSO"), QObject::tr("CSP"), QObject::tr("CSQ"), QObject::tr("CSR"), QObject::tr("CSS"), QObject::tr("CST"), QObject::tr("CSU"), + QObject::tr("CSV"), QObject::tr("CSW") + }; + + switch(type) { + case SWITCH_TYPE_SWITCH: + if (IS_TARANIS(GetEepromInterface()->getBoard())) + return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1) : QString("!") + CHECK_IN_ARRAY(switchesX9D, -index-1); + else + return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1) : QString("!") + CHECK_IN_ARRAY(switches9X, -index-1); + case SWITCH_TYPE_VIRTUAL: + return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1) : QString("!") + CHECK_IN_ARRAY(virtualSwitches, -index-1); + case SWITCH_TYPE_ON: + return QObject::tr("ON"); + case SWITCH_TYPE_ONM: + if (index==0) { + return QObject::tr("ONE"); + } + else if (index==1) { + return QObject::tr("!ONE"); + } + break; + case SWITCH_TYPE_TRN: + if (index==0) { + if (IS_TARANIS(GetEepromInterface()->getBoard())) + return SwitchDn('H')+"s"; + else + return QObject::tr("TRNs"); + } else if (index==1) { + if (IS_TARANIS(GetEepromInterface()->getBoard())) + return SwitchDn('H')+"l"; + else + return QObject::tr("TRNl"); + } + break; + case SWITCH_TYPE_REA: + if (index==0) { + if (GetEepromInterface()->getBoard() == BOARD_SKY9X) + return QObject::tr("REAs"); + } else if (index==1) { + if (GetEepromInterface()->getBoard() == BOARD_SKY9X) + return QObject::tr("REAl"); + } + break; + case SWITCH_TYPE_OFF: + return QObject::tr("OFF"); + case SWITCH_TYPE_MOMENT_SWITCH: + if (IS_TARANIS(GetEepromInterface()->getBoard())) + return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switchesX9D, -index-1)+QString("t"); + else + return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switches9X, -index-1)+QString("t"); + case SWITCH_TYPE_MOMENT_VIRTUAL: + return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(virtualSwitches, -index-1)+QString("t"); + default: + break; + } + + return QObject::tr("----"); +} + +GeneralSettings::GeneralSettings() +{ + memset(this, 0, sizeof(GeneralSettings)); + contrast = 25; + vBatWarn = 90; + for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) { + calibMid[i] = 0x200; + calibSpanNeg[i] = 0x180; + calibSpanPos[i] = 0x180; + } + QSettings settings("companion9x", "companion9x"); + templateSetup = settings.value("default_channel_order", 0).toInt(); + stickMode = settings.value("default_mode", 1).toInt(); + int profile_id = settings.value("ActiveProfile", 0).toInt(); + if (profile_id>0) { + settings.beginGroup("Profiles"); + QString profile=QString("profile%1").arg(profile_id); + settings.beginGroup(profile); + QString t_calib=settings.value("StickPotCalib","").toString(); + int potsnum=GetEepromInterface()->getCapability(Pots); + if (t_calib.isEmpty()) { + settings.endGroup(); + settings.endGroup(); + return; + } else { + QString t_trainercalib=settings.value("TrainerCalib","").toString(); + int8_t t_vBatCalib=(int8_t)settings.value("VbatCalib", vBatCalib).toInt(); + int8_t t_currentCalib=(int8_t)settings.value("currentCalib", currentCalib).toInt(); + int8_t t_PPM_Multiplier=(int8_t)settings.value("PPM_Multiplier", PPM_Multiplier).toInt(); + uint8_t t_stickMode=(uint8_t)settings.value("GSStickMode", stickMode).toUInt(); + uint8_t t_vBatWarn=(uint8_t)settings.value("vBatWarn",vBatWarn).toUInt(); + QString t_DisplaySet=settings.value("Display","").toString(); + QString t_BeeperSet=settings.value("Beeper","").toString(); + QString t_HapticSet=settings.value("Haptic","").toString(); + QString t_SpeakerSet=settings.value("Speaker","").toString(); + QString t_CountrySet=settings.value("countryCode","").toString(); + settings.endGroup(); + settings.endGroup(); + + if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) { + QString Byte; + int16_t byte16; + bool ok; + for (int i=0; i<(NUM_STICKS+potsnum); i++) { + Byte=t_calib.mid(i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + calibMid[i]=byte16; + Byte=t_calib.mid(4+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + calibSpanNeg[i]=byte16; + Byte=t_calib.mid(8+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + calibSpanPos[i]=byte16; + } + for (int i=0; i<4; i++) { + Byte=t_trainercalib.mid(i*4,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + trainer.calib[i]=byte16; + } + currentCalib=t_currentCalib; + vBatCalib=t_vBatCalib; + vBatWarn=t_vBatWarn; + PPM_Multiplier=t_PPM_Multiplier; + stickMode = t_stickMode; + } + if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) { + uint8_t byte8u; + int8_t byte8; + bool ok; + byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16); + if (ok) + optrexDisplay=(byte8==1 ? true : false); + byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16); + if (ok) + contrast=byte8u; + byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16); + if (ok) + backlightBright=byte8u; + byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16); + if (ok) + beeperMode=(BeeperMode)byte8; + byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16); + if (ok) + beeperLength=byte8; + byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16); + if (ok) + hapticMode=(BeeperMode)byte8; + byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16); + if (ok) + hapticStrength=byte8u; + byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16); + if (ok) + hapticLength=byte8; + byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16); + if (ok) + speakerMode=byte8u; + byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16); + if (ok) + speakerPitch=byte8u; + byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16); + if (ok) + speakerVolume=byte8u; + if (t_CountrySet.length()==6) { + byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16); + if (ok) + countryCode=byte8u; + byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16); + if (ok) + imperial=byte8u; + QString chars=t_CountrySet.mid(4,2); + ttsLanguage[0]=chars[0].toAscii(); + ttsLanguage[1]=chars[1].toAscii(); + } + } + } + } +} + +ModelData::ModelData() +{ + clear(); +} + +void ModelData::clear() +{ + memset(this, 0, sizeof(ModelData)); + moduleData[0].channelsCount = 8; + moduleData[1].channelsStart = 0; + moduleData[1].channelsCount = 8; + moduleData[0].ppmDelay = 300; + moduleData[1].ppmDelay = 300; + moduleData[2].ppmDelay = 300; + int board=GetEepromInterface()->getBoard(); + if (IS_TARANIS(board)) { + moduleData[0].protocol=PXX_XJT_X16; + moduleData[1].protocol=OFF; + } else { + moduleData[0].protocol=PPM; + moduleData[1].protocol=OFF; + } + for (int i=0; igetCapability(CustomCurves); + for (int i=0; i=8) + curves[i].clear(9); + else + curves[i].clear(5); + } + + swashRingData.clear(); + frsky.clear(); +} + +bool ModelData::isempty() +{ + return !used; +} + +void ModelData::setDefault(uint8_t id) +{ + clear(); + used = true; + sprintf(name, "MODEL%02d", id+1); +} + +unsigned int ModelData::getTrimFlightPhase(uint8_t idx, int8_t phase) +{ + // if (phase == -1) phase = getFlightPhase(); + + for (uint8_t i=0; i= 126 && var <= 130) + var = phaseData[0].gvars[var-126]; + else if (var <= -126 && var >= -130) + var = - phaseData[0].gvars[-126-var]; +} + +ModelData ModelData::removeGlobalVars() +{ + ModelData result = *this; + + for (int i=0; i eepromInterfaces; +void RegisterEepromInterfaces() +{ + QSettings settings("companion9x", "companion9x"); + int rev4a = settings.value("rev4asupport",0).toInt(); + eepromInterfaces.push_back(new Open9xInterface(BOARD_STOCK)); + eepromInterfaces.push_back(new Open9xInterface(BOARD_M128)); + eepromInterfaces.push_back(new Open9xInterface(BOARD_GRUVIN9X)); + eepromInterfaces.push_back(new Open9xInterface(BOARD_SKY9X)); + eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS)); + if (rev4a) + eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS_REV4a)); + eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK)); + eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X)); + eepromInterfaces.push_back(new Ersky9xInterface()); + eepromInterfaces.push_back(new Th9xInterface()); + eepromInterfaces.push_back(new Er9xInterface()); +} + +QList firmwares; +FirmwareVariant default_firmware_variant; +FirmwareVariant current_firmware_variant; + +const char * ER9X_STAMP = "http://er9x.googlecode.com/svn/trunk/src/stamp-er9x.h"; +const char * ERSKY9X_STAMP = "http://ersky9x.googlecode.com/svn/trunk/src/stamp-ersky9x.h"; + +void RegisterFirmwares() +{ + firmwares.push_back(new FirmwareInfo("th9x", QObject::tr("th9x"), new Th9xInterface(), "http://th9x.googlecode.com/svn/trunk/%1.bin", "http://th9x.googlecode.com/svn/trunk/src/stamp-th9x.h")); + + firmwares.push_back(new FirmwareInfo("er9x", QObject::tr("er9x"), new Er9xInterface(), "http://er9x.googlecode.com/svn/trunk/%1.hex", ER9X_STAMP)); + FirmwareInfo * er9x = firmwares.last(); + + Option er9x_options[] = { { "noht", "", 0 }, { "frsky", "", 0 }, { "frsky-noht", "", 0 }, { "jeti", "", 0 }, { "ardupilot", "", 0 }, { "nmea", "", 0 }, { NULL } }; + er9x->addOptions(er9x_options); + er9x->addOption("noht"); + + RegisterOpen9xFirmwares(); +#ifndef __APPLE__ + firmwares.push_back(new FirmwareInfo("ersky9x", QObject::tr("ersky9x"), new Ersky9xInterface(), "http://ersky9x.googlecode.com/svn/trunk/ersky9x_rom.bin", ERSKY9X_STAMP)); +#endif + default_firmware_variant = GetFirmwareVariant("opentx-stock-heli-templates-en"); + + RegisterEepromInterfaces(); +} + +bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size) +{ + foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { + if (eepromInterface->load(radioData, eeprom, size)) + return true; + } + + return false; +} + +bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int size, int index) +{ + foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { + if (eepromInterface->loadBackup(radioData, eeprom, size, index)) + return true; + } + + return false; +} + + +bool LoadEepromXml(RadioData &radioData, QDomDocument &doc) +{ + foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { + if (eepromInterface->loadxml(radioData, doc)) + return true; + } + + return false; +} + + +FirmwareVariant GetFirmwareVariant(QString id) +{ + FirmwareVariant result; + + foreach(FirmwareInfo * firmware, firmwares) { + + if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) { + result.id = id; + result.firmware = firmware; + result.variant = firmware->getVariant(id); + return result; + } + } + + return default_firmware_variant; +} + +void FirmwareInfo::addOption(const char *option, QString tooltip, uint32_t variant) +{ + Option options[] = { { option, tooltip, variant }, { NULL } }; + addOptions(options); +} + +unsigned int FirmwareInfo::getVariant(const QString & variantId) +{ + unsigned int variant = variantBase; + QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts); + foreach(QString option, options) { + foreach(QList