Skip to content

Commit 7dfbab0

Browse files
committed
[REVERT] Restore timing
1 parent dcb2a1e commit 7dfbab0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arduino-create-agent-js-client",
3-
"version": "2.14.0",
3+
"version": "2.15.0",
44
"description": "JS module providing discovery of the Arduino Create Plugin and communication with it",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/socket-daemon.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ let orderedPluginAddresses = [LOOPBACK_ADDRESS, LOOPBACK_HOST];
4545
let driversRequested = false;
4646

4747
const CANT_FIND_AGENT_MESSAGE = 'Arduino Create Agent cannot be found';
48+
const UPLOAD_DONE_TIMER = 5000;
4849

4950
let updateAttempts = 0;
5051

@@ -382,7 +383,10 @@ export default class SocketDaemon extends Daemon {
382383
}
383384

384385
handleUploadMessage(message) {
385-
if (message.Flash === 'Ok' && message.ProgrammerStatus === 'Done') return this.uploading.next({ status: this.UPLOAD_DONE, msg: message.Flash });
386+
if (message.Flash === 'Ok' && message.ProgrammerStatus === 'Done') {
387+
// After the upload is completed the port goes down for a while, so we have to wait a few seconds
388+
return timer(UPLOAD_DONE_TIMER).subscribe(() => this.uploading.next({ status: this.UPLOAD_DONE, msg: message.Flash }));
389+
}
386390

387391
switch (message.ProgrammerStatus) {
388392
case 'Starting':

0 commit comments

Comments
 (0)