bs2-programmer
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -129,2 +129,6 @@ 'use strict'; | ||
function programSlot(slot){ | ||
return protocol.send(new Buffer([slot]), { ackLength: 0 }); | ||
} | ||
var promise = protocol.enterProgramming() | ||
@@ -134,2 +138,8 @@ .then(function(){ | ||
}) | ||
.then(function(board){ | ||
if(board.slotCount > 1){ | ||
//TODO multislot support | ||
return programSlot(0); | ||
} | ||
}) | ||
.then(upload) | ||
@@ -136,0 +146,0 @@ .ensure(function(){ |
@@ -34,3 +34,7 @@ 'use strict'; | ||
case 0x65: | ||
return resolve({name: 'BS2e', version: '1.0'}); | ||
return resolve({ name: 'BS2e', version: '1.0', slotCount: 8 }); | ||
case 0x66: | ||
return resolve({ name: 'BS2e', version: '1.1', slotCount: 8 }); | ||
case 0x67: | ||
return resolve({ name: 'BS2e', version: '1.2', slotCount: 8 }); | ||
@@ -51,10 +55,13 @@ default: | ||
case 0x58: | ||
return resolve({name: 'BS2sx', version: '1.0'}); | ||
return resolve({ name: 'BS2sx', version: '1.0', slotCount: 8 }); | ||
case 0x59: | ||
return resolve({name: 'BS2sx', version: '1.1'}); | ||
return resolve({ name: 'BS2sx', version: '1.1', slotCount: 8 }); | ||
case 0x60: | ||
return resolve({name: 'BS2sx', version: '1.2'}); | ||
case 0x5a: | ||
return resolve({ name: 'BS2sx', version: '1.2', slotCount: 8 }); | ||
case 0x5b: | ||
return resolve({ name: 'BS2sx', version: '1.3', slotCount: 8 }); | ||
default: | ||
@@ -74,24 +81,34 @@ return reject(new Error('Unknown: ' + response.toString(16))); | ||
case 0x70: | ||
return resolve({name: 'BS2p24', version: '1.0'}); | ||
return resolve({name: 'BS2p', version: '1.0', slotCount: 8 }); | ||
case 0x71: | ||
return resolve({name: 'BS2p24', version: '1.1'}); | ||
return resolve({name: 'BS2p', version: '1.1', slotCount: 8 }); | ||
case 0x72: | ||
return resolve({name: 'BS2p24', version: '1.2'}); | ||
return resolve({name: 'BS2p', version: '1.2', slotCount: 8 }); | ||
case 0x73: | ||
return resolve({name: 'BS2p24', version: '1.3'}); | ||
return resolve({name: 'BS2p', version: '1.3', slotCount: 8 }); | ||
case 0x74: | ||
return resolve({name: 'BS2p', version: '1.4', slotCount: 8 }); | ||
case 0x75: | ||
return resolve({name: 'BS2p', version: '1.5', slotCount: 8 }); | ||
case 0x76: | ||
return resolve({name: 'BS2p', version: '1.6', slotCount: 8 }); | ||
case 0x77: | ||
return resolve({name: 'BS2p', version: '1.7', slotCount: 8 }); | ||
case 0x50: | ||
return resolve({name: 'BS2p40', version: '1.0'}); | ||
return resolve({name: 'BS2p', version: '1.0', slotCount: 8 }); | ||
case 0x51: | ||
return resolve({name: 'BS2p40', version: '1.1'}); | ||
return resolve({name: 'BS2p', version: '1.1', slotCount: 8 }); | ||
case 0x52: | ||
return resolve({name: 'BS2p40', version: '1.2'}); | ||
return resolve({name: 'BS2p', version: '1.2', slotCount: 8 }); | ||
case 0x53: | ||
return resolve({name: 'BS2p40', version: '1.3'}); | ||
return resolve({name: 'BS2p', version: '1.3', slotCount: 8 }); | ||
case 0x54: | ||
return resolve({name: 'BS2p', version: '1.4', slotCount: 8 }); | ||
case 0x55: | ||
return resolve({name: 'BS2p', version: '1.5', slotCount: 8 }); | ||
case 0x56: | ||
return resolve({name: 'BS2p', version: '1.6', slotCount: 8 }); | ||
case 0x57: | ||
return resolve({name: 'BS2p', version: '1.7', slotCount: 8 }); | ||
@@ -112,19 +129,23 @@ default: | ||
case 0x69: | ||
return resolve({name: 'BS2pe24', version: '1.0'}); | ||
return resolve({name: 'BS2pe', version: '1.0', slotCount: 8 }); | ||
case 0x6a: | ||
return resolve({name: 'BS2pe', version: '1.1', slotCount: 8 }); | ||
case 0x6b: | ||
return resolve({name: 'BS2pe', version: '1.2', slotCount: 8 }); | ||
case 0x6c: | ||
return resolve({name: 'BS2pe', version: '1.3', slotCount: 8 }); | ||
case 0x6d: | ||
return resolve({name: 'BS2pe', version: '1.4', slotCount: 8 }); | ||
case 0x70: | ||
return resolve({name: 'BS2pe24', version: '1.1'}); | ||
case 0x71: | ||
return resolve({name: 'BS2pe24', version: '1.2'}); | ||
case 0x49: | ||
return resolve({name: 'BS2pe40', version: '1.0'}); | ||
return resolve({name: 'BS2pe', version: '1.0', slotCount: 8 }); | ||
case 0x4a: | ||
return resolve({name: 'BS2pe', version: '1.1', slotCount: 8 }); | ||
case 0x4b: | ||
return resolve({name: 'BS2pe', version: '1.2', slotCount: 8 }); | ||
case 0x4c: | ||
return resolve({name: 'BS2pe', version: '1.3', slotCount: 8 }); | ||
case 0x4d: | ||
return resolve({name: 'BS2pe', version: '1.4', slotCount: 8 }); | ||
case 0x50: | ||
return resolve({name: 'BS2pe40', version: '1.1'}); | ||
case 0x51: | ||
return resolve({name: 'BS2pe40', version: '1.2'}); | ||
default: | ||
@@ -131,0 +152,0 @@ return reject(new Error('Unknown: ' + response.toString(16))); |
{ | ||
"name": "bs2-programmer", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"description": "Upload tokenized hex to Basic Stamp 2", | ||
@@ -14,3 +14,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"bs2-serial-protocol": "^0.3.0", | ||
"bs2-serial-protocol": "^0.12.0", | ||
"code": "^1.3.0", | ||
@@ -17,0 +17,0 @@ "lab": "^5.2.1" |
@@ -80,3 +80,3 @@ 'use strict'; | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2e', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2e', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -108,3 +108,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -122,3 +122,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.1'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.1', slotCount: 8 }); | ||
done(); | ||
@@ -130,3 +130,3 @@ }); | ||
protocol._setData(new Buffer([0x60])); | ||
protocol._setData(new Buffer([0x5a])); | ||
@@ -137,3 +137,3 @@ var bs2 = new Programmer({ protocol: protocol, revision: 'bs2sx' }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.2'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2sx', version: '1.2', slotCount: 8 }); | ||
done(); | ||
@@ -164,3 +164,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p24', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -178,3 +178,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p24', version: '1.1'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.1', slotCount: 8 }); | ||
done(); | ||
@@ -192,3 +192,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p24', version: '1.2'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.2', slotCount: 8 }); | ||
done(); | ||
@@ -206,3 +206,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p24', version: '1.3'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.3', slotCount: 8 }); | ||
done(); | ||
@@ -220,3 +220,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p40', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -234,3 +234,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p40', version: '1.1'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.1', slotCount: 8 }); | ||
done(); | ||
@@ -248,3 +248,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p40', version: '1.2'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.2', slotCount: 8 }); | ||
done(); | ||
@@ -262,3 +262,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2p40', version: '1.3'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2p', version: '1.3', slotCount: 8 }); | ||
done(); | ||
@@ -289,3 +289,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe24', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -297,3 +297,3 @@ }); | ||
protocol._setData(new Buffer([0x70])); | ||
protocol._setData(new Buffer([0x6a])); | ||
@@ -304,3 +304,3 @@ var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe' }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe24', version: '1.1'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.1', slotCount: 8 }); | ||
done(); | ||
@@ -312,3 +312,3 @@ }); | ||
protocol._setData(new Buffer([0x71])); | ||
protocol._setData(new Buffer([0x6b])); | ||
@@ -319,3 +319,3 @@ var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe' }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe24', version: '1.2'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.2', slotCount: 8 }); | ||
done(); | ||
@@ -333,3 +333,3 @@ }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe40', version: '1.0'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.0', slotCount: 8 }); | ||
done(); | ||
@@ -341,3 +341,3 @@ }); | ||
protocol._setData(new Buffer([0x50])); | ||
protocol._setData(new Buffer([0x4a])); | ||
@@ -348,3 +348,3 @@ var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe' }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe40', version: '1.1'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.1', slotCount: 8 }); | ||
done(); | ||
@@ -356,3 +356,3 @@ }); | ||
protocol._setData(new Buffer([0x51])); | ||
protocol._setData(new Buffer([0x4b])); | ||
@@ -363,3 +363,3 @@ var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe' }); | ||
Code.expect(error).to.not.exist(); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe40', version: '1.2'}); | ||
Code.expect(result).to.deep.equal({name: 'BS2pe', version: '1.2', slotCount: 8 }); | ||
done(); | ||
@@ -373,3 +373,3 @@ }); | ||
var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe' }); | ||
var bs2 = new Programmer({ protocol: protocol, revision: 'bs2pe', slotCount: 8 }); | ||
bs2.identify(function(error){ | ||
@@ -376,0 +376,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31901
786