Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Geozone sanity check / Save #2252

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading