Added announement to readme

This commit is contained in:
Nathan Kellenicki 2020-02-10 11:22:15 -08:00
parent e721e0f5bf
commit a34c4223fb
5 changed files with 66 additions and 7 deletions

View File

@ -3,6 +3,10 @@
# **node-poweredup** - A Javascript module to interface with LEGO Powered Up components. # **node-poweredup** - A Javascript module to interface with LEGO Powered Up components.
### Announcements
*Important*: v6.0.0 is a complete re-architecting of this library. Improvements include proper device and mode support through an external Device object, correct handling of firmware features, and promise-based functionality for interfacing with device attachments. Although many new features were added, existing code will almost surely break upon upgrade.
### Introduction ### Introduction
LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges - starting with LEGO Education WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, LEGO Technic CONTROL+ released in 2019, and LEGO Education SPIKE Prime released in 2020. It also includes the 2018 Duplo App-Controlled Train sets. LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges - starting with LEGO Education WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, LEGO Technic CONTROL+ released in 2019, and LEGO Education SPIKE Prime released in 2020. It also includes the 2018 Duplo App-Controlled Train sets.

View File

@ -96,15 +96,17 @@
<article><p><a href="https://drone.kellenicki.com/nkellenicki/node-poweredup"><img src="https://drone.kellenicki.com/api/badges/nkellenicki/node-poweredup/status.svg" alt="Drone"></a><br> <article><p><a href="https://drone.kellenicki.com/nkellenicki/node-poweredup"><img src="https://drone.kellenicki.com/api/badges/nkellenicki/node-poweredup/status.svg" alt="Drone"></a><br>
<a href="https://www.npmjs.com/package/node-poweredup"><img src="https://img.shields.io/npm/v/node-poweredup.svg?style=flat" alt="NPM Version"></a></p> <a href="https://www.npmjs.com/package/node-poweredup"><img src="https://img.shields.io/npm/v/node-poweredup.svg?style=flat" alt="NPM Version"></a></p>
<h1><strong>node-poweredup</strong> - A Javascript module to interface with LEGO Powered Up components.</h1> <h1><strong>node-poweredup</strong> - A Javascript module to interface with LEGO Powered Up components.</h1>
<h3>Announcements</h3>
<p><em>Important</em>: v6.0.0 is a complete re-architecting of this library. Improvements include proper device and mode support through an external Device object, correct handling of firmware features, and promise-based functionality for interfacing with device attachments. Although many new features were added, existing code will almost surely break upon upgrade.</p>
<h3>Introduction</h3> <h3>Introduction</h3>
<p>LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges - starting with LEGO WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, and LEGO Technic CONTROL+ released in 2019. It also includes the 2018 Duplo App-Controlled Train sets.</p> <p>LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges - starting with LEGO Education WeDo 2.0 released in 2016, LEGO Boost released in 2017, LEGO Powered Up released in 2018, LEGO Technic CONTROL+ released in 2019, and LEGO Education SPIKE Prime released in 2020. It also includes the 2018 Duplo App-Controlled Train sets.</p>
<p>This library allows communication and control of Powered Up devices and peripherals via Javascript, both from Node.js and from the browser using Web Bluetooth.</p> <p>This library allows communication and control of Powered Up devices and peripherals via Javascript, both from Node.js and from the browser using Web Bluetooth.</p>
<h3>Node.js Installation</h3> <h3>Node.js Installation</h3>
<p>Node.js v8.0 required.</p> <p>Node.js v8.0+ required.</p>
<pre class="prettyprint source lang-javascript"><code>npm install node-poweredup --save <pre class="prettyprint source lang-javascript"><code>npm install node-poweredup --save
</code></pre> </code></pre>
<p>node-poweredup uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are <a href="https://github.com/noble/noble#prerequisites">certain dependencies which may need installed first</a>.</p> <p>node-poweredup uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are <a href="https://github.com/noble/noble#prerequisites">certain dependencies which may need installed first</a>.</p>
<p>Note: node-poweredup has been tested on macOS 10.13 and Debian/Raspbian on the Raspberry Pi 3 Model B.</p> <p>Note: node-poweredup has been tested on macOS 10.15 and Debian/Raspbian on the Raspberry Pi 3 Model B.</p>
<h3>Compatibility</h3> <h3>Compatibility</h3>
<p>While most Powered Up components and Hubs are compatible with each other, there are exceptions. For example, there is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs.</p> <p>While most Powered Up components and Hubs are compatible with each other, there are exceptions. For example, there is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs.</p>
<table> <table>
@ -211,6 +213,56 @@
<td>Yes</td> <td>Yes</td>
<td><a href="https://brickset.com/sets/42099-1/">42099</a><br /><a href="https://brickset.com/sets/42100-1/">42100</a></td> <td><a href="https://brickset.com/sets/42099-1/">42099</a><br /><a href="https://brickset.com/sets/42100-1/">42100</a></td>
</tr> </tr>
<tr>
<td>SPIKE Prime Medium Motor</td>
<td>45678</td>
<td>Motor/Sensor</td>
<td><em>Partial</em></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td><a href="https://brickset.com/sets/45678-1/">45678</a></td>
</tr>
<tr>
<td>SPIKE Prime Large Motor</td>
<td>45678</td>
<td>Motor/Sensor</td>
<td><em>Partial</em></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td><a href="https://brickset.com/sets/45678-1/">45678</a></td>
</tr>
<tr>
<td>SPIKE Prime Color Sensor</td>
<td>45678</td>
<td>Motor/Sensor</td>
<td><em>Partial</em></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td><a href="https://brickset.com/sets/45678-1/">45678</a></td>
</tr>
<tr>
<td>SPIKE Prime Distance Sensor</td>
<td>45678</td>
<td>Motor/Sensor</td>
<td><em>Partial</em></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td><a href="https://brickset.com/sets/45678-1/">45678</a></td>
</tr>
<tr>
<td>SPIKE Prime Force Sensor</td>
<td>45678</td>
<td>Motor/Sensor</td>
<td><em>Partial</em></td>
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td><a href="https://brickset.com/sets/45678-1/">45678</a></td>
</tr>
</tbody> </tbody>
</table> </table>
<p>In addition, the Hubs themselves have certain built-in features which this library exposes.</p> <p>In addition, the Hubs themselves have certain built-in features which this library exposes.</p>
@ -273,6 +325,9 @@
<li> <li>
<p>When used with the Boost Move Hub, the Control+ Motors do not currently accept commands.</p> <p>When used with the Boost Move Hub, the Control+ Motors do not currently accept commands.</p>
</li> </li>
<li>
<p>The SPIKE Prime Hub does not use Bluetooth Low Energy, so is not supported via this library. It is recommended you use MicroPython and Bluetooth Classic to develop for this Hub.</p>
</li>
</ul> </ul>
<h3>Documentation</h3> <h3>Documentation</h3>
<p><a href="https://nathankellenicki.github.io/node-poweredup/">Full documentation is available here.</a></p> <p><a href="https://nathankellenicki.github.io/node-poweredup/">Full documentation is available here.</a></p>

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@ export class BaseHub extends EventEmitter {
protected _bleDevice: IBLEAbstraction; protected _bleDevice: IBLEAbstraction;
private _type: Consts.HubType; private _type: Consts.HubType;
private _attachCallbacks: Array<((device: Device) => boolean)> = []; private _attachCallbacks: ((device: Device) => boolean)[] = [];
constructor (bleDevice: IBLEAbstraction, portMap: {[portName: string]: number} = {}, type: Consts.HubType = Consts.HubType.UNKNOWN) { constructor (bleDevice: IBLEAbstraction, portMap: {[portName: string]: number} = {}, type: Consts.HubType = Consts.HubType.UNKNOWN) {
super(); super();
@ -315,7 +315,7 @@ export class BaseHub extends EventEmitter {
* @param {Array<Promise<any>>} commands Array of executing commands. * @param {Array<Promise<any>>} commands Array of executing commands.
* @returns {Promise} Resolved after the commands are finished. * @returns {Promise} Resolved after the commands are finished.
*/ */
public wait (commands: Array<Promise<any>>) { public wait (commands: Promise<any>[]) {
return Promise.all(commands); return Promise.all(commands);
} }

View File

@ -88,7 +88,7 @@ export class NobleDevice extends EventEmitter implements IBLEAbstraction {
return discoverReject(err); return discoverReject(err);
} }
debug("Service/characteristic discovery started"); debug("Service/characteristic discovery started");
const servicePromises: Array<Promise<null>> = []; const servicePromises: Promise<null>[] = [];
services.forEach((service) => { services.forEach((service) => {
servicePromises.push(new Promise((resolve, reject) => { servicePromises.push(new Promise((resolve, reject) => {
service.discoverCharacteristics([], (err, characteristics) => { service.discoverCharacteristics([], (err, characteristics) => {