Skip to content

Commit

Permalink
fix avr109 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones committed Jan 1, 2016
1 parent 37713c0 commit f7c9537
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion extension/src/avr109.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Avr109Board.prototype.waitForNewDevice_ = function(oldDevices, doneCb, deadline)

board.serialConnected_(connectArg, doneCb);
});
}, 2000);
}, 200);
}
});
}
Expand Down
14 changes: 7 additions & 7 deletions extension/test/fakeavr109.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ var FakeAvr109 = function(memorySize) {
this.onReceive.addListener = this.addListenerImpl_.bind(this);
this.onReceive.removeListener = this.removeListenerImpl_.bind(this);

this.reset_();
this.reset_(false);
this.nextConnectionId_ = 57;
this.memory_ = new Array(memorySize);
for (var i = 0; i < memorySize; i++) {
this.memory_[i] = 0;
}
}

FakeAvr109.prototype.reset_ = function() {
FakeAvr109.prototype.reset_ = function(bootloaderRunning) {
this.addressPtr_ = -1;
this.bootloaderRunning_ = false;
this.bootloaderRunning_ = bootloaderRunning;
this.bootloaderPortName_ = "bootloader-port";
this.connectionId_ = -1;
this.inProgmode_ = false;
Expand Down Expand Up @@ -85,19 +85,19 @@ FakeAvr109.prototype.connectImpl_ = function(deviceName, options, done) {
// Connected to the bootloader
done({connectionId: this.connectionId_});
} else {
// Just a normal connection
done({connectionId: this.connectionId_});

if (typeof(options.bitrate) != "undefined" && options.bitrate == AVR.MAGIC_BITRATE) {
log(kDebugFine, "FakeA109: Launching bootloader");
this.bootloaderRunning_ = true;
}

// Just a normal connection
done({connectionId: this.connectionId_});
}
}

FakeAvr109.prototype.disconnectImpl_ = function(connectionId, done) {
if (this.connectionId_ == connectionId) {
this.reset_();
this.reset_(this.bootloaderRunning_);
done(true);
} else {
done(false);
Expand Down

0 comments on commit f7c9537

Please sign in to comment.