From 9fcdf2ed8198df40d017e6e30d528a6fafe11fbe Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Wed, 16 Mar 2022 00:08:30 +0000 Subject: [PATCH] shorter --- src/panda.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/panda.js b/src/panda.js index b3f417e..cab2150 100644 --- a/src/panda.js +++ b/src/panda.js @@ -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() {