mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 03:19:54 +03:00
Init
This commit is contained in:
parent
939f5af04b
commit
f24ccfc637
96 changed files with 16438 additions and 8058 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -5,14 +5,6 @@ npm-debug.log
|
|||
.idea/
|
||||
npm-debug.log
|
||||
inav-configurator.iml
|
||||
# Generated scripts and styles
|
||||
/build
|
||||
# Used by nw-builder to download runtimes
|
||||
/cache
|
||||
# Where we put the final app directory structure
|
||||
/dist
|
||||
# Path where the NW.js apps get built
|
||||
/apps
|
||||
/.vscode/
|
||||
/out
|
||||
.eslintrc.json
|
||||
/.project
|
||||
|
|
19
.vscode/launch.json
vendored
Normal file
19
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Electron Main",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.sh",
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/@electron-forge/cli/script/vscode.cmd",
|
||||
|
||||
},
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
}
|
30
README.md
30
README.md
|
@ -40,6 +40,8 @@ Depending on the target operating system, _INAV Configurator_ is distributed as
|
|||
|
||||
### Linux
|
||||
|
||||
### Outdated, TODO: Update for Electron
|
||||
|
||||
1. Visit [release page](https://github.com/iNavFlight/inav-configurator/releases)
|
||||
2. Download Configurator for Linux platform (linux32 and linux64 are present)
|
||||
* **.rpm** is the Fedora installation file. Just download and install using `sudo dnf localinstall /path/to/INAV-Configurator_linux64-x.y.z-x86_64.rpm` or open it with a package manager (e.g. via Files)
|
||||
|
@ -101,29 +103,25 @@ For local development, the **node.js** build system is used.
|
|||
1. Install node.js
|
||||
1. From the project folder run `npm install`
|
||||
1. To build the JS and CSS files and start the configurator:
|
||||
- With NW.js: Run `npm start`.
|
||||
- With Chrome: Run `npm run gulp`. Then open `chrome://extensions`, enable
|
||||
the `Developer mode`, click on the `Load unpacked extension...` button, and select the `inav-configurator` directory.
|
||||
- Run `npm start`.
|
||||
|
||||
Other tasks are also defined in `gulpfile.js`. To run a task, use `node ./node_modules/gulp/bin/gulp.js task-name`. Available ones are:
|
||||
To build the App run `npm run make` to build for your platform.
|
||||
|
||||
- **build**: Generate JS and CSS output files used by the configurator from their sources. It must be run whenever changes are made to any `.js` or `.css` files in order to have those changes appear
|
||||
in the configurator. If new files are added, they must be included in `gulpfile.js`. See the comments at the top of `gulpfile.js` to learn how to do so. See also the `watch` task.
|
||||
- **watch**: Watch JS and CSS sources for changes and run the `build` task whenever they're edited.
|
||||
- **dist**: Create a distribution of the app (valid for packaging both as a Chrome app or NW.js app)
|
||||
in the `./dist/` directory.
|
||||
- **release**: Create NW.js apps for each supported platform (win32, osx64 and linux64) in the `./apps`
|
||||
directory. Running this task on macOS or Linux requires Wine since it's needed to set the icon
|
||||
for the Windows app. If you don't have Wine installed, you can create a release by running the **release-only-Linux** task.
|
||||
<br>`--installer` argument can be added to build installers for a particular OS. NOTE: MacOS Installer can be built with MacOS only.
|
||||
Options:
|
||||
* Architecture: --arch - Allowed values are: "ia32", "x64", "armv7l", "arm64", "universal", or "mips64el".
|
||||
|
||||
To build a specific release, use the command `release --platform="win64"` for example.
|
||||
See [Electron Forge CLI Documentation](https://www.electronforge.io/cli#options-2) for details
|
||||
|
||||
Example (note the double -- ):
|
||||
``` npm start -- --arch="ia32 ```
|
||||
|
||||
### Running with debug | Inspector
|
||||
|
||||
To be able to open Inspector, you will need SDK flavours of NW.js
|
||||
To be able to open Inspector, set envorinment variable `NODE_ENV` to `develpoment` or set the flag directly when run `npm start`:
|
||||
|
||||
`npm install nw@0.61.0 --nwjs_build_type=sdk`
|
||||
``` NODE_ENV=development npm start ```
|
||||
|
||||
Or use vscode and start a debug session `Electron Main` (Just hit F5!)
|
||||
|
||||
## Different map providers
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
theme: jekyll-theme-slate
|
117
eventPage.js
117
eventPage.js
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
If an id is also specified and a window with a matching id has been shown before, the remembered bounds of the window will be used instead.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
function startApplication() {
|
||||
var applicationStartTime = new Date().getTime();
|
||||
|
||||
chrome.app.window.create('main.html', {
|
||||
id: 'main-window',
|
||||
frame: 'chrome',
|
||||
innerBounds: {
|
||||
minWidth: 1024,
|
||||
minHeight: 550
|
||||
}
|
||||
}, function (createdWindow) {
|
||||
createdWindow.contentWindow.addEventListener('load', function () {
|
||||
createdWindow.contentWindow.catch_startup_time(applicationStartTime);
|
||||
});
|
||||
|
||||
createdWindow.onClosed.addListener(function () {
|
||||
// automatically close the port when application closes
|
||||
// save connectionId in separate variable before createdWindow.contentWindow is destroyed
|
||||
var connectionId = createdWindow.contentWindow.CONFIGURATOR.connection.connectionId,
|
||||
valid_connection = createdWindow.contentWindow.CONFIGURATOR.connectionValid,
|
||||
mincommand = createdWindow.contentWindow.MISC.mincommand;
|
||||
|
||||
console.log("EP:" + connectionId);
|
||||
if (connectionId && valid_connection) {
|
||||
// code below is handmade MSP message (without pretty JS wrapper), it behaves exactly like MSP.send_message
|
||||
// sending exit command just in case the cli tab was open.
|
||||
// reset motors to default (mincommand)
|
||||
|
||||
var bufferOut = new ArrayBuffer(5),
|
||||
bufView = new Uint8Array(bufferOut);
|
||||
|
||||
bufView[0] = 0x65; // e
|
||||
bufView[1] = 0x78; // x
|
||||
bufView[2] = 0x69; // i
|
||||
bufView[3] = 0x74; // t
|
||||
bufView[4] = 0x0D; // enter
|
||||
|
||||
chrome.serial.send(connectionId, bufferOut, function () { console.log('Send exit') });
|
||||
|
||||
setTimeout(function() {
|
||||
bufferOut = new ArrayBuffer(22);
|
||||
bufView = new Uint8Array(bufferOut);
|
||||
var checksum = 0;
|
||||
|
||||
bufView[0] = 36; // $
|
||||
bufView[1] = 77; // M
|
||||
bufView[2] = 60; // <
|
||||
bufView[3] = 16; // data length
|
||||
bufView[4] = 214; // MSP_SET_MOTOR
|
||||
|
||||
checksum = bufView[3] ^ bufView[4];
|
||||
|
||||
for (var i = 0; i < 16; i += 2) {
|
||||
bufView[i + 5] = mincommand & 0x00FF;
|
||||
bufView[i + 6] = mincommand >> 8;
|
||||
|
||||
checksum ^= bufView[i + 5];
|
||||
checksum ^= bufView[i + 6];
|
||||
}
|
||||
|
||||
bufView[5 + 16] = checksum;
|
||||
|
||||
chrome.serial.send(connectionId, bufferOut, function (sendInfo) {
|
||||
chrome.serial.disconnect(connectionId, function (result) {
|
||||
console.log('SERIAL: Connection closed - ' + result);
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
} else if (connectionId) {
|
||||
chrome.serial.disconnect(connectionId, function (result) {
|
||||
console.log('SERIAL: Connection closed - ' + result);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
chrome.app.runtime.onLaunched.addListener(startApplication);
|
||||
|
||||
chrome.runtime.onInstalled.addListener(function (details) {
|
||||
if (details.reason == 'update') {
|
||||
var previousVersionArr = details.previousVersion.split('.'),
|
||||
currentVersionArr = chrome.runtime.getManifest().version.split('.');
|
||||
|
||||
// only fire up notification sequence when one of the major version numbers changed
|
||||
if (currentVersionArr[0] > previousVersionArr[0] || currentVersionArr[1] > previousVersionArr[1]) {
|
||||
chrome.storage.local.get('update_notify', function (result) {
|
||||
if (result.update_notify === 'undefined' || result.update_notify) {
|
||||
var manifest = chrome.runtime.getManifest();
|
||||
var options = {
|
||||
priority: 0,
|
||||
type: 'basic',
|
||||
title: manifest.name,
|
||||
message: chrome.i18n.getMessage('notifications_app_just_updated_to_version', [manifest.version]),
|
||||
iconUrl: '/images/icon_128.png',
|
||||
buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}]
|
||||
};
|
||||
|
||||
chrome.notifications.create('baseflight_update', options, function (notificationId) {
|
||||
// empty
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
chrome.notifications.onButtonClicked.addListener(function (notificationId, buttonIndex) {
|
||||
if (notificationId == 'baseflight_update') {
|
||||
startApplication();
|
||||
}
|
||||
});
|
32
forge.config.js
Normal file
32
forge.config.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
packagerConfig: {
|
||||
asar: true,
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
/*
|
||||
{
|
||||
name: '@electron-forge/maker-squirrel',
|
||||
config: {},
|
||||
},
|
||||
*/
|
||||
{
|
||||
name: '@electron-forge/maker-zip',
|
||||
platforms: ['win32', 'darwin'],
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-deb',
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-rpm',
|
||||
config: {},
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
{
|
||||
name: '@electron-forge/plugin-auto-unpack-natives',
|
||||
config: {},
|
||||
},
|
||||
],
|
||||
};
|
728
gulpfile.js
728
gulpfile.js
|
@ -1,728 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var child_process = require('child_process');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var minimist = require('minimist');
|
||||
|
||||
var archiver = require('archiver');
|
||||
var del = require('del');
|
||||
var NwBuilder = require('nw-builder');
|
||||
var semver = require('semver');
|
||||
|
||||
var gulp = require('gulp');
|
||||
var concat = require('gulp-concat');
|
||||
|
||||
const commandExistsSync = require('command-exists').sync;
|
||||
|
||||
// Each key in the *sources* variable must be an array of
|
||||
// the source files that will be combined into a single
|
||||
// file and stored in *outputDir*. Each key in *sources*
|
||||
// must be also present in *output*, whose value indicates
|
||||
// the filename for the output file which combines the
|
||||
// contents of the source files.
|
||||
//
|
||||
// Keys must be camel cased and end with either 'Css' or
|
||||
// 'Js' (e.g. someSourcesCss or someSourcesJs). For each
|
||||
// key, a build task will be generated named by prepending
|
||||
// 'build-' and converting the key to dash-separated words
|
||||
// (e.g. someSourcesCss will generate build-some-sources-css).
|
||||
//
|
||||
// Tasks with names ending with '-js' will be executed by the
|
||||
// build-all-js task, while the ones ending with '-css' will
|
||||
// be done by build-all-css. There's also a build task which
|
||||
// runs both build-all-css and build-all-js.
|
||||
//
|
||||
// The watch task will monitor any files mentioned in the *sources*
|
||||
// variable and regenerate the corresponding output file when
|
||||
// they change.
|
||||
//
|
||||
// See README.md for details on the other tasks.
|
||||
|
||||
var sources = {};
|
||||
|
||||
sources.css = [
|
||||
'./main.css',
|
||||
'./js/libraries/jquery.nouislider.min.css',
|
||||
'./js/libraries/jquery.nouislider.pips.min.css',
|
||||
'./js/libraries/flightindicators.css',
|
||||
'./src/css/tabs/*.css',
|
||||
'./src/css/opensans_webfontkit/fonts.css',
|
||||
'./src/css/font-awesome/css/font-awesome.css',
|
||||
'./src/css/dropdown-lists/css/style_lists.css',
|
||||
'./js/libraries/switchery/switchery.css',
|
||||
'./js/libraries/jbox/jBox.css',
|
||||
'./node_modules/openlayers/dist/ol.css',
|
||||
'./src/css/logic.css',
|
||||
'./src/css/defaults_dialog.css',
|
||||
];
|
||||
|
||||
sources.js = [
|
||||
'./js/libraries/google-analytics-bundle.js',
|
||||
'./node_modules/jquery/dist/jquery.min.js',
|
||||
'./node_modules/jquery-ui-npm/jquery-ui.min.js',
|
||||
'./node_modules/marked/lib/marked.js',
|
||||
'./js/libraries/d3.min.js',
|
||||
'./js/libraries/jquery.nouislider.all.min.js',
|
||||
'./node_modules/three/build/three.min.js',
|
||||
'./node_modules/three/examples/js/loaders/GLTFLoader.js',
|
||||
'./node_modules/three/examples/js/controls/OrbitControls.js',
|
||||
'./js/libraries/nw-dialog.js',
|
||||
'./js/libraries/bundle_xml2js.js',
|
||||
'./js/libraries/Projector.js',
|
||||
'./js/libraries/CanvasRenderer.js',
|
||||
'./js/libraries/jquery.flightindicators.js',
|
||||
'./js/libraries/semver.js',
|
||||
'./js/libraries/jbox/jBox.min.js',
|
||||
'./js/libraries/switchery/switchery.js',
|
||||
'./js/libraries/jquery.ba-throttle-debounce.js',
|
||||
'./js/helpers.js',
|
||||
'./node_modules/inflection/inflection.min.js',
|
||||
'./node_modules/bluebird/js/browser/bluebird.min.js',
|
||||
'./js/injected_methods.js',
|
||||
'./js/intervals.js',
|
||||
'./js/timeouts.js',
|
||||
'./js/pid_controller.js',
|
||||
'./js/simple_smooth_filter.js',
|
||||
'./js/walking_average_filter.js',
|
||||
'./js/gui.js',
|
||||
'./js/msp/MSPCodes.js',
|
||||
'./js/msp/MSPHelper.js',
|
||||
'./js/msp/MSPchainer.js',
|
||||
'./js/port_handler.js',
|
||||
'./js/connection/connection.js',
|
||||
'./js/connection/connectionBle.js',
|
||||
'./js/connection/connectionSerial.js',
|
||||
'./js/connection/connectionTcp.js',
|
||||
'./js/connection/connectionUdp.js',
|
||||
'./js/servoMixRule.js',
|
||||
'./js/motorMixRule.js',
|
||||
'./js/logicCondition.js',
|
||||
'./js/settings.js',
|
||||
'./js/outputMapping.js',
|
||||
'./js/model.js',
|
||||
'./js/serial_backend.js',
|
||||
'./js/data_storage.js',
|
||||
'./js/fc.js',
|
||||
'./js/msp.js',
|
||||
'./js/protocols/stm32.js',
|
||||
'./js/protocols/stm32usbdfu.js',
|
||||
'./js/localization.js',
|
||||
'./js/boards.js',
|
||||
'./js/servoMixerRuleCollection.js',
|
||||
'./js/motorMixerRuleCollection.js',
|
||||
'./js/logicConditionsCollection.js',
|
||||
'./js/logicConditionsStatus.js',
|
||||
'./js/globalVariablesStatus.js',
|
||||
'./js/programmingPid.js',
|
||||
'./js/programmingPidCollection.js',
|
||||
'./js/programmingPidStatus.js',
|
||||
'./js/vtx.js',
|
||||
'./main.js',
|
||||
'./js/tabs.js',
|
||||
'./tabs/*.js',
|
||||
'./js/eventFrequencyAnalyzer.js',
|
||||
'./js/periodicStatusUpdater.js',
|
||||
'./js/serial_queue.js',
|
||||
'./js/msp_balanced_interval.js',
|
||||
'./tabs/advanced_tuning.js',
|
||||
'./tabs/ez_tune.js',
|
||||
'./js/peripherals.js',
|
||||
'./js/appUpdater.js',
|
||||
'./js/feature_framework.js',
|
||||
'./js/defaults_dialog.js',
|
||||
'./js/safehomeCollection.js',
|
||||
'./js/safehome.js',
|
||||
'./js/waypointCollection.js',
|
||||
'./js/waypoint.js',
|
||||
'./node_modules/openlayers/dist/ol.js',
|
||||
'./js/libraries/plotly-latest.min.js',
|
||||
'./js/sitl.js',
|
||||
'./js/CliAutoComplete.js',
|
||||
'./node_modules/jquery-textcomplete/dist/jquery.textcomplete.js'
|
||||
];
|
||||
|
||||
sources.receiverCss = [
|
||||
'./src/css/tabs/receiver_msp.css',
|
||||
'./src/css/opensans_webfontkit/fonts.css',
|
||||
'./js/libraries/jquery.nouislider.min.css',
|
||||
'./js/libraries/jquery.nouislider.pips.min.css',
|
||||
];
|
||||
|
||||
sources.receiverJs = [
|
||||
'./node_modules/jquery/dist/jquery.min.js',
|
||||
'./node_modules/jquery-ui-npm/jquery-ui.min.js',
|
||||
'./js/libraries/jquery.nouislider.all.min.js',
|
||||
'./tabs/receiver_msp.js'
|
||||
];
|
||||
|
||||
sources.debugTraceJs = [
|
||||
'./js/debug_trace.js'
|
||||
];
|
||||
|
||||
sources.hexParserJs = [
|
||||
'./js/workers/hex_parser.js',
|
||||
];
|
||||
|
||||
var output = {
|
||||
css: 'styles.css',
|
||||
js: 'script.js',
|
||||
receiverCss: 'receiver-msp.css',
|
||||
receiverJs: 'receiver-msp.js',
|
||||
debugTraceJs: 'debug-trace.js',
|
||||
hexParserJs: 'hex_parser.js',
|
||||
};
|
||||
|
||||
|
||||
var outputDir = './build/';
|
||||
var distDir = './dist/';
|
||||
var appsDir = './apps/';
|
||||
|
||||
function get_task_name(key) {
|
||||
return 'build-' + key.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();});
|
||||
}
|
||||
|
||||
function getArguments() {
|
||||
return minimist(process.argv.slice(2));
|
||||
}
|
||||
|
||||
function getPlatforms() {
|
||||
const defaultPlatforms = ['win32', 'win64', 'osx64', 'linux32', 'linux64'];
|
||||
const platform = getArguments().platform;
|
||||
if (platform) {
|
||||
if (defaultPlatforms.indexOf(platform) < 0) {
|
||||
throw new Error(`Invalid platform "${platform}". Available ones are: ${defaultPlatforms}`)
|
||||
}
|
||||
return [platform];
|
||||
}
|
||||
return defaultPlatforms;
|
||||
}
|
||||
|
||||
function execSync() {
|
||||
const cmd = arguments[0];
|
||||
const args = Array.prototype.slice.call(arguments, 1);
|
||||
const result = child_process.spawnSync(cmd, args, {stdio: 'inherit'});
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
}
|
||||
|
||||
// Define build tasks dynamically based on the sources
|
||||
// and output variables.
|
||||
var buildCssTasks = [];
|
||||
var buildJsTasks = [];
|
||||
(function() {
|
||||
// Convers fooBarBaz to foo-bar-baz
|
||||
for (var k in output) {
|
||||
(function (key) {
|
||||
var name = get_task_name(key);
|
||||
if (name.endsWith('-css')) {
|
||||
buildCssTasks.push(name);
|
||||
} else if (name.endsWith('-js')) {
|
||||
buildJsTasks.push(name);
|
||||
} else {
|
||||
throw 'Invalid task name: "' + name + '": must end with -css or -js';
|
||||
}
|
||||
gulp.task(name, function() {
|
||||
return gulp.src(sources[key])
|
||||
.pipe(concat(output[key]))
|
||||
.pipe(gulp.dest(outputDir));
|
||||
});
|
||||
})(k);
|
||||
}
|
||||
})();
|
||||
|
||||
gulp.task('build-all-js', gulp.parallel(buildJsTasks))
|
||||
gulp.task('build-all-css', gulp.parallel(buildCssTasks));
|
||||
gulp.task('build', gulp.parallel('build-all-css', 'build-all-js'));
|
||||
|
||||
gulp.task('clean', function() { return del(['./build/**', './dist/**'], {force: true}); });
|
||||
|
||||
// Real work for dist task. Done in another task to call it via
|
||||
// run-sequence.
|
||||
gulp.task('dist-build', gulp.series('build', function() {
|
||||
var distSources = [
|
||||
'./package.json', // For NW.js
|
||||
'./manifest.json', // For Chrome app
|
||||
'./eventPage.js',
|
||||
'./*.html',
|
||||
'./tabs/*.html',
|
||||
'./images/**/*',
|
||||
'./_locales/**/*',
|
||||
'./build/*',
|
||||
'./src/css/font-awesome/webfonts/*',
|
||||
'./src/css/opensans_webfontkit/*.{eot,svg,ttf,woff,woff2}',
|
||||
'./resources/*.json',
|
||||
'./resources/models/*',
|
||||
'./resources/osd/analogue/*.mcm',
|
||||
'./resources/motor_order/*.svg',
|
||||
'./resources/sitl/windows/*',
|
||||
'./resources/sitl/linux/*'
|
||||
];
|
||||
return gulp.src(distSources, { base: '.' })
|
||||
.pipe(gulp.dest(distDir));
|
||||
}));
|
||||
|
||||
gulp.task('dist', gulp.series('clean', 'dist-build'));
|
||||
|
||||
// Create app directories in ./apps
|
||||
gulp.task('apps', gulp.series('dist', function(done) {
|
||||
var builder = new NwBuilder({
|
||||
files: './dist/**/*',
|
||||
buildDir: appsDir,
|
||||
platforms: getPlatforms(),
|
||||
flavor: 'normal',
|
||||
macIcns: './images/inav.icns',
|
||||
winIco: './images/inav.ico',
|
||||
version: get_nw_version(),
|
||||
zip: false
|
||||
});
|
||||
builder.on('log', console.log);
|
||||
builder.build(function (err) {
|
||||
if (err) {
|
||||
console.log("Error building NW apps:" + err);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
// Package apps as .zip files
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
function get_nw_version() {
|
||||
return semver.valid(semver.coerce(require('./package.json').dependencies.nw));
|
||||
}
|
||||
|
||||
function get_release_filename_base(platform) {
|
||||
return 'INAV-Configurator_' + platform;
|
||||
}
|
||||
|
||||
function get_release_filename(platform, ext, addition = '') {
|
||||
var pkg = require('./package.json');
|
||||
return get_release_filename_base(platform) + addition + '_' + pkg.version + '.' + ext;
|
||||
}
|
||||
|
||||
function build_win_zip(arch) {
|
||||
return function build_win_zip_proc(done) {
|
||||
var pkg = require('./package.json');
|
||||
|
||||
// Create ZIP
|
||||
console.log(`Creating ${arch} ZIP file...`);
|
||||
var src = path.join(appsDir, pkg.name, arch);
|
||||
var output = fs.createWriteStream(path.join(appsDir, get_release_filename(arch, 'zip')));
|
||||
var archive = archiver('zip', {
|
||||
zlib: { level: 9 }
|
||||
});
|
||||
archive.on('warning', function(err) { throw err; });
|
||||
archive.on('error', function(err) { throw err; });
|
||||
archive.pipe(output);
|
||||
archive.directory(src, 'INAV Configurator');
|
||||
return archive.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
function build_win_iss(arch) {
|
||||
return function build_win_iss_proc(done) {
|
||||
if (!getArguments().installer) {
|
||||
done();
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create Installer
|
||||
console.log(`Creating ${arch} Installer...`);
|
||||
const innoSetup = require('@quanle94/innosetup');
|
||||
|
||||
const APPS_DIR = './apps/';
|
||||
const pkg = require('./package.json');
|
||||
|
||||
// Parameters passed to the installer script
|
||||
const parameters = [];
|
||||
|
||||
// Extra parameters to replace inside the iss file
|
||||
parameters.push(`/Dversion=${pkg.version}`);
|
||||
parameters.push(`/DarchName=${arch}`);
|
||||
parameters.push(`/DarchAllowed=${(arch === 'win32') ? 'x86 x64' : 'x64'}`);
|
||||
parameters.push(`/DarchInstallIn64bit=${(arch === 'win32') ? '' : 'x64'}`);
|
||||
parameters.push(`/DsourceFolder=${APPS_DIR}`);
|
||||
parameters.push(`/DtargetFolder=${APPS_DIR}`);
|
||||
|
||||
// Show only errors in console
|
||||
parameters.push(`/Q`);
|
||||
|
||||
// Script file to execute
|
||||
parameters.push("assets/windows/installer.iss");
|
||||
|
||||
innoSetup(parameters, {},
|
||||
function(error) {
|
||||
if (error != null) {
|
||||
console.error(`Installer for platform ${arch} finished with error ${error}`);
|
||||
} else {
|
||||
console.log(`Installer for platform ${arch} finished`);
|
||||
}
|
||||
done();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('release-win32', gulp.series(build_win_zip('win32'), build_win_iss('win32')));
|
||||
gulp.task('release-win64', gulp.series(build_win_zip('win64'), build_win_iss('win64')));
|
||||
|
||||
gulp.task('release-osx64', function(done) {
|
||||
var pkg = require('./package.json');
|
||||
var src = path.join(appsDir, pkg.name, 'osx64', pkg.name + '.app');
|
||||
// Check if we want to sign the .app bundle
|
||||
if (getArguments().codesign) {
|
||||
// macapptool can be downloaded from
|
||||
// https://github.com/fiam/macapptool
|
||||
//
|
||||
// Make sure the bundle is well formed
|
||||
execSync('macapptool', '-v', '1', 'fix', src);
|
||||
// Sign
|
||||
const codesignArgs = ['macapptool', '-v', '1', 'sign'];
|
||||
const codesignIdentity = getArguments()['codesign-identity'];
|
||||
if (codesignIdentity) {
|
||||
codesignArgs.push('-i', codesignIdentity);
|
||||
}
|
||||
codesignArgs.push('-e', 'entitlements.plist');
|
||||
codesignArgs.push(src)
|
||||
execSync.apply(this, codesignArgs);
|
||||
|
||||
// Check if the bundle is signed
|
||||
const codesignCheckArgs = [ 'codesign', '-vvv', '--deep', '--strict', src ];
|
||||
execSync.apply(this, codesignCheckArgs);
|
||||
}
|
||||
|
||||
// 'old' .zip mode
|
||||
if (!getArguments().installer) {
|
||||
const zipFilename = path.join(appsDir, get_release_filename('macOS', 'zip'));
|
||||
console.log('Creating ZIP file: ' + zipFilename);
|
||||
var output = fs.createWriteStream(zipFilename);
|
||||
var archive = archiver('zip', {
|
||||
zlib: { level: 9 }
|
||||
});
|
||||
archive.on('warning', function(err) { throw err; });
|
||||
archive.on('error', function(err) { throw err; });
|
||||
archive.pipe(output);
|
||||
archive.directory(src, 'INAV Configurator.app');
|
||||
output.on('close', function() {
|
||||
if (getArguments().notarize) {
|
||||
console.log('Notarizing DMG file: ' + zipFilename);
|
||||
const notarizeArgs = ['macapptool', '-v', '1', 'notarize'];
|
||||
const notarizationUsername = getArguments()['notarization-username'];
|
||||
if (notarizationUsername) {
|
||||
notarizeArgs.push('-u', notarizationUsername)
|
||||
}
|
||||
const notarizationPassword = getArguments()['notarization-password'];
|
||||
if (notarizationPassword) {
|
||||
notarizeArgs.push('-p', notarizationPassword)
|
||||
}
|
||||
notarizeArgs.push(zipFilename)
|
||||
execSync.apply(this, notarizeArgs);
|
||||
}
|
||||
done();
|
||||
});
|
||||
archive.finalize();
|
||||
}
|
||||
// 'new' .dmg mode
|
||||
else {
|
||||
const appdmg = require('appdmg');
|
||||
|
||||
var target = path.join(appsDir, get_release_filename('macOS', 'dmg'));
|
||||
console.log('Creating DMG file: ' + target);
|
||||
var basepath = path.join(appsDir, pkg.name, 'osx64');
|
||||
console.log('Base path: ' + basepath);
|
||||
|
||||
if (fs.existsSync(target)) {
|
||||
fs.unlinkSync(target);
|
||||
}
|
||||
|
||||
var specs = {};
|
||||
|
||||
specs["title"] = "INAV Configurator";
|
||||
specs["contents"] = [
|
||||
{ "x": 448, "y": 342, "type": "link", "path": "/Applications" },
|
||||
{ "x": 192, "y": 344, "type": "file", "path": pkg.name + ".app", "name": "INAV Configurator.app" },
|
||||
];
|
||||
specs["background"] = path.join(__dirname, 'assets/osx/dmg-background.png');
|
||||
specs["format"] = "UDZO";
|
||||
specs["window"] = {
|
||||
"size": {
|
||||
"width": 638,
|
||||
"height": 479,
|
||||
}
|
||||
};
|
||||
|
||||
const codesignIdentity = getArguments()['codesign-identity'];
|
||||
if (getArguments().codesign) {
|
||||
specs['code-sign'] = {
|
||||
'signing-identity': codesignIdentity,
|
||||
}
|
||||
}
|
||||
|
||||
const ee = appdmg({
|
||||
target: target,
|
||||
basepath: basepath,
|
||||
specification: specs,
|
||||
});
|
||||
|
||||
ee.on('progress', function(info) {
|
||||
//console.log(info);
|
||||
});
|
||||
|
||||
ee.on('error', function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
ee.on('finish', function() {
|
||||
if (getArguments().codesign) {
|
||||
// Check if the bundle is signed
|
||||
const codesignCheckArgs = [ 'codesign', '-vvv', '--deep', '--strict', target ];
|
||||
execSync.apply(this, codesignCheckArgs);
|
||||
}
|
||||
if (getArguments().notarize) {
|
||||
console.log('Notarizing DMG file: ' + target);
|
||||
const notarizeArgs = ['xcrun', 'notarytool', 'submit'];
|
||||
notarizeArgs.push(target);
|
||||
const notarizationUsername = getArguments()['notarization-username'];
|
||||
if (notarizationUsername) {
|
||||
notarizeArgs.push('--apple-id', notarizationUsername)
|
||||
} else {
|
||||
throw new Error('Missing notarization username');
|
||||
}
|
||||
const notarizationPassword = getArguments()['notarization-password'];
|
||||
if (notarizationPassword) {
|
||||
notarizeArgs.push('--password', notarizationPassword)
|
||||
} else {
|
||||
throw new Error('Missing notarization password');
|
||||
}
|
||||
const notarizationTeamId = getArguments()['notarization-team-id'];
|
||||
if (notarizationTeamId) {
|
||||
notarizeArgs.push('--team-id', notarizationTeamId)
|
||||
} else {
|
||||
throw new Error('Missing notarization Team ID');
|
||||
}
|
||||
notarizeArgs.push('--wait');
|
||||
|
||||
const notarizationWebhook = getArguments()['notarization-webhook'];
|
||||
if (notarizationWebhook) {
|
||||
notarizeArgs.push('--webhook', notarizationWebhook);
|
||||
}
|
||||
execSync.apply(this, notarizeArgs);
|
||||
|
||||
console.log('Stapling DMG file: ' + target);
|
||||
const stapleArgs = ['xcrun', 'stapler', 'staple'];
|
||||
stapleArgs.push(target);
|
||||
execSync.apply(this, stapleArgs);
|
||||
|
||||
console.log('Checking DMG file: ' + target);
|
||||
const checkArgs = ['spctl', '-vvv', '--assess', '--type', 'install', target];
|
||||
execSync.apply(this, checkArgs);
|
||||
}
|
||||
done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function post_build(arch, folder) {
|
||||
return function post_build_linux(done) {
|
||||
if ((arch === 'linux32') || (arch === 'linux64')) {
|
||||
const metadata = require('./package.json');
|
||||
// Copy Ubuntu launcher scripts to destination dir
|
||||
const launcherDir = path.join(folder, metadata.name, arch);
|
||||
console.log(`Copy Ubuntu launcher scripts to ${launcherDir}`);
|
||||
return gulp.src('assets/linux/**')
|
||||
.pipe(gulp.dest(launcherDir));
|
||||
}
|
||||
|
||||
return done();
|
||||
}
|
||||
}
|
||||
|
||||
// Create the dir directory, with write permissions
|
||||
function createDirIfNotExists(dir) {
|
||||
fs.mkdir(dir, '0775', function(err) {
|
||||
if (err && err.code !== 'EEXIST') {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function release_deb(arch) {
|
||||
return function release_deb_proc(done) {
|
||||
if (!getArguments().installer) {
|
||||
done();
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if dpkg-deb exists
|
||||
if (!commandExistsSync('dpkg-deb')) {
|
||||
console.warn(`dpkg-deb command not found, not generating deb package for ${arch}`);
|
||||
done();
|
||||
return null;
|
||||
}
|
||||
|
||||
const deb = require('gulp-debian');
|
||||
const LINUX_INSTALL_DIR = '/opt/inav';
|
||||
const metadata = require('./package.json');
|
||||
|
||||
console.log(`Generating deb package for ${arch}`);
|
||||
|
||||
return gulp.src([path.join(appsDir, metadata.name, arch, '*')])
|
||||
.pipe(deb({
|
||||
package: metadata.name,
|
||||
version: metadata.version,
|
||||
section: 'base',
|
||||
priority: 'optional',
|
||||
architecture: getLinuxPackageArch('deb', arch),
|
||||
maintainer: metadata.author,
|
||||
description: metadata.description,
|
||||
preinst: [`rm -rf ${LINUX_INSTALL_DIR}/${metadata.name}`],
|
||||
postinst: [
|
||||
`chown root:root ${LINUX_INSTALL_DIR}`,
|
||||
`chown -R root:root ${LINUX_INSTALL_DIR}/${metadata.name}`,
|
||||
`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${metadata.name}/${metadata.name}.desktop`,
|
||||
],
|
||||
prerm: [`xdg-desktop-menu uninstall ${metadata.name}.desktop`],
|
||||
depends: ['libgconf-2-4', 'libatomic1'],
|
||||
changelog: [],
|
||||
_target: `${LINUX_INSTALL_DIR}/${metadata.name}`,
|
||||
_out: appsDir,
|
||||
_copyright: 'assets/linux/copyright',
|
||||
_clean: true,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function post_release_deb(arch) {
|
||||
return function post_release_linux_deb(done) {
|
||||
if (!getArguments().installer) {
|
||||
done();
|
||||
return null;
|
||||
}
|
||||
if ((arch === 'linux32') || (arch === 'linux64')) {
|
||||
var rename = require("gulp-rename");
|
||||
const metadata = require('./package.json');
|
||||
const renameFrom = path.join(appsDir, metadata.name + '_' + metadata.version + '_' + getLinuxPackageArch('.deb', arch) + '.deb');
|
||||
const renameTo = path.join(appsDir, get_release_filename_base(arch) + '_' + metadata.version + '.deb');
|
||||
// Rename .deb build to common naming
|
||||
console.log(`Renaming .deb installer ${renameFrom} to ${renameTo}`);
|
||||
return gulp.src(renameFrom)
|
||||
.pipe(rename(renameTo))
|
||||
.pipe(gulp.dest("."));
|
||||
}
|
||||
|
||||
return done();
|
||||
}
|
||||
}
|
||||
|
||||
function release_rpm(arch) {
|
||||
return function release_rpm_proc(done) {
|
||||
if (!getArguments().installer) {
|
||||
done();
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if rpmbuild exists
|
||||
if (!commandExistsSync('rpmbuild')) {
|
||||
console.warn(`rpmbuild command not found, not generating rpm package for ${arch}`);
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
const buildRpm = require('rpm-builder');
|
||||
const NAME_REGEX = /-/g;
|
||||
const LINUX_INSTALL_DIR = '/opt/inav';
|
||||
const metadata = require('./package.json');
|
||||
|
||||
console.log(`Generating rpm package for ${arch}`);
|
||||
|
||||
// The buildRpm does not generate the folder correctly, manually
|
||||
createDirIfNotExists(appsDir);
|
||||
|
||||
const options = {
|
||||
name: get_release_filename_base(arch), // metadata.name,
|
||||
version: metadata.version.replace(NAME_REGEX, '_'), // RPM does not like release candidate versions
|
||||
buildArch: getLinuxPackageArch('rpm', arch),
|
||||
vendor: metadata.author,
|
||||
summary: metadata.description,
|
||||
license: 'GNU General Public License v3.0',
|
||||
requires: ['libatomic1'],
|
||||
prefix: '/opt',
|
||||
files: [{
|
||||
cwd: path.join(appsDir, metadata.name, arch),
|
||||
src: '*',
|
||||
dest: `${LINUX_INSTALL_DIR}/${metadata.name}`,
|
||||
}],
|
||||
postInstallScript: [`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${metadata.name}/${metadata.name}.desktop`],
|
||||
preUninstallScript: [`xdg-desktop-menu uninstall ${metadata.name}.desktop`],
|
||||
tempDir: path.join(appsDir, `tmp-rpm-build-${arch}`),
|
||||
keepTemp: false,
|
||||
verbose: false,
|
||||
rpmDest: appsDir,
|
||||
execOpts: { maxBuffer: 1024 * 1024 * 16 },
|
||||
};
|
||||
|
||||
buildRpm(options, function(err) {
|
||||
if (err) {
|
||||
console.error(`Error generating rpm package: ${err}`);
|
||||
}
|
||||
done();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getLinuxPackageArch(type, arch) {
|
||||
let packArch;
|
||||
|
||||
switch (arch) {
|
||||
case 'linux32':
|
||||
packArch = 'i386';
|
||||
break;
|
||||
case 'linux64':
|
||||
if (type === 'rpm') {
|
||||
packArch = 'x86_64';
|
||||
} else {
|
||||
packArch = 'amd64';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.error(`Package error, arch: ${arch}`);
|
||||
process.exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
return packArch;
|
||||
}
|
||||
|
||||
function releaseLinux(bits) {
|
||||
return function() {
|
||||
console.log(`Generating zip package for linux${bits}`);
|
||||
var dirname = 'linux' + bits;
|
||||
var pkg = require('./package.json');
|
||||
var src = path.join(appsDir, pkg.name, dirname);
|
||||
var output = fs.createWriteStream(path.join(appsDir, get_release_filename(dirname, 'tar.gz')));
|
||||
var archive = archiver('tar', {
|
||||
zlib: { level: 9 },
|
||||
gzip: true
|
||||
});
|
||||
archive.on('warning', function(err) { throw err; });
|
||||
archive.on('error', function(err) { throw err; });
|
||||
archive.pipe(output);
|
||||
archive.directory(src, 'INAV Configurator');
|
||||
return archive.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('release-linux32', gulp.series(releaseLinux(32), post_build('linux32', appsDir), release_deb('linux32'), post_release_deb('linux32')));
|
||||
gulp.task('release-linux64', gulp.series(releaseLinux(64), post_build('linux64', appsDir), release_deb('linux64'), post_release_deb('linux64'), release_rpm('linux64')));
|
||||
|
||||
// Create distributable .zip files in ./apps
|
||||
gulp.task('release', gulp.series('apps', getPlatforms().map(function(v) { return 'release-' + v; })));
|
||||
|
||||
gulp.task('watch', function () {
|
||||
for(var k in output) {
|
||||
gulp.watch(sources[k], gulp.series(get_task_name(k)));
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('default', gulp.series('build'));
|
106
main.html → index.html
Executable file → Normal file
106
main.html → index.html
Executable file → Normal file
|
@ -3,8 +3,110 @@
|
|||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" rel="stylesheet" href="./build/styles.css" media="all" />
|
||||
<script type="text/javascript" src="./build/script.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="./src/css/styles.css" media="all" />
|
||||
|
||||
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
|
||||
<script type="text/javascript" src="./js/main.js"></script>
|
||||
<script type="text/javascript" src="./js/sitl.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/d3.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/jquery.nouislider.all.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/three/three.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/three/GLTFLoader.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/three/OrbitControls.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/nw-dialog.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/bundle_xml2js.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/Projector.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/CanvasRenderer.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/jquery.flightindicators.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/semver.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/jbox/jBox.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/switchery/switchery.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/jquery.ba-throttle-debounce.js"></script>
|
||||
<script type="text/javascript" src="./js/helpers.js"></script>
|
||||
<script type="text/javascript" src="./js/injected_methods.js"></script>
|
||||
<script type="text/javascript" src="./js/intervals.js"></script>
|
||||
<script type="text/javascript" src="./js/timeouts.js"></script>
|
||||
<script type="text/javascript" src="./js/pid_controller.js"></script>
|
||||
<script type="text/javascript" src="./js/simple_smooth_filter.js"></script>
|
||||
<script type="text/javascript" src="./js/walking_average_filter.js"></script>
|
||||
<script type="text/javascript" src="./js/gui.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPCodes.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPHelper.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPchainer.js"></script>
|
||||
<script type="text/javascript" src="./js/port_handler.js"></script>
|
||||
<script type="text/javascript" src="./js/connection/connection.js"></script>
|
||||
<script type="text/javascript" src="./js/connection/connectionBle.js"></script>
|
||||
<script type="text/javascript" src="./js/connection/connectionSerial.js"></script>
|
||||
<script type="text/javascript" src="./js/connection/connectionTcp.js"></script>
|
||||
<script type="text/javascript" src="./js/connection/connectionUdp.js"></script>
|
||||
<script type="text/javascript" src="./js/servoMixRule.js"></script>
|
||||
<script type="text/javascript" src="./js/motorMixRule.js"></script>
|
||||
<script type="text/javascript" src="./js/logicCondition.js"></script>
|
||||
<script type="text/javascript" src="./js/settings.js"></script>
|
||||
<script type="text/javascript" src="./js/outputMapping.js"></script>
|
||||
<script type="text/javascript" src="./js/model.js"></script>
|
||||
<script type="text/javascript" src="./js/serial_backend.js"></script>
|
||||
<script type="text/javascript" src="./js/data_storage.js"></script>
|
||||
<script type="text/javascript" src="./js/fc.js"></script>
|
||||
<script type="text/javascript" src="./js/msp.js"></script>
|
||||
<script type="text/javascript" src="./js/protocols/stm32.js"></script>
|
||||
<script type="text/javascript" src="./js/protocols/stm32usbdfu.js"></script>
|
||||
<script type="text/javascript" src="./js/localization.js"></script>
|
||||
<script type="text/javascript" src="./js/boards.js"></script>
|
||||
<script type="text/javascript" src="./js/servoMixerRuleCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/motorMixerRuleCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/logicConditionsCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/logicConditionsStatus.js"></script>
|
||||
<script type="text/javascript" src="./js/globalVariablesStatus.js"></script>
|
||||
<script type="text/javascript" src="./js/programmingPid.js"></script>
|
||||
<script type="text/javascript" src="./js/programmingPidCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/programmingPidStatus.js"></script>
|
||||
<script type="text/javascript" src="./js/vtx.js"></script>
|
||||
<script type="text/javascript" src="./js/tabs.js"></script>
|
||||
<script type="text/javascript" src="./js/eventFrequencyAnalyzer.js"></script>
|
||||
<script type="text/javascript" src="./js/periodicStatusUpdater.js"></script>
|
||||
<script type="text/javascript" src="./js/serial_queue.js"></script>
|
||||
<script type="text/javascript" src="./js/msp_balanced_interval.js"></script>gt
|
||||
<script type="text/javascript" src="./js/peripherals.js"></script>
|
||||
<script type="text/javascript" src="./js/appUpdater.js"></script>
|
||||
<script type="text/javascript" src="./js/feature_framework.js"></script>
|
||||
<script type="text/javascript" src="./js/defaults_dialog.js"></script>
|
||||
<script type="text/javascript" src="./js/safehomeCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/safehome.js"></script>
|
||||
<script type="text/javascript" src="./js/waypointCollection.js"></script>
|
||||
<script type="text/javascript" src="./js/waypoint.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/plotly-latest.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./tabs/adjustments.js"></script>
|
||||
<script type="text/javascript" src="./tabs/advanced_tuning.js"></script>
|
||||
<script type="text/javascript" src="./tabs/auxiliary.js"></script>
|
||||
<script type="text/javascript" src="./tabs/calibration.js"></script>
|
||||
<script type="text/javascript" src="./tabs/cli.js"></script>
|
||||
<script type="text/javascript" src="./tabs/configuration.js"></script>
|
||||
<script type="text/javascript" src="./tabs/ez_tune.js"></script>
|
||||
<script type="text/javascript" src="./tabs/failsafe.js"></script>
|
||||
<script type="text/javascript" src="./tabs/firmware_flasher.js"></script>
|
||||
<script type="text/javascript" src="./tabs/gps.js"></script>
|
||||
<script type="text/javascript" src="./tabs/landing.js"></script>
|
||||
<script type="text/javascript" src="./tabs/led_strip.js"></script>
|
||||
<script type="text/javascript" src="./tabs/logging.js"></script>
|
||||
<script type="text/javascript" src="./tabs/magnetometer.js"></script>
|
||||
<script type="text/javascript" src="./tabs/mission_control.js"></script>
|
||||
<script type="text/javascript" src="./tabs/mixer.js"></script>
|
||||
<script type="text/javascript" src="./tabs/modes.js"></script>
|
||||
<script type="text/javascript" src="./tabs/onboard_logging.js"></script>
|
||||
<script type="text/javascript" src="./tabs/osd.js"></script>
|
||||
<script type="text/javascript" src="./tabs/outputs.js"></script>
|
||||
<script type="text/javascript" src="./tabs/pid_tuning.js"></script>
|
||||
<script type="text/javascript" src="./tabs/ports.js"></script>
|
||||
<script type="text/javascript" src="./tabs/programming.js"></script>
|
||||
<script type="text/javascript" src="./tabs/receiver.js"></script>
|
||||
<script type="text/javascript" src="./tabs/receiver_msp.js"></script>
|
||||
<script type="text/javascript" src="./tabs/sensors.js"></script>
|
||||
<script type="text/javascript" src="./tabs/setup.js"></script>
|
||||
<script type="text/javascript" src="./tabs/sitl.js"></script>
|
||||
|
||||
<script>if (window.module) module = window.module;</script>
|
||||
<title></title>
|
||||
</head>
|
||||
|
|
@ -5,7 +5,7 @@ var appUpdater = appUpdater || {};
|
|||
appUpdater.checkRelease = function (currVersion) {
|
||||
var modalStart;
|
||||
$.get('https://api.github.com/repos/iNavFlight/inav-configurator/releases', function (releaseData) {
|
||||
GUI.log(chrome.i18n.getMessage('loadedReleaseInfo'));
|
||||
GUI.log(localization.getMessage('loadedReleaseInfo'));
|
||||
//Git return sorted list, 0 - last release
|
||||
|
||||
let newVersion = releaseData[0].tag_name;
|
||||
|
@ -15,7 +15,7 @@ appUpdater.checkRelease = function (currVersion) {
|
|||
GUI.log(newVersion, chrome.runtime.getManifest().version);
|
||||
GUI.log(currVersion);
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('newVersionAvailable'));
|
||||
GUI.log(localization.getMessage('newVersionAvailable'));
|
||||
modalStart = new jBox('Modal', {
|
||||
width: 400,
|
||||
height: 200,
|
||||
|
|
|
@ -10,7 +10,7 @@ const ConnectionType = {
|
|||
class Connection {
|
||||
|
||||
constructor() {
|
||||
this._connectionId = false;
|
||||
this._connectionId = 0;
|
||||
this._openRequested = false;
|
||||
this._openCanceled = false;
|
||||
this._bitrate = 0;
|
||||
|
@ -145,7 +145,6 @@ class Connection {
|
|||
} else {
|
||||
this._openRequested = false;
|
||||
console.log('Failed to open');
|
||||
googleAnalytics.sendException('FailedToOpen', false);
|
||||
if (callback) {
|
||||
callback(false);
|
||||
}
|
||||
|
@ -163,13 +162,11 @@ class Connection {
|
|||
this.removeAllListeners();
|
||||
|
||||
this.disconnectImplementation(result => {
|
||||
this.checkChromeLastError();
|
||||
|
||||
if (result) {
|
||||
console.log('Connection with ID: ' + this._connectionId + ' closed, Sent: ' + this._bytesSent + ' bytes, Received: ' + this._bytesReceived + ' bytes');
|
||||
} else {
|
||||
console.log('Failed to close connection with ID: ' + this._connectionId + ' closed, Sent: ' + this._bytesSent + ' bytes, Received: ' + this._bytesReceived + ' bytes');
|
||||
googleAnalytics.sendException('Connection: FailedToClose', false);
|
||||
}
|
||||
|
||||
this._connectionId = false;
|
||||
|
@ -240,12 +237,6 @@ class Connection {
|
|||
}
|
||||
}
|
||||
|
||||
checkChromeLastError() {
|
||||
if (chrome.runtime.lastError) {
|
||||
console.error(chrome.runtime.lastError.message);
|
||||
}
|
||||
}
|
||||
|
||||
addOnReceiveCallback(callback) {
|
||||
throw new TypeError("Abstract method");
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class ConnectionBle extends Connection {
|
|||
await this.openDevice()
|
||||
.then(() => {
|
||||
this.addOnReceiveErrorListener(error => {
|
||||
GUI.log(chrome.i18n.getMessage('connectionBleInterrupted'));
|
||||
GUI.log(localization.getMessage('connectionBleInterrupted'));
|
||||
this.abort();
|
||||
});
|
||||
|
||||
|
@ -71,7 +71,7 @@ class ConnectionBle extends Connection {
|
|||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
GUI.log(chrome.i18n.getMessage('connectionBleError', [error]));
|
||||
GUI.log(localization.getMessage('connectionBleError', [error]));
|
||||
if (callback) {
|
||||
callback(false);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class ConnectionBle extends Connection {
|
|||
return device.gatt.connect()
|
||||
.then(server => {
|
||||
console.log("Connect to: " + device.name);
|
||||
GUI.log(chrome.i18n.getMessage('connectionConnected', [device.name]));
|
||||
GUI.log(localization.getMessage('connectionConnected', [device.name]));
|
||||
return server.getPrimaryServices();
|
||||
}).then(services => {
|
||||
let connectedService = services.find(service => {
|
||||
|
@ -131,7 +131,7 @@ class ConnectionBle extends Connection {
|
|||
throw new Error("Unsupported device (service UUID mismatch).");
|
||||
}
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('connectionBleType', [this._deviceDescription.name]));
|
||||
GUI.log(localization.getMessage('connectionBleType', [this._deviceDescription.name]));
|
||||
return connectedService.getCharacteristics();
|
||||
}).then(characteristics => {
|
||||
characteristics.forEach(characteristic => {
|
||||
|
|
|
@ -1,139 +1,103 @@
|
|||
'use strict'
|
||||
|
||||
class ConnectionSerial extends Connection {
|
||||
const { SerialPortStream } = require('@serialport/stream');
|
||||
const { autoDetect } = require('@serialport/bindings-cpp')
|
||||
const binding = autoDetect();
|
||||
|
||||
class ConnectionSerial extends Connection {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._failed = 0;
|
||||
this._serialport = null;
|
||||
this._errorListeners = [];
|
||||
this._onReceiveListeners = [];
|
||||
this._onErrorListener = [];
|
||||
}
|
||||
|
||||
connectImplementation(path, options, callback) {
|
||||
chrome.serial.connect(path, options, (connectionInfo) => {
|
||||
this.checkChromeLastError();
|
||||
if (connectionInfo && !this._openCanceled) {
|
||||
this.addOnReceiveErrorListener(info => {
|
||||
console.error(info);
|
||||
googleAnalytics.sendException('Serial: ' + info.error, false);
|
||||
this._serialport = new SerialPortStream({binding, path: path, baudRate: options.bitrate, autoOpen: true}, () => {
|
||||
|
||||
switch (info.error) {
|
||||
case 'system_error': // we might be able to recover from this one
|
||||
if (!this._failed++) {
|
||||
chrome.serial.setPaused(this._connectionId, false, function () {
|
||||
SerialCom.getInfo((info) => {
|
||||
if (info) {
|
||||
if (!info.paused) {
|
||||
console.log('SERIAL: Connection recovered from last onReceiveError');
|
||||
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
||||
|
||||
this._failed = 0;
|
||||
} else {
|
||||
console.log('SERIAL: Connection did not recover from last onReceiveError, disconnecting');
|
||||
GUI.log(chrome.i18n.getMessage('serialPortUnrecoverable'));
|
||||
googleAnalytics.sendException('Serial: onReceiveError - unrecoverable', false);
|
||||
|
||||
this.abort();
|
||||
}
|
||||
} else {
|
||||
this.checkChromeLastError();
|
||||
}
|
||||
this._serialport.on('data', buffer => {
|
||||
this._onReceiveListeners.forEach(listener => {
|
||||
listener({
|
||||
connectionId: this._connectionId,
|
||||
data: buffer
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
})
|
||||
|
||||
case 'break': // This occurs on F1 boards with old firmware during reboot
|
||||
case 'overrun':
|
||||
case 'frame_error': //Got disconnected
|
||||
// wait 50 ms and attempt recovery
|
||||
var error = info.error;
|
||||
setTimeout(() => {
|
||||
chrome.serial.setPaused(info.connectionId, false, function() {
|
||||
SerialCom.getInfo(function (info) {
|
||||
if (info) {
|
||||
if (info.paused) {
|
||||
// assume unrecoverable, disconnect
|
||||
console.log('SERIAL: Connection did not recover from ' + error + ' condition, disconnecting');
|
||||
GUI.log(chrome.i18n.getMessage('serialPortUnrecoverable'));;
|
||||
googleAnalytics.sendException('Serial: ' + error + ' - unrecoverable', false);
|
||||
|
||||
this.abort();
|
||||
} else {
|
||||
console.log('SERIAL: Connection recovered from ' + error + ' condition');
|
||||
googleAnalytics.sendException('Serial: ' + error + ' - recovered', false);
|
||||
}
|
||||
}
|
||||
this._serialport.on('error', error => {
|
||||
console.log("Serial error: " + error);
|
||||
this._onReceiveErrorListeners.forEach(listener => {
|
||||
listener(error);
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
break;
|
||||
|
||||
case 'timeout':
|
||||
// TODO
|
||||
break;
|
||||
|
||||
case 'device_lost':
|
||||
case 'disconnected':
|
||||
default:
|
||||
this.abort();
|
||||
}
|
||||
});
|
||||
GUI.log(chrome.i18n.getMessage('connectionConnected', [path]));
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback(connectionInfo);
|
||||
callback({
|
||||
connectionId: ++this._connectionId,
|
||||
bitrate: options.bitrate
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
disconnectImplementation(callback) {
|
||||
chrome.serial.disconnect(this._connectionId, (result) => {
|
||||
if (this._serialport && this._serialport.isOpen) {
|
||||
this._serialport.close(error => {
|
||||
if (error) {
|
||||
console.log("Unable to close serial: " + error)
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
callback(error ? false : true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sendImplementation(data, callback) {
|
||||
chrome.serial.send(this._connectionId, data, callback);
|
||||
this._serialport.write(Buffer.from(data), error => {
|
||||
var result = 0;
|
||||
if (error) {
|
||||
result = 1;
|
||||
console.log("Serial wrire error: " + error)
|
||||
}
|
||||
if (callback) {
|
||||
callback({
|
||||
bytesSent: data.byteLength,
|
||||
resultCode: result
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addOnReceiveCallback(callback){
|
||||
chrome.serial.onReceive.addListener(callback);
|
||||
this._onReceiveErrorListeners.push(callback);
|
||||
}
|
||||
|
||||
removeOnReceiveCallback(callback){
|
||||
chrome.serial.onReceive.removeListener(callback);
|
||||
this._onReceiveListeners = this._onReceiveErrorListeners.filter(listener => listener !== callback);
|
||||
}
|
||||
|
||||
addOnReceiveErrorCallback(callback) {
|
||||
chrome.serial.onReceiveError.addListener(callback);
|
||||
this._onReceiveErrorListeners.push(callback);
|
||||
}
|
||||
|
||||
removeOnReceiveErrorCallback(callback) {
|
||||
chrome.serial.onReceiveError.removeListener(callback);
|
||||
this._onReceiveErrorListeners = this._onReceiveErrorListeners.filter(listener => listener !== callback);
|
||||
}
|
||||
|
||||
static getDevices(callback) {
|
||||
chrome.serial.getDevices((devices_array) => {
|
||||
static async getDevices(callback) {
|
||||
SerialPort.list().then((ports, error) => {
|
||||
var devices = [];
|
||||
devices_array.forEach((device) => {
|
||||
devices.push(device.path);
|
||||
if (error) {
|
||||
GUI.log("Unable to list serial ports.");
|
||||
} else {
|
||||
ports.forEach(port => {
|
||||
devices.push(port.path);
|
||||
});
|
||||
}
|
||||
if (callback)
|
||||
callback(devices);
|
||||
});
|
||||
}
|
||||
|
||||
static getInfo(connectionId, callback) {
|
||||
chrome.serial.getInfo(connectionId, callback);
|
||||
}
|
||||
|
||||
static getControlSignals(connectionId, callback) {
|
||||
chrome.serial.getControlSignals(connectionId, callback);
|
||||
}
|
||||
|
||||
static setControlSignals(connectionId, signals, callback) {
|
||||
chrome.serial.setControlSignals(connectionId, signals, callback);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ class ConnectionTcp extends Connection {
|
|||
|
||||
this.addOnReceiveErrorListener(info => {
|
||||
console.error(info);
|
||||
googleAnalytics.sendException('TCP: ' + info.error, false);
|
||||
|
||||
let message;
|
||||
switch (info.resultCode) {
|
||||
|
@ -79,7 +78,7 @@ class ConnectionTcp extends Connection {
|
|||
this.abort();
|
||||
});
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('connectionConnected', ["tcp://" + this._connectionIP + ":" + this._connectionPort]));
|
||||
GUI.log(localization.getMessage('connectionConnected', ["tcp://" + this._connectionIP + ":" + this._connectionPort]));
|
||||
|
||||
if (callback) {
|
||||
callback({
|
||||
|
|
|
@ -46,7 +46,7 @@ class ConnectionUdp extends Connection {
|
|||
|
||||
this._timeoutId = setTimeout(() => {
|
||||
if (!this._isCli) { // Disable timeout for CLI
|
||||
GUI.log(chrome.i18n.getMessage('connectionUdpTimeout'));
|
||||
GUI.log(localization.getMessage('connectionUdpTimeout'));
|
||||
this.abort();
|
||||
}
|
||||
}, 10000);
|
||||
|
@ -55,7 +55,6 @@ class ConnectionUdp extends Connection {
|
|||
// Actually useless, but according to chrome documentation also UDP triggers error events ¯\_(ツ)_/¯
|
||||
this.addOnReceiveErrorListener(info => {
|
||||
console.error(info);
|
||||
googleAnalytics.sendException('UDP: ' + info.error, false);
|
||||
|
||||
let message;
|
||||
switch (info.resultCode) {
|
||||
|
@ -91,7 +90,7 @@ class ConnectionUdp extends Connection {
|
|||
this.abort();
|
||||
});
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('connectionConnected', ["udp://" + this._connectionIP + ":" + this._connectionPort]));
|
||||
GUI.log(localization.getMessage('connectionConnected', ["udp://" + this._connectionIP + ":" + this._connectionPort]));
|
||||
|
||||
if (callback) {
|
||||
callback({
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
var CONFIGURATOR = {
|
||||
// all versions are specified and compared using semantic versioning http://semver.org/
|
||||
'minfirmwareVersionAccepted': '7.0.0',
|
||||
'maxFirmwareVersionAccepted': '9.0.0', // Condition is < (lt) so we accept all in 8.x branch
|
||||
'maxFirmwareVersionAccepted': '8.0.0', // Condition is < (lt) so we accept all in 7.x branch
|
||||
'connectionValid': false,
|
||||
'connectionValidCliOnly': false,
|
||||
'cliActive': false,
|
||||
|
|
|
@ -39,43 +39,47 @@ helper.defaultsDialog = (function () {
|
|||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
Filtering
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "ez_axis_ratio",
|
||||
value: 116
|
||||
key: "gyro_main_lpf_type",
|
||||
value: "PT1"
|
||||
},
|
||||
{
|
||||
key: "ez_response",
|
||||
value: 71
|
||||
key: "dterm_lpf_hz",
|
||||
value: 85
|
||||
},
|
||||
{
|
||||
key: "ez_damping",
|
||||
value: 103
|
||||
key: "dterm_lpf_type",
|
||||
value: "PT3"
|
||||
},
|
||||
{
|
||||
key: "ez_stability",
|
||||
value: 105
|
||||
key: "dynamic_gyro_notch_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_aggressiveness",
|
||||
value: 100
|
||||
key: "dynamic_gyro_notch_q",
|
||||
value: 250
|
||||
},
|
||||
{
|
||||
key: "ez_rate",
|
||||
value: 134
|
||||
key: "dynamic_gyro_notch_min_hz",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "ez_expo",
|
||||
value: 118
|
||||
key: "setpoint_kalman_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "setpoint_kalman_q",
|
||||
value: 200
|
||||
},
|
||||
{
|
||||
key: "smith_predictor_delay", // Enable Smith Predictor
|
||||
value: 1.5
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
|
@ -108,6 +112,64 @@ helper.defaultsDialog = (function () {
|
|||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
Rates
|
||||
*/
|
||||
{
|
||||
key: "rc_yaw_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "rc_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "roll_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "pitch_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "yaw_rate",
|
||||
value: 60
|
||||
},
|
||||
/*
|
||||
PIDs
|
||||
*/
|
||||
{
|
||||
key: "mc_p_pitch",
|
||||
value: 32
|
||||
},
|
||||
{
|
||||
key: "mc_i_pitch",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "mc_d_pitch",
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
key: "mc_p_roll",
|
||||
value: 28
|
||||
},
|
||||
{
|
||||
key: "mc_i_roll",
|
||||
value: 80
|
||||
},
|
||||
{
|
||||
key: "mc_d_roll",
|
||||
value: 23
|
||||
},
|
||||
{
|
||||
key: "mc_p_yaw",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "mc_i_yaw",
|
||||
value: 80
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
|
@ -130,6 +192,11 @@ helper.defaultsDialog = (function () {
|
|||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
},
|
||||
// Ez Tune
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
value: 90
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -160,43 +227,15 @@ helper.defaultsDialog = (function () {
|
|||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
Filtering
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 110
|
||||
},
|
||||
{
|
||||
key: "ez_axis_ratio",
|
||||
value: 110
|
||||
},
|
||||
{
|
||||
key: "ez_response",
|
||||
value: 92
|
||||
},
|
||||
{
|
||||
key: "ez_damping",
|
||||
value: 108
|
||||
},
|
||||
{
|
||||
key: "ez_stability",
|
||||
value: 110
|
||||
},
|
||||
{
|
||||
key: "ez_aggressiveness",
|
||||
value: 80
|
||||
},
|
||||
{
|
||||
key: "ez_rate",
|
||||
value: 134
|
||||
},
|
||||
{
|
||||
key: "ez_expo",
|
||||
value: 118
|
||||
key: "gyro_main_lpf_type",
|
||||
value: "PT1"
|
||||
},
|
||||
/*
|
||||
Dynamic gyro LPF
|
||||
|
@ -218,6 +257,41 @@ helper.defaultsDialog = (function () {
|
|||
value: 3
|
||||
},
|
||||
/*
|
||||
D-term
|
||||
*/
|
||||
{
|
||||
key: "dterm_lpf_hz",
|
||||
value: 110
|
||||
},
|
||||
{
|
||||
key: "dterm_lpf_type",
|
||||
value: "PT3"
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_q",
|
||||
value: 250
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_min_hz",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "setpoint_kalman_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "setpoint_kalman_q",
|
||||
value: 200
|
||||
},
|
||||
{
|
||||
key: "smith_predictor_delay", // Enable Smith Predictor
|
||||
value: 1.5
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
*/
|
||||
{
|
||||
|
@ -248,6 +322,64 @@ helper.defaultsDialog = (function () {
|
|||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
Rates
|
||||
*/
|
||||
{
|
||||
key: "rc_yaw_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "rc_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "roll_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "pitch_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "yaw_rate",
|
||||
value: 60
|
||||
},
|
||||
/*
|
||||
PIDs
|
||||
*/
|
||||
{
|
||||
key: "mc_p_pitch",
|
||||
value: 40
|
||||
},
|
||||
{
|
||||
key: "mc_i_pitch",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "mc_d_pitch",
|
||||
value: 27
|
||||
},
|
||||
{
|
||||
key: "mc_p_roll",
|
||||
value: 36
|
||||
},
|
||||
{
|
||||
key: "mc_i_roll",
|
||||
value: 80
|
||||
},
|
||||
{
|
||||
key: "mc_d_roll",
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
key: "mc_p_yaw",
|
||||
value: 35
|
||||
},
|
||||
{
|
||||
key: "mc_i_yaw",
|
||||
value: 80
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
|
@ -270,6 +402,11 @@ helper.defaultsDialog = (function () {
|
|||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
},
|
||||
// Ez Tune
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
value: 110
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -300,43 +437,51 @@ helper.defaultsDialog = (function () {
|
|||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
Filtering
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "ez_axis_ratio",
|
||||
value: 110
|
||||
key: "gyro_main_lpf_type",
|
||||
value: "PT1"
|
||||
},
|
||||
{
|
||||
key: "ez_response",
|
||||
value: 101
|
||||
key: "dterm_lpf_hz",
|
||||
value: 80
|
||||
},
|
||||
{
|
||||
key: "ez_damping",
|
||||
value: 115
|
||||
key: "dterm_lpf_type",
|
||||
value: "PT3"
|
||||
},
|
||||
{
|
||||
key: "ez_stability",
|
||||
value: 100
|
||||
key: "dynamic_gyro_notch_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_aggressiveness",
|
||||
value: 100
|
||||
key: "dynamic_gyro_notch_mode",
|
||||
value: "3D"
|
||||
},
|
||||
{
|
||||
key: "ez_rate",
|
||||
value: 134
|
||||
key: "dynamic_gyro_notch_q",
|
||||
value: 250
|
||||
},
|
||||
{
|
||||
key: "ez_expo",
|
||||
value: 118
|
||||
key: "dynamic_gyro_notch_min_hz",
|
||||
value: 60
|
||||
},
|
||||
{
|
||||
key: "setpoint_kalman_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "setpoint_kalman_q",
|
||||
value: 200
|
||||
},
|
||||
{
|
||||
key: "smith_predictor_delay", // Enable Smith Predictor
|
||||
value: 1.5
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
|
@ -369,6 +514,64 @@ helper.defaultsDialog = (function () {
|
|||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
Rates
|
||||
*/
|
||||
{
|
||||
key: "rc_yaw_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "rc_expo",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "roll_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "pitch_rate",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "yaw_rate",
|
||||
value: 60
|
||||
},
|
||||
/*
|
||||
PIDs
|
||||
*/
|
||||
{
|
||||
key: "mc_p_pitch",
|
||||
value: 44
|
||||
},
|
||||
{
|
||||
key: "mc_i_pitch",
|
||||
value: 85
|
||||
},
|
||||
{
|
||||
key: "mc_d_pitch",
|
||||
value: 28
|
||||
},
|
||||
{
|
||||
key: "mc_p_roll",
|
||||
value: 40
|
||||
},
|
||||
{
|
||||
key: "mc_i_roll",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "mc_d_roll",
|
||||
value: 26
|
||||
},
|
||||
{
|
||||
key: "mc_p_yaw",
|
||||
value: 40
|
||||
},
|
||||
{
|
||||
key: "mc_i_yaw",
|
||||
value: 80
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
|
@ -391,6 +594,11 @@ helper.defaultsDialog = (function () {
|
|||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
},
|
||||
// Ez Tune
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
value: 90
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -924,7 +1132,7 @@ helper.defaultsDialog = (function () {
|
|||
privateScope.finalize = function (selectedDefaultPreset) {
|
||||
mspHelper.saveToEeprom(function () {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
if (selectedDefaultPreset.reboot) {
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
|
@ -933,7 +1141,7 @@ helper.defaultsDialog = (function () {
|
|||
if (typeof savingDefaultsModal !== 'undefined') {
|
||||
savingDefaultsModal.close();
|
||||
}
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
});
|
||||
});
|
||||
|
@ -959,9 +1167,6 @@ helper.defaultsDialog = (function () {
|
|||
}
|
||||
});
|
||||
|
||||
//Save analytics
|
||||
googleAnalytics.sendEvent('Setting', 'Defaults', selectedDefaultPreset.title);
|
||||
|
||||
var settingsChainer = MSPChainerClass();
|
||||
var chain = [];
|
||||
|
||||
|
|
16
js/fc.js
16
js/fc.js
|
@ -29,7 +29,6 @@ var CONFIG,
|
|||
MOTOR_DATA,
|
||||
SERVO_DATA,
|
||||
GPS_DATA,
|
||||
ADSB_VEHICLES,
|
||||
MISSION_PLANNER,
|
||||
ANALOG,
|
||||
ARMING_CONFIG,
|
||||
|
@ -66,7 +65,8 @@ var CONFIG,
|
|||
BOARD_ALIGNMENT,
|
||||
CURRENT_METER_CONFIG,
|
||||
FEATURES,
|
||||
RATE_DYNAMICS;
|
||||
RATE_DYNAMICS,
|
||||
EZ_TUNE;
|
||||
|
||||
var FC = {
|
||||
restartRequired: false,
|
||||
|
@ -252,12 +252,6 @@ var FC = {
|
|||
packetCount: 0
|
||||
};
|
||||
|
||||
ADSB_VEHICLES = {
|
||||
vehiclesCount: 0,
|
||||
callsignLength: 0,
|
||||
vehicles: []
|
||||
};
|
||||
|
||||
MISSION_PLANNER = new WaypointCollection();
|
||||
|
||||
ANALOG = {
|
||||
|
@ -1244,12 +1238,6 @@ var FC = {
|
|||
hasOperand: [true, false],
|
||||
output: "raw"
|
||||
},
|
||||
54: {
|
||||
name: "Mag calibration",
|
||||
operandType: "Set Flight Parameter",
|
||||
hasOperand: [false, false],
|
||||
output: "boolean"
|
||||
},
|
||||
}
|
||||
},
|
||||
getOperandTypes: function () {
|
||||
|
|
12
js/gui.js
12
js/gui.js
|
@ -183,7 +183,7 @@ GUI_control.prototype.content_ready = function (callback) {
|
|||
const documentationDiv = $('<div>').addClass('cf_doc_version_bt');
|
||||
$('<a>').attr('href', 'https://github.com/iNavFlight/inav/wiki')
|
||||
.attr('target', '_blank').attr('id', 'button-documentation')
|
||||
.html(chrome.i18n.getMessage('documentation')).appendTo(documentationDiv);
|
||||
.html(localization.getMessage('documentation')).appendTo(documentationDiv);
|
||||
documentationDiv.insertAfter(tabTitle);
|
||||
|
||||
// loading tooltip
|
||||
|
@ -256,7 +256,7 @@ GUI_control.prototype.updateStatusBar = function() {
|
|||
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
$('span.cpu-load').text(chrome.i18n.getMessage('statusbar_cpu_load', [CONFIG.cpuload]));
|
||||
$('span.cpu-load').text(localization.getMessage('statusbar_cpu_load', [CONFIG.cpuload]));
|
||||
$('span.arming-flags').text(activeArmFlags.length ? activeArmFlags.join(', ') : '-');
|
||||
};
|
||||
|
||||
|
@ -265,9 +265,9 @@ GUI_control.prototype.updateProfileChange = function(refresh) {
|
|||
$('#profilechange').val(CONFIG.profile);
|
||||
$('#batteryprofilechange').val(CONFIG.battery_profile);
|
||||
if (refresh) {
|
||||
GUI.log(chrome.i18n.getMessage('loadedMixerProfile', [CONFIG.mixer_profile + 1]));
|
||||
GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [CONFIG.profile + 1]));
|
||||
GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [CONFIG.battery_profile + 1]));
|
||||
GUI.log(localization.getMessage('loadedMixerProfile', [CONFIG.mixer_profile + 1]));
|
||||
GUI.log(localization.getMessage('pidTuning_LoadedProfile', [CONFIG.profile + 1]));
|
||||
GUI.log(localization.getMessage('loadedBatteryProfile', [CONFIG.battery_profile + 1]));
|
||||
updateActivatedTab();
|
||||
}
|
||||
};
|
||||
|
@ -379,7 +379,7 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata
|
|||
GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways, onlyEnabled) {
|
||||
|
||||
let $select = $container.append('<select class="mix-rule-condition">').find("select"),
|
||||
lcCount = logicConditions.getCount();
|
||||
lcCount = logicConditions.getCount(),
|
||||
option = "";
|
||||
|
||||
if (withAlways) {
|
||||
|
|
|
@ -548,14 +548,14 @@ Buffer.concat = function concat (list, length) {
|
|||
var i
|
||||
if (length === undefined) {
|
||||
length = 0
|
||||
for (i = 0; i < list.length; ++i) {
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
length += list[i].length
|
||||
}
|
||||
}
|
||||
|
||||
var buffer = Buffer.allocUnsafe(length)
|
||||
var pos = 0
|
||||
for (i = 0; i < list.length; ++i) {
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
var buf = list[i]
|
||||
if (isInstance(buf, Uint8Array)) {
|
||||
buf = Buffer.from(buf)
|
||||
|
@ -922,7 +922,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|||
var i
|
||||
if (dir) {
|
||||
var foundIndex = -1
|
||||
for (i = byteOffset; i < arrLength; i++) {
|
||||
for (let i = byteOffset; i < arrLength; i++) {
|
||||
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
||||
if (foundIndex === -1) foundIndex = i
|
||||
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
||||
|
@ -933,7 +933,7 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|||
}
|
||||
} else {
|
||||
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
||||
for (i = byteOffset; i >= 0; i--) {
|
||||
for (let i = byteOffset; i >= 0; i--) {
|
||||
var found = true
|
||||
for (var j = 0; j < valLength; j++) {
|
||||
if (read(arr, i + j) !== read(val, j)) {
|
||||
|
@ -1759,7 +1759,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|||
|
||||
var i
|
||||
if (typeof val === 'number') {
|
||||
for (i = start; i < end; ++i) {
|
||||
for (let i = start; i < end; ++i) {
|
||||
this[i] = val
|
||||
}
|
||||
} else {
|
||||
|
@ -1771,7 +1771,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|||
throw new TypeError('The value "' + val +
|
||||
'" is invalid for argument "value"')
|
||||
}
|
||||
for (i = 0; i < end - start; ++i) {
|
||||
for (let i = 0; i < end - start; ++i) {
|
||||
this[i + start] = bytes[i % len]
|
||||
}
|
||||
}
|
||||
|
@ -2240,7 +2240,7 @@ EventEmitter.prototype.emit = function emit(type) {
|
|||
// slower
|
||||
default:
|
||||
args = new Array(len - 1);
|
||||
for (i = 1; i < len; i++)
|
||||
for (let i = 1; i < len; i++)
|
||||
args[i - 1] = arguments[i];
|
||||
emitMany(handler, isFn, this, args);
|
||||
}
|
||||
|
@ -2399,7 +2399,7 @@ EventEmitter.prototype.removeListener =
|
|||
} else if (typeof list !== 'function') {
|
||||
position = -1;
|
||||
|
||||
for (i = list.length - 1; i >= 0; i--) {
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
if (list[i] === listener || list[i].listener === listener) {
|
||||
originalListener = list[i].listener;
|
||||
position = i;
|
||||
|
@ -2451,7 +2451,7 @@ EventEmitter.prototype.removeAllListeners =
|
|||
if (arguments.length === 0) {
|
||||
var keys = objectKeys(events);
|
||||
var key;
|
||||
for (i = 0; i < keys.length; ++i) {
|
||||
for (let i = 0; i < keys.length; ++i) {
|
||||
key = keys[i];
|
||||
if (key === 'removeListener') continue;
|
||||
this.removeAllListeners(key);
|
||||
|
@ -2468,7 +2468,7 @@ EventEmitter.prototype.removeAllListeners =
|
|||
this.removeListener(type, listeners);
|
||||
} else if (listeners) {
|
||||
// LIFO order
|
||||
for (i = listeners.length - 1; i >= 0; i--) {
|
||||
for (let i = listeners.length - 1; i >= 0; i--) {
|
||||
this.removeListener(type, listeners[i]);
|
||||
}
|
||||
}
|
||||
|
@ -5815,12 +5815,12 @@ module.exports = deprecate;
|
|||
* Mark that a method should not be used.
|
||||
* Returns a modified function which warns once by default.
|
||||
*
|
||||
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
|
||||
* If `localstore.noDeprecation = true` is set, then it is a no-op.
|
||||
*
|
||||
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
|
||||
* If `localstore.throwDeprecation = true` is set, then deprecated functions
|
||||
* will throw an Error when invoked.
|
||||
*
|
||||
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
|
||||
* If `localstore.traceDeprecation = true` is set, then deprecated functions
|
||||
* will invoke `console.trace()` instead of `console.error()`.
|
||||
*
|
||||
* @param {Function} fn - the function to deprecate
|
||||
|
@ -7516,7 +7516,7 @@ function config (name) {
|
|||
element.txt(obj);
|
||||
}
|
||||
} else if (Array.isArray(obj)) {
|
||||
for (index in obj) {
|
||||
for (let index in obj) {
|
||||
if (!hasProp.call(obj, index)) continue;
|
||||
child = obj[index];
|
||||
for (key in child) {
|
||||
|
@ -7542,7 +7542,7 @@ function config (name) {
|
|||
element = element.txt(child);
|
||||
}
|
||||
} else if (Array.isArray(child)) {
|
||||
for (index in child) {
|
||||
for (let index in child) {
|
||||
if (!hasProp.call(child, index)) continue;
|
||||
entry = child[index];
|
||||
if (typeof entry === 'string') {
|
||||
|
@ -7686,7 +7686,7 @@ function config (name) {
|
|||
|
||||
processItem = function(processors, item, key) {
|
||||
var i, len, process;
|
||||
for (i = 0, len = processors.length; i < len; i++) {
|
||||
for (let i = 0, len = processors.length; i < len; i++) {
|
||||
process = processors[i];
|
||||
item = process(item, key);
|
||||
}
|
||||
|
@ -7865,7 +7865,7 @@ function config (name) {
|
|||
xpath = "/" + ((function() {
|
||||
var i, len, results;
|
||||
results = [];
|
||||
for (i = 0, len = stack.length; i < len; i++) {
|
||||
for (let i = 0, len = stack.length; i < len; i++) {
|
||||
node = stack[i];
|
||||
results.push(node["#name"]);
|
||||
}
|
||||
|
@ -8106,7 +8106,7 @@ function config (name) {
|
|||
if (isFunction(Object.assign)) {
|
||||
Object.assign.apply(null, arguments);
|
||||
} else {
|
||||
for (i = 0, len = sources.length; i < len; i++) {
|
||||
for (let i = 0, len = sources.length; i < len; i++) {
|
||||
source = sources[i];
|
||||
if (source != null) {
|
||||
for (key in source) {
|
||||
|
@ -8819,12 +8819,12 @@ function config (name) {
|
|||
value = value.valueOf();
|
||||
}
|
||||
if (Array.isArray(target)) {
|
||||
for (i = 0, len = target.length; i < len; i++) {
|
||||
for (let i = 0, len = target.length; i < len; i++) {
|
||||
insTarget = target[i];
|
||||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
for (let insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
|
@ -9145,7 +9145,7 @@ function config (name) {
|
|||
}
|
||||
name = name.valueOf();
|
||||
if (Array.isArray(name)) {
|
||||
for (i = 0, len = name.length; i < len; i++) {
|
||||
for (let i = 0, len = name.length; i < len; i++) {
|
||||
attName = name[i];
|
||||
delete this.attributes[attName];
|
||||
}
|
||||
|
@ -9396,7 +9396,7 @@ function config (name) {
|
|||
this.instruction(insTarget);
|
||||
}
|
||||
} else if (isObject(target)) {
|
||||
for (insTarget in target) {
|
||||
for (let insTarget in target) {
|
||||
if (!hasProp.call(target, insTarget)) continue;
|
||||
insValue = target[insTarget];
|
||||
this.instruction(insTarget, insValue);
|
||||
|
@ -9446,7 +9446,7 @@ function config (name) {
|
|||
doc = this.document();
|
||||
doctype = new XMLDocType(doc, pubID, sysID);
|
||||
ref1 = doc.children;
|
||||
for (i = j = 0, len = ref1.length; j < len; i = ++j) {
|
||||
for (let i = j = 0, len = ref1.length; j < len; i = ++j) {
|
||||
child = ref1[i];
|
||||
if (child instanceof XMLDocType) {
|
||||
doc.children[i] = doctype;
|
||||
|
@ -9454,7 +9454,7 @@ function config (name) {
|
|||
}
|
||||
}
|
||||
ref2 = doc.children;
|
||||
for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
|
||||
for (let i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
|
||||
child = ref2[i];
|
||||
if (child.isRoot) {
|
||||
doc.children.splice(i, 0, doctype);
|
||||
|
@ -9722,7 +9722,7 @@ function config (name) {
|
|||
XMLStreamWriter.prototype.document = function(doc) {
|
||||
var child, i, j, len, len1, ref, ref1, results;
|
||||
ref = doc.children;
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
for (let i = 0, len = ref.length; i < len; i++) {
|
||||
child = ref[i];
|
||||
child.isLastRootNode = false;
|
||||
}
|
||||
|
@ -9790,7 +9790,7 @@ function config (name) {
|
|||
this.stream.write(' [');
|
||||
this.stream.write(this.endline(node));
|
||||
ref = node.children;
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
for (let i = 0, len = ref.length; i < len; i++) {
|
||||
child = ref[i];
|
||||
switch (false) {
|
||||
case !(child instanceof XMLDTDAttList):
|
||||
|
@ -9850,7 +9850,7 @@ function config (name) {
|
|||
} else {
|
||||
this.stream.write('>' + this.newline);
|
||||
ref1 = node.children;
|
||||
for (i = 0, len = ref1.length; i < len; i++) {
|
||||
for (let i = 0, len = ref1.length; i < len; i++) {
|
||||
child = ref1[i];
|
||||
switch (false) {
|
||||
case !(child instanceof XMLCData):
|
||||
|
@ -10004,7 +10004,7 @@ function config (name) {
|
|||
this.textispresent = false;
|
||||
r = '';
|
||||
ref = doc.children;
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
for (let i = 0, len = ref.length; i < len; i++) {
|
||||
child = ref[i];
|
||||
r += (function() {
|
||||
switch (false) {
|
||||
|
@ -10068,7 +10068,7 @@ function config (name) {
|
|||
r += ' [';
|
||||
r += this.newline;
|
||||
ref = node.children;
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
for (let i = 0, len = ref.length; i < len; i++) {
|
||||
child = ref[i];
|
||||
r += (function() {
|
||||
switch (false) {
|
||||
|
@ -10133,7 +10133,7 @@ function config (name) {
|
|||
} else {
|
||||
if (this.dontprettytextnodes) {
|
||||
ref1 = node.children;
|
||||
for (i = 0, len = ref1.length; i < len; i++) {
|
||||
for (let i = 0, len = ref1.length; i < len; i++) {
|
||||
child = ref1[i];
|
||||
if (child.value != null) {
|
||||
this.textispresent++;
|
||||
|
|
2
js/libraries/plotly-latest.min.js
vendored
2
js/libraries/plotly-latest.min.js
vendored
File diff suppressed because one or more lines are too long
4000
js/libraries/three/GLTFLoader.js
Normal file
4000
js/libraries/three/GLTFLoader.js
Normal file
File diff suppressed because it is too large
Load diff
1079
js/libraries/three/OrbitControls.js
Normal file
1079
js/libraries/three/OrbitControls.js
Normal file
File diff suppressed because it is too large
Load diff
6
js/libraries/three/three.min.js
vendored
Normal file
6
js/libraries/three/three.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,25 +1,62 @@
|
|||
'use strict';
|
||||
|
||||
function localize() {
|
||||
var localized = 0;
|
||||
const fs = require('fs')
|
||||
|
||||
var translate = function(messageID) {
|
||||
let Localiziation = function(locale) {
|
||||
let self = { };
|
||||
let messages = null;
|
||||
let localized = 0
|
||||
let local = locale;
|
||||
|
||||
self.loadMessages = function () {
|
||||
var data;
|
||||
try {
|
||||
data = fs.readFileSync(path.join(__dirname, "./locale/" + local + "/messages.json"), 'utf8',);
|
||||
messages = JSON.parse(data);
|
||||
} catch (err) {
|
||||
console.log("Error while reading languge file");
|
||||
}
|
||||
}
|
||||
|
||||
self.getMessage = function(messageID, substitutions = null) {
|
||||
try {
|
||||
if (substitutions) {
|
||||
return messages[messageID].message.replace(/\{(\d+)\}/g, function (t, i) {
|
||||
return substitutions[i] !== void 0 ? substitutions[i] : "{" + (i - substitutions.length) + "}";
|
||||
});
|
||||
} else {
|
||||
return messages[messageID].message;
|
||||
}
|
||||
} catch {
|
||||
console.log("Unable to get messageID: " + messageID)
|
||||
return messageID;
|
||||
}
|
||||
}
|
||||
|
||||
self.translate = function(messageID) {
|
||||
localized++;
|
||||
|
||||
return chrome.i18n.getMessage(messageID);
|
||||
if (messages == null) {
|
||||
self.loadMessages();
|
||||
}
|
||||
|
||||
return self.getMessage(messageID);
|
||||
|
||||
};
|
||||
|
||||
self.localize = function () {
|
||||
|
||||
$('[i18n]:not(.i18n-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.html(translate(element.attr('i18n')));
|
||||
element.html(self.translate(element.attr('i18n')));
|
||||
element.addClass('i18n-replaced');
|
||||
});
|
||||
|
||||
$('[data-i18n]:not(.i18n-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
const translated = translate(element.data('i18n'));
|
||||
const translated = self.translate(element.data('i18n'));
|
||||
element.html(translated);
|
||||
element.addClass('i18n-replaced');
|
||||
if (element.attr("title") !== "") {
|
||||
|
@ -30,44 +67,48 @@ function localize() {
|
|||
$('[i18n_title]:not(.i18n_title-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('title', translate(element.attr('i18n_title')));
|
||||
element.attr('title', self.translate(element.attr('i18n_title')));
|
||||
element.addClass('i18n_title-replaced');
|
||||
});
|
||||
|
||||
$('[data-i18n_title]:not(.i18n_title-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('title', translate(element.data('i18n_title')));
|
||||
element.attr('title', self.translate(element.data('i18n_title')));
|
||||
element.addClass('i18n_title-replaced');
|
||||
});
|
||||
|
||||
$('[i18n_label]:not(.i18n_label-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('label', translate(element.attr('i18n_label')));
|
||||
element.attr('label', self.translate(element.attr('i18n_label')));
|
||||
element.addClass('i18n_label-replaced');
|
||||
});
|
||||
|
||||
$('[data-i18n_label]:not(.i18n_label-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('label', translate(element.data('i18n_label')));
|
||||
element.attr('label', self.translate(element.data('i18n_label')));
|
||||
element.addClass('i18n_label-replaced');
|
||||
});
|
||||
|
||||
$('[i18n_value]:not(.i18n_value-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
var element = $(this);""
|
||||
|
||||
element.val(translate(element.attr('i18n_value')));
|
||||
element.val(self.translate(element.attr('i18n_value')));
|
||||
element.addClass('i18n_value-replaced');
|
||||
});
|
||||
|
||||
$('[i18n_placeholder]:not(.i18n_placeholder-replaced)').each(function() {
|
||||
var element = $(this);
|
||||
|
||||
element.attr('placeholder', translate(element.attr('i18n_placeholder')));
|
||||
element.attr('placeholder', self.translate(element.attr('i18n_placeholder')));
|
||||
element.addClass('i18n_placeholder-replaced');
|
||||
});
|
||||
|
||||
return localized;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
}
|
||||
|
|
629
js/main.js
Normal file
629
js/main.js
Normal file
|
@ -0,0 +1,629 @@
|
|||
window.$ = window.jQuery = require('jquery'),
|
||||
require('jquery-ui-dist/jquery-ui');
|
||||
const { SerialPort } = require('serialport');
|
||||
const path = require('path');
|
||||
const { app } = require('@electron/remote');
|
||||
const ol = require('openlayers');
|
||||
const Store = require('electron-store');
|
||||
const store = new Store();
|
||||
var localization;
|
||||
|
||||
// Set how the units render on the configurator only
|
||||
const UnitType = {
|
||||
none: "none",
|
||||
OSD: "OSD",
|
||||
imperial: "imperial",
|
||||
metric: "metric",
|
||||
}
|
||||
|
||||
|
||||
let globalSettings = {
|
||||
// Configurator rendering options
|
||||
// Used to depict how the units are displayed within the UI
|
||||
unitType: null,
|
||||
// Used to convert units within the UI
|
||||
osdUnits: null,
|
||||
// Map
|
||||
mapProviderType: null,
|
||||
mapApiKey: null,
|
||||
proxyURL: null,
|
||||
proxyLayer: null,
|
||||
// Show colours for profiles
|
||||
showProfileParameters: null,
|
||||
// tree target for documents
|
||||
docsTreeLocation: 'master',
|
||||
};
|
||||
|
||||
$(document).on("ready", () => {
|
||||
localization = new Localiziation("en");
|
||||
localization.localize();
|
||||
|
||||
globalSettings.unitType = store.get('unit_type', UnitType.none);
|
||||
globalSettings.mapProviderType = store.get('map_provider_type', 'osm');
|
||||
globalSettings.mapApiKey = store.get('map_api_key', '');
|
||||
globalSettings.proxyURL = store.get('proxyurl', 'http://192.168.1.222/mapproxy/service?');
|
||||
globalSettings.proxyLayer = store.get('proxylayer', 'your_proxy_layer_name');
|
||||
globalSettings.showProfileParameters = store.get('show_profile_parameters', 1);
|
||||
updateProfilesHighlightColours();
|
||||
|
||||
// Resets the OSD units used by the unit coversion when the FC is disconnected.
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
globalSettings.osdUnits = null;
|
||||
}
|
||||
|
||||
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
||||
GUI.log(localization.getMessage('getRunningOS') + GUI.operating_system + '</strong>, ' +
|
||||
'Chrome: <strong>' + process.versions['chrome'] + '</strong>, ' +
|
||||
localization.getMessage('getConfiguratorVersion') + app.getVersion() + '</strong>');
|
||||
|
||||
$('#status-bar .version').text(app.getVersion());
|
||||
$('#logo .version').text(app.getVersion());
|
||||
updateFirmwareVersion();
|
||||
|
||||
if (store.get('logopen', false)) {
|
||||
$("#showlog").trigger('click');
|
||||
}
|
||||
|
||||
if (store.get('update_notify', true)) {
|
||||
appUpdater.checkRelease(app.getVersion());
|
||||
}
|
||||
|
||||
// log library versions in console to make version tracking easier
|
||||
console.log('Libraries: jQuery - ' + $.fn.jquery + ', d3 - ' + d3.version + ', three.js - ' + THREE.REVISION);
|
||||
|
||||
// Tabs
|
||||
var ui_tabs = $('#tabs > ul');
|
||||
$('a', ui_tabs).click(function () {
|
||||
|
||||
if ($(this).parent().hasClass("tab_help")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(this).parent().hasClass('active') == false && !GUI.tab_switch_in_progress) { // only initialize when the tab isn't already active
|
||||
var self = this,
|
||||
tabClass = $(self).parent().prop('class');
|
||||
|
||||
var tabRequiresConnection = $(self).parent().hasClass('mode-connected');
|
||||
|
||||
var tab = tabClass.substring(4);
|
||||
var tabName = $(self).text();
|
||||
|
||||
if (tabRequiresConnection && !CONFIGURATOR.connectionValid) {
|
||||
GUI.log(localization.getMessage('tabSwitchConnectionRequired'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI.connect_lock) { // tab switching disabled while operation is in progress
|
||||
GUI.log(localization.getMessage('tabSwitchWaitForOperation'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI.allowedTabs.indexOf(tab) < 0) {
|
||||
GUI.log(localization.getMessage('tabSwitchUpgradeRequired', [tabName]));
|
||||
return;
|
||||
}
|
||||
|
||||
GUI.tab_switch_in_progress = true;
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
// disable previously active tab highlight
|
||||
$('li', ui_tabs).removeClass('active');
|
||||
|
||||
// Highlight selected tab
|
||||
$(self).parent().addClass('active');
|
||||
|
||||
// detach listeners and remove element data
|
||||
var content = $('#content');
|
||||
content.data('empty', !!content.is(':empty'));
|
||||
content.empty();
|
||||
|
||||
// display loading screen
|
||||
$('#cache .data-loading').clone().appendTo(content);
|
||||
|
||||
function content_ready() {
|
||||
GUI.tab_switch_in_progress = false;
|
||||
|
||||
// Update CSS on to show highlighing or not
|
||||
updateProfilesHighlightColours();
|
||||
}
|
||||
|
||||
switch (tab) {
|
||||
case 'landing':
|
||||
TABS.landing.initialize(content_ready);
|
||||
break;
|
||||
case 'firmware_flasher':
|
||||
TABS.firmware_flasher.initialize(content_ready);
|
||||
break;
|
||||
case 'sitl':
|
||||
TABS.sitl.initialize(content_ready);
|
||||
break;
|
||||
case 'auxiliary':
|
||||
TABS.auxiliary.initialize(content_ready);
|
||||
break;
|
||||
case 'adjustments':
|
||||
TABS.adjustments.initialize(content_ready);
|
||||
break;
|
||||
case 'ports':
|
||||
TABS.ports.initialize(content_ready);
|
||||
break;
|
||||
case 'led_strip':
|
||||
TABS.led_strip.initialize(content_ready);
|
||||
break;
|
||||
case 'failsafe':
|
||||
TABS.failsafe.initialize(content_ready);
|
||||
break;
|
||||
case 'setup':
|
||||
TABS.setup.initialize(content_ready);
|
||||
break;
|
||||
case 'calibration':
|
||||
TABS.calibration.initialize(content_ready);
|
||||
break;
|
||||
case 'configuration':
|
||||
TABS.configuration.initialize(content_ready);
|
||||
break;
|
||||
case 'profiles':
|
||||
TABS.profiles.initialize(content_ready);
|
||||
break;
|
||||
case 'pid_tuning':
|
||||
TABS.pid_tuning.initialize(content_ready);
|
||||
break;
|
||||
case 'receiver':
|
||||
TABS.receiver.initialize(content_ready);
|
||||
break;
|
||||
case 'modes':
|
||||
TABS.modes.initialize(content_ready);
|
||||
break;
|
||||
case 'servos':
|
||||
TABS.servos.initialize(content_ready);
|
||||
break;
|
||||
case 'gps':
|
||||
TABS.gps.initialize(content_ready);
|
||||
break;
|
||||
case 'magnetometer':
|
||||
TABS.magnetometer.initialize(content_ready);
|
||||
break;
|
||||
case 'mission_control':
|
||||
TABS.mission_control.initialize(content_ready);
|
||||
break;
|
||||
case 'mixer':
|
||||
TABS.mixer.initialize(content_ready);
|
||||
break;
|
||||
case 'outputs':
|
||||
TABS.outputs.initialize(content_ready);
|
||||
break;
|
||||
case 'osd':
|
||||
TABS.osd.initialize(content_ready);
|
||||
break;
|
||||
case 'sensors':
|
||||
TABS.sensors.initialize(content_ready);
|
||||
break;
|
||||
case 'logging':
|
||||
TABS.logging.initialize(content_ready);
|
||||
break;
|
||||
case 'onboard_logging':
|
||||
TABS.onboard_logging.initialize(content_ready);
|
||||
break;
|
||||
case 'advanced_tuning':
|
||||
TABS.advanced_tuning.initialize(content_ready);
|
||||
break;
|
||||
case 'programming':
|
||||
TABS.programming.initialize(content_ready);
|
||||
break;
|
||||
case 'cli':
|
||||
TABS.cli.initialize(content_ready);
|
||||
break;
|
||||
case 'ez_tune':
|
||||
TABS.ez_tune.initialize(content_ready);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Tab not found:' + tab);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#tabs ul.mode-disconnected li a:first').click();
|
||||
|
||||
// options
|
||||
$('#options').click(function () {
|
||||
var el = $(this);
|
||||
|
||||
if (!el.hasClass('active')) {
|
||||
el.addClass('active');
|
||||
el.after('<div id="options-window"></div>');
|
||||
|
||||
$('div#options-window').load('/html//options.html', function () {
|
||||
|
||||
// translate to user-selected language
|
||||
localization.localize();
|
||||
|
||||
// if notifications are enabled, or wasn't set, check the notifications checkbox
|
||||
if (store.get('update_notify', true)) {
|
||||
$('div.notifications input').prop('checked', true);
|
||||
}
|
||||
|
||||
$('div.notifications input').change(function () {
|
||||
var check = $(this).is(':checked');
|
||||
store.set('update_notify', check);
|
||||
});
|
||||
|
||||
$('div.statistics input').change(function () {
|
||||
var check = $(this).is(':checked');
|
||||
});
|
||||
|
||||
$('div.show_profile_parameters input').change(function () {
|
||||
globalSettings.showProfileParameters = $(this).is(':checked');
|
||||
store.set('show_profile_parameters', globalSettings.showProfileParameters);
|
||||
|
||||
// Update CSS on select boxes
|
||||
updateProfilesHighlightColours();
|
||||
|
||||
// Horrible way to reload the tab
|
||||
const activeTab = $('#tabs li.active');
|
||||
activeTab.removeClass('active');
|
||||
activeTab.find('a').click();
|
||||
});
|
||||
|
||||
$('#ui-unit-type').val(globalSettings.unitType);
|
||||
$('#map-provider-type').val(globalSettings.mapProviderType);
|
||||
$('#map-api-key').val(globalSettings.mapApiKey);
|
||||
$('#proxyurl').val(globalSettings.proxyURL);
|
||||
$('#proxylayer').val(globalSettings.proxyLayer);
|
||||
$('#showProfileParameters').prop('checked', globalSettings.showProfileParameters);
|
||||
|
||||
// Set the value of the unit type
|
||||
// none, OSD, imperial, metric
|
||||
$('#ui-unit-type').change(function () {
|
||||
store.set('unit_type', $(this).val());
|
||||
globalSettings.unitType = $(this).val();
|
||||
|
||||
// Update the osd units in global settings
|
||||
// but only if we need it
|
||||
if (globalSettings.unitType === UnitType.OSD) {
|
||||
get_osd_settings();
|
||||
}
|
||||
|
||||
// Horrible way to reload the tab
|
||||
const activeTab = $('#tabs li.active');
|
||||
activeTab.removeClass('active');
|
||||
activeTab.find('a').click();
|
||||
});
|
||||
$('#map-provider-type').change(function () {
|
||||
store.set('map_provider_type', $(this).val());
|
||||
globalSettings.mapProviderType = $(this).val();
|
||||
});
|
||||
$('#map-api-key').change(function () {
|
||||
store.set('map_api_key', $(this).val());
|
||||
globalSettings.mapApiKey = $(this).val();
|
||||
});
|
||||
$('#proxyurl').change(function () {
|
||||
store.set('proxyurl', $(this).val());
|
||||
globalSettings.proxyURL = $(this).val();
|
||||
});
|
||||
$('#proxylayer').change(function () {
|
||||
store.set('proxylayer', $(this).val());
|
||||
globalSettings.proxyLayer = $(this).val();
|
||||
});
|
||||
$('#demoModeReset').on('click', () => {
|
||||
SITLProcess.deleteEepromFile('demo.bin');
|
||||
});
|
||||
function close_and_cleanup(e) {
|
||||
if (e.type == 'click' && !$.contains($('div#options-window')[0], e.target) || e.type == 'keyup' && e.keyCode == 27) {
|
||||
$(document).unbind('click keyup', close_and_cleanup);
|
||||
|
||||
$('div#options-window').slideUp(250, function () {
|
||||
el.removeClass('active');
|
||||
$(this).empty().remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('click keyup', close_and_cleanup);
|
||||
|
||||
$(this).slideDown(250);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var $content = $("#content");
|
||||
|
||||
// listen to all input change events and adjust the value within limits if necessary
|
||||
$content.on('focus', 'input[type="number"]', function () {
|
||||
var element = $(this),
|
||||
val = element.val();
|
||||
|
||||
if (!isNaN(val)) {
|
||||
element.data('previousValue', parseFloat(val));
|
||||
}
|
||||
});
|
||||
|
||||
$content.on('keydown', 'input[type="number"]', function (e) {
|
||||
// whitelist all that we need for numeric control
|
||||
var whitelist = [
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, // numpad and standard number keypad
|
||||
109, 189, // minus on numpad and in standard keyboard
|
||||
8, 46, 9, // backspace, delete, tab
|
||||
190, 110, // decimal point
|
||||
37, 38, 39, 40, 13 // arrows and enter
|
||||
];
|
||||
|
||||
if (whitelist.indexOf(e.keyCode) == -1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$content.on('change', 'input[type="number"]', function () {
|
||||
var element = $(this),
|
||||
min = parseFloat(element.prop('min')),
|
||||
max = parseFloat(element.prop('max')),
|
||||
step = parseFloat(element.prop('step')),
|
||||
val = parseFloat(element.val()),
|
||||
decimal_places;
|
||||
|
||||
// only adjust minimal end if bound is set
|
||||
if (element.prop('min')) {
|
||||
if (val < min) {
|
||||
element.val(min);
|
||||
val = min;
|
||||
}
|
||||
}
|
||||
|
||||
// only adjust maximal end if bound is set
|
||||
if (element.prop('max')) {
|
||||
if (val > max) {
|
||||
element.val(max);
|
||||
val = max;
|
||||
}
|
||||
}
|
||||
|
||||
// if entered value is illegal use previous value instead
|
||||
if (isNaN(val)) {
|
||||
element.val(element.data('previousValue'));
|
||||
val = element.data('previousValue');
|
||||
}
|
||||
|
||||
// if step is not set or step is int and value is float use previous value instead
|
||||
if (isNaN(step) || step % 1 === 0) {
|
||||
if (val % 1 !== 0) {
|
||||
element.val(element.data('previousValue'));
|
||||
val = element.data('previousValue');
|
||||
}
|
||||
}
|
||||
|
||||
// if step is set and is float and value is int, convert to float, keep decimal places in float according to step *experimental*
|
||||
if (!isNaN(step) && step % 1 !== 0) {
|
||||
decimal_places = String(step).split('.')[1].length;
|
||||
|
||||
if (val % 1 === 0) {
|
||||
element.val(val.toFixed(decimal_places));
|
||||
} else if (String(val).split('.')[1].length != decimal_places) {
|
||||
element.val(val.toFixed(decimal_places));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#showlog").on('click', function() {
|
||||
var state = $(this).data('state'),
|
||||
$log = $("#log");
|
||||
|
||||
if (state) {
|
||||
$log.animate({height: 27}, 200, function() {
|
||||
var command_log = $('div#log');
|
||||
//noinspection JSValidateTypes
|
||||
command_log.scrollTop($('div.wrapper', command_log).height());
|
||||
});
|
||||
$log.removeClass('active');
|
||||
$("#content").removeClass('logopen');
|
||||
$(".tab_container").removeClass('logopen');
|
||||
$("#scrollicon").removeClass('active');
|
||||
store.set('logopen', false);
|
||||
|
||||
state = false;
|
||||
}else{
|
||||
$log.animate({height: 111}, 200);
|
||||
$log.addClass('active');
|
||||
$("#content").addClass('logopen');
|
||||
$(".tab_container").addClass('logopen');
|
||||
$("#scrollicon").addClass('active');
|
||||
store.set('logopen', true);
|
||||
|
||||
state = true;
|
||||
}
|
||||
|
||||
$(this).html(state ? localization.getMessage("mainHideLog") : localization.getMessage("mainShowLog"));
|
||||
$(this).data('state', state);
|
||||
|
||||
});
|
||||
|
||||
var mixerprofile_e = $('#mixerprofilechange');
|
||||
|
||||
mixerprofile_e.change(function () {
|
||||
var mixerprofile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SELECT_MIXER_PROFILE, [mixerprofile], false, function () {
|
||||
GUI.log(localization.getMessage('loadedMixerProfile', [mixerprofile + 1]));
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var profile_e = $('#profilechange');
|
||||
|
||||
profile_e.change(function () {
|
||||
var profile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [profile], false, function () {
|
||||
GUI.log(localization.getMessage('pidTuning_LoadedProfile', [profile + 1]));
|
||||
});
|
||||
});
|
||||
|
||||
var batteryprofile_e = $('#batteryprofilechange');
|
||||
|
||||
batteryprofile_e.change(function () {
|
||||
var batteryprofile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [batteryprofile], false, function () {
|
||||
GUI.log(localization.getMessage('loadedBatteryProfile', [batteryprofile + 1]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function get_osd_settings() {
|
||||
if (globalSettings.osdUnits !== undefined && globalSettings.osdUnits !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
MSP.promise(MSPCodes.MSP2_INAV_OSD_PREFERENCES).then(function (resp) {
|
||||
var prefs = resp.data;
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
globalSettings.osdUnits = prefs.readU8();
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfilesHighlightColours() {
|
||||
if (globalSettings.showProfileParameters) {
|
||||
$('.dropdown-dark #profilechange').addClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').addClass('showProfileParams');
|
||||
|
||||
$('.batteryProfileHighlight').each(function () {
|
||||
$(this).addClass('batteryProfileHighlightActive');
|
||||
$(this).removeClass('batteryProfileHighlight');
|
||||
});
|
||||
|
||||
$('.controlProfileHighlight').each(function () {
|
||||
$(this).addClass('controlProfileHighlightActive');
|
||||
$(this).removeClass('controlProfileHighlight');
|
||||
});
|
||||
} else {
|
||||
$('.dropdown-dark #profilechange').removeClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').removeClass('showProfileParams');
|
||||
|
||||
$('.batteryProfileHighlightActive').each(function () {
|
||||
$(this).addClass('batteryProfileHighlight');
|
||||
$(this).removeClass('batteryProfileHighlightActive');
|
||||
});
|
||||
|
||||
$('.controlProfileHighlightActive').each(function () {
|
||||
$(this).addClass('controlProfileHighlight');
|
||||
$(this).removeClass('controlProfileHighlightActive');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function catch_startup_time(startTime) {
|
||||
var endTime = new Date().getTime(),
|
||||
timeSpent = endTime - startTime;
|
||||
}
|
||||
|
||||
function millitime() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
if (bytes < 1024) {
|
||||
bytes = bytes + ' Bytes';
|
||||
} else if (bytes < 1048576) {
|
||||
bytes = (bytes / 1024).toFixed(3) + ' KB';
|
||||
} else if (bytes < 1073741824) {
|
||||
bytes = (bytes / 1048576).toFixed(3) + ' MB';
|
||||
} else {
|
||||
bytes = (bytes / 1073741824).toFixed(3) + ' GB';
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Number.prototype.clamp = function (min, max) {
|
||||
return Math.min(Math.max(this, min), max);
|
||||
};
|
||||
|
||||
/**
|
||||
* String formatting now supports currying (partial application).
|
||||
* For a format string with N replacement indices, you can call .format
|
||||
* with M <= N arguments. The result is going to be a format string
|
||||
* with N-M replacement indices, properly counting from 0 .. N-M.
|
||||
* The following Example should explain the usage of partial applied format:
|
||||
* "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
|
||||
* "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
|
||||
**/
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/\{(\d+)\}/g, function (t, i) {
|
||||
return args[i] !== void 0 ? args[i] : "{" + (i - args.length) + "}";
|
||||
});
|
||||
};
|
||||
|
||||
function padZeros(val, length) {
|
||||
let str = val.toString();
|
||||
|
||||
if (str.length < length) {
|
||||
if (str.charAt(0) === '-') {
|
||||
str = "-0" + str.substring(1);
|
||||
str = padZeros(str, length);
|
||||
} else {
|
||||
str = padZeros("0" + str, length);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function updateActivatedTab() {
|
||||
var activeTab = $('#tabs > ul li.active');
|
||||
activeTab.removeClass('active');
|
||||
$('a', activeTab).trigger('click');
|
||||
}
|
||||
|
||||
function updateFirmwareVersion() {
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
$('#logo .firmware_version').text(CONFIG.flightControllerVersion + " [" + CONFIG.target + "]");
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/' + CONFIG.flightControllerVersion + '/docs/';
|
||||
|
||||
// If this is a master branch firmware, this will find a 404 as there is no tag tree. So default to master for docs.
|
||||
$.ajax({
|
||||
url: globalSettings.docsTreeLocation + 'Settings.md',
|
||||
method: "HEAD",
|
||||
statusCode: {
|
||||
404: function () {
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#logo .firmware_version').text(localization.getMessage('fcNotConnected'));
|
||||
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
|
||||
}
|
||||
}
|
||||
|
||||
function updateEzTuneTabVisibility(loadMixerConfig) {
|
||||
let useEzTune = true;
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
if (loadMixerConfig) {
|
||||
mspHelper.loadMixerConfig(function () {
|
||||
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
||||
$('.tab_ez_tune').removeClass("is-hidden");
|
||||
} else {
|
||||
$('.tab_ez_tune').addClass("is-hidden");
|
||||
useEzTune = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
||||
$('.tab_ez_tune').removeClass("is-hidden");
|
||||
} else {
|
||||
$('.tab_ez_tune').addClass("is-hidden");
|
||||
useEzTune = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return useEzTune;
|
||||
}
|
12
js/model.js
12
js/model.js
|
@ -31,12 +31,12 @@ const INPUT_STABILIZED_ROLL = 0,
|
|||
INPUT_RC_AUX4 = 11,
|
||||
INPUT_GIMBAL_PITCH = 12,
|
||||
INPUT_GIMBAL_ROLL = 13,
|
||||
INPUT_FEATURE_FLAPS = 14;
|
||||
STABILIZED_ROLL_POSITIVE = 23;
|
||||
STABILIZED_ROLL_NEGATIVE = 24;
|
||||
STABILIZED_PITCH_POSITIVE = 25;
|
||||
STABILIZED_PITCH_NEGATIVE = 26;
|
||||
STABILIZED_YAW_POSITIVE = 27;
|
||||
INPUT_FEATURE_FLAPS = 14,
|
||||
STABILIZED_ROLL_POSITIVE = 23,
|
||||
STABILIZED_ROLL_NEGATIVE = 24,
|
||||
STABILIZED_PITCH_POSITIVE = 25,
|
||||
STABILIZED_PITCH_NEGATIVE = 26,
|
||||
STABILIZED_YAW_POSITIVE = 27,
|
||||
STABILIZED_YAW_NEGATIVE = 28;
|
||||
|
||||
const
|
||||
|
|
|
@ -298,7 +298,7 @@ var MSP = {
|
|||
view[4] = code;
|
||||
|
||||
checksum = view[3] ^ view[4];
|
||||
for (ii = 0; ii < payloadLength; ii++) {
|
||||
for (let ii = 0; ii < payloadLength; ii++) {
|
||||
view[ii + 5] = data[ii];
|
||||
checksum ^= data[ii];
|
||||
}
|
||||
|
@ -316,11 +316,11 @@ var MSP = {
|
|||
view[5] = (code & 0xFF00) >> 8; // code upper byte
|
||||
view[6] = payloadLength & 0xFF; // payloadLength lower byte
|
||||
view[7] = (payloadLength & 0xFF00) >> 8; // payloadLength upper byte
|
||||
for (ii = 0; ii < payloadLength; ii++) {
|
||||
for (let ii = 0; ii < payloadLength; ii++) {
|
||||
view[8+ii] = data[ii];
|
||||
}
|
||||
checksum = 0;
|
||||
for (ii = 3; ii < length-1; ii++) {
|
||||
for (let ii = 3; ii < length-1; ii++) {
|
||||
checksum = this._crc8_dvb_s2(checksum, view[ii]);
|
||||
}
|
||||
view[length-1] = checksum;
|
||||
|
|
|
@ -245,7 +245,5 @@ var MSPCodes = {
|
|||
MSP2_INAV_EZ_TUNE: 0x2070,
|
||||
MSP2_INAV_EZ_TUNE_SET: 0x2071,
|
||||
|
||||
MSP2_INAV_SELECT_MIXER_PROFILE: 0x2080,
|
||||
|
||||
MSP2_ADSB_VEHICLE_LIST: 0x2090,
|
||||
MSP2_INAV_SELECT_MIXER_PROFILE: 0x2080
|
||||
};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/*global $, SERVO_DATA, PID_names, ADJUSTMENT_RANGES, RXFAIL_CONFIG, SERVO_CONFIG,CONFIG*/
|
||||
'use strict';
|
||||
|
||||
const mapSeries = require('promise-map-series')
|
||||
|
||||
var mspHelper = (function (gui) {
|
||||
var self = {};
|
||||
|
||||
|
@ -79,7 +81,7 @@ var mspHelper = (function (gui) {
|
|||
CONFIG.cpuload = data.getUint16(offset, true);
|
||||
offset += 2;
|
||||
|
||||
profile_byte = data.getUint8(offset++)
|
||||
let profile_byte = data.getUint8(offset++)
|
||||
let profile = profile_byte & 0x0F;
|
||||
profile_changed |= (profile !== CONFIG.profile) && (CONFIG.profile !==-1);
|
||||
CONFIG.profile = profile;
|
||||
|
@ -106,7 +108,7 @@ var mspHelper = (function (gui) {
|
|||
var words = dataHandler.message_length_expected / 4;
|
||||
|
||||
CONFIG.mode = [];
|
||||
for (i = 0; i < words; ++i)
|
||||
for (let i = 0; i < words; ++i)
|
||||
CONFIG.mode.push(data.getUint32(i * 4, true));
|
||||
break;
|
||||
|
||||
|
@ -142,7 +144,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP_SERVO:
|
||||
var servoCount = dataHandler.message_length_expected / 2;
|
||||
for (i = 0; i < servoCount; i++) {
|
||||
for (let i = 0; i < servoCount; i++) {
|
||||
SERVO_DATA[i] = data.getUint16(needle, true);
|
||||
|
||||
needle += 2;
|
||||
|
@ -150,7 +152,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP_MOTOR:
|
||||
var motorCount = dataHandler.message_length_expected / 2;
|
||||
for (i = 0; i < motorCount; i++) {
|
||||
for (let i = 0; i < motorCount; i++) {
|
||||
MOTOR_DATA[i] = data.getUint16(needle, true);
|
||||
|
||||
needle += 2;
|
||||
|
@ -159,7 +161,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP_RC:
|
||||
RC.active_channels = dataHandler.message_length_expected / 2;
|
||||
|
||||
for (i = 0; i < RC.active_channels; i++) {
|
||||
for (let i = 0; i < RC.active_channels; i++) {
|
||||
RC.channels[i] = data.getUint16((i * 2), true);
|
||||
}
|
||||
break;
|
||||
|
@ -187,35 +189,6 @@ var mspHelper = (function (gui) {
|
|||
GPS_DATA.eph = data.getUint16(16, true);
|
||||
GPS_DATA.epv = data.getUint16(18, true);
|
||||
break;
|
||||
case MSPCodes.MSP2_ADSB_VEHICLE_LIST:
|
||||
var byteOffsetCounter = 0;
|
||||
ADSB_VEHICLES.vehicles = [];
|
||||
ADSB_VEHICLES.vehiclesCount = data.getUint8(byteOffsetCounter++);
|
||||
ADSB_VEHICLES.callsignLength = data.getUint8(byteOffsetCounter++);
|
||||
|
||||
for(i = 0; i < ADSB_VEHICLES.vehiclesCount; i++){
|
||||
|
||||
var vehicle = {callSignByteArray: [], callsign: "", icao: 0, lat: 0, lon: 0, alt: 0, heading: 0, ttl: 0, tslc: 0, emitterType: 0};
|
||||
|
||||
for(ii = 0; ii < ADSB_VEHICLES.callsignLength; ii++){
|
||||
vehicle.callSignByteArray.push(data.getUint8(byteOffsetCounter++));
|
||||
}
|
||||
|
||||
vehicle.callsign = (String.fromCharCode(...vehicle.callSignByteArray)).replace(/[^\x20-\x7E]/g, '');
|
||||
vehicle.icao = data.getUint32(byteOffsetCounter, true); byteOffsetCounter += 4;
|
||||
vehicle.lat = data.getInt32(byteOffsetCounter, true); byteOffsetCounter += 4;
|
||||
vehicle.lon = data.getInt32(byteOffsetCounter, true); byteOffsetCounter += 4;
|
||||
vehicle.altCM = data.getInt32(byteOffsetCounter, true); byteOffsetCounter += 4;
|
||||
vehicle.headingDegrees = data.getUint16(byteOffsetCounter, true); byteOffsetCounter += 2;
|
||||
vehicle.tslc = data.getUint8(byteOffsetCounter++);
|
||||
vehicle.emitterType = data.getUint8(byteOffsetCounter++);
|
||||
vehicle.ttl = data.getUint8(byteOffsetCounter++);
|
||||
|
||||
ADSB_VEHICLES.vehicles.push(vehicle);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_ATTITUDE:
|
||||
SENSOR_DATA.kinematics[0] = data.getInt16(0, true) / 10.0; // x
|
||||
SENSOR_DATA.kinematics[1] = data.getInt16(2, true) / 10.0; // y
|
||||
|
@ -304,7 +277,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSP2_PID:
|
||||
// PID data arrived, we need to scale it and save to appropriate bank / array
|
||||
for (i = 0, needle = 0; i < (dataHandler.message_length_expected / 4); i++, needle += 4) {
|
||||
for (let i = 0, needle = 0; i < (dataHandler.message_length_expected / 4); i++, needle += 4) {
|
||||
PIDs[i][0] = data.getUint8(needle);
|
||||
PIDs[i][1] = data.getUint8(needle + 1);
|
||||
PIDs[i][2] = data.getUint8(needle + 2);
|
||||
|
@ -421,7 +394,7 @@ var mspHelper = (function (gui) {
|
|||
//noinspection JSUndeclaredVariable
|
||||
AUX_CONFIG = []; // empty the array as new data is coming in
|
||||
buff = [];
|
||||
for (i = 0; i < data.byteLength; i++) {
|
||||
for (let i = 0; i < data.byteLength; i++) {
|
||||
if (data.getUint8(i) == 0x3B) { // ; (delimeter char)
|
||||
AUX_CONFIG.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
|
||||
|
||||
|
@ -437,7 +410,7 @@ var mspHelper = (function (gui) {
|
|||
PID_names = []; // empty the array as new data is coming in
|
||||
|
||||
buff = [];
|
||||
for (i = 0; i < data.byteLength; i++) {
|
||||
for (let i = 0; i < data.byteLength; i++) {
|
||||
if (data.getUint8(i) == 0x3B) { // ; (delimiter char)
|
||||
PID_names.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
|
||||
|
||||
|
@ -465,14 +438,14 @@ var mspHelper = (function (gui) {
|
|||
//noinspection JSUndeclaredVariable
|
||||
AUX_CONFIG_IDS = []; // empty the array as new data is coming in
|
||||
|
||||
for (i = 0; i < data.byteLength; i++) {
|
||||
for (let i = 0; i < data.byteLength; i++) {
|
||||
AUX_CONFIG_IDS.push(data.getUint8(i));
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SERVO_MIX_RULES:
|
||||
SERVO_RULES.flush();
|
||||
if (data.byteLength % 8 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 8) {
|
||||
for (let i = 0; i < data.byteLength; i += 8) {
|
||||
SERVO_RULES.put(new ServoMixRule(
|
||||
data.getInt8(i),
|
||||
data.getInt8(i + 1),
|
||||
|
@ -487,7 +460,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_SERVO_MIXER:
|
||||
SERVO_RULES.flush();
|
||||
if (data.byteLength % 6 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 6) {
|
||||
for (let i = 0; i < data.byteLength; i += 6) {
|
||||
SERVO_RULES.put(new ServoMixRule(
|
||||
data.getInt8(i),
|
||||
data.getInt8(i + 1),
|
||||
|
@ -509,7 +482,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS:
|
||||
LOGIC_CONDITIONS.flush();
|
||||
if (data.byteLength % 14 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 14) {
|
||||
for (let i = 0; i < data.byteLength; i += 14) {
|
||||
LOGIC_CONDITIONS.put(new LogicCondition(
|
||||
data.getInt8(i),
|
||||
data.getInt8(i + 1),
|
||||
|
@ -540,7 +513,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS:
|
||||
if (data.byteLength % 4 === 0) {
|
||||
let index = 0;
|
||||
for (i = 0; i < data.byteLength; i += 4) {
|
||||
for (let i = 0; i < data.byteLength; i += 4) {
|
||||
LOGIC_CONDITIONS_STATUS.set(index, data.getInt32(i, true));
|
||||
index++;
|
||||
}
|
||||
|
@ -550,7 +523,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_GVAR_STATUS:
|
||||
if (data.byteLength % 4 === 0) {
|
||||
let index = 0;
|
||||
for (i = 0; i < data.byteLength; i += 4) {
|
||||
for (let i = 0; i < data.byteLength; i += 4) {
|
||||
GLOBAL_VARIABLES_STATUS.set(index, data.getInt32(i, true));
|
||||
index++;
|
||||
}
|
||||
|
@ -564,7 +537,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_PROGRAMMING_PID:
|
||||
PROGRAMMING_PID.flush();
|
||||
if (data.byteLength % 19 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 19) {
|
||||
for (let i = 0; i < data.byteLength; i += 19) {
|
||||
PROGRAMMING_PID.put(new ProgrammingPid(
|
||||
data.getInt8(i), // enabled
|
||||
data.getInt8(i + 1), // setpointType
|
||||
|
@ -583,7 +556,7 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS:
|
||||
if (data.byteLength % 4 === 0) {
|
||||
let index = 0;
|
||||
for (i = 0; i < data.byteLength; i += 4) {
|
||||
for (let i = 0; i < data.byteLength; i += 4) {
|
||||
PROGRAMMING_PID_STATUS.set(index, data.getInt32(i, true));
|
||||
index++;
|
||||
}
|
||||
|
@ -598,7 +571,7 @@ var mspHelper = (function (gui) {
|
|||
MOTOR_RULES.flush();
|
||||
|
||||
if (data.byteLength % 8 === 0) {
|
||||
for (i = 0; i < data.byteLength; i += 8) {
|
||||
for (let i = 0; i < data.byteLength; i += 8) {
|
||||
var rule = new MotorMixRule(0, 0, 0, 0);
|
||||
|
||||
rule.fromMsp(
|
||||
|
@ -624,7 +597,7 @@ var mspHelper = (function (gui) {
|
|||
SERVO_CONFIG = []; // empty the array as new data is coming in
|
||||
|
||||
if (data.byteLength % 14 == 0) {
|
||||
for (i = 0; i < data.byteLength; i += 14) {
|
||||
for (let i = 0; i < data.byteLength; i += 14) {
|
||||
var arr = {
|
||||
'min': data.getInt16(i + 0, true),
|
||||
'max': data.getInt16(i + 2, true),
|
||||
|
@ -709,11 +682,11 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
break;
|
||||
case MSPCodes.MSP_DEBUG:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (let i = 0; i < 4; i++)
|
||||
SENSOR_DATA.debug[i] = data.getInt16((2 * i), 1);
|
||||
break;
|
||||
case MSPCodes.MSP2_INAV_DEBUG:
|
||||
for (i = 0; i < 8; i++)
|
||||
for (let i = 0; i < 8; i++)
|
||||
SENSOR_DATA.debug[i] = data.getInt32((4 * i), 1);
|
||||
break;
|
||||
case MSPCodes.MSP_SET_MOTOR:
|
||||
|
@ -737,7 +710,7 @@ var mspHelper = (function (gui) {
|
|||
//noinspection JSUndeclaredVariable
|
||||
RC_MAP = []; // empty the array as new data is coming in
|
||||
|
||||
for (i = 0; i < data.byteLength; i++) {
|
||||
for (let i = 0; i < data.byteLength; i++) {
|
||||
RC_MAP.push(data.getUint8(i));
|
||||
}
|
||||
break;
|
||||
|
@ -802,13 +775,13 @@ var mspHelper = (function (gui) {
|
|||
var dateLength = 11;
|
||||
|
||||
buff = [];
|
||||
for (i = 0; i < dateLength; i++) {
|
||||
for (let i = 0; i < dateLength; i++) {
|
||||
buff.push(data.getUint8(offset++));
|
||||
}
|
||||
buff.push(32); // ascii space
|
||||
|
||||
var timeLength = 8;
|
||||
for (i = 0; i < timeLength; i++) {
|
||||
for (let i = 0; i < timeLength; i++) {
|
||||
buff.push(data.getUint8(offset++));
|
||||
}
|
||||
CONFIG.buildInfo = String.fromCharCode.apply(null, buff);
|
||||
|
@ -844,7 +817,7 @@ var mspHelper = (function (gui) {
|
|||
var bytesPerPort = 1 + 4 + 4;
|
||||
var serialPortCount = data.byteLength / bytesPerPort;
|
||||
|
||||
for (i = 0; i < serialPortCount; i++) {
|
||||
for (let i = 0; i < serialPortCount; i++) {
|
||||
var BAUD_RATES = mspHelper.BAUD_RATES_post1_6_3;
|
||||
|
||||
var serialPort = {
|
||||
|
@ -871,7 +844,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
var modeRangeCount = data.byteLength / 4; // 4 bytes per item.
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < modeRangeCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < modeRangeCount; i++) {
|
||||
var modeRange = {
|
||||
id: data.getUint8(offset++),
|
||||
auxChannelIndex: data.getUint8(offset++),
|
||||
|
@ -890,7 +863,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
var adjustmentRangeCount = data.byteLength / 6; // 6 bytes per item.
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < adjustmentRangeCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < adjustmentRangeCount; i++) {
|
||||
var adjustmentRange = {
|
||||
slotIndex: data.getUint8(offset++),
|
||||
auxChannelIndex: data.getUint8(offset++),
|
||||
|
@ -906,7 +879,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP_CHANNEL_FORWARDING:
|
||||
for (i = 0; i < data.byteLength && i < SERVO_CONFIG.length; i++) {
|
||||
for (let i = 0; i < data.byteLength && i < SERVO_CONFIG.length; i++) {
|
||||
var channelIndex = data.getUint8(i);
|
||||
if (channelIndex < 255) {
|
||||
SERVO_CONFIG[i].indexOfChannelToForward = channelIndex;
|
||||
|
@ -979,7 +952,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
var channelCount = data.byteLength / 3;
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < channelCount; i++, offset++) {
|
||||
for (let i = 0; offset < data.byteLength && i < channelCount; i++, offset++) {
|
||||
var rxfailChannel = {
|
||||
mode: data.getUint8(offset++),
|
||||
value: data.getUint16(offset++, true)
|
||||
|
@ -1000,7 +973,7 @@ var mspHelper = (function (gui) {
|
|||
functions,
|
||||
led;
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < ledCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < ledCount; i++) {
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
|
||||
directionMask = data.getUint16(offset, true);
|
||||
|
@ -1085,7 +1058,7 @@ var mspHelper = (function (gui) {
|
|||
functions,
|
||||
led;
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < ledCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < ledCount; i++) {
|
||||
var mask = data.getUint32(offset, 1);
|
||||
offset += 4;
|
||||
var extra = data.getUint8(offset, 1);
|
||||
|
@ -1141,7 +1114,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
colorCount = data.byteLength / 4;
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < colorCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < colorCount; i++) {
|
||||
|
||||
var h = data.getUint16(offset, true);
|
||||
var s = data.getUint8(offset + 2);
|
||||
|
@ -1167,7 +1140,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
colorCount = data.byteLength / 3;
|
||||
|
||||
for (i = 0; offset < data.byteLength && i < colorCount; i++) {
|
||||
for (let i = 0; offset < data.byteLength && i < colorCount; i++) {
|
||||
|
||||
var mode = data.getUint8(offset++);
|
||||
var direction = data.getUint8(offset++);
|
||||
|
@ -1531,16 +1504,16 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING:
|
||||
OUTPUT_MAPPING.flush();
|
||||
for (i = 0; i < data.byteLength; ++i)
|
||||
for (let i = 0; i < data.byteLength; ++i)
|
||||
OUTPUT_MAPPING.put({
|
||||
'timerId': i,
|
||||
'usageFlags': data.getUint8(i)});
|
||||
break;
|
||||
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING_EXT:
|
||||
OUTPUT_MAPPING.flush();
|
||||
for (i = 0; i < data.byteLength; i += 2) {
|
||||
timerId = data.getUint8(i);
|
||||
usageFlags = data.getUint8(i + 1);
|
||||
for (let i = 0; i < data.byteLength; i += 2) {
|
||||
let timerId = data.getUint8(i);
|
||||
let usageFlags = data.getUint8(i + 1);
|
||||
OUTPUT_MAPPING.put(
|
||||
{
|
||||
'timerId': timerId,
|
||||
|
@ -1553,9 +1526,9 @@ var mspHelper = (function (gui) {
|
|||
if(data.byteLength > 2) {
|
||||
OUTPUT_MAPPING.flushTimerOverrides();
|
||||
}
|
||||
for (i = 0; i < data.byteLength; i += 2) {
|
||||
timerId = data.getUint8(i);
|
||||
outputMode = data.getUint8(i + 1);
|
||||
for (let i = 0; i < data.byteLength; i += 2) {
|
||||
let timerId = data.getUint8(i);
|
||||
let outputMode = data.getUint8(i + 1);
|
||||
OUTPUT_MAPPING.setTimerOverride(timerId, outputMode);
|
||||
}
|
||||
break;
|
||||
|
@ -1590,7 +1563,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_TEMPERATURES:
|
||||
for (i = 0; i < 8; ++i) {
|
||||
for (let i = 0; i < 8; ++i) {
|
||||
temp_decidegrees = data.getInt16(i * 2, true);
|
||||
SENSOR_DATA.temperature[i] = temp_decidegrees / 10; // °C
|
||||
}
|
||||
|
@ -1643,7 +1616,7 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
|
||||
// trigger callbacks, cleanup/remove callback after trigger
|
||||
for (i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length
|
||||
for (let i = dataHandler.callbacks.length - 1; i >= 0; i--) { // iterating in reverse because we use .splice which modifies array length
|
||||
if (i < dataHandler.callbacks.length) {
|
||||
if (dataHandler.callbacks[i].code == dataHandler.code) {
|
||||
// save callback reference
|
||||
|
@ -1718,7 +1691,7 @@ var mspHelper = (function (gui) {
|
|||
buffer.push(VTX_CONFIG.low_power_disarm);
|
||||
break;
|
||||
case MSPCodes.MSP2_SET_PID:
|
||||
for (i = 0; i < PIDs.length; i++) {
|
||||
for (let i = 0; i < PIDs.length; i++) {
|
||||
buffer.push(parseInt(PIDs[i][0]));
|
||||
buffer.push(parseInt(PIDs[i][1]));
|
||||
buffer.push(parseInt(PIDs[i][2]));
|
||||
|
@ -1762,7 +1735,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_RX_MAP:
|
||||
for (i = 0; i < RC_MAP.length; i++) {
|
||||
for (let i = 0; i < RC_MAP.length; i++) {
|
||||
buffer.push(RC_MAP[i]);
|
||||
}
|
||||
break;
|
||||
|
@ -1833,11 +1806,11 @@ var mspHelper = (function (gui) {
|
|||
buffer.push(highByte(Math.round(MISC.vbatmaxcellvoltage * 100)));
|
||||
buffer.push(lowByte(Math.round(MISC.vbatwarningcellvoltage * 100)));
|
||||
buffer.push(highByte(Math.round(MISC.vbatwarningcellvoltage * 100)));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(MISC.battery_capacity, byte_index));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(MISC.battery_capacity_warning, byte_index));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(MISC.battery_capacity_critical, byte_index));
|
||||
buffer.push((MISC.battery_capacity_unit == 'mAh') ? 0 : 1);
|
||||
break;
|
||||
|
@ -1858,11 +1831,11 @@ var mspHelper = (function (gui) {
|
|||
buffer.push(highByte(BATTERY_CONFIG.current_offset));
|
||||
buffer.push(lowByte(BATTERY_CONFIG.current_scale));
|
||||
buffer.push(highByte(BATTERY_CONFIG.current_scale));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(BATTERY_CONFIG.capacity, byte_index));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(BATTERY_CONFIG.capacity_warning, byte_index));
|
||||
for (byte_index = 0; byte_index < 4; ++byte_index)
|
||||
for (let byte_index = 0; byte_index < 4; ++byte_index)
|
||||
buffer.push(specificByte(BATTERY_CONFIG.capacity_critical, byte_index));
|
||||
buffer.push(BATTERY_CONFIG.capacity_unit);
|
||||
break;
|
||||
|
@ -1918,7 +1891,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP_SET_CHANNEL_FORWARDING:
|
||||
for (i = 0; i < SERVO_CONFIG.length; i++) {
|
||||
for (let i = 0; i < SERVO_CONFIG.length; i++) {
|
||||
var out = SERVO_CONFIG[i].indexOfChannelToForward;
|
||||
if (out == undefined) {
|
||||
out = 255; // Cleanflight defines "CHANNEL_FORWARDING_DISABLED" as "(uint8_t)0xFF"
|
||||
|
@ -1928,7 +1901,7 @@ var mspHelper = (function (gui) {
|
|||
break;
|
||||
|
||||
case MSPCodes.MSP2_SET_CF_SERIAL_CONFIG:
|
||||
for (i = 0; i < SERIAL_CONFIG.ports.length; i++) {
|
||||
for (let i = 0; i < SERIAL_CONFIG.ports.length; i++) {
|
||||
var serialPort = SERIAL_CONFIG.ports[i];
|
||||
|
||||
buffer.push(serialPort.identifier);
|
||||
|
@ -3173,7 +3146,7 @@ var mspHelper = (function (gui) {
|
|||
if (waypointId < MISSION_PLANNER.getCountBusyPoints()) {
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, loadWaypoint);
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('ReceiveTime') + (new Date().getTime() - startTime) + 'ms');
|
||||
GUI.log(localization.getMessage('ReceiveTime') + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP, [waypointId], false, callback);
|
||||
}
|
||||
};
|
||||
|
@ -3195,7 +3168,7 @@ var mspHelper = (function (gui) {
|
|||
};
|
||||
|
||||
function endMission() {
|
||||
GUI.log(chrome.i18n.getMessage('SendTime') + (new Date().getTime() - startTime) + 'ms');
|
||||
GUI.log(localization.getMessage('SendTime') + (new Date().getTime() - startTime) + 'ms');
|
||||
MSP.send_message(MSPCodes.MSP_WP_GETINFO, false, false, callback);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,19 +35,19 @@ helper.periodicStatusUpdater = (function () {
|
|||
|
||||
if (FC.isModeEnabled('ARM'))
|
||||
$(".armedicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_armed_active.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_armed_active.svg")'
|
||||
});
|
||||
else
|
||||
$(".armedicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_armed_grey.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_armed_grey.svg")'
|
||||
});
|
||||
if (FC.isModeEnabled('FAILSAFE'))
|
||||
$(".failsafeicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_failsafe_active.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_failsafe_active.svg")'
|
||||
});
|
||||
else
|
||||
$(".failsafeicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_failsafe_grey.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_failsafe_grey.svg")'
|
||||
});
|
||||
|
||||
if (ANALOG != undefined) {
|
||||
|
@ -65,11 +65,11 @@ helper.periodicStatusUpdater = (function () {
|
|||
|
||||
if (active) {
|
||||
$(".linkicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_link_active.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_link_active.svg")'
|
||||
});
|
||||
} else {
|
||||
$(".linkicon").css({
|
||||
'background-image': 'url("../images/icons/cf_icon_link_grey.svg")'
|
||||
'background-image': 'url("./images/icons/cf_icon_link_grey.svg")'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
var usbDevices = {
|
||||
filters: [
|
||||
const { findByIds } = require('usb');
|
||||
|
||||
var usbDevices = [
|
||||
{ 'vendorId': 1155, 'productId': 57105},
|
||||
{ 'vendorId': 11836, 'productId': 57105}
|
||||
]
|
||||
};
|
||||
];
|
||||
|
||||
// TODO: Replace with events
|
||||
|
||||
var PortHandler = new function () {
|
||||
this.initial_ports = false;
|
||||
|
@ -22,16 +24,7 @@ PortHandler.initialize = function () {
|
|||
PortHandler.check = function () {
|
||||
var self = this;
|
||||
|
||||
ConnectionSerial.getDevices(function(all_ports) {
|
||||
|
||||
// filter out ports that are not serial
|
||||
let current_ports = [];
|
||||
for (var i = 0; i < all_ports.length; i++) {
|
||||
if (all_ports[i].indexOf(':') === -1) {
|
||||
current_ports.push(all_ports[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionSerial.getDevices(function(current_ports) {
|
||||
// port got removed or initial_ports wasn't initialized yet
|
||||
if (self.array_difference(self.initial_ports, current_ports).length > 0 || !self.initial_ports) {
|
||||
var removed_ports = self.array_difference(self.initial_ports, current_ports);
|
||||
|
@ -75,35 +68,31 @@ PortHandler.check = function () {
|
|||
|
||||
// auto-select last used port (only during initialization)
|
||||
if (!self.initial_ports) {
|
||||
chrome.storage.local.get('last_used_port', function (result) {
|
||||
var last_used_port = store.get('last_used_port', false);
|
||||
// if last_used_port was set, we try to select it
|
||||
if (result.last_used_port) {
|
||||
if (result.last_used_port == "ble" || result.last_used_port == "tcp" || result.last_used_port == "udp" || result.last_used_port == "sitl" || result.last_used_port == "sitl-demo") {
|
||||
$('#port').val(result.last_used_port);
|
||||
if (last_used_port) {
|
||||
if (last_used_port == "ble" || last_used_port == "tcp" || last_used_port == "udp" || last_used_port == "sitl" || last_used_port == "sitl-demo") {
|
||||
$('#port').val(last_used_port);
|
||||
} else {
|
||||
current_ports.forEach(function(port) {
|
||||
if (port == result.last_used_port) {
|
||||
console.log('Selecting last used port: ' + result.last_used_port);
|
||||
$('#port').val(result.last_used_port);
|
||||
if (port == last_used_port) {
|
||||
console.log('Selecting last used port: ' + last_used_port);
|
||||
$('#port').val(last_used_port);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log('Last used port wasn\'t saved "yet", auto-select disabled.');
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.get('last_used_bps', function (result) {
|
||||
if (result['last_used_bps']) {
|
||||
$('#baud').val(result['last_used_bps']);
|
||||
var last_used_bps = store.get('last_used_bps', false);
|
||||
if (last_used_bps) {
|
||||
$('#baud').val(last_used_bps);
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.get('wireless_mode_enabled', function (result) {
|
||||
if (result['wireless_mode_enabled']) {
|
||||
if (store.get('wireless_mode_enabled', false)) {
|
||||
$('#wireless-mode').prop('checked', true).change();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -154,7 +143,7 @@ PortHandler.check = function () {
|
|||
self.initial_ports = current_ports;
|
||||
}
|
||||
|
||||
self.check_usb_devices();
|
||||
//self.check_usb_devices();
|
||||
|
||||
GUI.updateManualPortVisibility();
|
||||
setTimeout(function () {
|
||||
|
@ -164,22 +153,29 @@ PortHandler.check = function () {
|
|||
};
|
||||
|
||||
PortHandler.check_usb_devices = function (callback) {
|
||||
chrome.usb.getDevices(usbDevices, function (result) {
|
||||
if (result.length) {
|
||||
|
||||
self.dfu_available = false;
|
||||
for (const device of usbDevices) {
|
||||
if (findByIds(device.vendorId, device.productId)) {
|
||||
self.dfu_available = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.dfu_available) {
|
||||
if (!$("div#port-picker #port [value='DFU']").length) {
|
||||
$('div#port-picker #port').append($('<option/>', {value: "DFU", text: "DFU", data: {isDFU: true}}));
|
||||
$('div#port-picker #port').val('DFU');
|
||||
}
|
||||
self.dfu_available = true;
|
||||
} else {
|
||||
if ($("div#port-picker #port [value='DFU']").length) {
|
||||
$("div#port-picker #port [value='DFU']").remove();
|
||||
}
|
||||
self.dfu_available = false;
|
||||
}
|
||||
|
||||
if (callback) callback(self.dfu_available);
|
||||
});
|
||||
if (callback)
|
||||
callback(self.dfu_available);
|
||||
|
||||
};
|
||||
|
||||
PortHandler.update_port_select = function (ports) {
|
||||
|
|
|
@ -81,7 +81,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
|||
|
||||
self.initialize();
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('failedToOpenSerialPort'));
|
||||
GUI.log(localization.getMessage('failedToOpenSerialPort'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -108,7 +108,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
|||
retries++;
|
||||
if (retries > maxRetries) {
|
||||
clearInterval(interval);
|
||||
GUI.log(chrome.i18n.getMessage('failedToFlash') + port);
|
||||
GUI.log(localization.getMessage('failedToFlash') + port);
|
||||
}
|
||||
}
|
||||
// Check for DFU devices
|
||||
|
@ -145,7 +145,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
|||
});
|
||||
});
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('failedToOpenSerialPort'));
|
||||
GUI.log(localization.getMessage('failedToOpenSerialPort'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ STM32_protocol.prototype.initialize = function () {
|
|||
$('span.progressLabel').text('STM32 - timed out, programming: FAILED');
|
||||
self.progress_bar_e.addClass('invalid');
|
||||
|
||||
googleAnalytics.sendEvent('Flashing', 'Programming', 'timeout');
|
||||
|
||||
// protocol got stuck, clear timer and disconnect
|
||||
helper.interval.remove('STM32_timeout');
|
||||
|
@ -722,7 +721,6 @@ STM32_protocol.prototype.upload_procedure = function (step) {
|
|||
if (verify) {
|
||||
console.log('Programming: SUCCESSFUL');
|
||||
$('span.progressLabel').text('Programming: SUCCESSFUL');
|
||||
googleAnalytics.sendEvent('Flashing', 'Programming', 'success');
|
||||
|
||||
// update progress bar
|
||||
self.progress_bar_e.addClass('valid');
|
||||
|
@ -732,7 +730,6 @@ STM32_protocol.prototype.upload_procedure = function (step) {
|
|||
} else {
|
||||
console.log('Programming: FAILED');
|
||||
$('span.progressLabel').text('Programming: FAILED');
|
||||
googleAnalytics.sendEvent('Flashing', 'Programming', 'fail');
|
||||
|
||||
// update progress bar
|
||||
self.progress_bar_e.addClass('invalid');
|
||||
|
|
|
@ -97,7 +97,7 @@ STM32DFU_protocol.prototype.connect = function (device, hex, options, callback)
|
|||
self.openDevice(result[0]);
|
||||
} else {
|
||||
console.log('USB DFU not found');
|
||||
GUI.log(chrome.i18n.getMessage('stm32UsbDfuNotFound'));
|
||||
GUI.log(localization.getMessage('stm32UsbDfuNotFound'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -108,16 +108,16 @@ STM32DFU_protocol.prototype.openDevice = function (device) {
|
|||
chrome.usb.openDevice(device, function (handle) {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('Failed to open USB device!');
|
||||
GUI.log(chrome.i18n.getMessage('usbDeviceOpenFail'));
|
||||
GUI.log(localization.getMessage('usbDeviceOpenFail'));
|
||||
if(GUI.operating_system === 'Linux') {
|
||||
GUI.log(chrome.i18n.getMessage('usbDeviceUdevNotice'));
|
||||
GUI.log(localization.getMessage('usbDeviceUdevNotice'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
self.handle = handle;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('usbDeviceOpened', handle.handle.toString()));
|
||||
GUI.log(localization.getMessage('usbDeviceOpened', handle.handle.toString()));
|
||||
console.log('Device opened with Handle ID: ' + handle.handle);
|
||||
self.claimInterface(0);
|
||||
});
|
||||
|
@ -129,10 +129,10 @@ STM32DFU_protocol.prototype.closeDevice = function () {
|
|||
chrome.usb.closeDevice(this.handle, function closed() {
|
||||
if (checkChromeRuntimeError()) {
|
||||
console.log('Failed to close USB device!');
|
||||
GUI.log(chrome.i18n.getMessage('usbDeviceCloseFail'));
|
||||
GUI.log(localization.getMessage('usbDeviceCloseFail'));
|
||||
}
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('usbDeviceClosed'));
|
||||
GUI.log(localization.getMessage('usbDeviceClosed'));
|
||||
console.log('Device closed with Handle ID: ' + self.handle.handle);
|
||||
|
||||
self.handle = null;
|
||||
|
@ -568,10 +568,10 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
self.flash_layout = chipInfo.internal_flash;
|
||||
self.available_flash_size = self.flash_layout.total_size - (self.hex.start_linear_address - self.flash_layout.start_address);
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
|
||||
GUI.log(localization.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
|
||||
|
||||
if (self.hex.bytes_total > self.available_flash_size) {
|
||||
GUI.log(chrome.i18n.getMessage('dfu_error_image_size',
|
||||
GUI.log(localization.getMessage('dfu_error_image_size',
|
||||
[(self.hex.bytes_total / 1024.0).toFixed(1),
|
||||
(self.available_flash_size / 1024.0).toFixed(1)]));
|
||||
self.cleanup();
|
||||
|
@ -595,10 +595,10 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
|
||||
self.available_flash_size = firmware_partition_size;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
|
||||
GUI.log(localization.getMessage('dfu_device_flash_info', (self.flash_layout.total_size / 1024).toString()));
|
||||
|
||||
if (self.hex.bytes_total > self.available_flash_size) {
|
||||
GUI.log(chrome.i18n.getMessage('dfu_error_image_size',
|
||||
GUI.log(localization.getMessage('dfu_error_image_size',
|
||||
[(self.hex.bytes_total / 1024.0).toFixed(1),
|
||||
(self.available_flash_size / 1024.0).toFixed(1)]));
|
||||
self.cleanup();
|
||||
|
@ -631,7 +631,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
|
||||
var unprotect = function() {
|
||||
console.log('Initiate read unprotect');
|
||||
let messageReadProtected = chrome.i18n.getMessage('stm32ReadProtected');
|
||||
let messageReadProtected = localization.getMessage('stm32ReadProtected');
|
||||
GUI.log(messageReadProtected);
|
||||
TABS.firmware_flasher.flashingMessage(messageReadProtected, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION);
|
||||
|
||||
|
@ -654,9 +654,9 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
self.controlTransfer('in', self.request.GETSTATUS, 0, 0, 6, 0, function (data, error) { // should stall/disconnect
|
||||
if(error) { // we encounter an error, but this is expected. should be a stall.
|
||||
console.log('Unprotect memory command ran successfully. Unplug flight controller. Connect again in DFU mode and try flashing again.');
|
||||
GUI.log(chrome.i18n.getMessage('stm32UnprotectSuccessful'));
|
||||
GUI.log(localization.getMessage('stm32UnprotectSuccessful'));
|
||||
|
||||
let messageUnprotectUnplug = chrome.i18n.getMessage('stm32UnprotectUnplug');
|
||||
let messageUnprotectUnplug = localization.getMessage('stm32UnprotectUnplug');
|
||||
GUI.log(messageUnprotectUnplug);
|
||||
|
||||
TABS.firmware_flasher.flashingMessage(messageUnprotectUnplug, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.ACTION)
|
||||
|
@ -665,8 +665,8 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
} else { // unprotecting the flight controller did not work. It did not reboot.
|
||||
console.log('Failed to execute unprotect memory command');
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('stm32UnprotectFailed'));
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32UnprotectFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
GUI.log(localization.getMessage('stm32UnprotectFailed'));
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32UnprotectFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
console.log(data);
|
||||
self.cleanup();
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
}, incr);
|
||||
} else {
|
||||
console.log('Failed to initiate unprotect memory command');
|
||||
let messageUnprotectInitFailed = chrome.i18n.getMessage('stm32UnprotectInitFailed');
|
||||
let messageUnprotectInitFailed = localization.getMessage('stm32UnprotectInitFailed');
|
||||
GUI.log(messageUnprotectInitFailed);
|
||||
TABS.firmware_flasher.flashingMessage(messageUnprotectInitFailed, TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
self.cleanup();
|
||||
|
@ -695,7 +695,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
if (data[4] == self.state.dfuUPLOAD_IDLE && ob_data.length == self.chipInfo.option_bytes.total_size) {
|
||||
console.log('Option bytes read successfully');
|
||||
console.log('Chip does not appear read protected');
|
||||
GUI.log(chrome.i18n.getMessage('stm32NotReadProtected'));
|
||||
GUI.log(localization.getMessage('stm32NotReadProtected'));
|
||||
// it is pretty safe to continue to erase flash
|
||||
self.clearStatus(function() {
|
||||
self.upload_procedure(2);
|
||||
|
@ -744,14 +744,14 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
// if address load fails with this specific error though, it is very likely bc of read protection
|
||||
if(loadAddressResponse[4] == self.state.dfuERROR && loadAddressResponse[0] == self.status.errVENDOR) {
|
||||
// read protected
|
||||
GUI.log(chrome.i18n.getMessage('stm32AddressLoadFailed'));
|
||||
GUI.log(localization.getMessage('stm32AddressLoadFailed'));
|
||||
self.clearStatus(unprotect);
|
||||
return;
|
||||
} else if(loadAddressResponse[4] == self.state.dfuDNLOAD_IDLE) {
|
||||
console.log('Address load for option bytes sector succeeded.');
|
||||
self.clearStatus(tryReadOB);
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('stm32AddressLoadUnknown'));
|
||||
GUI.log(localization.getMessage('stm32AddressLoadUnknown'));
|
||||
self.cleanup();
|
||||
}
|
||||
};
|
||||
|
@ -793,13 +793,13 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
|
||||
if (erase_pages.length === 0) {
|
||||
console.log('Aborting, No flash pages to erase');
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32InvalidHex'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32InvalidHex'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
self.cleanup();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32Erase'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32Erase'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
console.log('Executing local chip erase', erase_pages);
|
||||
|
||||
var page = 0;
|
||||
|
@ -811,7 +811,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
|
||||
if(page == erase_pages.length) {
|
||||
console.log("Erase: complete");
|
||||
GUI.log(chrome.i18n.getMessage('dfu_erased_kilobytes', (total_erased / 1024).toString()));
|
||||
GUI.log(localization.getMessage('dfu_erased_kilobytes', (total_erased / 1024).toString()));
|
||||
self.upload_procedure(4);
|
||||
} else {
|
||||
erase_page();
|
||||
|
@ -881,7 +881,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
// upload
|
||||
// we dont need to clear the state as we are already using DFU_DNLOAD
|
||||
console.log('Writing data ...');
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32Flashing'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32Flashing'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
|
||||
var blocks = self.hex.data.length - 1;
|
||||
var flashing_block = 0;
|
||||
|
@ -953,7 +953,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
case 5:
|
||||
// verify
|
||||
console.log('Verifying data ...');
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32Verifying'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32Verifying'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.NEUTRAL);
|
||||
|
||||
var blocks = self.hex.data.length - 1;
|
||||
var reading_block = 0;
|
||||
|
@ -1021,14 +1021,14 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
|||
if (verify) {
|
||||
console.log('Programming: SUCCESSFUL');
|
||||
// update progress bar
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32ProgrammingSuccessful'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.VALID);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32ProgrammingSuccessful'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.VALID);
|
||||
|
||||
// proceed to next step
|
||||
self.leave();
|
||||
} else {
|
||||
console.log('Programming: FAILED');
|
||||
// update progress bar
|
||||
TABS.firmware_flasher.flashingMessage(chrome.i18n.getMessage('stm32ProgrammingFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
TABS.firmware_flasher.flashingMessage(localization.getMessage('stm32ProgrammingFailed'), TABS.firmware_flasher.FLASH_MESSAGE_TYPES.INVALID);
|
||||
|
||||
// disconnect
|
||||
self.cleanup();
|
||||
|
|
|
@ -65,7 +65,7 @@ $(document).ready(function () {
|
|||
helper.timeout.add('waiting_for_bootup', function waiting_for_bootup() {
|
||||
MSP.send_message(MSPCodes.MSPV2_INAV_STATUS, false, false, function () {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
GUI.log(localization.getMessage('deviceReady'));
|
||||
//noinspection JSValidateTypes
|
||||
TABS.configuration.initialize(false, $('#content').scrollTop());
|
||||
});
|
||||
|
@ -117,12 +117,11 @@ $(document).ready(function () {
|
|||
GUI.updateManualPortVisibility();
|
||||
|
||||
$portOverride.change(function () {
|
||||
chrome.storage.local.set({'portOverride': $portOverride.val()});
|
||||
store.set('portOverride', $portOverride.val());
|
||||
});
|
||||
|
||||
chrome.storage.local.get('portOverride', function (data) {
|
||||
$portOverride.val(data.portOverride);
|
||||
});
|
||||
$portOverride.val(store.get('portOverride', ''));
|
||||
|
||||
|
||||
$port.change(function (target) {
|
||||
GUI.updateManualPortVisibility();
|
||||
|
@ -138,7 +137,7 @@ $(document).ready(function () {
|
|||
String($port.val());
|
||||
|
||||
if (selected_port === 'DFU') {
|
||||
GUI.log(chrome.i18n.getMessage('dfu_connect_message'));
|
||||
GUI.log(localization.getMessage('dfu_connect_message'));
|
||||
}
|
||||
else if (selected_port != '0') {
|
||||
if (!clicks) {
|
||||
|
@ -147,7 +146,7 @@ $(document).ready(function () {
|
|||
|
||||
// lock port select & baud while we are connecting / connected
|
||||
$('#port, #baud, #delay').prop('disabled', true);
|
||||
$('div.connect_controls a.connect_state').text(chrome.i18n.getMessage('connecting'));
|
||||
$('div.connect_controls a.connect_state').text(localization.getMessage('connecting'));
|
||||
|
||||
if (selected_port == 'tcp' || selected_port == 'udp') {
|
||||
CONFIGURATOR.connection.connect($portOverride.val(), {}, onOpen);
|
||||
|
@ -210,7 +209,7 @@ $(document).ready(function () {
|
|||
|
||||
// reset connect / disconnect button
|
||||
$('div.connect_controls a.connect').removeClass('active');
|
||||
$('div.connect_controls a.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
$('div.connect_controls a.connect_state').text(localization.getMessage('connect'));
|
||||
|
||||
// reset active sensor indicators
|
||||
sensor_status(0);
|
||||
|
@ -236,17 +235,15 @@ function onValidFirmware()
|
|||
{
|
||||
MSP.send_message(MSPCodes.MSP_BUILD_INFO, false, false, function () {
|
||||
|
||||
googleAnalytics.sendEvent('Firmware', 'Using', CONFIG.buildInfo);
|
||||
GUI.log(chrome.i18n.getMessage('buildInfoReceived', [CONFIG.buildInfo]));
|
||||
GUI.log(localization.getMessage('buildInfoReceived', [CONFIG.buildInfo]));
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, function () {
|
||||
|
||||
googleAnalytics.sendEvent('Board', 'Using', CONFIG.boardIdentifier + ',' + CONFIG.boardVersion);
|
||||
GUI.log(chrome.i18n.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
|
||||
GUI.log(localization.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_UID, false, false, function () {
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
|
||||
GUI.log(localization.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
|
||||
|
||||
// continue as usually
|
||||
CONFIGURATOR.connectionValid = true;
|
||||
|
@ -266,7 +263,7 @@ function onValidFirmware()
|
|||
|
||||
function onInvalidFirmwareVariant()
|
||||
{
|
||||
GUI.log(chrome.i18n.getMessage('firmwareVariantNotSupported'));
|
||||
GUI.log(localization.getMessage('firmwareVariantNotSupported'));
|
||||
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
|
||||
GUI.allowedTabs = ['cli'];
|
||||
onConnect();
|
||||
|
@ -275,7 +272,7 @@ function onInvalidFirmwareVariant()
|
|||
|
||||
function onInvalidFirmwareVersion()
|
||||
{
|
||||
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.minfirmwareVersionAccepted, CONFIGURATOR.maxFirmwareVersionAccepted]));
|
||||
GUI.log(localization.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.minfirmwareVersionAccepted, CONFIGURATOR.maxFirmwareVersionAccepted]));
|
||||
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
|
||||
GUI.allowedTabs = ['cli'];
|
||||
onConnect();
|
||||
|
@ -283,7 +280,7 @@ function onInvalidFirmwareVersion()
|
|||
}
|
||||
|
||||
function onBleNotSupported() {
|
||||
GUI.log(chrome.i18n.getMessage('connectionBleNotSupported'));
|
||||
GUI.log(localization.getMessage('connectionBleNotSupported'));
|
||||
CONFIGURATOR.connection.abort();
|
||||
}
|
||||
|
||||
|
@ -291,7 +288,7 @@ function onBleNotSupported() {
|
|||
function onOpen(openInfo) {
|
||||
|
||||
if (FC.restartRequired) {
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
$('div.connect_controls a').click(); // disconnect
|
||||
return;
|
||||
}
|
||||
|
@ -303,30 +300,31 @@ function onOpen(openInfo) {
|
|||
// reset connecting_to
|
||||
GUI.connecting_to = false;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('serialPortOpened', [openInfo.connectionId]));
|
||||
GUI.log(localization.getMessage('serialPortOpened', [openInfo.connectionId]));
|
||||
|
||||
// save selected port with chrome.storage if the port differs
|
||||
chrome.storage.local.get('last_used_port', function (result) {
|
||||
if (result.last_used_port) {
|
||||
if (result.last_used_port != GUI.connected_to) {
|
||||
var last_used_port = store.get('last_used_port', false);
|
||||
if (last_used_port) {
|
||||
if (last_used_port != GUI.connected_to) {
|
||||
// last used port doesn't match the one found in local db, we will store the new one
|
||||
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||
store.set('last_used_port', GUI.connected_to);
|
||||
}
|
||||
} else {
|
||||
// variable isn't stored yet, saving
|
||||
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||
store.set('last_used_port', GUI.connected_to);
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.set({last_used_bps: CONFIGURATOR.connection.bitrate});
|
||||
chrome.storage.local.set({wireless_mode_enabled: $('#wireless-mode').is(":checked")});
|
||||
|
||||
store.set('last_used_bps', CONFIGURATOR.connection.bitrate);
|
||||
store.set('wireless_mode_enabled', $('#wireless-mode').is(":checked"));
|
||||
|
||||
CONFIGURATOR.connection.addOnReceiveListener(read_serial);
|
||||
|
||||
/*
|
||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||
helper.timeout.add('connecting', function () {
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
|
||||
GUI.log(localization.getMessage('noConfigurationReceived'));
|
||||
|
||||
helper.mspQueue.flush();
|
||||
helper.mspQueue.freeHardLock();
|
||||
|
@ -336,6 +334,7 @@ function onOpen(openInfo) {
|
|||
$('div.connect_controls a').click(); // disconnect
|
||||
}
|
||||
}, 10000);
|
||||
*/
|
||||
|
||||
FC.resetState();
|
||||
|
||||
|
@ -345,18 +344,18 @@ function onOpen(openInfo) {
|
|||
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
|
||||
|
||||
if (CONFIG.apiVersion === "0.0.0") {
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
FC.restartRequired = true;
|
||||
return;
|
||||
}
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
|
||||
GUI.log(localization.getMessage('apiVersionReceived', [CONFIG.apiVersion]));
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_FC_VARIANT, false, false, function () {
|
||||
if (CONFIG.flightControllerIdentifier == 'INAV') {
|
||||
MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function () {
|
||||
googleAnalytics.sendEvent('Firmware', 'Variant', CONFIG.flightControllerIdentifier + ',' + CONFIG.flightControllerVersion);
|
||||
GUI.log(chrome.i18n.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
|
||||
|
||||
GUI.log(localization.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
|
||||
if (semver.gte(CONFIG.flightControllerVersion, CONFIGURATOR.minfirmwareVersionAccepted) && semver.lt(CONFIG.flightControllerVersion, CONFIGURATOR.maxFirmwareVersionAccepted)) {
|
||||
if (CONFIGURATOR.connection.type == ConnectionType.BLE && semver.lt(CONFIG.flightControllerVersion, "5.0.0")) {
|
||||
onBleNotSupported();
|
||||
|
@ -379,11 +378,11 @@ function onOpen(openInfo) {
|
|||
});
|
||||
} else {
|
||||
console.log('Failed to open serial port');
|
||||
GUI.log(chrome.i18n.getMessage('serialPortOpenFail'));
|
||||
GUI.log(localization.getMessage('serialPortOpenFail'));
|
||||
|
||||
var $connectButton = $('#connectbutton');
|
||||
|
||||
$connectButton.find('.connect_state').text(chrome.i18n.getMessage('connect'));
|
||||
$connectButton.find('.connect_state').text(localization.getMessage('connect'));
|
||||
$connectButton.find('.connect').removeClass('active');
|
||||
|
||||
// unlock port select & baud
|
||||
|
@ -396,7 +395,7 @@ function onOpen(openInfo) {
|
|||
|
||||
function onConnect() {
|
||||
helper.timeout.remove('connecting'); // kill connecting timer
|
||||
$('#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
||||
$('#connectbutton a.connect_state').text(localization.getMessage('disconnect')).addClass('active');
|
||||
$('#connectbutton a.connect').addClass('active');
|
||||
$('.mode-disconnected').hide();
|
||||
$('.mode-connected').show();
|
||||
|
@ -434,9 +433,9 @@ function onConnect() {
|
|||
|
||||
function onClosed(result) {
|
||||
if (result) { // All went as expected
|
||||
GUI.log(chrome.i18n.getMessage('serialPortClosedOk'));
|
||||
GUI.log(localization.getMessage('serialPortClosedOk'));
|
||||
} else { // Something went wrong
|
||||
GUI.log(chrome.i18n.getMessage('serialPortClosedFail'));
|
||||
GUI.log(localization.getMessage('serialPortClosedFail'));
|
||||
}
|
||||
|
||||
$('.mode-connected').hide();
|
||||
|
|
|
@ -6,7 +6,7 @@ var Settings = (function () {
|
|||
self.fillSelectOption = function(s, ii) {
|
||||
var name = (s.setting.table ? s.setting.table.values[ii] : null);
|
||||
if (name) {
|
||||
var localizedName = chrome.i18n.getMessage(name);
|
||||
var localizedName = localization.getMessage(name);
|
||||
if (localizedName) {
|
||||
name = localizedName;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ var Settings = (function () {
|
|||
$('[data-setting!=""][data-setting]').each(function() {
|
||||
inputs.push($(this));
|
||||
});
|
||||
return Promise.mapSeries(inputs, function (input, ii) {
|
||||
return mapSeries(inputs, function (input, ii) {
|
||||
var settingName = input.data('setting');
|
||||
var inputUnit = input.data('unit');
|
||||
|
||||
|
@ -580,7 +580,7 @@ var Settings = (function () {
|
|||
$('[data-setting!=""][data-setting]').each(function() {
|
||||
inputs.push($(this));
|
||||
});
|
||||
return Promise.mapSeries(inputs, function (input, ii) {
|
||||
return mapSeries(inputs, function (input, ii) {
|
||||
return self.saveInput(input);
|
||||
});
|
||||
};
|
||||
|
@ -602,7 +602,7 @@ var Settings = (function () {
|
|||
helpIcons.push($(this));
|
||||
});
|
||||
|
||||
return Promise.mapSeries(helpIcons, function(helpIcon, ii) {
|
||||
return mapSeries(helpIcons, function(helpIcon, ii) {
|
||||
let forAtt = helpIcon.attr('for');
|
||||
|
||||
if (typeof forAtt !== "undefined" && forAtt !== "") {
|
||||
|
|
|
@ -124,10 +124,12 @@ var Ser2TCP = {
|
|||
},
|
||||
|
||||
getDevices: function(callback) {
|
||||
chrome.serial.getDevices((devices_array) => {
|
||||
SerialPort.list().then((ports, error) => {
|
||||
var devices = [];
|
||||
devices_array.forEach((device) => {
|
||||
|
||||
if (error) {
|
||||
GUI.log("Unable to list serial ports.");
|
||||
} else {
|
||||
ports.forEach((device) => {
|
||||
if (GUI.operating_system == 'Windows') {
|
||||
var m = device.path.match(/COM\d?\d/g)
|
||||
if (m)
|
||||
|
@ -140,6 +142,7 @@ var Ser2TCP = {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
callback(devices);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -139,7 +139,7 @@ let Waypoint = function (number, action, lat, lon, alt=0, p1=0, p2=0, p3=0, endM
|
|||
self.getElevation = async function (globalSettings) {
|
||||
let elevation = "N/A";
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "ellipsoid" : "sealevel";
|
||||
let elevationEarthModel = $('#elevationEarthModel').prop("checked") ? "sealevel" : "ellipsoid";
|
||||
|
||||
const response = await fetch('http://dev.virtualearth.net/REST/v1/Elevation/List?points='+self.getLatMap()+','+self.getLonMap()+'&heights='+elevationEarthModel+'&key='+globalSettings.mapApiKey);
|
||||
const myJson = await response.json();
|
||||
|
|
90
_locales/en/messages.json → locale/en/messages.json
Executable file → Normal file
90
_locales/en/messages.json → locale/en/messages.json
Executable file → Normal file
|
@ -63,13 +63,13 @@
|
|||
},
|
||||
|
||||
"configMigrationFrom": {
|
||||
"message": "Migrating configuration file generated by configurator: $1"
|
||||
"message": "Migrating configuration file generated by configurator: {0}"
|
||||
},
|
||||
"configMigratedTo": {
|
||||
"message": "Migrated configuration to configurator: $1"
|
||||
"message": "Migrated configuration to configurator: {0}"
|
||||
},
|
||||
"configMigrationSuccessful": {
|
||||
"message": "Configuration migration complete, migrations applied: $1"
|
||||
"message": "Configuration migration complete, migrations applied: {0}"
|
||||
},
|
||||
"documentation": {
|
||||
"message": "Documentation"
|
||||
|
@ -267,7 +267,7 @@
|
|||
"message": "ACRO"
|
||||
},
|
||||
"serialPortOpened": {
|
||||
"message": "MSP connection <span style=\"color: #37a8db\">successfully</span> opened with ID: $1"
|
||||
"message": "MSP connection <span style=\"color: #37a8db\">successfully</span> opened with ID: {0}"
|
||||
},
|
||||
"serialPortOpenFail": {
|
||||
"message": "<span style=\"color: red\">Failed</span> to open MSP connection"
|
||||
|
@ -282,10 +282,10 @@
|
|||
"message": "Unrecoverable <span style=\"color: red\">failure</span> of serial connection, disconnecting...'"
|
||||
},
|
||||
"connectionConnected": {
|
||||
"message": "Connected to: $1"
|
||||
"message": "Connected to: {0}"
|
||||
},
|
||||
"connectionBleType": {
|
||||
"message": "BLE device type: $1"
|
||||
"message": "BLE device type: {0}"
|
||||
},
|
||||
"connectionBleNotSupported": {
|
||||
"message": "<span style=\"color: red\">Connection error:</span> Firmware doesn't support BLE connections. Abort."
|
||||
|
@ -294,7 +294,7 @@
|
|||
"message": "The connection was unexpectedly interrupted."
|
||||
},
|
||||
"connectionBleError": {
|
||||
"message": "Error while opening BLE device: $1"
|
||||
"message": "Error while opening BLE device: {0}"
|
||||
},
|
||||
"connectionBleCliEnter": {
|
||||
"message": "Connection over BLE active, output might be slower than usual."
|
||||
|
@ -303,7 +303,7 @@
|
|||
"message": "UDP connection timed out."
|
||||
},
|
||||
"usbDeviceOpened": {
|
||||
"message": "USB device <span style=\"color: #37a8db\">successfully</span> opened with ID: $1"
|
||||
"message": "USB device <span style=\"color: #37a8db\">successfully</span> opened with ID: {0}"
|
||||
},
|
||||
"usbDeviceOpenFail": {
|
||||
"message": "<span style=\"color: red\">Failed</span> to open USB device!"
|
||||
|
@ -330,7 +330,7 @@
|
|||
"message": "STM32 - timed out, programming: FAILED"
|
||||
},
|
||||
"stm32WrongResponse": {
|
||||
"message": "STM32 Communication failed, wrong response, expected: $1 (0x$2) received: $3 (0x$4)"
|
||||
"message": "STM32 Communication failed, wrong response, expected: {0} (0x{1}) received: {2} (0x{3})"
|
||||
},
|
||||
"stm32ContactingBootloader": {
|
||||
"message": "Contacting bootloader ..."
|
||||
|
@ -403,7 +403,7 @@
|
|||
"message": "No configuration received within <span style=\"color: red\">10 seconds</span>, communication <span style=\"color: red\">failed</span>"
|
||||
},
|
||||
"firmwareVersionNotSupported": {
|
||||
"message": "This firmware version is <span style=\"color: red\">not supported</span>. This version of Configurator supports firmware from $1 to $2 (excluded)"
|
||||
"message": "This firmware version is <span style=\"color: red\">not supported</span>. This version of Configurator supports firmware from {0} to {1} (excluded)"
|
||||
},
|
||||
"firmwareVariantNotSupported": {
|
||||
"message": "This firmware variant is <span style=\"color: red\">not supported</span>. Please upgrade to INAV firmware. Use CLI for backup before flashing. CLI backup/restore procedure is in the documention."
|
||||
|
@ -417,29 +417,29 @@
|
|||
},
|
||||
|
||||
"tabSwitchUpgradeRequired": {
|
||||
"message": "You need to <strong>upgrade</strong> your firmware before you can use the $1 tab."
|
||||
"message": "You need to <strong>upgrade</strong> your firmware before you can use the {0} tab."
|
||||
},
|
||||
"firmwareVersion": {
|
||||
"message": "Firmware Version: <strong>$1</strong>"
|
||||
"message": "Firmware Version: <strong>{0}</strong>"
|
||||
},
|
||||
"apiVersionReceived": {
|
||||
"message": "MultiWii API version <span style=\"color: #37a8db\">received</span> - <strong>$1</strong>"
|
||||
"message": "MultiWii API version <span style=\"color: #37a8db\">received</span> - <strong>{0}</strong>"
|
||||
},
|
||||
"uniqueDeviceIdReceived": {
|
||||
"message": "Unique device ID <span style=\"color: #37a8db\">received</span> - <strong>0x$1</strong>"
|
||||
"message": "Unique device ID <span style=\"color: #37a8db\">received</span> - <strong>0x{0}</strong>"
|
||||
},
|
||||
"boardInfoReceived": {
|
||||
"message": "Board: <strong>$1</strong>, version: <strong>$2</strong>"
|
||||
"message": "Board: <strong>{0}</strong>, version: <strong>{1}</strong>"
|
||||
},
|
||||
"buildInfoReceived": {
|
||||
"message": "Running firmware released on: <strong>$1</strong>"
|
||||
"message": "Running firmware released on: <strong>{0}</strong>"
|
||||
},
|
||||
"fcInfoReceived": {
|
||||
"message": "Flight controller info, identifier: <strong>$1</strong>, version: <strong>$2</strong>"
|
||||
"message": "Flight controller info, identifier: <strong>{0}</strong>, version: <strong>{1}</strong>"
|
||||
},
|
||||
|
||||
"notifications_app_just_updated_to_version": {
|
||||
"message": "Application just updated to version: $1"
|
||||
"message": "Application just updated to version: {0}"
|
||||
},
|
||||
"notifications_click_here_to_start_app": {
|
||||
"message": "Click here to start the application"
|
||||
|
@ -449,10 +449,10 @@
|
|||
"message": "Port utilization:"
|
||||
},
|
||||
"statusbar_usage_download": {
|
||||
"message": "D: $1%"
|
||||
"message": "D: {0}%"
|
||||
},
|
||||
"statusbar_usage_upload": {
|
||||
"message": "U: $1%"
|
||||
"message": "U: {0}%"
|
||||
},
|
||||
"statusbar_packet_error": {
|
||||
"message": "Packet error:"
|
||||
|
@ -464,7 +464,7 @@
|
|||
"message": "Cycle Time:"
|
||||
},
|
||||
"statusbar_cpu_load": {
|
||||
"message": "CPU Load: $1%"
|
||||
"message": "CPU Load: {0}%"
|
||||
},
|
||||
"statusbar_arming_flags": {
|
||||
"message": "Arming Flags:"
|
||||
|
@ -474,13 +474,13 @@
|
|||
"message": "Please use the Firmware Flasher to access DFU devices"
|
||||
},
|
||||
"dfu_erased_kilobytes": {
|
||||
"message": "Erased $1 kB of flash <span style=\"color: #37a8db\">successfully</span>"
|
||||
"message": "Erased {0} kB of flash <span style=\"color: #37a8db\">successfully</span>"
|
||||
},
|
||||
"dfu_device_flash_info": {
|
||||
"message": "Detected device with total flash size $1 kiB"
|
||||
"message": "Detected device with total flash size {0} kiB"
|
||||
},
|
||||
"dfu_error_image_size": {
|
||||
"message": "<span style=\"color: red; font-weight: bold\">Error</span>: Supplied image is larger then flash available on the chip! Image: $1 kiB, limit = $2 kiB"
|
||||
"message": "<span style=\"color: red; font-weight: bold\">Error</span>: Supplied image is larger then flash available on the chip! Image: {0} kiB, limit = {1} kiB"
|
||||
},
|
||||
|
||||
"eeprom_saved_ok": {
|
||||
|
@ -539,7 +539,7 @@
|
|||
"message": "Facebook Group"
|
||||
},
|
||||
"initialSetupBackupAndRestoreApiVersion": {
|
||||
"message": "<span style=\"color: red\">Backup and restore functionality disabled.</span> You have firmware with API version <span style=\"color: red\">$1</span>, backup and restore requires <span style=\"color: #37a8db\">$2</span>. Please backup your settings via the CLI, see INAV documentation for procedure."
|
||||
"message": "<span style=\"color: red\">Backup and restore functionality disabled.</span> You have firmware with API version <span style=\"color: red\">{0}</span>, backup and restore requires <span style=\"color: #37a8db\">{1}</span>. Please backup your settings via the CLI, see INAV documentation for procedure."
|
||||
},
|
||||
"initialSetupButtonCalibrateAccel": {
|
||||
"message": "Calibrate Accelerometer"
|
||||
|
@ -578,7 +578,7 @@
|
|||
"message": "Reset Z axis, offset: 0 deg"
|
||||
},
|
||||
"initialSetupButtonResetZaxisValue": {
|
||||
"message": "Reset Z axis, offset: $1 deg"
|
||||
"message": "Reset Z axis, offset: {0} deg"
|
||||
},
|
||||
"initialSetupMixerHead": {
|
||||
"message": "Mixer Type"
|
||||
|
@ -635,40 +635,40 @@
|
|||
"message": "Battery detected cell count:"
|
||||
},
|
||||
"initialSetupBatteryDetectedCellsValue": {
|
||||
"message": "$1"
|
||||
"message": "{0}"
|
||||
},
|
||||
"initialSetupBatteryPercentage": {
|
||||
"message": "Battery left:"
|
||||
},
|
||||
"initialSetupBatteryPercentageValue": {
|
||||
"message": "$1 %"
|
||||
"message": "{0} %"
|
||||
},
|
||||
"initialSetupBatteryRemainingCapacity": {
|
||||
"message": "Battery remaining capacity"
|
||||
},
|
||||
"initialSetupBatteryRemainingCapacityValue": {
|
||||
"message": "$1 $2"
|
||||
"message": "{0} {1}"
|
||||
},
|
||||
"initialSetupBatteryFull": {
|
||||
"message": "Battery full when plugged in"
|
||||
},
|
||||
"initialSetupBatteryFullValue": {
|
||||
"message": "$1"
|
||||
"message": "{0}"
|
||||
},
|
||||
"initialSetupBatteryThresholds": {
|
||||
"message": "Battery use cap thresholds"
|
||||
},
|
||||
"initialSetupBatteryThresholdsValue": {
|
||||
"message": "$1"
|
||||
"message": "{0}"
|
||||
},
|
||||
"initialSetup_Wh_drawn": {
|
||||
"message": "Capacity drawn:"
|
||||
},
|
||||
"initialSetup_Wh_drawnValue": {
|
||||
"message": "$1 Wh"
|
||||
"message": "{0} Wh"
|
||||
},
|
||||
"initialSetupBatteryVoltageValue": {
|
||||
"message": "$1 V"
|
||||
"message": "{0} V"
|
||||
},
|
||||
"initialSetupDrawn": {
|
||||
"message": "Capacity drawn:"
|
||||
|
@ -680,19 +680,19 @@
|
|||
"message": "Power draw:"
|
||||
},
|
||||
"initialSetupPowerDrawValue": {
|
||||
"message": "$1 W"
|
||||
"message": "{0} W"
|
||||
},
|
||||
"initialSetupBatteryMahValue": {
|
||||
"message": "$1 mAh"
|
||||
"message": "{0} mAh"
|
||||
},
|
||||
"initialSetupCurrentDrawValue": {
|
||||
"message": "$1 A"
|
||||
"message": "{0} A"
|
||||
},
|
||||
"initialSetupRSSI": {
|
||||
"message": "RSSI:"
|
||||
},
|
||||
"initialSetupRSSIValue": {
|
||||
"message": "$1 %"
|
||||
"message": "{0} %"
|
||||
},
|
||||
"initialSetupGPSHead": {
|
||||
"message": "GPS"
|
||||
|
@ -704,10 +704,10 @@
|
|||
"message": "Save"
|
||||
},
|
||||
"initialSetupModel": {
|
||||
"message": "Model: $1"
|
||||
"message": "Model: {0}"
|
||||
},
|
||||
"initialSetupAttitude": {
|
||||
"message": "$1 deg"
|
||||
"message": "{0} deg"
|
||||
},
|
||||
"initialSetupAccelCalibStarted": {
|
||||
"message": "Accelerometer calibration started"
|
||||
|
@ -1567,7 +1567,7 @@
|
|||
"message": "Profile"
|
||||
},
|
||||
"pidTuning_LoadedProfile": {
|
||||
"message": "Loaded Profile: <strong style=\"color: #37a8db\">$1</strong>"
|
||||
"message": "Loaded Profile: <strong style=\"color: #37a8db\">{0}</strong>"
|
||||
},
|
||||
"pidTuning_gyro_use_dyn_lpf": {
|
||||
"message": "Dynamic gyro LPF"
|
||||
|
@ -1591,10 +1591,10 @@
|
|||
"message": "Defines the gyro LPF cutoff frequency at maximum throttle. When throttle is decreased, LPF cutoff frequency is decreased as well, down to the minimum cutoff frequency."
|
||||
},
|
||||
"loadedMixerProfile": {
|
||||
"message": "Loaded Mixer Profile: <strong style=\"color: #37a8db\">$1</strong>, Check modes tab: MIXER PROFILE 2 if you don't see the changes"
|
||||
"message": "Loaded Mixer Profile: <strong style=\"color: #37a8db\">{0}</strong>, Check modes tab: MIXER PROFILE 2 if you don't see the changes"
|
||||
},
|
||||
"loadedBatteryProfile": {
|
||||
"message": "Loaded Battery Profile: <strong style=\"color: #37a8db\">$1</strong>"
|
||||
"message": "Loaded Battery Profile: <strong style=\"color: #37a8db\">{0}</strong>"
|
||||
},
|
||||
"pidTuningDataRefreshed": {
|
||||
"message": "PID data <strong>refreshed</strong>"
|
||||
|
@ -2217,7 +2217,7 @@
|
|||
"message": "Please select at least one property to log"
|
||||
},
|
||||
"loggingAutomaticallyRetained": {
|
||||
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
||||
"message": "Automatically loaded previous log file: <strong>{0}</strong>"
|
||||
},
|
||||
"blackboxNotSupported": {
|
||||
"message": "Your flight controller's firmware does not support Blackbox logging or Blackbox feature is not enabled"
|
||||
|
@ -3513,7 +3513,7 @@
|
|||
"message": "Default Layout"
|
||||
},
|
||||
"osdLayoutAlternative": {
|
||||
"message": "Alternative Layout #$1"
|
||||
"message": "Alternative Layout #{0}"
|
||||
},
|
||||
"osdUnitImperial": {
|
||||
"message": "Imperial"
|
||||
|
@ -4203,7 +4203,7 @@
|
|||
"message": "Uploading..."
|
||||
},
|
||||
"uploadedCharacters": {
|
||||
"message": "Uploaded $1 characters"
|
||||
"message": "Uploaded {0} characters"
|
||||
},
|
||||
"portsIdentifier": {
|
||||
"message": "Identifier"
|
794
main.js
794
main.js
|
@ -1,764 +1,64 @@
|
|||
/*global $, chrome, analytics*/
|
||||
'use strict';
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const windowStateKeeper = require('electron-window-state');
|
||||
const Store = require('electron-store');
|
||||
Store.initRenderer();
|
||||
|
||||
// Google Analytics
|
||||
var googleAnalyticsService = analytics.getService('ice_cream_app');
|
||||
var googleAnalytics = googleAnalyticsService.getTracker("UA-75834706-2");
|
||||
var googleAnalyticsConfig = false;
|
||||
googleAnalyticsService.getConfig().addCallback(function (config) {
|
||||
googleAnalyticsConfig = config;
|
||||
require('@electron/remote/main').initialize();
|
||||
|
||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
let mainWindow = null;
|
||||
|
||||
app.on('ready', () => {
|
||||
|
||||
let mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 800,
|
||||
defaultHeight: 600
|
||||
});
|
||||
|
||||
chrome.storage = chrome.storage || {};
|
||||
|
||||
// Set how the units render on the configurator only
|
||||
const UnitType = {
|
||||
none: "none",
|
||||
OSD: "OSD",
|
||||
imperial: "imperial",
|
||||
metric: "metric",
|
||||
}
|
||||
|
||||
let globalSettings = {
|
||||
// Configurator rendering options
|
||||
// Used to depict how the units are displayed within the UI
|
||||
unitType: null,
|
||||
// Used to convert units within the UI
|
||||
osdUnits: null,
|
||||
// Map
|
||||
mapProviderType: null,
|
||||
mapApiKey: null,
|
||||
proxyURL: null,
|
||||
proxyLayer: null,
|
||||
// Show colours for profiles
|
||||
showProfileParameters: null,
|
||||
// tree target for documents
|
||||
docsTreeLocation: 'master',
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
chrome.storage.local.get('unit_type', function (result) {
|
||||
if (!result.unit_type) {
|
||||
result.unit_type = UnitType.none;
|
||||
}
|
||||
globalSettings.unitType = result.unit_type;
|
||||
});
|
||||
chrome.storage.local.get('map_provider_type', function (result) {
|
||||
if (typeof result.map_provider_type === 'undefined') {
|
||||
result.map_provider_type = 'osm';
|
||||
}
|
||||
globalSettings.mapProviderType = result.map_provider_type;
|
||||
});
|
||||
chrome.storage.local.get('map_api_key', function (result) {
|
||||
if (typeof result.map_api_key === 'undefined') {
|
||||
result.map_api_key = '';
|
||||
}
|
||||
globalSettings.mapApiKey = result.map_api_key;
|
||||
});
|
||||
chrome.storage.local.get('proxyurl', function (result) {
|
||||
if (typeof result.proxyurl === 'undefined') {
|
||||
result.proxyurl = 'http://192.168.1.222/mapproxy/service?';
|
||||
}
|
||||
globalSettings.proxyURL = result.proxyurl;
|
||||
});
|
||||
chrome.storage.local.get('proxylayer', function (result) {
|
||||
if (typeof result.proxylayer === 'undefined') {
|
||||
result.proxylayer = 'your_proxy_layer_name';
|
||||
}
|
||||
globalSettings.proxyLayer = result.proxylayer;
|
||||
});
|
||||
chrome.storage.local.get('show_profile_parameters', function (result) {
|
||||
if (typeof result.show_profile_parameters === 'undefined') {
|
||||
result.show_profile_parameters = 1;
|
||||
}
|
||||
globalSettings.showProfileParameters = result.show_profile_parameters;
|
||||
// Update CSS on to show highlighing or not
|
||||
updateProfilesHighlightColours();
|
||||
});
|
||||
chrome.storage.local.get('cli_autocomplete', function (result) {
|
||||
if (typeof result.cliAutocomplete === 'undefined') {
|
||||
result.cli_autocomplete = 1;
|
||||
}
|
||||
globalSettings.cliAutocomplete = result.cli_autocomplete;
|
||||
CliAutoComplete.setEnabled(globalSettings.cliAutocomplete);
|
||||
mainWindow = new BrowserWindow({
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
webSecurity: false
|
||||
},
|
||||
});
|
||||
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors')
|
||||
|
||||
require("@electron/remote/main").enable(mainWindow.webContents);
|
||||
mainWindow.removeMenu();
|
||||
mainWindow.setMinimumSize(800, 600);
|
||||
|
||||
// Resets the OSD units used by the unit coversion when the FC is disconnected.
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
globalSettings.osdUnits = null;
|
||||
}
|
||||
mainWindow.loadFile('index.html');
|
||||
|
||||
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
||||
GUI.log(chrome.i18n.getMessage('getRunningOS') + GUI.operating_system + '</strong>, ' +
|
||||
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</strong>, ' +
|
||||
chrome.i18n.getMessage('getConfiguratorVersion') + chrome.runtime.getManifest().version + '</strong>');
|
||||
mainWindowState.manage(mainWindow);
|
||||
|
||||
$('#status-bar .version').text(chrome.runtime.getManifest().version);
|
||||
$('#logo .version').text(chrome.runtime.getManifest().version);
|
||||
updateFirmwareVersion();
|
||||
|
||||
// notification messages for various operating systems
|
||||
switch (GUI.operating_system) {
|
||||
case 'Windows':
|
||||
break;
|
||||
case 'MacOS':
|
||||
// var main_chromium_version = window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/,"$1").split('.')[0];
|
||||
break;
|
||||
case 'ChromeOS':
|
||||
break;
|
||||
case 'Linux':
|
||||
break;
|
||||
case 'UNIX':
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeof require !== "undefined") {
|
||||
// Load native UI library
|
||||
var gui = require('nw.gui');
|
||||
var win = gui.Window.get();
|
||||
|
||||
//Listen to the new window event
|
||||
win.on('new-win-policy', function (frame, url, policy) {
|
||||
gui.Shell.openExternal(url);
|
||||
policy.ignore();
|
||||
});
|
||||
|
||||
//Get saved size and position
|
||||
chrome.storage.local.get('windowSize', function (result) {
|
||||
if (result.windowSize) {
|
||||
if (result.windowSize.height <= window.screen.availHeight)
|
||||
win.height = result.windowSize.height;
|
||||
if (result.windowSize.width <= window.screen.availWidth)
|
||||
win.width = result.windowSize.width;
|
||||
if (result.windowSize.x >= window.screen.availLeft)
|
||||
win.x = result.windowSize.x;
|
||||
if (result.windowSize.y >= window.screen.availTop)
|
||||
win.y = result.windowSize.y;
|
||||
// Open the DevTools.
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
win.setMinimumSize(800, 600);
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
win.on('close', function () {
|
||||
//Save window size and position
|
||||
chrome.storage.local.set({'windowSize': {height: win.height, width: win.width, x: win.x, y: win.y}}, function () {
|
||||
// Notify that we saved.
|
||||
console.log('Settings saved');
|
||||
});
|
||||
this.hide(); // Pretend to be closed already
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
console.log("We're closing...");
|
||||
this.close(true);
|
||||
});
|
||||
} else {
|
||||
console.log('Not load require');
|
||||
}
|
||||
|
||||
chrome.storage.local.get('logopen', function (result) {
|
||||
if (result.logopen) {
|
||||
$("#showlog").trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.get('update_notify', function(result) {
|
||||
if (typeof result.update_notify === 'undefined' || result.update_notify) {
|
||||
appUpdater.checkRelease(chrome.runtime.getManifest().version);
|
||||
app.on('activate', () => {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
// log library versions in console to make version tracking easier
|
||||
console.log('Libraries: jQuery - ' + $.fn.jquery + ', d3 - ' + d3.version + ', three.js - ' + THREE.REVISION);
|
||||
|
||||
// Tabs
|
||||
var ui_tabs = $('#tabs > ul');
|
||||
$('a', ui_tabs).click(function () {
|
||||
|
||||
if ($(this).parent().hasClass("tab_help")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($(this).parent().hasClass('active') == false && !GUI.tab_switch_in_progress) { // only initialize when the tab isn't already active
|
||||
var self = this,
|
||||
tabClass = $(self).parent().prop('class');
|
||||
|
||||
var tabRequiresConnection = $(self).parent().hasClass('mode-connected');
|
||||
|
||||
var tab = tabClass.substring(4);
|
||||
var tabName = $(self).text();
|
||||
|
||||
if (tabRequiresConnection && !CONFIGURATOR.connectionValid) {
|
||||
GUI.log(chrome.i18n.getMessage('tabSwitchConnectionRequired'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI.connect_lock) { // tab switching disabled while operation is in progress
|
||||
GUI.log(chrome.i18n.getMessage('tabSwitchWaitForOperation'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI.allowedTabs.indexOf(tab) < 0) {
|
||||
GUI.log(chrome.i18n.getMessage('tabSwitchUpgradeRequired', [tabName]));
|
||||
return;
|
||||
}
|
||||
|
||||
GUI.tab_switch_in_progress = true;
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
// disable previously active tab highlight
|
||||
$('li', ui_tabs).removeClass('active');
|
||||
|
||||
// Highlight selected tab
|
||||
$(self).parent().addClass('active');
|
||||
|
||||
// detach listeners and remove element data
|
||||
var content = $('#content');
|
||||
content.data('empty', !!content.is(':empty'));
|
||||
content.empty();
|
||||
|
||||
// display loading screen
|
||||
$('#cache .data-loading').clone().appendTo(content);
|
||||
|
||||
function content_ready() {
|
||||
GUI.tab_switch_in_progress = false;
|
||||
|
||||
// Update CSS on to show highlighing or not
|
||||
updateProfilesHighlightColours();
|
||||
}
|
||||
|
||||
switch (tab) {
|
||||
case 'landing':
|
||||
TABS.landing.initialize(content_ready);
|
||||
break;
|
||||
case 'firmware_flasher':
|
||||
TABS.firmware_flasher.initialize(content_ready);
|
||||
break;
|
||||
case 'sitl':
|
||||
TABS.sitl.initialize(content_ready);
|
||||
break;
|
||||
case 'auxiliary':
|
||||
TABS.auxiliary.initialize(content_ready);
|
||||
break;
|
||||
case 'adjustments':
|
||||
TABS.adjustments.initialize(content_ready);
|
||||
break;
|
||||
case 'ports':
|
||||
TABS.ports.initialize(content_ready);
|
||||
break;
|
||||
case 'led_strip':
|
||||
TABS.led_strip.initialize(content_ready);
|
||||
break;
|
||||
case 'failsafe':
|
||||
TABS.failsafe.initialize(content_ready);
|
||||
break;
|
||||
case 'setup':
|
||||
TABS.setup.initialize(content_ready);
|
||||
break;
|
||||
case 'calibration':
|
||||
TABS.calibration.initialize(content_ready);
|
||||
break;
|
||||
case 'configuration':
|
||||
TABS.configuration.initialize(content_ready);
|
||||
break;
|
||||
case 'profiles':
|
||||
TABS.profiles.initialize(content_ready);
|
||||
break;
|
||||
case 'pid_tuning':
|
||||
TABS.pid_tuning.initialize(content_ready);
|
||||
break;
|
||||
case 'receiver':
|
||||
TABS.receiver.initialize(content_ready);
|
||||
break;
|
||||
case 'modes':
|
||||
TABS.modes.initialize(content_ready);
|
||||
break;
|
||||
case 'servos':
|
||||
TABS.servos.initialize(content_ready);
|
||||
break;
|
||||
case 'gps':
|
||||
TABS.gps.initialize(content_ready);
|
||||
break;
|
||||
case 'magnetometer':
|
||||
TABS.magnetometer.initialize(content_ready);
|
||||
break;
|
||||
case 'mission_control':
|
||||
TABS.mission_control.initialize(content_ready);
|
||||
break;
|
||||
case 'mixer':
|
||||
TABS.mixer.initialize(content_ready);
|
||||
break;
|
||||
case 'outputs':
|
||||
TABS.outputs.initialize(content_ready);
|
||||
break;
|
||||
case 'osd':
|
||||
TABS.osd.initialize(content_ready);
|
||||
break;
|
||||
case 'sensors':
|
||||
TABS.sensors.initialize(content_ready);
|
||||
break;
|
||||
case 'logging':
|
||||
TABS.logging.initialize(content_ready);
|
||||
break;
|
||||
case 'onboard_logging':
|
||||
TABS.onboard_logging.initialize(content_ready);
|
||||
break;
|
||||
case 'advanced_tuning':
|
||||
TABS.advanced_tuning.initialize(content_ready);
|
||||
break;
|
||||
case 'programming':
|
||||
TABS.programming.initialize(content_ready);
|
||||
break;
|
||||
case 'cli':
|
||||
TABS.cli.initialize(content_ready);
|
||||
break;
|
||||
case 'ez_tune':
|
||||
TABS.ez_tune.initialize(content_ready);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Tab not found:' + tab);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#tabs ul.mode-disconnected li a:first').click();
|
||||
|
||||
// options
|
||||
$('#options').click(function () {
|
||||
var el = $(this);
|
||||
|
||||
if (!el.hasClass('active')) {
|
||||
el.addClass('active');
|
||||
el.after('<div id="options-window"></div>');
|
||||
|
||||
$('div#options-window').load('./tabs/options.html', function () {
|
||||
googleAnalytics.sendAppView('Options');
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
// if notifications are enabled, or wasn't set, check the notifications checkbox
|
||||
chrome.storage.local.get('update_notify', function (result) {
|
||||
if (typeof result.update_notify === 'undefined' || result.update_notify) {
|
||||
$('div.notifications input').prop('checked', true);
|
||||
}
|
||||
});
|
||||
|
||||
$('div.notifications input').change(function () {
|
||||
var check = $(this).is(':checked');
|
||||
googleAnalytics.sendEvent('Settings', 'Notifications', check);
|
||||
|
||||
chrome.storage.local.set({'update_notify': check});
|
||||
});
|
||||
|
||||
// if tracking is enabled, check the statistics checkbox
|
||||
if (googleAnalyticsConfig.isTrackingPermitted()) {
|
||||
$('div.statistics input').prop('checked', true);
|
||||
}
|
||||
|
||||
$('div.statistics input').change(function () {
|
||||
var check = $(this).is(':checked');
|
||||
googleAnalytics.sendEvent('Settings', 'GoogleAnalytics', check);
|
||||
googleAnalyticsConfig.setTrackingPermitted(check);
|
||||
});
|
||||
|
||||
$('div.show_profile_parameters input').change(function () {
|
||||
globalSettings.showProfileParameters = $(this).is(':checked');
|
||||
chrome.storage.local.set({
|
||||
'show_profile_parameters': globalSettings.showProfileParameters
|
||||
});
|
||||
|
||||
// Update CSS on select boxes
|
||||
updateProfilesHighlightColours();
|
||||
|
||||
// Horrible way to reload the tab
|
||||
const activeTab = $('#tabs li.active');
|
||||
activeTab.removeClass('active');
|
||||
activeTab.find('a').click();
|
||||
});
|
||||
$('div.cli_autocomplete input').change(function () {
|
||||
globalSettings.cliAutocomplete = $(this).is(':checked');
|
||||
chrome.storage.local.set({
|
||||
'cli_autocomplete': globalSettings.cliAutocomplete
|
||||
});
|
||||
|
||||
CliAutoComplete.setEnabled($(this).is(':checked'));
|
||||
});
|
||||
|
||||
|
||||
$('#ui-unit-type').val(globalSettings.unitType);
|
||||
$('#map-provider-type').val(globalSettings.mapProviderType);
|
||||
$('#map-api-key').val(globalSettings.mapApiKey);
|
||||
$('#proxyurl').val(globalSettings.proxyURL);
|
||||
$('#proxylayer').val(globalSettings.proxyLayer);
|
||||
$('#showProfileParameters').prop('checked', globalSettings.showProfileParameters);
|
||||
$('#cliAutocomplete').prop('checked', globalSettings.cliAutocomplete);
|
||||
|
||||
// Set the value of the unit type
|
||||
// none, OSD, imperial, metric
|
||||
$('#ui-unit-type').change(function () {
|
||||
chrome.storage.local.set({
|
||||
'unit_type': $(this).val()
|
||||
});
|
||||
globalSettings.unitType = $(this).val();
|
||||
|
||||
// Update the osd units in global settings
|
||||
// but only if we need it
|
||||
if (globalSettings.unitType === UnitType.OSD) {
|
||||
get_osd_settings();
|
||||
}
|
||||
|
||||
// Horrible way to reload the tab
|
||||
const activeTab = $('#tabs li.active');
|
||||
activeTab.removeClass('active');
|
||||
activeTab.find('a').click();
|
||||
});
|
||||
$('#map-provider-type').change(function () {
|
||||
chrome.storage.local.set({
|
||||
'map_provider_type': $(this).val()
|
||||
});
|
||||
globalSettings.mapProviderType = $(this).val();
|
||||
});
|
||||
$('#map-api-key').change(function () {
|
||||
chrome.storage.local.set({
|
||||
'map_api_key': $(this).val()
|
||||
});
|
||||
globalSettings.mapApiKey = $(this).val();
|
||||
});
|
||||
$('#proxyurl').change(function () {
|
||||
chrome.storage.local.set({
|
||||
'proxyurl': $(this).val()
|
||||
});
|
||||
globalSettings.proxyURL = $(this).val();
|
||||
});
|
||||
$('#proxylayer').change(function () {
|
||||
chrome.storage.local.set({
|
||||
'proxylayer': $(this).val()
|
||||
});
|
||||
globalSettings.proxyLayer = $(this).val();
|
||||
});
|
||||
$('#demoModeReset').on('click', () => {
|
||||
SITLProcess.deleteEepromFile('demo.bin');
|
||||
});
|
||||
function close_and_cleanup(e) {
|
||||
if (e.type == 'click' && !$.contains($('div#options-window')[0], e.target) || e.type == 'keyup' && e.keyCode == 27) {
|
||||
$(document).unbind('click keyup', close_and_cleanup);
|
||||
|
||||
$('div#options-window').slideUp(250, function () {
|
||||
el.removeClass('active');
|
||||
$(this).empty().remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('click keyup', close_and_cleanup);
|
||||
|
||||
$(this).slideDown(250);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var $content = $("#content");
|
||||
|
||||
// listen to all input change events and adjust the value within limits if necessary
|
||||
$content.on('focus', 'input[type="number"]', function () {
|
||||
var element = $(this),
|
||||
val = element.val();
|
||||
|
||||
if (!isNaN(val)) {
|
||||
element.data('previousValue', parseFloat(val));
|
||||
}
|
||||
});
|
||||
|
||||
$content.on('keydown', 'input[type="number"]', function (e) {
|
||||
// whitelist all that we need for numeric control
|
||||
var whitelist = [
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, // numpad and standard number keypad
|
||||
109, 189, // minus on numpad and in standard keyboard
|
||||
8, 46, 9, // backspace, delete, tab
|
||||
190, 110, // decimal point
|
||||
37, 38, 39, 40, 13 // arrows and enter
|
||||
];
|
||||
|
||||
if (whitelist.indexOf(e.keyCode) == -1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$content.on('change', 'input[type="number"]', function () {
|
||||
var element = $(this),
|
||||
min = parseFloat(element.prop('min')),
|
||||
max = parseFloat(element.prop('max')),
|
||||
step = parseFloat(element.prop('step')),
|
||||
val = parseFloat(element.val()),
|
||||
decimal_places;
|
||||
|
||||
// only adjust minimal end if bound is set
|
||||
if (element.prop('min')) {
|
||||
if (val < min) {
|
||||
element.val(min);
|
||||
val = min;
|
||||
}
|
||||
}
|
||||
|
||||
// only adjust maximal end if bound is set
|
||||
if (element.prop('max')) {
|
||||
if (val > max) {
|
||||
element.val(max);
|
||||
val = max;
|
||||
}
|
||||
}
|
||||
|
||||
// if entered value is illegal use previous value instead
|
||||
if (isNaN(val)) {
|
||||
element.val(element.data('previousValue'));
|
||||
val = element.data('previousValue');
|
||||
}
|
||||
|
||||
// if step is not set or step is int and value is float use previous value instead
|
||||
if (isNaN(step) || step % 1 === 0) {
|
||||
if (val % 1 !== 0) {
|
||||
element.val(element.data('previousValue'));
|
||||
val = element.data('previousValue');
|
||||
}
|
||||
}
|
||||
|
||||
// if step is set and is float and value is int, convert to float, keep decimal places in float according to step *experimental*
|
||||
if (!isNaN(step) && step % 1 !== 0) {
|
||||
decimal_places = String(step).split('.')[1].length;
|
||||
|
||||
if (val % 1 === 0) {
|
||||
element.val(val.toFixed(decimal_places));
|
||||
} else if (String(val).split('.')[1].length != decimal_places) {
|
||||
element.val(val.toFixed(decimal_places));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#showlog").on('click', function() {
|
||||
var state = $(this).data('state'),
|
||||
$log = $("#log");
|
||||
|
||||
if (state) {
|
||||
$log.animate({height: 27}, 200, function() {
|
||||
var command_log = $('div#log');
|
||||
//noinspection JSValidateTypes
|
||||
command_log.scrollTop($('div.wrapper', command_log).height());
|
||||
});
|
||||
$log.removeClass('active');
|
||||
$("#content").removeClass('logopen');
|
||||
$(".tab_container").removeClass('logopen');
|
||||
$("#scrollicon").removeClass('active');
|
||||
chrome.storage.local.set({'logopen': false});
|
||||
|
||||
state = false;
|
||||
}else{
|
||||
$log.animate({height: 111}, 200);
|
||||
$log.addClass('active');
|
||||
$("#content").addClass('logopen');
|
||||
$(".tab_container").addClass('logopen');
|
||||
$("#scrollicon").addClass('active');
|
||||
chrome.storage.local.set({'logopen': true});
|
||||
|
||||
state = true;
|
||||
}
|
||||
$(this).html(state ? chrome.i18n.getMessage("mainHideLog") : chrome.i18n.getMessage("mainShowLog"));
|
||||
$(this).data('state', state);
|
||||
|
||||
});
|
||||
|
||||
var mixerprofile_e = $('#mixerprofilechange');
|
||||
|
||||
mixerprofile_e.change(function () {
|
||||
var mixerprofile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SELECT_MIXER_PROFILE, [mixerprofile], false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('loadedMixerProfile', [mixerprofile + 1]));
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var profile_e = $('#profilechange');
|
||||
|
||||
profile_e.change(function () {
|
||||
var profile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [profile], false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [profile + 1]));
|
||||
});
|
||||
});
|
||||
|
||||
var batteryprofile_e = $('#batteryprofilechange');
|
||||
|
||||
batteryprofile_e.change(function () {
|
||||
var batteryprofile = parseInt($(this).val());
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [batteryprofile], false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [batteryprofile + 1]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function get_osd_settings() {
|
||||
if (globalSettings.osdUnits !== undefined && globalSettings.osdUnits !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
MSP.promise(MSPCodes.MSP2_INAV_OSD_PREFERENCES).then(function (resp) {
|
||||
var prefs = resp.data;
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
prefs.readU8();
|
||||
globalSettings.osdUnits = prefs.readU8();
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfilesHighlightColours() {
|
||||
if (globalSettings.showProfileParameters) {
|
||||
$('.dropdown-dark #profilechange').addClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').addClass('showProfileParams');
|
||||
|
||||
$('.batteryProfileHighlight').each(function() {
|
||||
$(this).addClass('batteryProfileHighlightActive');
|
||||
$(this).removeClass('batteryProfileHighlight');
|
||||
});
|
||||
|
||||
$('.controlProfileHighlight').each(function() {
|
||||
$(this).addClass('controlProfileHighlightActive');
|
||||
$(this).removeClass('controlProfileHighlight');
|
||||
});
|
||||
} else {
|
||||
$('.dropdown-dark #profilechange').removeClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').removeClass('showProfileParams');
|
||||
|
||||
$('.batteryProfileHighlightActive').each(function() {
|
||||
$(this).addClass('batteryProfileHighlight');
|
||||
$(this).removeClass('batteryProfileHighlightActive');
|
||||
});
|
||||
|
||||
$('.controlProfileHighlightActive').each(function() {
|
||||
$(this).addClass('controlProfileHighlight');
|
||||
$(this).removeClass('controlProfileHighlightActive');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function catch_startup_time(startTime) {
|
||||
var endTime = new Date().getTime(),
|
||||
timeSpent = endTime - startTime;
|
||||
|
||||
googleAnalytics.sendTiming('Load Times', 'Application Startup', timeSpent);
|
||||
}
|
||||
|
||||
function millitime() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
if (bytes < 1024) {
|
||||
bytes = bytes + ' Bytes';
|
||||
} else if (bytes < 1048576) {
|
||||
bytes = (bytes / 1024).toFixed(3) + ' KB';
|
||||
} else if (bytes < 1073741824) {
|
||||
bytes = (bytes / 1048576).toFixed(3) + ' MB';
|
||||
} else {
|
||||
bytes = (bytes / 1073741824).toFixed(3) + ' GB';
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Number.prototype.clamp = function(min, max) {
|
||||
return Math.min(Math.max(this, min), max);
|
||||
};
|
||||
|
||||
/**
|
||||
* String formatting now supports currying (partial application).
|
||||
* For a format string with N replacement indices, you can call .format
|
||||
* with M <= N arguments. The result is going to be a format string
|
||||
* with N-M replacement indices, properly counting from 0 .. N-M.
|
||||
* The following Example should explain the usage of partial applied format:
|
||||
* "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
|
||||
* "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
|
||||
**/
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/\{(\d+)\}/g, function (t, i) {
|
||||
return args[i] !== void 0 ? args[i] : "{"+(i-args.length)+"}";
|
||||
});
|
||||
};
|
||||
|
||||
function padZeros(val, length) {
|
||||
let str = val.toString();
|
||||
|
||||
if (str.length < length) {
|
||||
if (str.charAt(0) === '-') {
|
||||
str = "-0" + str.substring(1);
|
||||
str = padZeros(str, length);
|
||||
} else {
|
||||
str = padZeros("0" + str, length);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function updateActivatedTab() {
|
||||
var activeTab = $('#tabs > ul li.active');
|
||||
activeTab.removeClass('active');
|
||||
$('a', activeTab).trigger('click');
|
||||
}
|
||||
|
||||
function updateFirmwareVersion() {
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
$('#logo .firmware_version').text(CONFIG.flightControllerVersion + " [" + CONFIG.target + "]");
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/' + CONFIG.flightControllerVersion + '/docs/';
|
||||
|
||||
// If this is a master branch firmware, this will find a 404 as there is no tag tree. So default to master for docs.
|
||||
$.ajax({
|
||||
url : globalSettings.docsTreeLocation + 'Settings.md',
|
||||
method: "HEAD",
|
||||
statusCode: {
|
||||
404: function() {
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#logo .firmware_version').text(chrome.i18n.getMessage('fcNotConnected'));
|
||||
|
||||
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
|
||||
}
|
||||
}
|
||||
|
||||
function updateEzTuneTabVisibility(loadMixerConfig) {
|
||||
let useEzTune = true;
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
if (loadMixerConfig) {
|
||||
mspHelper.loadMixerConfig(function() {
|
||||
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
||||
$('.tab_ez_tune').removeClass("is-hidden");
|
||||
} else {
|
||||
$('.tab_ez_tune').addClass("is-hidden");
|
||||
useEzTune = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
||||
$('.tab_ez_tune').removeClass("is-hidden");
|
||||
} else {
|
||||
$('.tab_ez_tune').addClass("is-hidden");
|
||||
useEzTune = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return useEzTune;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"minimum_chrome_version": "38",
|
||||
"version": "8.0.0",
|
||||
"author": "Several",
|
||||
"name": "INAV - Configurator",
|
||||
"short_name": "INAV",
|
||||
"description": "Crossplatform configuration tool for INAVFlight flight control system",
|
||||
|
||||
"offline_enabled": true,
|
||||
|
||||
"default_locale": "en",
|
||||
|
||||
"app": {
|
||||
"background": {
|
||||
"scripts": ["eventPage.js"],
|
||||
"persistent": false
|
||||
}
|
||||
},
|
||||
|
||||
"sandbox": {
|
||||
"pages": ["tabs/map.html"]
|
||||
},
|
||||
|
||||
"sockets": {
|
||||
"udp": {
|
||||
"send": ["*"],
|
||||
"bind": ["*"]
|
||||
}
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"https://www.google-analytics.com/",
|
||||
"https://maps.googleapis.com/*",
|
||||
"https://*.github.com/",
|
||||
"https://*.githubusercontent.com/",
|
||||
"https://*.amazonaws.com/",
|
||||
"https://dev.virtualearth.net/",
|
||||
"serial",
|
||||
"usb",
|
||||
"bluetooth",
|
||||
"sockets",
|
||||
"storage",
|
||||
"fileSystem",
|
||||
"fileSystem.write",
|
||||
"fileSystem.retainEntries",
|
||||
"notifications",
|
||||
"alwaysOnTopWindows",
|
||||
{"usbDevices": [
|
||||
{"vendorId": 1155, "productId": 57105},
|
||||
{"vendorId": 11836, "productId": 57105}
|
||||
]}
|
||||
],
|
||||
|
||||
"icons": {
|
||||
"128": "images/inav_icon_128.png"
|
||||
}
|
||||
}
|
11296
package-lock.json
generated
11296
package-lock.json
generated
File diff suppressed because it is too large
Load diff
52
package.json
52
package.json
|
@ -2,12 +2,14 @@
|
|||
"name": "inav-configurator",
|
||||
"description": "INAV Configurator",
|
||||
"version": "8.0.0",
|
||||
"main": "main.html",
|
||||
"main": "main.js",
|
||||
"default_locale": "en",
|
||||
"scripts": {
|
||||
"start": "node node_modules/gulp/bin/gulp.js build && node node_modules/nw/bin/nw .",
|
||||
"gulp": "gulp",
|
||||
"nw": "nw"
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "echo \"No linting configured\""
|
||||
},
|
||||
"window": {
|
||||
"title": "INAV Configurator",
|
||||
|
@ -23,37 +25,31 @@
|
|||
"author": "iNavFlight",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"archiver": "^2.0.3",
|
||||
"bluebird": "3.4.1",
|
||||
"command-exists": "^1.2.8",
|
||||
"del": "^3.0.0",
|
||||
"fs": "0.0.1-security",
|
||||
"graceful-fs": "^4.2.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"@electron/remote": "^2.1.1",
|
||||
"usb": "^2.11.0",
|
||||
"promise-map-series": "^0.3.0",
|
||||
"serialport": "^12.0.0",
|
||||
"inflection": "1.12.0",
|
||||
"jquery": "3.7.1",
|
||||
"jquery-textcomplete": "^1.8.5",
|
||||
"jquery-ui-npm": "1.12.0",
|
||||
"marked": "^0.3.17",
|
||||
"fs": "0.0.1-security",
|
||||
"jquery": "2.1.4",
|
||||
"jquery-ui-dist": "1.12.1",
|
||||
"marked": "^11.2.0",
|
||||
"minimist": "^1.2.0",
|
||||
"nw": "^0.81.0",
|
||||
"nw-dialog": "^1.0.7",
|
||||
"openlayers": "^4.6.5",
|
||||
"plotly": "^1.0.6",
|
||||
"temp": "^0.8.3",
|
||||
"three": "0.139.0",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@quanle94/innosetup": "^6.0.2",
|
||||
"gulp-debian": "^0.1.9",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"nw-builder": "3.8.6",
|
||||
"rpm-builder": "^1.2.1",
|
||||
"semver": "6.3.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"appdmg": "^0.6.2"
|
||||
"@electron-forge/cli": "^7.2.0",
|
||||
"@electron-forge/maker-deb": "^7.2.0",
|
||||
"@electron-forge/maker-rpm": "^7.2.0",
|
||||
"@electron-forge/maker-squirrel": "^7.2.0",
|
||||
"@electron-forge/maker-zip": "^7.2.0",
|
||||
"@electron-forge/plugin-auto-unpack-natives": "^7.2.0",
|
||||
"electron": "28.1.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
### this will remove the folders from %appdatalocal% for each user account on a given computer and then recreate the inav-configurator folder and place a text file in that folder. The script checks for this file and if it exsists will simply exit.
|
||||
## because this checks each and every user on the windows machine ps will kick out some errors for any user that it doesnt have permission to access there local app data folder. these can be ignored.
|
||||
|
||||
|
||||
#check for file
|
||||
$txtfilepath = "C:\Users\$($_.Name)\AppData\Local\inav-configurator\check.txt"
|
||||
|
||||
$testpath = test-path $txtfilepath
|
||||
|
||||
if ($testpath -eq $true){
|
||||
$append = "Terminated at time xxxxx"
|
||||
$append | out-file $txtfilepath -append -force
|
||||
break
|
||||
}
|
||||
else{
|
||||
#continue script
|
||||
# Get users
|
||||
$users = Get-ChildItem -Path "C:\Users"
|
||||
|
||||
# Loop through users and delete the folder
|
||||
$users | foreach-Object {
|
||||
Remove-Item -Recurse -Path "C:\Users\$($_.Name)\AppData\Local\inav-configurator" -Force
|
||||
|
||||
}
|
||||
}
|
||||
#create new inav-configurator folder
|
||||
New-Item -Path "C:\Users\$($_.Name)\AppData\Local\" -name "inav-configurator" -ItemType "directory"
|
||||
# add text file to check for
|
||||
New-Item -Path "C:\Users\$($_.Name)\AppData\Local\inav-configurator" -name "check.txt" -ItemType "file" -Value "config cleared"
|
||||
break
|
||||
|
12
src/css/font-awesome/css/font-awesome.css
vendored
12
src/css/font-awesome/css/font-awesome.css
vendored
|
@ -4585,8 +4585,8 @@
|
|||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: block;
|
||||
src: url("../src/css/font-awesome/webfonts/fa-brands-400.eot");
|
||||
src: url("../src/css/font-awesome/webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../src/css/font-awesome/webfonts/fa-brands-400.woff2") format("woff2"), url("../src/css/font-awesome/webfonts/fa-brands-400.woff") format("woff"), url("../src/css/font-awesome/webfonts/fa-brands-400.ttf") format("truetype"), url("../src/css/font-awesome/webfonts/fa-brands-400.svg#fontawesome") format("svg"); }
|
||||
src: url("./../webfonts/fa-brands-400.eot");
|
||||
src: url("./../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("./../../font-awesome/webfonts/fa-brands-400.woff2") format("woff2"), url("./../../font-awesome/webfonts/fa-brands-400.woff") format("woff"), url("./../../font-awesome/webfonts/fa-brands-400.ttf") format("truetype"), url("./../../font-awesome/webfonts/fa-brands-400.svg#fontawesome") format("svg"); }
|
||||
|
||||
.fab {
|
||||
font-family: 'Font Awesome 5 Brands';
|
||||
|
@ -4596,8 +4596,8 @@
|
|||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: block;
|
||||
src: url("../src/css/font-awesome/webfonts/fa-regular-400.eot");
|
||||
src: url("../src/css/font-awesome/webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../src/css/font-awesome/webfonts/fa-regular-400.woff2") format("woff2"), url("../src/css/font-awesome/webfonts/fa-regular-400.woff") format("woff"), url("../src/css/font-awesome/webfonts/fa-regular-400.ttf") format("truetype"), url("../src/css/font-awesome/webfonts/fa-regular-400.svg#fontawesome") format("svg"); }
|
||||
src: url("./../../font-awesome/webfonts/fa-regular-400.eot");
|
||||
src: url("./../../font-awesome/webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("./../../font-awesome/webfonts/fa-regular-400.woff2") format("woff2"), url("./../../font-awesome/webfonts/fa-regular-400.woff") format("woff"), url("./../../font-awesome/webfonts/fa-regular-400.ttf") format("truetype"), url("./../../font-awesome/webfonts/fa-regular-400.svg#fontawesome") format("svg"); }
|
||||
|
||||
.far {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
|
@ -4607,8 +4607,8 @@
|
|||
font-style: normal;
|
||||
font-weight: 900;
|
||||
font-display: block;
|
||||
src: url("../src/css/font-awesome/webfonts/fa-solid-900.eot");
|
||||
src: url("../src/css/font-awesome/webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../src/css/font-awesome/webfonts/fa-solid-900.woff2") format("woff2"), url("../src/css/font-awesome/webfonts/fa-solid-900.woff") format("woff"), url("../src/css/font-awesome/webfonts/fa-solid-900.ttf") format("truetype"), url("../src/css/font-awesome/webfonts/fa-solid-900.svg#fontawesome") format("svg"); }
|
||||
src: url("./../../font-awesome/webfonts/fa-solid-900.eot");
|
||||
src: url("./../../font-awesome/webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("./../../font-awesome/webfonts/fa-solid-900.woff2") format("woff2"), url("./../../font-awesome/webfonts/fa-solid-900.woff") format("woff"), url("./../../font-awesome/webfonts/fa-solid-900.ttf") format("truetype"), url("./../../font-awesome/webfonts/fa-solid-900.svg#fontawesome") format("svg"); }
|
||||
|
||||
.fa,
|
||||
.fas {
|
||||
|
|
2294
src/css/main.css
Normal file
2294
src/css/main.css
Normal file
File diff suppressed because it is too large
Load diff
|
@ -3,12 +3,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sanssemibold';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-semibold-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-semibold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-semibold-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-semibold-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-semibold-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-semibold-webfont.svg#open_sanssemibold') format('svg');
|
||||
src: url('opensans-semibold-webfont.eot');
|
||||
src: url('opensans-semibold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-semibold-webfont.woff2') format('woff2'),
|
||||
url('opensans-semibold-webfont.woff') format('woff'),
|
||||
url('opensans-semibold-webfont.ttf') format('truetype'),
|
||||
url('opensans-semibold-webfont.svg#open_sanssemibold') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -16,12 +16,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sansregular';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-regular-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-regular-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-regular-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-regular-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-regular-webfont.svg#open_sansregular') format('svg');
|
||||
src: url('opensans-regular-webfont.eot');
|
||||
src: url('opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-regular-webfont.woff2') format('woff2'),
|
||||
url('opensans-regular-webfont.woff') format('woff'),
|
||||
url('opensans-regular-webfont.ttf') format('truetype'),
|
||||
url('opensans-regular-webfont.svg#open_sansregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -29,12 +29,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sanslight';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-light-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-light-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-light-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-light-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-light-webfont.svg#open_sanslight') format('svg');
|
||||
src: url('opensans-light-webfont.eot');
|
||||
src: url('opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-light-webfont.woff2') format('woff2'),
|
||||
url('opensans-light-webfont.woff') format('woff'),
|
||||
url('opensans-light-webfont.ttf') format('truetype'),
|
||||
url('opensans-light-webfont.svg#open_sanslight') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -42,12 +42,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sansitalic';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-italic-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-italic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-italic-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-italic-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-italic-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-italic-webfont.svg#open_sansitalic') format('svg');
|
||||
src: url('opensans-italic-webfont.eot');
|
||||
src: url('opensans-italic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-italic-webfont.woff2') format('woff2'),
|
||||
url('opensans-italic-webfont.woff') format('woff'),
|
||||
url('opensans-italic-webfont.ttf') format('truetype'),
|
||||
url('opensans-italic-webfont.svg#open_sansitalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -55,12 +55,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sansbold_italic';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bolditalic-webfont.svg#open_sansbold_italic') format('svg');
|
||||
src: url('opensans-bolditalic-webfont.eot');
|
||||
src: url('opensans-bolditalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-bolditalic-webfont.woff2') format('woff2'),
|
||||
url('opensans-bolditalic-webfont.woff') format('woff'),
|
||||
url('opensans-bolditalic-webfont.ttf') format('truetype'),
|
||||
url('opensans-bolditalic-webfont.svg#open_sansbold_italic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -68,12 +68,12 @@
|
|||
/*noinspection CssUnknownTarget*/
|
||||
@font-face {
|
||||
font-family: 'open_sansbold';
|
||||
src: url('../src/css/opensans_webfontkit/opensans-bold-webfont.eot');
|
||||
src: url('../src/css/opensans_webfontkit/opensans-bold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bold-webfont.woff2') format('woff2'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bold-webfont.woff') format('woff'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bold-webfont.ttf') format('truetype'),
|
||||
url('../src/css/opensans_webfontkit/opensans-bold-webfont.svg#open_sansbold') format('svg');
|
||||
src: url('opensans-bold-webfont.eot');
|
||||
src: url('opensans-bold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('opensans-bold-webfont.woff2') format('woff2'),
|
||||
url('opensans-bold-webfont.woff') format('woff'),
|
||||
url('opensans-bold-webfont.ttf') format('truetype'),
|
||||
url('opensans-bold-webfont.svg#open_sansbold') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
4
src/css/receiver-msp.css
Normal file
4
src/css/receiver-msp.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
@import 'tabs/receiver_msp.css';
|
||||
@import './opensans_webfontkit/fonts.css';
|
||||
@import '/js/libraries/jquery.nouislider.min.css';
|
||||
@import '/js/libraries/jquery.nouislider.pips.min.css';
|
40
src/css/styles.css
Normal file
40
src/css/styles.css
Normal file
|
@ -0,0 +1,40 @@
|
|||
@import 'main.css';
|
||||
@import '../js/libraries/jquery.nouislider.min.css';
|
||||
@import '../js/libraries/jquery.nouislider.pips.min.css';
|
||||
@import '../js/libraries/flightindicators.css';
|
||||
@import 'opensans_webfontkit/fonts.css';
|
||||
@import 'font-awesome/css/font-awesome.css';
|
||||
@import 'dropdown-lists/css/style_lists.css';
|
||||
@import '../js/libraries/switchery/switchery.css';
|
||||
@import '../js/libraries/jbox/jBox.css';
|
||||
@import 'logic.css';
|
||||
@import 'defaults_dialog.css';
|
||||
@import './../../node_modules/openlayers/dist/ol.css';
|
||||
@import 'tabs/adjustments.css';
|
||||
@import 'tabs/advanced_tuning.css';
|
||||
@import 'tabs/auxiliary.css';
|
||||
@import 'tabs/calibration.css';
|
||||
@import 'tabs/cli.css';
|
||||
@import 'tabs/configuration.css';
|
||||
@import 'tabs/ez_tune.css';
|
||||
@import 'tabs/failsafe.css';
|
||||
@import 'tabs/firmware_flasher.css';
|
||||
@import 'tabs/gps.css';
|
||||
@import 'tabs/landing.css';
|
||||
@import 'tabs/led_strip.css';
|
||||
@import 'tabs/logging.css';
|
||||
@import 'tabs/magnetometer.css';
|
||||
@import 'tabs/mission_planer.css';
|
||||
@import 'tabs/mixer.css';
|
||||
@import 'tabs/modes.css';
|
||||
@import 'tabs/motors.css';
|
||||
@import 'tabs/onboard_logging.css';
|
||||
@import 'tabs/osd.css';
|
||||
@import 'tabs/pid_tuning.css';
|
||||
@import 'tabs/ports.css';
|
||||
@import 'tabs/profiles.css';
|
||||
@import 'tabs/programming.css';
|
||||
@import 'tabs/receiver.css';
|
||||
@import 'tabs/sensors.css';
|
||||
@import 'tabs/setup.css';
|
||||
@import 'tabs/sitl.css';
|
|
@ -203,7 +203,7 @@
|
|||
float: right;
|
||||
margin-right: 5px;
|
||||
margin-top: -9px;
|
||||
background: url('../../../images/icons/close1.svg') no-repeat center 100%;
|
||||
background: url('./../../../images/icons/close1.svg') no-repeat center 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
height: 30px;
|
||||
text-align: center;
|
||||
display: none;
|
||||
background-image: url(../../../images/icons/check.svg);
|
||||
background-image: url(./../../../images/icons/check.svg);
|
||||
background-size: contain;
|
||||
|
||||
}
|
||||
|
@ -77,55 +77,55 @@
|
|||
}
|
||||
|
||||
.tab-calibration .step1 {
|
||||
background-image: url(../../../images/icons/pos1_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos1_grey.svg);
|
||||
background-size: 185px;
|
||||
background-position-y: 10px;
|
||||
}
|
||||
|
||||
.tab-calibration .step1.active, .tab-calibration .step1.finished {
|
||||
background-image: url(../../../images/icons/pos1.svg);
|
||||
background-image: url(./../../../images/icons/pos1.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step2 {
|
||||
background-image: url(../../../images/icons/pos2_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos2_grey.svg);
|
||||
background-size: 185px;
|
||||
background-position-y: 10px;
|
||||
}
|
||||
|
||||
.tab-calibration .step2.active, .tab-calibration .step2.finished {
|
||||
background-image: url(../../../images/icons/pos2.svg);
|
||||
background-image: url(./../../../images/icons/pos2.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step3 {
|
||||
background-image: url(../../../images/icons/pos3_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos3_grey.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step3.active, .tab-calibration .step3.finished {
|
||||
background-image: url(../../../images/icons/pos3.svg);
|
||||
background-image: url(./../../../images/icons/pos3.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step4 {
|
||||
background-image: url(../../../images/icons/pos4_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos4_grey.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step4.active, .tab-calibration .step4.finished {
|
||||
background-image: url(../../../images/icons/pos4.svg);
|
||||
background-image: url(./../../../images/icons/pos4.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step5 {
|
||||
background-image: url(../../../images/icons/pos5_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos5_grey.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step5.active, .tab-calibration .step5.finished {
|
||||
background-image: url(../../../images/icons/pos5.svg);
|
||||
background-image: url(./../../../images/icons/pos5.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step6 {
|
||||
background-image: url(../../../images/icons/pos6_grey.svg);
|
||||
background-image: url(./../../../images/icons/pos6_grey.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .step6.active, .tab-calibration .step6.finished {
|
||||
background-image: url(../../../images/icons/pos6.svg);
|
||||
background-image: url(./../../../images/icons/pos6.svg);
|
||||
}
|
||||
|
||||
.tab-calibration .note {
|
||||
|
|
|
@ -79,24 +79,6 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.cli-textcomplete-dropdown {
|
||||
border: 1px solid black;
|
||||
background-color: #4f4f4f;
|
||||
border-radius: 5px;
|
||||
max-height: 50%;
|
||||
overflow: auto;
|
||||
list-style: none;
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
}
|
||||
.cli-textcomplete-dropdown a {
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cli-textcomplete-dropdown .active {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
||||
|
||||
.tab-cli .content_wrapper {
|
||||
|
|
|
@ -166,17 +166,17 @@ hr {
|
|||
|
||||
.tab-configuration .pitch {
|
||||
background-size: 20px;
|
||||
background: url(../images/icons/cf_icon_pitch.svg) no-repeat center;
|
||||
background: url(./../../../images/icons/cf_icon_pitch.svg) no-repeat center;
|
||||
}
|
||||
|
||||
.tab-configuration .yaw {
|
||||
background-size: 20px;
|
||||
background: url(../images/icons/cf_icon_yaw.svg) no-repeat center;
|
||||
background: url(./../../../images/icons/cf_icon_yaw.svg) no-repeat center;
|
||||
}
|
||||
|
||||
.tab-configuration .roll {
|
||||
background-size: 20px;
|
||||
background: url(../images/icons/cf_icon_roll.svg) no-repeat center;
|
||||
background: url(./../../../images/icons/cf_icon_roll.svg) no-repeat center;
|
||||
}
|
||||
|
||||
.tab-configuration .board select {
|
||||
|
|
|
@ -91,22 +91,22 @@
|
|||
}
|
||||
|
||||
.tab-failsafe .pro1 {
|
||||
background: url(../images/icons/cf_failsafe_procedure1.svg) no-repeat top right 10px;
|
||||
background: url(./../../../images/icons/cf_failsafe_procedure1.svg) no-repeat top right 10px;
|
||||
background-size: 200px;
|
||||
}
|
||||
|
||||
.tab-failsafe .pro2 {
|
||||
background: url(../images/icons/cf_failsafe_procedure2.svg) no-repeat top right 10px;
|
||||
background: url(./../../../images/icons/cf_failsafe_procedure2.svg) no-repeat top right 10px;
|
||||
background-size: 200px;
|
||||
}
|
||||
|
||||
.tab-failsafe .pro3 {
|
||||
background: url(../images/icons/cf_failsafe_procedure3.svg) no-repeat top right 10px;
|
||||
background: url(./../../../images/icons/cf_failsafe_procedure3.svg) no-repeat top right 10px;
|
||||
background-size: 200px;
|
||||
}
|
||||
|
||||
.tab-failsafe .pro4 {
|
||||
background: url(../images/icons/cf_failsafe_procedure4.svg) no-repeat top right 10px;
|
||||
background: url(./../../../images/icons/cf_failsafe_procedure4.svg) no-repeat top right 10px;
|
||||
background-size: 200px;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
.tab-landing .content_top {
|
||||
height: 140px;
|
||||
background: white url(/images/map_bg.svg);
|
||||
background: white url(./../../../images/map_bg.svg);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,71 +34,71 @@
|
|||
}
|
||||
|
||||
.tab-mission-control .ic_save2FC {
|
||||
background-image: url(../images/icons/cf_icon_MP_save2FC_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_save2FC_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_loadFromFC {
|
||||
background-image: url(../images/icons/cf_icon_MP_loadFromFC_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_loadFromFC_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_save2File {
|
||||
background-image: url(../images/icons/cf_icon_MP_saveFile_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_saveFile_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_loadFromFile {
|
||||
background-image: url(../images/icons/cf_icon_MP_loadFile_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_loadFile_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_save2Eprom {
|
||||
background-image: url(../images/icons/cf_icon_MP_save2Eprom_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_save2Eprom_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_loadFromEprom {
|
||||
background-image: url(../images/icons/cf_icon_MP_loadFromEprom_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_loadFromEprom_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_removeAll {
|
||||
background-image: url(../images/icons/cf_icon_MP_removeAll_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_removeAll_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_openMultimission {
|
||||
background-image: url(../images/icons/cf_icon_multimission_white.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_multimission_white.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_save {
|
||||
background-image: url(../images/icons/cf_icon_MP_save_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_save_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_cancel {
|
||||
background-image: url(../images/icons/cf_icon_MP_cancel_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_cancel_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_add {
|
||||
background-image: url(../images/icons/cf_icon_MP_add_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_add_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_show {
|
||||
background-image: url(../images/icons/cf_icon_MP_show_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_show_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_hide {
|
||||
background-image: url(../images/icons/cf_icon_MP_hide_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_hide_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_play {
|
||||
background-image: url(../images/icons/cf_icon_MP_play_grey.svg);
|
||||
background-image: url(../..//images/icons/cf_icon_MP_play_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_stop {
|
||||
background-image: url(../images/icons/cf_icon_MP_stop_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_stop_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_center {
|
||||
background-image: url(../images/icons/cf_icon_MP_center_grey.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_MP_center_grey.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .ic_setup {
|
||||
background-image: url(../images/icons/cf_icon_setup_white.svg);
|
||||
background-image: url(./../../../images/icons/cf_icon_setup_white.svg);
|
||||
}
|
||||
|
||||
.tab-mission-control .btnicon {
|
||||
|
|
|
@ -344,7 +344,7 @@
|
|||
right: 0;
|
||||
z-index: -1;
|
||||
overflow: hidden;
|
||||
background: url("../../../images/light-wide-2.svg") no-repeat 95% 20%;
|
||||
background: url("./../../../images/light-wide-2.svg") no-repeat 95% 20%;
|
||||
background-size: 430px;
|
||||
height: 174px;
|
||||
opacity: 0.15;
|
||||
|
|
|
@ -315,7 +315,7 @@
|
|||
height: 117px;
|
||||
border: 1px solid silver;
|
||||
border-radius: 3px;
|
||||
background-image: url(../../../images/paper.jpg);
|
||||
background-image: url(./../../../images/paper.jpg);
|
||||
background-size: 200%;
|
||||
background-position: center;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@
|
|||
height: 117px;
|
||||
border: 1px solid silver;
|
||||
border-radius: 3px;
|
||||
background-image: url(../../../images/paper.jpg);
|
||||
background-image: url(./../../../images/paper.jpg);
|
||||
background-size: 200%;
|
||||
background-position: center;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: url(../../../images/paper.jpg) center;
|
||||
background: url(./../../../images/paper.jpg) center;
|
||||
border-radius: 5px;
|
||||
background-size: contain;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@
|
|||
float: right;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
background-image:url(../../../images/icons/pass.svg);
|
||||
background-image:url(./../../../images/icons/pass.svg);
|
||||
background-size:contain;
|
||||
background-position:center;
|
||||
background-repeat:no-repeat;
|
||||
|
@ -304,7 +304,7 @@
|
|||
margin-top: 3px;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
background-image:url(../../../images/icons/nopass.svg);
|
||||
background-image:url(./../../../images/icons/nopass.svg);
|
||||
background-size:contain;
|
||||
background-position:center;
|
||||
background-repeat:no-repeat;
|
||||
|
|
|
@ -6,7 +6,6 @@ TABS.adjustments = {};
|
|||
TABS.adjustments.initialize = function (callback) {
|
||||
GUI.active_tab_ref = this;
|
||||
GUI.active_tab = 'adjustments';
|
||||
googleAnalytics.sendAppView('Adjustments');
|
||||
|
||||
function get_adjustment_ranges() {
|
||||
MSP.send_message(MSPCodes.MSP_ADJUSTMENT_RANGES, false, false, get_box_ids);
|
||||
|
@ -21,7 +20,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/adjustments.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/adjustments.html"), process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_adjustment_ranges);
|
||||
|
@ -170,7 +169,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
}
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// UI Hooks
|
||||
$('a.save').click(function () {
|
||||
|
@ -223,7 +222,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('adjustmentsEepromSaved'));
|
||||
GUI.log(localization.getMessage('adjustmentsEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -155,11 +155,7 @@
|
|||
<label for="maxBankAngle"><span data-i18n="maxBankAngle"></span></label>
|
||||
<div for="maxBankAngle" class="helpicon cf_tip" data-i18n_title="maxBankAngleHelp"></div>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input type="number" id="navManualClimbRate" data-unit="v-cms" data-setting="nav_fw_manual_climb_rate" data-setting-multiplier="1" step="1" min="10" max="2000" />
|
||||
<label for="navManualClimbRate"><span data-i18n="navManualClimbRate"></span></label>
|
||||
<div for="navManualClimbRate" class="helpicon cf_tip" data-i18n_title="navManualClimbRateHelp"></div>
|
||||
</div>
|
||||
|
||||
<div class="number">
|
||||
<input id="maxClimbAngle" type="number" data-unit="deg" data-setting="nav_fw_climb_angle" data-setting-multiplier="1" step="1" min="5" max="80" />
|
||||
<label for="maxClimbAngle"><span data-i18n="maxClimbAngle"></span></label>
|
||||
|
@ -242,16 +238,6 @@
|
|||
<label for="max-manual-speed"><span data-i18n="posholdMaxManualSpeed"></span></label>
|
||||
<div for="max-manual-speed" class="helpicon cf_tip" data-i18n_title="posholdMaxManualSpeedHelp"></div>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input type="number" id="navAutoClimbRate" data-unit="v-cms" data-setting="nav_mc_auto_climb_rate" data-setting-multiplier="1" step="1" min="10" max="2000" />
|
||||
<label for="navAutoClimbRate"><span data-i18n="navAutoClimbRate"></span></label>
|
||||
<div for="navAutoClimbRate" class="helpicon cf_tip" data-i18n_title="navAutoClimbRateHelp"></div>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input type="number" id="navManualClimbRate" data-unit="v-cms" data-setting="nav_mc_manual_climb_rate" data-setting-multiplier="1" step="1" min="10" max="2000" />
|
||||
<label for="navManualClimbRate"><span data-i18n="navManualClimbRate"></span></label>
|
||||
<div for="navManualClimbRate" class="helpicon cf_tip" data-i18n_title="navManualClimbRateHelp"></div>
|
||||
</div>
|
||||
<div class="number">
|
||||
<input id="max-bank-angle" type="number" data-unit="deg" data-setting="nav_mc_bank_angle" data-setting-multiplier="1" step="1" min="15" max="45" />
|
||||
<label for="max-bank-angle"><span data-i18n="posholdMaxBankAngle"></span></label>
|
||||
|
@ -479,6 +465,17 @@
|
|||
<div class="spacer_box_title" data-i18n="generalNavigationSettings"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<div class="number">
|
||||
<input type="number" id="navManualClimbRate" data-unit="v-cms" data-setting="nav_manual_climb_rate" data-setting-multiplier="1" step="1" min="10" max="2000" />
|
||||
<label for="navManualClimbRate"><span data-i18n="navManualClimbRate"></span></label>
|
||||
<div for="navManualClimbRate" class="helpicon cf_tip" data-i18n_title="navManualClimbRateHelp"></div>
|
||||
</div>
|
||||
|
||||
<div class="number">
|
||||
<input type="number" id="navAutoClimbRate" data-unit="v-cms" data-setting="nav_auto_climb_rate" data-setting-multiplier="1" step="1" min="10" max="2000" />
|
||||
<label for="navAutoClimbRate"><span data-i18n="navAutoClimbRate"></span></label>
|
||||
<div for="navAutoClimbRate" class="helpicon cf_tip" data-i18n_title="navAutoClimbRateHelp"></div>
|
||||
</div>
|
||||
|
||||
<div class="number">
|
||||
<input type="number" id="navMaxAltitude" data-unit="cm" data-setting="nav_max_altitude" data-setting-multiplier="1" step="1" min="0" max="65000" />
|
||||
|
|
|
@ -6,13 +6,12 @@ TABS.advanced_tuning.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'advanced_tuning') {
|
||||
GUI.active_tab = 'advanced_tuning';
|
||||
googleAnalytics.sendAppView('AdvancedTuning');
|
||||
}
|
||||
|
||||
loadHtml();
|
||||
|
||||
function loadHtml() {
|
||||
GUI.load("./tabs/advanced_tuning.html", Settings.processHtml(function () {
|
||||
GUI.load(path.join(__dirname, "tabs/advanced_tuning.html"), Settings.processHtml(function () {
|
||||
|
||||
if (FC.isAirplane()) {
|
||||
$('.airplaneTuning').show();
|
||||
|
@ -36,7 +35,7 @@ TABS.advanced_tuning.initialize = function (callback) {
|
|||
|
||||
GUI.simpleBind();
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// Set up required field warnings
|
||||
$('#launchIdleThr').keyup(function() {
|
||||
|
@ -78,7 +77,7 @@ TABS.advanced_tuning.initialize = function (callback) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
|
@ -86,12 +85,11 @@ TABS.advanced_tuning.initialize = function (callback) {
|
|||
|
||||
function reinitialize() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_advanced_tuning a'));
|
||||
}
|
||||
};
|
||||
|
||||
$incLD = 0;
|
||||
|
||||
TABS.advanced_tuning.checkRequirements_IdleThrottle = function() {
|
||||
let idleThrottle = $('#launchIdleThr');
|
||||
|
|
|
@ -7,8 +7,6 @@ TABS.auxiliary = {};
|
|||
TABS.auxiliary.initialize = function (callback) {
|
||||
GUI.active_tab_ref = this;
|
||||
GUI.active_tab = 'auxiliary';
|
||||
googleAnalytics.sendAppView('Auxiliary');
|
||||
|
||||
function get_mode_ranges() {
|
||||
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);
|
||||
}
|
||||
|
@ -31,7 +29,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
function load_html() {
|
||||
sort_modes_for_display();
|
||||
GUI.load("./tabs/auxiliary.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/auxiliary.html"), process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||
|
@ -55,7 +53,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
var found = false;
|
||||
var sortedID = 0;
|
||||
|
||||
for (i=0; i<AUX_CONFIG.length; i++) {
|
||||
for (let i=0; i<AUX_CONFIG.length; i++) {
|
||||
tmpAUX_CONFIG[i] = AUX_CONFIG[i];
|
||||
tmpAUX_CONFIG_IDS[i] = AUX_CONFIG_IDS[i];
|
||||
}
|
||||
|
@ -65,8 +63,8 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
for (let categoryModesIndex in modeSections) {
|
||||
let categoryModes = modeSections[categoryModesIndex];
|
||||
for (cM=0; cM<categoryModes.length; cM++){
|
||||
for(j=0; j<tmpAUX_CONFIG.length; j++) {
|
||||
for (let cM=0; cM<categoryModes.length; cM++){
|
||||
for(let j=0; j<tmpAUX_CONFIG.length; j++) {
|
||||
if (categoryModes[cM] === tmpAUX_CONFIG[j]) {
|
||||
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[j];
|
||||
AUX_CONFIG_IDS[sortedID] = tmpAUX_CONFIG_IDS[j];
|
||||
|
@ -80,9 +78,9 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
// There are modes that are missing from the modeSections object. Add them to the end until they are ordered correctly.
|
||||
if (tmpAUX_CONFIG.length > AUX_CONFIG.length) {
|
||||
for (i=0; i<tmpAUX_CONFIG.length; i++) {
|
||||
for (let i=0; i<tmpAUX_CONFIG.length; i++) {
|
||||
found = false;
|
||||
for (j=0; j<AUX_CONFIG.length; j++) {
|
||||
for (let j=0; j<AUX_CONFIG.length; j++) {
|
||||
if (tmpAUX_CONFIG[i] === AUX_CONFIG[j]) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -140,7 +138,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
|
||||
//add value to autodetect channel
|
||||
let channelOption = channelOptionTemplate.clone();
|
||||
channelOption.text(chrome.i18n.getMessage('auxiliaryAutoChannelSelect'));
|
||||
channelOption.text(localization.getMessage('auxiliaryAutoChannelSelect'));
|
||||
channelOption.val(-1);
|
||||
channelList.append(channelOption);
|
||||
|
||||
|
@ -279,7 +277,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// UI Hooks
|
||||
$('a.save').click(function () {
|
||||
|
@ -330,19 +328,9 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
//
|
||||
mspHelper.sendModeRanges(save_to_eeprom);
|
||||
|
||||
/*
|
||||
* Send some data to analytics
|
||||
*/
|
||||
uniqueModes = $.unique(uniqueModes);
|
||||
for (var mode in uniqueModes) {
|
||||
if (uniqueModes.hasOwnProperty(mode)) {
|
||||
googleAnalytics.sendEvent('Setting', 'AuxModes', uniqueModes[mode]);
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
|
||||
GUI.log(localization.getMessage('auxiliaryEepromSaved'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -409,7 +397,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
} else {
|
||||
// Check to see if the mode is in range
|
||||
var modeRanges = modeElement.find(' .range');
|
||||
for (r = 0; r < modeRanges.length; r++) {
|
||||
for (let r = 0; r < modeRanges.length; r++) {
|
||||
var rangeLow = $(modeRanges[r]).find('.lowerLimitValue').html();
|
||||
var rangeHigh = $(modeRanges[r]).find('.upperLimitValue').html();
|
||||
var markerPosition = $(modeRanges[r]).find('.marker')[0].style.left;
|
||||
|
@ -464,8 +452,8 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
*/
|
||||
function auto_select_channel(RC_channels, activeChannels, RSSI_channel) {
|
||||
const auto_option = $('.tab-auxiliary select.channel option[value="-1"]:selected');
|
||||
var prevChannelsValues = null;
|
||||
if (auto_option.length === 0) {
|
||||
prevChannelsValues = null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -497,16 +485,16 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
}
|
||||
|
||||
let hideUnusedModes = false;
|
||||
chrome.storage.local.get('hideUnusedModes', function (result) {
|
||||
let hideUnusedModesStore = store.get('hideUnusedModes', false);
|
||||
$("input#switch-toggle-unused")
|
||||
.change(function() {
|
||||
hideUnusedModes = $(this).prop("checked");
|
||||
chrome.storage.local.set({ hideUnusedModes: hideUnusedModes });
|
||||
store.set('hideUnusedModes', hideUnusedModes);
|
||||
update_ui();
|
||||
})
|
||||
.prop("checked", !!result.hideUnusedModes)
|
||||
.prop("checked", !!hideUnusedModesStore)
|
||||
.change();
|
||||
});
|
||||
|
||||
// update ui instantly on first load
|
||||
update_ui();
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'calibration') {
|
||||
GUI.active_tab = 'calibration';
|
||||
googleAnalytics.sendAppView('Calibration');
|
||||
}
|
||||
loadChainer.setChain([
|
||||
mspHelper.queryFcStatus,
|
||||
|
@ -68,7 +67,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
|
@ -77,12 +76,12 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
function reinitialize() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_calibration a'));
|
||||
}
|
||||
|
||||
function loadHtml() {
|
||||
GUI.load("./tabs/calibration.html", processHtml);
|
||||
GUI.load(path.join(__dirname, "tabs/calibration.html"), processHtml);
|
||||
}
|
||||
|
||||
function updateCalibrationSteps() {
|
||||
|
@ -162,7 +161,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
}).open();
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ACC_CALIBRATION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibStarted'));
|
||||
GUI.log(localization.getMessage('initialSetupAccelCalibStarted'));
|
||||
});
|
||||
|
||||
helper.timeout.add('acc_calibration_timeout', function () {
|
||||
|
@ -170,20 +169,20 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
modalProcessing.close();
|
||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, checkFinishAccCalibrate);
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupAccelCalibEnded'));
|
||||
GUI.log(localization.getMessage('initialSetupAccelCalibEnded'));
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
function setupCalibrationButton(callback) {
|
||||
if (FC.getAccelerometerCalibrated()) {
|
||||
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').html(localization.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').prop("title", localization.getMessage("AccResetBtn"));
|
||||
$('#calibrate-start-button').removeClass("calibrate");
|
||||
$('#calibrate-start-button').addClass("resetCalibration");
|
||||
} else {
|
||||
$('#calibrate-start-button').html(chrome.i18n.getMessage("AccBtn"));
|
||||
$('#calibrate-start-button').prop("title", chrome.i18n.getMessage("AccBtn"));
|
||||
$('#calibrate-start-button').html(localization.getMessage("AccBtn"));
|
||||
$('#calibrate-start-button').prop("title", localization.getMessage("AccBtn"));
|
||||
$('#calibrate-start-button').addClass("calibrate");
|
||||
$('#calibrate-start-button').removeClass("resetCalibration");
|
||||
}
|
||||
|
@ -198,7 +197,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
calibrateNew();
|
||||
}
|
||||
|
||||
if (callback) callback();
|
||||
|
||||
}
|
||||
|
||||
function resetAccCalibration() {
|
||||
|
@ -229,7 +228,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
$('#mag_btn').on('click', function () {
|
||||
MSP.send_message(MSPCodes.MSP_MAG_CALIBRATION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibStarted'));
|
||||
GUI.log(localization.getMessage('initialSetupMagCalibStarted'));
|
||||
});
|
||||
|
||||
var button = $(this);
|
||||
|
@ -253,13 +252,13 @@ TABS.calibration.initialize = function (callback) {
|
|||
$(button).removeClass('disabled');
|
||||
|
||||
modalProcessing.close();
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupMagCalibEnded'));
|
||||
GUI.log(localization.getMessage('initialSetupMagCalibEnded'));
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
||||
helper.interval.remove('compass_calibration_interval');
|
||||
|
||||
//Cleanup
|
||||
delete modalProcessing;
|
||||
//delete modalProcessing;
|
||||
$('.jBox-wrapper').remove();
|
||||
}, 1000);
|
||||
} else {
|
||||
|
@ -271,7 +270,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
|
||||
$('#opflow_btn').on('click', function () {
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_OPFLOW_CALIBRATION, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupOpflowCalibStarted'));
|
||||
GUI.log(localization.getMessage('initialSetupOpflowCalibStarted'));
|
||||
});
|
||||
|
||||
var button = $(this);
|
||||
|
@ -295,7 +294,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
$(button).removeClass('disabled');
|
||||
|
||||
modalProcessing.close();
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupOpflowCalibEnded'));
|
||||
GUI.log(localization.getMessage('initialSetupOpflowCalibEnded'));
|
||||
MSP.send_message(MSPCodes.MSP_CALIBRATION_DATA, false, false, updateSensorData);
|
||||
helper.interval.remove('opflow_calibration_interval');
|
||||
}
|
||||
|
@ -312,7 +311,7 @@ TABS.calibration.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
setupCalibrationButton();
|
||||
$('#calibrate-start-button').on('click', actionCalibrateButton);
|
||||
|
|
77
tabs/cli.js
77
tabs/cli.js
|
@ -1,4 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
/*global chrome,GUI,TABS,nwdialog,$*/
|
||||
TABS.cli = {
|
||||
lineDelayMs: 50,
|
||||
|
@ -49,7 +51,7 @@ function copyToClipboard(text) {
|
|||
const button = $('.tab-cli .copy');
|
||||
const origText = button.text();
|
||||
const origWidth = button.css("width");
|
||||
button.text(chrome.i18n.getMessage("cliCopySuccessful"));
|
||||
button.text(localization.getMessage("cliCopySuccessful"));
|
||||
button.css({
|
||||
width: origWidth,
|
||||
textAlign: "center",
|
||||
|
@ -117,7 +119,6 @@ TABS.cli.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'cli') {
|
||||
GUI.active_tab = 'cli';
|
||||
googleAnalytics.sendAppView('CLI');
|
||||
}
|
||||
|
||||
// Flush MSP queue as well as all MSP registered callbacks
|
||||
|
@ -142,28 +143,15 @@ TABS.cli.initialize = function (callback) {
|
|||
Promise.reduce(outputArray, sendLinesWithDelay(outputArray), 0);
|
||||
}
|
||||
|
||||
GUI.load("./tabs/cli.html", function () {
|
||||
GUI.load(path.join(__dirname, "tabs/cli.html"), function () {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
$('.cliDocsBtn').attr('href', globalSettings.docsTreeLocation + 'Settings.md');
|
||||
|
||||
CONFIGURATOR.cliActive = true;
|
||||
|
||||
var textarea = $('.tab-cli textarea[name="commands"]');
|
||||
CliAutoComplete.initialize(textarea, self.sendLine.bind(self), writeToOutput);
|
||||
$(CliAutoComplete).on('build:start', function() {
|
||||
textarea
|
||||
.val('')
|
||||
.attr('placeholder', chrome.i18n.getMessage('cliInputPlaceholderBuilding'))
|
||||
.prop('disabled', true);
|
||||
});
|
||||
$(CliAutoComplete).on('build:stop', function() {
|
||||
textarea
|
||||
.attr('placeholder', chrome.i18n.getMessage('cliInputPlaceholder'))
|
||||
.prop('disabled', false)
|
||||
.focus();
|
||||
});
|
||||
|
||||
$('.tab-cli .save').click(function() {
|
||||
var prefix = 'cli';
|
||||
|
@ -178,17 +166,17 @@ TABS.cli.initialize = function (callback) {
|
|||
nwdialog.setContext(document);
|
||||
nwdialog.saveFileDialog(filename, accepts, '', function(result) {
|
||||
if (!result) {
|
||||
GUI.log(chrome.i18n.getMessage('cliSaveToFileAborted'));
|
||||
GUI.log(localization.getMessage('cliSaveToFileAborted'));
|
||||
return;
|
||||
}
|
||||
const fs = require('fs');
|
||||
|
||||
fs.writeFile(result, self.outputHistory, (err) => {
|
||||
if (err) {
|
||||
GUI.log(chrome.i18n.getMessage('ErrorWritingFile'));
|
||||
GUI.log(localization.getMessage('ErrorWritingFile'));
|
||||
return console.error(err);
|
||||
}
|
||||
GUI.log(chrome.i18n.getMessage('FileSaved'));
|
||||
GUI.log(localization.getMessage('FileSaved'));
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -250,7 +238,7 @@ TABS.cli.initialize = function (callback) {
|
|||
closeButton: 'title',
|
||||
animation: false,
|
||||
isolateScroll: false,
|
||||
title: chrome.i18n.getMessage("cliConfirmSnippetDialogTitle"),
|
||||
title: localization.getMessage("cliConfirmSnippetDialogTitle"),
|
||||
content: $('#snippetpreviewcontent'),
|
||||
onCreated: () => $("#snippetpreviewcontent a.confirm").click(() => executeSnippet()),
|
||||
});
|
||||
|
@ -263,7 +251,7 @@ TABS.cli.initialize = function (callback) {
|
|||
|
||||
fs.readFile(result, (err, data) => {
|
||||
if (err) {
|
||||
GUI.log(chrome.i18n.getMessage('ErrorReadingFile'));
|
||||
GUI.log(localization.getMessage('ErrorReadingFile'));
|
||||
return console.error(err);
|
||||
}
|
||||
|
||||
|
@ -279,8 +267,6 @@ TABS.cli.initialize = function (callback) {
|
|||
if (event.which == tabKeyCode) {
|
||||
// prevent default tabbing behaviour
|
||||
event.preventDefault();
|
||||
|
||||
if (!CliAutoComplete.isEnabled()) {
|
||||
const outString = textarea.val();
|
||||
const lastCommand = outString.split("\n").pop();
|
||||
const command = getCliCommand(lastCommand, self.cliBuffer);
|
||||
|
@ -289,11 +275,6 @@ TABS.cli.initialize = function (callback) {
|
|||
textarea.val('');
|
||||
}
|
||||
}
|
||||
else if (!CliAutoComplete.isOpen() && !CliAutoComplete.isBuilding()) {
|
||||
// force show autocomplete on Tab
|
||||
CliAutoComplete.openLater(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
textarea.keypress(function (event) {
|
||||
|
@ -301,10 +282,6 @@ TABS.cli.initialize = function (callback) {
|
|||
if (event.which == enterKeyCode) {
|
||||
event.preventDefault(); // prevent the adding of new line
|
||||
|
||||
if (CliAutoComplete.isBuilding()) {
|
||||
return; // silently ignore commands if autocomplete is still building
|
||||
}
|
||||
|
||||
var out_string = textarea.val();
|
||||
self.history.add(out_string.trim());
|
||||
|
||||
|
@ -324,10 +301,6 @@ TABS.cli.initialize = function (callback) {
|
|||
var keyUp = {38: true},
|
||||
keyDown = {40: true};
|
||||
|
||||
if (CliAutoComplete.isOpen()) {
|
||||
return; // disable history keys if autocomplete is open
|
||||
}
|
||||
|
||||
if (event.keyCode in keyUp) {
|
||||
textarea.val(self.history.prev());
|
||||
}
|
||||
|
@ -359,7 +332,7 @@ TABS.cli.initialize = function (callback) {
|
|||
if (delay > 0) {
|
||||
helper.timeout.add('cli_delay', () => {
|
||||
self.send(getCliCommand("cli_delay " + delay + '\n', TABS.cli.cliBuffer));
|
||||
self.send(getCliCommand('# ' + chrome.i18n.getMessage('connectionBleCliEnter') + '\n', TABS.cli.cliBuffer));
|
||||
self.send(getCliCommand('# ' + localization.getMessage('connectionBleCliEnter') + '\n', TABS.cli.cliBuffer));
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
@ -398,11 +371,6 @@ function writeToOutput(text) {
|
|||
}
|
||||
|
||||
function writeLineToOutput(text) {
|
||||
if (CliAutoComplete.isBuilding()) {
|
||||
CliAutoComplete.builderParseLine(text);
|
||||
return; // suppress output if in building state
|
||||
}
|
||||
|
||||
if (text.startsWith("### ERROR: ")) {
|
||||
writeToOutput('<span class="error_message">' + text + '</span><br>');
|
||||
} else {
|
||||
|
@ -477,34 +445,22 @@ TABS.cli.read = function (readInfo) {
|
|||
this.cliBuffer += currentChar;
|
||||
}
|
||||
|
||||
if (!CliAutoComplete.isBuilding()) {
|
||||
// do not include the building dialog into the history
|
||||
this.outputHistory += currentChar;
|
||||
}
|
||||
|
||||
if (this.cliBuffer == 'Rebooting') {
|
||||
CONFIGURATOR.cliActive = false;
|
||||
CONFIGURATOR.cliValid = false;
|
||||
GUI.log(chrome.i18n.getMessage('cliReboot'));
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('cliReboot'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!CONFIGURATOR.cliValid && validateText.indexOf('CLI') !== -1) {
|
||||
GUI.log(chrome.i18n.getMessage('cliEnter'));
|
||||
GUI.log(localization.getMessage('cliEnter'));
|
||||
CONFIGURATOR.cliValid = true;
|
||||
|
||||
if (CliAutoComplete.isEnabled() && !CliAutoComplete.isBuilding()) {
|
||||
// start building autoComplete
|
||||
CliAutoComplete.builderStart();
|
||||
}
|
||||
}
|
||||
|
||||
// fallback to native autocomplete
|
||||
if (!CliAutoComplete.isEnabled()) {
|
||||
setPrompt(removePromptHash(this.cliBuffer));
|
||||
validateText = "";
|
||||
}
|
||||
|
||||
setPrompt(removePromptHash(this.cliBuffer));
|
||||
|
@ -543,8 +499,5 @@ TABS.cli.cleanup = function (callback) {
|
|||
if (callback) callback();
|
||||
}, 1000); // if we dont allow enough time to reboot, CRC of "first" command sent will fail, keep an eye for this one
|
||||
CONFIGURATOR.cliActive = false;
|
||||
|
||||
CliAutoComplete.cleanup();
|
||||
$(CliAutoComplete).off();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (GUI.active_tab != 'configuration') {
|
||||
GUI.active_tab = 'configuration';
|
||||
googleAnalytics.sendAppView('Configuration');
|
||||
|
||||
}
|
||||
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
@ -49,7 +49,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
|
@ -58,12 +58,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reinitialize() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_configuration a'));
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/configuration.html", Settings.processHtml(process_html));
|
||||
GUI.load(path.join(__dirname, "tabs/configuration.html"), Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
|
@ -74,17 +74,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
var features = FC.getFeatures();
|
||||
|
||||
var features_e = $('.features');
|
||||
for (i = 0; i < features.length; i++) {
|
||||
for (let i = 0; i < features.length; i++) {
|
||||
var row_e,
|
||||
tips = [],
|
||||
feature_tip_html = '';
|
||||
|
||||
if (features[i].showNameInTip) {
|
||||
tips.push(chrome.i18n.getMessage("manualEnablingTemplate").replace("{name}", features[i].name));
|
||||
tips.push(localization.getMessage("manualEnablingTemplate").replace("{name}", features[i].name));
|
||||
}
|
||||
|
||||
if (features[i].haveTip) {
|
||||
tips.push(chrome.i18n.getMessage("feature" + features[i].name + "Tip"));
|
||||
tips.push(localization.getMessage("feature" + features[i].name + "Tip"));
|
||||
}
|
||||
|
||||
if (tips.length > 0) {
|
||||
|
@ -111,7 +111,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
helper.features.updateUI($('.tab-configuration'), FEATURES);
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// VTX
|
||||
var config_vtx = $('.config-vtx');
|
||||
|
@ -121,7 +121,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
vtx_band.empty();
|
||||
var vtx_no_band_note = $('#vtx_no_band');
|
||||
if (VTX_CONFIG.band < VTX.BAND_MIN || VTX_CONFIG.band > VTX.BAND_MAX) {
|
||||
var noBandName = chrome.i18n.getMessage("configurationNoBand");
|
||||
var noBandName = localization.getMessage("configurationNoBand");
|
||||
$('<option value="0">' + noBandName + '</option>').appendTo(vtx_band);
|
||||
vtx_no_band_note.show();
|
||||
} else {
|
||||
|
@ -170,7 +170,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
var vtx_low_power_disarm = $('#vtx_low_power_disarm');
|
||||
vtx_low_power_disarm.empty();
|
||||
for (var ii = VTX.LOW_POWER_DISARM_MIN; ii <= VTX.LOW_POWER_DISARM_MAX; ii++) {
|
||||
var name = chrome.i18n.getMessage("configurationVTXLowPowerDisarmValue_" + ii);
|
||||
var name = localization.getMessage("configurationVTXLowPowerDisarmValue_" + ii);
|
||||
if (!name) {
|
||||
name = ii;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$i2cSpeedInfo.addClass('info-box');
|
||||
$i2cSpeedInfo.removeClass('warning-box');
|
||||
|
||||
$i2cSpeedInfo.html(chrome.i18n.getMessage('i2cSpeedSuggested800khz'));
|
||||
$i2cSpeedInfo.html(localization.getMessage('i2cSpeedSuggested800khz'));
|
||||
$i2cSpeedInfo.show();
|
||||
|
||||
} else if (value == "800KHZ") {
|
||||
|
@ -246,7 +246,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$i2cSpeedInfo.removeClass('ok-box');
|
||||
$i2cSpeedInfo.removeClass('info-box');
|
||||
$i2cSpeedInfo.addClass('warning-box');
|
||||
$i2cSpeedInfo.html(chrome.i18n.getMessage('i2cSpeedTooLow'));
|
||||
$i2cSpeedInfo.html(localization.getMessage('i2cSpeedTooLow'));
|
||||
$i2cSpeedInfo.show();
|
||||
}
|
||||
|
||||
|
@ -273,20 +273,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
MISC.battery_capacity_critical = parseInt($('#battery_capacity_critical').val() * MISC.battery_capacity / 100);
|
||||
MISC.battery_capacity_unit = $('#battery_capacity_unit').val();
|
||||
|
||||
googleAnalytics.sendEvent('Setting', 'I2CSpeed', $('#i2c_speed').children("option:selected").text());
|
||||
|
||||
googleAnalytics.sendEvent('Board', 'Accelerometer', $('#sensor-acc').children("option:selected").text());
|
||||
googleAnalytics.sendEvent('Board', 'Magnetometer', $('#sensor-mag').children("option:selected").text());
|
||||
googleAnalytics.sendEvent('Board', 'Barometer', $('#sensor-baro').children("option:selected").text());
|
||||
googleAnalytics.sendEvent('Board', 'Pitot', $('#sensor-pitot').children("option:selected").text());
|
||||
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var featureName = features[i].name;
|
||||
if (FC.isFeatureEnabled(featureName, features)) {
|
||||
googleAnalytics.sendEvent('Setting', 'Feature', featureName);
|
||||
}
|
||||
}
|
||||
|
||||
helper.features.reset();
|
||||
helper.features.fromUI($('.tab-configuration'));
|
||||
helper.features.execute(function () {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Debug Trace</title>
|
||||
<script type="text/javascript" src="/build/debug-trace.js"></script>
|
||||
<script type="text/javascript" src="./../js/debug_trace.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre><code id="debug-trace"></code></pre>
|
||||
|
|
|
@ -34,24 +34,23 @@ TABS.ez_tune.initialize = function (callback) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
}
|
||||
|
||||
function reinitialize() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_ez_tune a'));
|
||||
}
|
||||
|
||||
if (GUI.active_tab != 'ez_tune') {
|
||||
GUI.active_tab = 'ez_tune';
|
||||
googleAnalytics.sendAppView('Ez Tune');
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/ez_tune.html", Settings.processHtml(process_html));
|
||||
GUI.load(path.join(__dirname, "tabs/ez_tune.html"), Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function getYawPidScale(input) {
|
||||
|
@ -102,7 +101,7 @@ TABS.ez_tune.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function process_html() {
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
helper.tabs.init($('.tab-ez_tune'));
|
||||
helper.features.updateUI($('.tab-ez_tune'), FEATURES);
|
||||
|
|
|
@ -6,7 +6,6 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (GUI.active_tab != 'failsafe') {
|
||||
GUI.active_tab = 'failsafe';
|
||||
googleAnalytics.sendAppView('Failsafe');
|
||||
}
|
||||
|
||||
// Can get rid of this when MSPHelper supports strings (fixed in #7734, awaiting merge)
|
||||
|
@ -15,11 +14,11 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/failsafe.html", Settings.processHtml(function() {
|
||||
GUI.load(path.join(__dirname, "tabs/failsafe.html"), Settings.processHtml(function() {
|
||||
GUI.simpleBind();
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// for some odd reason chrome 38+ changes scroll according to the touched select element
|
||||
// i am guessing this is a bug, since this wasn't happening on 37
|
||||
|
@ -52,7 +51,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
switch (FAILSAFE_CONFIG.failsafe_procedure) {
|
||||
default:
|
||||
case 0:
|
||||
element = $('input[id="land"]');
|
||||
let element = $('input[id="land"]');
|
||||
element.prop('checked', true);
|
||||
element.change();
|
||||
break;
|
||||
|
@ -131,7 +130,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
});
|
||||
|
@ -139,7 +138,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reinitialize() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_failsafe a'));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
/*global $,nwdialog*/
|
||||
'use strict';
|
||||
|
||||
const { marked } = require('marked');
|
||||
|
||||
TABS.firmware_flasher = {};
|
||||
TABS.firmware_flasher.initialize = function (callback) {
|
||||
|
||||
if (GUI.active_tab != 'firmware_flasher') {
|
||||
GUI.active_tab = 'firmware_flasher';
|
||||
googleAnalytics.sendAppView('Firmware Flasher');
|
||||
}
|
||||
|
||||
|
||||
var intel_hex = false, // standard intel hex in string format
|
||||
parsed_hex = false; // parsed raw hex in array format
|
||||
|
||||
GUI.load("./tabs/firmware_flasher.html", function () {
|
||||
GUI.load(path.join(__dirname, "tabs/firmware_flasher.html"), function () {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();
|
||||
|
||||
function enable_load_online_button() {
|
||||
$(".load_remote_file").text(chrome.i18n.getMessage('firmwareFlasherButtonLoadOnline')).removeClass('disabled');
|
||||
$(".load_remote_file").text(localization.getMessage('firmwareFlasherButtonLoadOnline')).removeClass('disabled');
|
||||
}
|
||||
|
||||
function parse_hex(str, callback) {
|
||||
// parsing hex in different thread
|
||||
var worker = new Worker('./build/hex_parser.js');
|
||||
var worker = new Worker('/js/workers/hex_parser.js');
|
||||
|
||||
// "callback"
|
||||
worker.onmessage = function (event) {
|
||||
|
@ -52,9 +53,9 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
|
||||
$('input.show_development_releases').click(function() {
|
||||
let selectedTarget = String($('select[name="board"]').val());
|
||||
GUI.log(chrome.i18n.getMessage('selectedTarget') + selectedTarget);
|
||||
GUI.log(localization.getMessage('selectedTarget') + selectedTarget);
|
||||
buildBoardOptions();
|
||||
GUI.log(chrome.i18n.getMessage('toggledRCs'));
|
||||
GUI.log(localization.getMessage('toggledRCs'));
|
||||
if (selectedTarget === "0") {
|
||||
TABS.firmware_flasher.getTarget();
|
||||
} else {
|
||||
|
@ -86,8 +87,8 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
var versions_e = $('select[name="firmware_version"]').empty();
|
||||
var showDevReleases = ($('input.show_development_releases').is(':checked'));
|
||||
|
||||
boards_e.append($("<option value='0'>{0}</option>".format(chrome.i18n.getMessage('firmwareFlasherOptionLabelSelectBoard'))));
|
||||
versions_e.append($("<option value='0'>{0}</option>".format(chrome.i18n.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersion'))));
|
||||
boards_e.append($("<option value='0'>{0}</option>".format(localization.getMessage('firmwareFlasherOptionLabelSelectBoard'))));
|
||||
versions_e.append($("<option value='0'>{0}</option>".format(localization.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersion'))));
|
||||
|
||||
var releases = {};
|
||||
var sortedTargets = [];
|
||||
|
@ -183,16 +184,16 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
|
||||
if (!GUI.connect_lock) {
|
||||
$('.progress').val(0).removeClass('valid invalid');
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherLoadFirmwareFile'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherLoadFirmwareFile'));
|
||||
$('div.git_info').slideUp();
|
||||
$('div.release_info').slideUp();
|
||||
$('a.flash_firmware').addClass('disabled');
|
||||
|
||||
var versions_e = $('select[name="firmware_version"]').empty();
|
||||
if(target == 0) {
|
||||
versions_e.append($("<option value='0'>{0}</option>".format(chrome.i18n.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersion'))));
|
||||
versions_e.append($("<option value='0'>{0}</option>".format(localization.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersion'))));
|
||||
} else {
|
||||
versions_e.append($("<option value='0'>{0} {1}</option>".format(chrome.i18n.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersionFor'), target)));
|
||||
versions_e.append($("<option value='0'>{0} {1}</option>".format(localization.getMessage('firmwareFlasherOptionLabelSelectFirmwareVersionFor'), target)));
|
||||
}
|
||||
|
||||
TABS.firmware_flasher.releases[target].forEach(function(descriptor) {
|
||||
|
@ -243,12 +244,11 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
parsed_hex = data;
|
||||
|
||||
if (parsed_hex) {
|
||||
googleAnalytics.sendEvent('Flashing', 'Firmware', 'local');
|
||||
$('a.flash_firmware').removeClass('disabled');
|
||||
|
||||
$('span.progressLabel').text('Loaded Local Firmware: (' + parsed_hex.bytes_total + ' bytes)');
|
||||
} else {
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherHexCorrupted'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -274,7 +274,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
$('a.load_remote_file').click(function (evt) {
|
||||
|
||||
if ($('select[name="firmware_version"]').val() == "0") {
|
||||
GUI.log(chrome.i18n.getMessage('noFirmwareSelectedToLoad'));
|
||||
GUI.log(localization.getMessage('noFirmwareSelectedToLoad'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,6 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
if (parsed_hex) {
|
||||
var url;
|
||||
|
||||
googleAnalytics.sendEvent('Flashing', 'Firmware', 'online');
|
||||
$('span.progressLabel').html('<a class="save_firmware" href="#" title="Save Firmware">Loaded Online Firmware: (' + parsed_hex.bytes_total + ' bytes)</a>');
|
||||
|
||||
$('a.flash_firmware').removeClass('disabled');
|
||||
|
@ -317,7 +316,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
|
||||
var status_e = $('div.release_info .status');
|
||||
if (summary.status == 'release-candidate') {
|
||||
$('div.release_info .status').html(chrome.i18n.getMessage('firmwareFlasherReleaseStatusReleaseCandidate')).show();
|
||||
$('div.release_info .status').html(localization.getMessage('firmwareFlasherReleaseStatusReleaseCandidate')).show();
|
||||
} else {
|
||||
status_e.hide();
|
||||
}
|
||||
|
@ -327,7 +326,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
$('div.release_info .status').text(summary.status);
|
||||
$('div.release_info .file').text(summary.file).prop('href', summary.url);
|
||||
|
||||
var formattedNotes = marked(summary.notes);
|
||||
var formattedNotes = marked.parse(summary.notes);
|
||||
$('div.release_info .notes').html(formattedNotes);
|
||||
// Make links in the release notes open in a new window
|
||||
$('div.release_info .notes a').each(function () {
|
||||
|
@ -337,26 +336,26 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
$('div.release_info').slideDown();
|
||||
|
||||
} else {
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherHexCorrupted'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function failed_to_load() {
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
||||
$('a.flash_firmware').addClass('disabled');
|
||||
enable_load_online_button();
|
||||
}
|
||||
|
||||
var summary = $('select[name="firmware_version"] option:selected').data('summary');
|
||||
if (summary) { // undefined while list is loading or while running offline
|
||||
$(".load_remote_file").text(chrome.i18n.getMessage('firmwareFlasherButtonLoading')).addClass('disabled');
|
||||
$(".load_remote_file").text(localization.getMessage('firmwareFlasherButtonLoading')).addClass('disabled');
|
||||
$.get(summary.url, function (data) {
|
||||
enable_load_online_button();
|
||||
process_hex(data, summary);
|
||||
}).fail(failed_to_load);
|
||||
} else {
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherFailedToLoadOnlineFirmware'));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -402,13 +401,13 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
STM32.connect(port, baud, parsed_hex, options);
|
||||
} else {
|
||||
console.log('Please select valid serial port');
|
||||
GUI.log(chrome.i18n.getMessage('selectValidSerialPort'));
|
||||
GUI.log(localization.getMessage('selectValidSerialPort'));
|
||||
}
|
||||
} else {
|
||||
STM32DFU.connect(usbDevices, parsed_hex, options);
|
||||
}
|
||||
} else {
|
||||
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
|
||||
$('span.progressLabel').text(localization.getMessage('firmwareFlasherFirmwareNotLoaded'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -452,15 +451,15 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
});
|
||||
} else {
|
||||
console.log('You don\'t have write permissions for this file, sorry.');
|
||||
GUI.log(chrome.i18n.getMessage('writePermissionsForFile'));
|
||||
GUI.log(localization.getMessage('writePermissionsForFile'));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
chrome.storage.local.get('no_reboot_sequence', function (result) {
|
||||
if (result.no_reboot_sequence) {
|
||||
|
||||
if (store.get('no_reboot_sequence', false)) {
|
||||
$('input.updating').prop('checked', true);
|
||||
$('.flash_on_connect_wrapper').show();
|
||||
} else {
|
||||
|
@ -478,13 +477,13 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
$('.flash_on_connect_wrapper').hide();
|
||||
}
|
||||
|
||||
chrome.storage.local.set({'no_reboot_sequence': status});
|
||||
store.set('no_reboot_sequence', status);
|
||||
});
|
||||
|
||||
$('input.updating').change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_manual_baud', function (result) {
|
||||
|
||||
store.get('flash_manual_baud', function (result) {
|
||||
if (result.flash_manual_baud) {
|
||||
$('input.flash_manual_baud').prop('checked', true);
|
||||
} else {
|
||||
|
@ -494,26 +493,25 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
// bind UI hook so the status is saved on change
|
||||
$('input.flash_manual_baud').change(function() {
|
||||
var status = $(this).is(':checked');
|
||||
chrome.storage.local.set({'flash_manual_baud': status});
|
||||
store.set('flash_manual_baud', status);
|
||||
});
|
||||
|
||||
$('input.flash_manual_baud').change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_manual_baud_rate', function (result) {
|
||||
$('#flash_manual_baud_rate').val(result.flash_manual_baud_rate);
|
||||
var flash_manual_baud_rate = store.get('flash_manual_baud_rate', '');
|
||||
$('#flash_manual_baud_rate').val(flash_manual_baud_rate);
|
||||
|
||||
// bind UI hook so the status is saved on change
|
||||
$('#flash_manual_baud_rate').change(function() {
|
||||
var baud = parseInt($('#flash_manual_baud_rate').val());
|
||||
chrome.storage.local.set({'flash_manual_baud_rate': baud});
|
||||
store.set('flash_manual_baud_rate', baud);
|
||||
});
|
||||
|
||||
$('input.flash_manual_baud_rate').change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_on_connect', function (result) {
|
||||
if (result.flash_on_connect) {
|
||||
|
||||
if (store.get('flash_on_connect', false)) {
|
||||
$('input.flash_on_connect').prop('checked', true);
|
||||
} else {
|
||||
$('input.flash_on_connect').prop('checked', false);
|
||||
|
@ -549,12 +547,12 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
PortHandler.flush_callbacks();
|
||||
}
|
||||
|
||||
chrome.storage.local.set({'flash_on_connect': status});
|
||||
store.set('flash_on_connect', status);
|
||||
}).change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('erase_chip', function (result) {
|
||||
if (result.erase_chip) {
|
||||
|
||||
|
||||
if (store.get('erase_chip', false)) {
|
||||
$('input.erase_chip').prop('checked', true);
|
||||
} else {
|
||||
$('input.erase_chip').prop('checked', false);
|
||||
|
@ -562,12 +560,12 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
|
||||
// bind UI hook so the status is saved on change
|
||||
$('input.erase_chip').change(function () {
|
||||
chrome.storage.local.set({'erase_chip': $(this).is(':checked')});
|
||||
store.set('erase_chip', $(this).is(':checked'));
|
||||
});
|
||||
|
||||
$('input.erase_chip').change();
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(document).keypress(function (e) {
|
||||
if (e.which == 13) { // enter
|
||||
|
@ -635,14 +633,14 @@ TABS.firmware_flasher.cleanup = function (callback) {
|
|||
};
|
||||
|
||||
TABS.firmware_flasher.getTarget = function() {
|
||||
GUI.log(chrome.i18n.getMessage('automaticTargetSelect'));
|
||||
GUI.log(localization.getMessage('automaticTargetSelect'));
|
||||
|
||||
var selected_baud = parseInt($('#baud').val());
|
||||
var selected_port = $('#port').find('option:selected').data().isManual ? $('#port-override').val() : String($('#port').val());
|
||||
|
||||
if (selected_port !== 'DFU') {
|
||||
if (selected_port == '0') {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFailNoPort'));
|
||||
if (!selected_port || selected_port == '0') {
|
||||
GUI.log(localization.getMessage('targetPrefetchFailNoPort'));
|
||||
} else {
|
||||
console.log('Connecting to: ' + selected_port);
|
||||
GUI.connecting_to = selected_port;
|
||||
|
@ -654,7 +652,7 @@ TABS.firmware_flasher.getTarget = function() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFailDFU'));
|
||||
GUI.log(localization.getMessage('targetPrefetchFailDFU'));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -666,27 +664,27 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
|||
GUI.connecting_to = false;
|
||||
|
||||
// save selected port with chrome.storage if the port differs
|
||||
chrome.storage.local.get('last_used_port', function (result) {
|
||||
if (result.last_used_port) {
|
||||
if (result.last_used_port != GUI.connected_to) {
|
||||
var last_used_port = store.get('last_used_port', '');
|
||||
if (last_used_port) {
|
||||
if (last_used_port != GUI.connected_to) {
|
||||
// last used port doesn't match the one found in local db, we will store the new one
|
||||
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||
store.set('last_used_port', GUI.connected_to);
|
||||
}
|
||||
} else {
|
||||
// variable isn't stored yet, saving
|
||||
chrome.storage.local.set({'last_used_port': GUI.connected_to});
|
||||
store.set('last_used_port', GUI.connected_to);
|
||||
}
|
||||
});
|
||||
|
||||
chrome.storage.local.set({last_used_bps: CONFIGURATOR.connection.bitrate});
|
||||
chrome.storage.local.set({wireless_mode_enabled: $('#wireless-mode').is(":checked")});
|
||||
|
||||
store.set('last_used_bps', CONFIGURATOR.connection.bitrate);
|
||||
store.set('wireless_mode_enabled', $('#wireless-mode').is(":checked"));
|
||||
|
||||
CONFIGURATOR.connection.addOnReceiveListener(read_serial);
|
||||
|
||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||
helper.timeout.add('connecting', function () {
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFail') + chrome.i18n.getMessage('noConfigurationReceived'));
|
||||
GUI.log(localization.getMessage('targetPrefetchFail') + localization.getMessage('noConfigurationReceived'));
|
||||
|
||||
TABS.firmware_flasher.closeTempConnection();
|
||||
}
|
||||
|
@ -700,7 +698,7 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
|||
MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, function () {
|
||||
|
||||
if (CONFIG.apiVersion === "0.0.0") {
|
||||
GUI_control.prototype.log("Cannot prefetch target: <span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
GUI_control.prototype.log("Cannot prefetch target: <span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("illegalStateRestartRequired") + "</strong></span>");
|
||||
FC.restartRequired = true;
|
||||
return;
|
||||
}
|
||||
|
@ -709,7 +707,7 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
|||
if (CONFIG.flightControllerIdentifier == 'INAV') {
|
||||
MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function () {
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "5.0.0")) {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFailOld'));
|
||||
GUI.log(localization.getMessage('targetPrefetchFailOld'));
|
||||
TABS.firmware_flasher.closeTempConnection();
|
||||
} else {
|
||||
mspHelper.getCraftName(function(name) {
|
||||
|
@ -721,13 +719,13 @@ TABS.firmware_flasher.onOpen = function(openInfo) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFailNonINAV'));
|
||||
GUI.log(localization.getMessage('targetPrefetchFailNonINAV'));
|
||||
TABS.firmware_flasher.closeTempConnection();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchFail') + chrome.i18n.getMessage('serialPortOpenFail'));
|
||||
GUI.log(localization.getMessage('targetPrefetchFail') + localization.getMessage('serialPortOpenFail'));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -736,7 +734,7 @@ TABS.firmware_flasher.onValidFirmware = function() {
|
|||
MSP.send_message(MSPCodes.MSP_BUILD_INFO, false, false, function () {
|
||||
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, function () {
|
||||
$('select[name="board"] option[value=' + CONFIG.target + ']').attr("selected", "selected");
|
||||
GUI.log(chrome.i18n.getMessage('targetPrefetchsuccessful') + CONFIG.target);
|
||||
GUI.log(localization.getMessage('targetPrefetchsuccessful') + CONFIG.target);
|
||||
|
||||
TABS.firmware_flasher.closeTempConnection();
|
||||
$('select[name="board"]').change();
|
||||
|
|
160
tabs/gps.js
160
tabs/gps.js
|
@ -1,4 +1,4 @@
|
|||
/*global $,MSPChainerClass,googleAnalytics,mspHelper,MSPCodes,GUI,chrome,MSP,TABS,Settings,helper,ol*/
|
||||
/*global $,MSPChainerClass,mspHelper,MSPCodes,GUI,chrome,MSP,TABS,Settings,helper,ol*/
|
||||
'use strict';
|
||||
|
||||
TABS.gps = {};
|
||||
|
@ -6,35 +6,8 @@ TABS.gps.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'gps') {
|
||||
GUI.active_tab = 'gps';
|
||||
googleAnalytics.sendAppView('GPS');
|
||||
}
|
||||
|
||||
// mavlink ADSB_EMITTER_TYPE
|
||||
const ADSB_VEHICLE_TYPE = {
|
||||
0: 'adsb_14.png', // ADSB_EMITTER_TYPE_NO_INFO
|
||||
1: 'adsb_1.png', // ADSB_EMITTER_TYPE_LIGHT
|
||||
2: 'adsb_1.png', // ADSB_EMITTER_TYPE_SMALL
|
||||
3: 'adsb_2.png', // ADSB_EMITTER_TYPE_LARGE
|
||||
4: 'adsb_14.png', // ADSB_EMITTER_TYPE_HIGH_VORTEX_LARGE
|
||||
5: 'adsb_5.png', // ADSB_EMITTER_TYPE_HEAVY
|
||||
6: 'adsb_14.png', // ADSB_EMITTER_TYPE_HIGHLY_MANUV
|
||||
7: 'adsb_13.png', // ADSB_EMITTER_TYPE_ROTOCRAFT
|
||||
8: 'adsb_14.png', // ADSB_EMITTER_TYPE_UNASSIGNED
|
||||
9: 'adsb_6.png', // ADSB_EMITTER_TYPE_GLIDER
|
||||
10: 'adsb_7.png', // ADSB_EMITTER_TYPE_LIGHTER_AIR
|
||||
11: 'adsb_15.png', // ADSB_EMITTER_TYPE_PARACHUTE
|
||||
12: 'adsb_1.png', // ADSB_EMITTER_TYPE_ULTRA_LIGHT
|
||||
13: 'adsb_14.png', // ADSB_EMITTER_TYPE_UNASSIGNED2
|
||||
14: 'adsb_8.png', // ADSB_EMITTER_TYPE_UAV
|
||||
15: 'adsb_14.png', // ADSB_EMITTER_TYPE_SPACE
|
||||
16: 'adsb_14.png', // ADSB_EMITTER_TYPE_UNASSGINED3
|
||||
17: 'adsb_9.png', // ADSB_EMITTER_TYPE_EMERGENCY_SURFACE
|
||||
18: 'adsb_10.png', // ADSB_EMITTER_TYPE_SERVICE_SURFACE
|
||||
19: 'adsb_12.png', // ADSB_EMITTER_TYPE_POINT_OBSTACLE
|
||||
};
|
||||
|
||||
|
||||
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
||||
var loadChain = [
|
||||
|
@ -63,19 +36,19 @@ TABS.gps.initialize = function (callback) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_gps a'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/gps.html", Settings.processHtml(process_html));
|
||||
GUI.load(path.join(__dirname, "tabs/gps.html"), Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
let cursorInitialized = false;
|
||||
|
@ -84,12 +57,8 @@ TABS.gps.initialize = function (callback) {
|
|||
let iconGeometry;
|
||||
let iconFeature;
|
||||
|
||||
let vehicleVectorSource;
|
||||
let vehiclesCursorInitialized = false;
|
||||
|
||||
|
||||
function process_html() {
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
var features = FC.getFeatures();
|
||||
|
||||
|
@ -100,7 +69,7 @@ TABS.gps.initialize = function (callback) {
|
|||
var gpsSbas = FC.getGpsSbasProviders();
|
||||
|
||||
var gps_protocol_e = $('#gps_protocol');
|
||||
for (i = 0; i < gpsProtocols.length; i++) {
|
||||
for (let i = 0; i < gpsProtocols.length; i++) {
|
||||
gps_protocol_e.append('<option value="' + i + '">' + gpsProtocols[i] + '</option>');
|
||||
}
|
||||
|
||||
|
@ -112,7 +81,7 @@ TABS.gps.initialize = function (callback) {
|
|||
gps_protocol_e.change();
|
||||
|
||||
var gps_ubx_sbas_e = $('#gps_ubx_sbas');
|
||||
for (i = 0; i < gpsSbas.length; i++) {
|
||||
for (let i = 0; i < gpsSbas.length; i++) {
|
||||
gps_ubx_sbas_e.append('<option value="' + i + '">' + gpsSbas[i] + '</option>');
|
||||
}
|
||||
|
||||
|
@ -161,36 +130,6 @@ TABS.gps.initialize = function (callback) {
|
|||
view: mapView
|
||||
});
|
||||
|
||||
TABS.gps.toolboxAdsbVehicle = new jBox('Mouse', {
|
||||
position: {
|
||||
x: "right",
|
||||
y: "bottom"
|
||||
},
|
||||
offset: {
|
||||
x: -5,
|
||||
y: 20,
|
||||
},
|
||||
});
|
||||
|
||||
mapHandler.on('pointermove', function(evt) {
|
||||
var feature = mapHandler.forEachFeatureAtPixel(mapHandler.getEventPixel(evt.originalEvent), function(feature, layer) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
if (feature) {
|
||||
TABS.gps.toolboxAdsbVehicle.setContent(
|
||||
`icao: <strong>` + feature.get('name') + `</strong><br />`
|
||||
+ `lat: <strong>`+ (feature.get('data').lat / 10000000) + `</strong><br />`
|
||||
+ `lon: <strong>`+ (feature.get('data').lon / 10000000) + `</strong><br />`
|
||||
+ `ASL: <strong>`+ (feature.get('data').altCM ) / 100 + `m</strong><br />`
|
||||
+ `heading: <strong>`+ feature.get('data').headingDegrees + `°</strong><br />`
|
||||
+ `type: <strong>`+ feature.get('data').emitterType + `</strong>`
|
||||
).open();
|
||||
}else{
|
||||
TABS.gps.toolboxAdsbVehicle.close();
|
||||
}
|
||||
});
|
||||
|
||||
let center = ol.proj.fromLonLat([0, 0]);
|
||||
mapView.setCenter(center);
|
||||
mapView.setZoom(2);
|
||||
|
@ -212,11 +151,11 @@ TABS.gps.initialize = function (callback) {
|
|||
let lat = GPS_DATA.lat / 10000000;
|
||||
let lon = GPS_DATA.lon / 10000000;
|
||||
|
||||
let gpsFixType = chrome.i18n.getMessage('gpsFixNone');
|
||||
let gpsFixType = localization.getMessage('gpsFixNone');
|
||||
if (GPS_DATA.fix >= 2) {
|
||||
gpsFixType = chrome.i18n.getMessage('gpsFix3D');
|
||||
gpsFixType = localization.getMessage('gpsFix3D');
|
||||
} else if (GPS_DATA.fix >= 1) {
|
||||
gpsFixType = chrome.i18n.getMessage('gpsFix2D');
|
||||
gpsFixType = localization.getMessage('gpsFix2D');
|
||||
}
|
||||
|
||||
$('.GPS_info td.fix').html(gpsFixType);
|
||||
|
@ -253,7 +192,7 @@ TABS.gps.initialize = function (callback) {
|
|||
anchor: [0.5, 1],
|
||||
opacity: 1,
|
||||
scale: 0.5,
|
||||
src: '../images/icons/cf_icon_position.png'
|
||||
src: '../../images/icons/cf_icon_position.png'
|
||||
}))
|
||||
});
|
||||
|
||||
|
@ -281,66 +220,6 @@ TABS.gps.initialize = function (callback) {
|
|||
iconGeometry.setCoordinates(center);
|
||||
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "7.1.0")) {
|
||||
MSP.send_message(MSPCodes.MSP2_ADSB_VEHICLE_LIST, false, false, function () {
|
||||
//ADSB vehicles
|
||||
|
||||
if (vehiclesCursorInitialized) {
|
||||
vehicleVectorSource.clear();
|
||||
}
|
||||
|
||||
for (let key in ADSB_VEHICLES.vehicles) {
|
||||
let vehicle = ADSB_VEHICLES.vehicles[key];
|
||||
|
||||
if (!vehiclesCursorInitialized) {
|
||||
vehiclesCursorInitialized = true;
|
||||
|
||||
vehicleVectorSource = new ol.source.Vector({});
|
||||
|
||||
let vehicleLayer = new ol.layer.Vector({
|
||||
source: vehicleVectorSource
|
||||
});
|
||||
|
||||
mapHandler.addLayer(vehicleLayer);
|
||||
}
|
||||
|
||||
if (vehicle.lat > 0 && vehicle.lon > 0 && vehicle.ttl > 0) {
|
||||
let vehicleIconStyle = new ol.style.Style({
|
||||
image: new ol.style.Icon(({
|
||||
opacity: 1,
|
||||
rotation: vehicle.headingDegrees * (Math.PI / 180),
|
||||
scale: 0.8,
|
||||
anchor: [0.5, 0.5],
|
||||
src: '../resources/adsb/' + ADSB_VEHICLE_TYPE[vehicle.emitterType],
|
||||
})),
|
||||
text: new ol.style.Text(({
|
||||
text: vehicle.callsign,
|
||||
textAlign: 'center',
|
||||
textBaseline: "bottom",
|
||||
offsetY: +40,
|
||||
padding: [2, 2, 2, 2],
|
||||
backgroundFill: '#444444',
|
||||
fill: new ol.style.Fill({color: '#ffffff'}),
|
||||
})),
|
||||
});
|
||||
|
||||
|
||||
let iconGeometry = new ol.geom.Point(ol.proj.fromLonLat([vehicle.lon / 10000000, vehicle.lat / 10000000]));
|
||||
let iconFeature = new ol.Feature({
|
||||
geometry: iconGeometry,
|
||||
name: vehicle.callsign,
|
||||
type: 'adsb',
|
||||
data: vehicle,
|
||||
});
|
||||
|
||||
iconFeature.setStyle(vehicleIconStyle);
|
||||
vehicleVectorSource.addFeature(iconFeature);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -363,20 +242,6 @@ TABS.gps.initialize = function (callback) {
|
|||
|
||||
|
||||
$('a.save').on('click', function () {
|
||||
if (FC.isFeatureEnabled('GPS', features)) {
|
||||
googleAnalytics.sendEvent('Setting', 'GpsProtocol', gpsProtocols[MISC.gps_type]);
|
||||
googleAnalytics.sendEvent('Setting', 'GpsSbas', gpsSbas[MISC.gps_ubx_sbas]);
|
||||
}
|
||||
|
||||
googleAnalytics.sendEvent('Setting', 'GPSEnabled', FC.isFeatureEnabled('GPS', features) ? "true" : "false");
|
||||
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
var featureName = features[i].name;
|
||||
if (FC.isFeatureEnabled(featureName, features)) {
|
||||
googleAnalytics.sendEvent('Setting', 'Feature', featureName);
|
||||
}
|
||||
}
|
||||
|
||||
helper.features.reset();
|
||||
helper.features.fromUI($('.tab-gps'));
|
||||
helper.features.execute(function () {
|
||||
|
@ -391,7 +256,4 @@ TABS.gps.initialize = function (callback) {
|
|||
|
||||
TABS.gps.cleanup = function (callback) {
|
||||
if (callback) callback();
|
||||
if(TABS.gps.toolboxAdsbVehicle){
|
||||
TABS.gps.toolboxAdsbVehicle.close();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="content_wrapper">
|
||||
<div class="content_top">
|
||||
<div class="logowrapper" align="center">
|
||||
<img src="../images/cf_logo_white.svg" />
|
||||
<img src="images/cf_logo_white.svg" />
|
||||
<div class="" i18n="defaultWelcomeIntro" align="center"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
'use strict';
|
||||
/*global $,TABS,GUI,googleAnalytics*/
|
||||
|
||||
/*global $,TABS,GUI*/
|
||||
|
||||
TABS.landing = {};
|
||||
TABS.landing.initialize = function (callback) {
|
||||
|
||||
if (GUI.active_tab != 'landing') {
|
||||
GUI.active_tab = 'landing';
|
||||
googleAnalytics.sendAppView('Landing');
|
||||
}
|
||||
|
||||
GUI.load("./tabs/landing.html", function () {
|
||||
localize();
|
||||
GUI.load(path.join(__dirname, "tabs/landing.html"), function () {
|
||||
localization.localize();
|
||||
|
||||
$('.tab-landing a').click(function () {
|
||||
googleAnalytics.sendEvent('ExternalUrls', 'Click', $(this).prop('href'));
|
||||
// googleAnalytics.sendEvent('ExternalUrls', 'Click', $(this).prop('href'));
|
||||
});
|
||||
|
||||
GUI.content_ready(callback);
|
||||
|
|
|
@ -19,7 +19,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (GUI.active_tab != 'led_strip') {
|
||||
GUI.active_tab = 'led_strip';
|
||||
googleAnalytics.sendAppView('LED Strip');
|
||||
}
|
||||
|
||||
function load_led_config() {
|
||||
|
@ -35,7 +34,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/led_strip.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/led_strip.html"), process_html);
|
||||
}
|
||||
|
||||
load_led_config();
|
||||
|
@ -55,7 +54,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function process_html() {
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// Build Grid
|
||||
var theHTML = [];
|
||||
|
@ -539,7 +538,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('ledStripEepromSaved'));
|
||||
GUI.log(localization.getMessage('ledStripEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ TABS.logging.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'logging') {
|
||||
GUI.active_tab = 'logging';
|
||||
googleAnalytics.sendAppView('Logging');
|
||||
}
|
||||
|
||||
var requested_properties = [],
|
||||
|
@ -24,7 +23,7 @@ TABS.logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
var load_html = function () {
|
||||
GUI.load("./tabs/logging.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/logging.html"), process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_RC, false, false, get_motor_data);
|
||||
|
@ -32,7 +31,7 @@ TABS.logging.initialize = function (callback) {
|
|||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// UI hooks
|
||||
$('a.log_file').click(prepare_file);
|
||||
|
@ -85,24 +84,24 @@ TABS.logging.initialize = function (callback) {
|
|||
}, 1000);
|
||||
|
||||
$('.speed').prop('disabled', true);
|
||||
$(this).text(chrome.i18n.getMessage('loggingStop'));
|
||||
$(this).text(localization.getMessage('loggingStop'));
|
||||
$(this).data("clicks", !clicks);
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('loggingErrorOneProperty'));
|
||||
GUI.log(localization.getMessage('loggingErrorOneProperty'));
|
||||
}
|
||||
} else {
|
||||
helper.interval.killAll(['global_data_refresh', 'msp-load-update']);
|
||||
helper.mspBalancedInterval.flush();
|
||||
|
||||
$('.speed').prop('disabled', false);
|
||||
$(this).text(chrome.i18n.getMessage('loggingStart'));
|
||||
$(this).text(localization.getMessage('loggingStart'));
|
||||
$(this).data("clicks", !clicks);
|
||||
}
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('loggingErrorLogFile'));
|
||||
GUI.log(localization.getMessage('loggingErrorLogFile'));
|
||||
}
|
||||
} else {
|
||||
GUI.log(chrome.i18n.getMessage('loggingErrorNotConnected'));
|
||||
GUI.log(localization.getMessage('loggingErrorNotConnected'));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -235,10 +234,9 @@ TABS.logging.initialize = function (callback) {
|
|||
nwdialog.saveFileDialog(filename, accepts, '', function(file) {
|
||||
loggingFileName = file;
|
||||
readyToWrite = true;
|
||||
chrome.storage.local.set({
|
||||
'logging_file_name': loggingFileName,
|
||||
'logging_file_ready': readyToWrite
|
||||
});
|
||||
store.set('logging_file_name', loggingFileName);
|
||||
store.set('logging_file_ready', readyToWrite);
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'magnetometer') {
|
||||
GUI.active_tab = 'magnetometer';
|
||||
googleAnalytics.sendAppView('MAGNETOMETER');
|
||||
}
|
||||
|
||||
self.alignmentConfig = {
|
||||
|
@ -126,7 +125,7 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
|
@ -134,12 +133,12 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function reinitialize() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_magnetometer a'));
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/magnetometer.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/magnetometer.html"), process_html);
|
||||
}
|
||||
|
||||
function generateRange(min, max, step) {
|
||||
|
@ -292,7 +291,7 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
|
||||
function process_html() {
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// initialize 3D
|
||||
self.initialize3D();
|
||||
|
@ -318,7 +317,7 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
self.pitch_e = $('dd.pitch'),
|
||||
self.heading_e = $('dd.heading');
|
||||
|
||||
for (i = 0; i < alignments.length; i++) {
|
||||
for (let i = 0; i < alignments.length; i++) {
|
||||
self.pageElements.orientation_mag_e.append('<option value="' + (i + 1) + '">' + alignments[i] + '</option>');
|
||||
}
|
||||
self.pageElements.orientation_mag_e.val(SENSOR_ALIGNMENT.align_mag);
|
||||
|
@ -518,9 +517,9 @@ TABS.magnetometer.initialize = function (callback) {
|
|||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
||||
self.roll_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
|
||||
self.pitch_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
|
||||
self.heading_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
|
||||
self.roll_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
|
||||
self.pitch_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
|
||||
self.heading_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
|
||||
self.render3D();
|
||||
});
|
||||
}
|
||||
|
@ -573,7 +572,7 @@ TABS.magnetometer.initialize3D = function () {
|
|||
if (useWebGlRenderer) {
|
||||
if (MIXER_CONFIG.appliedMixerPreset === -1) {
|
||||
model_file = 'custom';
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("mixerNotConfigured") + "</strong></span>");
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("mixerNotConfigured") + "</strong></span>");
|
||||
}
|
||||
else {
|
||||
model_file = helper.mixer.getById(MIXER_CONFIG.appliedMixerPreset).model;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<a id="saveFileMissionButton" class="btnicon ic_save2File" href="#" i18n_title="missionTitleSaveMissionFile"></a>
|
||||
</div>
|
||||
<div class="btn save_btn">
|
||||
<a id="loadMissionButton" class="btnicon ic_loadFromFC" href="#" i18n_title="missionTitleLoadMissionFromFC" </a>
|
||||
<a id="saveMissionButton" class="btnicon ic_save2FC" href="#" i18n_title="missionTitleSaveMissionToFC" </a>
|
||||
<a id="loadMissionButton" class="btnicon ic_loadFromFC" href="#" i18n_title="missionTitleLoadMissionFromFC"> </a>
|
||||
<a id="saveMissionButton" class="btnicon ic_save2FC" href="#" i18n_title="missionTitleSaveMissionToFC"> </a>
|
||||
<a id="loadEepromMissionButton" class="btnicon ic_loadFromEprom" href="#" i18n_title="missionTitleLoadEepromMission"></a>
|
||||
<a id="saveEepromMissionButton" class="btnicon ic_save2Eprom" href="#" i18n_title="missionTitleSaveEepromMission"></a>
|
||||
</div>
|
||||
|
@ -166,7 +166,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="point" id="elevationEarthModelclass" style="display: none">
|
||||
<label class="spacer_box_title" for="elevationEarthModel" data-i18n="missionEllipsoidEarthDEMModel"></label>
|
||||
<label class="spacer_box_title" for="elevationEarthModel" data-i18n="missionLevelEarthDEMModel"></label>
|
||||
<input id="elevationEarthModel" type="checkbox" value="0" class="togglemedium" required>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -80,9 +80,13 @@ TABS.mission_control.initialize = function (callback) {
|
|||
let isOffline = false;
|
||||
let rthUpdateInterval = 0;
|
||||
|
||||
var $safehomesTable;
|
||||
var $safehomesTableBody;
|
||||
var $waypointOptionsTable;
|
||||
var $waypointOptionsTableBody;
|
||||
|
||||
if (GUI.active_tab != 'mission_control') {
|
||||
GUI.active_tab = 'mission_control';
|
||||
googleAnalytics.sendAppView('Mission Control');
|
||||
}
|
||||
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
|
@ -101,7 +105,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function loadHtml() {
|
||||
GUI.load("./tabs/mission_control.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/mission_control.html"), process_html);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
|
@ -130,7 +134,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#missionMap, #missionControls').hide();
|
||||
$('#notLoadMap').show();
|
||||
}
|
||||
localize();
|
||||
localization.localize();
|
||||
|
||||
function get_raw_gps_data() {
|
||||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, get_comp_gps_data);
|
||||
|
@ -167,7 +171,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
anchor: [0.5, 0.5],
|
||||
opacity: 1,
|
||||
scale: 0.6,
|
||||
src: '../images/icons/icon_mission_airplane.png'
|
||||
src: 'images/icons/icon_mission_airplane.png'
|
||||
}))
|
||||
});
|
||||
|
||||
|
@ -194,7 +198,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
anchor: [0.5, 1.0],
|
||||
opacity: 1,
|
||||
scale: 0.5,
|
||||
src: '../images/icons/cf_icon_RTH.png'
|
||||
src: '/images/icons/cf_icon_RTH.png'
|
||||
}))
|
||||
});
|
||||
|
||||
|
@ -364,15 +368,24 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init parameters for default Settings
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var settings = {speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : 0, bingDemModel : false};
|
||||
|
||||
var vMaxDistSH = 0;
|
||||
var settings = {};
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
mspHelper.getSetting("safehome_max_distance").then(function (s) {
|
||||
if (s) {
|
||||
settings.maxDistSH = Number(s.value)/100;
|
||||
vMaxDistSH = Number(s.value)/100;
|
||||
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||
}
|
||||
else {
|
||||
vMaxDistSH = 0;
|
||||
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
vMaxDistSH = 0;
|
||||
settings = { speed: 0, alt: 5000, safeRadiusSH : 50, maxDistSH : vMaxDistSH};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// define & init Waypoints parameters
|
||||
|
@ -426,16 +439,16 @@ TABS.mission_control.initialize = function (callback) {
|
|||
//
|
||||
/////////////////////////////////////////////
|
||||
function loadSettings() {
|
||||
chrome.storage.local.get('missionPlannerSettings', function (result) {
|
||||
if (result.missionPlannerSettings) {
|
||||
settings = result.missionPlannerSettings;
|
||||
var missionPlannerSettings = store.get('missionPlannerSettings', false);
|
||||
if (missionPlannerSettings) {
|
||||
settings = missionPlannerSettings;
|
||||
}
|
||||
refreshSettings();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
chrome.storage.local.set({'missionPlannerSettings': settings});
|
||||
store.set('missionPlannerSettings', settings);
|
||||
}
|
||||
|
||||
function refreshSettings() {
|
||||
|
@ -510,7 +523,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
GUI.switchery();
|
||||
localize();
|
||||
localization.localize();;
|
||||
}
|
||||
|
||||
|
||||
|
@ -539,7 +552,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
anchor: [0.5, 1],
|
||||
opacity: 1,
|
||||
scale: 0.5,
|
||||
src: '../images/icons/cf_icon_safehome' + (safehome.isUsed() ? '_used' : '')+ '.png'
|
||||
src: '/images/icons/cf_icon_safehome' + (safehome.isUsed() ? '_used' : '')+ '.png'
|
||||
})),
|
||||
text: new ol.style.Text(({
|
||||
text: String(Number(safehome.getNumber())+1),
|
||||
|
@ -670,7 +683,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
$('#elevationEarthModelclass').fadeIn(300);
|
||||
changeSwitchery($('#elevationEarthModel'), settings.bingDemModel);
|
||||
} else {
|
||||
$('#elevationEarthModelclass').fadeOut(300);
|
||||
}
|
||||
|
@ -724,7 +736,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
anchor: [0.5, 1],
|
||||
opacity: 1,
|
||||
scale: 0.5,
|
||||
src: '../images/icons/cf_icon_home.png'
|
||||
src: '/images/icons/cf_icon_home.png'
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
@ -875,7 +887,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
});
|
||||
|
||||
mission.reinit();
|
||||
tempMissionData = multimission.get().slice(startWPCount, endWPCount + 1); // copy selected single mission from MM
|
||||
var tempMissionData = multimission.get().slice(startWPCount, endWPCount + 1); // copy selected single mission from MM
|
||||
let i = 0;
|
||||
tempMissionData.forEach(function (element) { // write mission copy to active map mission
|
||||
mission.put(element);
|
||||
|
@ -948,7 +960,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
function fileLoadMultiMissionCheck() {
|
||||
if (singleMissionActive()) {
|
||||
return true;
|
||||
} else if (confirm(chrome.i18n.getMessage('confirm_overwrite_multimission_file_load_option'))) {
|
||||
} else if (confirm(localization.getMessage('confirm_overwrite_multimission_file_load_option'))) {
|
||||
nwdialog.setContext(document);
|
||||
nwdialog.openFileDialog(function(result) {
|
||||
loadMissionFile(result);
|
||||
|
@ -1029,7 +1041,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
anchor: [0.5, 1],
|
||||
opacity: 1,
|
||||
scale: 0.5,
|
||||
src: '../images/icons/cf_icon_position' + (dictofPointIcon[waypoint.getAction()] != '' ? '_'+dictofPointIcon[waypoint.getAction()] : '') + (isEdit ? '_edit' : '')+ '.png'
|
||||
src: './images/icons/cf_icon_position' + (dictofPointIcon[waypoint.getAction()] != '' ? '_'+dictofPointIcon[waypoint.getAction()] : '') + (isEdit ? '_edit' : '')+ '.png'
|
||||
})),
|
||||
text: new ol.style.Text(({
|
||||
text: String(Number(waypoint.getLayerNumber()+1)),
|
||||
|
@ -1171,7 +1183,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
featureArrow.setStyle(
|
||||
new ol.style.Style({
|
||||
image: new ol.style.Icon({
|
||||
src: '../images/icons/cf_icon_arrow.png',
|
||||
src: '/images/icons/cf_icon_arrow.png',
|
||||
scale: 0.3,
|
||||
anchor: [0.5, 0.5],
|
||||
rotateWithView: true,
|
||||
|
@ -1308,26 +1320,26 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if ($(this).val() >= 360 || ($(this).val() < 0 && $(this).val() != -1))
|
||||
{
|
||||
$(this).val(-1);
|
||||
alert(chrome.i18n.getMessage('MissionPlannerHeadSettingsCheck'));
|
||||
alert(localization.getMessage('MissionPlannerHeadSettingsCheck'));
|
||||
}
|
||||
}
|
||||
else if (MWNP.WPTYPE.REV[element.getAction()] == "RTH") {
|
||||
if ($(this).val() != 0 && $(this).val() != 1)
|
||||
{
|
||||
$(this).val(0);
|
||||
alert(chrome.i18n.getMessage('MissionPlannerRTHSettingsCheck'));
|
||||
alert(localization.getMessage('MissionPlannerRTHSettingsCheck'));
|
||||
}
|
||||
}
|
||||
else if (MWNP.WPTYPE.REV[element.getAction()] == "JUMP") {
|
||||
if ($(this).val() > mission.getNonAttachedList().length || $(this).val() < 1)
|
||||
{
|
||||
$(this).val(1);
|
||||
alert(chrome.i18n.getMessage('MissionPlannerJumpSettingsCheck'));
|
||||
alert(localization.getMessage('MissionPlannerJumpSettingsCheck'));
|
||||
}
|
||||
else if (mission.getPoiList().length != 0 && mission.getPoiList()) {
|
||||
if (mission.getPoiList().includes(mission.convertJumpNumberToWaypoint(Number($(this).val())-1))) {
|
||||
$(this).val(1);
|
||||
alert(chrome.i18n.getMessage('MissionPlannerJump3SettingsCheck'));
|
||||
alert(localization.getMessage('MissionPlannerJump3SettingsCheck'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1342,7 +1354,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if ($(this).val() > 10 || ($(this).val() < 0 && $(this).val() != -1))
|
||||
{
|
||||
$(this).val(0);
|
||||
alert(chrome.i18n.getMessage('MissionPlannerJump2SettingsCheck'));
|
||||
alert(localization.getMessage('MissionPlannerJump2SettingsCheck'));
|
||||
}
|
||||
}
|
||||
element.setP2(Number($(this).val()));
|
||||
|
@ -1355,7 +1367,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
});
|
||||
GUI.switchery();
|
||||
localize();
|
||||
localization.localize();;
|
||||
return waypoint;
|
||||
}
|
||||
|
||||
|
@ -1431,7 +1443,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var button = document.createElement('button');
|
||||
|
||||
button.innerHTML = ' ';
|
||||
button.style = 'background: url(\'../images/CF_settings_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
button.style = 'background: url(\'./images/CF_settings_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSettings = function () {
|
||||
$('#missionPlannerSettings').fadeIn(300);
|
||||
|
@ -1463,7 +1475,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var button = document.createElement('button');
|
||||
|
||||
button.innerHTML = ' ';
|
||||
button.style = 'background: url(\'../images/icons/cf_icon_safehome_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
button.style = 'background: url(\'./images/icons/cf_icon_safehome_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSafehome = function () {
|
||||
$('#missionPlannerSafehome').fadeIn(300);
|
||||
|
@ -1501,7 +1513,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var button = document.createElement('button');
|
||||
|
||||
button.innerHTML = ' ';
|
||||
button.style = 'background: url(\'../images/icons/cf_icon_elevation_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
button.style = 'background: url(\'./images/icons/cf_icon_elevation_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSettings = function () {
|
||||
$('#missionPlannerHome').fadeIn(300);
|
||||
|
@ -1538,7 +1550,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var button = document.createElement('button');
|
||||
|
||||
button.innerHTML = ' ';
|
||||
button.style = 'background: url(\'../images/icons/cf_icon_multimission_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
button.style = 'background: url(\'./images/icons/cf_icon_multimission_white.svg\') no-repeat 1px -1px;background-color: rgba(0,60,136,.5);';
|
||||
|
||||
var handleShowSettings = function () {
|
||||
$('#missionPlannerMultiMission').fadeIn(300);
|
||||
|
@ -1693,6 +1705,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
var lon = (GPS_DATA ? (GPS_DATA.lon / 10000000) : 0);
|
||||
|
||||
let mapLayer;
|
||||
let control_list;
|
||||
|
||||
if (globalSettings.mapProviderType == 'bing') {
|
||||
mapLayer = new ol.source.BingMaps({
|
||||
|
@ -1759,20 +1772,20 @@ TABS.mission_control.initialize = function (callback) {
|
|||
// save map view settings when user moves it
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
map.on('moveend', function (evt) {
|
||||
chrome.storage.local.set({'missionPlannerLastValues': {
|
||||
store.set('missionPlannerLastValues', {
|
||||
center: ol.proj.toLonLat(map.getView().getCenter()),
|
||||
zoom: map.getView().getZoom()
|
||||
}});
|
||||
});
|
||||
});
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// load map view settings on startup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
chrome.storage.local.get('missionPlannerLastValues', function (result) {
|
||||
if (result.missionPlannerLastValues && result.missionPlannerLastValues.center) {
|
||||
map.getView().setCenter(ol.proj.fromLonLat(result.missionPlannerLastValues.center));
|
||||
map.getView().setZoom(result.missionPlannerLastValues.zoom);
|
||||
var missionPlannerLastValues = store.get('missionPlannerLastValues', false);
|
||||
if (missionPlannerLastValues && missionPlannerLastValues.zoom && missionPlannerLastValues.center) {
|
||||
map.getView().setCenter(ol.proj.fromLonLat(missionPlannerLastValues.center));
|
||||
map.getView().setZoom(missionPlannerLastValues.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Map on-click behavior definition
|
||||
|
@ -1789,7 +1802,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
clearEditForm();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
GUI.log(chrome.i18n.getMessage('notAWAYPOINT'));
|
||||
GUI.log(localization.getMessage('notAWAYPOINT'));
|
||||
}
|
||||
}
|
||||
selectedFeature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
|
@ -1856,7 +1869,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
else if (selectedFeature && tempMarker.kind == "line" && tempMarker.selection && !disableMarkerEdit) {
|
||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||
let tempWp = new Waypoint(tempMarker.number, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||
let tempWp = new Waypoint(tempMarker.number, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), Number(settings.alt), Number(settings.speed));
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
(async () => {
|
||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||
|
@ -1891,7 +1904,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
else if (!disableMarkerEdit) {
|
||||
let tempWpCoord = ol.proj.toLonLat(evt.coordinate);
|
||||
let tempWp = new Waypoint(mission.get().length, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), alt=Number(settings.alt), p1=Number(settings.speed));
|
||||
let tempWp = new Waypoint(mission.get().length, MWNP.WPTYPE.WAYPOINT, Math.round(tempWpCoord[1] * 10000000), Math.round(tempWpCoord[0] * 10000000), Number(settings.alt), Number(settings.speed));
|
||||
if (homeMarkers.length && HOME.getAlt() != "N/A") {
|
||||
(async () => {
|
||||
const elevationAtWP = await tempWp.getElevation(globalSettings);
|
||||
|
@ -2105,7 +2118,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#pointP3Alt').on('change', function (event) {
|
||||
if (selectedMarker) {
|
||||
P3Value = selectedMarker.getP3();
|
||||
var P3Value = selectedMarker.getP3();
|
||||
|
||||
if (disableMarkerEdit) {
|
||||
changeSwitchery($('#pointP3Alt'), TABS.mission_control.isBitSet(P3Value, MWNP.P3.ALT_TYPE));
|
||||
|
@ -2116,30 +2129,22 @@ TABS.mission_control.initialize = function (callback) {
|
|||
const elevationAtWP = await selectedMarker.getElevation(globalSettings);
|
||||
$('#elevationValueAtWP').text(elevationAtWP);
|
||||
var altitude = Number($('#pointAlt').val());
|
||||
|
||||
if (P3Value != selectedMarker.getP3()) {
|
||||
selectedMarker.setP3(P3Value);
|
||||
|
||||
let groundClearance = 100 * Number($('#groundClearanceValueAtWP').text());
|
||||
if (isNaN(groundClearance)) {
|
||||
groundClearance = settings.alt; // use default altitude if no current ground clearance
|
||||
}
|
||||
|
||||
if ($('#pointP3Alt').prop("checked")) {
|
||||
selectedMarker.setAlt(groundClearance + elevationAtWP * 100);
|
||||
if (altitude < 0) {
|
||||
altitude = settings.alt;
|
||||
}
|
||||
selectedMarker.setAlt(altitude + elevationAtWP * 100);
|
||||
} else {
|
||||
let elevationAtHome = HOME.getAlt();
|
||||
if (isNaN(elevationAtHome)) {
|
||||
elevationAtHome = elevationAtWP;
|
||||
}
|
||||
selectedMarker.setAlt(groundClearance + 100 * (elevationAtWP - elevationAtHome));
|
||||
selectedMarker.setAlt(altitude - Number(elevationAtWP) * 100);
|
||||
}
|
||||
}
|
||||
|
||||
const returnAltitude = checkAltElevSanity(false, selectedMarker.getAlt(), elevationAtWP, selectedMarker.getP3());
|
||||
selectedMarker.setAlt(returnAltitude);
|
||||
$('#pointAlt').val(selectedMarker.getAlt());
|
||||
altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||
var altitudeMeters = app.ConvertCentimetersToMeters(selectedMarker.getAlt());
|
||||
$('#altitudeInMeters').text(` ${altitudeMeters}m`);
|
||||
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
|
@ -2156,7 +2161,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
changeSwitchery($('#pointP3UserAction1'), TABS.mission_control.isBitSet(selectedMarker.getP3(), MWNP.P3.USER_ACTION_1));
|
||||
}
|
||||
|
||||
P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_1, $('#pointP3UserAction1').prop("checked"));
|
||||
var P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_1, $('#pointP3UserAction1').prop("checked"));
|
||||
selectedMarker.setP3(P3Value);
|
||||
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
|
@ -2171,7 +2176,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
changeSwitchery($('#pointP3UserAction2'), TABS.mission_control.isBitSet(selectedMarker.getP3(), MWNP.P3.USER_ACTION_2));
|
||||
}
|
||||
|
||||
P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_2, $('#pointP3UserAction2').prop("checked"));
|
||||
var P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_2, $('#pointP3UserAction2').prop("checked"));
|
||||
selectedMarker.setP3(P3Value);
|
||||
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
|
@ -2186,7 +2191,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
changeSwitchery($('#pointP3UserAction3'), TABS.mission_control.isBitSet(selectedMarker.getP3(), MWNP.P3.USER_ACTION_3));
|
||||
}
|
||||
|
||||
P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_3, $('#pointP3UserAction3').prop("checked"));
|
||||
var P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_3, $('#pointP3UserAction3').prop("checked"));
|
||||
selectedMarker.setP3(P3Value);
|
||||
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
|
@ -2201,7 +2206,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
changeSwitchery($('#pointP3UserAction4'), TABS.mission_control.isBitSet(selectedMarker.getP3(), MWNP.P3.USER_ACTION_4));
|
||||
}
|
||||
|
||||
P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_4, $('#pointP3UserAction4').prop("checked"));
|
||||
var P3Value = TABS.mission_control.setBit(selectedMarker.getP3(), MWNP.P3.USER_ACTION_4, $('#pointP3UserAction4').prop("checked"));
|
||||
selectedMarker.setP3(P3Value);
|
||||
|
||||
mission.updateWaypoint(selectedMarker);
|
||||
|
@ -2259,13 +2264,13 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#loadEepromSafehomeButton').on('click', function () {
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startGettingSafehomePoints'));
|
||||
GUI.log(localization.getMessage('startGettingSafehomePoints'));
|
||||
mspHelper.loadSafehomes();
|
||||
setTimeout(function(){
|
||||
renderSafehomesTable();
|
||||
cleanSafehomeLayers();
|
||||
renderSafehomesOnMap();
|
||||
GUI.log(chrome.i18n.getMessage('endGettingSafehomePoints'));
|
||||
GUI.log(localization.getMessage('endGettingSafehomePoints'));
|
||||
$('#loadEepromSafehomeButton').removeClass('disabled');
|
||||
}, 500);
|
||||
|
||||
|
@ -2273,11 +2278,11 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#saveEepromSafehomeButton').on('click', function() {
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startSendingSafehomePoints'));
|
||||
GUI.log(localization.getMessage('startSendingSafehomePoints'));
|
||||
mspHelper.saveSafehomes();
|
||||
setTimeout(function(){
|
||||
mspHelper.saveToEeprom();
|
||||
GUI.log(chrome.i18n.getMessage('endSendingSafehomePoints'));
|
||||
GUI.log(localization.getMessage('endSendingSafehomePoints'));
|
||||
$('#saveEepromSafehomeButton').removeClass('disabled');
|
||||
}, 500);
|
||||
});
|
||||
|
@ -2318,9 +2323,6 @@ TABS.mission_control.initialize = function (callback) {
|
|||
redrawLayer();
|
||||
plotElevation();
|
||||
})()
|
||||
|
||||
settings.bingDemModel = $('#elevationEarthModel').prop("checked") ? true : false;
|
||||
saveSettings();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2368,7 +2370,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
// Callback for Remove buttons
|
||||
/////////////////////////////////////////////
|
||||
$('#removeAllPoints').on('click', function () {
|
||||
if (markers.length && confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) {
|
||||
if (markers.length && confirm(localization.getMessage('confirm_delete_all_points'))) {
|
||||
if (removeAllMultiMissionCheck()) {
|
||||
removeAllWaypoints();
|
||||
updateMultimissionState();
|
||||
|
@ -2381,10 +2383,10 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#removePoint').on('click', function () {
|
||||
if (selectedMarker) {
|
||||
if (mission.isJumpTargetAttached(selectedMarker)) {
|
||||
alert(chrome.i18n.getMessage('MissionPlannerJumpTargetRemoval'));
|
||||
alert(localization.getMessage('MissionPlannerJumpTargetRemoval'));
|
||||
}
|
||||
else if (mission.getAttachedFromWaypoint(selectedMarker) && mission.getAttachedFromWaypoint(selectedMarker).length != 0) {
|
||||
if (confirm(chrome.i18n.getMessage('confirm_delete_point_with_options'))) {
|
||||
if (confirm(localization.getMessage('confirm_delete_point_with_options'))) {
|
||||
mission.getAttachedFromWaypoint(selectedMarker).forEach(function (element) {
|
||||
mission.dropWaypoint(element);
|
||||
mission.update(singleMissionActive());
|
||||
|
@ -2415,7 +2417,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
$('#loadFileMissionButton').on('click', function () {
|
||||
if (!fileLoadMultiMissionCheck()) return;
|
||||
|
||||
if (markers.length && !confirm(chrome.i18n.getMessage('confirm_delete_all_points'))) return;
|
||||
if (markers.length && !confirm(localization.getMessage('confirm_delete_all_points'))) return;
|
||||
nwdialog.setContext(document);
|
||||
nwdialog.openFileDialog('.mission', function(result) {
|
||||
loadMissionFile(result);
|
||||
|
@ -2431,39 +2433,39 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
$('#loadMissionButton').on('click', function () {
|
||||
let message = multimissionCount ? 'confirm_overwrite_multimission_file_load_option' : 'confirm_delete_all_points';
|
||||
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
||||
if ((markers.length || multimissionCount) && !confirm(localization.getMessage(message))) return;
|
||||
removeAllWaypoints();
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startGetPoint'));
|
||||
GUI.log(localization.getMessage('startGetPoint'));
|
||||
getWaypointsFromFC(false);
|
||||
});
|
||||
|
||||
$('#saveMissionButton').on('click', function () {
|
||||
if (mission.isEmpty()) {
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||
alert(localization.getMessage('no_waypoints_to_save'));
|
||||
return;
|
||||
}
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startSendPoint'));
|
||||
GUI.log(localization.getMessage('startSendPoint'));
|
||||
sendWaypointsToFC(false);
|
||||
});
|
||||
|
||||
$('#loadEepromMissionButton').on('click', function () {
|
||||
let message = multimissionCount ? 'confirm_overwrite_multimission_file_load_option' : 'confirm_delete_all_points';
|
||||
if ((markers.length || multimissionCount) && !confirm(chrome.i18n.getMessage(message))) return;
|
||||
if ((markers.length || multimissionCount) && !confirm(localization.getMessage(message))) return;
|
||||
removeAllWaypoints();
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startGetPoint'));
|
||||
GUI.log(localization.getMessage('startGetPoint'));
|
||||
getWaypointsFromFC(true);
|
||||
});
|
||||
|
||||
$('#saveEepromMissionButton').on('click', function () {
|
||||
if (mission.isEmpty()) {
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_save'));
|
||||
alert(localization.getMessage('no_waypoints_to_save'));
|
||||
return;
|
||||
}
|
||||
$(this).addClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('startSendPoint'));
|
||||
GUI.log(localization.getMessage('startSendPoint'));
|
||||
sendWaypointsToFC(true);
|
||||
});
|
||||
|
||||
|
@ -2472,19 +2474,13 @@ TABS.mission_control.initialize = function (callback) {
|
|||
/////////////////////////////////////////////
|
||||
$('#saveSettings').on('click', function () {
|
||||
let oldSafeRadiusSH = settings.safeRadiusSH;
|
||||
|
||||
settings.speed = Number($('#MPdefaultPointSpeed').val());
|
||||
settings.alt = Number($('#MPdefaultPointAlt').val());
|
||||
settings.safeRadiusSH = Number($('#MPdefaultSafeRangeSH').val());
|
||||
|
||||
settings = { speed: Number($('#MPdefaultPointSpeed').val()), alt: Number($('#MPdefaultPointAlt').val()), safeRadiusSH: Number($('#MPdefaultSafeRangeSH').val()), maxDistSH : vMaxDistSH};
|
||||
saveSettings();
|
||||
|
||||
if (settings.safeRadiusSH != oldSafeRadiusSH && $('#showHideSafehomeButton').is(":visible")) {
|
||||
cleanSafehomeLayers();
|
||||
renderSafehomesOnMap();
|
||||
$('#SafeHomeSafeDistance').text(settings.safeRadiusSH);
|
||||
}
|
||||
|
||||
closeSettingsPanel();
|
||||
});
|
||||
|
||||
|
@ -2503,17 +2499,17 @@ TABS.mission_control.initialize = function (callback) {
|
|||
/////////////////////////////////////////////
|
||||
function loadMissionFile(filename) {
|
||||
const fs = require('fs');
|
||||
if (!window.xml2js) return GUI.log(chrome.i18n.getMessage('errorReadingFileXml2jsNotFound'));
|
||||
if (!window.xml2js) return GUI.log(localization.getMessage('errorReadingFileXml2jsNotFound'));
|
||||
|
||||
fs.readFile(filename, (err, data) => {
|
||||
if (err) {
|
||||
GUI.log(chrome.i18n.getMessage('errorReadingFile'));
|
||||
GUI.log(localization.getMessage('errorReadingFile'));
|
||||
return console.error(err);
|
||||
}
|
||||
|
||||
window.xml2js.Parser({ 'explicitChildren': true, 'preserveChildrenOrder': true }).parseString(data, (err, result) => {
|
||||
if (err) {
|
||||
GUI.log(chrome.i18n.getMessage('errorParsingFile'));
|
||||
GUI.log(localization.getMessage('errorParsingFile'));
|
||||
return console.error(err);
|
||||
}
|
||||
|
||||
|
@ -2601,7 +2597,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
|
||||
if (missionEndFlagCount > 1) {
|
||||
if (multimissionCount && !confirm(chrome.i18n.getMessage('confirm_multimission_file_load'))) {
|
||||
if (multimissionCount && !confirm(localization.getMessage('confirm_multimission_file_load'))) {
|
||||
mission.flush();
|
||||
return;
|
||||
} else {
|
||||
|
@ -2645,7 +2641,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
}
|
||||
updateTotalInfo();
|
||||
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
||||
GUI.log(sFilename + chrome.i18n.getMessage('loadedSuccessfully'));
|
||||
GUI.log(sFilename + localization.getMessage('loadedSuccessfully'));
|
||||
updateFilename(sFilename);
|
||||
});
|
||||
});
|
||||
|
@ -2653,7 +2649,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
function saveMissionFile(filename) {
|
||||
const fs = require('fs');
|
||||
if (!window.xml2js) return GUI.log(chrome.i18n.getMessage('errorWritingFileXml2jsNotFound'));
|
||||
if (!window.xml2js) return GUI.log(localization.getMessage('errorWritingFileXml2jsNotFound'));
|
||||
|
||||
var center = ol.proj.toLonLat(map.getView().getCenter());
|
||||
var zoom = map.getView().getZoom();
|
||||
|
@ -2702,11 +2698,11 @@ TABS.mission_control.initialize = function (callback) {
|
|||
xml = xml.replace(/missionitem mission/g, 'meta mission');
|
||||
fs.writeFile(filename, xml, (err) => {
|
||||
if (err) {
|
||||
GUI.log(chrome.i18n.getMessage('ErrorWritingFile'));
|
||||
GUI.log(localization.getMessage('ErrorWritingFile'));
|
||||
return console.error(err);
|
||||
}
|
||||
let sFilename = String(filename.split('\\').pop().split('/').pop());
|
||||
GUI.log(sFilename + chrome.i18n.getMessage('savedSuccessfully'));
|
||||
GUI.log(sFilename + localization.getMessage('savedSuccessfully'));
|
||||
updateFilename(sFilename);
|
||||
});
|
||||
}
|
||||
|
@ -2724,15 +2720,15 @@ TABS.mission_control.initialize = function (callback) {
|
|||
|
||||
function getWaypointData() {
|
||||
mspHelper.loadWaypoints(function() {
|
||||
GUI.log(chrome.i18n.getMessage('endGetPoint'));
|
||||
GUI.log(localization.getMessage('endGetPoint'));
|
||||
if (loadEeprom) {
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_load_ok'));
|
||||
GUI.log(localization.getMessage('eeprom_load_ok'));
|
||||
$('#loadEepromMissionButton').removeClass('disabled');
|
||||
} else {
|
||||
$('#loadMissionButton').removeClass('disabled');
|
||||
}
|
||||
if (!MISSION_PLANNER.getCountBusyPoints()) {
|
||||
alert(chrome.i18n.getMessage('no_waypoints_to_load'));
|
||||
alert(localization.getMessage('no_waypoints_to_load'));
|
||||
return;
|
||||
}
|
||||
mission.reinit();
|
||||
|
@ -2766,10 +2762,10 @@ TABS.mission_control.initialize = function (callback) {
|
|||
MISSION_PLANNER.copy(mission);
|
||||
MISSION_PLANNER.update(false, true, true);
|
||||
mspHelper.saveWaypoints(function() {
|
||||
GUI.log(chrome.i18n.getMessage('endSendPoint'));
|
||||
GUI.log(localization.getMessage('endSendPoint'));
|
||||
if (saveEeprom) {
|
||||
$('#saveEepromMissionButton').removeClass('disabled');
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
GUI.log(localization.getMessage('eeprom_saved_ok'));
|
||||
MSP.send_message(MSPCodes.MSP_WP_MISSION_SAVE, [0], false, setMissionIndex);
|
||||
} else {
|
||||
$('#saveMissionButton').removeClass('disabled');
|
||||
|
@ -2789,7 +2785,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
let activeIndex = singleMissionActive() ? 1 : $('#activeNissionIndex').text();
|
||||
mspHelper.setSetting("nav_wp_multi_mission_index", activeIndex, function () {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('multimission_active_index_saved_eeprom'));
|
||||
GUI.log(localization.getMessage('multimission_active_index_saved_eeprom'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -2802,7 +2798,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
availableWPs = availableWPs - multimission.get().length;
|
||||
}
|
||||
$('#availablePoints').text(availableWPs + '/' + mission.getMaxWaypoints());
|
||||
$('#missionValid').html(mission.getValidMission() ? chrome.i18n.getMessage('armingCheckPass') : chrome.i18n.getMessage('armingCheckFail'));
|
||||
$('#missionValid').html(mission.getValidMission() ? localization.getMessage('armingCheckPass') : localization.getMessage('armingCheckFail'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2828,7 +2824,7 @@ TABS.mission_control.initialize = function (callback) {
|
|||
if (AbsAltCheck) {
|
||||
if (checkAltitude < 100 * elevation) {
|
||||
if (resetAltitude) {
|
||||
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||
alert(localization.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||
altitude = selectedMarker.getAlt();
|
||||
} else {
|
||||
altitude = settings.alt + 100 * elevation;
|
||||
|
@ -2839,14 +2835,10 @@ TABS.mission_control.initialize = function (callback) {
|
|||
let elevationAtHome = HOME.getAlt();
|
||||
if ((checkAltitude / 100 + elevationAtHome) < elevation) {
|
||||
if (resetAltitude) {
|
||||
alert(chrome.i18n.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||
alert(localization.getMessage('MissionPlannerAltitudeChangeReset'));
|
||||
altitude = selectedMarker.getAlt();
|
||||
} else {
|
||||
let currentGroundClearance = 100 * Number($('#groundClearanceValueAtWP').text());
|
||||
if (isNaN(currentGroundClearance) || selectedMarker == null) {
|
||||
currentGroundClearance = settings.alt; // use default altitude if no current ground clearance
|
||||
}
|
||||
altitude = currentGroundClearance + 100 * (elevation - elevationAtHome);
|
||||
altitude = settings.alt + 100 * (elevation - elevationAtHome);
|
||||
}
|
||||
}
|
||||
groundClearance = altitude / 100 + (elevationAtHome - elevation);
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
<div class="select position-relative">
|
||||
<div class="mixerPreview" style="max-width: 175px">
|
||||
<img src="./resources/motor_order/custom.svg" id="motor-mixer-preview-img"/>
|
||||
<div class="motorNumber" id="motorNumber1">1</div>
|
||||
<div class="motorNumber" id="motorNumber2">2</div>
|
||||
<div class="motorNumber" id="motorNumber3">3</div>
|
||||
<div class="motorNumber" id="motorNumber4">4</div>
|
||||
<div class="motorNumber is-hidden" id="motorNumber1">1</div>
|
||||
<div class="motorNumber is-hidden" id="motorNumber2">2</div>
|
||||
<div class="motorNumber is-hidden" id="motorNumber3">3</div>
|
||||
<div class="motorNumber is-hidden" id="motorNumber4">4</div>
|
||||
</div>
|
||||
<div class="half" style="width: calc(50% - 10px); margin-left: 10px;">
|
||||
<select id="mixer-preset"></select>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global $,helper,mspHelper,MSP,GUI,SERVO_RULES,MOTOR_RULES,MIXER_CONFIG,googleAnalytics,LOGIC_CONDITIONS,TABS,ServoMixRule*/
|
||||
/*global $,helper,mspHelper,MSP,GUI,SERVO_RULES,MOTOR_RULES,MIXER_CONFIG,LOGIC_CONDITIONS,TABS,ServoMixRule*/
|
||||
'use strict';
|
||||
|
||||
TABS.mixer = {};
|
||||
|
@ -19,7 +19,6 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (GUI.active_tab != 'mixer') {
|
||||
GUI.active_tab = 'mixer';
|
||||
googleAnalytics.sendAppView('Mixer');
|
||||
}
|
||||
|
||||
loadChainer.setChain([
|
||||
|
@ -51,7 +50,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reboot() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
|
@ -60,12 +59,12 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
function reinitialize() {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_mixer a'));
|
||||
}
|
||||
|
||||
function loadHtml() {
|
||||
GUI.load("./tabs/mixer.html", Settings.processHtml(processHtml));
|
||||
GUI.load(path.join(__dirname, "tabs/mixer.html"), Settings.processHtml(processHtml));
|
||||
}
|
||||
|
||||
function renderOutputTable() {
|
||||
|
@ -109,7 +108,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
let usedTimers = OUTPUT_MAPPING.getUsedTimerIds();
|
||||
|
||||
for (t of usedTimers) {
|
||||
for (let t of usedTimers) {
|
||||
var usageMode = OUTPUT_MAPPING.getTimerOverride(t);
|
||||
$container.append(
|
||||
'<div class="select" style="padding: 5px; margin: 1px; background-color: ' + OUTPUT_MAPPING.getTimerColor(t) + '">' +
|
||||
|
@ -389,7 +388,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
rate_inputs.attr("min", -1000);
|
||||
rate_inputs.attr("max", 1000);
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
}
|
||||
|
||||
function updateFixedValueVisibility(row, $mixRuleInput) {
|
||||
|
@ -433,16 +432,15 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
rules = currentMixerPreset.motorMixer;
|
||||
}
|
||||
|
||||
if (currentMixerPreset.image != 'quad_x') {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const i in rules) {
|
||||
if (rules.hasOwnProperty(i)) {
|
||||
const rule = rules[i];
|
||||
index++;
|
||||
|
||||
if (currentMixerPreset.image != 'quad_x') {
|
||||
$("#motorNumber"+index).css("visibility", "hidden");
|
||||
continue;
|
||||
}
|
||||
|
||||
let top_px = 30;
|
||||
let left_px = 28;
|
||||
if (rule.getRoll() < -0.5) {
|
||||
|
@ -454,7 +452,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
$("#motorNumber"+index).css("left", left_px + "px");
|
||||
$("#motorNumber"+index).css("top", top_px + "px");
|
||||
$("#motorNumber"+index).css("visibility", "visible");
|
||||
$("#motorNumber"+index).removeClass("is-hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,17 +522,10 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
}
|
||||
labelMotorNumbers();
|
||||
localize();
|
||||
localization.localize();;
|
||||
}
|
||||
|
||||
function saveAndReboot() {
|
||||
|
||||
/*
|
||||
* Send tracking
|
||||
*/
|
||||
googleAnalytics.sendEvent('Mixer', 'Platform type', helper.platform.getById(MIXER_CONFIG.platformType).name);
|
||||
googleAnalytics.sendEvent('Mixer', 'Mixer preset', helper.mixer.getById(MIXER_CONFIG.appliedMixerPreset).name);
|
||||
|
||||
/*
|
||||
* Send mixer rules
|
||||
*/
|
||||
|
@ -559,7 +550,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
let mixers = helper.mixer.getByPlatform(MIXER_CONFIG.platformType);
|
||||
|
||||
$mixerPreset.find("*").remove();
|
||||
for (i in mixers) {
|
||||
for (let i in mixers) {
|
||||
if (mixers.hasOwnProperty(i)) {
|
||||
let m = mixers[i];
|
||||
$mixerPreset.append('<option value="' + m.id + '">' + m.name + '</option>');
|
||||
|
@ -578,7 +569,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
closeButton: 'title',
|
||||
animation: false,
|
||||
attach: $wizardButton,
|
||||
title: chrome.i18n.getMessage("mixerWizardModalTitle"),
|
||||
title: localization.getMessage("mixerWizardModalTitle"),
|
||||
content: $('#mixerWizardContent')
|
||||
});
|
||||
|
||||
|
@ -650,9 +641,9 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) {
|
||||
if (isReversed) {
|
||||
motorDirectionCheckbox.parent().find("label span").html(chrome.i18n.getMessage("motor_direction_isInverted"));
|
||||
motorDirectionCheckbox.parent().find("label span").html(localization.getMessage("motor_direction_isInverted"));
|
||||
} else {
|
||||
motorDirectionCheckbox.parent().find("label span").html(chrome.i18n.getMessage("motor_direction_inverted"));
|
||||
motorDirectionCheckbox.parent().find("label span").html(localization.getMessage("motor_direction_inverted"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -733,7 +724,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
closeButton: 'title',
|
||||
animation: false,
|
||||
attach: $('#load-and-apply-mixer-button'),
|
||||
title: chrome.i18n.getMessage("mixerApplyModalTitle"),
|
||||
title: localization.getMessage("mixerApplyModalTitle"),
|
||||
content: $('#mixerApplyContent')
|
||||
});
|
||||
|
||||
|
@ -821,7 +812,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
|
||||
LOGIC_CONDITIONS.init($('#logic-wrapper'));
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
helper.mspBalancedInterval.add('logic_conditions_pull', 350, 1, getLogicConditionsStatus);
|
||||
|
||||
|
@ -850,8 +841,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
|||
};
|
||||
|
||||
TABS.mixer.cleanup = function (callback) {
|
||||
delete modal;
|
||||
delete motorWizardModal;
|
||||
//delete modal;
|
||||
//delete motorWizardModal;
|
||||
$('.jBox-wrapper').remove();
|
||||
if (callback) callback();
|
||||
};
|
||||
|
|
|
@ -8,7 +8,6 @@ TABS.modes.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'modes') {
|
||||
GUI.active_tab = 'modes';
|
||||
googleAnalytics.sendAppView('Modes');
|
||||
}
|
||||
|
||||
function get_active_box_data() {
|
||||
|
@ -24,7 +23,7 @@ TABS.modes.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/modes.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/modes.html"), process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_active_box_data);
|
||||
|
@ -45,7 +44,7 @@ TABS.modes.initialize = function (callback) {
|
|||
}
|
||||
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// generate table from the supplied AUX names and AUX data
|
||||
for (var i = 0; i < AUX_CONFIG.length; i++) {
|
||||
|
@ -88,7 +87,7 @@ TABS.modes.initialize = function (callback) {
|
|||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('auxiliaryEepromSaved'));
|
||||
GUI.log(localization.getMessage('auxiliaryEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'onboard_logging') {
|
||||
GUI.active_tab = 'onboard_logging';
|
||||
googleAnalytics.sendAppView('onboard_logging');
|
||||
}
|
||||
|
||||
if (CONFIGURATOR.connectionValid) {
|
||||
|
@ -55,7 +54,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
|
@ -63,14 +62,14 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function reinitialize() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_onboard_logging a'));
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/onboard_logging.html", function() {
|
||||
GUI.load(path.join(__dirname, "tabs/onboard_logging.html"), function() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
var
|
||||
dataflashPresent = DATAFLASH.totalSize > 0,
|
||||
|
@ -136,7 +135,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
|||
label.attr("for",FIELD_ID)
|
||||
|
||||
const span = $('<span></span>');
|
||||
span.html(chrome.i18n.getMessage(FIELD_ID))
|
||||
span.html(localization.getMessage(FIELD_ID))
|
||||
label.append(span);
|
||||
|
||||
const checkbox = $('<div class="checkbox"></div>')
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
<input id="showProfileParameters" type="checkbox" />
|
||||
<label for="showProfileParameters"><span data-i18n="options_showProfileParameters"></span></label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox cli_autocomplete">
|
||||
<input id="cliAutocomplete" type="checkbox" />
|
||||
<label for="cliAutocomplete"><span data-i18n="options_cliAutocomplete"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -242,16 +242,6 @@
|
|||
<input id="osd_gforce_axis_alarm_max" data-setting="osd_gforce_axis_alarm_max" data-setting-multiplier="1" type="number" data-step="0.1" />
|
||||
<span data-i18n="osd_gforce_axis_alarm_max"></span>
|
||||
</label>
|
||||
<div for="adsb_distance_warning" class="helpicon cf_tip" data-i18n_title="osdAlarmADSB_MAX_DISTANCE_WARNING"></div>
|
||||
<label for="adsb_distance_warning">
|
||||
<input id="adsb_distance_warning" data-setting="osd_adsb_distance_warning" data-unit="m" data-setting-multiplier="1" type="number" data-step="1" />
|
||||
<span data-i18n="osd_adsb_distance_warning"></span>
|
||||
</label>
|
||||
<div for="adsb_distance_alert" class="helpicon cf_tip" data-i18n_title="osdAlarmADSB_MAX_DISTANCE_ALERT"></div>
|
||||
<label for="adsb_distance_alert">
|
||||
<input id="adsb_distance_alert" data-setting="osd_adsb_distance_alert" data-unit="m" data-setting-multiplier="1" type="number" data-step="1" />
|
||||
<span data-i18n="osd_adsb_distance_alert"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gui_box grey dji-hd-container" id="dji_settings">
|
||||
|
|
110
tabs/osd.js
110
tabs/osd.js
|
@ -1,6 +1,8 @@
|
|||
/*global $,nwdialog*/
|
||||
'use strict';
|
||||
|
||||
const inflection = require( 'inflection' );
|
||||
|
||||
var SYM = SYM || {};
|
||||
SYM.LAST_CHAR = 225; // For drawing the font preview
|
||||
SYM.BLANK = 0x20;
|
||||
|
@ -114,7 +116,6 @@ SYM.FLIGHT_DIST_REMAINING = 0x167;
|
|||
SYM.GROUND_COURSE = 0xDC;
|
||||
SYM.ALERT = 0xDD;
|
||||
SYM.CROSS_TRACK_ERROR = 0xFC;
|
||||
SYM.ADSB = 0xFD;
|
||||
SYM.PAN_SERVO_IS_OFFSET_L = 0x1C7;
|
||||
SYM.ODOMETER = 0X168;
|
||||
SYM.PILOT_LOGO_SML_L = 0x1D5;
|
||||
|
@ -481,8 +482,6 @@ OSD.initData = function () {
|
|||
imu_temp_alarm_max: null,
|
||||
baro_temp_alarm_min: null,
|
||||
baro_temp_alarm_max: null,
|
||||
adsb_distance_warning: null,
|
||||
adsb_distance_alert: null,
|
||||
},
|
||||
layouts: [],
|
||||
layout_count: 1, // This needs to be 1 for compatibility with < 2.0
|
||||
|
@ -784,24 +783,6 @@ OSD.constants = {
|
|||
min: -55,
|
||||
max: 125
|
||||
},
|
||||
{
|
||||
name: 'ADSB_MAX_DISTANCE_WARNING',
|
||||
field: 'adsb_distance_warning',
|
||||
step: 1,
|
||||
unit: "meters",
|
||||
min: 1,
|
||||
max: 64000,
|
||||
min_version: '7.1.0',
|
||||
},
|
||||
{
|
||||
name: 'ADSB_MAX_DISTANCE_ALERT',
|
||||
field: 'adsb_distance_alert',
|
||||
step: 1,
|
||||
unit: "meters",
|
||||
min: 1,
|
||||
max: 64000,
|
||||
min_version: '7.1.0',
|
||||
},
|
||||
],
|
||||
|
||||
// All display fields, from every version, do not remove elements, only add!
|
||||
|
@ -1675,18 +1656,6 @@ OSD.constants = {
|
|||
min_version: '6.0.0',
|
||||
preview: FONT.symbol(SYM.GROUND_COURSE) + '245' + FONT.symbol(SYM.DEGREES)
|
||||
},
|
||||
{
|
||||
name: 'ADSB_WARNING_MESSAGE',
|
||||
id: 147,
|
||||
min_version: '7.1.0',
|
||||
preview: FONT.symbol(SYM.ADSB) + '19.25' + FONT.symbol(SYM.DIR_TO_HOME+1) + '2.75',
|
||||
},
|
||||
{
|
||||
name: 'ADSB_INFO',
|
||||
id: 148,
|
||||
min_version: '7.1.0',
|
||||
preview: FONT.symbol(SYM.ADSB) + '2',
|
||||
},
|
||||
{
|
||||
name: 'CROSS TRACK ERROR',
|
||||
id: 141,
|
||||
|
@ -2137,7 +2106,7 @@ OSD.reload = function(callback) {
|
|||
OSD.msp.decodeLayoutCounts(resp);
|
||||
// Get data for all layouts
|
||||
var ids = Array.apply(null, {length: OSD.data.layout_count}).map(Number.call, Number);
|
||||
var layouts = Promise.mapSeries(ids, function (layoutIndex, ii) {
|
||||
var layouts = mapSeries(ids, function (layoutIndex, ii) {
|
||||
var data = [];
|
||||
data.push8(layoutIndex);
|
||||
return MSP.promise(MSPCodes.MSP2_INAV_OSD_LAYOUTS, data).then(function (resp) {
|
||||
|
@ -2297,8 +2266,6 @@ OSD.msp = {
|
|||
result.push16(OSD.data.alarms.imu_temp_alarm_max);
|
||||
result.push16(OSD.data.alarms.baro_temp_alarm_min);
|
||||
result.push16(OSD.data.alarms.baro_temp_alarm_max);
|
||||
result.push16(OSD.data.alarms.adsb_distance_warning);
|
||||
result.push16(OSD.data.alarms.adsb_distance_alert);
|
||||
return result;
|
||||
},
|
||||
|
||||
|
@ -2318,8 +2285,6 @@ OSD.msp = {
|
|||
OSD.data.alarms.imu_temp_alarm_max = alarms.read16();
|
||||
OSD.data.alarms.baro_temp_alarm_min = alarms.read16();
|
||||
OSD.data.alarms.baro_temp_alarm_max = alarms.read16();
|
||||
OSD.data.alarms.adsb_distance_warning = alarms.read16();
|
||||
OSD.data.alarms.adsb_distance_alert = alarms.read16();
|
||||
},
|
||||
|
||||
encodePreferences: function() {
|
||||
|
@ -2576,7 +2541,7 @@ OSD.GUI.updateUnits = function() {
|
|||
if (unitType.min_version && semver.lt(CONFIG.flightControllerVersion, unitType.min_version)) {
|
||||
continue;
|
||||
}
|
||||
var name = chrome.i18n.getMessage(unitType.name);
|
||||
var name = localization.getMessage(unitType.name);
|
||||
var $option = $('<option>' + name + '</option>');
|
||||
$option.attr('value', name);
|
||||
$option.data('type', unitType.value);
|
||||
|
@ -2589,7 +2554,7 @@ OSD.GUI.updateUnits = function() {
|
|||
var unitType = OSD.constants.UNIT_TYPES[OSD.data.preferences.units];
|
||||
var tip;
|
||||
if (unitType.tip) {
|
||||
tip = chrome.i18n.getMessage(unitType.tip);
|
||||
tip = localization.getMessage(unitType.tip);
|
||||
}
|
||||
if (tip) {
|
||||
$unitTip.attr('title', tip);
|
||||
|
@ -2630,9 +2595,9 @@ OSD.GUI.updateFields = function() {
|
|||
var groupContainer = $tmpl.clone().addClass('osd_group').show();
|
||||
groupContainer.attr('id', group.name);
|
||||
var groupTitleContainer = groupContainer.find('.spacer_box_title');
|
||||
var groupTitle = chrome.i18n.getMessage(group.name);
|
||||
var groupTitle = localization.getMessage(group.name);
|
||||
groupTitleContainer.text(groupTitle);
|
||||
var groupHelp = chrome.i18n.getMessage(group.name + '_HELP');
|
||||
var groupHelp = localization.getMessage(group.name + '_HELP');
|
||||
if (groupHelp) {
|
||||
$('<div class="helpicon cf_tip"></div>')
|
||||
.css('margin-top', '1px')
|
||||
|
@ -2656,7 +2621,7 @@ OSD.GUI.updateFields = function() {
|
|||
var $field = $('<div class="display-field field-' + item.id + '"/>');
|
||||
var name = item.name;
|
||||
var nameKey = 'osdElement_' + name;
|
||||
var nameMessage = chrome.i18n.getMessage(nameKey);
|
||||
var nameMessage = localization.getMessage(nameKey);
|
||||
if (nameMessage) {
|
||||
name = nameMessage;
|
||||
} else {
|
||||
|
@ -2666,7 +2631,7 @@ OSD.GUI.updateFields = function() {
|
|||
if (searchTerm.length > 0 && !name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
var help = chrome.i18n.getMessage(nameKey + '_HELP');
|
||||
var help = localization.getMessage(nameKey + '_HELP');
|
||||
if (help) {
|
||||
$('<div class="helpicon cf_tip"></div>')
|
||||
.css('margin-top', '1px')
|
||||
|
@ -2726,7 +2691,7 @@ OSD.GUI.updateFields = function() {
|
|||
}
|
||||
$displayFields.append($field);
|
||||
}
|
||||
if (groupContainer.find('.display-fields').children().length > 0) {
|
||||
if (groupContainer.find('.display-fields').children().size() > 0) {
|
||||
$tmpl.parent().append(groupContainer);
|
||||
}
|
||||
}
|
||||
|
@ -2737,7 +2702,7 @@ OSD.GUI.updateFields = function() {
|
|||
.attr('checked', isGuidesChecked)
|
||||
.on('change', function () {
|
||||
OSD.GUI.updateGuidesView(this.checked);
|
||||
chrome.storage.local.set({'showOSDGuides': this.checked});
|
||||
store.set('showOSDGuides', this.checked);
|
||||
OSD.GUI.updatePreviews();
|
||||
})
|
||||
);
|
||||
|
@ -2802,7 +2767,7 @@ OSD.GUI.updateDjiMessageElements = function(on) {
|
|||
};
|
||||
|
||||
OSD.GUI.updateGuidesView = function(on) {
|
||||
isHdZero = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'HDZERO';
|
||||
let isHdZero = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'HDZERO';
|
||||
$('.hd_43_margin_left').toggleClass('hdzero_43_left', (isHdZero && on))
|
||||
$('.hd_43_margin_right').toggleClass('hdzero_43_right', (isHdZero && on))
|
||||
$('.hd_3016_box_top').toggleClass('hd_3016_top', (isHdZero && on))
|
||||
|
@ -2810,11 +2775,11 @@ OSD.GUI.updateGuidesView = function(on) {
|
|||
$('.hd_3016_box_left').toggleClass('hd_3016_left', (isHdZero && on))
|
||||
$('.hd_3016_box_right').toggleClass('hd_3016_right', (isHdZero && on))
|
||||
|
||||
isDJIWTF = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'DJIWTF';
|
||||
let isDJIWTF = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'DJIWTF';
|
||||
$('.hd_43_margin_left').toggleClass('dji_hd_43_left', (isDJIWTF && on))
|
||||
$('.hd_43_margin_right').toggleClass('dji_hd_43_right', (isDJIWTF && on))
|
||||
|
||||
isAvatar = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'AVATAR';
|
||||
let isAvatar = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'AVATAR';
|
||||
$('.hd_43_margin_left').toggleClass('hd_avatar_43_left', (isAvatar && on))
|
||||
$('.hd_43_margin_right').toggleClass('hd_avatar_43_right', (isAvatar && on))
|
||||
$('.hd_avatar_bottom_bar').toggleClass('hd_avatar_bottom', (isAvatar && on))
|
||||
|
@ -2823,13 +2788,13 @@ OSD.GUI.updateGuidesView = function(on) {
|
|||
$('.hd_avatar_storage_box_left').toggleClass('hd_avatar_storagebox_l', (isAvatar && on))
|
||||
$('.hd_avatar_storage_box_right').toggleClass('hd_avatar_storagebox_r', (isAvatar && on))
|
||||
|
||||
isBfHdCompat = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'BFHDCOMPAT';
|
||||
let isBfHdCompat = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'BFHDCOMPAT';
|
||||
$('.hd_43_margin_left').toggleClass('hd_bfhdcompat_43_left', (isBfHdCompat && on));
|
||||
$('.hd_43_margin_right').toggleClass('hd_bfhdcompat_43_right', (isBfHdCompat && on));
|
||||
$('.hd_bfhdcompat_bottom_box').toggleClass('hd_bfhdcompat_bottom', (isBfHdCompat && on));
|
||||
$('.hd_bfhdcompat_storage_box').toggleClass('hd_bfhdcompat_storagebox', (isBfHdCompat && on));
|
||||
|
||||
isPAL = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'PAL' || OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'AUTO';
|
||||
let isPAL = OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'PAL' || OSD.constants.VIDEO_TYPES[OSD.data.preferences.video_system] == 'AUTO';
|
||||
$('.pal_ntsc_box_bottom').toggleClass('ntsc_bottom', (isPAL && on))
|
||||
};
|
||||
|
||||
|
@ -2901,7 +2866,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
OSD.data.preview = [];
|
||||
|
||||
// clear the buffer
|
||||
for (i = 0; i < OSD.data.display_size.total; i++) {
|
||||
for (let i = 0; i < OSD.data.display_size.total; i++) {
|
||||
OSD.data.preview.push([null, ' '.charCodeAt(0)]);
|
||||
};
|
||||
|
||||
|
@ -2938,7 +2903,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
}
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
for (i = 0; i < preview.length; i++) {
|
||||
for (let i = 0; i < preview.length; i++) {
|
||||
var charCode = preview.charCodeAt(i);
|
||||
if (charCode == '\n'.charCodeAt(0)) {
|
||||
x = 0;
|
||||
|
@ -2980,7 +2945,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
|
||||
// artificial horizon
|
||||
if ($('input[name="ARTIFICIAL_HORIZON"]').prop('checked')) {
|
||||
for (i = 0; i < 9; i++) {
|
||||
for (let i = 0; i < 9; i++) {
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - 4 + i, SYM.AH_BAR9_0 + 4);
|
||||
}
|
||||
}
|
||||
|
@ -3012,7 +2977,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
if ($('input[name="HORIZON_SIDEBARS"]').prop('checked')) {
|
||||
var hudwidth = OSD.constants.AHISIDEBARWIDTHPOSITION;
|
||||
var hudheight = OSD.constants.AHISIDEBARHEIGHTPOSITION;
|
||||
for (i = -hudheight; i <= hudheight; i++) {
|
||||
for (let i = -hudheight; i <= hudheight; i++) {
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition - hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
OSD.GUI.checkAndProcessSymbolPosition(hudCenterPosition + hudwidth + (i * FONT.constants.SIZES.LINE), SYM.AH_DECORATION);
|
||||
}
|
||||
|
@ -3028,7 +2993,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
// render
|
||||
var $preview = $('.display-layout .preview').empty();
|
||||
var $row = $('<div class="row"/>');
|
||||
for (i = 0; i < OSD.data.display_size.total;) {
|
||||
for (let i = 0; i < OSD.data.display_size.total;) {
|
||||
var charCode = OSD.data.preview[i];
|
||||
var colorStyle = '';
|
||||
|
||||
|
@ -3053,7 +3018,7 @@ OSD.GUI.updatePreviews = function() {
|
|||
$img.find('img').css('pointer-events', 'none');
|
||||
if (item && item.positionable !== false) {
|
||||
var nameKey = 'osdElement_' + item.name;
|
||||
var nameMessage = chrome.i18n.getMessage(nameKey);
|
||||
var nameMessage = localization.getMessage(nameKey);
|
||||
|
||||
if (!nameMessage) {
|
||||
nameMessage = inflection.titleize(item.name);
|
||||
|
@ -3083,7 +3048,7 @@ OSD.GUI.updateAll = function() {
|
|||
if (OSD.data.layout_count > 1) {
|
||||
layouts.empty();
|
||||
for (var ii = 0; ii < OSD.data.layout_count; ii++) {
|
||||
var name = ii > 0 ? chrome.i18n.getMessage('osdLayoutAlternative', [ii]) : chrome.i18n.getMessage('osdLayoutDefault');
|
||||
var name = ii > 0 ? localization.getMessage('osdLayoutAlternative', [ii]) : localization.getMessage('osdLayoutDefault');
|
||||
var opt = $('<option/>').val(ii).text(name).appendTo(layouts);
|
||||
}
|
||||
layouts.val(OSD.data.selected_layout);
|
||||
|
@ -3140,9 +3105,9 @@ TABS.osd.initialize = function (callback) {
|
|||
GUI.active_tab = 'osd';
|
||||
}
|
||||
|
||||
GUI.load("./tabs/osd.html", Settings.processHtml(function () {
|
||||
GUI.load(path.join(__dirname, "tabs/osd.html"), Settings.processHtml(function () {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// Open modal window
|
||||
OSD.GUI.jbox = new jBox('Modal', {
|
||||
|
@ -3161,7 +3126,7 @@ TABS.osd.initialize = function (callback) {
|
|||
Settings.saveInputs().then(function () {
|
||||
var self = this;
|
||||
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
|
||||
GUI.log(chrome.i18n.getMessage('osdSettingsSaved'));
|
||||
GUI.log(localization.getMessage('osdSettingsSaved'));
|
||||
var oldText = $(this).text();
|
||||
$(this).html("Saved");
|
||||
setTimeout(function () {
|
||||
|
@ -3171,11 +3136,7 @@ TABS.osd.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// Initialise guides checkbox
|
||||
chrome.storage.local.get('showOSDGuides', function (result) {
|
||||
if (typeof result.showOSDGuides !== 'undefined') {
|
||||
isGuidesChecked = result.showOSDGuides;
|
||||
}
|
||||
});
|
||||
isGuidesChecked = store.get('showOSDGuides', false);
|
||||
|
||||
// Setup switch indicators
|
||||
$(".osdSwitchInd_channel option").each(function() {
|
||||
|
@ -3260,13 +3221,14 @@ TABS.osd.initialize = function (callback) {
|
|||
FONT.preview($preview);
|
||||
OSD.GUI.update();
|
||||
});
|
||||
chrome.storage.local.set({'osd_font': $(this).data('font-file')});
|
||||
store.set('osd_font', $(this).data('font-file'));
|
||||
});
|
||||
|
||||
// load the last selected font when we change tabs
|
||||
chrome.storage.local.get('osd_font', function (result) {
|
||||
if (result.osd_font != undefined) {
|
||||
previous_font_button = $('.fontbuttons button[data-font-file="' + result.osd_font + '"]');
|
||||
var osd_font = store.get('osd_font', false);
|
||||
var previous_font_button;
|
||||
if (osd_font) {
|
||||
previous_font_button = $('.fontbuttons button[data-font-file="' + osd_font + '"]');
|
||||
if (previous_font_button.attr('data-font-file') == undefined) previous_font_button = undefined;
|
||||
}
|
||||
|
||||
|
@ -3275,7 +3237,7 @@ TABS.osd.initialize = function (callback) {
|
|||
} else {
|
||||
previous_font_button.click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('button.load_font_file').click(function () {
|
||||
$fontPicker.removeClass('active');
|
||||
|
@ -3290,12 +3252,12 @@ TABS.osd.initialize = function (callback) {
|
|||
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
||||
var progressLabel = $('.progressLabel');
|
||||
var progressBar = $('.progress');
|
||||
var uploading = chrome.i18n.getMessage('uploadingCharacters');
|
||||
var uploading = localization.getMessage('uploadingCharacters');
|
||||
progressLabel.text(uploading);
|
||||
var progressCallback = function(done, total, percentage) {
|
||||
progressBar.val(percentage);
|
||||
if (done == total) {
|
||||
progressLabel.text(chrome.i18n.getMessage('uploadedCharacters'), [total]);
|
||||
progressLabel.text(localization.getMessage('uploadedCharacters'), [total]);
|
||||
} else {
|
||||
progressLabel.text(uploading + ' (' + done + '/' + total + ')');
|
||||
}
|
||||
|
@ -3349,7 +3311,7 @@ TABS.osd.initialize = function (callback) {
|
|||
});
|
||||
} else {
|
||||
console.log('You don\'t have write permissions for this file, sorry.');
|
||||
GUI.log(chrome.i18n.getMessage('writePermissionsForFile'));
|
||||
GUI.log(localization.getMessage('writePermissionsForFile'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global helper,MSP,MSPChainerClass,googleAnalytics,GUI,mspHelper,MOTOR_RULES,TABS,$,MSPCodes,ANALOG,MOTOR_DATA,chrome,PLATFORM_MULTIROTOR,PLATFORM_TRICOPTER,SERVO_RULES,FC,SERVO_CONFIG,SENSOR_DATA,REVERSIBLE_MOTORS,MISC,MIXER_CONFIG,OUTPUT_MAPPING*/
|
||||
/*global helper,MSP,MSPChainerClass,GUI,mspHelper,MOTOR_RULES,TABS,$,MSPCodes,ANALOG,MOTOR_DATA,chrome,PLATFORM_MULTIROTOR,PLATFORM_TRICOPTER,SERVO_RULES,FC,SERVO_CONFIG,SENSOR_DATA,REVERSIBLE_MOTORS,MISC,MIXER_CONFIG,OUTPUT_MAPPING*/
|
||||
'use strict';
|
||||
|
||||
TABS.outputs = {
|
||||
|
@ -17,7 +17,6 @@ TABS.outputs.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab !== 'outputs') {
|
||||
GUI.active_tab = 'outputs';
|
||||
googleAnalytics.sendAppView('Outputs');
|
||||
}
|
||||
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
@ -56,12 +55,12 @@ TABS.outputs.initialize = function (callback) {
|
|||
mspHelper.saveToEeprom
|
||||
]);
|
||||
saveChainer.setExitPoint(function () {
|
||||
GUI.log(chrome.i18n.getMessage('eeprom_saved_ok'));
|
||||
GUI.log(localization.getMessage('eeprom_saved_ok'));
|
||||
MOTOR_RULES.cleanup();
|
||||
});
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/outputs.html", Settings.processHtml(onLoad));
|
||||
GUI.load(path.join(__dirname, "tabs/outputs.html"), Settings.processHtml(onLoad));
|
||||
}
|
||||
|
||||
function saveSettings(onComplete) {
|
||||
|
@ -104,14 +103,14 @@ TABS.outputs.initialize = function (callback) {
|
|||
if (ADVANCED_CONFIG.motorPwmProtocol >= 5) {
|
||||
$('.hide-for-shot').hide();
|
||||
if ($idlePercent.val() > 7.0) {
|
||||
$idleInfoBox.html(chrome.i18n.getMessage('throttleIdleDigitalInfo'));
|
||||
$idleInfoBox.html(localization.getMessage('throttleIdleDigitalInfo'));
|
||||
$idleInfoBox.addClass('ok-box');
|
||||
$idleInfoBox.show();
|
||||
}
|
||||
} else {
|
||||
$('.hide-for-shot').show();
|
||||
if ($idlePercent.val() > 10.0) {
|
||||
$idleInfoBox.html(chrome.i18n.getMessage('throttleIdleAnalogInfo'));
|
||||
$idleInfoBox.html(localization.getMessage('throttleIdleAnalogInfo'));
|
||||
$idleInfoBox.addClass('ok-box');
|
||||
$idleInfoBox.show();
|
||||
}
|
||||
|
@ -120,7 +119,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
|
||||
let $escProtocol = $('#esc-protocol');
|
||||
|
||||
for (i in escProtocols) {
|
||||
for (let i in escProtocols) {
|
||||
if (escProtocols.hasOwnProperty(i)) {
|
||||
var protocolData = escProtocols[i];
|
||||
$escProtocol.append('<option value="' + i + '">' + protocolData.name + '</option>');
|
||||
|
@ -140,7 +139,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
|
||||
let $servoRate = $('#servo-rate');
|
||||
|
||||
for (i in servoRates) {
|
||||
for (let i in servoRates) {
|
||||
if (servoRates.hasOwnProperty(i)) {
|
||||
$servoRate.append('<option value="' + i + '">' + servoRates[i] + '</option>');
|
||||
}
|
||||
|
@ -227,7 +226,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
while (data[0].length > 40) {
|
||||
for (i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
data[i].shift();
|
||||
}
|
||||
}
|
||||
|
@ -378,11 +377,11 @@ TABS.outputs.initialize = function (callback) {
|
|||
$('a.save').click(function () {
|
||||
saveChainer.setExitPoint(function () {
|
||||
//noinspection JSUnresolvedVariable
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_outputs a'));
|
||||
});
|
||||
});
|
||||
|
@ -555,7 +554,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
|
||||
$('div.values li').eq(index).text(getMotorOutputValue($(this).val()));
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
var val = parseInt($('div.sliders input').eq(i).val());
|
||||
|
||||
buffer.push(lowByte(val));
|
||||
|
@ -683,7 +682,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
color,
|
||||
i;
|
||||
|
||||
for (i = 0; i < MOTOR_DATA.length; i++) {
|
||||
for (let i= 0; i < MOTOR_DATA.length; i++) {
|
||||
data = MOTOR_DATA[i] - MISC.mincommand;
|
||||
margin_top = block_height - (data * (block_height / full_block_scale)).clamp(0, block_height);
|
||||
height = (data * (block_height / full_block_scale)).clamp(0, block_height);
|
||||
|
@ -694,7 +693,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
}
|
||||
|
||||
// servo indicators are still using old (not flexible block scale), it will be changed in the future accordingly
|
||||
for (i = 0; i < SERVO_DATA.length; i++) {
|
||||
for (let i= 0; i < SERVO_DATA.length; i++) {
|
||||
data = SERVO_DATA[i] - 1000;
|
||||
margin_top = block_height - (data * (block_height / 1000)).clamp(0, block_height);
|
||||
height = (data * (block_height / 1000)).clamp(0, block_height);
|
||||
|
@ -727,7 +726,7 @@ TABS.outputs.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function finalize() {
|
||||
localize();
|
||||
localization.localize();;
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<input type="range" name="value-slider" value="42" min="0" max="1000" step="1" data-normal-max="110">
|
||||
</div>
|
||||
|
||||
<div class="pid-slider-row"">
|
||||
<div class="pid-slider-row">
|
||||
<span data-i18n="pidTuning_Derivative"></span>
|
||||
<input type="number" name="value-input" value="42" min="0" max="255" step="1" class="controlProfileHighlightActive">
|
||||
<input type="range" name="value-slider" value="42" min="0" max="1000" step="1" data-normal-max="60">
|
||||
|
|
|
@ -27,11 +27,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'pid_tuning') {
|
||||
GUI.active_tab = 'pid_tuning';
|
||||
googleAnalytics.sendAppView('PID Tuning');
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/pid_tuning.html", Settings.processHtml(process_html));
|
||||
GUI.load(path.join(__dirname, "tabs/pid_tuning.html"), Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function pid_and_rc_to_form() {
|
||||
|
@ -135,7 +134,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$("#note-wrapper").remove();
|
||||
}
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
helper.tabs.init($('.tab-pid_tuning'));
|
||||
helper.features.updateUI($('.tab-pid_tuning'), FEATURES);
|
||||
|
@ -156,7 +155,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
$('#resetPIDs').on('click', function() {
|
||||
|
||||
if (confirm(chrome.i18n.getMessage('confirm_reset_pid'))) {
|
||||
if (confirm(localization.getMessage('confirm_reset_pid'))) {
|
||||
MSP.send_message(MSPCodes.MSP_SET_RESET_CURR_PID, false, false, false);
|
||||
updateActivatedTab();
|
||||
}
|
||||
|
@ -164,14 +163,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
$('#resetDefaults').on('click', function() {
|
||||
|
||||
if (confirm(chrome.i18n.getMessage('confirm_select_defaults'))) {
|
||||
if (confirm(localization.getMessage('confirm_select_defaults'))) {
|
||||
mspHelper.setSetting("applied_defaults", 0, function() {
|
||||
mspHelper.saveToEeprom( function () {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
});
|
||||
});
|
||||
|
@ -185,8 +184,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
let $theOtherPids = $('#the-other-pids');
|
||||
let $showAdvancedPids = $('#show-advanced-pids');
|
||||
|
||||
chrome.storage.local.get('showOtherPids', function (result) {
|
||||
if (result.showOtherPids) {
|
||||
if (store.get('showOtherPids', false) ) {
|
||||
$theOtherPids.removeClass("is-hidden");
|
||||
$showAdvancedPids.prop('checked', true);
|
||||
} else {
|
||||
|
@ -194,15 +192,15 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$showAdvancedPids.prop('checked', false);
|
||||
}
|
||||
$showAdvancedPids.change();
|
||||
});
|
||||
|
||||
|
||||
$showAdvancedPids.on('change', function() {
|
||||
if ($showAdvancedPids.is(':checked')) {
|
||||
$theOtherPids.removeClass("is-hidden");
|
||||
chrome.storage.local.set({ showOtherPids: true });
|
||||
store.set('showOtherPids', true);
|
||||
} else {
|
||||
$theOtherPids.addClass("is-hidden");
|
||||
chrome.storage.local.set({ showOtherPids: false });
|
||||
store.set('showOtherPids', false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -277,7 +275,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$(".tab-pid_tuning").remove();
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningDataRefreshed'));
|
||||
GUI.log(localization.getMessage('pidTuningDataRefreshed'));
|
||||
TABS.pid_tuning.initialize();
|
||||
});
|
||||
});
|
||||
|
@ -312,7 +310,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningEepromSaved'));
|
||||
GUI.log(localization.getMessage('pidTuningEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
<tbody>
|
||||
<tr class="portConfiguration">
|
||||
<td class="identifierCell">
|
||||
<p><div class="identifier"/> <div class="softSerialWarning"><img src="../images/icons/cf_icon_armed_active.svg" height="16" width="16" data-i18n_title="softSerialWarning"/></div></p>
|
||||
<p><div class="identifier"/> <div class="softSerialWarning"><img src="./images/icons/cf_icon_armed_active.svg" height="16" width="16" data-i18n_title="softSerialWarning"/></div></p>
|
||||
</td>
|
||||
<td class="functionsCell-data"><select class="msp_baudrate">
|
||||
<!-- list generated here -->
|
||||
|
||||
</select></td>
|
||||
<td class="functionsCell-telemetry"><select class="telemetry_baudrate"">
|
||||
<td class="functionsCell-telemetry"><select class="telemetry_baudrate">
|
||||
<!-- list generated here -->
|
||||
</select></td>
|
||||
<td class="functionsCell-rx"></td>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<!-- list generated here -->
|
||||
</select></td>
|
||||
<td class="functionsCell-peripherals"><select class="peripherals_baudrate">
|
||||
<!-- list generated here -->
|
||||
<!-- list generated here -->r
|
||||
</select></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -122,7 +122,7 @@ TABS.ports.initialize = function (callback) {
|
|||
);
|
||||
|
||||
for (var i = 0; i < portFunctionRules.length; i++) {
|
||||
portFunctionRules[i].displayName = chrome.i18n.getMessage('portsFunction_' + portFunctionRules[i].name);
|
||||
portFunctionRules[i].displayName = localization.getMessage('portsFunction_' + portFunctionRules[i].name);
|
||||
}
|
||||
|
||||
var mspBaudRates = [
|
||||
|
@ -167,7 +167,6 @@ TABS.ports.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'ports') {
|
||||
GUI.active_tab = 'ports';
|
||||
googleAnalytics.sendAppView('Ports');
|
||||
}
|
||||
|
||||
load_configuration_from_fc();
|
||||
|
@ -176,7 +175,7 @@ TABS.ports.initialize = function (callback) {
|
|||
MSP.send_message(MSPCodes.MSP2_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
|
||||
|
||||
function on_configuration_loaded_handler() {
|
||||
GUI.load("./tabs/ports.html", on_tab_loaded_handler);
|
||||
GUI.load(path.join(__dirname, "tabs/ports.html"), on_tab_loaded_handler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,22 +201,22 @@ TABS.ports.initialize = function (callback) {
|
|||
$elements;
|
||||
|
||||
$elements = $('select.sensors_baudrate');
|
||||
for (i = 0; i < gpsBaudRates.length; i++) {
|
||||
for (let i = 0; i < gpsBaudRates.length; i++) {
|
||||
$elements.append('<option value="' + gpsBaudRates[i] + '">' + gpsBaudRates[i] + '</option>');
|
||||
}
|
||||
|
||||
$elements = $('select.msp_baudrate');
|
||||
for (i = 0; i < mspBaudRates.length; i++) {
|
||||
for (let i = 0; i < mspBaudRates.length; i++) {
|
||||
$elements.append('<option value="' + mspBaudRates[i] + '">' + mspBaudRates[i] + '</option>');
|
||||
}
|
||||
|
||||
$elements = $('select.telemetry_baudrate');
|
||||
for (i = 0; i < telemetryBaudRates_post1_6_3.length; i++) {
|
||||
for (let i = 0; i < telemetryBaudRates_post1_6_3.length; i++) {
|
||||
$elements.append('<option value="' + telemetryBaudRates_post1_6_3[i] + '">' + telemetryBaudRates_post1_6_3[i] + '</option>');
|
||||
}
|
||||
|
||||
$elements = $('select.peripherals_baudrate');
|
||||
for (i = 0; i < peripheralsBaudRates.length; i++) {
|
||||
for (let i = 0; i < peripheralsBaudRates.length; i++) {
|
||||
$elements.append('<option value="' + peripheralsBaudRates[i] + '">' + peripheralsBaudRates[i] + '</option>');
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,7 @@ TABS.ports.initialize = function (callback) {
|
|||
let functions_e_id = "portFunc-" + column + "-" + portIndex;
|
||||
functions_e.attr("id", functions_e_id);
|
||||
|
||||
for (i = 0; i < portFunctionRules.length; i++) {
|
||||
for (let i = 0; i < portFunctionRules.length; i++) {
|
||||
var functionRule = portFunctionRules[i];
|
||||
var functionName = functionRule.name;
|
||||
|
||||
|
@ -277,10 +276,10 @@ TABS.ports.initialize = function (callback) {
|
|||
var selectElementSelector = 'select[name=' + selectElementName + ']';
|
||||
select_e = functions_e.find(selectElementSelector);
|
||||
|
||||
if (select_e.length == 0) {
|
||||
if (select_e.size() == 0) {
|
||||
functions_e.prepend('<span class="function"><select name="' + selectElementName + '" class="' + selectElementName + '" onchange="updateDefaultBaud(\'' + functions_e_id + '\', \'' + column + '\')" /></span>');
|
||||
select_e = functions_e.find(selectElementSelector);
|
||||
var disabledText = chrome.i18n.getMessage('portsTelemetryDisabled');
|
||||
var disabledText = localization.getMessage('portsTelemetryDisabled');
|
||||
select_e.append('<option value="">' + disabledText + '</option>');
|
||||
}
|
||||
select_e.append('<option value="' + functionName + '">' + functionRule.displayName + '</option>');
|
||||
|
@ -298,7 +297,7 @@ TABS.ports.initialize = function (callback) {
|
|||
|
||||
function on_tab_loaded_handler() {
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
update_ui();
|
||||
|
||||
|
@ -337,10 +336,6 @@ TABS.ports.initialize = function (callback) {
|
|||
functions.push(sensorsFunction);
|
||||
}
|
||||
|
||||
if (telemetryFunction.length > 0) {
|
||||
googleAnalytics.sendEvent('Setting', 'Telemetry Protocol', telemetryFunction);
|
||||
}
|
||||
|
||||
var serialPort = {
|
||||
functions: functions,
|
||||
msp_baudrate: $(portConfiguration_e).find('.msp_baudrate').val(),
|
||||
|
@ -359,7 +354,7 @@ TABS.ports.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function on_saved_handler() {
|
||||
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
|
||||
GUI.log(localization.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function() {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, on_reboot_success_handler);
|
||||
|
@ -367,7 +362,7 @@ TABS.ports.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function on_reboot_success_handler() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_ports a'));
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +373,7 @@ function updateDefaultBaud(baudSelect, column) {
|
|||
let portName = section.find('.function-' + column).val();
|
||||
let baudRate = (column === 'telemetry') ? "AUTO" : 115200;;
|
||||
|
||||
for (i = 0; i < portFunctionRules.length; i++) {
|
||||
for (let i = 0; i < portFunctionRules.length; i++) {
|
||||
if (portFunctionRules[i].name === portName) {
|
||||
if (typeof portFunctionRules[i].defaultBaud !== 'undefined') {
|
||||
baudRate = portFunctionRules[i].defaultBaud;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global TABS,MSPChainerClass,mspHelper,googleAnalytics,GUI,LOGIC_CONDITIONS,PROGRAMMING_PID,GLOBAL_VARIABLES_STATUS,helper,LOGIC_CONDITIONS_STATUS,PROGRAMMING_PID_STATUS*/
|
||||
/*global TABS,MSPChainerClass,mspHelper,GUI,LOGIC_CONDITIONS,PROGRAMMING_PID,GLOBAL_VARIABLES_STATUS,helper,LOGIC_CONDITIONS_STATUS,PROGRAMMING_PID_STATUS*/
|
||||
'use strict';
|
||||
|
||||
TABS.programming = {};
|
||||
|
@ -10,7 +10,6 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
|
||||
if (GUI.active_tab != 'programming') {
|
||||
GUI.active_tab = 'programming';
|
||||
googleAnalytics.sendAppView('Programming');
|
||||
}
|
||||
|
||||
loadChainer.setChain([
|
||||
|
@ -36,7 +35,7 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
statusChainer.setExitPoint(onStatusPullDone);
|
||||
|
||||
function loadHtml() {
|
||||
GUI.load("./tabs/programming.html", processHtml);
|
||||
GUI.load(path.join(__dirname, "tabs/programming.html"), processHtml);
|
||||
}
|
||||
|
||||
function processHtml() {
|
||||
|
@ -50,11 +49,11 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
|
||||
helper.tabs.init($('.tab-programming'));
|
||||
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
$('#save-button').click(function () {
|
||||
saveChainer.execute();
|
||||
GUI.log(chrome.i18n.getMessage('programmingEepromSaved'));
|
||||
GUI.log(localization.getMessage('programmingEepromSaved'));
|
||||
});
|
||||
|
||||
helper.mspBalancedInterval.add('logic_conditions_pull', 100, 1, function () {
|
||||
|
|
|
@ -11,7 +11,6 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'receiver') {
|
||||
GUI.active_tab = 'receiver';
|
||||
googleAnalytics.sendAppView('Receiver');
|
||||
}
|
||||
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
@ -30,7 +29,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
loadChainer.execute();
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/receiver.html", Settings.processHtml(process_html));
|
||||
GUI.load(path.join(__dirname, "tabs/receiver.html"), Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function saveSettings(onComplete) {
|
||||
|
@ -74,7 +73,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
let $receiverMode = $('#receiver_type'),
|
||||
$serialWrapper = $('#serialrx_provider-wrapper');
|
||||
|
@ -121,10 +120,10 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
// generate bars
|
||||
var bar_names = [
|
||||
chrome.i18n.getMessage('controlAxisRoll'),
|
||||
chrome.i18n.getMessage('controlAxisPitch'),
|
||||
chrome.i18n.getMessage('controlAxisYaw'),
|
||||
chrome.i18n.getMessage('controlAxisThrottle')
|
||||
localization.getMessage('controlAxisRoll'),
|
||||
localization.getMessage('controlAxisPitch'),
|
||||
localization.getMessage('controlAxisYaw'),
|
||||
localization.getMessage('controlAxisThrottle')
|
||||
],
|
||||
bar_container = $('.tab-receiver .bars');
|
||||
|
||||
|
@ -133,7 +132,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
if (i < bar_names.length) {
|
||||
name = bar_names[i];
|
||||
} else {
|
||||
name = chrome.i18n.getMessage("radioChannelShort") + (i + 1);
|
||||
name = localization.getMessage("radioChannelShort") + (i + 1);
|
||||
}
|
||||
|
||||
bar_container.append('\
|
||||
|
@ -298,17 +297,11 @@ TABS.receiver.initialize = function (callback) {
|
|||
var rcMapValue = $('input[name="rcmap"]').val();
|
||||
var strBuffer = rcMapValue.split('');
|
||||
|
||||
/*
|
||||
* Send tracking event so we can know if users are using different mappings than EATR
|
||||
*/
|
||||
googleAnalytics.sendEvent('Setting', 'RcMappingSave', rcMapValue);
|
||||
|
||||
for (var i = 0; i < RC_MAP.length; i++) {
|
||||
RC_MAP[i] = strBuffer.indexOf(FC.getRcMapLetters()[i]);
|
||||
}
|
||||
|
||||
googleAnalytics.sendEvent('Setting', 'RcProtocol', $('#receiver_type option:selected').text() + ":" + $('#serialrx_provider option:selected').text());
|
||||
|
||||
// catch rssi aux
|
||||
MISC.rssi_channel = parseInt($('select[name="rssi_channel"]').val());
|
||||
|
||||
|
@ -330,11 +323,11 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('receiverEepromSaved'));
|
||||
GUI.log(localization.getMessage('receiverEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect($('.tab_receiver a'));
|
||||
});
|
||||
});
|
||||
|
@ -349,7 +342,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
windowWidth = 420,
|
||||
windowHeight = Math.min(window.innerHeight, 720);
|
||||
|
||||
chrome.app.window.create("/tabs/receiver_msp.html", {
|
||||
window.open("/html/receiver_msp.html", {
|
||||
id: "receiver_msp",
|
||||
innerBounds: {
|
||||
minWidth: windowWidth, minHeight: windowHeight,
|
||||
|
@ -394,7 +387,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
var i;
|
||||
|
||||
// update bars with latest data
|
||||
for (i = 0; i < RC.active_channels; i++) {
|
||||
for (let i = 0; i < RC.active_channels; i++) {
|
||||
meter_fill_array[i].css('width', ((RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
||||
meter_label_array[i].text(RC.channels[i]);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="/build/receiver-msp.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="/build/receiver-msp.css" media="all" />
|
||||
<script type="text/javascript" src="/js/libraries/jquery.nouislider.all.min.js"></script>
|
||||
<script type="text/javascript" src="/js/tabs/receiver_msp.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="./../css/receiver-msp.css" media="all" />
|
||||
<script type="text/javascript" src="/js/localization.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="control-gimbals">
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
window.$ = window.jQuery = require('jquery');
|
||||
|
||||
var localization = new Localiziation("en");;
|
||||
|
||||
var
|
||||
CHANNEL_MIN_VALUE = 1000,
|
||||
CHANNEL_MID_VALUE = 1500,
|
||||
|
@ -63,7 +67,7 @@ function transmitChannels() {
|
|||
// Callback given to us by the window creator so we can have it send data over MSP for us:
|
||||
if (!window.setRawRx(channelValues)) {
|
||||
// MSP connection has gone away
|
||||
chrome.app.window.current().close();
|
||||
window.current().close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,12 +122,12 @@ function localizeAxisNames() {
|
|||
var
|
||||
gimbal = gimbalElems.get(gimbalIndex);
|
||||
|
||||
$(".gimbal-label-vert", gimbal).text(chrome.i18n.getMessage("controlAxis" + gimbals[gimbalIndex][0]));
|
||||
$(".gimbal-label-horz", gimbal).text(chrome.i18n.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
|
||||
$(".gimbal-label-vert", gimbal).text(localization.getMessage("controlAxis" + gimbals[gimbalIndex][0]));
|
||||
$(".gimbal-label-horz", gimbal).text(localization.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
|
||||
}
|
||||
|
||||
for (var sliderIndex = 0; sliderIndex < 8; sliderIndex++) {
|
||||
$(".slider-label", sliderElems.get(sliderIndex)).text(chrome.i18n.getMessage("radioChannelShort") + (sliderIndex + 5));
|
||||
$(".slider-label", sliderElems.get(sliderIndex)).text(localization.getMessage("radioChannelShort") + (sliderIndex + 5));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,9 +137,9 @@ $(document).ready(function() {
|
|||
shrinkHeight = $(".warning").height();
|
||||
|
||||
$(".warning").slideUp("short", function() {
|
||||
chrome.app.window.current().innerBounds.minHeight -= shrinkHeight;
|
||||
chrome.app.window.current().innerBounds.height -= shrinkHeight;
|
||||
chrome.app.window.current().innerBounds.maxHeight -= shrinkHeight;
|
||||
window.current().innerBounds.minHeight -= shrinkHeight;
|
||||
window.current().innerBounds.height -= shrinkHeight;
|
||||
window.current().innerBounds.maxHeight -= shrinkHeight;
|
||||
});
|
||||
|
||||
enableTX = true;
|
||||
|
|
|
@ -6,7 +6,6 @@ TABS.sensors.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'sensors') {
|
||||
GUI.active_tab = 'sensors';
|
||||
googleAnalytics.sendAppView('Sensors');
|
||||
}
|
||||
|
||||
function initSensorData(){
|
||||
|
@ -44,7 +43,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
while (data[0].length > 300) {
|
||||
for (i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
data[i].shift();
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +197,9 @@ TABS.sensors.initialize = function (callback) {
|
|||
}
|
||||
}
|
||||
|
||||
GUI.load("./tabs/sensors.html", function load_html() {
|
||||
GUI.load(path.join(__dirname, "tabs/sensors.html"), function load_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
// disable graphs for sensors that are missing
|
||||
var checkboxes = $('.tab-sensors .info .checkboxes input');
|
||||
|
@ -257,10 +256,10 @@ TABS.sensors.initialize = function (callback) {
|
|||
|
||||
$('.tab-sensors .rate select:first').change();
|
||||
|
||||
chrome.storage.local.set({'graphs_enabled': checkboxes});
|
||||
store.set('graphs_enabled', checkboxes);
|
||||
});
|
||||
|
||||
chrome.storage.local.get('graphs_enabled', function (result) {
|
||||
store.get('graphs_enabled', function (result) {
|
||||
if (result.graphs_enabled) {
|
||||
var checkboxes = $('.tab-sensors .info .checkboxes input');
|
||||
for (var i = 0; i < result.graphs_enabled.length; i++) {
|
||||
|
@ -299,7 +298,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
initDataArray(1),
|
||||
initDataArray(1)
|
||||
];
|
||||
debug_data = [
|
||||
var debug_data = [
|
||||
initDataArray(1),
|
||||
initDataArray(1),
|
||||
initDataArray(1),
|
||||
|
@ -354,23 +353,23 @@ TABS.sensors.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// set refresh speeds according to configuration saved in storage
|
||||
chrome.storage.local.get('sensor_settings', function (result) {
|
||||
if (result.sensor_settings) {
|
||||
$('.tab-sensors select[name="gyro_refresh_rate"]').val(result.sensor_settings.rates.gyro);
|
||||
$('.tab-sensors select[name="gyro_scale"]').val(result.sensor_settings.scales.gyro);
|
||||
var sensor_settings = store.get('sensor_settings', false)
|
||||
if (sensor_settings) {
|
||||
$('.tab-sensors select[name="gyro_refresh_rate"]').val(sensor_settings.rates.gyro);
|
||||
$('.tab-sensors select[name="gyro_scale"]').val(sensor_settings.scales.gyro);
|
||||
|
||||
$('.tab-sensors select[name="accel_refresh_rate"]').val(result.sensor_settings.rates.accel);
|
||||
$('.tab-sensors select[name="accel_scale"]').val(result.sensor_settings.scales.accel);
|
||||
$('.tab-sensors select[name="accel_refresh_rate"]').val(sensor_settings.rates.accel);
|
||||
$('.tab-sensors select[name="accel_scale"]').val(sensor_settings.scales.accel);
|
||||
|
||||
$('.tab-sensors select[name="mag_refresh_rate"]').val(result.sensor_settings.rates.mag);
|
||||
$('.tab-sensors select[name="mag_scale"]').val(result.sensor_settings.scales.mag);
|
||||
$('.tab-sensors select[name="mag_refresh_rate"]').val(sensor_settings.rates.mag);
|
||||
$('.tab-sensors select[name="mag_scale"]').val(sensor_settings.scales.mag);
|
||||
|
||||
$('.tab-sensors select[name="baro_refresh_rate"]').val(result.sensor_settings.rates.baro);
|
||||
$('.tab-sensors select[name="sonar_refresh_rate"]').val(result.sensor_settings.rates.sonar);
|
||||
$('.tab-sensors select[name="baro_refresh_rate"]').val(sensor_settings.rates.baro);
|
||||
$('.tab-sensors select[name="sonar_refresh_rate"]').val(sensor_settings.rates.sonar);
|
||||
|
||||
$('.tab-sensors select[name="airspeed_refresh_rate"]').val(result.sensor_settings.rates.airspeed);
|
||||
$('.tab-sensors select[name="airspeed_refresh_rate"]').val(sensor_settings.rates.airspeed);
|
||||
|
||||
$('.tab-sensors select[name="debug_refresh_rate"]').val(result.sensor_settings.rates.debug);
|
||||
$('.tab-sensors select[name="debug_refresh_rate"]').val(sensor_settings.rates.debug);
|
||||
|
||||
// start polling data by triggering refresh rate change event
|
||||
$('.tab-sensors .rate select:first').change();
|
||||
|
@ -378,7 +377,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
// start polling immediatly (as there is no configuration saved in the storage)
|
||||
$('.tab-sensors .rate select:first').change();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.tab-sensors .rate select, .tab-sensors .scale select').change(function () {
|
||||
// if any of the select fields change value, all of the select values are grabbed
|
||||
|
@ -406,7 +405,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
var fastest = d3.min([rates.gyro, rates.accel, rates.mag]);
|
||||
|
||||
// store current/latest refresh rates in the storage
|
||||
chrome.storage.local.set({'sensor_settings': {'rates': rates, 'scales': scales}});
|
||||
store.set('sensor_settings', {'rates': rates, 'scales': scales});
|
||||
|
||||
// re-initialize domains with new scales
|
||||
gyroHelpers = initGraphHelpers('#gyro', samples_gyro_i, [-scales.gyro, scales.gyro]);
|
||||
|
@ -596,7 +595,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
var windowWidth = 500;
|
||||
var windowHeight = 510;
|
||||
|
||||
chrome.app.window.create("/tabs/debug_trace.html", {
|
||||
window.open("/tabs/debug_trace.html", {
|
||||
id: "debug_trace",
|
||||
innerBounds: {
|
||||
minWidth: windowWidth, minHeight: windowHeight,
|
||||
|
|
|
@ -16,7 +16,6 @@ TABS.setup.initialize = function (callback) {
|
|||
|
||||
if (GUI.active_tab != 'setup') {
|
||||
GUI.active_tab = 'setup';
|
||||
googleAnalytics.sendAppView('Setup');
|
||||
}
|
||||
|
||||
var loadChainer = new MSPChainerClass();
|
||||
|
@ -33,26 +32,26 @@ TABS.setup.initialize = function (callback) {
|
|||
loadChainer.execute();
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/setup.html", process_html);
|
||||
GUI.load(path.join(__dirname, "tabs/setup.html"), process_html);
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
localization.localize();;
|
||||
|
||||
if (!FC.isMotorOutputEnabled()) {
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("logPwmOutputDisabled") + "</strong></span>");
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("logPwmOutputDisabled") + "</strong></span>");
|
||||
}
|
||||
|
||||
// initialize 3D
|
||||
self.initialize3D();
|
||||
|
||||
// set roll in interactive block
|
||||
$('span.roll').text(chrome.i18n.getMessage('initialSetupAttitude', [0]));
|
||||
$('span.roll').text(localization.getMessage('initialSetupAttitude', [0]));
|
||||
// set pitch in interactive block
|
||||
$('span.pitch').text(chrome.i18n.getMessage('initialSetupAttitude', [0]));
|
||||
$('span.pitch').text(localization.getMessage('initialSetupAttitude', [0]));
|
||||
// set heading in interactive block
|
||||
$('span.heading').text(chrome.i18n.getMessage('initialSetupAttitude', [0]));
|
||||
$('span.heading').text(localization.getMessage('initialSetupAttitude', [0]));
|
||||
|
||||
|
||||
// check if we have magnetometer
|
||||
|
@ -64,13 +63,13 @@ TABS.setup.initialize = function (callback) {
|
|||
self.initializeInstruments();
|
||||
|
||||
$('a.resetSettings').click(function () {
|
||||
if (confirm(chrome.i18n.getMessage('confirm_reset_settings'))) {
|
||||
if (confirm(localization.getMessage('confirm_reset_settings'))) {
|
||||
MSP.send_message(MSPCodes.MSP_RESET_CONF, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupSettingsRestored'));
|
||||
GUI.log(localization.getMessage('initialSetupSettingsRestored'));
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
GUI.log(localization.getMessage('deviceRebooting'));
|
||||
GUI.handleReconnect();
|
||||
});
|
||||
});
|
||||
|
@ -79,12 +78,12 @@ TABS.setup.initialize = function (callback) {
|
|||
});
|
||||
|
||||
// display current yaw fix value (important during tab re-initialization)
|
||||
$('div#interactive_block > a.reset').text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
$('div#interactive_block > a.reset').text(localization.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
|
||||
// reset yaw button hook
|
||||
$('div#interactive_block > a.reset').click(function () {
|
||||
self.yaw_fix = SENSOR_DATA.kinematics[2] * - 1.0;
|
||||
$(this).text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
$(this).text(localization.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
|
||||
console.log('YAW reset to 0 deg, fix: ' + self.yaw_fix + ' deg');
|
||||
});
|
||||
|
@ -120,11 +119,11 @@ TABS.setup.initialize = function (callback) {
|
|||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
|
||||
var gpsFixType = chrome.i18n.getMessage('gpsFixNone');
|
||||
var gpsFixType = localization.getMessage('gpsFixNone');
|
||||
if (GPS_DATA.fix >= 2)
|
||||
gpsFixType = chrome.i18n.getMessage('gpsFix3D');
|
||||
gpsFixType = localization.getMessage('gpsFix3D');
|
||||
else if (GPS_DATA.fix >= 1)
|
||||
gpsFixType = chrome.i18n.getMessage('gpsFix2D');
|
||||
gpsFixType = localization.getMessage('gpsFix2D');
|
||||
gpsFix_e.html(gpsFixType);
|
||||
gpsSats_e.text(GPS_DATA.numSat);
|
||||
gpsLat_e.text((GPS_DATA.lat / 10000000).toFixed(4) + ' deg');
|
||||
|
@ -143,9 +142,9 @@ TABS.setup.initialize = function (callback) {
|
|||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
||||
roll_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
|
||||
pitch_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
|
||||
heading_e.text(chrome.i18n.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
|
||||
roll_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[0]]));
|
||||
pitch_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[1]]));
|
||||
heading_e.text(localization.getMessage('initialSetupAttitude', [SENSOR_DATA.kinematics[2]]));
|
||||
self.render3D();
|
||||
self.updateInstruments();
|
||||
});
|
||||
|
@ -155,21 +154,21 @@ TABS.setup.initialize = function (callback) {
|
|||
helper.mspBalancedInterval.add('setup_data_pull_slow', 250, 1, get_slow_data);
|
||||
|
||||
helper.interval.add('gui_analog_update', function () {
|
||||
bat_cells_e.text(chrome.i18n.getMessage('initialSetupBatteryDetectedCellsValue', [ANALOG.cell_count]));
|
||||
bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryVoltageValue', [ANALOG.voltage]));
|
||||
remaining_capacity_wh_decimals = ANALOG.battery_remaining_capacity.toString().length < 5 ? 3 : (7 - ANALOG.battery_remaining_capacity.toString().length);
|
||||
remaining_capacity_value = MISC.battery_capacity_unit == 'mAh' ? ANALOG.battery_remaining_capacity : (ANALOG.battery_remaining_capacity / 1000).toFixed(remaining_capacity_wh_decimals < 0 ? 0 : remaining_capacity_wh_decimals);
|
||||
remaining_capacity_unit = MISC.battery_capacity_unit == 'mAh' ? 'mAh' : 'Wh';
|
||||
bat_remaining_e.text(chrome.i18n.getMessage('initialSetupBatteryRemainingCapacityValue', ((MISC.battery_capacity > 0) && ANALOG.battery_full_when_plugged_in) ? [remaining_capacity_value, remaining_capacity_unit] : ['NA', '']));
|
||||
bat_percent_e.text(chrome.i18n.getMessage('initialSetupBatteryPercentageValue', [ANALOG.battery_percentage]));
|
||||
bat_full_e.text(chrome.i18n.getMessage('initialSetupBatteryFullValue', [ANALOG.battery_full_when_plugged_in]));
|
||||
bat_thresh_e.text(chrome.i18n.getMessage('initialSetupBatteryThresholdsValue', [ANALOG.use_capacity_thresholds]));
|
||||
bat_mah_drawn_e.text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn]));
|
||||
capacity_drawn_decimals = ANALOG.mWhdrawn.toString().length < 5 ? 3 : (7 - ANALOG.mWhdrawn.toString().length);
|
||||
bat_wh_drawn_e.text(chrome.i18n.getMessage('initialSetup_Wh_drawnValue', [(ANALOG.mWhdrawn / 1000).toFixed(capacity_drawn_decimals < 0 ? 0 : capacity_drawn_decimals)]));
|
||||
bat_current_draw_e.text(chrome.i18n.getMessage('initialSetupCurrentDrawValue', [ANALOG.amperage.toFixed(2)]));
|
||||
bat_power_draw_e.text(chrome.i18n.getMessage('initialSetupPowerDrawValue', [ANALOG.power.toFixed(2)]));
|
||||
rssi_e.text(chrome.i18n.getMessage('initialSetupRSSIValue', [((ANALOG.rssi / 1023) * 100).toFixed(0)]));
|
||||
bat_cells_e.text(localization.getMessage('initialSetupBatteryDetectedCellsValue', [ANALOG.cell_count]));
|
||||
bat_voltage_e.text(localization.getMessage('initialSetupBatteryVoltageValue', [ANALOG.voltage]));
|
||||
let remaining_capacity_wh_decimals = ANALOG.battery_remaining_capacity.toString().length < 5 ? 3 : (7 - ANALOG.battery_remaining_capacity.toString().length);
|
||||
let remaining_capacity_value = MISC.battery_capacity_unit == 'mAh' ? ANALOG.battery_remaining_capacity : (ANALOG.battery_remaining_capacity / 1000).toFixed(remaining_capacity_wh_decimals < 0 ? 0 : remaining_capacity_wh_decimals);
|
||||
let remaining_capacity_unit = MISC.battery_capacity_unit == 'mAh' ? 'mAh' : 'Wh';
|
||||
bat_remaining_e.text(localization.getMessage('initialSetupBatteryRemainingCapacityValue', ((MISC.battery_capacity > 0) && ANALOG.battery_full_when_plugged_in) ? [remaining_capacity_value, remaining_capacity_unit] : ['NA', '']));
|
||||
bat_percent_e.text(localization.getMessage('initialSetupBatteryPercentageValue', [ANALOG.battery_percentage]));
|
||||
bat_full_e.text(localization.getMessage('initialSetupBatteryFullValue', [ANALOG.battery_full_when_plugged_in]));
|
||||
bat_thresh_e.text(localization.getMessage('initialSetupBatteryThresholdsValue', [ANALOG.use_capacity_thresholds]));
|
||||
bat_mah_drawn_e.text(localization.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn]));
|
||||
let capacity_drawn_decimals = ANALOG.mWhdrawn.toString().length < 5 ? 3 : (7 - ANALOG.mWhdrawn.toString().length);
|
||||
bat_wh_drawn_e.text(localization.getMessage('initialSetup_Wh_drawnValue', [(ANALOG.mWhdrawn / 1000).toFixed(capacity_drawn_decimals < 0 ? 0 : capacity_drawn_decimals)]));
|
||||
bat_current_draw_e.text(localization.getMessage('initialSetupCurrentDrawValue', [ANALOG.amperage.toFixed(2)]));
|
||||
bat_power_draw_e.text(localization.getMessage('initialSetupPowerDrawValue', [ANALOG.power.toFixed(2)]));
|
||||
rssi_e.text(localization.getMessage('initialSetupRSSIValue', [((ANALOG.rssi / 1023) * 100).toFixed(0)]));
|
||||
}, 100, true);
|
||||
|
||||
function updateArminFailure() {
|
||||
|
@ -177,10 +176,10 @@ TABS.setup.initialize = function (callback) {
|
|||
for (var bit in flagNames) {
|
||||
if (flagNames.hasOwnProperty(bit)) {
|
||||
if (bit_check(CONFIG.armingFlags, bit)) {
|
||||
$('#reason-' + flagNames[bit]).html(chrome.i18n.getMessage('armingCheckFail'));
|
||||
$('#reason-' + flagNames[bit]).html(localization.getMessage('armingCheckFail'));
|
||||
}
|
||||
else {
|
||||
$('#reason-' + flagNames[bit]).html(chrome.i18n.getMessage('armingCheckPass'));
|
||||
$('#reason-' + flagNames[bit]).html(localization.getMessage('armingCheckPass'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +195,7 @@ TABS.setup.initialize = function (callback) {
|
|||
};
|
||||
|
||||
TABS.setup.initializeInstruments = function() {
|
||||
var options = {size:90, showBox : false, img_directory: 'images/flightindicators/'};
|
||||
var options = {size:90, showBox : false, img_directory: path.join(__dirname, '/images/flightindicators/')};
|
||||
var attitude = $.flightIndicator('#attitude', 'attitude', options);
|
||||
var heading = $.flightIndicator('#heading', 'heading', options);
|
||||
|
||||
|
@ -246,7 +245,7 @@ TABS.setup.initialize3D = function () {
|
|||
if (useWebGlRenderer) {
|
||||
if (MIXER_CONFIG.appliedMixerPreset === -1) {
|
||||
model_file = 'custom';
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + chrome.i18n.getMessage("mixerNotConfigured") + "</strong></span>");
|
||||
GUI_control.prototype.log("<span style='color: red; font-weight: bolder'><strong>" + localization.getMessage("mixerNotConfigured") + "</strong></span>");
|
||||
} else {
|
||||
model_file = helper.mixer.getById(MIXER_CONFIG.appliedMixerPreset).model;
|
||||
}
|
||||
|
@ -306,7 +305,7 @@ TABS.setup.initialize3D = function () {
|
|||
camera.aspect = wrapper.width() / wrapper.height();
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
this.render3D();
|
||||
self.render3D();
|
||||
};
|
||||
|
||||
$(window).on('resize', this.resize3D);
|
||||
|
|
50
tabs/sitl.js
50
tabs/sitl.js
|
@ -66,22 +66,16 @@ TABS.sitl.initialize = (callback) => {
|
|||
|
||||
if (GUI.active_tab != 'sitl') {
|
||||
GUI.active_tab = 'sitl';
|
||||
googleAnalytics.sendAppView('SITL');
|
||||
}
|
||||
|
||||
if (GUI.active_tab != 'sitl') {
|
||||
GUI.active_tab = 'sitl';
|
||||
googleAnalytics.sendAppView('SITL');
|
||||
}
|
||||
|
||||
GUI.load("./tabs/sitl.html", function () {
|
||||
localize();
|
||||
GUI.load(path.join(__dirname, "tabs/sitl.html"), function () {
|
||||
localization.localize();
|
||||
|
||||
var os = GUI.operating_system;
|
||||
if (os != 'Windows' && os != 'Linux') {
|
||||
|
||||
$('.content_wrapper').find('*').remove();
|
||||
$('.content_wrapper').append(`<h2>${chrome.i18n.getMessage('sitlOSNotSupported')}</h2>`);
|
||||
$('.content_wrapper').append(`<h2>${localization.getMessage('sitlOSNotSupported')}</h2>`);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
return;
|
||||
|
@ -121,12 +115,12 @@ TABS.sitl.initialize = (callback) => {
|
|||
$('#sitlLog').animate({scrollTop: $('#sitlLog').scrollHeight}, "fast");
|
||||
|
||||
profiles = stdProfiles.slice(0);
|
||||
chrome.storage.local.get('sitlProfiles', (result) => {
|
||||
if(result.sitlProfiles)
|
||||
profiles.push(...result.sitlProfiles);
|
||||
|
||||
var sitlProfiles = store.get('sitlProfiles', false);
|
||||
if (sitlProfiles) {
|
||||
profiles.push(...sitlProfiles);
|
||||
}
|
||||
initElements(true);
|
||||
});
|
||||
|
||||
|
||||
Ser2TCP.resetPortsList();
|
||||
Ser2TCP.pollSerialPorts(ports => {
|
||||
|
@ -235,7 +229,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
$('.sitlStart').removeClass('disabled');
|
||||
Ser2TCP.stop();
|
||||
SITLProcess.stop();
|
||||
appendLog(chrome.i18n.getMessage('sitlStopped'));
|
||||
appendLog(localization.getMessage('sitlStopped'));
|
||||
});
|
||||
|
||||
profileSaveBtn_e.on('click', () => {
|
||||
|
@ -243,12 +237,12 @@ TABS.sitl.initialize = (callback) => {
|
|||
});
|
||||
|
||||
profileNewBtn_e.on('click', () => {
|
||||
var name = prompt(chrome.i18n.getMessage('sitlNewProfile'), chrome.i18n.getMessage('sitlEnterName'));
|
||||
var name = prompt(localization.getMessage('sitlNewProfile'), localization.getMessage('sitlEnterName'));
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
if (profiles.find(e => { return e.name == name })) {
|
||||
alert(chrome.i18n.getMessage('sitlProfileExists'))
|
||||
alert(localization.getMessage('sitlProfileExists'))
|
||||
return;
|
||||
}
|
||||
var eerpromName = name.replace(/[^a-z0-9]/gi, '_').toLowerCase() + ".bin";
|
||||
|
@ -279,7 +273,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
profileDeleteBtn_e.on('click', () => {
|
||||
|
||||
if (currentProfile.isStdProfile) {
|
||||
alert(chrome.i18n.getMessage('sitlStdProfileCantDeleted'));
|
||||
alert(localization.getMessage('sitlStdProfileCantDeleted'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -364,17 +358,15 @@ TABS.sitl.initialize = (callback) => {
|
|||
protocollPreset_e.append(`<option value="${protocoll.name}">${protocoll.name}</option>`);
|
||||
});
|
||||
|
||||
chrome.storage.local.get('sitlLastProfile', (result) => {
|
||||
if (result.sitlLastProfile) {
|
||||
var sitlLastProfile = store.get('sitlLastProfile', false);
|
||||
if (sitlLastProfile) {
|
||||
var element = profiles.find(profile => {
|
||||
return profile.name == result.sitlLastProfile;
|
||||
return profile.name == sitlLastProfile;
|
||||
});
|
||||
|
||||
if (element)
|
||||
profiles_e.val(element.name).trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
updateCurrentProfile();
|
||||
|
@ -382,7 +374,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
|
||||
function saveProfiles() {
|
||||
if (currentProfile.isStdProfile) {
|
||||
alert(chrome.i18n.getMessage('sitlStdProfileCantOverwritten'));
|
||||
alert(localization.getMessage('sitlStdProfileCantOverwritten'));
|
||||
return;
|
||||
}
|
||||
var profilesToSave = [];
|
||||
|
@ -391,9 +383,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
profilesToSave.push(profile);
|
||||
});
|
||||
|
||||
chrome.storage.local.set({
|
||||
'sitlProfiles': profilesToSave
|
||||
});
|
||||
store.set('sitlProfiles', profilesToSave);
|
||||
|
||||
}
|
||||
|
||||
|
@ -461,9 +451,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
simIp_e.val(currentProfile.ip).trigger('change');
|
||||
useImu_e.prop('checked', currentProfile.useImu).trigger('change');
|
||||
|
||||
chrome.storage.local.set({
|
||||
'sitlLastProfile': selected
|
||||
});
|
||||
store.set('sitlLastProfile', selected);
|
||||
}
|
||||
|
||||
function renderChanMapTable()
|
||||
|
@ -485,7 +473,7 @@ TABS.sitl.initialize = (callback) => {
|
|||
|
||||
row.find(".inavChannel").val(mapping[i]).on('change', (sender) => {
|
||||
mapping[$(sender.target).data('out')] = parseInt($(sender.target).val());
|
||||
chrome.storage.local.set({'sitlMapping': mapping});
|
||||
store.set('sitlMapping', mapping);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue