Skip to content

Commit

Permalink
Merge pull request #2252 from Scavanger/Geozone-Sanity-Fix
Browse files Browse the repository at this point in the history
[Fix] Geozone sanity check / Save
  • Loading branch information
b14ckyy authored Nov 19, 2024
2 parents 7b65434 + 41861d1 commit e7b06ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 10 additions & 2 deletions js/geozone.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,23 @@ 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 = () => {
return minAltitude;
}

self.setMaxAltitude = (data) => {
maxAltitude = data;
if (!isNaN(data)){
maxAltitude = parseInt(data);
} else {
maxAltitude = data;
}
}

self.getMaxAltitude = () => {
Expand Down
4 changes: 4 additions & 0 deletions js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 3 additions & 5 deletions tabs/mission_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,6 @@ TABS.mission_control.initialize = function (callback) {
reasons.push(i18n.getMessage("gezoneInvalidReasonMinMaxAlt"));
}



if (reasons.length > 0) {
$('#geozoneInvalidContent').append(`<div style="display: inline-block">${i18n.getMessage("geozone")} ${zone.getNumber() + 1}: ${reasons.join(", ")}</div><br/>`);
invalidGeoZones = true;
Expand Down Expand Up @@ -1748,10 +1746,10 @@ TABS.mission_control.initialize = function (callback) {
<span class="vertexNumber"></span> \
</td> \
<td> \
<input type="number" class="vertexLat"/> \
<input type="number" step="0.0000001" class="vertexLat"/> \
</td> \
<td> \
<input type="number" class="vertexLon"/> \
<input type="number" step="0.0000001" class="vertexLon"/> \
</td> \
</tr> \
');
Expand Down Expand Up @@ -3438,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();
Expand Down

0 comments on commit e7b06ae

Please sign in to comment.