Merge remote-tracking branch 'origin/master' into mmosca-led-reassignment
commit
9ce5716a0a
@ -0,0 +1,729 @@
|
||||
'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_entries.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'));
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,881 @@
|
||||
'use strict';
|
||||
|
||||
var defaultsDialogData = [
|
||||
{
|
||||
"title": 'Mini Quad with 3" propellers',
|
||||
"id": 6,
|
||||
"notRecommended": false,
|
||||
"reboot": true,
|
||||
"mixerToApply": 3,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 3
|
||||
},
|
||||
/*
|
||||
System
|
||||
*/
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "looptime",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "ez_axis_ratio",
|
||||
value: 116
|
||||
},
|
||||
{
|
||||
key: "ez_response",
|
||||
value: 71
|
||||
},
|
||||
{
|
||||
key: "ez_damping",
|
||||
value: 103
|
||||
},
|
||||
{
|
||||
key: "ez_stability",
|
||||
value: 105
|
||||
},
|
||||
{
|
||||
key: "ez_aggressiveness",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "ez_rate",
|
||||
value: 134
|
||||
},
|
||||
{
|
||||
key: "ez_expo",
|
||||
value: 118
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
*/
|
||||
{
|
||||
key: "airmode_type",
|
||||
value: "THROTTLE_THRESHOLD"
|
||||
},
|
||||
{
|
||||
key: "airmode_throttle_threshold",
|
||||
value: 1150
|
||||
},
|
||||
{
|
||||
key: "mc_iterm_relax",
|
||||
value: "RP"
|
||||
},
|
||||
{
|
||||
key: "d_boost_min",
|
||||
value: 1.0
|
||||
},
|
||||
{
|
||||
key: "d_boost_max",
|
||||
value: 1.0
|
||||
},
|
||||
{
|
||||
key: "antigravity_gain",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
{
|
||||
key: "tpa_rate",
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
key: "tpa_breakpoint",
|
||||
value: 1200
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "MULTIROTOR"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": 'Mini Quad with 5" propellers',
|
||||
"id": 2,
|
||||
"notRecommended": false,
|
||||
"reboot": true,
|
||||
"mixerToApply": 3,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 3
|
||||
},
|
||||
/*
|
||||
System
|
||||
*/
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "looptime",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_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
|
||||
},
|
||||
/*
|
||||
Dynamic gyro LPF
|
||||
*/
|
||||
{
|
||||
key: "gyro_use_dyn_lpf",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "gyro_dyn_lpf_min_hz",
|
||||
value: 85
|
||||
},
|
||||
{
|
||||
key: "gyro_dyn_lpf_max_hz",
|
||||
value: 300
|
||||
},
|
||||
{
|
||||
key: "gyro_dyn_lpf_curve_expo",
|
||||
value: 3
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
*/
|
||||
{
|
||||
key: "airmode_type",
|
||||
value: "THROTTLE_THRESHOLD"
|
||||
},
|
||||
{
|
||||
key: "airmode_throttle_threshold",
|
||||
value: 1150
|
||||
},
|
||||
{
|
||||
key: "mc_iterm_relax",
|
||||
value: "RP"
|
||||
},
|
||||
{
|
||||
key: "d_boost_min",
|
||||
value: 1.0
|
||||
},
|
||||
{
|
||||
key: "d_boost_max",
|
||||
value: 1.0
|
||||
},
|
||||
{
|
||||
key: "antigravity_gain",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
{
|
||||
key: "tpa_rate",
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
key: "tpa_breakpoint",
|
||||
value: 1200
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "MULTIROTOR"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": 'Mini Quad with 7" propellers',
|
||||
"id": 5,
|
||||
"notRecommended": false,
|
||||
"reboot": true,
|
||||
"mixerToApply": 3,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 3
|
||||
},
|
||||
/*
|
||||
System
|
||||
*/
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "looptime",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "DSHOT300"
|
||||
},
|
||||
/*
|
||||
Ez Tune setup
|
||||
*/
|
||||
{
|
||||
key: "ez_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "ez_filter_hz",
|
||||
value: 90
|
||||
},
|
||||
{
|
||||
key: "ez_axis_ratio",
|
||||
value: 110
|
||||
},
|
||||
{
|
||||
key: "ez_response",
|
||||
value: 101
|
||||
},
|
||||
{
|
||||
key: "ez_damping",
|
||||
value: 115
|
||||
},
|
||||
{
|
||||
key: "ez_stability",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "ez_aggressiveness",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "ez_rate",
|
||||
value: 134
|
||||
},
|
||||
{
|
||||
key: "ez_expo",
|
||||
value: 118
|
||||
},
|
||||
/*
|
||||
Mechanics
|
||||
*/
|
||||
{
|
||||
key: "airmode_type",
|
||||
value: "THROTTLE_THRESHOLD"
|
||||
},
|
||||
{
|
||||
key: "airmode_throttle_threshold",
|
||||
value: 1150
|
||||
},
|
||||
{
|
||||
key: "mc_iterm_relax",
|
||||
value: "RPY"
|
||||
},
|
||||
{
|
||||
key: "d_boost_min",
|
||||
value: 0.8
|
||||
},
|
||||
{
|
||||
key: "d_boost_max",
|
||||
value: 1.2
|
||||
},
|
||||
{
|
||||
key: "antigravity_gain",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "antigravity_accelerator",
|
||||
value: 5
|
||||
},
|
||||
/*
|
||||
* TPA
|
||||
*/
|
||||
{
|
||||
key: "tpa_rate",
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
key: "tpa_breakpoint",
|
||||
value: 1200
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "MULTIROTOR"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": 'Airplane with a Tail',
|
||||
"notRecommended": false,
|
||||
"id": 3,
|
||||
"reboot": true,
|
||||
"mixerToApply": 14,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 14
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "AIRPLANE"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
key: "dterm_lpf_hz",
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
key: "d_boost_min",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
key: "d_boost_max",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_q",
|
||||
value: 250
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_min_hz",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "STANDARD"
|
||||
},
|
||||
{
|
||||
key: "ahrs_inertia_comp_method",
|
||||
value: "ADAPTIVE"
|
||||
},
|
||||
{
|
||||
key: "throttle_idle",
|
||||
value: 5.0
|
||||
},
|
||||
{
|
||||
key: "rc_yaw_expo",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "rc_expo",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "roll_rate",
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
key: "pitch_rate",
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
key: "yaw_rate",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_p",
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_i",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_d",
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_xy_p",
|
||||
value: 55
|
||||
},
|
||||
{
|
||||
key: "fw_turn_assist_pitch_gain",
|
||||
value: 0.4
|
||||
},
|
||||
{
|
||||
key: "max_angle_inclination_rll",
|
||||
value: 450
|
||||
},
|
||||
{
|
||||
key: "nav_fw_bank_angle",
|
||||
value: 35
|
||||
},
|
||||
{
|
||||
key: "fw_p_pitch",
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
key: "fw_i_pitch",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "fw_d_pitch",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "fw_ff_pitch",
|
||||
value: 80
|
||||
},
|
||||
{
|
||||
key: "fw_p_roll",
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
key: "fw_i_roll",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
key: "fw_d_roll",
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
key: "fw_ff_roll",
|
||||
value: 50
|
||||
},
|
||||
{
|
||||
key: "fw_p_yaw",
|
||||
value: 50
|
||||
},
|
||||
{
|
||||
key: "fw_i_yaw",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
key: "fw_d_yaw",
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
key: "fw_ff_yaw",
|
||||
value: 255
|
||||
},
|
||||
{
|
||||
key: "airmode_type",
|
||||
value: "STICK_CENTER_ONCE"
|
||||
},
|
||||
{
|
||||
key: "small_angle",
|
||||
value: 180
|
||||
},
|
||||
{
|
||||
key: "nav_fw_control_smoothness",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "nav_rth_allow_landing",
|
||||
value: "FS_ONLY"
|
||||
},
|
||||
{
|
||||
key: "nav_rth_altitude",
|
||||
value: 5000
|
||||
},
|
||||
{
|
||||
key: "nav_wp_radius",
|
||||
value: 800
|
||||
},
|
||||
{
|
||||
key: "nav_wp_max_safe_distance",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_max_angle",
|
||||
value: 45
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_motor_delay",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_max_altitude",
|
||||
value: 5000
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_climb_angle",
|
||||
value: 25
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"title": 'Airplane without a Tail (Wing, Delta, etc)',
|
||||
"notRecommended": false,
|
||||
"id": 4,
|
||||
"reboot": true,
|
||||
"mixerToApply": 8,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "AIRPLANE"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 25
|
||||
},
|
||||
{
|
||||
key: "dterm_lpf_hz",
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
key: "d_boost_min",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
key: "d_boost_max",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_enabled",
|
||||
value: "ON"
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_q",
|
||||
value: 250
|
||||
},
|
||||
{
|
||||
key: "dynamic_gyro_notch_min_hz",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "STANDARD"
|
||||
},
|
||||
{
|
||||
key: "ahrs_inertia_comp_method",
|
||||
value: "ADAPTIVE"
|
||||
},
|
||||
{
|
||||
key: "throttle_idle",
|
||||
value: 5.0
|
||||
},
|
||||
{
|
||||
key: "rc_yaw_expo",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "rc_expo",
|
||||
value: 30
|
||||
},
|
||||
{
|
||||
key: "roll_rate",
|
||||
value: 18
|
||||
},
|
||||
{
|
||||
key: "pitch_rate",
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
key: "yaw_rate",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_p",
|
||||
value: 35
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_i",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_z_d",
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_xy_p",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "fw_turn_assist_pitch_gain",
|
||||
value: 0.3
|
||||
},
|
||||
{
|
||||
key: "max_angle_inclination_rll",
|
||||
value: 550
|
||||
},
|
||||
{
|
||||
key: "nav_fw_bank_angle",
|
||||
value: 45
|
||||
},
|
||||
{
|
||||
key: "fw_p_pitch",
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
key: "fw_i_pitch",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "fw_d_pitch",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "fw_ff_pitch",
|
||||
value: 70
|
||||
},
|
||||
{
|
||||
key: "fw_p_roll",
|
||||
value: 15
|
||||
},
|
||||
{
|
||||
key: "fw_i_roll",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
key: "fw_d_roll",
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
key: "fw_ff_roll",
|
||||
value: 50
|
||||
},
|
||||
{
|
||||
key: "fw_p_yaw",
|
||||
value: 20
|
||||
},
|
||||
{
|
||||
key: "fw_i_yaw",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
key: "fw_d_yaw",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
key: "fw_ff_yaw",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "airmode_type",
|
||||
value: "STICK_CENTER_ONCE"
|
||||
},
|
||||
{
|
||||
key: "small_angle",
|
||||
value: 180
|
||||
},
|
||||
{
|
||||
key: "nav_fw_control_smoothness",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "nav_rth_allow_landing",
|
||||
value: "FS_ONLY"
|
||||
},
|
||||
{
|
||||
key: "nav_rth_altitude",
|
||||
value: 5000
|
||||
},
|
||||
{
|
||||
key: "nav_wp_radius",
|
||||
value: 1000
|
||||
},
|
||||
{
|
||||
key: "nav_wp_max_safe_distance",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_max_angle",
|
||||
value: 75
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_motor_delay",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_max_altitude",
|
||||
value: 5000
|
||||
},
|
||||
{
|
||||
key: "nav_fw_launch_climb_angle",
|
||||
value: 25
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"title": 'Rovers & Boats',
|
||||
"id": 1,
|
||||
"notRecommended": false,
|
||||
"reboot": true,
|
||||
"mixerToApply": 31,
|
||||
"wizardPages": ['receiver'],
|
||||
"settings": [
|
||||
{
|
||||
key: "model_preview_type",
|
||||
value: 31
|
||||
},
|
||||
{
|
||||
key: "gyro_hardware_lpf",
|
||||
value: "256HZ"
|
||||
},
|
||||
{
|
||||
key: "gyro_main_lpf_hz",
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
key: "motor_pwm_protocol",
|
||||
value: "STANDARD"
|
||||
},
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
key: "failsafe_procedure",
|
||||
value: "DROP"
|
||||
},
|
||||
{
|
||||
key: "platform_type",
|
||||
value: "ROVER"
|
||||
},
|
||||
{
|
||||
key: "nav_wp_max_safe_distance",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "nav_fw_loiter_radius",
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
key: "nav_fw_yaw_deadband",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
key: "pidsum_limit_yaw",
|
||||
value: 500
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_hdg_p",
|
||||
value: 60
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_hdg_i",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
key: "nav_fw_pos_hdg_d",
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": 'Keep current settings (Not recommended)',
|
||||
"id": 0,
|
||||
"notRecommended": true,
|
||||
"reboot": false,
|
||||
"settings": [
|
||||
{
|
||||
key: "applied_defaults",
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
module.exports = defaultsDialogData;
|
@ -0,0 +1,286 @@
|
||||
'use strict';
|
||||
|
||||
var FLIGHT_MODES = [
|
||||
{
|
||||
boxId: 0,
|
||||
boxName: "ARM",
|
||||
permanentId: 0
|
||||
},
|
||||
{
|
||||
boxId: 1,
|
||||
boxName: "ANGLE",
|
||||
permanentId: 1
|
||||
},
|
||||
{
|
||||
boxId: 2,
|
||||
boxName: "HORIZON",
|
||||
permanentId: 2
|
||||
},
|
||||
{
|
||||
boxId: 3,
|
||||
boxName: "NAV ALTHOLD",
|
||||
permanentId: 3
|
||||
},
|
||||
{
|
||||
boxId: 4,
|
||||
boxName: "HEADING HOLD",
|
||||
permanentId: 5
|
||||
},
|
||||
{
|
||||
boxId: 5,
|
||||
boxName: "HEADFREE",
|
||||
permanentId: 6
|
||||
},
|
||||
{
|
||||
boxId: 6,
|
||||
boxName: "HEADADJ",
|
||||
permanentId: 7
|
||||
},
|
||||
{
|
||||
boxId: 7,
|
||||
boxName: "CAMSTAB",
|
||||
permanentId: 8
|
||||
},
|
||||
{
|
||||
boxId: 8,
|
||||
boxName: "NAV RTH",
|
||||
permanentId: 10
|
||||
},
|
||||
{
|
||||
boxId: 9,
|
||||
boxName: "NAV POSHOLD",
|
||||
permanentId: 11
|
||||
},
|
||||
{
|
||||
boxId: 10,
|
||||
boxName: "MANUAL",
|
||||
permanentId: 12
|
||||
},
|
||||
{
|
||||
boxId: 11,
|
||||
boxName: "BEEPER",
|
||||
permanentId: 13
|
||||
},
|
||||
{
|
||||
boxId: 12,
|
||||
boxName: "LEDS OFF",
|
||||
permanentId: 15
|
||||
},
|
||||
{
|
||||
boxId: 13,
|
||||
boxName: "LIGHTS",
|
||||
permanentId: 16
|
||||
},
|
||||
{
|
||||
boxId: 15,
|
||||
boxName: "OSD OFF",
|
||||
permanentId: 19
|
||||
},
|
||||
{
|
||||
boxId: 16,
|
||||
boxName: "TELEMETRY",
|
||||
permanentId: 20
|
||||
},
|
||||
{
|
||||
boxId: 28,
|
||||
boxName: "AUTO TUNE",
|
||||
permanentId: 21
|
||||
},
|
||||
{
|
||||
boxId: 17,
|
||||
boxName: "BLACKBOX",
|
||||
permanentId: 26
|
||||
},
|
||||
{
|
||||
boxId: 18,
|
||||
boxName: "FAILSAFE",
|
||||
permanentId: 27
|
||||
},
|
||||
{
|
||||
boxId: 19,
|
||||
boxName: "NAV WP",
|
||||
permanentId: 28
|
||||
},
|
||||
{
|
||||
boxId: 20,
|
||||
boxName: "AIR MODE",
|
||||
permanentId: 29
|
||||
},
|
||||
{
|
||||
boxId: 21,
|
||||
boxName: "HOME RESET",
|
||||
permanentId: 30
|
||||
},
|
||||
{
|
||||
boxId: 22,
|
||||
boxName: "GCS NAV",
|
||||
permanentId: 31
|
||||
},
|
||||
{
|
||||
boxId: 39,
|
||||
boxName: "FPV ANGLE MIX",
|
||||
permanentId: 32
|
||||
},
|
||||
{
|
||||
boxId: 24,
|
||||
boxName: "SURFACE",
|
||||
permanentId: 33
|
||||
},
|
||||
{
|
||||
boxId: 25,
|
||||
boxName: "FLAPERON",
|
||||
permanentId: 34
|
||||
},
|
||||
{
|
||||
boxId: 26,
|
||||
boxName: "TURN ASSIST",
|
||||
permanentId: 35
|
||||
},
|
||||
{
|
||||
boxId: 14,
|
||||
boxName: "NAV LAUNCH",
|
||||
permanentId: 36
|
||||
},
|
||||
{
|
||||
boxId: 27,
|
||||
boxName: "SERVO AUTOTRIM",
|
||||
permanentId: 37
|
||||
},
|
||||
{
|
||||
boxId: 23,
|
||||
boxName: "KILLSWITCH",
|
||||
permanentId: 38
|
||||
},
|
||||
{
|
||||
boxId: 29,
|
||||
boxName: "CAMERA CONTROL 1",
|
||||
permanentId: 39
|
||||
},
|
||||
{
|
||||
boxId: 30,
|
||||
boxName: "CAMERA CONTROL 2",
|
||||
permanentId: 40
|
||||
},
|
||||
{
|
||||
boxId: 31,
|
||||
boxName: "CAMERA CONTROL 3",
|
||||
permanentId: 41
|
||||
},
|
||||
{
|
||||
boxId: 32,
|
||||
boxName: "OSD ALT 1",
|
||||
permanentId: 42
|
||||
},
|
||||
{
|
||||
boxId: 33,
|
||||
boxName: "OSD ALT 2",
|
||||
permanentId: 43
|
||||
},
|
||||
{
|
||||
boxId: 34,
|
||||
boxName: "OSD ALT 3",
|
||||
permanentId: 44
|
||||
},
|
||||
{
|
||||
boxId: 35,
|
||||
boxName: "NAV COURSE HOLD",
|
||||
permanentId: 45
|
||||
},
|
||||
{
|
||||
boxId: 36,
|
||||
boxName: "MC BRAKING",
|
||||
permanentId: 46
|
||||
},
|
||||
{
|
||||
boxId: 37,
|
||||
boxName: "USER1",
|
||||
permanentId: 47
|
||||
},
|
||||
{
|
||||
boxId: 38,
|
||||
boxName: "USER2",
|
||||
permanentId: 48
|
||||
},
|
||||
{
|
||||
boxId: 48,
|
||||
boxName: "USER3",
|
||||
permanentId: 57
|
||||
},
|
||||
{
|
||||
boxId: 49,
|
||||
boxName: "USER4",
|
||||
permanentId: 58
|
||||
},
|
||||
{
|
||||
boxId: 40,
|
||||
boxName: "LOITER CHANGE",
|
||||
permanentId: 49
|
||||
},
|
||||
{
|
||||
boxId: 41,
|
||||
boxName: "MSP RC OVERRIDE",
|
||||
permanentId: 50
|
||||
},
|
||||
{
|
||||
boxId: 42,
|
||||
boxName: "PREARM",
|
||||
permanentId: 51
|
||||
},
|
||||
{
|
||||
boxId: 43,
|
||||
boxName: "TURTLE",
|
||||
permanentId: 52
|
||||
},
|
||||
{
|
||||
boxId: 44,
|
||||
boxName: "NAV CRUISE",
|
||||
permanentId: 53
|
||||
},
|
||||
{
|
||||
boxId: 45,
|
||||
boxName: "AUTO LEVEL TRIM",
|
||||
permanentId: 54
|
||||
},
|
||||
{
|
||||
boxId: 46,
|
||||
boxName: "WP PLANNER",
|
||||
permanentId: 55
|
||||
},
|
||||
{
|
||||
boxId: 47,
|
||||
boxName: "SOARING",
|
||||
permanentId: 56
|
||||
},
|
||||
{
|
||||
boxId: 50,
|
||||
boxName: "MISSION CHANGE",
|
||||
permanentId: 59
|
||||
},
|
||||
{
|
||||
boxId: 51,
|
||||
boxName: "BEEPER MUTE",
|
||||
permanentId: 60
|
||||
},
|
||||
{
|
||||
boxId: 52,
|
||||
boxName: "MULTI FUNCTION",
|
||||
permanentId: 61
|
||||
},
|
||||
{
|
||||
boxId: 53,
|
||||
boxName: "MIXER PROFILE 2",
|
||||
permanentId: 62
|
||||
},
|
||||
{
|
||||
boxId: 54,
|
||||
boxName: "MIXER TRANSITION",
|
||||
permanentId: 63
|
||||
},
|
||||
{
|
||||
boxId: 55,
|
||||
boxName: "ANGLE HOLD",
|
||||
permanentId: 64
|
||||
}
|
||||
];
|
||||
|
||||
module.exports = {FLIGHT_MODES};
|
@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
const Store = require('electron-store');
|
||||
const store = new Store();
|
||||
const FC = require('./fc');
|
||||
|
||||
var settingsCache = (function() {
|
||||
|
||||
let publicScope = {};
|
||||
let privateScope = {};
|
||||
|
||||
const SETTINGS_KEY = 'settings';
|
||||
|
||||
privateScope.getSetingKey = function(settingName) {
|
||||
return FC.CONFIG.target + '_' + FC.CONFIG.flightControllerVersion + '_' + settingName;
|
||||
}
|
||||
|
||||
publicScope.flush = function() {
|
||||
store.delete(SETTINGS_KEY);
|
||||
console.log('Settings cache flushed');
|
||||
};
|
||||
|
||||
publicScope.get = function(settingName) {
|
||||
let settings = store.get(SETTINGS_KEY, null);
|
||||
|
||||
if (settings === null) {
|
||||
return undefined;
|
||||
}
|
||||
let setting = settings[privateScope.getSetingKey(settingName)];
|
||||
return setting;
|
||||
};
|
||||
|
||||
publicScope.set = function(settingName, value) {
|
||||
let settings = store.get(SETTINGS_KEY, null);
|
||||
|
||||
if (settings === null) {
|
||||
settings = {};
|
||||
}
|
||||
|
||||
settings[privateScope.getSetingKey(settingName)] = value;
|
||||
store.set(SETTINGS_KEY, settings);
|
||||
};
|
||||
|
||||
return publicScope;
|
||||
}());
|
||||
|
||||
module.exports = settingsCache;
|
@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
const mspHelper = require('./msp/MSPHelper');
|
||||
const serialPortHelper = require('./serialPortHelper');
|
||||
const FC = require('./fc');
|
||||
|
||||
var wizardSaveFramework = (function () {
|
||||
|
||||
let self = {};
|
||||
|
||||
self.saveSetting = function (config, callback) {
|
||||
/*
|
||||
serialrx_provider to 2
|
||||
serialrx_provider to 6
|
||||
*/
|
||||
|
||||
switch (config.name) {
|
||||
case 'receiverPort':
|
||||
serialPortHelper.set(config.value, 'RX_SERIAL', null);
|
||||
mspHelper.saveSerialPorts(callback);
|
||||
break;
|
||||
case 'receiverProtocol':
|
||||
mspHelper.setSetting('serialrx_provider', config.value, callback);
|
||||
break;
|
||||
default:
|
||||
callback();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
self.handleSetting = function (configs, finalCallback) {
|
||||
|
||||
if (configs.length > 0) {
|
||||
let setting = configs.shift();
|
||||
self.saveSetting(setting, function () {
|
||||
self.handleSetting(configs, finalCallback);
|
||||
});
|
||||
} else {
|
||||
console.log('Nothing to save');
|
||||
finalCallback();
|
||||
}
|
||||
};
|
||||
|
||||
self.persist = function (config, finalCallback) {
|
||||
if (config === null || config === undefined || config.length === 0) {
|
||||
finalCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
let configCopy = Array.from(config);
|
||||
|
||||
self.handleSetting(configCopy, finalCallback);
|
||||
}
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
||||
module.exports = wizardSaveFramework;
|
@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
const mspHelper = require('./msp/MSPHelper');
|
||||
const serialPortHelper = require('./serialPortHelper');
|
||||
|
||||
const wizardUiBindings = (function () {
|
||||
|
||||
let self = {};
|
||||
|
||||
self.receiver = function ($content) {
|
||||
|
||||
mspHelper.loadSerialPorts(function () {
|
||||
let $receiverPort = $content.find('#wizard-receiver-port');
|
||||
let ports = serialPortHelper.getPortIdentifiersForFunction('RX_SERIAL');
|
||||
let currentPort = null;
|
||||
|
||||
if (ports.length > 0) {
|
||||
currentPort = ports[0];
|
||||
}
|
||||
|
||||
let availablePorts = serialPortHelper.getPortList();
|
||||
|
||||
$receiverPort.append('<option value="-1">NONE</option>');
|
||||
for (let i = 0; i < availablePorts.length; i++) {
|
||||
let port = availablePorts[i];
|
||||
$receiverPort.append('<option value="' + port.identifier + '">' + port.displayName + '</option>');
|
||||
}
|
||||
|
||||
if (currentPort !== null) {
|
||||
$receiverPort.val(currentPort);
|
||||
} else {
|
||||
$receiverPort.val(-1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
||||
module.exports = wizardUiBindings;
|
@ -0,0 +1,8 @@
|
||||
<div class="defaults-dialog__bottom_buttons">
|
||||
<div class="btn default_btn narrow green">
|
||||
<a id="wizard-next" href="#">Next</a>
|
||||
</div>
|
||||
<div class="btn default_btn narrow">
|
||||
<a id="wizard-skip" href="#">Skip</a>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<h2>Filters wizard</h2>
|
@ -0,0 +1 @@
|
||||
<h2>GPS wizard</h2>
|
@ -0,0 +1 @@
|
||||
<h2>Outputs wizard</h2>
|
@ -0,0 +1 @@
|
||||
<h2>PIDs wizard</h2>
|
@ -0,0 +1,11 @@
|
||||
<h2>Receiver wizard</h2>
|
||||
<p>
|
||||
Configure receiver serial port and protocol. If you unsure about serial port or protocol, click `Skip` to go to the next page.
|
||||
You can change those settings later with the configurator UI.
|
||||
</p>
|
||||
<div>
|
||||
<label for="wizard-receiver-port">Receiver Serial Port</label><select id="wizard-receiver-port"></select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="wizard-receiver-protocol">Receiver Protocol</label><select id="wizard-receiver-protocol" data-setting="serialrx_provider"></select>
|
||||
</div>
|
Loading…
Reference in New Issue