@@ -360,9 +360,22 @@ TABS.mission_control.initialize = function (callback) {
360360
361361 //////////////////////////////////////////////////////////////////////////////////////////////
362362 // define & init parameters for default Settings
363- //////////////////////////////////////////////////////////////////////////////////////////////
364- var settings = { speed : 0 , alt : 5000 , safeRadiusSH : 50 } ;
365-
363+ //////////////////////////////////////////////////////////////////////////////////////////////
364+ var vMaxDistSH = 0 ;
365+ var settings = { } ;
366+ mspHelper . getSetting ( "safehome_max_distance" ) . then ( function ( s ) {
367+ if ( s ) {
368+ console . log ( s ) ;
369+ vMaxDistSH = Number ( s . value ) / 100 ;
370+ settings = { speed : 0 , alt : 5000 , safeRadiusSH : 50 , maxDistSH : vMaxDistSH } ;
371+ }
372+ else {
373+ console . log ( s ) ;
374+ vMaxDistSH = 0 ;
375+ settings = { speed : 0 , alt : 5000 , safeRadiusSH : 50 , maxDistSH : vMaxDistSH } ;
376+ }
377+ } ) ;
378+ console . log ( settings ) ;
366379 //////////////////////////////////////////////////////////////////////////////////////////////
367380 // define & init Waypoints parameters
368381 //////////////////////////////////////////////////////////////////////////////////////////////
@@ -543,7 +556,7 @@ TABS.mission_control.initialize = function (callback) {
543556
544557 let circleStyle = new ol . style . Style ( {
545558 stroke : new ol . style . Stroke ( {
546- color : 'rgba(255, 163, 46, 1 )' ,
559+ color : 'rgba(144, 12, 63, 0.5 )' ,
547560 width : 3 ,
548561 lineDash : [ 10 ]
549562 } ) ,
@@ -570,9 +583,10 @@ TABS.mission_control.initialize = function (callback) {
570583 style : function ( iconFeature ) {
571584 let styles = [ getSafehomeIcon ( safehome ) ] ;
572585 if ( safehome . isUsed ( ) ) {
573- // circleStyle.setGeometry(new ol.geom.Circle(iconFeature.getGeometry().getCoordinates(), safehomeRangeRadius ));
586+ circleStyle . setGeometry ( new ol . geom . Circle ( iconFeature . getGeometry ( ) . getCoordinates ( ) , getProjectedRadius ( settings . maxDistSH ) ) ) ;
574587 circleSafeStyle . setGeometry ( new ol . geom . Circle ( iconFeature . getGeometry ( ) . getCoordinates ( ) , getProjectedRadius ( Number ( settings . safeRadiusSH ) ) ) ) ;
575588 styles . push ( circleSafeStyle ) ;
589+ styles . push ( circleStyle ) ;
576590 }
577591 return styles ;
578592 }
@@ -1029,6 +1043,8 @@ TABS.mission_control.initialize = function (callback) {
10291043 cleanSafehomeLayers ( ) ;
10301044 renderSafehomesTable ( ) ;
10311045 renderSafehomesOnMap ( ) ;
1046+ $ ( '#safeHomeMaxDistance' ) . text ( settings . maxDistSH ) ;
1047+ $ ( '#SafeHomeSafeDistance' ) . text ( settings . safeRadiusSH ) ;
10321048 } ;
10331049
10341050 button . addEventListener ( 'click' , handleShowSafehome , false ) ;
@@ -1530,8 +1546,11 @@ TABS.mission_control.initialize = function (callback) {
15301546 $ ( this ) . addClass ( 'disabled' ) ;
15311547 GUI . log ( 'Start of sending Safehome points' ) ;
15321548 mspHelper . saveSafehomes ( ) ;
1533- GUI . log ( 'End of sending Safehome points' ) ;
1534- $ ( '#saveEepromSafehomeButton' ) . removeClass ( 'disabled' ) ;
1549+ setTimeout ( function ( ) {
1550+ mspHelper . saveToEeprom ( ) ;
1551+ GUI . log ( 'End of sending Safehome points' ) ;
1552+ $ ( '#saveEepromSafehomeButton' ) . removeClass ( 'disabled' ) ;
1553+ } , 500 ) ;
15351554 } ) ;
15361555
15371556 /////////////////////////////////////////////
@@ -1635,8 +1654,14 @@ TABS.mission_control.initialize = function (callback) {
16351654 // Callback for settings
16361655 /////////////////////////////////////////////
16371656 $ ( '#saveSettings' ) . on ( 'click' , function ( ) {
1638- settings = { speed : Number ( $ ( '#MPdefaultPointSpeed' ) . val ( ) ) , alt : Number ( $ ( '#MPdefaultPointAlt' ) . val ( ) ) , safeRadiusSH : Number ( $ ( '#MPdefaultSafeRangeSH' ) . val ( ) ) } ;
1657+ let oldSafeRadiusSH = settings . safeRadiusSH ;
1658+ settings = { speed : Number ( $ ( '#MPdefaultPointSpeed' ) . val ( ) ) , alt : Number ( $ ( '#MPdefaultPointAlt' ) . val ( ) ) , safeRadiusSH : Number ( $ ( '#MPdefaultSafeRangeSH' ) . val ( ) ) , maxDistSH : vMaxDistSH } ;
16391659 saveSettings ( ) ;
1660+ if ( settings . safeRadiusSH != oldSafeRadiusSH && $ ( '#showHideSafehomeButton' ) . is ( ":visible" ) ) {
1661+ cleanSafehomeLayers ( ) ;
1662+ renderSafehomesOnMap ( ) ;
1663+ $ ( '#SafeHomeSafeDistance' ) . text ( settings . safeRadiusSH ) ;
1664+ }
16401665 closeSettingsPanel ( ) ;
16411666 } ) ;
16421667
0 commit comments