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) {