Skip to content

Commit

Permalink
Merge branch 'master' into dzikuvx-simplify-receiver-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
DzikuVx committed Apr 27, 2024
2 parents f90c0b9 + 04f4b92 commit 09a3a0b
Show file tree
Hide file tree
Showing 59 changed files with 527 additions and 536 deletions.
185 changes: 185 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Build Configurator
# Don't enable CI on push, just on PR. If you
# are working on the main repo and want to trigger
# a CI build submit a draft PR.
on: pull_request

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAME=inav-configurator_linux_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y install dpkg fakeroot rpm build-essential libudev-dev
- name: Install deps
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build Linux
run: npm run make
- name: Upload Linux deb
uses: actions/upload-artifact@v3
with:
name: ${{ env.BUILD_NAME }}_DEB
path: ./out/make/deb/x64/*.deb
- name: Upload Linux rpm
uses: actions/upload-artifact@v3
with:
name: ${{ env.BUILD_NAME }}_RPM
path: ./out/make/rpm/x64/*.rpm
- name: Upload Linux zip
uses: actions/upload-artifact@v3
with:
name: ${{ env.BUILD_NAME }}_ZIP
path: ./out/make/zip/linux/x64/*.zip
build-mac:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEx64=inav-configurator_darwin_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEarm64=inav-configurator_darwin_arm64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
# Workaround due to a bug in node-gyp: https://github.com/electron/rebuild/issues/1116
- name: Install Setuptools
run: python3 -m pip install --break-system-packages setuptools
- name: Install deps
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build MacOS x64
run: npm run make -- --arch="x64"
- name: Build MacOS arm64
run: npm run make -- --arch="arm64"
- name: Upload MacOS x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_ZIP
path: ./out/make/zip/darwin/x64/*.zip
- name: Upload MacOS x64 dmg
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_DMG
path: ./out/make/*x64*.dmg
- name: Upload MacOS arm64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEarm64}}_ZIP
path: ./out/make/zip/darwin/arm64/*.zip
- name: Upload MacOS arm64 dmg
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEarm64}}_DMG
path: ./out/make/*arm64*.dmg
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install linux utils
run: choco install --force -y awk grep sed
- name: Setup environment
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# This is the hash of the commit for the PR
# when the action is triggered by PR, empty otherwise
COMMIT_ID=${{ github.event.pull_request.head.sha }}
# This is the hash of the commit when triggered by push
# but the hash of refs/pull/<n>/merge, which is different
# from the hash of the latest commit in the PR, that's
# why we try github.event.pull_request.head.sha first
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=ci-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep version package.json | sed 's/.*"\([0-9][0-9]*.[0-9]*.[0-9]*\)".*/\1/g')
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEx64=inav-configurator_win32_x64_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAMEia32=inav-configurator_win32_ia32_${VERSION}_${BUILD_SUFFIX}" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: engineerd/[email protected]
with:
name: "Wix Toolset 3.1.4"
url: "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip"
pathInArchive: "/"
- name: Install deps
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
command: npm install
timeout_minutes: 10
- name: Build Win32 x64
run: npm run make -- --arch="x64"
- name: Build win32 ia32
run: npm run make -- --arch="ia32"
- name: Upload Windows x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_ZIP
path: ./out/make/zip/win32/x64/*.zip
- name: Upload Windows x64 msi
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEx64}}_MSI
path: ./out/make/wix/x64/*.msi
- name: Upload Windows ia32 zip
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEia32}}_ZIP
path: ./out/make/zip/win32/ia32/*.zip
- name: Upload Windows ia32 msi
uses: actions/upload-artifact@v4
with:
name: ${{env.BUILD_NAMEia32}}_MSI
path: ./out/make/wix/ia32/*.msi

28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ everything, the hardware is not working, or you have any other _support_ problem

## Installation

Depending on the target operating system, _INAV Configurator_ is distributed as a _standalone_ application or Chrome App.
_INAV Configurator_ is distributed as a _standalone_ application.

### Windows

1. Visit [release page](https://github.com/iNavFlight/inav-configurator/releases)
2. Download Configurator for Windows platform (win32 or win64 is present)
2. Download Configurator for Windows platform (ia32 or win64 is present)
3. Install
* Extract ZIP archive and run the INAV Configurator app from the unpacked folder
* OR just use the setup program `INAV Configurator.msi`
* OR just use the setup program `INAV-Configurator_win32_arch_x.y.z.msi`, **arch** is your computer architecture (ia32 (32bit) or x64 (64bit)), **x.y.z** is the INAV Configurator version number.

4. Configurator is not signed, so you have to allow Windows to run untrusted applications. There might be a monit for it during the first run

### Linux

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)
* **.deb** is the Debian/Ubuntu installation file. Just download and install using `sudo apt install /path/to/INAV-Configurator_linux64_x.y.z.deb` or open it with a package manager (e.g. via the File Manager)
2. Download Configurator for Linux platform (only linux64 is present)
* **.rpm** is the Fedora installation file. Just download and install using `sudo dnf localinstall /path/to/INAV-Configurator_linux_x64-x.y.z.rpm` or open it with a package manager (e.g. via Files)
* **.deb** is the Debian/Ubuntu installation file. Just download and install using `sudo apt install /path/to/INAV-Configurator_linux_x64_x.y.z.deb` or open it with a package manager (e.g. via the File Manager)
* **.zip** is a universal archive. Download and continue with these instructions to install
3. Change to the directory containing the downloaded **zip** file
4. download [this](https://raw.githubusercontent.com/iNavFlight/inav-configurator/master/assets/linux/inav-configurator.desktop) file to the same directory. Its filename should be `inav-configurator.desktop`.
5. Extract **zip** archive
```
unzip INAV-Configurator_linuxNN_x.y.z.tar.gz -d /tmp/
unzip INAV-Configurator_linux_arch_x.y.z.zip -d /tmp/
```
**NN** is the bits of your OS. **x.y.z** is the INAV Configurator version number.
**arch** is your computer architecture (x64, armv7l, ...), **x.y.z** is the INAV Configurator version number.

6. If this is the first time installing INAV Configurator, create a home for its files
```
Expand Down Expand Up @@ -93,21 +93,27 @@ Options:

See [Electron Forge CLI Documentation](https://www.electronforge.io/cli#options-2) for details

Note: Not all architectures are available for all platforms. For example, ia32 (32bit) support is not available for Linux.
Tested architectures:
- Windows: x64 and ia32
- Linux: x64 and armv7l
- MacOS: x64 and arm64

To build the setup program for windows, you have to install [WiX Toolset V3](https://github.com/wixtoolset/wix3/releases) and add the `bin` folder to you `PATH`, e.g.
```C:\Program Files (x86)\WiX Toolset v3.14\bin```

To build deb and rpm packages for Linux, you have to install the following packages:
- Ubuntu/Debian: `dpkg, fakeroot, rpmbuild, build-essential, libudev-dev`
- Ubuntu/Debian: `dpkg, fakeroot, rpm, build-essential, libudev-dev`
- OpenSuse/Fedora: `dpkg, fakeroot, rpmbuild, systemd-devel, devel-basis (zypper install -t pattern devel_basis), zip`

Example (note the double -- ):
``` npm run make -- --arch="x64" ```
```npm run make -- --arch="x64"```

### Running with debug | Inspector

To be able to open Inspector, set envorinment variable `NODE_ENV` to `develpoment` or set the flag directly when run `npm start`:

```NODE_ENV=development npm start```
```NODE_ENV=development npm start``` or ```$env:NODE_ENV="development" | npm start``` for Windows PowerShell

Or use vscode and start a debug session `Debug Configurator` (Just hit F5!)

Expand Down
3 changes: 2 additions & 1 deletion forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ module.exports = {
name: '@electron-forge/maker-dmg',
config: {
name: "INAV Configurator",
background: "./assets/osx/dmg-background.png"
background: "./assets/osx/dmg-background.png",
icon: "./images/inav.icns"
}
},
{
Expand Down
3 changes: 0 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ <h2 class="groundstation-telemetry__header" data-i18n="gsTelemetry"></h2>
<div>
<span id="hardware-roundtrip"> </span>
</div>
<div>
<span id="drop-rate"> </span>
</div>
<div>
<span data-i18n="statusbar_arming_flags"></span> <span class="arming-flags">-</span>
</div>
Expand Down
4 changes: 3 additions & 1 deletion js/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ class Connection {
getTimeout() {
if (this._bitrate >= 57600) {
return 3000;
} else {
} if (this._bitrate >= 19200) {
return 4000;
} else {
return 6000;
}
}
}
Expand Down
23 changes: 16 additions & 7 deletions js/connection/connectionSerial.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class ConnectionSerial extends Connection {
super._type = ConnectionType.Serial;
}

connectImplementation(path, options, callback) {
connectImplementation(path, options, callback) {
try {
this._serialport = new SerialPortStream({binding, path: path, baudRate: options.bitrate, autoOpen: true}, () => {
if (callback) {
callback({
connectionId: ++this._connectionId,
bitrate: options.bitrate
bitrate: options.bitrate
});
}
});
Expand All @@ -50,12 +50,12 @@ class ConnectionSerial extends Connection {
this.abort();
console.log("Serial error: " + error);
this._onReceiveErrorListeners.forEach(listener => {
listener(error);
listener(error);
});
});
}

disconnectImplementation(callback) {
disconnectImplementation(callback) {
if (this._serialport && this._serialport.isOpen) {
this._serialport.close(error => {
if (error) {
Expand All @@ -68,7 +68,7 @@ class ConnectionSerial extends Connection {
callback(true);
}
}

sendImplementation(data, callback) {
if (this._serialport && this._serialport.isOpen) {
this._serialport.write(Buffer.from(data), error => {
Expand Down Expand Up @@ -105,14 +105,23 @@ class ConnectionSerial extends Connection {
this._onReceiveErrorListeners = this._onReceiveErrorListeners.filter(listener => listener !== callback);
}

static async getDevices(callback) {
static async getDevices(callback) {
SerialPort.list().then((ports, error) => {
var devices = [];
if (error) {
GUI.log("Unable to list serial ports.");
} else {
ports.forEach(port => {
devices.push(port.path);
if (GUI.operating_system == 'Linux') {
/* Limit to: USB serial, RFCOMM (BT), 6 legacy devices */
if (port.pnpId ||
port.path.match(/rfcomm\d*/) ||
port.path.match(/ttyS[0-5]$/)) {
devices.push(port.path);
}
} else {
devices.push(port.path);
}
});
}
if (callback)
Expand Down
6 changes: 6 additions & 0 deletions js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,12 @@ var FC = {
operandType: "Set Flight Parameter",
hasOperand: [true, false],
output: "raw"
},
53: {
name: "Disable GPS Sensor Fix",
operandType: "Set Flight Parameter",
hasOperand: [true, false],
output: "boolean"
},
54: {
name: "Mag calibration",
Expand Down
Loading

0 comments on commit 09a3a0b

Please sign in to comment.