Skip to content

Commit b886b2f

Browse files
author
Marty
committed
override Board's startup() function for init SerialPort Control
1 parent 60c9721 commit b886b2f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/board/Bit.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
+(function(factory) {
1+
+(function (factory) {
22
if (typeof exports === 'undefined') {
33
factory(webduino || {});
44
} else {
55
module.exports = factory;
66
}
7-
}(function(scope) {
7+
}(function (scope) {
88
'use strict';
99

1010
var util = scope.util,
@@ -54,6 +54,16 @@
5454

5555
Bit.DEFAULT_SERVER = 'wss://ws.webduino.io:443';
5656

57+
proto.startup = async function () {
58+
this._isReady = true;
59+
if (this._options.transport === 'serial') {
60+
// wait for physical board ready to receive data from serialPort
61+
await delay(0.5);
62+
this.send([0xf0, 0x0e, 0x0c, 0xf7]);
63+
}
64+
this.emit(BoardEvent.READY, this);
65+
};
66+
5767

5868
scope.board.Bit = Bit;
5969

0 commit comments

Comments
 (0)