Skip to content

Commit 847e13e

Browse files
authored
rusEFI - basic support (#311)
1 parent e0d2507 commit 847e13e

File tree

7 files changed

+173
-132
lines changed

7 files changed

+173
-132
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"cSpell.words": [
4+
"rusefi"
5+
]
36
}

package-lock.json

Lines changed: 153 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
"test": "node test/test.js"
3939
},
4040
"devDependencies": {
41-
"@types/node": "^18.11.2",
42-
"@typescript-eslint/eslint-plugin": "^5.40.1",
43-
"@typescript-eslint/parser": "^5.40.1",
44-
"eslint": "^8.25.0",
41+
"@types/node": "^18.11.8",
42+
"@typescript-eslint/eslint-plugin": "^5.42.0",
43+
"@typescript-eslint/parser": "^5.42.0",
44+
"eslint": "^8.26.0",
4545
"eslint-config-prettier": "^8.5.0",
4646
"eslint-plugin-import": "^2.26.0",
4747
"eslint-plugin-modules-newline": "^0.0.6",

src/parser.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,16 @@ export class Parser {
152152
private number(type: NumberType, size: number) {
153153
const functionName = `get${type.charAt(0).toUpperCase()}${type.slice(1)}${size}`;
154154

155-
// dynamically call DataView function like: this.dataView.getInt8(8);
156-
const result = (this.dataView as any)[functionName](this.offset);
157-
this.advance(size / 8);
158-
159-
return result;
155+
try {
156+
// dynamically call DataView function like: this.dataView.getInt8(8);
157+
const result = (this.dataView as any)[functionName](this.offset);
158+
this.advance(size / 8);
159+
160+
return result;
161+
} catch (error) {
162+
// out of range
163+
return 0;
164+
}
160165
}
161166

162167
private string(length: number) {

test/data/rusefi.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

test/data/rusefi.mlg

9.11 MB
Binary file not shown.

test/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const testFiles = [
1818
'data/short',
1919
'data/blank',
2020
'data/markers',
21+
'data/rusefi',
2122
];
2223

2324
const toArrayBuffer = (b) => {

0 commit comments

Comments
 (0)