Skip to content

Commit

Permalink
Merge branch 'master' into feature/connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mechazawa committed Nov 26, 2023
2 parents 1e73dfb + fb65be3 commit a470df6
Show file tree
Hide file tree
Showing 14 changed files with 3,871 additions and 14,613 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Node CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [16, 18, 20]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ env.cache-name }}-
${{ runner.os }}-node-${{ matrix.node-version }}-build-
${{ runner.os }}-node-${{ matrix.node-version }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Install Dependencies
run: npm ci
- name: Lint
run: npx eslint src

- name: Generate Documentation
if: matrix.node-version == 18
run: npm run docs
- name: Archive Documentation
if: matrix.node-version == 18
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,8 @@ and sending commands based on the [xml specification].

## Installation

Using yarn

```bash
yarn add minidrone-js
```

or using npm

```bash
npm install minidrone-js
npm install minidrone-js --save
```

## Example
Expand All @@ -58,21 +50,23 @@ function sleep(ms) {
return new Promise(a => setTimeout(a, ms));
}

drone.on('connected', async () => {
void async function() {
await new Promise(resolve => drone.once('connected', resolve));

// Makes the code a bit clearer
const runCommand = x => drone.runCommand(x);

await runCommand(takeoff);

await sleep(2000);
await runCommand(backFlip);

await sleep(2000);
await runCommand(landing);

await sleep(5000);
process.exit();
});
}();
```

## Troubleshooting
Expand Down
8 changes: 5 additions & 3 deletions examples/doAFlip.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ const backFlip = parser.getCommand('minidrone', 'Animations', 'Flip', {direction
connector.connect();

drone.on('connected', () => {
console.log('Connected!')

// Makes the code a bit clearer
const runCommand = x => drone.runCommand(x);

runCommand(takeoff);
// runCommand(takeoff);

setTimeout(runCommand, 2000, backFlip);
setTimeout(runCommand, 4000, landing);
// setTimeout(runCommand, 2000, backFlip);
// setTimeout(runCommand, 2000, landing);
setTimeout(process.exit, 5000);
});
Loading

0 comments on commit a470df6

Please sign in to comment.