Skip to content

Commit

Permalink
Added announement to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nathankellenicki committed Feb 10, 2020
1 parent e721e0f commit a34c422
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

# **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

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.
Expand Down
61 changes: 58 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
<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>
<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>
<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>
<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
</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>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>
<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>
Expand Down Expand Up @@ -211,6 +213,56 @@ <h3>Compatibility</h3>
<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>
</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>
</table>
<p>In addition, the Hubs themselves have certain built-in features which this library exposes.</p>
Expand Down Expand Up @@ -273,6 +325,9 @@ <h3>Known Issues and Limitations</h3>
<li>
<p>When used with the Boost Move Hub, the Control+ Motors do not currently accept commands.</p>
</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>
<h3>Documentation</h3>
<p><a href="https://nathankellenicki.github.io/node-poweredup/">Full documentation is available here.</a></p>
Expand Down
2 changes: 1 addition & 1 deletion docs/quicksearch.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/hubs/basehub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class BaseHub extends EventEmitter {
protected _bleDevice: IBLEAbstraction;

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) {
super();
Expand Down Expand Up @@ -315,7 +315,7 @@ export class BaseHub extends EventEmitter {
* @param {Array<Promise<any>>} commands Array of executing commands.
* @returns {Promise} Resolved after the commands are finished.
*/
public wait (commands: Array<Promise<any>>) {
public wait (commands: Promise<any>[]) {
return Promise.all(commands);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nobleabstraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class NobleDevice extends EventEmitter implements IBLEAbstraction {
return discoverReject(err);
}
debug("Service/characteristic discovery started");
const servicePromises: Array<Promise<null>> = [];
const servicePromises: Promise<null>[] = [];
services.forEach((service) => {
servicePromises.push(new Promise((resolve, reject) => {
service.discoverCharacteristics([], (err, characteristics) => {
Expand Down

0 comments on commit a34c422

Please sign in to comment.