update
Took 2 minutes
This commit is contained in:
parent
59f2932809
commit
6bbde817d4
@ -15,6 +15,7 @@ export class ArduinoProxy {
|
||||
private static onData(data) {
|
||||
data = data.toString().trim();
|
||||
try {
|
||||
log("Receiving " + data);
|
||||
let json = JSON.parse(data) as ArduinoProxyPayload;
|
||||
if (this.callbacks[json.id]) {
|
||||
this.callbacks[json.id].resolve(json);
|
||||
@ -81,7 +82,7 @@ export class ArduinoProxy {
|
||||
let id = Utils.generateRandomString(8);
|
||||
request.id = id;
|
||||
this.callbacks[id] = {resolve: resolve, reject: reject};
|
||||
|
||||
log("Sending " + request);
|
||||
this.serialPort.write(JSON.stringify(request), ArduinoProxy.encoding, (err: Error | null | undefined) => {
|
||||
if (err) {
|
||||
reject("I/O error on request " + id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user