From f99a685372cbaeacb1cd01ed40d4661772616e24 Mon Sep 17 00:00:00 2001 From: Scavanger Date: Tue, 19 Nov 2024 12:55:06 -0300 Subject: [PATCH 1/2] Fix Geozone sanity check - ASL --- js/geozone.js | 12 ++++++++++-- tabs/mission_control.js | 6 ++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/js/geozone.js b/js/geozone.js index 1f9d006f8..8b7ceb44a 100644 --- a/js/geozone.js +++ b/js/geozone.js @@ -85,7 +85,11 @@ let Geozone = function (type, shape, minAltitude, maxAltitude, sealevelRef, radi } self.setMinAltitude = (data) => { - minAltitude = data; + if (!isNaN(data)){ + minAltitude = parseInt(data); + } else { + minAltitude = data; + } } self.getMinAltitude = () => { @@ -93,7 +97,11 @@ let Geozone = function (type, shape, minAltitude, maxAltitude, sealevelRef, radi } self.setMaxAltitude = (data) => { - maxAltitude = data; + if (!isNaN(data)){ + maxAltitude = parseInt(data); + } else { + maxAltitude = data; + } } self.getMaxAltitude = () => { diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 1afca6c1d..56c9a3cbe 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -977,8 +977,6 @@ TABS.mission_control.initialize = function (callback) { reasons.push(i18n.getMessage("gezoneInvalidReasonMinMaxAlt")); } - - if (reasons.length > 0) { $('#geozoneInvalidContent').append(`
${i18n.getMessage("geozone")} ${zone.getNumber() + 1}: ${reasons.join(", ")}

`); invalidGeoZones = true; @@ -1748,10 +1746,10 @@ TABS.mission_control.initialize = function (callback) { \ \ \ - \ + \ \ \ - \ + \ \ \ '); From 41861d15472a04e6928a29761f7f21e69def24ed Mon Sep 17 00:00:00 2001 From: Scavanger Date: Tue, 19 Nov 2024 13:35:14 -0300 Subject: [PATCH 2/2] Fix input fields --- js/gui.js | 4 ++++ tabs/mission_control.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/js/gui.js b/js/gui.js index 4e187037d..4010ddf11 100644 --- a/js/gui.js +++ b/js/gui.js @@ -548,6 +548,10 @@ GUI_control.prototype.alert = function(message) { dialog.showMessageBoxSync({ message: message, icon: "./images/inav_icon_128.png" }); } +GUI_control.prototype.confirm = function(message) { + return dialog.showMessageBoxSync({ message: message, icon: "./images/inav_icon_128.png", buttons: ["Yes", "No"]}) == 0; +} + // initialize object into GUI variable var GUI = new GUI_control(); diff --git a/tabs/mission_control.js b/tabs/mission_control.js index 56c9a3cbe..0fce8675e 100644 --- a/tabs/mission_control.js +++ b/tabs/mission_control.js @@ -3436,7 +3436,7 @@ TABS.mission_control.initialize = function (callback) { return; } - if (confirm(i18n.getMessage("missionGeozoneReboot"))) { + if (GUI.confirm(i18n.getMessage("missionGeozoneReboot"))) { $(event.currentTarget).addClass('disabled'); GUI.log('Start of sending Geozones'); mspHelper.saveGeozones();