mirror of
https://github.com/jwetzell/aas-js.git
synced 2026-08-11 23:53:38 +00:00
add whirley and start cleaning output state
This commit is contained in:
Generated
+8
@@ -3763,6 +3763,11 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
@@ -6176,6 +6181,9 @@
|
||||
"name": "aas-lib",
|
||||
"version": "0.1.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"devDependencies": {}
|
||||
},
|
||||
"packages/webui": {
|
||||
|
||||
+30
-2
@@ -1,10 +1,11 @@
|
||||
/* eslint-disable no-bitwise */
|
||||
const _ = require('lodash');
|
||||
|
||||
class Console {
|
||||
constructor() {
|
||||
this.sportInitialized = false;
|
||||
this.state = {
|
||||
time: {},
|
||||
auxTime: {},
|
||||
home: {},
|
||||
guest: {},
|
||||
};
|
||||
@@ -70,7 +71,8 @@ class Console {
|
||||
break;
|
||||
case 0x59:
|
||||
this.sport = 'whirley';
|
||||
throw new Error('Whirley is not implemented');
|
||||
this.parseWhirley();
|
||||
break;
|
||||
case 0x67:
|
||||
this.sport = 'segment';
|
||||
throw new Error('Segment is not implemented');
|
||||
@@ -94,7 +96,13 @@ class Console {
|
||||
}
|
||||
|
||||
this.state.auxTime = this.latestPacket.buffer.subarray(8, 9).toString('hex');
|
||||
if (this.state.auxTime === 'aa') {
|
||||
this.state.auxTime = '';
|
||||
}
|
||||
this.state.aux2Time = this.latestPacket.buffer.subarray(9, 10).toString('hex');
|
||||
if (this.state.aux2Time === 'aa') {
|
||||
this.state.aux2Time = '';
|
||||
}
|
||||
|
||||
const hornBinaryFlags = this.latestPacket.buffer.at(4).toString(2).padStart(8, '0');
|
||||
this.state.horn = hornBinaryFlags[0] === '1';
|
||||
@@ -440,6 +448,26 @@ class Console {
|
||||
}
|
||||
}
|
||||
|
||||
parseWhirley() {
|
||||
if (!this.sportInitialized) {
|
||||
this.sportInitialized = true;
|
||||
}
|
||||
const propertiesToDelete = [
|
||||
'home.timeouts',
|
||||
'guest.timeouts',
|
||||
'home.bonus',
|
||||
'guest.bonus',
|
||||
'home.doubleBonus',
|
||||
'guest.doubleBonus',
|
||||
'auxTime',
|
||||
'aux2Time',
|
||||
];
|
||||
|
||||
this.state.key = this.state.aux2Time;
|
||||
|
||||
this.state = _.omit(this.state, propertiesToDelete);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} packedNumber
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user