Skip to content

Commit

Permalink
fix decode dpt1 after refactoring byte interpretation in parser refs #56
Browse files Browse the repository at this point in the history
  • Loading branch information
andreek committed Nov 19, 2018
1 parent 893738d commit efa680a
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
.project
.DS_Store
.nyc_output/
.tern-project
5 changes: 1 addition & 4 deletions lib/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ Decoder.prototype.decode = function(len, data, callback) {
// eis 1 / dpt 1.xxx
if(len === 8) {
type = 'DPT1';
value = data-64;
if(value > 1) {
value = value-64;
}
value = data;
}

// eis 6 / dpt 5.xxx
Expand Down
195 changes: 195 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eibd",
"version": "0.4.1",
"version": "0.4.2",
"description": "node eibd client",
"main": "./index",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions test/decoder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ describe('Decoder', function() {
});
describe('DPT1', function() {
it('should decode DPT1 value 1', function() {
var data = 65;
var data = 1;
enc.decode(8, data, function(err, type, value) {
assert.equal(err, null);
assert.equal(type, 'DPT1');
assert.equal(value, 1);
});
}),
it('should decode DPT1 value 0', function() {
var data = 64;
var data = 0;
enc.decode(8, data, function(err, type, value) {
assert.equal(err, null);
assert.equal(type, 'DPT1');
Expand Down

0 comments on commit efa680a

Please sign in to comment.