Skip to content

Commit

Permalink
~ parsing registers values
Browse files Browse the repository at this point in the history
  • Loading branch information
rascafr committed Sep 2, 2019
1 parent 389b4a9 commit 0a68b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ D.errors = {
0x48: 'External BMS - ???',
0x49: 'Internal BMS firmware version mismatch',
0x50: 'External BMS firmware version mismatch'
}

D.isRegisterOperation = function(reg) {
return (reg >= 0x01 && reg <= 0x04 || reg === 0x61);
}
2 changes: 1 addition & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function frameToString(frame) {
str += '\n - raw: ' + toHexString(frame.raw);
str += '\n - flow: ' + D.addresses[frame.src] + ' -> ' + D.addresses[frame.dst];
str += '\n - cmd: ' + D.commands[frame.cmd];
str += '\n - arg: ' + frame.arg;
str += '\n - arg: ' + (D.isRegisterOperation(frame.cmd) ? D.registers[frame.arg] : frame.arg);
str += '\n - payload: ' + toHexString(frame.payload);
str += '\n - UTF payload: ' + new Buffer(frame.payload).toString();
str += '\n';
Expand Down

0 comments on commit 0a68b24

Please sign in to comment.