WeDo 2.0 voltage reporting

This commit is contained in:
Nathan Kellenicki 2019-01-22 10:32:19 -08:00
parent adaac287cc
commit 110f65b291
24 changed files with 57 additions and 968 deletions

View File

@ -338,139 +338,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="Hub.html#current">Hub#current</a>
</li></ul></dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -5597,7 +5464,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -338,139 +338,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="Hub.html#current">Hub#current</a>
</li></ul></dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -4200,7 +4067,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -318,125 +318,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -2586,7 +2467,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -327,134 +327,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -4460,7 +4332,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -338,139 +338,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="Hub.html#current">Hub#current</a>
</li></ul></dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -5169,7 +5036,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -338,139 +338,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="Hub.html#current">Hub#current</a>
</li></ul></dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -3421,7 +3288,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -860,7 +860,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -331,134 +331,6 @@
</dl>
</dd>
<hr>
<dt class="name" id="current">
<h4 id="current"><span class="type-signature">&lt;readonly> </span>current<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>current</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current usage of the hub (Amps)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#current">Hub#current</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-82">line 82</a>
</li>
</ul>
</dd>
</dl> </dl>
@ -4438,7 +4310,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-309">line 309</a> <a href="wedo2smarthub.js.html#sunlight-1-line-307">line 307</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4747,7 +4619,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-298">line 298</a> <a href="wedo2smarthub.js.html#sunlight-1-line-296">line 296</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4909,7 +4781,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-339">line 339</a> <a href="wedo2smarthub.js.html#sunlight-1-line-337">line 337</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5095,7 +4967,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-327">line 327</a> <a href="wedo2smarthub.js.html#sunlight-1-line-325">line 325</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5174,7 +5046,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -349,7 +349,7 @@ exports.BoostMoveHub = BoostMoveHub;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -5945,7 +5945,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-309">line 309</a> <a href="wedo2smarthub.js.html#sunlight-1-line-307">line 307</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -6254,7 +6254,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-298">line 298</a> <a href="wedo2smarthub.js.html#sunlight-1-line-296">line 296</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -6416,7 +6416,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-339">line 339</a> <a href="wedo2smarthub.js.html#sunlight-1-line-337">line 337</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -6602,7 +6602,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="wedo2smarthub.js.html">wedo2smarthub.js</a>, <a href="wedo2smarthub.js.html">wedo2smarthub.js</a>,
<a href="wedo2smarthub.js.html#sunlight-1-line-327">line 327</a> <a href="wedo2smarthub.js.html#sunlight-1-line-325">line 325</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -6681,7 +6681,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -277,7 +277,7 @@ var BLECharacteristic;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -298,7 +298,7 @@ exports.DuploTrainBase = DuploTrainBase;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -3272,7 +3272,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -161,13 +161,13 @@ class Hub extends events_1.EventEmitter {
get voltage() { get voltage() {
return this._voltage; return this._voltage;
} }
/** // /**
* @readonly // * @readonly
* @property {number} current Current usage of the hub (Amps) // * @property {number} current Current usage of the hub (Amps)
*/ // */
get current() { // public get current () {
return this._current; // return this._current;
} // }
/** /**
* Connect to the Hub. * Connect to the Hub.
* @method Hub#connect * @method Hub#connect
@ -480,7 +480,7 @@ exports.Hub = Hub;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -314,7 +314,7 @@ poweredUP.scan(); // Start scanning for Hubs</code></pre><p>More examples are av
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -298,25 +298,25 @@ class LPF2Hub extends hub_1.Hub {
if ((data[3] === 0x3b &amp;&amp; this.type === Consts.HubType.POWERED_UP_REMOTE)) { // Voltage (PUP Remote) if ((data[3] === 0x3b &amp;&amp; this.type === Consts.HubType.POWERED_UP_REMOTE)) { // Voltage (PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const voltage = data.readUInt16LE(4) / 500; const voltage = data.readUInt16LE(4) / 500;
this._voltage = Math.floor(voltage); this._voltage = voltage;
return; return;
} }
else if (data[3] === 0x3c &amp;&amp; this.type === Consts.HubType.POWERED_UP_REMOTE) { // Current (PUP Remote) else if (data[3] === 0x3c &amp;&amp; this.type === Consts.HubType.POWERED_UP_REMOTE) { // Current (PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const current = data.readUInt16LE(4) / 1000; const current = data.readUInt16LE(4);
this._current = current; this._current = current;
return; return;
} }
else if (data[3] === 0x3c &amp;&amp; this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Voltage (Non-PUP Remote) else if (data[3] === 0x3c &amp;&amp; this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Voltage (Non-PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const voltage = data.readUInt16LE(4) / 400; const voltage = data.readUInt16LE(4) / 400;
this._voltage = Math.floor(voltage); this._voltage = voltage;
return; return;
} }
else if (data[3] === 0x3b &amp;&amp; this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Current (Non-PUP Remote) else if (data[3] === 0x3b &amp;&amp; this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Current (Non-PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const current = data.readUInt16LE(4) / 4096; const current = data.readUInt16LE(4) / 1000;
this._current = current * 100; this._current = current;
return; return;
} }
const port = this._getPortForPortNumber(data[3]); const port = this._getPortForPortNumber(data[3]);
@ -493,7 +493,7 @@ exports.LPF2Hub = LPF2Hub;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -273,7 +273,7 @@ exports.PoweredUP = PoweredUP;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -306,7 +306,7 @@ exports.PUPHub = PUPHub;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -236,7 +236,7 @@ exports.PUPRemote = PUPRemote;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

File diff suppressed because one or more lines are too long

View File

@ -361,14 +361,12 @@ class WeDo2SmartHub extends hub_1.Hub {
// Voltage // Voltage
if (data[1] === 0x03) { if (data[1] === 0x03) {
const voltage = data.readInt16LE(2); const voltage = data.readInt16LE(2);
this._voltage = voltage; this._voltage = voltage / 40;
console.log("Voltage", voltage);
// Current // Current
} }
else if (data[1] === 0x04) { else if (data[1] === 0x04) {
const current = data.readInt16LE(2); const current = data.readInt16LE(2);
this._current = current; this._current = current / 1000;
console.log("Current", current);
} }
const port = this._getPortForPortNumber(data[1]); const port = this._getPortForPortNumber(data[1]);
if (!port) { if (!port) {
@ -480,7 +478,7 @@ exports.WeDo2SmartHub = WeDo2SmartHub;
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Fri Jan 18th 2019 on Tue Jan 22nd 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span> </span>

View File

@ -104,13 +104,13 @@ export class Hub extends EventEmitter {
} }
/** // /**
* @readonly // * @readonly
* @property {number} current Current usage of the hub (Amps) // * @property {number} current Current usage of the hub (Amps)
*/ // */
public get current () { // public get current () {
return this._current; // return this._current;
} // }
/** /**

View File

@ -254,22 +254,22 @@ export class LPF2Hub extends Hub {
if ((data[3] === 0x3b && this.type === Consts.HubType.POWERED_UP_REMOTE)) { // Voltage (PUP Remote) if ((data[3] === 0x3b && this.type === Consts.HubType.POWERED_UP_REMOTE)) { // Voltage (PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const voltage = data.readUInt16LE(4) / 500; const voltage = data.readUInt16LE(4) / 500;
this._voltage = Math.floor(voltage); this._voltage = voltage;
return; return;
} else if (data[3] === 0x3c && this.type === Consts.HubType.POWERED_UP_REMOTE) { // Current (PUP Remote) } else if (data[3] === 0x3c && this.type === Consts.HubType.POWERED_UP_REMOTE) { // Current (PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const current = data.readUInt16LE(4) / 1000; const current = data.readUInt16LE(4);
this._current = current; this._current = current;
return; return;
} else if (data[3] === 0x3c && this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Voltage (Non-PUP Remote) } else if (data[3] === 0x3c && this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Voltage (Non-PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const voltage = data.readUInt16LE(4) / 400; const voltage = data.readUInt16LE(4) / 400;
this._voltage = Math.floor(voltage); this._voltage = voltage;
return; return;
} else if (data[3] === 0x3b && this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Current (Non-PUP Remote) } else if (data[3] === 0x3b && this.type !== Consts.HubType.POWERED_UP_REMOTE) { // Current (Non-PUP Remote)
data = this._padMessage(data, 6); data = this._padMessage(data, 6);
const current = data.readUInt16LE(4) / 4096; const current = data.readUInt16LE(4) / 1000;
this._current = current * 100; this._current = current;
return; return;
} }

View File

@ -320,13 +320,11 @@ export class WeDo2SmartHub extends Hub {
// Voltage // Voltage
if (data[1] === 0x03) { if (data[1] === 0x03) {
const voltage = data.readInt16LE(2); const voltage = data.readInt16LE(2);
this._voltage = voltage; this._voltage = voltage / 40;
console.log("Voltage", voltage);
// Current // Current
} else if (data[1] === 0x04) { } else if (data[1] === 0x04) {
const current = data.readInt16LE(2); const current = data.readInt16LE(2);
this._current = current; this._current = current / 1000;
console.log("Current", current);
} }
const port = this._getPortForPortNumber(data[1]); const port = this._getPortForPortNumber(data[1]);