We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbf9418 commit b3e3d18Copy full SHA for b3e3d18
1 file changed
src/core/Board.js
@@ -30,7 +30,10 @@
30
DISCONNECT: 'disconnect'
31
};
32
33
- // Message command bytes (128-255/0x80-0xFF)
+ /**
34
+ * Message command bytes (128-255/0x80-0xFF)
35
+ * https://github.com/firmata/protocol/blob/master/protocol.md
36
+ */
37
var DIGITAL_MESSAGE = 0x90,
38
ANALOG_MESSAGE = 0xE0,
39
REPORT_ANALOG = 0xC0,
@@ -122,14 +125,19 @@
122
125
}
123
126
124
127
function onMessage(data) {
- var len = data.length;
128
+ try {
129
+ var len = data.length;
130
- if (len) {
- for (var i = 0; i < len; i++) {
- this.processInput(data[i]);
131
+ if (len) {
132
+ for (var i = 0; i < len; i++) {
133
+ this.processInput(data[i]);
134
+ }
135
+ } else {
136
+ this.processInput(data);
137
- } else {
- this.processInput(data);
138
+ } catch (err) {
139
+ console.error(err);
140
+ throw err;
141
142
143
0 commit comments