Skip to content

Commit

Permalink
Merge pull request #13 from jongear/parrot-mambo
Browse files Browse the repository at this point in the history
feat(Drone.ts): Add support to auto-detect Parrot Mambo's manufacturer hex record
  • Loading branch information
jongear authored Jan 18, 2019
2 parents 4290d2b + 40d6ab0 commit c7a396c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,25 @@ matrix:
########

- name: '[OSX] Node.js v6.x'
sudo: required
os: osx
osx_image: xcode9.3
node_js: '6'

- name: '[OSX] Node.js v8.x'
sudo: required
os: osx
osx_image: xcode9.3
node_js: '8'

- name: '[OSX] Node.js v10.x xcode` 9.3'
sudo: required
os: osx
osx_image: xcode9.3
node_js: '10'

- name: '[OSX] Node.js v10.x xcode10'
sudo: required
os: osx
osx_image: xcode10
node_js: '10'
Expand All @@ -64,6 +68,35 @@ matrix:
- 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config'
- semantic-release

###########
# Windows #
###########
# Travis builds are failing on windows when adding secret environment variables
# this is due to a naming issue with nvs
# https://travis-ci.community/t/windows-instances-hanging-before-install/250/15
#
# - name: '[Windows] Node.js v6.x'
# sudo: required
# os: windows
# env: TARGET_ARCH=x64
# node_js: '6'
# before_install:
# - npm install --global --production windows-build-tools
# - name: '[Windows] Node.js v8.x'
# sudo: required
# os: windows
# env: TARGET_ARCH=x64
# node_js: '8'
# before_install:
# - npm install --global --production windows-build-tools
# - name: '[Windows] Node.js v10.x'
# sudo: required
# os: windows
# env: TARGET_ARCH=x64
# node_js: '10'
# before_install:
# - npm install --global --production windows-build-tools

branches:
only:
- master
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"tslint": "^5.12.1",
"tslint-config-prettier": "^1.17.0",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^3.2.2",
"typescript": "^3.2.4",
"watch": "^1.0.2"
}
}
10 changes: 7 additions & 3 deletions src/drone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default class Drone extends EventEmitter {
'4300cf1909090100',
'4300cf1907090100',
'4300cf190a090100',
'4300cf190b090100',
]

const localNameMatch =
Expand All @@ -49,9 +50,12 @@ export default class Drone extends EventEmitter {
return localName.startsWith(name)
}) >= 0

const manufacturerMatch =
manufacturer &&
acceptedManufacturers.indexOf(manufacturer.toString('hex')) >= 0
let manufacturerMatch = false

if (manufacturer) {
const hexManufacturer = manufacturer.toString('hex')
manufacturerMatch = acceptedManufacturers.indexOf(hexManufacturer) >= 0
}

// Is true for EITHER a valid name prefix OR manufacturer code.
return localNameMatch || manufacturerMatch
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"module": "commonjs",
"allowJs": false,
"declaration": true,
"target": "es2017",
"target": "es2015",
"rootDir": "src"
},
"include": ["src/**/*"],
Expand Down

0 comments on commit c7a396c

Please sign in to comment.