mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 20:35:19 +03:00
Merge pull request #1242 from ArnoTlse/Safehome_to_EPROM
Safehome update version 1.0
This commit is contained in:
commit
ffce2c9a57
3 changed files with 79 additions and 22 deletions
|
@ -475,3 +475,21 @@
|
||||||
.tab-mission-control .btnTable-success a:hover {
|
.tab-mission-control .btnTable-success a:hover {
|
||||||
background-color: #218838;
|
background-color: #218838;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-mission-control .legendItem {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-mission-control .fill{
|
||||||
|
border:none;
|
||||||
|
border-bottom:5px dotted #88CC3E;
|
||||||
|
display:inline-block;
|
||||||
|
width:20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-mission-control .textLegend{
|
||||||
|
margin:2px;
|
||||||
|
}
|
||||||
|
.tab-mission-control .valueLegend{
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
|
|
@ -109,6 +109,20 @@
|
||||||
<tbody id="safehomesTableBody">
|
<tbody id="safehomesTableBody">
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<hr>
|
||||||
|
<div class="spacer" id="safehomeLegend">
|
||||||
|
<span><b>Legend : </b></span>
|
||||||
|
<div class="legendItem">
|
||||||
|
<span class="fill" style="border-bottom-color:#900C3F"></span>
|
||||||
|
<span class="textLegend">Max distance (m):</span>
|
||||||
|
<span id="safeHomeMaxDistance" class="valueLegend"></span>
|
||||||
|
</div>
|
||||||
|
<div class="legendItem">
|
||||||
|
<span class="fill"></span>
|
||||||
|
<span class="textLegend">Safe Radius (m):</span>
|
||||||
|
<span id="SafeHomeSafeDistance" class="valueLegend"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -361,8 +361,21 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init parameters for default Settings
|
// define & init parameters for default Settings
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
var settings = { speed: 0, alt: 5000, safeRadiusSH : 50};
|
var vMaxDistSH = 0;
|
||||||
|
var settings = {};
|
||||||
|
mspHelper.getSetting("safehome_max_distance").then(function (s) {
|
||||||
|
if (s) {
|
||||||
|
console.log(s);
|
||||||
|
vMaxDistSH = Number(s.value)/100;
|
||||||
|
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(s);
|
||||||
|
vMaxDistSH = 0;
|
||||||
|
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(settings);
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// define & init Waypoints parameters
|
// define & init Waypoints parameters
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -543,7 +556,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
let circleStyle = new ol.style.Style({
|
let circleStyle = new ol.style.Style({
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: 'rgba(255, 163, 46, 1)',
|
color: 'rgba(144, 12, 63, 0.5)',
|
||||||
width: 3,
|
width: 3,
|
||||||
lineDash : [10]
|
lineDash : [10]
|
||||||
}),
|
}),
|
||||||
|
@ -570,9 +583,10 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
style : function(iconFeature) {
|
style : function(iconFeature) {
|
||||||
let styles = [getSafehomeIcon(safehome)];
|
let styles = [getSafehomeIcon(safehome)];
|
||||||
if (safehome.isUsed()) {
|
if (safehome.isUsed()) {
|
||||||
//circleStyle.setGeometry(new ol.geom.Circle(iconFeature.getGeometry().getCoordinates(), safehomeRangeRadius));
|
circleStyle.setGeometry(new ol.geom.Circle(iconFeature.getGeometry().getCoordinates(), getProjectedRadius(settings.maxDistSH)));
|
||||||
circleSafeStyle.setGeometry(new ol.geom.Circle(iconFeature.getGeometry().getCoordinates(), getProjectedRadius(Number(settings.safeRadiusSH))));
|
circleSafeStyle.setGeometry(new ol.geom.Circle(iconFeature.getGeometry().getCoordinates(), getProjectedRadius(Number(settings.safeRadiusSH))));
|
||||||
styles.push(circleSafeStyle);
|
styles.push(circleSafeStyle);
|
||||||
|
styles.push(circleStyle);
|
||||||
}
|
}
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
@ -1029,6 +1043,8 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
cleanSafehomeLayers();
|
cleanSafehomeLayers();
|
||||||
renderSafehomesTable();
|
renderSafehomesTable();
|
||||||
renderSafehomesOnMap();
|
renderSafehomesOnMap();
|
||||||
|
$('#safeHomeMaxDistance').text(settings.maxDistSH);
|
||||||
|
$('#SafeHomeSafeDistance').text(settings.safeRadiusSH);
|
||||||
};
|
};
|
||||||
|
|
||||||
button.addEventListener('click', handleShowSafehome, false);
|
button.addEventListener('click', handleShowSafehome, false);
|
||||||
|
@ -1530,8 +1546,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start of sending Safehome points');
|
GUI.log('Start of sending Safehome points');
|
||||||
mspHelper.saveSafehomes();
|
mspHelper.saveSafehomes();
|
||||||
|
setTimeout(function(){
|
||||||
|
mspHelper.saveToEeprom();
|
||||||
GUI.log('End of sending Safehome points');
|
GUI.log('End of sending Safehome points');
|
||||||
$('#saveEepromSafehomeButton').removeClass('disabled');
|
$('#saveEepromSafehomeButton').removeClass('disabled');
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
@ -1635,8 +1654,14 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
// Callback for settings
|
// Callback for settings
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
$('#saveSettings').on('click', function () {
|
$('#saveSettings').on('click', function () {
|
||||||
settings = { speed: Number($('#MPdefaultPointSpeed').val()), alt: Number($('#MPdefaultPointAlt').val()), safeRadiusSH: Number($('#MPdefaultSafeRangeSH').val()) };
|
let oldSafeRadiusSH = settings.safeRadiusSH;
|
||||||
|
settings = { speed: Number($('#MPdefaultPointSpeed').val()), alt: Number($('#MPdefaultPointAlt').val()), safeRadiusSH: Number($('#MPdefaultSafeRangeSH').val()), maxDistSH : vMaxDistSH};
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
if (settings.safeRadiusSH != oldSafeRadiusSH && $('#showHideSafehomeButton').is(":visible")) {
|
||||||
|
cleanSafehomeLayers();
|
||||||
|
renderSafehomesOnMap();
|
||||||
|
$('#SafeHomeSafeDistance').text(settings.safeRadiusSH);
|
||||||
|
}
|
||||||
closeSettingsPanel();
|
closeSettingsPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue