mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 08:45:26 +03:00
Convert to CommonJS Modules
This commit is contained in:
parent
7df8253099
commit
91f1699659
100 changed files with 9685 additions and 3735 deletions
23
js/sitl.js
23
js/sitl.js
|
@ -1,9 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const path = require('path');
|
||||
const { app } = require('@electron/remote');
|
||||
const { SerialPort } = require('serialport');
|
||||
const { spawn } = require('node:child_process');
|
||||
const pathMod = require('path');
|
||||
const { chmod, rm } = require('node:fs');
|
||||
|
||||
const { GUI } = require('./gui');
|
||||
|
||||
const serialRXProtocolls = [
|
||||
{
|
||||
name : "SBus",
|
||||
|
@ -55,9 +58,9 @@ var Ser2TCP = {
|
|||
|
||||
var path;
|
||||
if (GUI.operating_system == 'Windows') {
|
||||
path = './resources/sitl/windows/Ser2TCP.exe'
|
||||
path = './../resources/sitl/windows/Ser2TCP.exe'
|
||||
} else if (GUI.operating_system == 'Linux') {
|
||||
path = './resources/sitl/linux/Ser2TCP'
|
||||
path = './../resources/sitl/linux/Ser2TCP'
|
||||
chmod(path, 0o755, (err) => {
|
||||
if (err)
|
||||
console.log(err);
|
||||
|
@ -191,7 +194,7 @@ var SITLProcess = {
|
|||
process: null,
|
||||
|
||||
deleteEepromFile(filename) {
|
||||
rm(`${nw.App.dataPath}/${filename}`, error => {
|
||||
rm(`${app.getPath('userData')}/${filename}`, error => {
|
||||
if (error) {
|
||||
GUI.log(`Unable to reset Demo mode: ${error.message}`);
|
||||
}
|
||||
|
@ -205,11 +208,11 @@ var SITLProcess = {
|
|||
|
||||
var sitlExePath, eepromPath;
|
||||
if (GUI.operating_system == 'Windows') {
|
||||
sitlExePath = './resources/sitl/windows/inav_SITL.exe'
|
||||
eepromPath = `${nw.App.dataPath}\\${eepromFileName}`
|
||||
sitlExePath = path.join(__dirname, './../resources/sitl/windows/inav_SITL.exe');
|
||||
eepromPath = `${app.getPath('userData')}\\${eepromFileName}`
|
||||
} else if (GUI.operating_system == 'Linux') {
|
||||
sitlExePath = './resources/sitl/linux/inav_SITL';
|
||||
eepromPath = `${nw.App.dataPath}/${eepromFileName}`
|
||||
sitlExePath = './../resources/sitl/linux/inav_SITL';
|
||||
eepromPath = `${app.getPath('userData')}/${eepromFileName}`
|
||||
chmod(sitlExePath, 0o755, err => {
|
||||
if (err)
|
||||
console.log(err);
|
||||
|
@ -271,3 +274,5 @@ var SITLProcess = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = { Ser2TCP, SITLProcess };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue