mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 16:55:22 +03:00
Added some i18n to strings for the GUI console.
This commit is contained in:
parent
b02fe8915a
commit
c45a14fd92
8 changed files with 47 additions and 47 deletions
|
@ -5,7 +5,7 @@ var appUpdater = appUpdater || {};
|
||||||
appUpdater.checkRelease = function (currVersion) {
|
appUpdater.checkRelease = function (currVersion) {
|
||||||
var modalStart;
|
var modalStart;
|
||||||
$.get('https://api.github.com/repos/iNavFlight/inav-configurator/releases', function (releaseData) {
|
$.get('https://api.github.com/repos/iNavFlight/inav-configurator/releases', function (releaseData) {
|
||||||
GUI.log('Loaded release information from GitHub.');
|
GUI.log(chrome.i18n.getMessage('loadedReleaseInfo'));
|
||||||
//Git return sorted list, 0 - last release
|
//Git return sorted list, 0 - last release
|
||||||
|
|
||||||
let newVersion = releaseData[0].tag_name;
|
let newVersion = releaseData[0].tag_name;
|
||||||
|
@ -15,7 +15,7 @@ appUpdater.checkRelease = function (currVersion) {
|
||||||
GUI.log(newVersion, chrome.runtime.getManifest().version);
|
GUI.log(newVersion, chrome.runtime.getManifest().version);
|
||||||
GUI.log(currVersion);
|
GUI.log(currVersion);
|
||||||
|
|
||||||
GUI.log('New version available!');
|
GUI.log(chrome.i18n.getMessage('newVersionAvailable'));
|
||||||
modalStart = new jBox('Modal', {
|
modalStart = new jBox('Modal', {
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 200,
|
height: 200,
|
||||||
|
|
|
@ -3003,7 +3003,7 @@ var mspHelper = (function (gui) {
|
||||||
if (waypointId < MISSION_PLANNER.getCountBusyPoints()) {
|
if (waypointId < MISSION_PLANNER.getCountBusyPoints()) {
|
||||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, loadWaypoint);
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, loadWaypoint);
|
||||||
} else {
|
} else {
|
||||||
GUI.log('Receive time: ' + (new Date().getTime() - startTime) + 'ms');
|
GUI.log(chrome.i18n.getMessage('ReceiveTime') + (new Date().getTime() - startTime) + 'ms');
|
||||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3025,7 +3025,7 @@ var mspHelper = (function (gui) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function endMission() {
|
function endMission() {
|
||||||
GUI.log('Send time: ' + (new Date().getTime() - startTime) + 'ms');
|
GUI.log(chrome.i18n.getMessage('SendTime') + (new Date().getTime() - startTime) + 'ms');
|
||||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
||||||
|
|
||||||
self.initialize();
|
self.initialize();
|
||||||
} else {
|
} else {
|
||||||
GUI.log('<span style="color: red">Failed</span> to open serial port');
|
GUI.log(chrome.i18n.getMessage('failedToOpenSerialPort'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +108,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
||||||
retries++;
|
retries++;
|
||||||
if (retries > maxRetries) {
|
if (retries > maxRetries) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
GUI.log('<span style="color: red">Failed</span> to flash ' + port);
|
GUI.log(chrome.i18n.getMessage('failedToFlash') + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for DFU devices
|
// Check for DFU devices
|
||||||
|
@ -145,7 +145,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GUI.log('<span style="color: red">Failed</span> to open serial port');
|
GUI.log(chrome.i18n.getMessage('failedToOpenSerialPort'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
6
main.js
6
main.js
|
@ -85,9 +85,9 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
||||||
GUI.log('Running - OS: <strong>' + GUI.operating_system + '</strong>, ' +
|
GUI.log(chrome.i18n.getMessage('getRunningOS') + GUI.operating_system + '</strong>, ' +
|
||||||
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</strong>, ' +
|
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</strong>, ' +
|
||||||
'Configurator: <strong>' + chrome.runtime.getManifest().version + '</strong>');
|
chrome.i18n.getMessage('getConfiguratorVersion') + chrome.runtime.getManifest().version + '</strong>');
|
||||||
|
|
||||||
$('#status-bar .version').text(chrome.runtime.getManifest().version);
|
$('#status-bar .version').text(chrome.runtime.getManifest().version);
|
||||||
$('#logo .version').text(chrome.runtime.getManifest().version);
|
$('#logo .version').text(chrome.runtime.getManifest().version);
|
||||||
|
@ -534,7 +534,7 @@ $(document).ready(function () {
|
||||||
|
|
||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
$(this).text(state ? 'Hide Log' : 'Show Log');
|
$(this).html(state ? chrome.i18n.getMessage("mainHideLog") : chrome.i18n.getMessage("mainShowLog"));
|
||||||
$(this).data('state', state);
|
$(this).data('state', state);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -172,10 +172,10 @@ TABS.cli.initialize = function (callback) {
|
||||||
|
|
||||||
fs.writeFile(result, self.outputHistory, (err) => {
|
fs.writeFile(result, self.outputHistory, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
GUI.log('<span style="color: red">Error writing file</span>');
|
GUI.log(chrome.i18n.getMessage('ErrorWritingFile'));
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
GUI.log('File saved');
|
GUI.log(chrome.i18n.getMessage('FileSaved'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -250,7 +250,7 @@ TABS.cli.initialize = function (callback) {
|
||||||
|
|
||||||
fs.readFile(result, (err, data) => {
|
fs.readFile(result, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
GUI.log('<span style="color: red">Error reading file</span>');
|
GUI.log(chrome.i18n.getMessage('ErrorReadingFile'));
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
$('input.show_development_releases').click(function() {
|
$('input.show_development_releases').click(function() {
|
||||||
let selectedTarget = String($('select[name="board"]').val());
|
let selectedTarget = String($('select[name="board"]').val());
|
||||||
GUI.log("selected target = " + selectedTarget);
|
GUI.log(chrome.i18n.getMessage('selectedTarget') + selectedTarget);
|
||||||
buildBoardOptions();
|
buildBoardOptions();
|
||||||
GUI.log("toggled RCs");
|
GUI.log(chrome.i18n.getMessage('toggledRCs'));
|
||||||
if (selectedTarget === "0") {
|
if (selectedTarget === "0") {
|
||||||
TABS.firmware_flasher.getTarget();
|
TABS.firmware_flasher.getTarget();
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,7 +274,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
$('a.load_remote_file').click(function (evt) {
|
$('a.load_remote_file').click(function (evt) {
|
||||||
|
|
||||||
if ($('select[name="firmware_version"]').val() == "0") {
|
if ($('select[name="firmware_version"]').val() == "0") {
|
||||||
GUI.log("<b>No firmware selected to load</b>");
|
GUI.log(chrome.i18n.getMessage('noFirmwareSelectedToLoad'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
STM32.connect(port, baud, parsed_hex, options);
|
STM32.connect(port, baud, parsed_hex, options);
|
||||||
} else {
|
} else {
|
||||||
console.log('Please select valid serial port');
|
console.log('Please select valid serial port');
|
||||||
GUI.log('<span style="color: red">Please select valid serial port</span>');
|
GUI.log(chrome.i18n.getMessage('selectValidSerialPort'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex, options);
|
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex, options);
|
||||||
|
@ -452,7 +452,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('You don\'t have write permissions for this file, sorry.');
|
console.log('You don\'t have write permissions for this file, sorry.');
|
||||||
GUI.log('You don\'t have <span style="color: red">write permissions</span> for this file');
|
GUI.log(chrome.i18n.getMessage('writePermissionsForFile'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -635,14 +635,14 @@ TABS.firmware_flasher.cleanup = function (callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.firmware_flasher.getTarget = function() {
|
TABS.firmware_flasher.getTarget = function() {
|
||||||
GUI.log("Attempting automatic target selection");
|
GUI.log(chrome.i18n.getMessage('automaticTargetSelect'));
|
||||||
|
|
||||||
var selected_baud = parseInt($('#baud').val());
|
var selected_baud = parseInt($('#baud').val());
|
||||||
var selected_port = $('#port').find('option:selected').data().isManual ? $('#port-override').val() : String($('#port').val());
|
var selected_port = $('#port').find('option:selected').data().isManual ? $('#port-override').val() : String($('#port').val());
|
||||||
|
|
||||||
if (selected_port !== 'DFU') {
|
if (selected_port !== 'DFU') {
|
||||||
if (selected_port == '0') {
|
if (selected_port == '0') {
|
||||||
GUI.log("Cannot prefetch target: No port");
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFailNoPort'));
|
||||||
} else {
|
} else {
|
||||||
console.log('Connecting to: ' + selected_port);
|
console.log('Connecting to: ' + selected_port);
|
||||||
GUI.connecting_to = selected_port;
|
GUI.connecting_to = selected_port;
|
||||||
|
@ -654,7 +654,7 @@ TABS.firmware_flasher.getTarget = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GUI.log("Cannot prefetch target: Flight Controller in DFU");
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFailDFU'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
||||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||||
helper.timeout.add('connecting', function () {
|
helper.timeout.add('connecting', function () {
|
||||||
if (!CONFIGURATOR.connectionValid) {
|
if (!CONFIGURATOR.connectionValid) {
|
||||||
GUI.log("Cannot prefetch target: " + chrome.i18n.getMessage('noConfigurationReceived'));
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFail') + chrome.i18n.getMessage('noConfigurationReceived'));
|
||||||
|
|
||||||
TABS.firmware_flasher.closeTempConnection();
|
TABS.firmware_flasher.closeTempConnection();
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
||||||
if (CONFIG.flightControllerIdentifier == 'INAV') {
|
if (CONFIG.flightControllerIdentifier == 'INAV') {
|
||||||
MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function () {
|
||||||
if (semver.lt(CONFIG.flightControllerVersion, "5.0.0")) {
|
if (semver.lt(CONFIG.flightControllerVersion, "5.0.0")) {
|
||||||
GUI.log("Cannot prefetch target: INAV Firmware too old");
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFailOld'));
|
||||||
TABS.firmware_flasher.closeTempConnection();
|
TABS.firmware_flasher.closeTempConnection();
|
||||||
} else {
|
} else {
|
||||||
mspHelper.getCraftName(function(name) {
|
mspHelper.getCraftName(function(name) {
|
||||||
|
@ -721,13 +721,13 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GUI.log("Cannot prefetch target: Non-INAV Firmware");
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFailNonINAV'));
|
||||||
TABS.firmware_flasher.closeTempConnection();
|
TABS.firmware_flasher.closeTempConnection();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GUI.log("Cannot prefetch target: " + chrome.i18n.getMessage('serialPortOpenFail'));
|
GUI.log(chrome.i18n.getMessage('targetPrefetchFail') + chrome.i18n.getMessage('serialPortOpenFail'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -736,7 +736,7 @@ TABS.firmware_flasher.onValidFirmware = function() {
|
||||||
MSP.send_message(MSPCodes.MSP_BUILD_INFO, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_BUILD_INFO, false, false, function () {
|
||||||
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, function () {
|
||||||
$('select[name="board"] option[value=' + CONFIG.target + ']').attr("selected", "selected");
|
$('select[name="board"] option[value=' + CONFIG.target + ']').attr("selected", "selected");
|
||||||
GUI.log("Target prefetch successful: " + CONFIG.target);
|
GUI.log(chrome.i18n.getMessage('targetPrefetchsuccessful') + CONFIG.target);
|
||||||
|
|
||||||
TABS.firmware_flasher.closeTempConnection();
|
TABS.firmware_flasher.closeTempConnection();
|
||||||
$('select[name="board"]').change();
|
$('select[name="board"]').change();
|
||||||
|
|
|
@ -1797,7 +1797,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
clearEditForm();
|
clearEditForm();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
GUI.log("Previous selection was not a WAYPOINT!");
|
GUI.log(chrome.i18n.getMessage('notAWAYPOINT'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedFeature = map.forEachFeatureAtPixel(evt.pixel,
|
selectedFeature = map.forEachFeatureAtPixel(evt.pixel,
|
||||||
|
@ -2259,25 +2259,25 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
$('#loadEepromSafehomeButton').on('click', function () {
|
$('#loadEepromSafehomeButton').on('click', function () {
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start of getting Safehome points');
|
GUI.log(chrome.i18n.getMessage('startGettingSafehomePoints'));
|
||||||
mspHelper.loadSafehomes();
|
mspHelper.loadSafehomes();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
renderSafehomesTable();
|
renderSafehomesTable();
|
||||||
cleanSafehomeLayers();
|
cleanSafehomeLayers();
|
||||||
renderSafehomesOnMap();
|
renderSafehomesOnMap();
|
||||||
GUI.log('End of getting Safehome points');
|
GUI.log(chrome.i18n.getMessage('endGettingSafehomePoints'));
|
||||||
$('#loadEepromSafehomeButton').removeClass('disabled');
|
$('#loadEepromSafehomeButton').removeClass('disabled');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#saveEepromSafehomeButton').on('click', function () {
|
$('#saveEepromSafehomeButton').on('click', function() {
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start of sending Safehome points');
|
GUI.log(chrome.i18n.getMessage('startSendingSafehomePoints'));
|
||||||
mspHelper.saveSafehomes();
|
mspHelper.saveSafehomes();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
mspHelper.saveToEeprom();
|
mspHelper.saveToEeprom();
|
||||||
GUI.log('End of sending Safehome points');
|
GUI.log(chrome.i18n.getMessage('endSendingSafehomePoints'));
|
||||||
$('#saveEepromSafehomeButton').removeClass('disabled');
|
$('#saveEepromSafehomeButton').removeClass('disabled');
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
@ -2431,7 +2431,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
||||||
removeAllWaypoints();
|
removeAllWaypoints();
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start get point');
|
GUI.log(chrome.i18n.getMessage('startGetPoint'));
|
||||||
getWaypointsFromFC(false);
|
getWaypointsFromFC(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2441,7 +2441,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start send point');
|
GUI.log(chrome.i18n.getMessage('startSendPoint'));
|
||||||
sendWaypointsToFC(false);
|
sendWaypointsToFC(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2450,7 +2450,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
||||||
removeAllWaypoints();
|
removeAllWaypoints();
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start get point');
|
GUI.log(chrome.i18n.getMessage('startGetPoint'));
|
||||||
getWaypointsFromFC(true);
|
getWaypointsFromFC(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2460,7 +2460,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$(this).addClass('disabled');
|
$(this).addClass('disabled');
|
||||||
GUI.log('Start send point');
|
GUI.log(chrome.i18n.getMessage('startSendPoint'));
|
||||||
sendWaypointsToFC(true);
|
sendWaypointsToFC(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2494,17 +2494,17 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
function loadMissionFile(filename) {
|
function loadMissionFile(filename) {
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
if (!window.xml2js) return GUI.log('<span style="color: red">Error reading file (xml2js not found)</span>');
|
if (!window.xml2js) return GUI.log(chrome.i18n.getMessage('errorReadingFileXml2jsNotFound'));
|
||||||
|
|
||||||
fs.readFile(filename, (err, data) => {
|
fs.readFile(filename, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
GUI.log('<span style="color: red">Error reading file</span>');
|
GUI.log(chrome.i18n.getMessage('errorReadingFile'));
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.xml2js.Parser({ 'explicitChildren': true, 'preserveChildrenOrder': true }).parseString(data, (err, result) => {
|
window.xml2js.Parser({ 'explicitChildren': true, 'preserveChildrenOrder': true }).parseString(data, (err, result) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
GUI.log('<span style="color: red">Error parsing file</span>');
|
GUI.log(chrome.i18n.getMessage('errorParsingFile'));
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2636,7 +2636,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
updateTotalInfo();
|
updateTotalInfo();
|
||||||
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
||||||
GUI.log(sFilename+' has been loaded successfully !');
|
GUI.log(sFilename + chrome.i18n.getMessage('loadedSuccessfully'));
|
||||||
updateFilename(sFilename);
|
updateFilename(sFilename);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2644,7 +2644,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
function saveMissionFile(filename) {
|
function saveMissionFile(filename) {
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
if (!window.xml2js) return GUI.log('<span style="color: red">Error writing file (xml2js not found)</span>');
|
if (!window.xml2js) return GUI.log(chrome.i18n.getMessage('errorWritingFileXml2jsNotFound'));
|
||||||
|
|
||||||
var center = ol.proj.toLonLat(map.getView().getCenter());
|
var center = ol.proj.toLonLat(map.getView().getCenter());
|
||||||
var zoom = map.getView().getZoom();
|
var zoom = map.getView().getZoom();
|
||||||
|
@ -2693,11 +2693,11 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
xml = xml.replace(/missionitem mission/g, 'meta mission');
|
xml = xml.replace(/missionitem mission/g, 'meta mission');
|
||||||
fs.writeFile(filename, xml, (err) => {
|
fs.writeFile(filename, xml, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
GUI.log('<span style="color: red">Error writing file</span>');
|
GUI.log(chrome.i18n.getMessage('ErrorWritingFile'));
|
||||||
return console.error(err);
|
return console.error(err);
|
||||||
}
|
}
|
||||||
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
||||||
GUI.log(sFilename+' has been saved successfully !');
|
GUI.log(sFilename + chrome.i18n.getMessage('savedSuccessfully'));
|
||||||
updateFilename(sFilename);
|
updateFilename(sFilename);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2715,7 +2715,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
|
|
||||||
function getWaypointData() {
|
function getWaypointData() {
|
||||||
mspHelper.loadWaypoints(function() {
|
mspHelper.loadWaypoints(function() {
|
||||||
GUI.log('End get point');
|
GUI.log(chrome.i18n.getMessage('endGetPoint'));
|
||||||
if (loadEeprom) {
|
if (loadEeprom) {
|
||||||
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
|
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
|
||||||
$('#loadEepromMissionButton').removeClass('disabled');
|
$('#loadEepromMissionButton').removeClass('disabled');
|
||||||
|
@ -2757,7 +2757,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
MISSION_PLANNER.copy(mission);
|
MISSION_PLANNER.copy(mission);
|
||||||
MISSION_PLANNER.update(false, true, true);
|
MISSION_PLANNER.update(false, true, true);
|
||||||
mspHelper.saveWaypoints(function() {
|
mspHelper.saveWaypoints(function() {
|
||||||
GUI.log('End send point');
|
GUI.log(chrome.i18n.getMessage('endSendPoint'));
|
||||||
if (saveEeprom) {
|
if (saveEeprom) {
|
||||||
$('#saveEepromMissionButton').removeClass('disabled');
|
$('#saveEepromMissionButton').removeClass('disabled');
|
||||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||||
|
|
|
@ -3076,7 +3076,7 @@ TABS.osd.initialize = function (callback) {
|
||||||
Settings.saveInputs().then(function () {
|
Settings.saveInputs().then(function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
|
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
|
||||||
GUI.log('OSD settings saved');
|
GUI.log(chrome.i18n.getMessage('osdSettingsSaved'));
|
||||||
var oldText = $(this).text();
|
var oldText = $(this).text();
|
||||||
$(this).html("Saved");
|
$(this).html("Saved");
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -3264,7 +3264,7 @@ TABS.osd.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('You don\'t have write permissions for this file, sorry.');
|
console.log('You don\'t have write permissions for this file, sorry.');
|
||||||
GUI.log('You don\'t have <span style="color: red">write permissions</span> for this file');
|
GUI.log(chrome.i18n.getMessage('writePermissionsForFile'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue