Skip to content

Commit 6b04b07

Browse files
committed
0.5.1
1 parent 28e2e98 commit 6b04b07

File tree

8 files changed

+67
-70
lines changed

8 files changed

+67
-70
lines changed

dist/webduino-all.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ Paho.MQTT = (function (global) {
24962496
})(window);
24972497

24982498
var webduino = webduino || {
2499-
version: '0.5.0'
2499+
version: '0.5.1'
25002500
};
25012501

25022502
if (typeof exports !== 'undefined') {
@@ -4172,18 +4172,13 @@ if (typeof exports !== 'undefined') {
41724172
}
41734173

41744174
function cleanup() {
4175-
this.disconnect(function () {
4176-
if (typeof exports !== 'undefined') {
4177-
process.exit();
4178-
}
4179-
});
4175+
this.disconnect();
41804176
}
41814177

41824178
function attachCleanup(self) {
41834179
if (typeof exports === 'undefined') {
41844180
window.addEventListener('beforeunload', self._cleanupHandler);
41854181
} else {
4186-
process.addListener('SIGINT', self._cleanupHandler);
41874182
process.addListener('uncaughtException', self._cleanupHandler);
41884183
}
41894184
}
@@ -4192,7 +4187,6 @@ if (typeof exports !== 'undefined') {
41924187
if (typeof exports === 'undefined') {
41934188
window.removeEventListener('beforeunload', self._cleanupHandler);
41944189
} else {
4195-
process.removeListener('SIGINT', self._cleanupHandler);
41964190
process.removeListener('uncaughtException', self._cleanupHandler);
41974191
}
41984192
}
@@ -4474,7 +4468,6 @@ if (typeof exports !== 'undefined') {
44744468
}
44754469

44764470
if (!this._isReady) {
4477-
this.systemReset();
44784471
this.enableDigitalPins();
44794472
}
44804473
};
@@ -4568,20 +4561,26 @@ if (typeof exports !== 'undefined') {
45684561
};
45694562

45704563
proto.sendDigitalData = function (pin, value) {
4571-
var portNum = Math.floor(pin / 8);
4572-
4573-
if (value === Pin.HIGH) {
4574-
// Set the bit
4575-
this._digitalPort[portNum] |= (value << (pin % 8));
4576-
} else if (value === Pin.LOW) {
4577-
// Clear the bit
4578-
this._digitalPort[portNum] &= ~(1 << (pin % 8));
4579-
} else {
4580-
// Should not happen...
4581-
throw new Error('Invalid value passed to sendDigital, value must be 0 or 1.');
4582-
}
4564+
try {
4565+
var portNum = Math.floor(pin / 8);
4566+
4567+
if (value === Pin.HIGH) {
4568+
// Set the bit
4569+
this._digitalPort[portNum] |= (value << (pin % 8));
4570+
} else if (value === Pin.LOW) {
4571+
// Clear the bit
4572+
this._digitalPort[portNum] &= ~(1 << (pin % 8));
4573+
} else {
4574+
// Should not happen...
4575+
throw new Error('Invalid value passed to sendDigital, value must be 0 or 1.');
4576+
}
45834577

4584-
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
4578+
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
4579+
} catch (err) {
4580+
console.error('Board -> sendDigitalData, msg:', err.message, 'value:', value);
4581+
this.emit(BoardEvent.ERROR, err);
4582+
setImmediate(this.disconnect.bind(this));
4583+
}
45854584
};
45864585

