From 6cd87dbd645fed849a828c476f543a98d0c61aa6 Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Tue, 2 Jan 2018 23:46:44 +0300 Subject: [PATCH 01/57] add first version mission planer --- _locales/en/messages.json | 24 ++ js/gui.js | 3 +- main.html | 9 +- main.js | 3 + package-lock.json | 411 ++++++++++++++++---------------- package.json | 2 +- src/css/tabs/mission_planer.css | 65 +++++ tabs/mission_control.html | 61 +++++ tabs/mission_control.js | 356 +++++++++++++++++++++++++++ 9 files changed, 721 insertions(+), 213 deletions(-) create mode 100644 src/css/tabs/mission_planer.css create mode 100644 tabs/mission_control.html create mode 100644 tabs/mission_control.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 68a4d78a..a8cf5434 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2319,5 +2319,29 @@ }, "downloadUpdatesBtn": { "message": "Download new app" + }, + "tabMissionControl": { + "message": "Mission Control" + }, + "loadMissionButton": { + "message": "Load mission" + }, + "saveMissionButton": { + "message": "Save mission" + }, + "editPointHead": { + "message": "Edit point" + }, + "editPointButtonSave": { + "message": "Save" + }, + "editPointButtonRemove": { + "message": "Remove" + }, + "removeAllPointButtonSave": { + "message": "Remove all points" + }, + "missionTotalInformationHead": { + "message": "Total information" } } diff --git a/js/gui.js b/js/gui.js index 3028577d..a1ce5d8b 100644 --- a/js/gui.js +++ b/js/gui.js @@ -38,7 +38,8 @@ var GUI_control = function () { 'setup', 'osd', 'profiles', - 'advanced_tuning' + 'advanced_tuning', + 'mission_control' ]; this.allowedTabs = this.defaultAllowedTabsWhenDisconnected; diff --git a/main.html b/main.html index f989e0c4..651e8cd5 100755 --- a/main.html +++ b/main.html @@ -1,9 +1,11 @@ - + + + @@ -14,7 +16,8 @@ @@ -185,6 +188,7 @@
  • +
  • @@ -199,7 +203,6 @@ title="Onboard Logging">
  • - diff --git a/main.js b/main.js index 8dcbb28c..6d2d6789 100644 --- a/main.js +++ b/main.js @@ -189,6 +189,9 @@ $(document).ready(function () { case 'gps': TABS.gps.initialize(content_ready); break; + case 'mission_control': + TABS.mission_control.initialize(content_ready); + break; case 'motors': TABS.motors.initialize(content_ready); break; diff --git a/package-lock.json b/package-lock.json index d5346a6a..979d93f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,26 +1,13 @@ { "name": "inav-configurator", - "version": "1.7.3", + "version": "1.8.1", "lockfileVersion": 1, "requires": true, "dependencies": { - "@mapbox/point-geometry": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", - "integrity": "sha1-ioP5M1x4YO/6Lu7KJUMyqgru2PI=" - }, - "@mapbox/vector-tile": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.0.tgz", - "integrity": "sha1-xJX5clJb78zvzYOPRf+jfvO3D+g=", - "requires": { - "@mapbox/point-geometry": "0.1.0" - } - }, "abbrev": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "accepts": { "version": "1.3.3", @@ -32,9 +19,9 @@ } }, "acorn": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.0.3.tgz", - "integrity": "sha1-xGDfCEkUY/AozLguqzcwvwEIez0=" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==" }, "after": { "version": "0.8.2", @@ -118,9 +105,9 @@ "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" }, "aproba": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", - "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, "archiver": { "version": "2.0.3", @@ -212,9 +199,9 @@ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, "arraybuffer.slice": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", - "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=" + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" }, "asn1": { "version": "0.2.3", @@ -234,6 +221,11 @@ "lodash": "4.17.4" } }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -250,9 +242,9 @@ "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, "babylon": { - "version": "7.0.0-beta.24", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.24.tgz", - "integrity": "sha512-k1yiJYz1Zt6/xfxx0OC7obTNOF5WktZ8P8z1y+7kwP4INOygqqgzolO5fse4jYIb3CzHyU7WNC38EjYa1wjEGQ==" + "version": "7.0.0-beta.19", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", + "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==" }, "backo2": { "version": "1.0.2", @@ -612,36 +604,44 @@ } }, "closure-util": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/closure-util/-/closure-util-1.22.0.tgz", - "integrity": "sha512-DX5IhSawO9838/fKNaH3Cx8jeeJGWORodHhTFkxCOVsr71OtXCfo/rtXsV24eq3iq31jdmgUQvlNIXEMHTlkWg==", + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/closure-util/-/closure-util-1.26.0.tgz", + "integrity": "sha512-zpWABEochWrY48soiEttuqJk/OSYscS9PcvKgHvKUefM29+R8rqx5Bp8KIZHR0Nsq1JrNgxg2VTmJ/IsqN5VOA==", "requires": { - "acorn": "5.0.3", - "async": "2.5.0", - "fs-extra": "3.0.1", + "acorn": "5.2.1", + "async": "2.6.0", + "fs-extra": "4.0.2", "gaze": "1.1.2", "get-down": "1.2.0", "glob": "7.1.2", "graceful-fs": "4.1.11", - "handlebars": "4.0.10", + "handlebars": "4.0.11", "lodash": "4.17.4", "minimatch": "3.0.4", "mkdirp": "0.5.1", "nomnom": "1.8.1", "npmlog": "4.1.2", - "rimraf": "2.6.1", - "send": "0.15.3", - "socket.io": "2.0.1", + "rimraf": "2.6.2", + "send": "0.16.1", + "socket.io": "2.0.4", "temp": "github:adam-lynch/node-temp#279c1350cb7e4f02515d91da9e35d39a40774016" }, "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + }, "fs-extra": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", - "integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", + "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", "requires": { "graceful-fs": "4.1.11", - "jsonfile": "3.0.1", + "jsonfile": "4.0.0", "universalify": "0.1.1" } }, @@ -664,12 +664,20 @@ } }, "jsonfile": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", - "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "requires": { "graceful-fs": "4.1.11" } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "requires": { + "glob": "7.1.2" + } } } }, @@ -1572,23 +1580,23 @@ } }, "engine.io": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.1.1.tgz", - "integrity": "sha1-CAUf+5UZB6MmfnLgvLPQ83fkZgs=", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.1.4.tgz", + "integrity": "sha1-PQIRtwpVLOhB/8fahiezAamkFi4=", "requires": { "accepts": "1.3.3", "base64id": "1.0.0", "cookie": "0.3.1", - "debug": "2.6.8", - "engine.io-parser": "2.1.1", + "debug": "2.6.9", + "engine.io-parser": "2.1.2", "uws": "0.14.5", - "ws": "2.3.1" + "ws": "3.3.3" }, "dependencies": { "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -1601,28 +1609,27 @@ } }, "engine.io-client": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.1.tgz", - "integrity": "sha1-QVqYUrrbFPoAj6PvHjFgjbZ2EyU=", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.1.4.tgz", + "integrity": "sha1-T88TcLRxY70s6b4nM5ckMDUNTqE=", "requires": { "component-emitter": "1.2.1", "component-inherit": "0.0.3", - "debug": "2.6.8", - "engine.io-parser": "2.1.1", + "debug": "2.6.9", + "engine.io-parser": "2.1.2", "has-cors": "1.1.0", "indexof": "0.0.1", - "parsejson": "0.0.3", "parseqs": "0.0.5", "parseuri": "0.0.5", - "ws": "2.3.1", - "xmlhttprequest-ssl": "1.5.3", + "ws": "3.3.3", + "xmlhttprequest-ssl": "1.5.4", "yeast": "0.1.2" }, "dependencies": { "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -1635,12 +1642,12 @@ } }, "engine.io-parser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.1.tgz", - "integrity": "sha1-4Ps/DgRi9/WLt3waUun1p+JuRmg=", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", + "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", "requires": { "after": "0.8.2", - "arraybuffer.slice": "0.0.6", + "arraybuffer.slice": "0.0.7", "base64-arraybuffer": "0.1.5", "blob": "0.0.4", "has-binary2": "1.0.2" @@ -1927,9 +1934,9 @@ } }, "fresh": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", - "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=" + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, "fs-exists-sync": { "version": "0.1.0", @@ -1958,7 +1965,7 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "requires": { - "aproba": "1.1.2", + "aproba": "1.2.0", "console-control-strings": "1.1.0", "has-unicode": "2.0.1", "object-assign": "4.1.1", @@ -2410,9 +2417,9 @@ } }, "handlebars": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", - "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "requires": { "async": "1.5.2", "optimist": "0.6.1", @@ -2880,17 +2887,17 @@ "optional": true }, "jsdoc": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.4.tgz", - "integrity": "sha512-VmTw0J+2L16IxAe0JSDSAcH0F+DbZxaj8wN1AjHtKMQU/hO0ciIl5ZE93XqrrFIbknobuqHKJCXZj6+Hk57MjA==", + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", + "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", "requires": { - "babylon": "7.0.0-beta.24", - "bluebird": "3.5.0", + "babylon": "7.0.0-beta.19", + "bluebird": "3.5.1", "catharsis": "0.8.9", "escape-string-regexp": "1.0.5", "js2xmlparser": "3.0.0", "klaw": "2.0.0", - "marked": "0.3.6", + "marked": "0.3.9", "mkdirp": "0.5.1", "requizzle": "0.2.1", "strip-json-comments": "2.0.1", @@ -2899,9 +2906,9 @@ }, "dependencies": { "bluebird": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", - "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=" + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" }, "klaw": { "version": "2.0.0", @@ -3187,7 +3194,7 @@ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz", "integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==", "requires": { - "vlq": "0.2.2" + "vlq": "0.2.3" } }, "make-dir": { @@ -3211,9 +3218,9 @@ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, "marked": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", - "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=" + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.9.tgz", + "integrity": "sha512-nW5u0dxpXxHfkHzzrveY45gCbi+R4PaO4WRZYqZNl+vB0hVGeqlFn0aOg1c8AKL63TrNFn9Bm2UP4AdiZ9TPLw==" }, "merge": { "version": "1.2.0", @@ -3254,9 +3261,9 @@ } }, "mime": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", - "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { "version": "1.30.0", @@ -3300,9 +3307,9 @@ } }, "minizlib": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.0.3.tgz", - "integrity": "sha1-1cGr93vhVGGZUuJTM27Mq5sqMvU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "requires": { "minipass": "2.2.1" } @@ -3414,7 +3421,7 @@ "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", "requires": { - "abbrev": "1.1.0" + "abbrev": "1.1.1" } }, "normalize-path": { @@ -3617,41 +3624,48 @@ } }, "openlayers": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/openlayers/-/openlayers-4.3.3.tgz", - "integrity": "sha512-hFOPwplmgjgCyIrnXoVixtZeZ4mog84xpI9PLoXWiyO7iGmIH3/XxhBPuSLuvrHg+/huoFzA0OckRLvr3T2DAg==", + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/openlayers/-/openlayers-4.6.4.tgz", + "integrity": "sha512-Oru7/xniirjech7H5zkMQSUj/JUymNveiE4vAwmyjAmcoNyO4zTRD/Pp7BPfxBPuAz45vDl78H1wEQD7RGWkGg==", "requires": { - "@mapbox/vector-tile": "1.3.0", - "async": "2.5.0", - "closure-util": "1.22.0", - "fs-extra": "4.0.1", - "jsdoc": "3.5.4", + "async": "2.6.0", + "closure-util": "1.26.0", + "fs-extra": "4.0.3", + "jsdoc": "3.5.5", "nomnom": "1.8.1", - "pbf": "3.0.5", + "pbf": "3.1.0", "pixelworks": "1.1.0", "rbush": "2.0.1", - "rollup": "0.47.6", - "rollup-plugin-cleanup": "1.0.1", - "rollup-plugin-commonjs": "8.2.1", + "rollup": "0.52.3", + "rollup-plugin-cleanup": "2.0.0", + "rollup-plugin-commonjs": "8.2.6", "rollup-plugin-node-resolve": "3.0.0", "temp": "github:adam-lynch/node-temp#279c1350cb7e4f02515d91da9e35d39a40774016", "walk": "2.3.9" }, "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "4.17.4" + } + }, "fs-extra": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.1.tgz", - "integrity": "sha1-f8DGyJV/mD9X8waiTlud3Y0N2IA=", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", "requires": { "graceful-fs": "4.1.11", - "jsonfile": "3.0.1", + "jsonfile": "4.0.0", "universalify": "0.1.1" } }, "jsonfile": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", - "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "requires": { "graceful-fs": "4.1.11" } @@ -3836,14 +3850,6 @@ "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" }, - "parsejson": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", - "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", - "requires": { - "better-assert": "1.0.2" - } - }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -3899,9 +3905,9 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=" }, "pbf": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.0.5.tgz", - "integrity": "sha1-JPD6LL6xblxWpZAbt+nCrAyAWb4=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz", + "integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==", "requires": { "ieee754": "1.1.8", "resolve-protobuf-schema": "2.0.0" @@ -4054,9 +4060,9 @@ "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" }, "quickselect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.0.0.tgz", - "integrity": "sha1-AmMIGPmq5OyrJvAQP5jQYcF8WPM=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.0.1.tgz", + "integrity": "sha512-Jt30UQSzTbxf6L2bFTMabHtGtYUzQcvOY0a+s5brm8tzndV/XWifBIH9v5QKtH5gGCZ5RRDwRhdhGMDVHAEGNQ==" }, "randomatic": { "version": "1.1.7", @@ -4105,7 +4111,7 @@ "resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.1.tgz", "integrity": "sha1-TPrKKMMGS8DudUMaG3mZDode76k=", "requires": { - "quickselect": "1.0.0" + "quickselect": "1.0.1" } }, "rc": { @@ -4308,14 +4314,14 @@ } }, "rollup": { - "version": "0.47.6", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.47.6.tgz", - "integrity": "sha512-bH3eWh7MzbiKTQcHQN7Ievqbs/yY7T+ZcJYboBYkp7BkRlAr2DXHPfiqlvlEH/M95giEBpinHEi/s9CVIgYT6w==" + "version": "0.52.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.52.3.tgz", + "integrity": "sha512-cw+vb9NqaTXlwJyb8G+Ve+uhhlVTcl1NKBkfANdeQqVcpZFilQgeNnAnNiu7MwfeXrqiKEGz+3R03a3zeFkmEQ==" }, "rollup-plugin-cleanup": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-1.0.1.tgz", - "integrity": "sha1-ygVsdP5uoheD+ZhRljsXPL6Ok1k=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-2.0.0.tgz", + "integrity": "sha1-hZdzGaO/VHUKnXX7kJx+UfWaLaQ=", "requires": { "acorn": "4.0.13", "magic-string": "0.22.4", @@ -4330,26 +4336,21 @@ } }, "rollup-plugin-commonjs": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.1.tgz", - "integrity": "sha512-ZTwAetmKimCsuWost/+n4FaOpMoczBRTx+kuQaZCIKXTx/R1wNBezuX5NS0vnPKM3hBoErdpAqmNyVSCi5XKbg==", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz", + "integrity": "sha512-qK0+uhktmnAgZkHkqFuajNmPw93fjrO7+CysDaxWE5jrUR9XSlSvuao5ZJP+XizxA8weakhgYYBtbVz9SGBpjA==", "requires": { - "acorn": "5.1.2", - "estree-walker": "0.5.0", + "acorn": "5.2.1", + "estree-walker": "0.5.1", "magic-string": "0.22.4", "resolve": "1.4.0", "rollup-pluginutils": "2.0.1" }, "dependencies": { - "acorn": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", - "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==" - }, "estree-walker": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.0.tgz", - "integrity": "sha512-/bEAy+yKAZQrEWUhGmS3H9XpGqSDBtRzX0I2PgMw9kA2n1jN22uV5B5p7MFdZdvWdXCRJztXAfx6ZeRfgkEETg==" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.1.tgz", + "integrity": "sha512-7HgCgz1axW7w5aOvgOQkoR1RMBkllygJrssU3BvymKQ95lxXYv6Pon17fBRDm9qhkvXZGijOULoSF9ShOk/ZLg==" } } }, @@ -4416,19 +4417,19 @@ } }, "send": { - "version": "0.15.3", - "resolved": "https://registry.npmjs.org/send/-/send-0.15.3.tgz", - "integrity": "sha1-UBP5+ZAj31DRvZiSwZ4979HVMwk=", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", + "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", "requires": { - "debug": "2.6.7", + "debug": "2.6.9", "depd": "1.1.1", "destroy": "1.0.4", "encodeurl": "1.0.1", "escape-html": "1.0.3", "etag": "1.8.1", - "fresh": "0.5.0", + "fresh": "0.5.2", "http-errors": "1.6.2", - "mime": "1.3.4", + "mime": "1.4.1", "ms": "2.0.0", "on-finished": "2.3.0", "range-parser": "1.2.0", @@ -4436,9 +4437,9 @@ }, "dependencies": { "debug": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.7.tgz", - "integrity": "sha1-krrR9tBbu2u6Isyoi80OyJTChh4=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -4548,22 +4549,21 @@ } }, "socket.io": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.0.1.tgz", - "integrity": "sha1-BkwSUXhGLkd6bfI9L9rRjdHFkU8=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.0.4.tgz", + "integrity": "sha1-waRZDO/4fs8TxyZS8Eb3FrKeYBQ=", "requires": { - "debug": "2.6.8", - "engine.io": "3.1.1", - "object-assign": "4.1.1", + "debug": "2.6.9", + "engine.io": "3.1.4", "socket.io-adapter": "1.1.1", - "socket.io-client": "2.0.1", + "socket.io-client": "2.0.4", "socket.io-parser": "3.1.2" }, "dependencies": { "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -4581,36 +4581,37 @@ "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" }, "socket.io-client": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.0.1.tgz", - "integrity": "sha1-HVL4x0Zgxou2aVlT+hGZcRVfrZM=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.0.4.tgz", + "integrity": "sha1-CRilUkBtxeVAs4Dc2Xr8SmQzL44=", "requires": { "backo2": "1.0.2", "base64-arraybuffer": "0.1.5", "component-bind": "1.0.0", "component-emitter": "1.2.1", - "debug": "2.6.4", - "engine.io-client": "3.1.1", + "debug": "2.6.9", + "engine.io-client": "3.1.4", "has-cors": "1.1.0", "indexof": "0.0.1", "object-component": "0.0.3", + "parseqs": "0.0.5", "parseuri": "0.0.5", "socket.io-parser": "3.1.2", "to-array": "0.1.4" }, "dependencies": { "debug": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.4.tgz", - "integrity": "sha1-dYaps8OXQcAoKuM0RcTorHRzT+A=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { - "ms": "0.7.3" + "ms": "2.0.0" } }, "ms": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.3.tgz", - "integrity": "sha1-cIFVpeROM/X9D8U+gdDUCpG+H/8=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -4620,15 +4621,15 @@ "integrity": "sha1-28IoIVH8T6675Aru3Ady66YZ9/I=", "requires": { "component-emitter": "1.2.1", - "debug": "2.6.8", + "debug": "2.6.9", "has-binary2": "1.0.2", "isarray": "2.0.1" }, "dependencies": { "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -4845,7 +4846,7 @@ "integrity": "sha512-TKJKz1fqBOZBaIQ/MGRKU0EnTGmKMLy4ReTRgP10AgtfOWBbj9PBg4MgY80GFpqGbs2EzcIctW5gbwbP4woDYg==", "requires": { "minipass": "2.2.1", - "minizlib": "1.0.3", + "minizlib": "1.1.0", "mkdirp": "0.5.1", "yallist": "3.0.2" }, @@ -4993,7 +4994,7 @@ "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", "requires": { - "abbrev": "1.1.0" + "abbrev": "1.1.1" } } } @@ -5099,9 +5100,9 @@ "optional": true }, "ultron": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.0.tgz", - "integrity": "sha1-sHoualQagV/Go0zNRTO67DB8qGQ=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, "unbzip2-stream": { "version": "1.2.5", @@ -5344,9 +5345,9 @@ } }, "vlq": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz", - "integrity": "sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE=" + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", + "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==" }, "walk": { "version": "2.3.9", @@ -5425,19 +5426,13 @@ } }, "ws": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-2.3.1.tgz", - "integrity": "sha1-a5Sz5EfLajY/eF6vlK9jWejoHIA=", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "requires": { - "safe-buffer": "5.0.1", - "ultron": "1.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", - "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=" - } + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1", + "ultron": "1.1.1" } }, "xdg-basedir": { @@ -5464,9 +5459,9 @@ "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" }, "xmlhttprequest-ssl": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz", - "integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=" + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.4.tgz", + "integrity": "sha1-BPVgkVcks4kIhxXMDteBPpZ3v1c=" }, "xtend": { "version": "4.0.1", diff --git a/package.json b/package.json index 2b5ae60f..ca6ef0c2 100755 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "jquery-ui-npm": "1.12.0", "nw": "^0.25.4-sdk", "nw-builder": "^3.4.1", - "openlayers": "^4.3.3", + "openlayers": "^4.6.4", "run-sequence": "^2.2.0", "temp": "^0.8.3", "three": "0.72.0" diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css new file mode 100644 index 00000000..132f2b3d --- /dev/null +++ b/src/css/tabs/mission_planer.css @@ -0,0 +1,65 @@ +.tab-calibration .content_toolbar { + height: 100px; +} + +.tab-mission-control .waypoint { + padding-left: 19px; + padding-right: 19px; + padding-bottom: 10px; +} +.tab-mission-control .waypoint-left { + width: 54%; + float: left; + padding-right: 5px; +} +.tab-mission-control .waypoint-right{ + width: 40%; + float: right; +} + +.tab-mission-control .content_wrapper { + height: calc(100% - 150px); +} + +.tab-mission-control .content_toolbar { + height: 150px; +} + +.tab-mission-control input { + width: 157px; + padding-left: 3px; + height: 20px; + line-height: 20px; + text-align: left; + border: 1px solid silver; + border-radius: 3px; + margin-left: 11px; + font-size: 12px; + font-weight: normal; +} + +.tab-mission-control .point { + display: inline-block; + margin-bottom: 5px; +} + +.tab-mission-control .point-label { + +} + +@media (max-width: 1236px) { + .tab-mission-control .waypoint-left { + width: 96%; + } + .tab-mission-control .waypoint-right{ + width: 96%; + float: left; + padding-right: 19px; + } + .tab-mission-control .content_toolbar { + height: 240px; + } + .tab-mission-control .content_wrapper { + height: calc(100% - 240px); + } +} \ No newline at end of file diff --git a/tabs/mission_control.html b/tabs/mission_control.html new file mode 100644 index 00000000..ea8f18ed --- /dev/null +++ b/tabs/mission_control.html @@ -0,0 +1,61 @@ +
    +
    +
    +
    +
    +
    +
    +
    +
    Edit point
    +
    +
    + +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    + Save +
    +
    + Remove +
    + +
    +
    +
    +
    +
    +
    +
    +
    Total information
    +
    +
    +
    + Distance (m): + +
    +
    + Available Points +
    + + +
    +
    +
    +
    +
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js new file mode 100644 index 00000000..d9c75eeb --- /dev/null +++ b/tabs/mission_control.js @@ -0,0 +1,356 @@ +'use strict'; + +TABS.mission_control = {}; +TABS.mission_control.isYmapLoad = false; +TABS.mission_control.initialize = function (callback) { + + if (GUI.active_tab != 'mission_control') { + GUI.active_tab = 'mission_control'; + googleAnalytics.sendAppView('Mission Control'); + } + + function load_html() { + $('#content').load("./tabs/mission_control.html", process_html); + } + + load_html(); + + function process_html() { + initMap(); + localize(); + + GUI.content_ready(callback); + } + + var markers = []; + var lines = []; + var map; + var selectedMarker; + + function clearEditForm() { + $('#pointLat').val(''); + $('#pointLon').val(''); + $('#pointAlt').val(''); + $('[name=pointNumber]').val('') + } + + function repaint() { + var oldPos; + for (var i in lines) { + map.removeLayer(lines[i]); + } + lines = []; + $('#missionDistance').text(0); + + map.getLayers().forEach(function (t) { + //feature.getGeometry().getType() + if (t instanceof ol.layer.Vector && typeof t.alt !== 'undefined') { + var geometry = t.getSource().getFeatures()[0].getGeometry(); + if (typeof oldPos !== 'undefined') { + paintLine(oldPos, geometry.getCoordinates()); + } + + oldPos = geometry.getCoordinates(); + } + }); + } + + function paintLine(pos1, pos2) { + var line = new ol.geom.LineString([pos1, pos2]); + + var feature = new ol.Feature({ + geometry: line + }); + feature.setStyle(new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: '#1497f1', + width: 3 + }) + })); + + var vectorSource = new ol.source.Vector({ + features: [feature] + }); + + var vectorLayer = new ol.layer.Vector({ + source: vectorSource + }); + + lines.push(vectorLayer); + + var length = ol.Sphere.getLength(line) + parseFloat($('#missionDistance').text()); + $('#missionDistance').text(length.toFixed(3)); + + map.addLayer(vectorLayer); + } + + function addMarker(pos) { + var iconFeature = new ol.Feature({ + geometry: new ol.geom.Point(pos), + name: 'Null Island', + population: 4000, + rainfall: 500 + }); + + var iconStyle = new ol.style.Style({ + image: new ol.style.Icon(({ + anchor: [0.5, 1], + opacity: 1, + scale: 0.5, + src: '../images/icons/cf_icon_position.png' + })) +// text: new ol.style.Text({ +// text: '10', +// offsetX: -1, +// offsetY: -30, +// overflow: true, +// scale: 2, +// fill: new ol.style.Fill({ +// color: 'black' +// }) +// }) + }); + + iconFeature.setStyle(iconStyle); + + var vectorSource = new ol.source.Vector({ + features: [iconFeature] + }); + + var vectorLayer = new ol.layer.Vector({ + source: vectorSource + }); + + vectorLayer.alt = 0; + vectorLayer.number = markers.length; + + markers.push(vectorLayer); + + return vectorLayer; + } + + function initMap() { + // var center = ol.proj.fromLonLat([e.data.lon, e.data.lat]); + // + // mapView.setCenter(center); + // iconGeometry.setCoordinates(center); + + var app = {}; + + /** + * @constructor + * @extends {ol.interaction.Pointer} + */ + app.Drag = function () { + + ol.interaction.Pointer.call(this, { + handleDownEvent: app.Drag.prototype.handleDownEvent, + handleDragEvent: app.Drag.prototype.handleDragEvent, + handleMoveEvent: app.Drag.prototype.handleMoveEvent, + handleUpEvent: app.Drag.prototype.handleUpEvent + }); + + /** + * @type {ol.Pixel} + * @private + */ + this.coordinate_ = null; + + /** + * @type {string|undefined} + * @private + */ + this.cursor_ = 'pointer'; + + /** + * @type {ol.Feature} + * @private + */ + this.feature_ = null; + + /** + * @type {string|undefined} + * @private + */ + this.previousCursor_ = undefined; + + }; + ol.inherits(app.Drag, ol.interaction.Pointer); + + + /** + * @param {ol.MapBrowserEvent} evt Map browser event. + * @return {boolean} `true` to start the drag sequence. + */ + app.Drag.prototype.handleDownEvent = function (evt) { + var map = evt.map; + + var feature = map.forEachFeatureAtPixel(evt.pixel, + function (feature, layer) { + return feature; + }); + + if (feature) { + this.coordinate_ = evt.coordinate; + this.feature_ = feature; + } + + return !!feature; + }; + + /** + * @param {ol.MapBrowserEvent} evt Map browser event. + */ + app.Drag.prototype.handleDragEvent = function (evt) { + var map = evt.map; + + var feature = map.forEachFeatureAtPixel(evt.pixel, + function (feature, layer) { + return feature; + }); + + var deltaX = evt.coordinate[0] - this.coordinate_[0]; + var deltaY = evt.coordinate[1] - this.coordinate_[1]; + + var geometry = /** @type {ol.geom.SimpleGeometry} */ + (this.feature_.getGeometry()); + geometry.translate(deltaX, deltaY); + + this.coordinate_[0] = evt.coordinate[0]; + this.coordinate_[1] = evt.coordinate[1]; + repaint(); + }; + + + /** + * @param {ol.MapBrowserEvent} evt Event. + */ + app.Drag.prototype.handleMoveEvent = function (evt) { + if (this.cursor_) { + var map = evt.map; + var feature = map.forEachFeatureAtPixel(evt.pixel, + function (feature, layer) { + return feature; + }); + var element = evt.map.getTargetElement(); + if (feature) { + if (element.style.cursor != this.cursor_) { + this.previousCursor_ = element.style.cursor; + element.style.cursor = this.cursor_; + } + } else if (this.previousCursor_ !== undefined) { + element.style.cursor = this.previousCursor_; + this.previousCursor_ = undefined; + } + } + }; + + + /** + * @param {ol.MapBrowserEvent} evt Map browser event. + * @return {boolean} `false` to stop the drag sequence. + */ + app.Drag.prototype.handleUpEvent = function (evt) { + this.coordinate_ = null; + this.feature_ = null; + return false; + }; + + var lat = GPS_DATA.lat / 10000000; + var lon = GPS_DATA.lon / 10000000; + + map = new ol.Map({ + interactions: ol.interaction.defaults().extend([new app.Drag()]), + layers: [ + new ol.layer.Tile({ + source: new ol.source.OSM() + }) + ], + target: document.getElementById('missionMap'), + view: new ol.View({ + center: ol.proj.fromLonLat([lon, lat]), + zoom: 10 + }) + }); + + map.on('click', function (evt) { + var selectedFeature = map.forEachFeatureAtPixel(evt.pixel, + function (feature, layer) { + return feature; + }); + selectedMarker = map.forEachFeatureAtPixel(evt.pixel, + function (feature, layer) { + return layer; + }); + if (selectedFeature) { + var geometry = selectedFeature.getGeometry(); + var coord = ol.proj.toLonLat(geometry.getCoordinates()); + + $('#pointLat').val(coord[0]); + $('#pointLon').val(coord[1]); + $('#pointAlt').val(selectedMarker.alt); + } else { + map.addLayer(addMarker(evt.coordinate)); + repaint(); + } + }); + + // change mouse cursor when over marker + $(map.getViewport()).on('mousemove', function (e) { + var pixel = map.getEventPixel(e.originalEvent); + var hit = map.forEachFeatureAtPixel(pixel, function (feature, layer) { + return true; + }); + if (hit) { + map.getTarget().style.cursor = 'pointer'; + } else { + map.getTarget().style.cursor = ''; + } + }); + + $('#removeAllPoints').on('click', function () { + for (var i in markers) { + map.removeLayer(markers[i]); + } + markers = []; + clearEditForm(); + repaint(); + }); + + $('#removePoint').on('click', function () { + if (selectedMarker) { + map.removeLayer(selectedMarker); + var tmp = []; + for (var i in markers) { + if (markers[i] !== selectedMarker) { + tmp.push(markers[i]); + } + } + markers = tmp; + selectedMarker = null; + clearEditForm(); + repaint(); + } + }); + + $('#savePoint').on('click', function () { + if (selectedMarker) { + map.getLayers().forEach(function (t) { + if (t === selectedMarker) { + var geometry = t.getSource().getFeatures()[0].getGeometry(); + geometry.setCoordinates(ol.proj.fromLonLat([parseFloat($('#pointLat').val()), parseFloat($('#pointLon').val())])); + t.alt = $('#pointAlt').val(); + } + }); + + selectedMarker = null; + clearEditForm(); + repaint(); + } + }); + } +}; + +TABS.mission_control.cleanup = function (callback) { + if (callback) callback(); +}; \ No newline at end of file From 59b303cb8a0d58c8e5e43ccd3f4f764768315d9c Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Wed, 3 Jan 2018 00:00:27 +0300 Subject: [PATCH 02/57] check Standalone app --- _locales/en/messages.json | 3 +++ tabs/mission_control.html | 1 + tabs/mission_control.js | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index a8cf5434..29b8a85b 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2343,5 +2343,8 @@ }, "missionTotalInformationHead": { "message": "Total information" + }, + "useOnlyStandalone": { + "message": "Use stand-alone application.
    Please visit the website to read the release notes and download." } } diff --git a/tabs/mission_control.html b/tabs/mission_control.html index ea8f18ed..429dc4fa 100644 --- a/tabs/mission_control.html +++ b/tabs/mission_control.html @@ -1,6 +1,7 @@
    +
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index d9c75eeb..f131bfcf 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -16,7 +16,12 @@ TABS.mission_control.initialize = function (callback) { load_html(); function process_html() { - initMap(); + if (typeof require !== "undefined") { + initMap(); + } else { + $('#missionMap').hide(); + $('#notLoadMap').show(); + } localize(); GUI.content_ready(callback); From 0b7598dabdfdbe83d0985f4c01a013319bfb0e69 Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Fri, 5 Jan 2018 20:05:10 +0300 Subject: [PATCH 03/57] save and load points --- js/fc.js | 15 ++++++ js/msp/MSPCodes.js | 3 +- js/msp/MSPHelper.js | 53 ++++++++++++++++++- main.css | 11 ++++ src/css/tabs/mission_planer.css | 13 ++++- tabs/mission_control.html | 24 ++++++--- tabs/mission_control.js | 90 ++++++++++++++++++++++++++++++--- 7 files changed, 193 insertions(+), 16 deletions(-) diff --git a/js/fc.js b/js/fc.js index 987d624b..b5025a3f 100644 --- a/js/fc.js +++ b/js/fc.js @@ -23,6 +23,7 @@ var CONFIG, MOTOR_DATA, SERVO_DATA, GPS_DATA, + MISSION_PLANER, ANALOG, ARMING_CONFIG, FC_CONFIG, @@ -196,6 +197,20 @@ var FC = { packetCount: 0 }; + MISSION_PLANER = { + maxWaypoints: 0, + isValidMission: 0, + countBusyPoints: 0, + bufferPoint: { + number: 0, + action: 0, + lat: 0, + lon: 0, + alt: 0, + endMission: 0 + } + }; + ANALOG = { voltage: 0, mAhdrawn: 0, diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index a09228d3..8985f03d 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -17,7 +17,8 @@ var MSPCodes = { MSP_POSITION_ESTIMATION_CONFIG: 16, MSP_SET_POSITION_ESTIMATION_CONFIG: 17, - + MSP_WP_MISSION_SAVE: 19, + MSP_WP_GETINFO: 20, MSP_RTH_AND_LAND_CONFIG: 21, MSP_SET_RTH_AND_LAND_CONFIG: 22, MSP_FW_CONFIG: 23, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 9a91bfc5..4f787a2f 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1106,6 +1106,12 @@ var mspHelper = (function (gui) { case MSPCodes.MSPV2_SET_SETTING: console.log("Setting set"); break; + case MSPCodes.MSP_WP_GETINFO: + // Reserved for waypoint capabilities data.getUint8(0); + MISSION_PLANER.maxWaypoints = data.getUint8(1); + MISSION_PLANER.isValidMission = data.getUint8(2); + MISSION_PLANER.countBusyPoints = data.getUint8(3); + break; default: console.log('Unknown code detected: ' + dataHandler.code); } else { @@ -1285,7 +1291,7 @@ var mspHelper = (function (gui) { buffer.push(highByte(FAILSAFE_CONFIG.failsafe_fw_yaw_rate)); buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_stick_motion_threshold)); buffer.push(highByte(FAILSAFE_CONFIG.failsafe_stick_motion_threshold)); - } + } if (semver.gte(CONFIG.flightControllerVersion, "1.7.4")) { buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_min_distance)); buffer.push(highByte(FAILSAFE_CONFIG.failsafe_min_distance)); @@ -1586,6 +1592,43 @@ var mspHelper = (function (gui) { buffer.push(SENSOR_CONFIG.opflow); break; + case MSPCodes.MSP_SET_WP: + console.log(MISSION_PLANER.bufferPoint.number); + console.log(MISSION_PLANER.bufferPoint.action); + console.log(MISSION_PLANER.bufferPoint.lat); + console.log(MISSION_PLANER.bufferPoint.lon); + console.log(MISSION_PLANER.bufferPoint.alt); + console.log(MISSION_PLANER.bufferPoint.endMission); + console.log('---'); + + + buffer.push(MISSION_PLANER.bufferPoint.number); // sbufReadU8(src); // number + buffer.push(MISSION_PLANER.bufferPoint.action); // sbufReadU8(src); // action + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 0)); // sbufReadU32(src); // lat + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 1)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 2)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 3)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 0)); // sbufReadU32(src); // lon + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 1)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 2)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 3)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 0)); // sbufReadU32(src); // to set altitude (cm) + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 1)); // sbufReadU32(src); // to set altitude (cm) + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 2)); // sbufReadU32(src); // to set altitude (cm) + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 3)); // sbufReadU32(src); // to set altitude (cm) + buffer.push(0); //sbufReadU16(src); // P1 + buffer.push(0); //sbufReadU16(src); // P2 + buffer.push(0); //sbufReadU16(src); // P3 + buffer.push(MISSION_PLANER.bufferPoint.endMission); //sbufReadU8(src); // future: to set nav flag + break; + case MSPCodes.MSP_WP: + buffer.push(MISSION_PLANER.bufferPoint.number); + + break; + case MSPCodes.MSP_WP_MISSION_SAVE: + buffer.push(0); + + break; default: return false; } @@ -2329,6 +2372,14 @@ var mspHelper = (function (gui) { } }; + self.getMissionInfo = function (callback) { + if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) { + MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback); + } else { + callback(); + } + }; + self._getSetting = function(name) { var promise; if (this._settings) { diff --git a/main.css b/main.css index 3dfbb971..a4dd81bb 100644 --- a/main.css +++ b/main.css @@ -1107,6 +1107,17 @@ dialog { opacity: 0.5; } +.content_toolbar .btn-danger a { + background-color: #db250e; + border: 1px solid #b5480e; +} + +.content_toolbar .btn-danger a:hover { + background-color: #b5480e; + transition: all ease 0.2s; +} + + .toolbar_scroll_bottom .content_wrapper { /* content wrapper in view with toolbar in scroll bottom leave 50px space for the toolbar diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css index 132f2b3d..a652873d 100644 --- a/src/css/tabs/mission_planer.css +++ b/src/css/tabs/mission_planer.css @@ -5,7 +5,7 @@ .tab-mission-control .waypoint { padding-left: 19px; padding-right: 19px; - padding-bottom: 10px; + /*padding-bottom: 10px;*/ } .tab-mission-control .waypoint-left { width: 54%; @@ -21,6 +21,17 @@ height: calc(100% - 150px); } +.tab-mission-control .checksfail { + /*float: right;*/ + margin-top: 3px; + height: 15px; + width: 15px; + background-image:url(../../../images/icons/nopass.svg); + background-size:contain; + background-position:center; + background-repeat:no-repeat; +} + .tab-mission-control .content_toolbar { height: 150px; } diff --git a/tabs/mission_control.html b/tabs/mission_control.html index 429dc4fa..e2145952 100644 --- a/tabs/mission_control.html +++ b/tabs/mission_control.html @@ -11,13 +11,20 @@
    +
    + +
    - +
    - +
    @@ -27,10 +34,10 @@ -
    + - @@ -49,11 +56,16 @@
    Available Points + 0/0 +
    +
    + Mission valid +
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index f131bfcf..f1a9a4d1 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -9,11 +9,22 @@ TABS.mission_control.initialize = function (callback) { googleAnalytics.sendAppView('Mission Control'); } - function load_html() { - $('#content').load("./tabs/mission_control.html", process_html); + var loadChainer = new MSPChainerClass(); + loadChainer.setChain([ + mspHelper.getMissionInfo + ]); + loadChainer.setExitPoint(loadHtml); + loadChainer.execute(); + + function updateTotalInfo() { + console.log(MISSION_PLANER.isValidMission); + $('#availablePoints').text(MISSION_PLANER.countBusyPoints + '/' + MISSION_PLANER.maxWaypoints); + $('#missionValid').html(MISSION_PLANER.isValidMission ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail')); } - load_html(); + function loadHtml() { + $('#content').load("./tabs/mission_control.html", process_html); + } function process_html() { if (typeof require !== "undefined") { @@ -31,6 +42,7 @@ TABS.mission_control.initialize = function (callback) { var lines = []; var map; var selectedMarker; + var pointForSend = 0; function clearEditForm() { $('#pointLat').val(''); @@ -89,9 +101,9 @@ TABS.mission_control.initialize = function (callback) { map.addLayer(vectorLayer); } - function addMarker(pos) { + function addMarker(_pos, _alt) { var iconFeature = new ol.Feature({ - geometry: new ol.geom.Point(pos), + geometry: new ol.geom.Point(_pos), name: 'Null Island', population: 4000, rainfall: 500 @@ -126,7 +138,7 @@ TABS.mission_control.initialize = function (callback) { source: vectorSource }); - vectorLayer.alt = 0; + vectorLayer.alt = _alt; vectorLayer.number = markers.length; markers.push(vectorLayer); @@ -295,7 +307,7 @@ TABS.mission_control.initialize = function (callback) { $('#pointLon').val(coord[1]); $('#pointAlt').val(selectedMarker.alt); } else { - map.addLayer(addMarker(evt.coordinate)); + map.addLayer(addMarker(evt.coordinate, 0)); repaint(); } }); @@ -353,6 +365,70 @@ TABS.mission_control.initialize = function (callback) { repaint(); } }); + + $('#loadMissionButton').on('click', function () { + $(this).addClass('disabled'); + console.log('Start get point'); + GUI.log('Start get point'); + + pointForSend = 0; + getNextPoint(); + }); + + $('#saveMissionButton').on('click', function () { + $(this).addClass('disabled'); + GUI.log('Start send point'); + + pointForSend = 0; + sendNextPoint(); + }); + + updateTotalInfo(); + } + + function getNextPoint() { + if (pointForSend > 0 ) { + addMarker(ol.proj.fromLonLat(MISSION_PLANER.bufferPoint.lon,MISSION_PLANER.bufferPoint.lat), MISSION_PLANER.bufferPoint.alt); + } + + if (pointForSend >= MISSION_PLANER.countBusyPoints) { + GUI.log('End get point'); + $('#loadMissionButton').removeClass('disabled'); + return; + } + + MISSION_PLANER.bufferPoint.number = pointForSend; + + pointForSend++; + + MSP.send_message(MSPCodes.MSP_WP, mspHelper.crunch(MSPCodes.MSP_WP), false, getNextPoint); + } + + function sendNextPoint() { + if (pointForSend >= markers.length) { + GUI.log('End send point'); + + GUI.log(chrome.i18n.getMessage('eeprom_saved_ok')); + MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, false, false); + + $('#saveMissionButton').removeClass('disabled'); + return; + } + + var geometry = markers[pointForSend].getSource().getFeatures()[0].getGeometry(); + + MISSION_PLANER.bufferPoint.number = pointForSend; + MISSION_PLANER.bufferPoint.action = 1; + MISSION_PLANER.bufferPoint.lat = geometry.getCoordinates()[0] * 10000000; + MISSION_PLANER.bufferPoint.lon = geometry.getCoordinates()[1] * 10000000; + MISSION_PLANER.bufferPoint.alt = markers[pointForSend].alt; + + pointForSend++; + if (pointForSend >= markers.length) { + MISSION_PLANER.bufferPoint.endMission = 0xA5; + } + + MSP.send_message(MSPCodes.MSP_SET_WP, false, false, sendNextPoint); } }; From 8dee7a6340f2bc9e647ac5c32a9b1fb84a826d4b Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Sun, 7 Jan 2018 18:14:05 +0300 Subject: [PATCH 04/57] fix save point --- js/msp/MSPHelper.js | 24 +++++++++++------------- tabs/mission_control.js | 10 +++++++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 4f787a2f..8661c1c2 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1112,6 +1112,9 @@ var mspHelper = (function (gui) { MISSION_PLANER.isValidMission = data.getUint8(2); MISSION_PLANER.countBusyPoints = data.getUint8(3); break; + case MSPCodes.MSP_SET_WP: + console.log('Point saved'); + break; default: console.log('Unknown code detected: ' + dataHandler.code); } else { @@ -1593,15 +1596,6 @@ var mspHelper = (function (gui) { break; case MSPCodes.MSP_SET_WP: - console.log(MISSION_PLANER.bufferPoint.number); - console.log(MISSION_PLANER.bufferPoint.action); - console.log(MISSION_PLANER.bufferPoint.lat); - console.log(MISSION_PLANER.bufferPoint.lon); - console.log(MISSION_PLANER.bufferPoint.alt); - console.log(MISSION_PLANER.bufferPoint.endMission); - console.log('---'); - - buffer.push(MISSION_PLANER.bufferPoint.number); // sbufReadU8(src); // number buffer.push(MISSION_PLANER.bufferPoint.action); // sbufReadU8(src); // action buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 0)); // sbufReadU32(src); // lat @@ -1616,17 +1610,21 @@ var mspHelper = (function (gui) { buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 1)); // sbufReadU32(src); // to set altitude (cm) buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 2)); // sbufReadU32(src); // to set altitude (cm) buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 3)); // sbufReadU32(src); // to set altitude (cm) - buffer.push(0); //sbufReadU16(src); // P1 - buffer.push(0); //sbufReadU16(src); // P2 - buffer.push(0); //sbufReadU16(src); // P3 + buffer.push(lowByte(0)); //sbufReadU16(src); // P1 + buffer.push(highByte(0)); + buffer.push(lowByte(0)); //sbufReadU16(src); // P2 + buffer.push(highByte(0)); + buffer.push(lowByte(0)); //sbufReadU16(src); // P3 + buffer.push(highByte(0)); buffer.push(MISSION_PLANER.bufferPoint.endMission); //sbufReadU8(src); // future: to set nav flag break; case MSPCodes.MSP_WP: + console.log(MISSION_PLANER.bufferPoint.number); buffer.push(MISSION_PLANER.bufferPoint.number); break; case MSPCodes.MSP_WP_MISSION_SAVE: - buffer.push(0); + // buffer.push(0); break; default: diff --git a/tabs/mission_control.js b/tabs/mission_control.js index f1a9a4d1..203be86e 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -411,6 +411,8 @@ TABS.mission_control.initialize = function (callback) { GUI.log(chrome.i18n.getMessage('eeprom_saved_ok')); MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, false, false); + MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, updateTotalInfo); + $('#saveMissionButton').removeClass('disabled'); return; } @@ -419,16 +421,18 @@ TABS.mission_control.initialize = function (callback) { MISSION_PLANER.bufferPoint.number = pointForSend; MISSION_PLANER.bufferPoint.action = 1; - MISSION_PLANER.bufferPoint.lat = geometry.getCoordinates()[0] * 10000000; - MISSION_PLANER.bufferPoint.lon = geometry.getCoordinates()[1] * 10000000; + MISSION_PLANER.bufferPoint.lat = parseInt(geometry.getCoordinates()[0] * 10000000); + MISSION_PLANER.bufferPoint.lon = parseInt(geometry.getCoordinates()[1] * 10000000); MISSION_PLANER.bufferPoint.alt = markers[pointForSend].alt; pointForSend++; if (pointForSend >= markers.length) { MISSION_PLANER.bufferPoint.endMission = 0xA5; + } else { + MISSION_PLANER.bufferPoint.endMission = 0; } - MSP.send_message(MSPCodes.MSP_SET_WP, false, false, sendNextPoint); + MSP.send_message(MSPCodes.MSP_SET_WP, mspHelper.crunch(MSPCodes.MSP_SET_WP), false, sendNextPoint); } }; From efda79569885d84ccfe93981d6ac9229fb52285d Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Sun, 7 Jan 2018 20:49:58 +0300 Subject: [PATCH 05/57] fix load point --- _locales/en/messages.json | 6 ++++ js/msp/MSPHelper.js | 73 +++++++++++++++++++++------------------ tabs/mission_control.html | 6 ++-- tabs/mission_control.js | 29 +++++++++++----- 4 files changed, 70 insertions(+), 44 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 29b8a85b..10be9bba 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2329,6 +2329,12 @@ "saveMissionButton": { "message": "Save mission" }, + "loadEepromMissionButton": { + "message": "Load Eeprom mission" + }, + "saveEepromMissionButton": { + "message": "Save Eeprom mission" + }, "editPointHead": { "message": "Edit point" }, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 8661c1c2..3ed04df5 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -42,7 +42,7 @@ var mspHelper = (function (gui) { 'BLACKBOX': 7, 'TELEMETRY_MAVLINK': 8, 'TELEMETRY_IBUS': 9, - 'RUNCAM_DEVICE_CONTROL' : 10, + 'RUNCAM_DEVICE_CONTROL': 10, 'TBS_SMARTAUDIO': 11, 'IRC_TRAMP': 12 }; @@ -132,14 +132,14 @@ var mspHelper = (function (gui) { case MSPCodes.MSP_SENSOR_STATUS: SENSOR_STATUS.isHardwareHealthy = data.getUint8(0); - SENSOR_STATUS.gyroHwStatus = data.getUint8(1); - SENSOR_STATUS.accHwStatus = data.getUint8(2); - SENSOR_STATUS.magHwStatus = data.getUint8(3); - SENSOR_STATUS.baroHwStatus = data.getUint8(4); - SENSOR_STATUS.gpsHwStatus = data.getUint8(5); - SENSOR_STATUS.rangeHwStatus = data.getUint8(6); - SENSOR_STATUS.speedHwStatus = data.getUint8(7); - SENSOR_STATUS.flowHwStatus = data.getUint8(8); + SENSOR_STATUS.gyroHwStatus = data.getUint8(1); + SENSOR_STATUS.accHwStatus = data.getUint8(2); + SENSOR_STATUS.magHwStatus = data.getUint8(3); + SENSOR_STATUS.baroHwStatus = data.getUint8(4); + SENSOR_STATUS.gpsHwStatus = data.getUint8(5); + SENSOR_STATUS.rangeHwStatus = data.getUint8(6); + SENSOR_STATUS.speedHwStatus = data.getUint8(7); + SENSOR_STATUS.flowHwStatus = data.getUint8(8); if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) { sensor_status_ex(SENSOR_STATUS); } @@ -339,7 +339,12 @@ var mspHelper = (function (gui) { } break; case MSPCodes.MSP_WP: - console.log(data); + MISSION_PLANER.bufferPoint.number = data.getUint8(0); + MISSION_PLANER.bufferPoint.action = data.getUint8(1); + MISSION_PLANER.bufferPoint.lon = data.getInt32(2, true) / 10000000; + MISSION_PLANER.bufferPoint.lat = data.getInt32(6, true) / 10000000; + MISSION_PLANER.bufferPoint.alt = data.getInt32(10, true); + break; case MSPCodes.MSP_BOXIDS: //noinspection JSUndeclaredVariable @@ -1596,6 +1601,8 @@ var mspHelper = (function (gui) { break; case MSPCodes.MSP_SET_WP: + console.log(MISSION_PLANER.bufferPoint.lat); + console.log(MISSION_PLANER.bufferPoint.lon); buffer.push(MISSION_PLANER.bufferPoint.number); // sbufReadU8(src); // number buffer.push(MISSION_PLANER.bufferPoint.action); // sbufReadU8(src); // action buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 0)); // sbufReadU32(src); // lat @@ -1607,9 +1614,9 @@ var mspHelper = (function (gui) { buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 2)); buffer.push(specificByte(MISSION_PLANER.bufferPoint.lon, 3)); buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 0)); // sbufReadU32(src); // to set altitude (cm) - buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 1)); // sbufReadU32(src); // to set altitude (cm) - buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 2)); // sbufReadU32(src); // to set altitude (cm) - buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 3)); // sbufReadU32(src); // to set altitude (cm) + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 1)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 2)); + buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 3)); buffer.push(lowByte(0)); //sbufReadU16(src); // P1 buffer.push(highByte(0)); buffer.push(lowByte(0)); //sbufReadU16(src); // P2 @@ -1652,9 +1659,9 @@ var mspHelper = (function (gui) { self.sendBlackboxConfiguration = function (onDataCallback) { var message = [ - BLACKBOX.blackboxDevice & 0xFF, - BLACKBOX.blackboxRateNum & 0xFF, - BLACKBOX.blackboxRateDenom & 0xFF + BLACKBOX.blackboxDevice & 0xFF, + BLACKBOX.blackboxRateNum & 0xFF, + BLACKBOX.blackboxRateDenom & 0xFF ]; //noinspection JSUnusedLocalSymbols @@ -2082,7 +2089,7 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_IDENT, false, false, callback); }; - self.loadINAVPidConfig = function(callback) { + self.loadINAVPidConfig = function (callback) { if (semver.gt(CONFIG.flightControllerVersion, "1.3.0")) { MSP.send_message(MSPCodes.MSP_INAV_PID, false, false, callback); } else { @@ -2094,7 +2101,7 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_LOOP_TIME, false, false, callback); }; - self.loadAdvancedConfig = function(callback) { + self.loadAdvancedConfig = function (callback) { if (semver.gte(CONFIG.flightControllerVersion, "1.3.0")) { MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, callback); } else { @@ -2275,7 +2282,7 @@ var mspHelper = (function (gui) { }; self.saveRxConfig = function (callback) { - if(semver.gte(CONFIG.apiVersion, "1.21.0")) { + if (semver.gte(CONFIG.apiVersion, "1.21.0")) { MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, callback); } else { callback(); @@ -2283,7 +2290,7 @@ var mspHelper = (function (gui) { }; self.saveSensorConfig = function (callback) { - if(semver.gte(CONFIG.flightControllerVersion, "1.5.0")) { + if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) { MSP.send_message(MSPCodes.MSP_SET_SENSOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_SENSOR_CONFIG), false, callback); } else { callback(); @@ -2378,20 +2385,20 @@ var mspHelper = (function (gui) { } }; - self._getSetting = function(name) { + self._getSetting = function (name) { var promise; if (this._settings) { promise = Promise.resolve(this._settings); } else { - promise = new Promise(function(resolve, reject) { + promise = new Promise(function (resolve, reject) { var $this = this; $.ajax({ url: chrome.runtime.getURL('/resources/settings.json'), dataType: 'json', - error: function(jqXHR, text, error) { + error: function (jqXHR, text, error) { reject(error); }, - success: function(data) { + success: function (data) { $this._settings = data; resolve(data); } @@ -2403,19 +2410,19 @@ var mspHelper = (function (gui) { }); }; - self._encodeSettingName = function(name, data) { + self._encodeSettingName = function (name, data) { for (var ii = 0; ii < name.length; ii++) { data.push(name.charCodeAt(ii)); } data.push(0); }; - self.getSetting = function(name, callback) { + self.getSetting = function (name, callback) { var $this = this; return this._getSetting(name).then(function (setting) { - var data = []; + var data = []; $this._encodeSettingName(name, data); - MSP.send_message(MSPCodes.MSPV2_SETTING, data, false, function(resp) { + MSP.send_message(MSPCodes.MSPV2_SETTING, data, false, function (resp) { var value; switch (setting.type) { case "uint8_t": @@ -2452,7 +2459,7 @@ var mspHelper = (function (gui) { }); }; - self.encodeSetting = function(name, value) { + self.encodeSetting = function (name, value) { var $this = this; return this._getSetting(name).then(function (setting) { if (setting.table) { @@ -2495,15 +2502,15 @@ var mspHelper = (function (gui) { }); }; - self.setSetting = function(name, value, callback) { + self.setSetting = function (name, value, callback) { this.encodeSetting(name, value).then(function (data) { MSP.send_message(MSPCodes.MSPV2_SET_SETTING, data, false, callback); }); }; - self.getRTC = function(callback) { + self.getRTC = function (callback) { if (semver.gt(CONFIG.flightControllerVersion, "1.7.3")) { - MSP.send_message(MSPCodes.MSP_RTC, false, false, function(resp) { + MSP.send_message(MSPCodes.MSP_RTC, false, false, function (resp) { var seconds = resp.data.read32(); var millis = resp.data.readU16(); if (callback) { @@ -2515,7 +2522,7 @@ var mspHelper = (function (gui) { } }; - self.setRTC = function(callback) { + self.setRTC = function (callback) { if (semver.gt(CONFIG.flightControllerVersion, "1.7.3")) { var now = Date.now(); var secs = now / 1000; diff --git a/tabs/mission_control.html b/tabs/mission_control.html index e2145952..2847043d 100644 --- a/tabs/mission_control.html +++ b/tabs/mission_control.html @@ -64,8 +64,10 @@
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 203be86e..6aa6e4c2 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -17,7 +17,6 @@ TABS.mission_control.initialize = function (callback) { loadChainer.execute(); function updateTotalInfo() { - console.log(MISSION_PLANER.isValidMission); $('#availablePoints').text(MISSION_PLANER.countBusyPoints + '/' + MISSION_PLANER.maxWaypoints); $('#missionValid').html(MISSION_PLANER.isValidMission ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail')); } @@ -383,17 +382,31 @@ TABS.mission_control.initialize = function (callback) { sendNextPoint(); }); + $('#loadEepromMissionButton').on('click', function () { + + }); + $('#saveEepromMissionButton').on('click', function () { + GUI.log(chrome.i18n.getMessage('eeprom_saved_ok')); + MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, false, false); + }); + updateTotalInfo(); } function getNextPoint() { - if (pointForSend > 0 ) { - addMarker(ol.proj.fromLonLat(MISSION_PLANER.bufferPoint.lon,MISSION_PLANER.bufferPoint.lat), MISSION_PLANER.bufferPoint.alt); + if (pointForSend > 0) { + // console.log(MISSION_PLANER.bufferPoint.lon); + // console.log(MISSION_PLANER.bufferPoint.lat); + // console.log(MISSION_PLANER.bufferPoint.alt); + // console.log(MISSION_PLANER.bufferPoint.action); + map.addLayer(addMarker(ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]), MISSION_PLANER.bufferPoint.alt)); + // repaint(); } - if (pointForSend >= MISSION_PLANER.countBusyPoints) { + if (pointForSend > MISSION_PLANER.countBusyPoints) { GUI.log('End get point'); $('#loadMissionButton').removeClass('disabled'); + repaint(); return; } @@ -408,9 +421,6 @@ TABS.mission_control.initialize = function (callback) { if (pointForSend >= markers.length) { GUI.log('End send point'); - GUI.log(chrome.i18n.getMessage('eeprom_saved_ok')); - MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, false, false); - MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, updateTotalInfo); $('#saveMissionButton').removeClass('disabled'); @@ -418,11 +428,12 @@ TABS.mission_control.initialize = function (callback) { } var geometry = markers[pointForSend].getSource().getFeatures()[0].getGeometry(); + var coordinate = ol.proj.toLonLat(geometry.getCoordinates()); MISSION_PLANER.bufferPoint.number = pointForSend; MISSION_PLANER.bufferPoint.action = 1; - MISSION_PLANER.bufferPoint.lat = parseInt(geometry.getCoordinates()[0] * 10000000); - MISSION_PLANER.bufferPoint.lon = parseInt(geometry.getCoordinates()[1] * 10000000); + MISSION_PLANER.bufferPoint.lat = parseInt(coordinate[0] * 10000000); + MISSION_PLANER.bufferPoint.lon = parseInt(coordinate[1] * 10000000); MISSION_PLANER.bufferPoint.alt = markers[pointForSend].alt; pointForSend++; From 536c5488e4e6ba5cf146d41f2a1691d1de9b832d Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Sun, 28 Jan 2018 14:21:59 +0300 Subject: [PATCH 06/57] Save and load mission from EEPROM, fix bugs --- _locales/en/messages.json | 10 +++++-- js/msp/MSPCodes.js | 1 + js/msp/MSPHelper.js | 22 ++++++++++---- tabs/mission_control.html | 8 ++--- tabs/mission_control.js | 62 ++++++++++++++++++++++++++------------- 5 files changed, 72 insertions(+), 31 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 10be9bba..5889d25d 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2324,10 +2324,10 @@ "message": "Mission Control" }, "loadMissionButton": { - "message": "Load mission" + "message": "Load mission from FC" }, "saveMissionButton": { - "message": "Save mission" + "message": "Save mission to FC" }, "loadEepromMissionButton": { "message": "Load Eeprom mission" @@ -2352,5 +2352,11 @@ }, "useOnlyStandalone": { "message": "Use stand-alone application.
    Please visit the website to read the release notes and download." + }, + "eeprom_load_ok": { + "message": "EEPROM loaded" + }, + "confirm_delete_all_points": { + "message": "Do you really want to delete all points?" } } diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 8985f03d..a285bb00 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -17,6 +17,7 @@ var MSPCodes = { MSP_POSITION_ESTIMATION_CONFIG: 16, MSP_SET_POSITION_ESTIMATION_CONFIG: 17, + MSP_WP_MISSION_LOAD: 18, MSP_WP_MISSION_SAVE: 19, MSP_WP_GETINFO: 20, MSP_RTH_AND_LAND_CONFIG: 21, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 3ed04df5..18633858 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -341,8 +341,8 @@ var mspHelper = (function (gui) { case MSPCodes.MSP_WP: MISSION_PLANER.bufferPoint.number = data.getUint8(0); MISSION_PLANER.bufferPoint.action = data.getUint8(1); - MISSION_PLANER.bufferPoint.lon = data.getInt32(2, true) / 10000000; - MISSION_PLANER.bufferPoint.lat = data.getInt32(6, true) / 10000000; + MISSION_PLANER.bufferPoint.lat = data.getInt32(2, true) / 10000000; + MISSION_PLANER.bufferPoint.lon = data.getInt32(6, true) / 10000000; MISSION_PLANER.bufferPoint.alt = data.getInt32(10, true); break; @@ -1120,6 +1120,14 @@ var mspHelper = (function (gui) { case MSPCodes.MSP_SET_WP: console.log('Point saved'); break; + case MSPCodes.MSP_WP_MISSION_SAVE: + // buffer.push(0); + console.log(data); + + break; + case MSPCodes.MSP_WP_MISSION_LOAD: + console.log('Mission load'); + break; default: console.log('Unknown code detected: ' + dataHandler.code); } else { @@ -1601,8 +1609,6 @@ var mspHelper = (function (gui) { break; case MSPCodes.MSP_SET_WP: - console.log(MISSION_PLANER.bufferPoint.lat); - console.log(MISSION_PLANER.bufferPoint.lon); buffer.push(MISSION_PLANER.bufferPoint.number); // sbufReadU8(src); // number buffer.push(MISSION_PLANER.bufferPoint.action); // sbufReadU8(src); // action buffer.push(specificByte(MISSION_PLANER.bufferPoint.lat, 0)); // sbufReadU32(src); // lat @@ -1627,11 +1633,17 @@ var mspHelper = (function (gui) { break; case MSPCodes.MSP_WP: console.log(MISSION_PLANER.bufferPoint.number); - buffer.push(MISSION_PLANER.bufferPoint.number); + buffer.push(MISSION_PLANER.bufferPoint.number+1); break; case MSPCodes.MSP_WP_MISSION_SAVE: // buffer.push(0); + console.log(buffer); + + break; + case MSPCodes.MSP_WP_MISSION_LOAD: + // buffer.push(0); + console.log(buffer); break; default: diff --git a/tabs/mission_control.html b/tabs/mission_control.html index 2847043d..c7b04d66 100644 --- a/tabs/mission_control.html +++ b/tabs/mission_control.html @@ -3,7 +3,7 @@
    -
    +
    @@ -12,8 +12,8 @@
    - + @@ -27,7 +27,7 @@
    - +
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 6aa6e4c2..c438b199 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -29,7 +29,7 @@ TABS.mission_control.initialize = function (callback) { if (typeof require !== "undefined") { initMap(); } else { - $('#missionMap').hide(); + $('#missionMap, #missionControls').hide(); $('#notLoadMap').show(); } localize(); @@ -100,7 +100,7 @@ TABS.mission_control.initialize = function (callback) { map.addLayer(vectorLayer); } - function addMarker(_pos, _alt) { + function addMarker(_pos, _alt, _action) { var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(_pos), name: 'Null Island', @@ -139,6 +139,7 @@ TABS.mission_control.initialize = function (callback) { vectorLayer.alt = _alt; vectorLayer.number = markers.length; + vectorLayer.action = _action; markers.push(vectorLayer); @@ -285,7 +286,7 @@ TABS.mission_control.initialize = function (callback) { target: document.getElementById('missionMap'), view: new ol.View({ center: ol.proj.fromLonLat([lon, lat]), - zoom: 10 + zoom: 14 }) }); @@ -305,8 +306,9 @@ TABS.mission_control.initialize = function (callback) { $('#pointLat').val(coord[0]); $('#pointLon').val(coord[1]); $('#pointAlt').val(selectedMarker.alt); + $('#pointType').val(selectedMarker.action); } else { - map.addLayer(addMarker(evt.coordinate, 0)); + map.addLayer(addMarker(evt.coordinate, 1500, 1)); repaint(); } }); @@ -325,25 +327,24 @@ TABS.mission_control.initialize = function (callback) { }); $('#removeAllPoints').on('click', function () { - for (var i in markers) { - map.removeLayer(markers[i]); + if (confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) { + removeAllPoints(); } - markers = []; - clearEditForm(); - repaint(); }); $('#removePoint').on('click', function () { if (selectedMarker) { - map.removeLayer(selectedMarker); + var tmp = []; for (var i in markers) { - if (markers[i] !== selectedMarker) { + if (markers[i] !== selectedMarker && typeof markers[i].action !== "undefined") { tmp.push(markers[i]); } } + map.removeLayer(selectedMarker); markers = tmp; selectedMarker = null; + clearEditForm(); repaint(); } @@ -356,6 +357,7 @@ TABS.mission_control.initialize = function (callback) { var geometry = t.getSource().getFeatures()[0].getGeometry(); geometry.setCoordinates(ol.proj.fromLonLat([parseFloat($('#pointLat').val()), parseFloat($('#pointLon').val())])); t.alt = $('#pointAlt').val(); + t.action = $('#pointType').val(); } }); @@ -366,8 +368,8 @@ TABS.mission_control.initialize = function (callback) { }); $('#loadMissionButton').on('click', function () { + removeAllPoints(); $(this).addClass('disabled'); - console.log('Start get point'); GUI.log('Start get point'); pointForSend = 0; @@ -383,7 +385,9 @@ TABS.mission_control.initialize = function (callback) { }); $('#loadEepromMissionButton').on('click', function () { + GUI.log(chrome.i18n.getMessage('eeprom_load_ok')); + MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, false, getPointsFromEprom); }); $('#saveEepromMissionButton').on('click', function () { GUI.log(chrome.i18n.getMessage('eeprom_saved_ok')); @@ -393,20 +397,39 @@ TABS.mission_control.initialize = function (callback) { updateTotalInfo(); } + function removeAllPoints() { + for (var i in markers) { + map.removeLayer(markers[i]); + } + markers = []; + clearEditForm(); + repaint(); + } + + function getPointsFromEprom() { + pointForSend = 0; + MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getNextPoint); + } + + function getNextPoint() { + var coord; if (pointForSend > 0) { // console.log(MISSION_PLANER.bufferPoint.lon); // console.log(MISSION_PLANER.bufferPoint.lat); // console.log(MISSION_PLANER.bufferPoint.alt); // console.log(MISSION_PLANER.bufferPoint.action); - map.addLayer(addMarker(ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]), MISSION_PLANER.bufferPoint.alt)); - // repaint(); + + coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); + map.addLayer(addMarker(coord, MISSION_PLANER.bufferPoint.alt, MISSION_PLANER.bufferPoint.action)); } - if (pointForSend > MISSION_PLANER.countBusyPoints) { + if (pointForSend >= MISSION_PLANER.countBusyPoints) { GUI.log('End get point'); $('#loadMissionButton').removeClass('disabled'); + map.getView().setCenter(coord); repaint(); + updateTotalInfo(); return; } @@ -430,12 +453,11 @@ TABS.mission_control.initialize = function (callback) { var geometry = markers[pointForSend].getSource().getFeatures()[0].getGeometry(); var coordinate = ol.proj.toLonLat(geometry.getCoordinates()); - MISSION_PLANER.bufferPoint.number = pointForSend; - MISSION_PLANER.bufferPoint.action = 1; - MISSION_PLANER.bufferPoint.lat = parseInt(coordinate[0] * 10000000); - MISSION_PLANER.bufferPoint.lon = parseInt(coordinate[1] * 10000000); + MISSION_PLANER.bufferPoint.number = pointForSend + 1; + MISSION_PLANER.bufferPoint.action = markers[pointForSend].action; + MISSION_PLANER.bufferPoint.lon = parseInt(coordinate[0] * 10000000); + MISSION_PLANER.bufferPoint.lat = parseInt(coordinate[1] * 10000000); MISSION_PLANER.bufferPoint.alt = markers[pointForSend].alt; - pointForSend++; if (pointForSend >= markers.length) { MISSION_PLANER.bufferPoint.endMission = 0xA5; From 818d07409b6f4fdfd133858704d2d0c48a6c31bd Mon Sep 17 00:00:00 2001 From: afinogen Date: Mon, 29 Jan 2018 13:57:43 +0300 Subject: [PATCH 07/57] fix conflict( --- _locales/en/messages.json | 1 - 1 file changed, 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 151aeea4..f401a54a 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2325,7 +2325,6 @@ "downloadUpdatesBtn": { "message": "Download new app" }, -<<<<<<< HEAD "tabMissionControl": { "message": "Mission Control" }, From 5ea039a9d73cccd128aae5b7efc777d24674a54b Mon Sep 17 00:00:00 2001 From: afinogen Date: Mon, 29 Jan 2018 14:12:42 +0300 Subject: [PATCH 08/57] add adaptive style --- src/css/tabs/mission_planer.css | 65 ++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css index a652873d..668436b3 100644 --- a/src/css/tabs/mission_planer.css +++ b/src/css/tabs/mission_planer.css @@ -73,4 +73,67 @@ .tab-mission-control .content_wrapper { height: calc(100% - 240px); } -} \ No newline at end of file +} + + +/* Need test! */ +.tab-mission-control .content_toolbar { + display: flex; + height: 150px; + flex-direction: row; + justify-content: space-between; + flex-wrap: wrap; +} + +.tab-mission-control .waypoint-left, +.tab-mission-control .waypoint-right { + width: 47%; + float: none; +} + +.btn.save_btn { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.btn.save_btn a{ + margin-top: 5px; +} + +.gui_box{ + width: 100%; + clear: both; + height: 90%; +} + +.tab-mission-control.toolbar_fixed_bottom{ + height: 100%; +} +.tab-mission-control .content_wrapper{ + height: 100%; +} +#missionMap{ + height: 100%; +} +.tab-mission-control .content_toolbar{ + height: auto; +} + +.tab-mission-control input{ + width: 115px; +} + +.point{ + margin-left: 5px; +} +@media (max-width: 1252px){ + .tab-mission-control .waypoint-left, + .tab-mission-control .waypoint-right { + width: 100%; + } + .tab-mission-control .waypoint-right{ + padding-right: 5px; + margin-top: 5px; + } +} From 4d096ebe320e12e61ea75a305c053374d1971f4c Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Mon, 29 Jan 2018 21:39:17 +0300 Subject: [PATCH 09/57] fix css --- src/css/tabs/mission_planer.css | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css index 668436b3..3bf1415b 100644 --- a/src/css/tabs/mission_planer.css +++ b/src/css/tabs/mission_planer.css @@ -17,10 +17,6 @@ float: right; } -.tab-mission-control .content_wrapper { - height: calc(100% - 150px); -} - .tab-mission-control .checksfail { /*float: right;*/ margin-top: 3px; @@ -32,12 +28,8 @@ background-repeat:no-repeat; } -.tab-mission-control .content_toolbar { - height: 150px; -} - .tab-mission-control input { - width: 157px; + width: 115px; padding-left: 3px; height: 20px; line-height: 20px; @@ -52,6 +44,7 @@ .tab-mission-control .point { display: inline-block; margin-bottom: 5px; + margin-left: 5px; } .tab-mission-control .point-label { @@ -75,11 +68,11 @@ } } - /* Need test! */ .tab-mission-control .content_toolbar { display: flex; - height: 150px; + /*height: 150px;*/ + height: auto; flex-direction: row; justify-content: space-between; flex-wrap: wrap; @@ -110,23 +103,13 @@ .tab-mission-control.toolbar_fixed_bottom{ height: 100%; } -.tab-mission-control .content_wrapper{ - height: 100%; -} +/*.tab-mission-control .content_wrapper{*/ + /*height: 100%;*/ +/*}*/ #missionMap{ height: 100%; } -.tab-mission-control .content_toolbar{ - height: auto; -} -.tab-mission-control input{ - width: 115px; -} - -.point{ - margin-left: 5px; -} @media (max-width: 1252px){ .tab-mission-control .waypoint-left, .tab-mission-control .waypoint-right { From b24f3a29d656ca7dc09f4bf5f2858400eeb089c2 Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Mon, 29 Jan 2018 22:41:42 +0300 Subject: [PATCH 10/57] fix css 2 --- src/css/tabs/mission_planer.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css index 3bf1415b..40bd7f7b 100644 --- a/src/css/tabs/mission_planer.css +++ b/src/css/tabs/mission_planer.css @@ -84,17 +84,17 @@ float: none; } -.btn.save_btn { +.tab-mission-control .btn.save_btn { display: flex; flex-direction: row; flex-wrap: wrap; } -.btn.save_btn a{ +.tab-mission-control .btn.save_btn a{ margin-top: 5px; } -.gui_box{ +.tab-mission-control .gui_box{ width: 100%; clear: both; height: 90%; From 52318f81f201737250fe68213cf73f76cf0c07e3 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Thu, 25 Jan 2018 22:32:41 +0100 Subject: [PATCH 11/57] improve battery monitoring: add Wh icon in OSD fonts --- resources/osd/bold.mcm | 88 +++++++++++++++++----------------- resources/osd/bold/171.png | Bin 0 -> 228 bytes resources/osd/default.mcm | 80 +++++++++++++++---------------- resources/osd/default/171.png | Bin 0 -> 227 bytes resources/osd/large.mcm | 80 +++++++++++++++---------------- resources/osd/large/171.png | Bin 0 -> 227 bytes 6 files changed, 124 insertions(+), 124 deletions(-) create mode 100644 resources/osd/bold/171.png create mode 100644 resources/osd/default/171.png create mode 100644 resources/osd/large/171.png diff --git a/resources/osd/bold.mcm b/resources/osd/bold.mcm index b2497cc9..c837648a 100644 --- a/resources/osd/bold.mcm +++ b/resources/osd/bold.mcm @@ -10946,54 +10946,54 @@ MAX7456 01010101 01010101 01010101 +01010000 +00010100 +00000101 +01010010 +00010100 +10000101 +01010010 +00000000 +10000101 +01010010 +00000000 +10000101 +01010010 +00101000 +10000101 +01010000 +10101010 +00000101 +01010100 +10000010 +00010101 +01010100 +00000000 +00010101 +01010100 +00000101 01010101 +01010100 +10000101 01010101 +01010100 +10000000 01010101 +01010100 +10001000 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +01010100 +10100010 +00010101 +01010100 +10000010 +00010101 +01010100 +10000010 +00010101 +01010100 +00000000 +00010101 01010101 01010101 01010101 diff --git a/resources/osd/bold/171.png b/resources/osd/bold/171.png new file mode 100644 index 0000000000000000000000000000000000000000..f8dcbcf648c156b30796b149622a92c320f0446e GIT binary patch literal 228 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(Y)RhkE?;9RjK%qiU7sn8d^J{|~`3@-X2t7Xh)6#n8 z6)|()V=GrK70~fm6`OFTDdqIm*I!ReTNUw+S6$jX{Yx3A_k@(UqD&2`0YS_UI4_zv zq#EoK^)58XzrXCuw2=R&{#t}h3QP62=rTR7xpGBBllSxemv{VX->yBkf??(oqt!LD S9UlWNXYh3Ob6Mw<&;$TZB27X7 literal 0 HcmV?d00001 diff --git a/resources/osd/default.mcm b/resources/osd/default.mcm index 78a67750..594d243c 100644 --- a/resources/osd/default.mcm +++ b/resources/osd/default.mcm @@ -10946,53 +10946,53 @@ MAX7456 01010101 01010101 01010101 +01010100 +01010101 +00010101 +01010010 +00010100 +10000101 +01010010 +00010100 +10000101 +01010010 +00000000 +10000101 +01010010 +00101000 +10000101 +01010100 +10101010 +00010101 +01010100 +10000010 +00010101 +01010101 +00010100 01010101 01010101 +00010101 01010101 +01010100 +10000101 01010101 +01010100 +10000001 01010101 +01010100 +10001000 01010101 +01010100 +10100010 +00010101 +01010100 +10000010 +00010101 +01010100 +10000010 +00010101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +00010100 01010101 01010101 01010101 diff --git a/resources/osd/default/171.png b/resources/osd/default/171.png new file mode 100644 index 0000000000000000000000000000000000000000..3daae9f43ef87e913eab4c34e6d501b8071f28a6 GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(Y)RhkE Date: Tue, 30 Jan 2018 21:00:26 +0100 Subject: [PATCH 12/57] Add Wh/Km OSD icon --- resources/osd/bold.mcm | 134 +++++++++++++++--------------- resources/osd/bold/172-173.png | Bin 0 -> 273 bytes resources/osd/default.mcm | 134 +++++++++++++++--------------- resources/osd/default/172-173.png | Bin 0 -> 273 bytes resources/osd/large.mcm | 134 +++++++++++++++--------------- resources/osd/large/172-173.png | Bin 0 -> 273 bytes 6 files changed, 201 insertions(+), 201 deletions(-) create mode 100644 resources/osd/bold/172-173.png create mode 100644 resources/osd/default/172-173.png create mode 100644 resources/osd/large/172-173.png diff --git a/resources/osd/bold.mcm b/resources/osd/bold.mcm index c837648a..fb0031e6 100644 --- a/resources/osd/bold.mcm +++ b/resources/osd/bold.mcm @@ -11008,21 +11008,56 @@ MAX7456 01010101 01010101 01010101 +01010001 +01010100 01010101 +01001000 +01010010 01010101 +01001000 +01010010 01010101 +01001000 +00000010 01010101 +01001000 +10100010 01010101 +01010010 +10101000 01010101 +01010010 +00001000 01010101 +01010100 +01010001 01010101 +00000000 +00000000 +01010100 +10101010 +10101010 01010101 +00000000 +00000000 01010101 +01010100 +00010000 01010101 +01010010 +00001000 01010101 +01010010 +00100000 01010101 +01010010 +10100000 01010101 +01010010 +00001000 01010101 +01010100 +00000000 01010101 01010101 01010101 @@ -11036,91 +11071,56 @@ MAX7456 01010101 01010101 01010101 +01000001 01010101 01010101 +00100001 01010101 01010101 +00100000 01010101 01010101 +00100010 +00010101 01010101 +00101000 +10000101 01010101 +00100000 +10000101 01010101 +00100000 +10000101 01010101 +01000101 +00010101 01010101 +00000000 +00000000 01010101 +10101010 +10101010 +00010101 +00000000 +00000000 01010101 +00000100 +00010101 01010101 +00100010 +00010101 01010101 +10001000 +10000101 01010101 +10001000 +10000101 01010101 +10000000 +10000101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +00010101 +00010101 01010101 01010101 01010101 diff --git a/resources/osd/bold/172-173.png b/resources/osd/bold/172-173.png new file mode 100644 index 0000000000000000000000000000000000000000..e6ca6746d2a7a340d96d68177863636afce04ad7 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^5Co-U3d7N@s{I0_w6;AobWpEp0< zzvK?jwgq=%-ULWXdloQkVPW8Li0a<8@4P|S6P2@f>rX5a%Vw3gKCrDxt8>+zAcspH zdM7=<@iP?Eu4!q!UiIKz>ZUM$C)X3}ZI;`wuv}rWIJs-$&;Kl|GE%O8GH2bD==U)z z$0qi5?&RkRXU*RB^juo8L-{_}tV#11$e7r!$Z9*jKy%@(4YFIde`J;4P=D%#(cwiv Pmoj*|`njxgN@xNAJJV(& literal 0 HcmV?d00001 diff --git a/resources/osd/default.mcm b/resources/osd/default.mcm index 594d243c..a6f338ac 100644 --- a/resources/osd/default.mcm +++ b/resources/osd/default.mcm @@ -11008,21 +11008,56 @@ MAX7456 01010101 01010101 01010101 +01010001 +01010100 01010101 +01001000 +01010010 01010101 +01001000 +01010010 01010101 +01001000 +00000010 01010101 +01001000 +10100010 01010101 +01010010 +10101000 01010101 +01010010 +00001000 01010101 +01010100 +01010001 01010101 +00000000 +00000000 +01010100 +10101010 +10101010 01010101 +00000000 +00000000 01010101 +01010100 +00010000 01010101 +01010010 +00001000 01010101 +01010010 +00100000 01010101 +01010010 +10100000 01010101 +01010010 +00001000 01010101 +01010100 +00000000 01010101 01010101 01010101 @@ -11036,91 +11071,56 @@ MAX7456 01010101 01010101 01010101 +01000001 01010101 01010101 +00100001 01010101 01010101 +00100000 01010101 01010101 +00100010 +00010101 01010101 +00101000 +10000101 01010101 +00100000 +10000101 01010101 +00100000 +10000101 01010101 +01000101 +00010101 01010101 +00000000 +00000000 01010101 +10101010 +10101010 +00010101 +00000000 +00000000 01010101 +00000100 +00010101 01010101 +00100010 +00010101 01010101 +10001000 +10000101 01010101 +10001000 +10000101 01010101 +10000000 +10000101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +00010101 +00010101 01010101 01010101 01010101 diff --git a/resources/osd/default/172-173.png b/resources/osd/default/172-173.png new file mode 100644 index 0000000000000000000000000000000000000000..e6ca6746d2a7a340d96d68177863636afce04ad7 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^5Co-U3d7N@s{I0_w6;AobWpEp0< zzvK?jwgq=%-ULWXdloQkVPW8Li0a<8@4P|S6P2@f>rX5a%Vw3gKCrDxt8>+zAcspH zdM7=<@iP?Eu4!q!UiIKz>ZUM$C)X3}ZI;`wuv}rWIJs-$&;Kl|GE%O8GH2bD==U)z z$0qi5?&RkRXU*RB^juo8L-{_}tV#11$e7r!$Z9*jKy%@(4YFIde`J;4P=D%#(cwiv Pmoj*|`njxgN@xNAJJV(& literal 0 HcmV?d00001 diff --git a/resources/osd/large.mcm b/resources/osd/large.mcm index 724cc456..709ac509 100644 --- a/resources/osd/large.mcm +++ b/resources/osd/large.mcm @@ -11008,21 +11008,56 @@ MAX7456 01010101 01010101 01010101 +01010001 +01010100 01010101 +01001000 +01010010 01010101 +01001000 +01010010 01010101 +01001000 +00000010 01010101 +01001000 +10100010 01010101 +01010010 +10101000 01010101 +01010010 +00001000 01010101 +01010100 +01010001 01010101 +00000000 +00000000 +01010100 +10101010 +10101010 01010101 +00000000 +00000000 01010101 +01010100 +00010000 01010101 +01010010 +00001000 01010101 +01010010 +00100000 01010101 +01010010 +10100000 01010101 +01010010 +00001000 01010101 +01010100 +00000000 01010101 01010101 01010101 @@ -11036,91 +11071,56 @@ MAX7456 01010101 01010101 01010101 +01000001 01010101 01010101 +00100001 01010101 01010101 +00100000 01010101 01010101 +00100010 +00010101 01010101 +00101000 +10000101 01010101 +00100000 +10000101 01010101 +00100000 +10000101 01010101 +01000101 +00010101 01010101 +00000000 +00000000 01010101 +10101010 +10101010 +00010101 +00000000 +00000000 01010101 +00000100 +00010101 01010101 +00100010 +00010101 01010101 +10001000 +10000101 01010101 +10001000 +10000101 01010101 +10000000 +10000101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +00010101 +00010101 01010101 01010101 01010101 diff --git a/resources/osd/large/172-173.png b/resources/osd/large/172-173.png new file mode 100644 index 0000000000000000000000000000000000000000..e6ca6746d2a7a340d96d68177863636afce04ad7 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^5Co-U3d7N@s{I0_w6;AobWpEp0< zzvK?jwgq=%-ULWXdloQkVPW8Li0a<8@4P|S6P2@f>rX5a%Vw3gKCrDxt8>+zAcspH zdM7=<@iP?Eu4!q!UiIKz>ZUM$C)X3}ZI;`wuv}rWIJs-$&;Kl|GE%O8GH2bD==U)z z$0qi5?&RkRXU*RB^juo8L-{_}tV#11$e7r!$Z9*jKy%@(4YFIde`J;4P=D%#(cwiv Pmoj*|`njxgN@xNAJJV(& literal 0 HcmV?d00001 From 8cac88c14f597274735867de25bf7f16ea875be8 Mon Sep 17 00:00:00 2001 From: giacomo892 Date: Wed, 7 Feb 2018 21:07:26 +0100 Subject: [PATCH 13/57] Add FW_LAUNCH feature to configurator --- _locales/en/messages.json | 3 +++ js/fc.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index fd62a27a..8c40d937 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -573,6 +573,9 @@ "featureAIRMODE": { "message": "Permanently enable AIRMODE" }, + "featureFW_LAUNCH": { + "message": "Permanently enable Launch Mode for Fixed Wing" + }, "configurationFeatureEnabled": { "message": "Enabled" }, diff --git a/js/fc.js b/js/fc.js index 05be6b27..53c58559 100644 --- a/js/fc.js +++ b/js/fc.js @@ -498,6 +498,12 @@ var FC = { ); } + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + features.push( + {bit: 30, group: 'other', name: 'FW_LAUNCH', haveTip: false, showNameInTip: false} + ); + } + return features.reverse(); }, isFeatureEnabled: function (featureName, features) { From fd78485aec0bcb4355c2c53f90aa8a1ef99833b6 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Fri, 9 Feb 2018 00:59:15 +0100 Subject: [PATCH 14/57] Add new development branch adjustments --- _locales/en/messages.json | 18 +++++++++--------- tabs/adjustments.js | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 68a4d78a..806eeaab 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1043,31 +1043,31 @@ "message": "Roll D Adjustment" }, "adjustmentsFunction21": { - "message": "Alt P Adjustment" + "message": "RC Yaw Expo Adjustment" }, "adjustmentsFunction22": { - "message": "Alt I Adjustment" + "message": "Manual RC Expo Adjustment" }, "adjustmentsFunction23": { - "message": "Alt D Adjustment" + "message": "Manual RC Yaw Expo Adjustment" }, "adjustmentsFunction24": { - "message": "Vel P Adjustment" + "message": "Manual Pitch & Roll Rate Adjustment" }, "adjustmentsFunction25": { - "message": "Vel I Adjustment" + "message": "Manual Roll Rate Adjustment" }, "adjustmentsFunction26": { - "message": "Vel D Adjustment" + "message": "Manual Pitch Rate Adjustment" }, "adjustmentsFunction27": { - "message": "MAG P Adjustment" + "message": "Manual Yaw Rate Adjustment" }, "adjustmentsFunction28": { - "message": "Pos P Adjustment" + "message": "Navigation FW Cruise Throttle Adjustment" }, "adjustmentsFunction29": { - "message": "Pos I Adjustment" + "message": "Navigation FW Pitch To Throttle Adjustment" }, "adjustmentsFunction30": { "message": "PosR P Adjustment" diff --git a/tabs/adjustments.js b/tabs/adjustments.js index 110441e5..15a93079 100644 --- a/tabs/adjustments.js +++ b/tabs/adjustments.js @@ -70,6 +70,10 @@ TABS.adjustments.initialize = function (callback) { availableFunctionCount = 21; } + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + availableFunctionCount = 30; + } + var functionListOptions = $(functionListOptions).slice(0,availableFunctionCount); functionList.empty().append(functionListOptions); From b98d7a8f3b633e752855f60233e5032ea9ef3897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 12 Feb 2018 12:32:52 +0000 Subject: [PATCH 15/57] Add support for viewing trace output via MSP from the sensors tab Use an additional window to show the debug trace, so the configurator can be used at the same time the user is viewing the output. --- js/fc.js | 3 ++- js/msp/MSPHelper.js | 19 +++++++++++++++++++ src/css/tabs/sensors.css | 11 +++++++++++ tabs/debug_trace.html | 16 ++++++++++++++++ tabs/sensors.html | 2 ++ tabs/sensors.js | 20 ++++++++++++++++++++ 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tabs/debug_trace.html diff --git a/js/fc.js b/js/fc.js index 53c58559..ac65856c 100644 --- a/js/fc.js +++ b/js/fc.js @@ -47,7 +47,8 @@ var CONFIG, CALIBRATION_DATA, POSITION_ESTIMATOR, RTH_AND_LAND_CONFIG, - FW_CONFIG; + FW_CONFIG, + DEBUG_TRACE; var FC = { MAX_SERVO_RATE: 125, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index e634b62c..5c150eb7 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -47,6 +47,12 @@ var mspHelper = (function (gui) { 'IRC_TRAMP': 12 }; + // Required for MSP_DEBUGMSG because console.log() doesn't allow omitting + // the newline at the end, so we keep the pending message here until we find a + // '\0', then print it. Messages sent by MSP_DEBUGMSG are guaranteed to + // always finish with a '\0'. + var debugMsgBuffer = ''; + /** * * @param {MSP} dataHandler @@ -440,6 +446,19 @@ var mspHelper = (function (gui) { console.log('Settings Saved in EEPROM'); break; case MSPCodes.MSP_DEBUGMSG: + for (var ii = 0; ii < data.byteLength; ii++) { + var c = data.readU8(); + if (c == 0) { + // End of message + if (debugMsgBuffer.length > 1) { + console.log('[DEBUG] ' + debugMsgBuffer); + DEBUG_TRACE = (DEBUG_TRACE || '') + debugMsgBuffer; + } + debugMsgBuffer = ''; + continue; + } + debugMsgBuffer += String.fromCharCode(c); + } break; case MSPCodes.MSP_DEBUG: for (i = 0; i < 4; i++) diff --git a/src/css/tabs/sensors.css b/src/css/tabs/sensors.css index aa75fc92..276bb564 100644 --- a/src/css/tabs/sensors.css +++ b/src/css/tabs/sensors.css @@ -166,4 +166,15 @@ .tab-sensors .legend .item:nth-child(4) { fill: #4DA74D; +} + +.tab-sensors a.debug-trace { + float: right; + margin-right: 1em; + font-size: 90%; + text-decoration: underline; +} + +.tab-sensors a.debug-trace::hover { + text-decoration: underline; } \ No newline at end of file diff --git a/tabs/debug_trace.html b/tabs/debug_trace.html new file mode 100644 index 00000000..e0c9cbfc --- /dev/null +++ b/tabs/debug_trace.html @@ -0,0 +1,16 @@ + + +Debug Trace + + + +
    + + diff --git a/tabs/sensors.html b/tabs/sensors.html index ad95b131..420b78b1 100644 --- a/tabs/sensors.html +++ b/tabs/sensors.html @@ -19,6 +19,8 @@ type="checkbox" name="accel_on" />Accelerometer + + Open Debug Trace
    diff --git a/tabs/sensors.js b/tabs/sensors.js index a7a2754c..a5dc342c 100644 --- a/tabs/sensors.js +++ b/tabs/sensors.js @@ -482,6 +482,26 @@ TABS.sensors.initialize = function (callback) { } }); + $("a.debug-trace").click(function () { + var windowWidth = 500; + var windowHeight = 510; + + chrome.app.window.create("/tabs/debug_trace.html", { + id: "debug_trace", + innerBounds: { + minWidth: windowWidth, minHeight: windowHeight, + width: windowWidth, height: windowHeight, + }, + alwaysOnTop: true + }, function (createdWindow) { + createdWindow.contentWindow.getDebugTrace = function () { return DEBUG_TRACE || ''; }; + return true; + }); + return false; + }); + + + GUI.content_ready(callback); }); }; From abedf49d3882f5804152fea1e6cdc14cb1cc5cd1 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Tue, 13 Feb 2018 00:27:31 +1000 Subject: [PATCH 16/57] Fix sensor names --- js/fc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/fc.js b/js/fc.js index 53c58559..b3d8752d 100644 --- a/js/fc.js +++ b/js/fc.js @@ -847,7 +847,7 @@ var FC = { return [ "NONE", "AUTO", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "MPU9250", "FAKE"]; }, getMagnetometerNames: function () { - return ["NONE", "AUTO", "HMC5883", "AK8975", "GPSMAG", "MAG3110", "AK8963", "IST8310", "FAKE"]; + return ["NONE", "AUTO", "HMC5883", "AK8975", "GPSMAG", "MAG3110", "AK8963", "IST8310", "QMC5883", "MPU9250", "FAKE"]; }, getBarometerNames: function () { if (semver.gte(CONFIG.flightControllerVersion, "1.6.2")) { @@ -866,7 +866,7 @@ var FC = { } }, getRangefinderNames: function () { - return [ "NONE", "HCSR04", "SRF10"]; + return [ "NONE", "HCSR04", "SRF10", "HCSR04I2C", "VL53L0X", "UIB"]; }, getArmingFlags: function () { return { From 08a54197c0c8378811c176e69b2d70da667ac86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 12 Feb 2018 14:01:01 +0000 Subject: [PATCH 17/57] Move code for the debug trace window to an external script Chrome doesn't allow inline scripts, only external ones --- gulpfile.js | 5 +++++ js/debug_trace.js | 9 +++++++++ src/css/tabs/sensors.css | 3 +-- tabs/debug_trace.html | 9 +-------- 4 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 js/debug_trace.js diff --git a/gulpfile.js b/gulpfile.js index fa5fe8c8..2e9e67ed 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -125,6 +125,10 @@ sources.receiverJs = [ './tabs/receiver_msp.js' ]; +sources.debugTraceJs = [ + './js/debug_trace.js' +]; + sources.hexParserJs = [ './js/workers/hex_parser.js', ]; @@ -136,6 +140,7 @@ var output = { mapJs: 'map.js', receiverCss: 'receiver-msp.css', receiverJs: 'receiver-msp.js', + debugTraceJs: 'debug-trace.js', hexParserJs: 'hex_parser.js', }; diff --git a/js/debug_trace.js b/js/debug_trace.js new file mode 100644 index 00000000..78252a94 --- /dev/null +++ b/js/debug_trace.js @@ -0,0 +1,9 @@ +function debugTraceOnLoad() +{ + var output = document.getElementById('debug-trace'); + setInterval(function() { + output.innerText = getDebugTrace(); + }, 100); +} + +window.onload = debugTraceOnLoad; diff --git a/src/css/tabs/sensors.css b/src/css/tabs/sensors.css index 276bb564..a578383c 100644 --- a/src/css/tabs/sensors.css +++ b/src/css/tabs/sensors.css @@ -172,9 +172,8 @@ float: right; margin-right: 1em; font-size: 90%; - text-decoration: underline; } -.tab-sensors a.debug-trace::hover { +.tab-sensors a.debug-trace:hover { text-decoration: underline; } \ No newline at end of file diff --git a/tabs/debug_trace.html b/tabs/debug_trace.html index e0c9cbfc..a1d031f1 100644 --- a/tabs/debug_trace.html +++ b/tabs/debug_trace.html @@ -1,14 +1,7 @@ Debug Trace - +
    From e3cba58c4c80a5390278c4d7c0a2a7bac622df67 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Tue, 13 Feb 2018 21:33:12 +1000 Subject: [PATCH 18/57] Update version to 1.9.0 --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index c414107d..67cc8740 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "minimum_chrome_version": "38", - "version": "1.8.1", + "version": "1.9.0", "author": "Several", "name": "INAV - Configurator", "short_name": "INAV", diff --git a/package.json b/package.json index 2b5ae60f..19b56933 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "inav-configurator", "description": "INAV Configurator", - "version": "1.8.1", + "version": "1.9.0", "main": "main.html", "default_locale": "en", "scripts": { From 005f462504826a8ce0e735f001384c72fbb86bcc Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Fri, 16 Feb 2018 01:49:26 +0100 Subject: [PATCH 19/57] Add new adjustments for board alignment --- _locales/en/messages.json | 4 ++-- tabs/adjustments.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3d9b968b..3763ea04 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1082,10 +1082,10 @@ "message": "Navigation FW Pitch To Throttle Adjustment" }, "adjustmentsFunction30": { - "message": "PosR P Adjustment" + "message": "Board Roll Alignment Adjustment" }, "adjustmentsFunction31": { - "message": "PosR I Adjustment" + "message": "Board Pitch Alignment Adjustment" }, "adjustmentsFunction32": { "message": "PosR D Adjustment" diff --git a/tabs/adjustments.js b/tabs/adjustments.js index 15a93079..0ad3e587 100644 --- a/tabs/adjustments.js +++ b/tabs/adjustments.js @@ -71,7 +71,7 @@ TABS.adjustments.initialize = function (callback) { } if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { - availableFunctionCount = 30; + availableFunctionCount = 32; } var functionListOptions = $(functionListOptions).slice(0,availableFunctionCount); From 7de758c64ebb37710a97504251f132d73ebebf05 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sat, 17 Feb 2018 21:44:49 +0100 Subject: [PATCH 20/57] Increase vbat resolution --- js/fc.js | 26 ++++++- js/msp/MSPCodes.js | 12 ++- js/msp/MSPHelper.js | 143 ++++++++++++++++++++++++++++++++++++ js/periodicStatusUpdater.js | 35 ++++++--- main.css | 3 +- tabs/configuration.html | 8 +- tabs/configuration.js | 43 +++++++++-- 7 files changed, 244 insertions(+), 26 deletions(-) diff --git a/js/fc.js b/js/fc.js index fe10c0c3..9656303e 100644 --- a/js/fc.js +++ b/js/fc.js @@ -28,6 +28,7 @@ var CONFIG, ARMING_CONFIG, FC_CONFIG, MISC, + VOLTMETER_CONFIG, _3D, DATAFLASH, SDCARD, @@ -215,8 +216,12 @@ var FC = { ANALOG = { voltage: 0, mAhdrawn: 0, + mWhdrawn: 0, rssi: 0, - amperage: 0 + amperage: 0, + power: 0, + cell_count: 0, + battery_percentage: 0 }; ARMING_CONFIG = { @@ -244,7 +249,24 @@ var FC = { vbatscale: 0, vbatmincellvoltage: 0, vbatmaxcellvoltage: 0, - vbatwarningcellvoltage: 0 + vbatwarningcellvoltage: 0, + battery_capacity: 0, + battery_capacity_warning: 0, + battery_capacity_critical: 0, + battery_capacity_unit: 0 + }; + + BATTERY_CONFIG = { + vbatscale: 0, + vbatmincellvoltage: 0, + vbatmaxcellvoltage: 0, + vbatwarningcellvoltage: 0, + current_offset: 0, + current_scale: 0, + capacity: 0, + capacity_warning: 0, + capacity_critical: 0, + capacity_unit: 0 }; ADVANCED_CONFIG = { diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 69cd7ace..2d3dba51 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -153,6 +153,14 @@ var MSPCodes = { MSP_BF_BUILD_INFO: 69, // build date as well as some space for future expansion // INAV specific codes - MSPV2_SETTING: 0x1003, - MSPV2_SET_SETTING: 0x1004, + MSPV2_SETTING: 0x1003, + MSPV2_SET_SETTING: 0x1004, + MSPV2_INAV_STATUS: 0x2000, + MSPV2_INAV_OPTICAL_FLOW: 0x2001, + MSPV2_INAV_ANALOG: 0x2002, + MSPV2_INAV_MISC: 0x2003, + MSPV2_INAV_SET_MISC: 0x2004, + MSPV2_INAV_BATTERY_CONFIG: 0x2005, + MSPV2_INAV_SET_BATTERY_CONFIG: 0x2006 + }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index f3601d6d..a8188eb7 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -235,6 +235,22 @@ var mspHelper = (function (gui) { ANALOG.mAhdrawn = data.getUint16(1, true); ANALOG.rssi = data.getUint16(3, true); // 0-1023 ANALOG.amperage = data.getInt16(5, true) / 100; // A + break; + case MSPCodes.MSPV2_INAV_ANALOG: + ANALOG.voltage = data.getUint16(offset, true) / 100.0; + offset += 2; + ANALOG.cell_count = data.getUint8(offset++); + ANALOG.battery_percentage = data.getUint8(offset++); + ANALOG.power = data.getUint16(offset, true); + offset += 2; + ANALOG.mAhdrawn = data.getUint16(offset, true); + offset += 2; + ANALOG.mWhdrawn = data.getUint16(offset, true); + offset += 2; + ANALOG.rssi = data.getUint16(offset, true); // 0-1023 + offset += 2; + ANALOG.amperage = data.getInt16(offset, true) / 100; // A + offset += 2; //noinspection JSValidateTypes dataHandler.analog_last_received_timestamp = Date.now(); break; @@ -299,6 +315,61 @@ var mspHelper = (function (gui) { MISC.vbatmaxcellvoltage = data.getUint8(offset++) / 10; // 10-50 MISC.vbatwarningcellvoltage = data.getUint8(offset++) / 10; // 10-50 break; + case MSPCodes.MSPV2_INAV_MISC: + MISC.midrc = data.getInt16(offset, true); + offset += 2; + MISC.minthrottle = data.getUint16(offset, true); // 0-2000 + offset += 2; + MISC.maxthrottle = data.getUint16(offset, true); // 0-2000 + offset += 2; + MISC.mincommand = data.getUint16(offset, true); // 0-2000 + offset += 2; + MISC.failsafe_throttle = data.getUint16(offset, true); // 1000-2000 + offset += 2; + MISC.gps_type = data.getUint8(offset++); + MISC.sensors_baudrate = data.getUint8(offset++); + MISC.gps_ubx_sbas = data.getInt8(offset++); + MISC.rssi_channel = data.getUint8(offset++); + MISC.placeholder2 = data.getUint8(offset++); + MISC.mag_declination = data.getInt16(offset, 1) / 10; // -18000-18000 + offset += 2; + MISC.vbatscale = data.getUint16(offset, true); + offset += 2; + MISC.vbatmincellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + MISC.vbatmaxcellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + MISC.vbatwarningcellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + MISC.battery_capacity = data.getUint32(offset, true); + offset += 4; + MISC.battery_capacity_warning = data.getUint32(offset, true); + offset += 4; + MISC.battery_capacity_critical = data.getUint32(offset, true); + offset += 4; + MISC.battery_capacity_unit = data.getUint8(offset++); + break; + case MSPCodes.MSPV2_INAV_BATTERY_CONFIG: + BATTERY_CONFIG.vbatscale = data.getUint16(offset, true); + offset += 2; + BATTERY_CONFIG.vbatmincellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + BATTERY_CONFIG.vbatmaxcellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + BATTERY_CONFIG.vbatwarningcellvoltage = data.getUint16(offset, true) / 100; + offset += 2; + BATTERY_CONFIG.current_offset = data.getUint16(offset, true); + offset += 2; + BATTERY_CONFIG.current_scale = data.getUint16(offset, true); + offset += 2; + BATTERY_CONFIG.capacity = data.getUint32(offset, true); + offset += 4; + BATTERY_CONFIG.capacity_warning = data.getUint32(offset, true); + offset += 4; + BATTERY_CONFIG.capacity_critical = data.getUint32(offset, true); + offset += 4; + BATTERY_CONFIG.capacity_unit = data.getUint8(offset++); + break; case MSPCodes.MSP_3D: _3D.deadband3d_low = data.getUint16(offset, true); offset += 2; @@ -1294,6 +1365,62 @@ var mspHelper = (function (gui) { buffer.push(Math.round(MISC.vbatmaxcellvoltage * 10)); buffer.push(Math.round(MISC.vbatwarningcellvoltage * 10)); break; + case MSPCodes.MSPV2_INAV_SET_MISC: + buffer.push(lowByte(MISC.midrc)); + buffer.push(highByte(MISC.midrc)); + buffer.push(lowByte(MISC.minthrottle)); + buffer.push(highByte(MISC.minthrottle)); + buffer.push(lowByte(MISC.maxthrottle)); + buffer.push(highByte(MISC.maxthrottle)); + buffer.push(lowByte(MISC.mincommand)); + buffer.push(highByte(MISC.mincommand)); + buffer.push(lowByte(MISC.failsafe_throttle)); + buffer.push(highByte(MISC.failsafe_throttle)); + buffer.push(MISC.gps_type); + buffer.push(MISC.sensors_baudrate); + buffer.push(MISC.gps_ubx_sbas); + buffer.push(MISC.multiwiicurrentoutput); + buffer.push(MISC.rssi_channel); + buffer.push(MISC.placeholder2); + buffer.push(lowByte(Math.round(MISC.mag_declination * 10))); + buffer.push(highByte(Math.round(MISC.mag_declination * 10))); + buffer.push(lowByte(MISC.vbatscale)); + buffer.push(highByte(MISC.vbatscale)); + buffer.push(lowByte(Math.round(MISC.vbatmincellvoltage * 100))); + buffer.push(highByte(Math.round(MISC.vbatmincellvoltage * 100))); + buffer.push(lowByte(Math.round(MISC.vbatmaxcellvoltage * 100))); + buffer.push(highByte(Math.round(MISC.vbatmaxcellvoltage * 100))); + buffer.push(lowByte(Math.round(MISC.vbatwarningcellvoltage * 100))); + buffer.push(highByte(Math.round(MISC.vbatwarningcellvoltage * 100))); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(MISC.battery_capacity, byte_index)); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(MISC.battery_capacity_warning, byte_index)); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(MISC.battery_capacity_critical, byte_index)); + buffer.push(MISC.battery_capacity_unit); + break; + case MSPCodes.MSPV2_INAV_SET_BATTERY_CONFIG: + buffer.push(lowByte(BATTERY_CONFIG.vbatscale)); + buffer.push(highByte(BATTERY_CONFIG.vbatscale)); + buffer.push(lowByte(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 100))); + buffer.push(highByte(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 100))); + buffer.push(lowByte(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 100))); + buffer.push(highByte(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 100))); + buffer.push(lowByte(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 100))); + buffer.push(highByte(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 100))); + buffer.push(lowByte(BATTERY_CONFIG.current_offset)); + buffer.push(highByte(BATTERY_CONFIG.current_offset)); + buffer.push(lowByte(BATTERY_CONFIG.current_scale)); + buffer.push(highByte(BATTERY_CONFIG.current_scale)); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(BATTERY_CONFIG.capacity, byte_index)); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(BATTERY_CONFIG.capacity_warning, byte_index)); + for (byte_index = 0; byte_index < 4; ++byte_index) + buffer.push(specificByte(BATTERY_CONFIG.capacity_critical, byte_index)); + buffer.push(BATTERY_CONFIG.capacity_unit); + break; case MSPCodes.MSP_SET_RX_CONFIG: buffer.push(RX_CONFIG.serialrx_provider); @@ -2219,6 +2346,14 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_MISC, false, false, callback); }; + self.loadMiscV2 = function (callback) { + MSP.send_message(MSPCodes.MSPV2_INAV_MISC, false, false, callback); + }; + + self.loadBatteryConfig = function (callback) { + MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback); + }; + self.loadArmingConfig = function (callback) { MSP.send_message(MSPCodes.MSP_ARMING_CONFIG, false, false, callback); }; @@ -2331,6 +2466,14 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, callback); }; + self.saveMiscV2 = function (callback) { + MSP.send_message(MSPCodes.MSPV2_INAV_SET_MISC, mspHelper.crunch(MSPCodes.MSPV2_INAV_SET_MISC), false, callback); + }; + + self.saveBatteryConfig = function (callback) { + MSP.send_message(MSPCodes.MSPV2_SET_BATTERY_CONFIG, mspHelper.crunch(MSPCodes.MSPV2_SET_BATTERY_CONFIG), false, callback); + }; + self.save3dConfig = function (callback) { MSP.send_message(MSPCodes.MSP_SET_3D, mspHelper.crunch(MSPCodes.MSP_SET_3D), false, callback); }; diff --git a/js/periodicStatusUpdater.js b/js/periodicStatusUpdater.js index 8bb03b3b..87261030 100644 --- a/js/periodicStatusUpdater.js +++ b/js/periodicStatusUpdater.js @@ -61,18 +61,31 @@ helper.periodicStatusUpdater = (function () { } if (ANALOG != undefined) { - var nbCells = Math.floor(ANALOG.voltage / MISC.vbatmaxcellvoltage) + 1; - if (ANALOG.voltage == 0) - nbCells = 1; + var nbCells; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + nbCells = ANALOG.cell_count; + } else { + nbCells = Math.floor(ANALOG.voltage / MISC.vbatmaxcellvoltage) + 1; + if (ANALOG.voltage == 0) + nbCells = 1; + } var min = MISC.vbatmincellvoltage * nbCells; var max = MISC.vbatmaxcellvoltage * nbCells; var warn = MISC.vbatwarningcellvoltage * nbCells; - $(".battery-status").css({ - width: ((ANALOG.voltage - min) / (max - min) * 100) + "%", - display: 'inline-block' - }); + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + $(".battery-status").css({ + width: ANALOG.battery_percentage + "%", + display: 'inline-block' + }); + } else { + $(".battery-status").css({ + width: ((ANALOG.voltage - min) / (max - min) * 100) + "%", + display: 'inline-block' + }); + } if (active) { $(".linkicon").css({ @@ -123,11 +136,15 @@ helper.periodicStatusUpdater = (function () { MSP.send_message(MSPCodes.MSP_STATUS, false, false); } - MSP.send_message(MSPCodes.MSP_ANALOG, false, false); + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + MSP.send_message(MSPCodes.MSPV2_INAV_ANALOG, false, false); + } else { + MSP.send_message(MSPCodes.MSP_ANALOG, false, false); + } privateScope.updateView(); } }; return publicScope; -})(); \ No newline at end of file +})(); diff --git a/main.css b/main.css index 236bedc4..273d03e6 100644 --- a/main.css +++ b/main.css @@ -1669,7 +1669,7 @@ dialog { color: white; font-size: 10px; margin-top: 20px; - width: 90px; + width: 100px; float: right; margin-right: 20px; line-height: 12px; @@ -1761,6 +1761,7 @@ dialog { .bottomStatusIcons { background-color: #272727; height: 31px; + margin-left: 5px; margin-top: 2px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; diff --git a/tabs/configuration.html b/tabs/configuration.html index e5f34c3e..ee3f324f 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -382,23 +382,23 @@
    - +
    - +
    - +
    - + diff --git a/tabs/configuration.js b/tabs/configuration.js index 56c2fb97..589bb0ca 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -24,9 +24,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) { var loadChainer = new MSPChainerClass(); - loadChainer.setChain([ + var loadChain = [ mspHelper.loadBfConfig, - mspHelper.loadMisc, mspHelper.loadArmingConfig, mspHelper.loadLoopTime, mspHelper.loadRxConfig, @@ -36,15 +35,22 @@ TABS.configuration.initialize = function (callback, scrollPosition) { mspHelper.loadINAVPidConfig, mspHelper.loadSensorConfig, loadCraftName - ]); + ]; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + loadChain.push(mspHelper.loadMiscV2); + } else { + loadChain.push(mspHelper.loadMisc); + } + + loadChainer.setChain(loadChain); loadChainer.setExitPoint(load_html); loadChainer.execute(); var saveChainer = new MSPChainerClass(); - saveChainer.setChain([ + var saveChain = [ mspHelper.saveBfConfig, - mspHelper.saveMisc, mspHelper.save3dConfig, mspHelper.saveSensorAlignment, mspHelper.saveAccTrim, @@ -55,8 +61,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) { mspHelper.saveINAVPidConfig, mspHelper.saveSensorConfig, saveCraftName, - mspHelper.saveToEeprom - ]); + ]; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + saveChain.push(mspHelper.saveMiscV2); + } else { + saveChain.push(mspHelper.saveMisc); + } + + saveChain.push(mspHelper.saveToEeprom); + + saveChainer.setChain(saveChain); saveChainer.setExitPoint(reboot); function reboot() { @@ -309,6 +324,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('#maxthrottle').val(MISC.maxthrottle); $('#mincommand').val(MISC.mincommand); + // Battery thresholds resolution is 100mV and voltage scale max is 255 before 1.8.1 + if (semver.lt(CONFIG.flightControllerVersion, '1.8.1')) { + $('#mincellvoltage').attr('step', '0.1'); + $('#maxcellvoltage').attr('step', '0.1'); + $('#warningcellvoltage').attr('step', '0.1'); + $('#voltagescale').attr('max', '255'); + } + // fill battery $('#mincellvoltage').val(MISC.vbatmincellvoltage); $('#maxcellvoltage').val(MISC.vbatmaxcellvoltage); @@ -713,7 +736,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) { }); helper.interval.add('config_load_analog', function () { - $('#batteryvoltage').val([ANALOG.voltage.toFixed(1)]); + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + $('#batteryvoltage').val([ANALOG.voltage.toFixed(2)]); + } else { + $('#batteryvoltage').val([ANALOG.voltage.toFixed(1)]); + } $('#batterycurrent').val([ANALOG.amperage.toFixed(2)]); }, 100, true); // 10 fps GUI.content_ready(callback); From b132aa774ccea4dfa3d3b2afb0d79ac3ce3431b2 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sat, 17 Feb 2018 22:50:22 +0100 Subject: [PATCH 21/57] New 1.9 OSD items --- _locales/en/messages.json | 15 +++++++++++++++ tabs/osd.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 41a8ad07..64ced040 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2253,9 +2253,24 @@ "osdElement_MAIN_BATT_CELL_VOLTAGE": { "message": "Battery Cell Voltage" }, + "osdElement_MAIN_BATT_REMAINING_PERCENTAGE": { + "message": "Battery Remaining Percentage" + }, + "osdElement_MAIN_BATT_REMAINING_CAPACITY": { + "message": "Battery Remaining Capacity" + }, "osdElement_MAIN_BATT_CELL_VOLTAGE_HELP": { "message": "Shows the average cell voltage from the main battery" }, + "osdElement_MAH_DRAWN": { + "message": "mAh drawn" + }, + "osdElement_EFFICIENCY_MAH": { + "message": "Efficiency mAh/Km" + }, + "osdElement_EFFICIENCY_WH": { + "message": "Efficiency Wh/Km" + }, "osdElement_THROTTLE_POSITION_AUTO_THR": { "message": "Throttle Position / Auto Throttle" }, diff --git a/tabs/osd.js b/tabs/osd.js index 74208c26..4aa314e8 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -17,8 +17,11 @@ SYM.AH_BAR9_0 = 0x80; SYM.AH_DECORATION = 0x13; SYM.AMP = 0x9A; SYM.MAH = 0x07; +SYM.WH = 0xAB; SYM.MAH_KM_0 = 157; SYM.MAH_KM_1 = 158; +SYM.WH_KM_0 = 172; +SYM.WH_KM_1 = 173; SYM.GPS_SAT1 = 0x1E; SYM.GPS_SAT2 = 0x1F; SYM.GPS_HDP1 = 0xBD; @@ -402,6 +405,12 @@ OSD.constants = { min_version: '1.7.4', preview: FONT.symbol(SYM.VOLT) + FONT.embed_dot('3.90V') }, + { + name: 'MAIN_BATT_REMAINING_PERCENTAGE', + id: 38, + min_version: '1.8.1', + preview: '100%' + }, { name: 'THROTTLE_POSITION', id: 9, @@ -574,6 +583,12 @@ OSD.constants = { id: 12, preview: FONT.symbol(SYM.MAH) + '690 ' // 4 chars }, + { + name: 'WH_DRAWN', + id: 36, + min_version: '1.8.1', + preview: FONT.symbol(SYM.WH) + FONT.embed_dot('1.25') + }, { name: 'POWER', id: 19, @@ -581,10 +596,22 @@ OSD.constants = { preview: 'W50 ' // 3 chars }, { - name: 'EFFICIENCY', + name: 'MAIN_BATT_REMAINING_CAPACITY', + id: 37, + min_version: '1.8.1', + preview: FONT.symbol(SYM.MAH) + '690 ' // 4 chars + }, + { + name: 'EFFICIENCY_MAH', id: 35, min_version: '1.7.4', preview: "123" + FONT.symbol(SYM.MAH_KM_0) + FONT.symbol(SYM.MAH_KM_1) + }, + { + name: 'EFFICIENCY_WH', + id: 39, + min_version: '1.8.1', + preview: FONT.embed_dot('1.23') + FONT.symbol(SYM.WH_KM_0) + FONT.symbol(SYM.WH_KM_1) } ] }, From 6d922bee2c8210d98df7d68670f8c6e0d00ce141 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 18 Feb 2018 05:23:22 +0100 Subject: [PATCH 22/57] Add capacity settings and data --- _locales/en/messages.json | 51 +++++++++++++++++++++++++++++++++++++ js/fc.js | 8 ++++-- js/msp/MSPHelper.js | 15 ++++++----- js/periodicStatusUpdater.js | 2 +- tabs/configuration.html | 32 +++++++++++++++++++++++ tabs/configuration.js | 19 +++++++++++++- tabs/setup.html | 30 +++++++++++++++++++--- tabs/setup.js | 33 +++++++++++++++++++++--- 8 files changed, 174 insertions(+), 16 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 64ced040..d24b6401 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -406,6 +406,42 @@ "initialSetupBattery": { "message": "Battery voltage:" }, + "initialSetupBatteryDetectedCells": { + "message": "Battery detected cell count:" + }, + "initialSetupBatteryDetectedCellsValue": { + "message": "$1" + }, + "initialSetupBatteryPercentage": { + "message": "Battery left:" + }, + "initialSetupBatteryPercentageValue": { + "message": "$1 %" + }, + "initialSetupBatteryRemainingCapacity": { + "message": "Battery remaining capacity" + }, + "initialSetupBatteryRemainingCapacityValue": { + "message": "$1 $2" + }, + "initialSetupBatteryFull": { + "message": "Battery full when plugged in" + }, + "initialSetupBatteryFullValue": { + "message": "$1" + }, + "initialSetupBatteryThresholds": { + "message": "Battery use cap thresholds" + }, + "initialSetupBatteryThresholdsValue": { + "message": "$1" + }, + "initialSetup_Wh_drawn": { + "message": "Capacity drawn:" + }, + "initialSetup_Wh_drawnValue": { + "message": "$1 Wh" + }, "initialSetupBatteryValue": { "message": "$1 V" }, @@ -693,6 +729,21 @@ "configurationBatteryMultiwiiCurrent": { "message": "Enable support for legacy Multiwii MSP current output" }, + "configurationBatteryCapacity": { + "message": "Battery Capacity" + }, + "configurationBatteryCapacityValue": { + "message": "Capacity" + }, + "configurationBatteryCapacityWarning": { + "message": "Warning Capacity" + }, + "configurationBatteryCapacityCritical": { + "message": "Critical Capacity" + }, + "configurationBatteryCapacityUnit": { + "message": "Battery Capacity Unit" + }, "configuration3d": { "message": "3D" }, diff --git a/js/fc.js b/js/fc.js index 9656303e..79d280f1 100644 --- a/js/fc.js +++ b/js/fc.js @@ -221,7 +221,11 @@ var FC = { amperage: 0, power: 0, cell_count: 0, - battery_percentage: 0 + battery_percentage: 0, + battery_full_when_plugged_in: false, + use_capacity_thresholds: false, + battery_remaining_capacity: 0, + battery_flags: 0 }; ARMING_CONFIG = { @@ -253,7 +257,7 @@ var FC = { battery_capacity: 0, battery_capacity_warning: 0, battery_capacity_critical: 0, - battery_capacity_unit: 0 + battery_capacity_unit: 'mAh' }; BATTERY_CONFIG = { diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index a8188eb7..5d9e1cdc 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -251,6 +251,12 @@ var mspHelper = (function (gui) { offset += 2; ANALOG.amperage = data.getInt16(offset, true) / 100; // A offset += 2; + var battery_flags = data.getUint8(offset++); + ANALOG.battery_full_when_plugged_in = (battery_flags & 1 ? true : false); + ANALOG.use_capacity_thresholds = ((battery_flags & 2) >> 1 ? true : false); + ANALOG.battery_state = (battery_flags & 12) >> 2; + ANALOG.battery_remaining_capacity = data.getUint32(offset, true); + offset += 4; //noinspection JSValidateTypes dataHandler.analog_last_received_timestamp = Date.now(); break; @@ -330,7 +336,6 @@ var mspHelper = (function (gui) { MISC.sensors_baudrate = data.getUint8(offset++); MISC.gps_ubx_sbas = data.getInt8(offset++); MISC.rssi_channel = data.getUint8(offset++); - MISC.placeholder2 = data.getUint8(offset++); MISC.mag_declination = data.getInt16(offset, 1) / 10; // -18000-18000 offset += 2; MISC.vbatscale = data.getUint16(offset, true); @@ -347,7 +352,7 @@ var mspHelper = (function (gui) { offset += 4; MISC.battery_capacity_critical = data.getUint32(offset, true); offset += 4; - MISC.battery_capacity_unit = data.getUint8(offset++); + MISC.battery_capacity_unit = (data.getUint8(offset++) ? 'mWh' : 'mAh'); break; case MSPCodes.MSPV2_INAV_BATTERY_CONFIG: BATTERY_CONFIG.vbatscale = data.getUint16(offset, true); @@ -368,7 +373,7 @@ var mspHelper = (function (gui) { offset += 4; BATTERY_CONFIG.capacity_critical = data.getUint32(offset, true); offset += 4; - BATTERY_CONFIG.capacity_unit = data.getUint8(offset++); + BATTERY_CONFIG.battery_capacity_unit = (data.getUint8(offset++) ? 'mWh' : 'mAh'); break; case MSPCodes.MSP_3D: _3D.deadband3d_low = data.getUint16(offset, true); @@ -1379,9 +1384,7 @@ var mspHelper = (function (gui) { buffer.push(MISC.gps_type); buffer.push(MISC.sensors_baudrate); buffer.push(MISC.gps_ubx_sbas); - buffer.push(MISC.multiwiicurrentoutput); buffer.push(MISC.rssi_channel); - buffer.push(MISC.placeholder2); buffer.push(lowByte(Math.round(MISC.mag_declination * 10))); buffer.push(highByte(Math.round(MISC.mag_declination * 10))); buffer.push(lowByte(MISC.vbatscale)); @@ -1398,7 +1401,7 @@ var mspHelper = (function (gui) { buffer.push(specificByte(MISC.battery_capacity_warning, byte_index)); for (byte_index = 0; byte_index < 4; ++byte_index) buffer.push(specificByte(MISC.battery_capacity_critical, byte_index)); - buffer.push(MISC.battery_capacity_unit); + buffer.push((MISC.battery_capacity_unit == 'mAh') ? 0 : 1); break; case MSPCodes.MSPV2_INAV_SET_BATTERY_CONFIG: buffer.push(lowByte(BATTERY_CONFIG.vbatscale)); diff --git a/js/periodicStatusUpdater.js b/js/periodicStatusUpdater.js index 87261030..061af6da 100644 --- a/js/periodicStatusUpdater.js +++ b/js/periodicStatusUpdater.js @@ -97,7 +97,7 @@ helper.periodicStatusUpdater = (function () { }); } - if (ANALOG.voltage < warn) { + if (((semver.gte(CONFIG.flightControllerVersion, '1.8.1')) && (((ANALOG.use_capacity_thresholds) && (ANALOG.battery_remaining_capacity <= (MISC.battery_capacity_warning - MISC.battery_capacity_critical))) || ((!ANALOG.use_capacity_thresholds) && (ANALOG.voltage < warn))) || (ANALOG.voltage < min)) || ((semver.lt(CONFIG.flightControllerVersion, '1.8.1')) && (ANALOG.voltage < warn))) { $(".battery-status").css('background-color', '#D42133'); } else { $(".battery-status").css('background-color', '#59AA29'); diff --git a/tabs/configuration.html b/tabs/configuration.html index ee3f324f..6de6fbba 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -445,6 +445,38 @@
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    diff --git a/tabs/configuration.js b/tabs/configuration.js index 589bb0ca..601306ad 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -332,7 +332,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('#voltagescale').attr('max', '255'); } - // fill battery + // fill battery voltage $('#mincellvoltage').val(MISC.vbatmincellvoltage); $('#maxcellvoltage').val(MISC.vbatmaxcellvoltage); $('#warningcellvoltage').val(MISC.vbatwarningcellvoltage); @@ -343,6 +343,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('#currentoffset').val(BF_CONFIG.currentoffset); $('#multiwiicurrentoutput').prop('checked', MISC.multiwiicurrentoutput); + // fill battery capacity + $('#battery_capacity').val(MISC.battery_capacity); + $('#battery_capacity_warning').val(MISC.battery_capacity_warning); + $('#battery_capacity_critical').val(MISC.battery_capacity_critical); + $('#battery_capacity_unit').val(MISC.battery_capacity_unit); + var escProtocols = FC.getEscProtocols(); var servoRates = FC.getServoRates(); @@ -587,6 +593,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $(".requires-v1_7").hide(); } + if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) { + $(".requires-v1_8_1").show(); + } else { + $(".requires-v1_8_1").hide(); + } + $('#3ddeadbandlow').val(_3D.deadband3d_low); $('#3ddeadbandhigh').val(_3D.deadband3d_high); $('#3dneutral').val(_3D.neutral3d); @@ -664,6 +676,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) { MISC.vbatwarningcellvoltage = parseFloat($('#warningcellvoltage').val()); MISC.vbatscale = parseInt($('#voltagescale').val()); + MISC.battery_capacity = parseInt($('#battery_capacity').val()); + MISC.battery_capacity_warning = parseInt($('#battery_capacity_warning').val()); + MISC.battery_capacity_critical = parseInt($('#battery_capacity_critical').val()); + MISC.battery_capacity_unit = $('#battery_capacity_unit').val(); + BF_CONFIG.currentscale = parseInt($('#currentscale').val()); BF_CONFIG.currentoffset = parseInt($('#currentoffset').val()); MISC.multiwiicurrentoutput = ~~$('#multiwiicurrentoutput').is(':checked'); // ~~ boolean to decimal conversion diff --git a/tabs/setup.html b/tabs/setup.html index be54d626..34c6f752 100644 --- a/tabs/setup.html +++ b/tabs/setup.html @@ -89,17 +89,41 @@
    + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + diff --git a/tabs/setup.js b/tabs/setup.js index b2705664..b2b44d51 100755 --- a/tabs/setup.js +++ b/tabs/setup.js @@ -15,11 +15,18 @@ TABS.setup.initialize = function (callback) { var loadChainer = new MSPChainerClass(); - loadChainer.setChain([ + var loadChain = [ mspHelper.loadBfConfig, - mspHelper.loadMisc, mspHelper.queryFcStatus - ]); + ]; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + loadChain.push(mspHelper.loadMiscV2); + } else { + loadChain.push(mspHelper.loadMisc); + } + + loadChainer.setChain(loadChain); loadChainer.setExitPoint(load_html); loadChainer.execute(); @@ -77,7 +84,13 @@ TABS.setup.initialize = function (callback) { // cached elements var bat_voltage_e = $('.bat-voltage'), + bat_percent_e = $('.bat-percent'), + bat_remaining_e = $('.bat-remain-cap'), + bat_cells_e = $('.bat-cells'), + bat_thresh_e = $('.bat-thresh'), + bat_full_e = $('.bat-full'), bat_mah_drawn_e = $('.bat-mah-drawn'), + bat_mwh_drawn_e = $('.bat-mwh-drawn'), bat_mah_drawing_e = $('.bat-mah-drawing'), rssi_e = $('.rssi'), gpsFix_e = $('.gpsFixType'), @@ -133,9 +146,23 @@ TABS.setup.initialize = function (callback) { helper.mspBalancedInterval.add('setup_data_pull_fast', 40, 1, get_fast_data); helper.mspBalancedInterval.add('setup_data_pull_slow', 250, 1, get_slow_data); + if (semver.lt(CONFIG.flightControllerVersion, '1.8.1')) { + $('.requires-v1_8_1').hide(); + } + helper.interval.add('gui_analog_update', function () { + bat_cells_e.text(chrome.i18n.getMessage('initialSetupBatteryDetectedCellsValue', [ANALOG.cell_count])); bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage])); + remaining_capacity_wh_decimals = ANALOG.battery_remaining_capacity.toString().length < 5 ? 3 : (7 - ANALOG.battery_remaining_capacity.toString().length); + remaining_capacity_value = MISC.battery_capacity_unit == 'mAh' ? ANALOG.battery_remaining_capacity : (ANALOG.battery_remaining_capacity / 1000).toFixed(remaining_capacity_wh_decimals < 0 ? 0 : remaining_capacity_wh_decimals); + remaining_capacity_unit = MISC.battery_capacity_unit == 'mAh' ? 'mAh' : 'Wh'; + bat_remaining_e.text(chrome.i18n.getMessage('initialSetupBatteryRemainingCapacityValue', ((MISC.battery_capacity > 0) && ANALOG.battery_full_when_plugged_in) ? [remaining_capacity_value, remaining_capacity_unit] : ['NA', ''])); + bat_percent_e.text(chrome.i18n.getMessage('initialSetupBatteryPercentageValue', [ANALOG.battery_percentage])); + bat_full_e.text(chrome.i18n.getMessage('initialSetupBatteryFullValue', [ANALOG.battery_full_when_plugged_in])); + bat_thresh_e.text(chrome.i18n.getMessage('initialSetupBatteryThresholdsValue', [ANALOG.use_capacity_thresholds])); bat_mah_drawn_e.text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn])); + capacity_drawn_decimals = ANALOG.mWhdrawn.toString().length < 5 ? 3 : (7 - ANALOG.mWhdrawn.toString().length); + bat_mwh_drawn_e.text(chrome.i18n.getMessage('initialSetup_Wh_drawnValue', [(ANALOG.mWhdrawn / 1000).toFixed(capacity_drawn_decimals < 0 ? 0 : capacity_drawn_decimals)])); bat_mah_drawing_e.text(chrome.i18n.getMessage('initialSetupBatteryAValue', [ANALOG.amperage.toFixed(2)])); rssi_e.text(chrome.i18n.getMessage('initialSetupRSSIValue', [((ANALOG.rssi / 1023) * 100).toFixed(0)])); }, 100, true); From b6dc007bd8225f008d5cd0afa8bf71e4444842bf Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 18 Feb 2018 06:08:59 +0100 Subject: [PATCH 23/57] Reflect MSP2 changes --- js/fc.js | 8 ++++++-- js/msp/MSPHelper.js | 11 +++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/fc.js b/js/fc.js index 9656303e..79d280f1 100644 --- a/js/fc.js +++ b/js/fc.js @@ -221,7 +221,11 @@ var FC = { amperage: 0, power: 0, cell_count: 0, - battery_percentage: 0 + battery_percentage: 0, + battery_full_when_plugged_in: false, + use_capacity_thresholds: false, + battery_remaining_capacity: 0, + battery_flags: 0 }; ARMING_CONFIG = { @@ -253,7 +257,7 @@ var FC = { battery_capacity: 0, battery_capacity_warning: 0, battery_capacity_critical: 0, - battery_capacity_unit: 0 + battery_capacity_unit: 'mAh' }; BATTERY_CONFIG = { diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index a8188eb7..9c37a864 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -251,6 +251,12 @@ var mspHelper = (function (gui) { offset += 2; ANALOG.amperage = data.getInt16(offset, true) / 100; // A offset += 2; + var battery_flags = data.getUint8(offset++); + ANALOG.battery_full_when_plugged_in = (battery_flags & 1 ? true : false); + ANALOG.use_capacity_thresholds = ((battery_flags & 2) >> 1 ? true : false); + ANALOG.battery_state = (battery_flags & 12) >> 2; + ANALOG.battery_remaining_capacity = data.getUint32(offset, true); + offset += 4; //noinspection JSValidateTypes dataHandler.analog_last_received_timestamp = Date.now(); break; @@ -330,7 +336,6 @@ var mspHelper = (function (gui) { MISC.sensors_baudrate = data.getUint8(offset++); MISC.gps_ubx_sbas = data.getInt8(offset++); MISC.rssi_channel = data.getUint8(offset++); - MISC.placeholder2 = data.getUint8(offset++); MISC.mag_declination = data.getInt16(offset, 1) / 10; // -18000-18000 offset += 2; MISC.vbatscale = data.getUint16(offset, true); @@ -347,7 +352,7 @@ var mspHelper = (function (gui) { offset += 4; MISC.battery_capacity_critical = data.getUint32(offset, true); offset += 4; - MISC.battery_capacity_unit = data.getUint8(offset++); + MISC.battery_capacity_unit = (data.getUint8(offset++) ? 'Wh' : 'mAh'); break; case MSPCodes.MSPV2_INAV_BATTERY_CONFIG: BATTERY_CONFIG.vbatscale = data.getUint16(offset, true); @@ -1379,9 +1384,7 @@ var mspHelper = (function (gui) { buffer.push(MISC.gps_type); buffer.push(MISC.sensors_baudrate); buffer.push(MISC.gps_ubx_sbas); - buffer.push(MISC.multiwiicurrentoutput); buffer.push(MISC.rssi_channel); - buffer.push(MISC.placeholder2); buffer.push(lowByte(Math.round(MISC.mag_declination * 10))); buffer.push(highByte(Math.round(MISC.mag_declination * 10))); buffer.push(lowByte(MISC.vbatscale)); From b49e0ad8cc5b2180dcc05b810a7665b0fa5e2471 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 18 Feb 2018 06:15:30 +0100 Subject: [PATCH 24/57] Remove the Multiwii current format option --- tabs/configuration.html | 6 ------ tabs/configuration.js | 2 -- 2 files changed, 8 deletions(-) diff --git a/tabs/configuration.html b/tabs/configuration.html index ee3f324f..cc00fac4 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -437,12 +437,6 @@ -
    - - -
    diff --git a/tabs/configuration.js b/tabs/configuration.js index 589bb0ca..e9fbe23a 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -341,7 +341,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { // fill current $('#currentscale').val(BF_CONFIG.currentscale); $('#currentoffset').val(BF_CONFIG.currentoffset); - $('#multiwiicurrentoutput').prop('checked', MISC.multiwiicurrentoutput); var escProtocols = FC.getEscProtocols(); var servoRates = FC.getServoRates(); @@ -666,7 +665,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { BF_CONFIG.currentscale = parseInt($('#currentscale').val()); BF_CONFIG.currentoffset = parseInt($('#currentoffset').val()); - MISC.multiwiicurrentoutput = ~~$('#multiwiicurrentoutput').is(':checked'); // ~~ boolean to decimal conversion _3D.deadband3d_low = parseInt($('#3ddeadbandlow').val()); _3D.deadband3d_high = parseInt($('#3ddeadbandhigh').val()); From f9c970b4c0c24b901e28817cded482656d870221 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Fri, 26 Jan 2018 00:51:26 +0100 Subject: [PATCH 25/57] MSP: add support for MSPV2_INAV_RATE_PROFILE and MSPV2_INAV_SET_RATE_PROFILE frame types --- js/fc.js | 7 +++++- js/msp/MSPCodes.js | 5 ++-- js/msp/MSPHelper.js | 56 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/js/fc.js b/js/fc.js index 79d280f1..3ac89f97 100644 --- a/js/fc.js +++ b/js/fc.js @@ -143,7 +143,12 @@ var FC = { throttle_MID: 0, throttle_EXPO: 0, dynamic_THR_breakpoint: 0, - RC_YAW_EXPO: 0 + RC_YAW_EXPO: 0, + manual_RC_EXPO: 0, + manual_RC_YAW_EXPO: 0, + manual_roll_rate: 0, + manual_pitch_rate: 0, + manual_yaw_rate: 0, }; AUX_CONFIG = []; diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 2d3dba51..3ae4719a 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -161,6 +161,7 @@ var MSPCodes = { MSPV2_INAV_MISC: 0x2003, MSPV2_INAV_SET_MISC: 0x2004, MSPV2_INAV_BATTERY_CONFIG: 0x2005, - MSPV2_INAV_SET_BATTERY_CONFIG: 0x2006 - + MSPV2_INAV_SET_BATTERY_CONFIG: 0x2006, + MSPV2_INAV_RATE_PROFILE: 0x2007, + MSPV2_INAV_SET_RATE_PROFILE: 0x2008, }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 9c37a864..a0165610 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -282,6 +282,32 @@ var mspHelper = (function (gui) { offset += 2; RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); break; + case MSPCodes.MSPV2_INAV_RATE_PROFILE: + // compat + RC_tuning.RC_RATE = 100; + RC_tuning.roll_pitch_rate = 0; + + // throttle + RC_tuning.throttle_MID = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.throttle_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.dynamic_THR_PID = parseInt(data.getUint8(offset++)); + RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset, true); + offset += 2; + + // stabilized + RC_tuning.RC_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.roll_rate = data.getUint8(offset++) * 10; + RC_tuning.pitch_rate = data.getUint8(offset++) * 10; + RC_tuning.yaw_rate = data.getUint8(offset++) * 10; + + // manual + RC_tuning.manual_RC_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.manual_RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + RC_tuning.manual_roll_rate = data.getUint8(offset++); + RC_tuning.manual_pitch_rate = data.getUint8(offset++); + RC_tuning.manual_yaw_rate = data.getUint8(offset++); + break; case MSPCodes.MSP_PID: // PID data arrived, we need to scale it and save to appropriate bank / array for (i = 0, needle = 0; i < (dataHandler.message_length_expected / 3); i++, needle += 3) { @@ -1326,6 +1352,28 @@ var mspHelper = (function (gui) { buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint)); buffer.push(Math.round(RC_tuning.RC_YAW_EXPO * 100)); break; + case MSPCodes.MSPV2_INAV_SET_RATE_PROFILE: + // throttle + buffer.push(Math.round(RC_tuning.throttle_MID * 100)); + buffer.push(Math.round(RC_tuning.throttle_EXPO * 100)); + buffer.push(RC_tuning.dynamic_THR_PID); + buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint)); + buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint)); + + // stabilized + buffer.push(Math.round(RC_tuning.RC_EXPO * 100)); + buffer.push(Math.round(RC_tuning.RC_YAW_EXPO * 100)); + buffer.push(Math.round(RC_tuning.roll_rate / 10)); + buffer.push(Math.round(RC_tuning.pitch_rate / 10)); + buffer.push(Math.round(RC_tuning.yaw_rate / 10)); + + // manual + buffer.push(Math.round(RC_tuning.manual_RC_EXPO * 100)); + buffer.push(Math.round(RC_tuning.manual_RC_YAW_EXPO * 100)); + buffer.push(RC_tuning.manual_roll_rate); + buffer.push(RC_tuning.manual_pitch_rate); + buffer.push(RC_tuning.manual_yaw_rate); + break; case MSPCodes.MSP_SET_RX_MAP: for (i = 0; i < RC_MAP.length; i++) { @@ -2325,6 +2373,10 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, callback); }; + self.loadRateProfileData = function (callback) { + MSP.send_message(MSPCodes.MSPV2_INAV_RATE_PROFILE, false, false, callback); + }; + self.loadPidData = function (callback) { MSP.send_message(MSPCodes.MSP_PID, false, false, callback); }; @@ -2453,6 +2505,10 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, callback); }; + self.saveRateProfileData = function (callback) { + MSP.send_message(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE, mspHelper.crunch(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE), false, callback); + }; + self.savePidAdvanced = function (callback) { if (semver.gte(CONFIG.flightControllerVersion, "1.4.0")) { MSP.send_message(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED), false, callback); From 020336694cb83ec40e87651a35eb725bb27171a8 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Fri, 26 Jan 2018 00:53:22 +0100 Subject: [PATCH 26/57] Add manual mode rate settings to the PID tuning tab --- _locales/en/messages.json | 9 +++++++++ tabs/pid_tuning.html | 18 ++++++++++++++++++ tabs/pid_tuning.js | 27 +++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 64ced040..99c87343 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -835,6 +835,15 @@ "pidTuningYawRate": { "message": "YAW rate" }, + "pidTuningManualRollRate": { + "message": "Manual ROLL rate" + }, + "pidTuningManualPitchRate": { + "message": "Manual PITCH rate" + }, + "pidTuningManualYawRate": { + "message": "Manual YAW rate" + }, "magHoldYawRate": { "message": "MagHold rate" }, diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 9e8cde35..a3da4fc2 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -167,6 +167,24 @@ degrees per second
    + + + + + + + + + + + + -
    0
    0 V
    0 %
    NA
    0
    0
    0.00 A
    0 mAh
    0.00 A
    0 Wh
    + % +
    + % +
    + % +
    diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 35cb7373..55dc76ab 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -9,14 +9,21 @@ TABS.pid_tuning.initialize = function (callback) { var loadChainer = new MSPChainerClass(); - loadChainer.setChain([ + var loadChain = [ mspHelper.loadPidNames, mspHelper.loadPidData, - mspHelper.loadRcTuningData, mspHelper.loadINAVPidConfig, mspHelper.loadPidAdvanced, mspHelper.loadFilterConfig - ]); + ]; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + loadChain.push(mspHelper.loadRateProfileData); + } else { + loadChain.push(mspHelper.loadRcTuningData); + } + + loadChainer.setChain(loadChain); loadChainer.setExitPoint(load_html); loadChainer.execute(); @@ -58,6 +65,10 @@ TABS.pid_tuning.initialize = function (callback) { $('.rate-tpa input[name="yaw"]').val(RC_tuning.yaw_rate.toFixed(2)); } + $('.rate-tpa input[name="manual_roll"]').val(RC_tuning.manual_roll_rate); + $('.rate-tpa input[name="manual_pitch"]').val(RC_tuning.manual_pitch_rate); + $('.rate-tpa input[name="manual_yaw"]').val(RC_tuning.manual_yaw_rate); + $('#tpa').val(RC_tuning.dynamic_THR_PID); $('#tpa-breakpoint').val(RC_tuning.dynamic_THR_breakpoint); } @@ -80,6 +91,10 @@ TABS.pid_tuning.initialize = function (callback) { RC_tuning.yaw_rate = parseFloat($('.rate-tpa input[name="yaw"]:visible').val()); RC_tuning.dynamic_THR_PID = parseInt($('#tpa').val()); RC_tuning.dynamic_THR_breakpoint = parseInt($('#tpa-breakpoint').val()); + + RC_tuning.manual_roll_rate = $('.rate-tpa input[name="manual_roll"]:visible').val(); + RC_tuning.manual_pitch_rate = $('.rate-tpa input[name="manual_pitch"]:visible').val(); + RC_tuning.manual_yaw_rate = $('.rate-tpa input[name="manual_yaw"]:visible').val(); } function hideUnusedPids(sensors_detected) { $('.tab-pid_tuning table.pid_tuning').hide(); @@ -231,7 +246,11 @@ TABS.pid_tuning.initialize = function (callback) { } function send_rc_tuning_changes() { - MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, saveINAVPidConfig); + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + MSP.send_message(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE, mspHelper.crunch(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE), false, saveINAVPidConfig); + } else { + MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, saveINAVPidConfig); + } } function saveINAVPidConfig() { From 76c6de70db98e7ee6fa3993dd62381927d9a955a Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Fri, 26 Jan 2018 00:54:01 +0100 Subject: [PATCH 27/57] Add manual mode expo settings to the receiver tab --- _locales/en/messages.json | 8 +++++- src/css/tabs/receiver.css | 13 +++++++++- tabs/receiver.html | 27 ++++++++++++++++----- tabs/receiver.js | 51 ++++++++++++++++++++++++++++++++++++--- 4 files changed, 87 insertions(+), 12 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 99c87343..d3bc94c1 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -902,9 +902,15 @@ "receiverRcExpo": { "message": "RC Expo" }, - "receiverRcYawExpo": { + "receiverRcYawExpo": { "message": "RC Yaw Expo" }, + "receiverManualRcExpo": { + "message": "Manual RC Expo" + }, + "receiverManualRcYawExpo": { + "message": "Manual RC Yaw Expo" + }, "receiverChannelMap": { "message": "Channel Map" }, diff --git a/src/css/tabs/receiver.css b/src/css/tabs/receiver.css index a2c0e7ba..8c6a9adf 100644 --- a/src/css/tabs/receiver.css +++ b/src/css/tabs/receiver.css @@ -330,6 +330,17 @@ background-position: center; } +.tab-receiver .manual_pitch_roll_curve { + margin: 0 0px 0px 0; + width: 200px; + height: 117px; + border: 1px solid silver; + border-radius: 3px; + background-image: url(../../../images/paper.jpg); + background-size: 200%; + background-position: center; +} + .tab-receiver #RX_plot { width: 100%; height: 200px; @@ -432,4 +443,4 @@ stroke: none; fill: #828885; font-size: 10px; -} \ No newline at end of file +} diff --git a/tabs/receiver.html b/tabs/receiver.html index 6e2cbb99..aee4869c 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -74,26 +74,41 @@
    -
    -
    - -
    +
    + + + + + +
    +
    + +
    +
    +
    + +
    +
    -
    +
    + +
    + +
    @@ -124,4 +139,4 @@
    -
    \ No newline at end of file +
    diff --git a/tabs/receiver.js b/tabs/receiver.js index 0681f658..fa7d39db 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -16,14 +16,21 @@ TABS.receiver.initialize = function (callback) { var loadChainer = new MSPChainerClass(); - loadChainer.setChain([ - mspHelper.loadRcTuningData, + var loadChain = [ mspHelper.loadMisc, mspHelper.loadRcData, mspHelper.loadRcMap, mspHelper.loadBfConfig, mspHelper.loadRcDeadband - ]); + ]; + + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + loadChain.push(mspHelper.loadRateProfileData); + } else { + loadChain.push(mspHelper.loadRcTuningData); + } + + loadChainer.setChain(loadChain); loadChainer.setExitPoint(load_html); loadChainer.execute(); @@ -42,6 +49,9 @@ TABS.receiver.initialize = function (callback) { $('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2)); $('.tunings .yaw_rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); + $('.tunings .rate input[name="manual_expo"]').val(RC_tuning.manual_RC_EXPO.toFixed(2)); + $('.tunings .yaw_rate input[name="manual_yaw_expo"]').val(RC_tuning.manual_RC_YAW_EXPO.toFixed(2)); + $('.deadband input[name="yaw_deadband"]').val(RC_deadband.yaw_deadband); $('.deadband input[name="deadband"]').val(RC_deadband.deadband); @@ -248,6 +258,32 @@ TABS.receiver.initialize = function (callback) { }, 0); }).trigger('input'); + $('.tunings .rate input').on('input change', function () { + setTimeout(function () { // let global validation trigger and adjust the values first + var expoE = $('.tunings .rate input[name="manual_expo"]'), + expo = parseFloat(expoE.val()), + pitch_roll_curve = $('.manual_pitch_roll_curve canvas').get(0), + context = pitch_roll_curve.getContext("2d"); + + // local validation to deal with input event + if (expo >= parseFloat(expoE.prop('min')) && + expo <= parseFloat(expoE.prop('max'))) { + // continue + } else { + return; + } + + // draw + context.clearRect(0, 0, 200, rateHeight); + context.beginPath(); + context.moveTo(0, rateHeight); + context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expo)), 200, 0); + context.lineWidth = 2; + context.strokeStyle = '#37a8db'; + context.stroke(); + }, 0); + }).trigger('input'); + $('a.refresh').click(function () { MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, function () { GUI.log(chrome.i18n.getMessage('receiverDataRefreshed')); @@ -272,6 +308,9 @@ TABS.receiver.initialize = function (callback) { RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val()); RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="yaw_expo"]').val()); + RC_tuning.manual_RC_EXPO = parseFloat($('.tunings .rate input[name="manual_expo"]').val()); + RC_tuning.manual_RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="manual_yaw_expo"]').val()); + RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val()); RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val()); @@ -309,7 +348,11 @@ TABS.receiver.initialize = function (callback) { }); } - MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, save_rc_map); + if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { + MSP.send_message(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE, mspHelper.crunch(MSPCodes.MSPV2_INAV_SET_RATE_PROFILE), false, save_rc_map); + } else { + MSP.send_message(MSPCodes.MSP_SET_RC_TUNING, mspHelper.crunch(MSPCodes.MSP_SET_RC_TUNING), false, save_rc_map); + } }); $("a.sticks").click(function () { From a33e48550bf826f82a62a78fb7fa35ded566624a Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 18 Feb 2018 17:16:27 +1000 Subject: [PATCH 28/57] Draw auto and manual expo curves on the same canvas --- tabs/receiver.html | 5 --- tabs/receiver.js | 79 ++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 47 deletions(-) diff --git a/tabs/receiver.html b/tabs/receiver.html index aee4869c..bc891347 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -82,11 +82,6 @@
    -
    - -
    -
    diff --git a/tabs/receiver.js b/tabs/receiver.js index fa7d39db..5115b8c9 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -38,6 +38,41 @@ TABS.receiver.initialize = function (callback) { $('#content').load("./tabs/receiver.html", process_html); } + function drawRollPitchExpo() { + var pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); + var context = pitch_roll_curve.getContext("2d"); + + var expoAVal = $('.tunings .rate input[name="expo"]'); + var expoA = parseFloat(expoAVal.val()); + + var expoMVal = $('.tunings .rate input[name="manual_expo"]'); + var expoM = parseFloat(expoMVal.val()); + + if (expoA <= parseFloat(expoAVal.prop('min')) || expoA >= parseFloat(expoAVal.prop('max')) || + expoM <= parseFloat(expoMVal.prop('min')) || expoM >= parseFloat(expoMVal.prop('max'))) { + return; + } + + var rateHeight = TABS.receiver.rateChartHeight; + + // draw + context.clearRect(0, 0, 200, rateHeight); + + context.beginPath(); + context.moveTo(0, rateHeight); + context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoA)), 200, 0); + context.lineWidth = 2; + context.strokeStyle = '#37a8db'; + context.stroke(); + + context.beginPath(); + context.moveTo(0, rateHeight); + context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoM)), 200, 0); + context.lineWidth = 2; + context.strokeStyle = '#a837db'; + context.stroke(); + } + function process_html() { // translate to user-selected language localize(); @@ -234,53 +269,13 @@ TABS.receiver.initialize = function (callback) { $('.tunings .rate input').on('input change', function () { setTimeout(function () { // let global validation trigger and adjust the values first - var expoE = $('.tunings .rate input[name="expo"]'), - expo = parseFloat(expoE.val()), - pitch_roll_curve = $('.pitch_roll_curve canvas').get(0), - context = pitch_roll_curve.getContext("2d"); - - // local validation to deal with input event - if (expo >= parseFloat(expoE.prop('min')) && - expo <= parseFloat(expoE.prop('max'))) { - // continue - } else { - return; - } - - // draw - context.clearRect(0, 0, 200, rateHeight); - context.beginPath(); - context.moveTo(0, rateHeight); - context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expo)), 200, 0); - context.lineWidth = 2; - context.strokeStyle = '#37a8db'; - context.stroke(); + drawRollPitchExpo(); }, 0); }).trigger('input'); $('.tunings .rate input').on('input change', function () { setTimeout(function () { // let global validation trigger and adjust the values first - var expoE = $('.tunings .rate input[name="manual_expo"]'), - expo = parseFloat(expoE.val()), - pitch_roll_curve = $('.manual_pitch_roll_curve canvas').get(0), - context = pitch_roll_curve.getContext("2d"); - - // local validation to deal with input event - if (expo >= parseFloat(expoE.prop('min')) && - expo <= parseFloat(expoE.prop('max'))) { - // continue - } else { - return; - } - - // draw - context.clearRect(0, 0, 200, rateHeight); - context.beginPath(); - context.moveTo(0, rateHeight); - context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expo)), 200, 0); - context.lineWidth = 2; - context.strokeStyle = '#37a8db'; - context.stroke(); + drawRollPitchExpo(); }, 0); }).trigger('input'); From 431d9937a734dfd9bb5ce7f328ee8885f2c2a2b8 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 18 Feb 2018 17:26:58 +1000 Subject: [PATCH 29/57] Fix uneven column width --- src/css/tabs/receiver.css | 12 +----------- tabs/receiver.html | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/css/tabs/receiver.css b/src/css/tabs/receiver.css index 8c6a9adf..a8e9f417 100644 --- a/src/css/tabs/receiver.css +++ b/src/css/tabs/receiver.css @@ -176,6 +176,7 @@ color: white; border-right: 1px solid silver; font-weight: normal; + width: 50%; } .tab-receiver .tunings table th:first-child { @@ -330,17 +331,6 @@ background-position: center; } -.tab-receiver .manual_pitch_roll_curve { - margin: 0 0px 0px 0; - width: 200px; - height: 117px; - border: 1px solid silver; - border-radius: 3px; - background-image: url(../../../images/paper.jpg); - background-size: 200%; - background-position: center; -} - .tab-receiver #RX_plot { width: 100%; height: 200px; diff --git a/tabs/receiver.html b/tabs/receiver.html index bc891347..958a10ea 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -85,7 +85,7 @@
    -
    +
    From 82f65b8b9d11a5140932f9268f325dfafed3cd19 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 18 Feb 2018 17:30:27 +1000 Subject: [PATCH 30/57] Bump version to 1.9.1 --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 67cc8740..538dae09 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "minimum_chrome_version": "38", - "version": "1.9.0", + "version": "1.9.1", "author": "Several", "name": "INAV - Configurator", "short_name": "INAV", diff --git a/package.json b/package.json index a484cffe..118dbc4a 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "inav-configurator", "description": "INAV Configurator", - "version": "1.9.0", + "version": "1.9.1", "main": "main.html", "default_locale": "en", "scripts": { From 6bd0cd2d0adc626c14fb01ac66cacfe1c3afb25a Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 18 Feb 2018 23:22:31 +1000 Subject: [PATCH 31/57] Enable CRAFT_NAME item in OSD --- js/fc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/fc.js b/js/fc.js index 3ac89f97..93a84085 100644 --- a/js/fc.js +++ b/js/fc.js @@ -888,7 +888,7 @@ var FC = { } }, getOsdDisabledFields: function () { - return ['CRAFT_NAME']; + return []; }, getAccelerometerNames: function () { return [ "NONE", "AUTO", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "MPU9250", "FAKE"]; From 5652fe0497c70f6aeeb457962651b694a5337214 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Mon, 19 Feb 2018 15:50:10 +0100 Subject: [PATCH 32/57] Fix expo curves issue --- tabs/receiver.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tabs/receiver.js b/tabs/receiver.js index 5115b8c9..7ea25775 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -273,12 +273,6 @@ TABS.receiver.initialize = function (callback) { }, 0); }).trigger('input'); - $('.tunings .rate input').on('input change', function () { - setTimeout(function () { // let global validation trigger and adjust the values first - drawRollPitchExpo(); - }, 0); - }).trigger('input'); - $('a.refresh').click(function () { MSP.send_message(MSPCodes.MSP_RC_TUNING, false, false, function () { GUI.log(chrome.i18n.getMessage('receiverDataRefreshed')); From 08a580cb229b4878c81fd2e791a6b276f1b12aa5 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Mon, 19 Feb 2018 20:14:51 +0100 Subject: [PATCH 33/57] Fix typo in MSPV2_INAV_MISC decoding --- js/msp/MSPHelper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 39206ce9..f410e6cf 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -378,7 +378,7 @@ var mspHelper = (function (gui) { offset += 4; MISC.battery_capacity_critical = data.getUint32(offset, true); offset += 4; - MISC.battery_capacity_unit = (data.getUint8(offset++) ? 'Wh' : 'mAh'); + MISC.battery_capacity_unit = (data.getUint8(offset++) ? 'mWh' : 'mAh'); break; case MSPCodes.MSPV2_INAV_BATTERY_CONFIG: BATTERY_CONFIG.vbatscale = data.getUint16(offset, true); From cb321db57d6556c85fe5e2059b14cc37a940f27b Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sat, 24 Feb 2018 17:57:07 +0100 Subject: [PATCH 34/57] Add feature for enabling/disabling profile selection by TX stick command --- _locales/en/messages.json | 3 +++ js/fc.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 92cfa8bf..684d5c7f 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -519,6 +519,9 @@ "featureVBAT": { "message": "Battery voltage monitoring" }, + "featureTX_PROF_SEL": { + "message": "Profile selection with TX stick command" + }, "featureINFLIGHT_ACC_CAL": { "message": "In-flight level calibration" }, diff --git a/js/fc.js b/js/fc.js index 93a84085..144d4495 100644 --- a/js/fc.js +++ b/js/fc.js @@ -547,7 +547,8 @@ var FC = { if (semver.gte(CONFIG.flightControllerVersion, '1.8.1')) { features.push( - {bit: 30, group: 'other', name: 'FW_LAUNCH', haveTip: false, showNameInTip: false} + {bit: 30, group: 'other', name: 'FW_LAUNCH', haveTip: false, showNameInTip: false}, + {bit: 2, group: 'other', name: 'TX_PROF_SEL', haveTip: false, showNameInTip: false} ); } From 5b8cfc078b027d5db96b999fe668bbba55a0a983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Mon, 26 Feb 2018 21:34:35 +0000 Subject: [PATCH 35/57] Load SENSOR_CONFIG before loading the calibration UI Otherwise the mag is not properly detected and the compass calibration button is grayed out. --- tabs/calibration.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tabs/calibration.js b/tabs/calibration.js index 221acc9a..ab753d99 100755 --- a/tabs/calibration.js +++ b/tabs/calibration.js @@ -55,6 +55,7 @@ TABS.calibration.initialize = function (callback) { if (semver.gte(CONFIG.flightControllerVersion, "1.8.1")) { loadChainer.setChain([ mspHelper.loadStatus, + mspHelper.loadSensorConfig, mspHelper.loadCalibrationData ]); loadChainer.setExitPoint(loadHtml); From 7070bf379068eca1bab8bdf92365992bf7e9ec91 Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Tue, 27 Feb 2018 21:02:20 +0300 Subject: [PATCH 36/57] fix #354, fix 0 height/width window size, fix load empty mission from eeprom --- main.js | 13 +++++++++++-- tabs/mission_control.js | 5 ++++- tabs/profiles.js | 6 +++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 6d2d6789..5725c8cc 100644 --- a/main.js +++ b/main.js @@ -61,8 +61,17 @@ $(document).ready(function () { win.on('close', function () { //Save window size and position - var currentWin = this; - chrome.storage.local.set({'windowSize': {height: win.height, width: win.width, x: win.x, y: win.y}}, function () { + var height = win.height; + var width = win.width; + + if (height < 400) { + height = 400 + } + if (width < 512) { + width = 512 + } + + chrome.storage.local.set({'windowSize': {height: height, width: width, x: win.x, y: win.y}}, function () { // Notify that we saved. console.log('Settings saved'); }); diff --git a/tabs/mission_control.js b/tabs/mission_control.js index c438b199..05dac5c8 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -411,8 +411,11 @@ TABS.mission_control.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getNextPoint); } - function getNextPoint() { + if (MISSION_PLANER.countBusyPoints == 0) { + return; + } + var coord; if (pointForSend > 0) { // console.log(MISSION_PLANER.bufferPoint.lon); diff --git a/tabs/profiles.js b/tabs/profiles.js index 98b77b77..0111a2df 100644 --- a/tabs/profiles.js +++ b/tabs/profiles.js @@ -564,7 +564,7 @@ TABS.profiles.initialize = function (callback, scrollPosition) { } function processHtml() { - + var modal; var $presetList = $('#presets-list'); var presetsList = presets.model.extractPresetNames(presets.presets); @@ -590,7 +590,7 @@ TABS.profiles.initialize = function (callback, scrollPosition) { $('#execute-button').click(function () { applyAndSave(); - OSD.GUI.jbox.close(); + modal.close(); googleAnalytics.sendEvent('Presets', 'Applied', currentPreset.name); }); @@ -600,7 +600,7 @@ TABS.profiles.initialize = function (callback, scrollPosition) { //noinspection JSValidateTypes $('#content').scrollTop((scrollPosition) ? scrollPosition : 0); - var modal = new jBox('Modal', { + modal = new jBox('Modal', { width: 600, height: 240, closeButton: 'title', From c2ae0f7dc3356044567c68867a434da9a40ed3dd Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Thu, 1 Mar 2018 14:12:15 +0100 Subject: [PATCH 37/57] Set capacity thresholds as percentage of battery capacity --- _locales/en/messages.json | 4 ++-- tabs/configuration.html | 17 ++++++++--------- tabs/configuration.js | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 684d5c7f..c7212eaf 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -739,10 +739,10 @@ "message": "Capacity" }, "configurationBatteryCapacityWarning": { - "message": "Warning Capacity" + "message": "Warning Capacity (%)" }, "configurationBatteryCapacityCritical": { - "message": "Critical Capacity" + "message": "Critical Capacity (%)" }, "configurationBatteryCapacityUnit": { "message": "Battery Capacity Unit" diff --git a/tabs/configuration.html b/tabs/configuration.html index a9ae6d22..e70f20ed 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -444,6 +444,12 @@
    +
    + +
    - +
    - +
    -
    - - -
    diff --git a/tabs/configuration.js b/tabs/configuration.js index 9338f3b4..ca789779 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -344,8 +344,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) { // fill battery capacity $('#battery_capacity').val(MISC.battery_capacity); - $('#battery_capacity_warning').val(MISC.battery_capacity_warning); - $('#battery_capacity_critical').val(MISC.battery_capacity_critical); + $('#battery_capacity_warning').val(MISC.battery_capacity_warning * 100 / MISC.battery_capacity); + $('#battery_capacity_critical').val(MISC.battery_capacity_critical * 100 / MISC.battery_capacity); $('#battery_capacity_unit').val(MISC.battery_capacity_unit); var escProtocols = FC.getEscProtocols(); @@ -676,8 +676,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) { MISC.vbatscale = parseInt($('#voltagescale').val()); MISC.battery_capacity = parseInt($('#battery_capacity').val()); - MISC.battery_capacity_warning = parseInt($('#battery_capacity_warning').val()); - MISC.battery_capacity_critical = parseInt($('#battery_capacity_critical').val()); + MISC.battery_capacity_warning = parseInt($('#battery_capacity_warning').val() * MISC.battery_capacity / 100); + MISC.battery_capacity_critical = parseInt($('#battery_capacity_critical').val() * MISC.battery_capacity / 100); MISC.battery_capacity_unit = $('#battery_capacity_unit').val(); BF_CONFIG.currentscale = parseInt($('#currentscale').val()); From 615d559b667b7166e353e42b819df331659a5575 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Thu, 1 Mar 2018 16:12:07 +0100 Subject: [PATCH 38/57] Add air speed graph in sensors tab --- js/fc.js | 1 + js/msp/MSPCodes.js | 1 + js/msp/MSPHelper.js | 3 +++ tabs/sensors.html | 38 +++++++++++++++++++++++++++-- tabs/sensors.js | 59 +++++++++++++++++++++++++++++++++++++++------ 5 files changed, 93 insertions(+), 9 deletions(-) diff --git a/js/fc.js b/js/fc.js index 144d4495..3c65889c 100644 --- a/js/fc.js +++ b/js/fc.js @@ -177,6 +177,7 @@ var FC = { altitude: 0, barometer: 0, sonar: 0, + air_speed: 0, kinematics: [0.0, 0.0, 0.0], debug: [0, 0, 0, 0] }; diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 3ae4719a..2ba5f237 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -164,4 +164,5 @@ var MSPCodes = { MSPV2_INAV_SET_BATTERY_CONFIG: 0x2006, MSPV2_INAV_RATE_PROFILE: 0x2007, MSPV2_INAV_SET_RATE_PROFILE: 0x2008, + MSPV2_INAV_AIR_SPEED: 0x2009, }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index f410e6cf..7ae22fa9 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -230,6 +230,9 @@ var mspHelper = (function (gui) { case MSPCodes.MSP_SONAR: SENSOR_DATA.sonar = data.getInt32(0, true); break; + case MSPCodes.MSPV2_INAV_AIR_SPEED: + SENSOR_DATA.air_speed = data.getInt32(0, true); + break; case MSPCodes.MSP_ANALOG: ANALOG.voltage = data.getUint8(0) / 10.0; ANALOG.mAhdrawn = data.getUint16(1, true); diff --git a/tabs/sensors.html b/tabs/sensors.html index 420b78b1..44bf0177 100644 --- a/tabs/sensors.html +++ b/tabs/sensors.html @@ -18,7 +18,8 @@ + type="checkbox" name="sonar_on" />Sonar Open Debug Trace @@ -229,6 +230,39 @@
    +
    +
    +
    +
    Air speed - cm/s
    +
    +
    +
    + +
    +
    IAS:
    +
    0
    +
    +
    + + + + + + + +
    +
    +
    @@ -306,4 +340,4 @@
    -
    \ No newline at end of file + diff --git a/tabs/sensors.js b/tabs/sensors.js index a5dc342c..e8f0522f 100644 --- a/tabs/sensors.js +++ b/tabs/sensors.js @@ -15,6 +15,7 @@ TABS.sensors.initialize = function (callback) { SENSOR_DATA.gyroscope[i] = 0; SENSOR_DATA.magnetometer[i] = 0; SENSOR_DATA.sonar = 0; + SENSOR_DATA.air_speed = 0; SENSOR_DATA.altitude = 0; SENSOR_DATA.debug[i] = 0; } @@ -172,6 +173,14 @@ TABS.sensors.initialize = function (callback) { } } + function plot_airspeed(enable) { + if (enable) { + $('.wrapper.airspeed').show(); + } else { + $('.wrapper.airspeed').hide(); + } + } + function plot_debug(enable) { if (enable) { $('.wrapper.debug').show(); @@ -193,6 +202,10 @@ TABS.sensors.initialize = function (callback) { checkboxes.eq(4).prop('disabled', true); } + if (semver.lt(CONFIG.flightControllerVersion, "1.9.1") || (!bit_check(CONFIG.activeSensors, 6))) { // airspeed + checkboxes.eq(5).prop('disabled', true); + } + $('.tab-sensors .info .checkboxes input').change(function () { var enable = $(this).prop('checked'); var index = $(this).parent().index(); @@ -214,6 +227,9 @@ TABS.sensors.initialize = function (callback) { plot_sonar(enable); break; case 5: + plot_airspeed(enable); + break; + case 6: plot_debug(enable); break; } @@ -248,12 +264,14 @@ TABS.sensors.initialize = function (callback) { samples_mag_i = 0, samples_altitude_i = 0, samples_sonar_i = 0, + samples_airspeed_i = 0, samples_debug_i = 0, gyro_data = initDataArray(3), accel_data = initDataArray(3), mag_data = initDataArray(3), altitude_data = (semver.gte(CONFIG.flightControllerVersion, "1.6.0")) ? initDataArray(2) : initDataArray(1), sonar_data = initDataArray(1), + airspeed_data = initDataArray(1), debug_data = [ initDataArray(1), initDataArray(1), @@ -266,6 +284,7 @@ TABS.sensors.initialize = function (callback) { var magHelpers = initGraphHelpers('#mag', samples_mag_i, [-1, 1]); var altitudeHelpers = initGraphHelpers('#altitude', samples_altitude_i); var sonarHelpers = initGraphHelpers('#sonar', samples_sonar_i); + var airspeedHelpers = initGraphHelpers('#airspeed', samples_airspeed_i); var debugHelpers = [ initGraphHelpers('#debug1', samples_debug_i), initGraphHelpers('#debug2', samples_debug_i), @@ -304,6 +323,8 @@ TABS.sensors.initialize = function (callback) { $('.tab-sensors select[name="baro_refresh_rate"]').val(result.sensor_settings.rates.baro); $('.tab-sensors select[name="sonar_refresh_rate"]').val(result.sensor_settings.rates.sonar); + $('.tab-sensors select[name="airspeed_refresh_rate"]').val(result.sensor_settings.rates.airspeed); + $('.tab-sensors select[name="debug_refresh_rate"]').val(result.sensor_settings.rates.debug); // start polling data by triggering refresh rate change event @@ -318,12 +339,13 @@ TABS.sensors.initialize = function (callback) { // if any of the select fields change value, all of the select values are grabbed // and timers are re-initialized with the new settings var rates = { - 'gyro': parseInt($('.tab-sensors select[name="gyro_refresh_rate"]').val(), 10), - 'accel': parseInt($('.tab-sensors select[name="accel_refresh_rate"]').val(), 10), - 'mag': parseInt($('.tab-sensors select[name="mag_refresh_rate"]').val(), 10), - 'baro': parseInt($('.tab-sensors select[name="baro_refresh_rate"]').val(), 10), - 'sonar': parseInt($('.tab-sensors select[name="sonar_refresh_rate"]').val(), 10), - 'debug': parseInt($('.tab-sensors select[name="debug_refresh_rate"]').val(), 10) + 'gyro': parseInt($('.tab-sensors select[name="gyro_refresh_rate"]').val(), 10), + 'accel': parseInt($('.tab-sensors select[name="accel_refresh_rate"]').val(), 10), + 'mag': parseInt($('.tab-sensors select[name="mag_refresh_rate"]').val(), 10), + 'baro': parseInt($('.tab-sensors select[name="baro_refresh_rate"]').val(), 10), + 'sonar': parseInt($('.tab-sensors select[name="sonar_refresh_rate"]').val(), 10), + 'airspeed': parseInt($('.tab-sensors select[name="airspeed_refresh_rate"]').val(), 10), + 'debug': parseInt($('.tab-sensors select[name="debug_refresh_rate"]').val(), 10) }; var scales = { @@ -402,6 +424,21 @@ TABS.sensors.initialize = function (callback) { } if (checkboxes[5]) { + helper.interval.add('airspeed_pull', function airspeed_data_pull() { + + /* + * Enable balancer + */ + if (helper.mspQueue.shouldDrop()) { + update_airspeed_graphs(); + return; + } + + MSP.send_message(MSPCodes.MSPV2_INAV_AIR_SPEED, false, false, update_airspeed_graphs); + }, rates.airspeed, true); + } + + if (checkboxes[6]) { helper.interval.add('debug_pull', function debug_data_pull() { /* @@ -470,13 +507,21 @@ TABS.sensors.initialize = function (callback) { raw_data_text_ements.x[4].text(SENSOR_DATA.sonar.toFixed(2)); } + function update_airspeed_graphs() { + updateGraphHelperSize(airspeedHelpers); + + samples_airspeed_i = addSampleToData(airspeed_data, samples_airspeed_i, [SENSOR_DATA.air_speed]); + drawGraph(airspeedHelpers, airspeed_data, samples_airspeed_i); + raw_data_text_ements.x[5].text(SENSOR_DATA.air_speed); + } + function update_debug_graphs() { for (var i = 0; i < 4; i++) { updateGraphHelperSize(debugHelpers[i]); addSampleToData(debug_data[i], samples_debug_i, [SENSOR_DATA.debug[i]]); drawGraph(debugHelpers[i], debug_data[i], samples_debug_i); - raw_data_text_ements.x[5 + i].text(SENSOR_DATA.debug[i]); + raw_data_text_ements.x[6 + i].text(SENSOR_DATA.debug[i]); } samples_debug_i++; } From adc197405e0f48d7ab3d3d80aba4f97b6ec415f4 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Thu, 1 Mar 2018 16:30:13 +0100 Subject: [PATCH 39/57] Fixes #364 --- tabs/mission_control.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 05dac5c8..5fe5584f 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -303,8 +303,8 @@ TABS.mission_control.initialize = function (callback) { var geometry = selectedFeature.getGeometry(); var coord = ol.proj.toLonLat(geometry.getCoordinates()); - $('#pointLat').val(coord[0]); - $('#pointLon').val(coord[1]); + $('#pointLon').val(coord[0]); + $('#pointLat').val(coord[1]); $('#pointAlt').val(selectedMarker.alt); $('#pointType').val(selectedMarker.action); } else { @@ -474,4 +474,4 @@ TABS.mission_control.initialize = function (callback) { TABS.mission_control.cleanup = function (callback) { if (callback) callback(); -}; \ No newline at end of file +}; From 87e092cbcb596d66a3bfed9d5f4dd1d00db93c8e Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Thu, 1 Mar 2018 20:58:37 +0300 Subject: [PATCH 40/57] new appearance of the interface, need testing --- _locales/en/messages.json | 3 + js/fc.js | 3 +- js/msp/MSPHelper.js | 5 +- main.js | 22 +-- src/css/tabs/mission_planer.css | 242 ++++++++++++++++++++++---------- tabs/mission_control.html | 147 +++++++++++-------- tabs/mission_control.js | 63 +++++++-- 7 files changed, 322 insertions(+), 163 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 684d5c7f..14ac0f27 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2442,6 +2442,9 @@ "missionTotalInformationHead": { "message": "Total information" }, + "missionRTHsettingsTitle": { + "message": "RTH settings" + }, "useOnlyStandalone": { "message": "Use stand-alone application.
    Please visit the website to read the release notes and download." }, diff --git a/js/fc.js b/js/fc.js index 144d4495..ac0f10bd 100644 --- a/js/fc.js +++ b/js/fc.js @@ -214,7 +214,8 @@ var FC = { lat: 0, lon: 0, alt: 0, - endMission: 0 + endMission: 0, + p1: 0 } }; diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index f410e6cf..1bab868a 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -452,6 +452,7 @@ var mspHelper = (function (gui) { MISSION_PLANER.bufferPoint.lat = data.getInt32(2, true) / 10000000; MISSION_PLANER.bufferPoint.lon = data.getInt32(6, true) / 10000000; MISSION_PLANER.bufferPoint.alt = data.getInt32(10, true); + MISSION_PLANER.bufferPoint.p1 = data.getInt16(14, true); break; case MSPCodes.MSP_BOXIDS: @@ -1839,8 +1840,8 @@ var mspHelper = (function (gui) { buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 1)); buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 2)); buffer.push(specificByte(MISSION_PLANER.bufferPoint.alt, 3)); - buffer.push(lowByte(0)); //sbufReadU16(src); // P1 - buffer.push(highByte(0)); + buffer.push(lowByte(MISSION_PLANER.bufferPoint.p1)); //sbufReadU16(src); // P1 speed or landing + buffer.push(highByte(MISSION_PLANER.bufferPoint.p1)); buffer.push(lowByte(0)); //sbufReadU16(src); // P2 buffer.push(highByte(0)); buffer.push(lowByte(0)); //sbufReadU16(src); // P3 diff --git a/main.js b/main.js index 5725c8cc..a177d1ce 100644 --- a/main.js +++ b/main.js @@ -59,19 +59,21 @@ $(document).ready(function () { } }); + win.setMinimumSize(1024, 800); + win.on('close', function () { //Save window size and position - var height = win.height; - var width = win.width; + // var height = win.height; + // var width = win.width; + // + // if (height < 400) { + // height = 400 + // } + // if (width < 512) { + // width = 512 + // } - if (height < 400) { - height = 400 - } - if (width < 512) { - width = 512 - } - - chrome.storage.local.set({'windowSize': {height: height, width: width, x: win.x, y: win.y}}, function () { + chrome.storage.local.set({'windowSize': {height: win.height, width: win.width, x: win.x, y: win.y}}, function () { // Notify that we saved. console.log('Settings saved'); }); diff --git a/src/css/tabs/mission_planer.css b/src/css/tabs/mission_planer.css index 40bd7f7b..234f3d2c 100644 --- a/src/css/tabs/mission_planer.css +++ b/src/css/tabs/mission_planer.css @@ -1,20 +1,56 @@ -.tab-calibration .content_toolbar { - height: 100px; +.tab-mission-control .btn a { + /* common styles for content toolbar buttons */ + /*margin-top: 0;*/ + /*margin-bottom: 0;*/ + /*margin-right: 20px;*/ + background-color: #37a8db; + border-radius: 3px; + border: 1px solid #3394b5; + color: #fff; + /*float: right;*/ + font-family: 'open_sansbold', Arial, serif; + font-size: 12px; + text-shadow: 0 1px rgba(0, 0, 0, 0.25); + display: block; + cursor: pointer; + transition: all ease 0.2s; + padding: 0 9px; + line-height: 28px; + margin: 5px; + float: left; + width: 130px; + text-align: center; } -.tab-mission-control .waypoint { - padding-left: 19px; - padding-right: 19px; - /*padding-bottom: 10px;*/ +.tab-mission-control .btn a:hover { + background-color: #3394b5; + transition: all ease 0.2s; } -.tab-mission-control .waypoint-left { - width: 54%; - float: left; - padding-right: 5px; + +.tab-mission-control .btn a:active { + background-color: #37a8db; + transition: all ease 0.0s; + box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.35); } -.tab-mission-control .waypoint-right{ - width: 40%; - float: right; + +.tab-mission-control .btn a.disabled { + cursor: default; + color: #fff; + background-color: #AFAFAF; + border: 1px solid #AFAFAF; + pointer-events: none; + text-shadow: none; + opacity: 0.5; +} + +.tab-mission-control .btn-danger a { + background-color: #db250e; + border: 1px solid #b5480e; +} + +.tab-mission-control .btn-danger a:hover { + background-color: #b5480e; + transition: all ease 0.2s; } .tab-mission-control .checksfail { @@ -28,6 +64,26 @@ background-repeat:no-repeat; } +.tab-mission-control .content_wrapper { + display: flex; + /*height: 150px;*/ + height: 90%; + /*width: 75%;*/ + flex-direction: row; + justify-content: space-between; + flex-wrap: wrap; + padding-bottom: 5px; + padding-top: 5px; +} + +.tab-mission-control { + height: 100%; +} + +#missionMap { + height: 100%; +} + .tab-mission-control input { width: 115px; padding-left: 3px; @@ -36,87 +92,119 @@ text-align: left; border: 1px solid silver; border-radius: 3px; - margin-left: 11px; + font-size: 12px; + font-weight: normal; +} + +.tab-mission-control select { + width: 118px; + padding-left: 3px; + height: 20px; + line-height: 20px; + text-align: left; + border: 1px solid silver; + border-radius: 3px; font-size: 12px; font-weight: normal; } .tab-mission-control .point { - display: inline-block; + display: block; margin-bottom: 5px; margin-left: 5px; } - .tab-mission-control .point-label { - + width: 60px; + display: inline-block; } -@media (max-width: 1236px) { - .tab-mission-control .waypoint-left { - width: 96%; - } - .tab-mission-control .waypoint-right{ - width: 96%; - float: left; - padding-right: 19px; - } - .tab-mission-control .content_toolbar { - height: 240px; - } - .tab-mission-control .content_wrapper { - height: calc(100% - 240px); - } -} +/*.tab-calibration .content_toolbar {*/ + /*height: 100px;*/ +/*}*/ -/* Need test! */ -.tab-mission-control .content_toolbar { - display: flex; - /*height: 150px;*/ - height: auto; - flex-direction: row; - justify-content: space-between; - flex-wrap: wrap; -} +/*.tab-mission-control .waypoint {*/ + /*padding-left: 19px;*/ + /*padding-right: 19px;*/ + /*!*padding-bottom: 10px;*!*/ +/*}*/ +/*.tab-mission-control .waypoint-left {*/ + /*width: 54%;*/ + /*float: left;*/ + /*padding-right: 5px;*/ +/*}*/ +/*.tab-mission-control .waypoint-right{*/ + /*width: 40%;*/ + /*float: right;*/ +/*}*/ -.tab-mission-control .waypoint-left, -.tab-mission-control .waypoint-right { - width: 47%; - float: none; -} -.tab-mission-control .btn.save_btn { - display: flex; - flex-direction: row; - flex-wrap: wrap; -} -.tab-mission-control .btn.save_btn a{ - margin-top: 5px; -} +/*@media (max-width: 1236px) {*/ + /*.tab-mission-control .waypoint-left {*/ + /*width: 96%;*/ + /*}*/ + /*.tab-mission-control .waypoint-right{*/ + /*width: 96%;*/ + /*float: left;*/ + /*padding-right: 19px;*/ + /*}*/ + /*.tab-mission-control .content_toolbar {*/ + /*height: 240px;*/ + /*}*/ + /*.tab-mission-control .content_wrapper {*/ + /*height: calc(100% - 240px);*/ + /*}*/ +/*}*/ -.tab-mission-control .gui_box{ - width: 100%; - clear: both; - height: 90%; -} +/*!* Need test! *!*/ +/*.tab-mission-control .cf_column {*/ + /*display: flex;*/ + /*!*height: 150px;*!*/ + /*height: auto;*/ + /*flex-direction: row;*/ + /*justify-content: space-between;*/ + /*flex-wrap: wrap;*/ +/*}*/ -.tab-mission-control.toolbar_fixed_bottom{ - height: 100%; -} -/*.tab-mission-control .content_wrapper{*/ +/*.tab-mission-control .waypoint-left,*/ +/*.tab-mission-control .waypoint-right {*/ + /*width: 47%;*/ + /*float: none;*/ +/*}*/ + +/*.tab-mission-control .btn.save_btn {*/ + /*display: flex;*/ + /*flex-direction: row;*/ + /*flex-wrap: wrap;*/ +/*}*/ + +/*.tab-mission-control .btn.save_btn a{*/ + /*margin-top: 5px;*/ +/*}*/ + +/*.tab-mission-control .gui_box{*/ + /*width: 100%;*/ + /*clear: both;*/ + /*height: 90%;*/ +/*}*/ + +/*.tab-mission-control.toolbar_fixed_bottom{*/ + /*height: 100%;*/ +/*}*/ +/*!*.tab-mission-control .content_wrapper{*!*/ + /*!*height: 100%;*!*/ +/*!*}*!*/ +/*#missionMap{*/ /*height: 100%;*/ /*}*/ -#missionMap{ - height: 100%; -} -@media (max-width: 1252px){ - .tab-mission-control .waypoint-left, - .tab-mission-control .waypoint-right { - width: 100%; - } - .tab-mission-control .waypoint-right{ - padding-right: 5px; - margin-top: 5px; - } -} +/*@media (max-width: 1252px){*/ + /*.tab-mission-control .waypoint-left,*/ + /*.tab-mission-control .waypoint-right {*/ + /*width: 100%;*/ + /*}*/ + /*.tab-mission-control .waypoint-right{*/ + /*padding-right: 5px;*/ + /*margin-top: 5px;*/ + /*}*/ +/*}*/ diff --git a/tabs/mission_control.html b/tabs/mission_control.html index c7b04d66..518fb9e0 100644 --- a/tabs/mission_control.html +++ b/tabs/mission_control.html @@ -1,76 +1,99 @@ -
    -
    -
    - +
    +
    +
    Mission planer
    +
    + +
    -
    -
    -
    -
    -
    Edit point
    -
    -
    - -
    - +
    +
    +
    +
    +
    +
    Total information
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - Save +
    +
    + Distance (m): +
    -
    - Remove +
    + Available Points + 0/0
    +
    + Mission valid +
    +
    +
    +
    + + +
    + +
    + +
    +
    -
    -
    -
    -
    Total information
    -
    -
    -
    - Distance (m): - -
    -
    - Available Points - 0/0 -
    -
    - Mission valid -
    -
    - - -
    -
    +
    +
    +
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 05dac5c8..f97ab835 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -47,7 +47,9 @@ TABS.mission_control.initialize = function (callback) { $('#pointLat').val(''); $('#pointLon').val(''); $('#pointAlt').val(''); - $('[name=pointNumber]').val('') + $('#pointSpeed').val(''); + $('[name=pointNumber]').val(''); + $('#MPeditPoint').fadeOut(300); } function repaint() { @@ -100,7 +102,7 @@ TABS.mission_control.initialize = function (callback) { map.addLayer(vectorLayer); } - function addMarker(_pos, _alt, _action) { + function addMarker(_pos, _alt, _action, _speed) { var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(_pos), name: 'Null Island', @@ -140,6 +142,7 @@ TABS.mission_control.initialize = function (callback) { vectorLayer.alt = _alt; vectorLayer.number = markers.length; vectorLayer.action = _action; + vectorLayer.speedValue = _speed; markers.push(vectorLayer); @@ -307,6 +310,8 @@ TABS.mission_control.initialize = function (callback) { $('#pointLon').val(coord[1]); $('#pointAlt').val(selectedMarker.alt); $('#pointType').val(selectedMarker.action); + $('#pointSpeed').val(selectedMarker.speedValue); + $('#MPeditPoint').fadeIn(300); } else { map.addLayer(addMarker(evt.coordinate, 1500, 1)); repaint(); @@ -358,6 +363,7 @@ TABS.mission_control.initialize = function (callback) { geometry.setCoordinates(ol.proj.fromLonLat([parseFloat($('#pointLat').val()), parseFloat($('#pointLon').val())])); t.alt = $('#pointAlt').val(); t.action = $('#pointType').val(); + t.speedValue = $('#pointSpeed').val(); } }); @@ -394,6 +400,14 @@ TABS.mission_control.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, false, false); }); + $('#rthEndMission').on('change', function () { + if ($(this).is(':checked')) { + $('#rthSettings').fadeIn(300); + } else { + $('#rthSettings').fadeOut(300); + } + }); + updateTotalInfo(); } @@ -422,15 +436,23 @@ TABS.mission_control.initialize = function (callback) { // console.log(MISSION_PLANER.bufferPoint.lat); // console.log(MISSION_PLANER.bufferPoint.alt); // console.log(MISSION_PLANER.bufferPoint.action); - - coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); - map.addLayer(addMarker(coord, MISSION_PLANER.bufferPoint.alt, MISSION_PLANER.bufferPoint.action)); + if (MISSION_PLANER.bufferPoint.action == 4) { + $('#rthEndMission').trigger('click'); + if (MISSION_PLANER.bufferPoint.p1 > 0) { + $('#rthLanding').trigger('click'); + } + } else { + coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); + map.addLayer(addMarker(coord, MISSION_PLANER.bufferPoint.alt, MISSION_PLANER.bufferPoint.action, MISSION_PLANER.bufferPoint.p1)); + if (pointForSend === 1) { + map.getView().setCenter(coord); + } + } } if (pointForSend >= MISSION_PLANER.countBusyPoints) { GUI.log('End get point'); $('#loadMissionButton').removeClass('disabled'); - map.getView().setCenter(coord); repaint(); updateTotalInfo(); return; @@ -444,12 +466,22 @@ TABS.mission_control.initialize = function (callback) { } function sendNextPoint() { + var isRTH = $('#rthEndMission').is(':checked'); + if (pointForSend >= markers.length) { - GUI.log('End send point'); + if (isRTH) { + MISSION_PLANER.bufferPoint.number = pointForSend + 1; + MISSION_PLANER.bufferPoint.action = 4; + MISSION_PLANER.bufferPoint.lon = 0; + MISSION_PLANER.bufferPoint.lat = 0; + MISSION_PLANER.bufferPoint.alt = 0; + MISSION_PLANER.bufferPoint.endMission = 0xA5; + MISSION_PLANER.bufferPoint.p1 = $('#rthLanding').is(':checked') ? 1 : 0; + MSP.send_message(MSPCodes.MSP_SET_WP, mspHelper.crunch(MSPCodes.MSP_SET_WP), false, endSendPoint); + } else { + endSendPoint(); + } - MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, updateTotalInfo); - - $('#saveMissionButton').removeClass('disabled'); return; } @@ -461,8 +493,9 @@ TABS.mission_control.initialize = function (callback) { MISSION_PLANER.bufferPoint.lon = parseInt(coordinate[0] * 10000000); MISSION_PLANER.bufferPoint.lat = parseInt(coordinate[1] * 10000000); MISSION_PLANER.bufferPoint.alt = markers[pointForSend].alt; + MISSION_PLANER.bufferPoint.p1 = markers[pointForSend].speedValue; pointForSend++; - if (pointForSend >= markers.length) { + if (pointForSend >= markers.length && !isRTH) { MISSION_PLANER.bufferPoint.endMission = 0xA5; } else { MISSION_PLANER.bufferPoint.endMission = 0; @@ -470,6 +503,14 @@ TABS.mission_control.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_SET_WP, mspHelper.crunch(MSPCodes.MSP_SET_WP), false, sendNextPoint); } + + function endSendPoint() { + GUI.log('End send point'); + + MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, updateTotalInfo); + + $('#saveMissionButton').removeClass('disabled'); + } }; TABS.mission_control.cleanup = function (callback) { From c56c133493e80d66a4501a19011faffe3b4be33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Fri, 2 Mar 2018 14:52:53 +0000 Subject: [PATCH 41/57] Remove disarm_kill_switch from the configurator UI disarm_kill_switch can be a safety hazard if set to false without understanding what it does and should be left on for most cases. Also, it's too easy to change without knowing what it does. This change just removes it from the UI, so it's still available via CLI for advanced users. --- _locales/en/messages.json | 6 ------ tabs/configuration.html | 8 -------- tabs/configuration.js | 2 -- 3 files changed, 16 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c7212eaf..d124aee5 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -684,12 +684,6 @@ "configurationAutoDisarmDelayHelp": { "message": "Requires MOTOR_STOP feature" }, - "configurationDisarmKillSwitch": { - "message": "Disarm regardless of throttle value" - }, - "configurationDisarmKillSwitchHelp": { - "message": "When arming via radio channel" - }, "configurationThrottleMinimum": { "message": "Minimum Throttle" }, diff --git a/tabs/configuration.html b/tabs/configuration.html index e70f20ed..4d427bb1 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -271,14 +271,6 @@
    -
    - - -
    -
    -
    - + From 2dddb11f8e4b82329b97651be954fcb3c0ed09ba Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Sun, 4 Mar 2018 20:29:32 +1000 Subject: [PATCH 45/57] Version bump to 1.9.2 --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 538dae09..b61c3a51 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "minimum_chrome_version": "38", - "version": "1.9.1", + "version": "1.9.2", "author": "Several", "name": "INAV - Configurator", "short_name": "INAV", diff --git a/package.json b/package.json index 118dbc4a..4a2c53aa 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "inav-configurator", "description": "INAV Configurator", - "version": "1.9.1", + "version": "1.9.2", "main": "main.html", "default_locale": "en", "scripts": { From 063b3ca49d9767d9e7d63d16b574618b6bbe6f34 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 4 Mar 2018 22:18:14 +0100 Subject: [PATCH 46/57] Fix calibration tab reported acc{zero,gain}_* values (fixes #374) --- tabs/calibration.html | 6 +++--- tabs/calibration.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tabs/calibration.html b/tabs/calibration.html index 584a7fe2..9cffa245 100755 --- a/tabs/calibration.html +++ b/tabs/calibration.html @@ -64,8 +64,8 @@
    - - + +
    @@ -154,4 +154,4 @@

    -
    \ No newline at end of file +
    diff --git a/tabs/calibration.js b/tabs/calibration.js index ab753d99..d3b73631 100755 --- a/tabs/calibration.js +++ b/tabs/calibration.js @@ -112,7 +112,7 @@ TABS.calibration.initialize = function (callback) { var pos = ['X', 'Y', 'Z']; pos.forEach(function (item) { $('[name=accGain' + item + ']').val(CALIBRATION_DATA.accGain[item]); - $('[name=accZero' + item + ']').val(CALIBRATION_DATA.accGain[item]); + $('[name=accZero' + item + ']').val(CALIBRATION_DATA.accZero[item]); $('[name=Mag' + item + ']').val(CALIBRATION_DATA.magZero[item]); }); updateCalibrationSteps(); From bb4f6c612d92282d671c13f3d81231468476dd4b Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Mon, 5 Mar 2018 04:21:02 +0100 Subject: [PATCH 47/57] Add OSD trip distance icon --- resources/osd/bold.mcm | 68 +++++++++++++++++------------------ resources/osd/bold/34.png | Bin 0 -> 248 bytes resources/osd/default.mcm | 68 +++++++++++++++++------------------ resources/osd/default/34.png | Bin 0 -> 248 bytes resources/osd/large.mcm | 68 +++++++++++++++++------------------ resources/osd/large/34.png | Bin 0 -> 248 bytes 6 files changed, 102 insertions(+), 102 deletions(-) create mode 100644 resources/osd/bold/34.png create mode 100644 resources/osd/default/34.png create mode 100644 resources/osd/large/34.png diff --git a/resources/osd/bold.mcm b/resources/osd/bold.mcm index fb0031e6..af1a92a1 100644 --- a/resources/osd/bold.mcm +++ b/resources/osd/bold.mcm @@ -2179,49 +2179,49 @@ MAX7456 01010101 01010101 01010101 +00010101 01010101 +01010100 +10000001 01010101 +01010010 +10001000 +00010101 +01001010 +10101010 +10000101 +01010010 +10001000 +10100001 +01010100 +10000001 +00100001 01010101 +00010100 +00100001 01010101 +01010010 +10100001 +01010100 +00001010 +00000101 +01010010 +10101000 01010101 +01010010 +00000001 01010101 +01010010 +00000001 01010101 +01010010 +10101000 01010101 +01010100 +00001010 +00010101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +01010000 01010101 01010101 01010101 diff --git a/resources/osd/bold/34.png b/resources/osd/bold/34.png new file mode 100644 index 0000000000000000000000000000000000000000..a146a468e2aa4ff20567377cdba7e3248294896f GIT binary patch literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPdGb@vTN&l49f3D zbJVhy1%~td*NCiLwfRgTe~DWM4f*C$o0 literal 0 HcmV?d00001 diff --git a/resources/osd/default.mcm b/resources/osd/default.mcm index a6f338ac..cc960007 100644 --- a/resources/osd/default.mcm +++ b/resources/osd/default.mcm @@ -2179,49 +2179,49 @@ MAX7456 01010101 01010101 01010101 +00010101 01010101 +01010100 +10000001 01010101 +01010010 +10001000 +00010101 +01001010 +10101010 +10000101 +01010010 +10001000 +10100001 +01010100 +10000001 +00100001 01010101 +00010100 +00100001 01010101 +01010010 +10100001 +01010100 +00001010 +00000101 +01010010 +10101000 01010101 +01010010 +00000001 01010101 +01010010 +00000001 01010101 +01010010 +10101000 01010101 +01010100 +00001010 +00010101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +01010000 01010101 01010101 01010101 diff --git a/resources/osd/default/34.png b/resources/osd/default/34.png new file mode 100644 index 0000000000000000000000000000000000000000..a146a468e2aa4ff20567377cdba7e3248294896f GIT binary patch literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPdGb@vTN&l49f3D zbJVhy1%~td*NCiLwfRgTe~DWM4f*C$o0 literal 0 HcmV?d00001 diff --git a/resources/osd/large.mcm b/resources/osd/large.mcm index 709ac509..eda6f56f 100644 --- a/resources/osd/large.mcm +++ b/resources/osd/large.mcm @@ -2179,49 +2179,49 @@ MAX7456 01010101 01010101 01010101 +00010101 01010101 +01010100 +10000001 01010101 +01010010 +10001000 +00010101 +01001010 +10101010 +10000101 +01010010 +10001000 +10100001 +01010100 +10000001 +00100001 01010101 +00010100 +00100001 01010101 +01010010 +10100001 +01010100 +00001010 +00000101 +01010010 +10101000 01010101 +01010010 +00000001 01010101 +01010010 +00000001 01010101 +01010010 +10101000 01010101 +01010100 +00001010 +00010101 01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 -01010101 +01010000 01010101 01010101 01010101 diff --git a/resources/osd/large/34.png b/resources/osd/large/34.png new file mode 100644 index 0000000000000000000000000000000000000000..a146a468e2aa4ff20567377cdba7e3248294896f GIT binary patch literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPdGb@vTN&l49f3D zbJVhy1%~td*NCiLwfRgTe~DWM4f*C$o0 literal 0 HcmV?d00001 From dd0f6287401b05d60250f8018ef472165d161c2d Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Tue, 6 Mar 2018 19:02:25 +0100 Subject: [PATCH 48/57] Add trip distance OSD item --- _locales/en/messages.json | 3 +++ tabs/osd.js | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 9df51c71..94dff464 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2358,6 +2358,9 @@ "osdElement_GPS_HDOP_HELP": { "message": "Shows the Horizontal Dilution Of Precission from the GPS. The lower, the most accurate the GPS fix is." }, + "osdElement_TRIP_DIST": { + "message": "Trip distance" + }, "osdElement_VARIO_HELP": { "message": "Shows vertical speed using up or down arrows. Each arrow represents 10cm (~4 inches) per second." }, diff --git a/tabs/osd.js b/tabs/osd.js index 4aa314e8..26fb03b3 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -36,6 +36,7 @@ SYM.AIR = 151; SYM.DIR_TO_HOME = 0x60; SYM.DIST_KM = 182; SYM.DIST_MI = 184; +SYM.TRIP_DIST = 0x22; SYM.HEADING1 = 0xA9; SYM.HEADING2 = 0xA8; SYM.HEADING_N = 24; @@ -668,6 +669,18 @@ OSD.constants = { return FONT.symbol(SYM.DIST_KM) + FONT.embed_dot('1.73'); } }, + { + name: 'TRIP_DIST', + id: 40, + min_version: '1.9.1', + preview: function(osd_data) { + if (OSD.data.unit_mode === 0) { + // Imperial + return FONT.symbol(SYM.TRIP_DIST) + FONT.symbol(SYM.DIST_MI) + FONT.embed_dot('0.98'); + } + return FONT.symbol(SYM.TRIP_DIST) + FONT.symbol(SYM.DIST_KM) + FONT.embed_dot('1.73'); + } + }, { name: 'GPS_HDOP', id: 31, From 5aa44eb39ba95bb4d5d09cda0b86b4c43459984a Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Thu, 15 Mar 2018 21:14:11 +1000 Subject: [PATCH 49/57] Add link to telegram channel --- _locales/en/messages.json | 3 +++ tabs/landing.html | 1 + 2 files changed, 4 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 94dff464..f1f6e343 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -313,6 +313,9 @@ "communitySlackSupport": { "message": "Slack Support Live Chat" }, + "communityTelegramSupport": { + "message": "Telegram Channel" + }, "initialSetupBackupAndRestoreApiVersion": { "message": "Backup and restore functionality disabled. You have firmware with API version $1, backup and restore requires $2. Please backup your settings via the CLI, see INAV documentation for procedure." }, diff --git a/tabs/landing.html b/tabs/landing.html index faf34635..7f13f33b 100644 --- a/tabs/landing.html +++ b/tabs/landing.html @@ -7,6 +7,7 @@
    +
    From 68dcaa18f88c47cb9e24bed6d45daa6290f11565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Fri, 16 Mar 2018 13:10:23 +0000 Subject: [PATCH 50/57] Add support for selecting FPort serial RX protocol --- js/fc.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/fc.js b/js/fc.js index ac0f10bd..cd0cf766 100644 --- a/js/fc.js +++ b/js/fc.js @@ -773,6 +773,10 @@ var FC = { data.push('TBS Crossfire'); } + if (semver.gte(CONFIG.flightControllerVersion, "1.9.1")) { + data.push('FPort'); + } + return data; }, getSPIProtocolTypes: function () { From 024561b64de209b9ba7a7ca37c4104e0221a36af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Sat, 17 Mar 2018 14:31:53 +0000 Subject: [PATCH 51/57] Format the markdown in the release notes as HTML --- gulpfile.js | 1 + package-lock.json | 10 +++++----- package.json | 1 + tabs/firmware_flasher.js | 6 +++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2e9e67ed..68f51deb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,6 +56,7 @@ sources.js = [ './js/libraries/google-analytics-bundle.js', './node_modules/jquery/dist/jquery.min.js', './node_modules/jquery-ui-npm/jquery-ui.min.js', + './node_modules/marked/lib/marked.js', './js/libraries/d3.min.js', './js/libraries/jquery.nouislider.all.min.js', './node_modules/three/three.min.js', diff --git a/package-lock.json b/package-lock.json index 979d93f8..9440ba07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "inav-configurator", - "version": "1.8.1", + "version": "1.9.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2897,7 +2897,7 @@ "escape-string-regexp": "1.0.5", "js2xmlparser": "3.0.0", "klaw": "2.0.0", - "marked": "0.3.9", + "marked": "0.3.17", "mkdirp": "0.5.1", "requizzle": "0.2.1", "strip-json-comments": "2.0.1", @@ -3218,9 +3218,9 @@ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, "marked": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.9.tgz", - "integrity": "sha512-nW5u0dxpXxHfkHzzrveY45gCbi+R4PaO4WRZYqZNl+vB0hVGeqlFn0aOg1c8AKL63TrNFn9Bm2UP4AdiZ9TPLw==" + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.17.tgz", + "integrity": "sha512-+AKbNsjZl6jFfLPwHhWmGTqE009wTKn3RTmn9K8oUKHrX/abPJjtcRtXpYB/FFrwPJRUA86LX/de3T0knkPCmQ==" }, "merge": { "version": "1.2.0", diff --git a/package.json b/package.json index 4a2c53aa..047abb9a 100755 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "inflection": "1.12.0", "jquery": "2.1.4", "jquery-ui-npm": "1.12.0", + "marked": "^0.3.17", "nw": "^0.25.4-sdk", "nw-builder": "^3.4.1", "openlayers": "^4.6.4", diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index f7c912b6..4a613e6f 100755 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -319,8 +319,12 @@ TABS.firmware_flasher.initialize = function (callback) { $('div.release_info .status').text(summary.status); $('div.release_info .file').text(summary.file).prop('href', summary.url); - var formattedNotes = summary.notes.trim('\r').replace(/\r/g, '
    '); + var formattedNotes = marked(summary.notes); $('div.release_info .notes').html(formattedNotes); + // Make links in the release notes open in a new window + $('div.release_info .notes a').each(function () { + $(this).attr('target', '_blank'); + }); $('div.release_info').slideDown(); From 77ac570614d372384822ded7136048534e41e927 Mon Sep 17 00:00:00 2001 From: Sergej Pozdnyakov Date: Sat, 17 Mar 2018 22:17:00 +0300 Subject: [PATCH 52/57] fix bugs, add default settings, add #381 --- _locales/en/messages.json | 3 + images/icons/cf_icon_position_edit.png | Bin 0 -> 5009 bytes src/css/tabs/mission_planer.css | 97 ++--------------- tabs/mission_control.html | 22 +++- tabs/mission_control.js | 142 ++++++++++++++++++++----- 5 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 images/icons/cf_icon_position_edit.png diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 94dff464..bdc5dcdb 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2442,6 +2442,9 @@ "missionRTHsettingsTitle": { "message": "RTH settings" }, + "missionDefaultSettingsHead": { + "message": "Default settings" + }, "useOnlyStandalone": { "message": "Use stand-alone application.
    Please visit the website to read the release notes and download." }, diff --git a/images/icons/cf_icon_position_edit.png b/images/icons/cf_icon_position_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..d931b09ad6c2736e1edf56eac60576c9b1ee80fd GIT binary patch literal 5009 zcmZ`-byU>P*ZwTMpwb}SAPp-nT?;PVrASDJbT>#VA+aEhpu|^dk!}`5U`0wmx}>{1 ze(Rs_AMcsD^UU0H?>+a-+%wOdd8e(Z^pKF25CDLOD$0tw7_|N;1bCRyZ8=RJ12}f_ z8u9>8{ekGl0vEGpwo=yB0Du4v00@f!fXjOfZUTU}5CCkw1^|f+0HAhFG4Fw6Z1F7B zloWycf9+FSNh(GIc2j=o2>?Xo{{#eNB8=@k+beU zW69xv#A9n&*{jexz@j*CF1favsheV#sey|mjc?z{ko`Ju&+rA8#or*26fna-5d4pI zIR&yK-V2mt9Z2@x=ukh@!+UzMSVk}Vw~QW&hx8J=kX|1=EMkxqR%L>d2_vdJ5RWzF z^1mZ|oEFt2FFJ@|7d*Xu?dTEf+R?wvMQ;UnGY;!GBda`S2aLo8Xe)Mbl&dlBp6%(8 z2L_3+XcnQy{j|#N$3+YcAr%BmW%Q!Na7Z|QL)qM~T}Q0|H5C;;-YT>(Q70#$pqp$C zVGa(RB>`qGOn0BAWNMA}{!6_8aAY_>D&`O`Lxe5(8{-@>IG}L2X^!+pV1}WleE{Hq ziVOnwx%eZ#TqO`*e}>Q8eYr$1lrYlj%dl5<$zXLdrTTEud=R~4D2d+W7s=$@_U=88 zexy|xq`<=88pM8cC>os1u6OGESwmHIVB*XW?d;m-D3npYUTY>+G4YPlF3A3@RGT{j zMx)s9UN--1>4Naa304=>{%AC^CKfw+i;h8CoJORW}O*v+lb0V&f?R~4#+?G9538}o&@1rTsMO~ zqi@dbKPv_DPEAN@2;Oo;BsJ9O@2n>_;KtG`KfQ6zK?72<5S1l%2NAJQdv ze*Ko=)T5e!9G$7`+~JA7q936RnOU}h*z80Zx~ew`)?WR-D;Ag9o$D1yyMFOGrXNww z;Vk1^vGP0Bw}g#lyH~hS z(fq0yEN?dUs+%tLUXAWv$ENgeexoOxs$Yf+98?fN_VLGuFk=yKsg5FtVju9kKm1f{ z4sFQsULh-GSDp8^tBa*-xHjeMes22kp-cXC@Rq5gdef-@W%gid-U4v~njqDGtY|rv z*CSwXh~5%j;|r8u7#Tcz(0us;GLv6BX@-Xsoesj3Kp>wbAF^@&*Phgxtzhm^K6MUH z_KcS6e^q}2P(AGk0#6e3UD^20yZ;7z_N1ux#zI*GG9t9k(A>_NxuE!&(UX!|_pP8z z=eUXY>R*#zl&HVV{_w5r5q$qFeUie~=*IM~ft}46F}|g*7T37)&RmVhkT(aE!?Ag@ zPIF@I^G>;7`<|C~C4Eb&c+^1-9Jeng$0{+TiYG<|TZtK~YtsW-u`S6``TdoJ2I z^(D)UL$f@2vhCF6pDOol?d@q^$n2smKV!!%zK9~Ii(rb6k*So?J6m{wx5it{g+@4l z8Nx^=ebK$bXPpI&}Sd6$oey9$+{RMO5c?@#MF&54Cq zKjMwK(6(H~t^15V1(#Q#Z631+_RdG2X5_~&7#;<-sLXDjPpa_rKNdQndz|ibp=+?A zvHn-|Rl(mR>xla|-TwlmLnXsN;-`K(>xImR5B5Q0O%5iTUSp`RPbK{l*t&} zr?6gobxI7UCe`bYU!&&k{o z?5CKdk#VvRs04O{i7o1aucPS_t#-Hq7BpTzxHyee2bL_3UtFAbJ|lNzZ>ngwbC~pIR=>`m6g9Vf zJHEms=8L8vincRh^&HU=&CAXJ&s%o6zG}r3NM&)eXOH*8`E{l&I_*|)TXLNJf(_sy zqF3C|%Zr^P#KLy2HVI)NPeC6bH{MBnGjsnD<4?n>{R6owg_2|-lvqEy@K$VQ7M5?) zivQIqz3|P_IvV_Q@ZwB|SKG`LQG%NkIk)?Hr8pq)i=Z{Ht|7k(J1{RPSSwYdyhuboBM-);EY7WBJXD6W@ z+jxu}`8f$pjOT?@y>8g9sJ|MF1Ee<|5n_@bdwENOkXd0|T7I<#a~!)w8^7btEC*Qf z*J2kk0gv)aT#E#ld1~FU2yrJTKY`zfSar1;s_y~03(fSa`qOo5b@0nR3THd3{+gzNA!CWxI+}VKdQT;EMB04nc=hwdvFgf-h z#0+E9`yos9Bq?z%2%${9Z@(HZ-CWfiPKNXHOkvt9*k7D#u$TB*=Gn0C(k&-)NdTZI ze}iQ$<-cDfeTbeqSfo(sH1j~Q+G_Nf!m}9Tpge|+8L3m7Z?F%17q_aqUHcq2iF)AY zC(}Vo+XXWDxp8pf-FHe1?s{WpKTmV=Gi=~3^shX3A>H4TB=3gn=y6J>*&0R^blf#u zs~lC+!Ord9Ba$6&Q56K|G|7sQcl9U90yA0Wug7yq9F|ts7ehG>W+!JVSbHtIx|+?7 z5BoCIZ;E?j>|O;~v@f>@hz@YxODXZ~RFh|DbP~g;x}}9>h_v!gmZzwg7-@d<`l3jw zJ@_~g-o12)!wBB5(xpyjo>YgKCHB@)^<=kT5TJb}&)WaTm$cC!y5xtArHS{xS;8%D zQz`dGTSUpY#Nn|p4U#;%P^{P_4ns+-78gAk57Zw`VS5}H3#jk)-IC?elWj-axWh_sU1Qq;T5 zzPgKU_Fra%U11Ii1AX9|^O)a|GqcnTlS<^b$?L1sA-s_2#6AVmDF$nn`{#*UDn|sE zR}!UMs#h-}lI!-qZY09rpDO;>iTSj^bvOGP5dje4a!Dcnv0%+>^@#SozCafMtPYS6db_UxFai<0q5diu#+_#Jj)WNf%7B`+YeCM!Mlx|Zw| z%SiuCs%(faTOsdcq?!ukxe8systJxR(nH5sBrSaOW4z%Pv)87(WiO3d;@xT}wzya| zj8;NNj1l4bq-34FH|fRl3#yHU*w7}wajp$XdNTiWB}qO4QM(6W{9=I_WUwzS#d?4s zZN>20@Lb7bmTgC)Vc)8+RTCsrtgsGqoJE4Q4a=bQi_@ z_j^@z^a&K1v9Q1m5f?N;^4_2wkjH>zj*#nc42ltNG1#D1)(7RhAK)t5<|}GBF1zf2 z23g0e)ol?hZ@%9pt)IN8&sQyljT4qSei7gLsn|oCi7iJ* zimO!Hs;e1$GE`#>;#2W%H%`9Z8`NE`IYm*vOP-r*5756otu-DQ(gd*?6LfC83F@!5 zRXEZFW~Ut+zO`*IuooY+KLW%Q6bouP>e{18SozyWi59_ZN18abyVfkuQbC}PS)cs+ z!EMD+u`soAsRRcW;7gCuU4o#vp_Beyb!UZuYno{JWc&u(fqg-;{oKqVaPXKk>gnOi zo5w65sb7?T#PI~+=5EjNAOFW4Oe90Ba6&b_@R;o+wNvXylix8ELE>tj-hUS6R284FLdoa=prQ+X2x?Mwo)xg zph!L|Xi`lPm1%z$O}^ZE?)XC>Coul{0vWhCiihXo{H%{UaKY9moBFmlANI@8dhDDc z%$SuhYd+atj0ISHb;iW?a(&Y%K>%NJp($=>+VAmU&sWw^?2u4*eO?;5EE1UF+e<^K zj+|GfW;XgXSjCPHuUu$uFNvtbw)~pws*|W90e}=&WyzPbZaiM!$$W4J zO7k&Vg0-bC87CK8TT>BLtn_kpYxVmU>L}p&yF(RgkE_8aXD-oH^lk#d0%)A+@l8$8 zsUn3}@RIvjcc`d?iTFQddLly%bd3c9N@}8uE)rz zQPcP;c71PkXE1U|t)7}cW=Mfll8?+uoGbRpO+qZp7lKCkM3U$*4}`RvO;s* z>F$;zdGsm2_7Z!uoGH&@-AhiNljw+L3_yy~h{55pum;K}&$P1csDb>gKm$2Q=k#x7KfKboEdP+Ulv zKjGMKLs1%Tkx_Ei1rj>wnGU-u(gD+e6MLasQY_3;($7oIxOGv63d7ap6~|OEj&06| zp%P53^MwYQgKANdtA#}zsAjgH?s#Ikhora))F(wndLM8|qoBM_N2+mzNwV&Q_*YB?o*GAb-D_!W(``LkFHkVeEKTq=QV-1 zNX|-Fv?+%t6iWb>3Rp(ATJ-FDd~{9-90D7?*wlem`F}7Kqo&n0S_;+HR4F7^?*H-W zfTaMrMs1x1*J|WHR?=$Qzgi6sSupCNG}JAsT?rk>&d1O9DFMW=KJggLO)3g+5P*O; zA@cRB@3;5RjmIVX;!JJag2uF!NV2V^+x#apac3yk;;hB|9yQfIg@$GtQ-B{+Fm+hj z>fK7je+hX%iZflh46)HPcBuk@v$$EMli*j-Fz##7utycd#p)b*94vsGqI^9TQ`S-R zsz+3sYv;W_1IF}zE9qurW_$62^d_`a9T$)PpB>5yHysO^X=idw27xG5pG}y09DZF# zO&%^jEyW|pDup0IXyf-^|$l?%vkB?!MlYmX_HO%)Ehu8BLUe*>~HWF4IHW&aP zLc*f_!VrGQGku7##8U{S^9ntc5E3FZ!Jhg*4$iLD4z~XPze6CX#RlU5s65wHtc1M| F{~xx&V5
    -
    + +
    Total information
    diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 9c2a2416..9d8f48fa 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -27,6 +27,18 @@ TABS.mission_control.initialize = function (callback) { function process_html() { if (typeof require !== "undefined") { + chrome.storage.local.get('missionPlanerSettings', function (result) { + if (result.missionPlanerSettings) { + $('#MPdefaultPointAlt').val(result.missionPlanerSettings.alt); + $('#MPdefaultPointSpeed').val(result.missionPlanerSettings.speed); + } else { + chrome.storage.local.set({'missionPlanerSettings': {speed: 0, alt: 5000}}); + $('#MPdefaultPointAlt').val(5000); + $('#MPdefaultPointSpeed').val(0); + } + }); + + initMap(); } else { $('#missionMap, #missionControls').hide(); @@ -40,7 +52,7 @@ TABS.mission_control.initialize = function (callback) { var markers = []; var lines = []; var map; - var selectedMarker; + var selectedMarker = null; var pointForSend = 0; function clearEditForm() { @@ -102,20 +114,13 @@ TABS.mission_control.initialize = function (callback) { map.addLayer(vectorLayer); } - function addMarker(_pos, _alt, _action, _speed) { - var iconFeature = new ol.Feature({ - geometry: new ol.geom.Point(_pos), - name: 'Null Island', - population: 4000, - rainfall: 500 - }); - - var iconStyle = new ol.style.Style({ + function getPointIcon(isEdit) { + return new ol.style.Style({ image: new ol.style.Icon(({ anchor: [0.5, 1], opacity: 1, scale: 0.5, - src: '../images/icons/cf_icon_position.png' + src: '../images/icons/cf_icon_position' + (isEdit ? '_edit' : '') + '.png' })) // text: new ol.style.Text({ // text: '10', @@ -128,8 +133,17 @@ TABS.mission_control.initialize = function (callback) { // }) // }) }); + } - iconFeature.setStyle(iconStyle); + function addMarker(_pos, _alt, _action, _speed) { + var iconFeature = new ol.Feature({ + geometry: new ol.geom.Point(_pos), + name: 'Null Island', + population: 4000, + rainfall: 500 + }); + + iconFeature.setStyle(getPointIcon()); var vectorSource = new ol.source.Vector({ features: [iconFeature] @@ -150,11 +164,6 @@ TABS.mission_control.initialize = function (callback) { } function initMap() { - // var center = ol.proj.fromLonLat([e.data.lon, e.data.lat]); - // - // mapView.setCenter(center); - // iconGeometry.setCoordinates(center); - var app = {}; /** @@ -197,6 +206,38 @@ TABS.mission_control.initialize = function (callback) { }; ol.inherits(app.Drag, ol.interaction.Pointer); + /** + * @constructor + * @extends {ol.control.Control} + * @param {Object=} opt_options Control options. + */ + app.PlannerSettingsControl = function (opt_options) { + var options = opt_options || {}; + var button = document.createElement('button'); + + button.innerHTML = ' '; + button.style = 'background: url(\'../images/CF_settings_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);'; + + var handleShowSettings = function () { + $('#MPeditPoint, #missionPalnerTotalInfo').hide(); + $('#missionPlanerSettings').fadeIn(300); + }; + + button.addEventListener('click', handleShowSettings, false); + button.addEventListener('touchstart', handleShowSettings, false); + + var element = document.createElement('div'); + element.className = 'mission-control-settings ol-unselectable ol-control'; + element.appendChild(button); + element.title = 'MP Settings'; + + ol.control.Control.call(this, { + element: element, + target: options.target + }); + + }; + ol.inherits(app.PlannerSettingsControl, ol.control.Control); /** * @param {ol.MapBrowserEvent} evt Map browser event. @@ -241,7 +282,6 @@ TABS.mission_control.initialize = function (callback) { repaint(); }; - /** * @param {ol.MapBrowserEvent} evt Event. */ @@ -265,7 +305,6 @@ TABS.mission_control.initialize = function (callback) { } }; - /** * @param {ol.MapBrowserEvent} evt Map browser event. * @return {boolean} `false` to stop the drag sequence. @@ -280,6 +319,13 @@ TABS.mission_control.initialize = function (callback) { var lon = GPS_DATA.lon / 10000000; map = new ol.Map({ + controls: ol.control.defaults({ + attributionOptions: { + collapsible: false + } + }).extend([ + new app.PlannerSettingsControl() + ]), interactions: ol.interaction.defaults().extend([new app.Drag()]), layers: [ new ol.layer.Tile({ @@ -294,6 +340,16 @@ TABS.mission_control.initialize = function (callback) { }); map.on('click', function (evt) { + if (selectedMarker != null) { + try { + selectedMarker.getSource().getFeatures()[0].setStyle(getPointIcon()); + selectedMarker = null; + clearEditForm(); + } catch (e) { + GUI.log(e); + } + } + var selectedFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) { return feature; @@ -306,6 +362,8 @@ TABS.mission_control.initialize = function (callback) { var geometry = selectedFeature.getGeometry(); var coord = ol.proj.toLonLat(geometry.getCoordinates()); + selectedFeature.setStyle(getPointIcon(true)); + $('#pointLon').val(coord[0]); $('#pointLat').val(coord[1]); $('#pointAlt').val(selectedMarker.alt); @@ -313,7 +371,7 @@ TABS.mission_control.initialize = function (callback) { $('#pointSpeed').val(selectedMarker.speedValue); $('#MPeditPoint').fadeIn(300); } else { - map.addLayer(addMarker(evt.coordinate, 1500, 1)); + map.addLayer(addMarker(evt.coordinate, $('#MPdefaultPointAlt').val(), 1, $('#MPdefaultPointSpeed').val())); repaint(); } }); @@ -367,6 +425,7 @@ TABS.mission_control.initialize = function (callback) { } }); + selectedMarker.getSource().getFeatures()[0].setStyle(getPointIcon()); selectedMarker = null; clearEditForm(); repaint(); @@ -374,7 +433,12 @@ TABS.mission_control.initialize = function (callback) { }); $('#loadMissionButton').on('click', function () { - removeAllPoints(); + if (markers.length) { + if (!confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) { + return; + } + removeAllPoints(); + } $(this).addClass('disabled'); GUI.log('Start get point'); @@ -391,6 +455,12 @@ TABS.mission_control.initialize = function (callback) { }); $('#loadEepromMissionButton').on('click', function () { + if (markers.length) { + if (!confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) { + return; + } + removeAllPoints(); + } GUI.log(chrome.i18n.getMessage('eeprom_load_ok')); MSP.send_message(MSPCodes.MSP_WP_MISSION_LOAD, false, getPointsFromEprom); @@ -408,6 +478,15 @@ TABS.mission_control.initialize = function (callback) { } }); + $('#saveSettings').on('click', function () { + chrome.storage.local.set({'missionPlanerSettings': {speed: $('#MPdefaultPointSpeed').val(), alt: $('#MPdefaultPointAlt').val()}}); + $('#missionPlanerSettings').hide(); + $('#missionPalnerTotalInfo').fadeIn(300); + if (selectedMarker !== null) { + $('#MPeditPoint').fadeIn(300); + } + }); + updateTotalInfo(); } @@ -425,24 +504,32 @@ TABS.mission_control.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, getNextPoint); } + function endGetPoint() { + GUI.log('End get point'); + $('#loadMissionButton').removeClass('disabled'); + repaint(); + updateTotalInfo(); + } + function getNextPoint() { if (MISSION_PLANER.countBusyPoints == 0) { + endGetPoint(); return; } - var coord; if (pointForSend > 0) { // console.log(MISSION_PLANER.bufferPoint.lon); // console.log(MISSION_PLANER.bufferPoint.lat); // console.log(MISSION_PLANER.bufferPoint.alt); // console.log(MISSION_PLANER.bufferPoint.action); if (MISSION_PLANER.bufferPoint.action == 4) { - $('#rthEndMission').trigger('click'); + $('#rthEndMission').attr('checked', true); + $('#rthSettings').fadeIn(300); if (MISSION_PLANER.bufferPoint.p1 > 0) { - $('#rthLanding').trigger('click'); + $('#rthLanding').attr('checked', true); } } else { - coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); + var coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); map.addLayer(addMarker(coord, MISSION_PLANER.bufferPoint.alt, MISSION_PLANER.bufferPoint.action, MISSION_PLANER.bufferPoint.p1)); if (pointForSend === 1) { map.getView().setCenter(coord); @@ -451,10 +538,7 @@ TABS.mission_control.initialize = function (callback) { } if (pointForSend >= MISSION_PLANER.countBusyPoints) { - GUI.log('End get point'); - $('#loadMissionButton').removeClass('disabled'); - repaint(); - updateTotalInfo(); + endGetPoint(); return; } From a7afedea9293bd8200c04ea0784c10a9e6aaf075 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Sun, 18 Mar 2018 16:40:23 +0100 Subject: [PATCH 53/57] Fix negative current sensor offset voltage values handling --- js/msp/MSPHelper.js | 2 +- tabs/configuration.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 647e7f15..81e9aa00 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -611,7 +611,7 @@ var mspHelper = (function (gui) { BF_CONFIG.board_align_pitch = data.getInt16(8, true); // -180 - 360 BF_CONFIG.board_align_yaw = data.getInt16(10, true); // -180 - 360 BF_CONFIG.currentscale = data.getInt16(12, true); - BF_CONFIG.currentoffset = data.getUint16(14, true); + BF_CONFIG.currentoffset = data.getInt16(14, true); break; case MSPCodes.MSP_SET_BF_CONFIG: console.log('BF_CONFIG saved'); diff --git a/tabs/configuration.html b/tabs/configuration.html index 44819490..748ea738 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -418,7 +418,7 @@
    - + From a89661f4cf52fd1251d548b403a8c4ccb0e39979 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Mon, 19 Mar 2018 18:10:20 +0100 Subject: [PATCH 54/57] Make channel mapping more user friendly --- js/fc.js | 25 ++++++++++++++++++++++++- tabs/receiver.html | 6 +++--- tabs/receiver.js | 37 ++++++++++++++----------------------- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/js/fc.js b/js/fc.js index a216cce1..4d25ba1d 100644 --- a/js/fc.js +++ b/js/fc.js @@ -994,7 +994,30 @@ var FC = { } }, getRcMapLetters: function () { - return ['A', 'E', 'R', 'T', '5', '6', '7', '8']; + if (semver.gte(CONFIG.flightControllerVersion, '1.9.1')) + return ['A', 'E', 'R', 'T']; + else + return ['A', 'E', 'R', 'T', '5', '6', '7', '8']; + }, + isRcMapValid: function (val) { + var strBuffer = val.split(''), + duplicityBuffer = []; + + if (val.length != FC.getRcMapLetters().length) + return false; + + // check if characters inside are all valid, also check for duplicity + for (var i = 0; i < val.length; i++) { + if (FC.getRcMapLetters().indexOf(strBuffer[i]) < 0) + return false; + + if (duplicityBuffer.indexOf(strBuffer[i]) < 0) + duplicityBuffer.push(strBuffer[i]); + else + return false; + } + + return true; }, getServoMixInputNames: function () { return [ diff --git a/tabs/receiver.html b/tabs/receiver.html index 958a10ea..f2af3660 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -25,9 +25,9 @@
    diff --git a/tabs/receiver.js b/tabs/receiver.js index 7ea25775..b95c45d2 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -77,6 +77,14 @@ TABS.receiver.initialize = function (callback) { // translate to user-selected language localize(); + if (semver.lt(CONFIG.flightControllerVersion, '1.9.1')) { + rcmap_options = $('select[name="rcmap_helper"] option'); + for (i = 0; i < rcmap_options.length; ++i) { + option = rcmap_options[i]; + option.setAttribute("value", option.getAttribute("value") + "5678"); + } + } + // fill in data from RC_tuning $('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2)); $('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2)); @@ -152,9 +160,9 @@ TABS.receiver.initialize = function (callback) { $(window).on('resize', self.resize).resize(); // trigger so labels get correctly aligned on creation // handle rcmap & rssi aux channel - var strBuffer = []; + var strBuffer = [], rcMapLetters = FC.getRcMapLetters(); for (var i = 0; i < RC_MAP.length; i++) { - strBuffer[RC_MAP[i]] = FC.getRcMapLetters()[i]; + strBuffer[RC_MAP[i]] = rcMapLetters[i]; } // reconstruct @@ -183,29 +191,12 @@ TABS.receiver.initialize = function (callback) { }); $rcMap.focusout(function () { - var val = $(this).val(), - strBuffer = val.split(''), - duplicityBuffer = []; - - if (val.length != 8) { + if (!FC.isRcMapValid($(this).val())) $(this).val(last_valid); - return false; - } + }); - // check if characters inside are all valid, also check for duplicity - for (var i = 0; i < val.length; i++) { - if (FC.getRcMapLetters().indexOf(strBuffer[i]) < 0) { - $(this).val(last_valid); - return false; - } - - if (duplicityBuffer.indexOf(strBuffer[i]) < 0) { - duplicityBuffer.push(strBuffer[i]); - } else { - $(this).val(last_valid); - return false; - } - } + $rcMap.on('input change', function() { + $(this).css("color", FC.isRcMapValid($(this).val()) ? "" : "#FF0000"); }); // handle helper From 6fd6fc293feff11b982864859331b77fe5b5b32c Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Thu, 22 Mar 2018 21:09:47 +1000 Subject: [PATCH 55/57] Check for custom mixer when loading/saving smix rules --- tabs/servos.js | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/tabs/servos.js b/tabs/servos.js index 507bb77d..24f8c301 100755 --- a/tabs/servos.js +++ b/tabs/servos.js @@ -11,22 +11,41 @@ TABS.servos.initialize = function (callback) { var loadChainer = new MSPChainerClass(); - loadChainer.setChain([ - mspHelper.loadServoConfiguration, - mspHelper.loadRcData, - mspHelper.loadBfConfig, - mspHelper.loadServoMixRules - ]); + if (BF_CONFIG.mixerConfiguration == 23 || BF_CONFIG.mixerConfiguration == 24 || BF_CONFIG.mixerConfiguration == 25) { + loadChainer.setChain([ + mspHelper.loadServoConfiguration, + mspHelper.loadRcData, + mspHelper.loadBfConfig, + mspHelper.loadServoMixRules + ]); + } + else { + loadChainer.setChain([ + mspHelper.loadServoConfiguration, + mspHelper.loadRcData, + mspHelper.loadBfConfig + ]); + } + loadChainer.setExitPoint(load_html); loadChainer.execute(); var saveChainer = new MSPChainerClass(); - saveChainer.setChain([ - mspHelper.sendServoConfigurations, - mspHelper.sendServoMixer, - mspHelper.saveToEeprom - ]); + if (BF_CONFIG.mixerConfiguration == 23 || BF_CONFIG.mixerConfiguration == 24 || BF_CONFIG.mixerConfiguration == 25) { + saveChainer.setChain([ + mspHelper.sendServoConfigurations, + mspHelper.sendServoMixer, + mspHelper.saveToEeprom + ]); + } + else { + saveChainer.setChain([ + mspHelper.sendServoConfigurations, + mspHelper.saveToEeprom + ]); + } + saveChainer.setExitPoint(function () { GUI.log(chrome.i18n.getMessage('servosEepromSave')); SERVO_RULES.cleanup(); From df9bbadc1a3cc1c4745fcc1b6b58fd52cd380d25 Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Thu, 22 Mar 2018 23:10:35 +1000 Subject: [PATCH 56/57] Version bump to 1.9.3 --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index b61c3a51..0ab160bc 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "minimum_chrome_version": "38", - "version": "1.9.2", + "version": "1.9.3", "author": "Several", "name": "INAV - Configurator", "short_name": "INAV", diff --git a/package.json b/package.json index 047abb9a..23e767c9 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "inav-configurator", "description": "INAV Configurator", - "version": "1.9.2", + "version": "1.9.3", "main": "main.html", "default_locale": "en", "scripts": { From 2e180fe4363ca5c442f37c5ddc9776c708fac106 Mon Sep 17 00:00:00 2001 From: Michel Pastor Date: Mon, 26 Mar 2018 03:42:25 +0200 Subject: [PATCH 57/57] Fixes the issue of the OSD tab alarm tooltips not closing --- tabs/osd.js | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tabs/osd.js b/tabs/osd.js index 26fb03b3..ddd5b094 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -1050,6 +1050,24 @@ TABS.osd.initialize = function (callback) { if (typeof alarm.step === 'function') { step = alarm.step(OSD.data) } + var $input = $(''); alarmInput.data('alarm', alarm); if (typeof alarm.to_display === 'function') { @@ -1066,26 +1084,10 @@ TABS.osd.initialize = function (callback) { OSD.data.alarms[alarm.name] = val; MSP.promise(MSPCodes.MSP_SET_OSD_CONFIG, OSD.msp.encodeOther()) .then(function () { + tooltip.close(); updateOsdView(); }); }); - var $input = $('