Skip to content

Commit

Permalink
Merge pull request #72 from tessel/0.2.11
Browse files Browse the repository at this point in the history
0.2.11
  • Loading branch information
johnnyman727 committed Sep 3, 2016
2 parents e87e82c + 23f2897 commit 27cbf28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -34,6 +34,8 @@ var FETCH_TRIGGER_CMD = 6;
var FIRMWARE_VERSION = 0x03;
var CRC = 0x1eb5;

var REBOOT_TIME = 100; // Amount of time needed to reboot and configure registers

function Ambient(hardware, callback) {
// Create a new instance of an attiny
this.attiny = new Attiny(hardware);
Expand Down Expand Up @@ -63,7 +65,7 @@ function Ambient(hardware, callback) {
};

// Make sure we can communicate with the module
self.attiny.initialize(firmwareOptions, function(err) {
self.attiny.initialize(REBOOT_TIME, firmwareOptions, function(err) {
if (err) {
if (callback) {
callback(err);
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "ambient-attx4",
"version": "0.2.10",
"version": "0.2.11",
"description": "Library to run the Ambient Module for Tessel. Detects ambient light and sound levels",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"./test": "false"
},
"dependencies": {
"attiny-common": "0.0.11",
"attiny-common": "0.1.0",
"sync-queue": "^0.0.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/index.js
Expand Up @@ -24,15 +24,15 @@ exports['Ambient'] = {
test.equal(this.sensor.pollInterval, undefined);
test.equal(this.attinyInitialized.callCount, 1);

// called with firmwareOptions, callback
test.equal(this.attinyInitialized.args[0].length, 2);
// called with rebootTime, firmwareOptions, callback
test.equal(this.attinyInitialized.args[0].length, 3);
test.done();
},

attinyInitialization: function(test) {
test.expect(3);

this.attinyInitialized = sandbox.stub(Attiny.prototype, 'initialize', (_, callback) => {
this.attinyInitialized = sandbox.stub(Attiny.prototype, 'initialize', (rebootTime, _, callback) => {
callback(null, this.sensor);
});

Expand Down

0 comments on commit 27cbf28

Please sign in to comment.