45874586
proto.sendServoData = function (pin, value) {

dist/webduino-all.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/webduino-base.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ Paho.MQTT = (function (global) {
24962496
})(window);
24972497

24982498
var webduino = webduino || {
2499-
version: '0.5.0'
2499+
version: '0.5.1'
25002500
};
25012501

25022502
if (typeof exports !== 'undefined') {
@@ -4172,18 +4172,13 @@ if (typeof exports !== 'undefined') {
41724172
}
41734173

41744174
function cleanup() {
4175-
this.disconnect(function () {
4176-
if (typeof exports !== 'undefined') {
4177-
process.exit();
4178-
}
4179-
});
4175+
this.disconnect();
41804176
}
41814177

41824178
function attachCleanup(self) {
41834179
if (typeof exports === 'undefined') {
41844180
window.addEventListener('beforeunload', self._cleanupHandler);
41854181
} else {
4186-
process.addListener('SIGINT', self._cleanupHandler);
41874182
process.addListener('uncaughtException', self._cleanupHandler);
41884183
}
41894184
}
@@ -4192,7 +4187,6 @@ if (typeof exports !== 'undefined') {
41924187
if (typeof exports === 'undefined') {
41934188
window.removeEventListener('beforeunload', self._cleanupHandler);
41944189
} else {
4195-
process.removeListener('SIGINT', self._cleanupHandler);
41964190
process.removeListener('uncaughtException', self._cleanupHandler);
41974191
}
41984192
}
@@ -4474,7 +4468,6 @@ if (typeof exports !== 'undefined') {
44744468
}
44754469

44764470
if (!this._isReady) {
4477-
this.systemReset();
44784471
this.enableDigitalPins();
44794472
}
44804473
};
@@ -4568,20 +4561,26 @@ if (typeof exports !== 'undefined') {
45684561
};
45694562

45704563
proto.sendDigitalData = function (pin, value) {
4571-
var portNum = Math.floor(pin / 8);
4572-
4573-
if (value === Pin.HIGH) {
4574-
// Set the bit
4575-
this._digitalPort[portNum] |= (value << (pin % 8));
4576-
} else if (value === Pin.LOW) {
4577-
// Clear the bit
4578-
this._digitalPort[portNum] &= ~(1 << (pin % 8));
4579-
} else {
4580-
// Should not happen...
4581-
throw new Error('Invalid value passed to sendDigital, value must be 0 or 1.');
4582-
}
4564+
try {
4565+
var portNum = Math.floor(pin / 8);
4566+
4567+
if (value === Pin.HIGH) {
4568+
// Set the bit
4569+
this._digitalPort[portNum] |= (value << (pin % 8));
4570+
} else if (value === Pin.LOW) {
4571+
// Clear the bit
4572+
this._digitalPort[portNum] &= ~(1 << (pin % 8));
4573+
} else {
4574+
// Should not happen...
4575+
throw new Error('Invalid value passed to sendDigital, value must be 0 or 1.');
4576+
}
45834577

4584-
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
4578+
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
4579+
} catch (err) {
4580+
console.error('Board -> sendDigitalData, msg:', err.message, 'value:', value);
4581+
this.emit(BoardEvent.ERROR, err);
4582+
setImmediate(this.disconnect.bind(this));
4583+
}
45854584
};
45864585

45874586
proto.sendServoData = function (pin, value) {

dist/webduino-base.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/files/src_core_Board.js.html

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,13 @@ <h1>src/core/Board.js <small>File</small></h1>
258258
}
259259

260260
function cleanup() {
261-
this.disconnect(function () {
262-
if (typeof exports !== &#x27;undefined&#x27;) {
263-
process.exit();
264-
}
265-
});
261+
this.disconnect();
266262
}
267263

268264
function attachCleanup(self) {
269265
if (typeof exports === &#x27;undefined&#x27;) {
270266
window.addEventListener(&#x27;beforeunload&#x27;, self._cleanupHandler);
271267
} else {
272-
process.addListener(&#x27;SIGINT&#x27;, self._cleanupHandler);
273268
process.addListener(&#x27;uncaughtException&#x27;, self._cleanupHandler);
274269
}
275270
}
@@ -278,7 +273,6 @@ <h1>src/core/Board.js <small>File</small></h1>
278273
if (typeof exports === &#x27;undefined&#x27;) {
279274
window.removeEventListener(&#x27;beforeunload&#x27;, self._cleanupHandler);
280275
} else {
281-
process.removeListener(&#x27;SIGINT&#x27;, self._cleanupHandler);
282276
process.removeListener(&#x27;uncaughtException&#x27;, self._cleanupHandler);
283277
}
284278
}
@@ -560,7 +554,6 @@ <h1>src/core/Board.js <small>File</small></h1>
560554
}
561555

562556
if (!this._isReady) {
563-
this.systemReset();
564557
this.enableDigitalPins();
565558
}
566559
};
@@ -654,20 +647,26 @@ <h1>src/core/Board.js <small>File</small></h1>
654647
};
655648

656649
proto.sendDigitalData = function (pin, value) {
657-
var portNum = Math.floor(pin / 8);
658-
659-
if (value === Pin.HIGH) {
660-
// Set the bit
661-
this._digitalPort[portNum] |= (value &lt;&lt; (pin % 8));
662-
} else if (value === Pin.LOW) {
663-
// Clear the bit
664-
this._digitalPort[portNum] &amp;= ~(1 &lt;&lt; (pin % 8));
665-
} else {
666-
// Should not happen...
667-
throw new Error(&#x27;Invalid value passed to sendDigital, value must be 0 or 1.&#x27;);
668-
}
650+
try {
651+
var portNum = Math.floor(pin / 8);
652+
653+
if (value === Pin.HIGH) {
654+
// Set the bit
655+
this._digitalPort[portNum] |= (value &lt;&lt; (pin % 8));
656+
} else if (value === Pin.LOW) {
657+
// Clear the bit
658+
this._digitalPort[portNum] &amp;= ~(1 &lt;&lt; (pin % 8));
659+
} else {
660+
// Should not happen...
661+
throw new Error(&#x27;Invalid value passed to sendDigital, value must be 0 or 1.&#x27;);
662+
}
669663

670-
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
664+
this.sendDigitalPort(portNum, this._digitalPort[portNum]);
665+
} catch (err) {
666+
console.error(&#x27;Board -&gt; sendDigitalData, msg:&#x27;, err.message, &#x27;value:&#x27;, value);
667+
this.emit(BoardEvent.ERROR, err);
668+
setImmediate(this.disconnect.bind(this));
669+
}
671670
};
672671

673672
proto.sendServoData = function (pin, value) {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webduino-js",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"main": "index.js",
55
"description": "The Webduino Javascript Core, for Browser and Node.js",
66
"repository": "https://github.com/webduinoio/webduino-js.git",

src/webduino.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var webduino = webduino || {
2-
version: '0.5.0'
2+
version: '0.5.1'
33
};
44

55
if (typeof exports !== 'undefined') {

0 commit comments

Comments
 (0)