Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed Mar 17, 2022
1 parent 64b35e3 commit 9fcdf2e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/panda.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,14 @@ export default class Panda {
index: 0
}, 13);

let voltage = buf.readUInt32LE(0) / 1000;
let current = buf.readUInt32LE(4) / 1000;
let isStarted = buf.readInt8(8) === 1;
let controlsAreAllowed = buf.readInt8(9) === 1;
let isGasInterceptorDetector = buf.readInt8(10) === 1;
let isStartSignalDetected = buf.readInt8(11) === 1;
let isStartedAlt = buf.readInt8(12) === 1;

return {
voltage,
current,
isStarted,
controlsAreAllowed,
isGasInterceptorDetector,
isStartSignalDetected,
isStartedAlt
voltage: buf.readUInt32LE(0) / 1000,
current: buf.readUInt32LE(4) / 1000,
isStarted: buf.readInt8(8) === 1,
controlsAreAllowed: buf.readInt8(9) === 1,
isGasInterceptorDetector: buf.readInt8(10) === 1,
isStartSignalDetected: buf.readInt8(11) === 1,
isStartedAlt: buf.readInt8(12) === 1
};
}
async getDeviceMetadata() {
Expand Down

0 comments on commit 9fcdf2e

Please sign in to comment.