Skip to content

Commit

Permalink
Improve live data
Browse files Browse the repository at this point in the history
  • Loading branch information
flxkrmr committed Mar 25, 2023
1 parent 112ff65 commit 3160c1a
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 90 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ npm run start
```
npm run make
```
### Publish Release draft to Github
### Create a tag Publish Release draft to Github
```
git tag -a v0.3.5 -m "v0.3.5"
git push origin v0.3.5
set GITHUB_TOKEN=xxx
npm run publish
```
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ <h3>
<td class="data-type">Speed</td>
<td id="data-speed">-</td>
</tr>
<tr>
<td class="data-type">Speed Unfiltered</td>
<td id="data-speed-unfiltered">-</td>
</tr>
<tr>
<td class="data-type">Manifold Absolute Pressure</td>
<td id="data-map">-</td>
</tr>
<tr>
<td class="data-type">Barometric Pressure</td>
<td id="data-bp">-</td>
</tr>
</tbody>
</table>
</div>
Expand Down
70 changes: 69 additions & 1 deletion lib/eec-iv.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,16 @@ class EecIvDecoder {
}

toRpm(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word)*4
}

toLambda(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word)/1000;
}

Expand Down Expand Up @@ -211,6 +217,9 @@ class EecIvDecoder {
}

toTemperatureC(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
// word[0] * 10/9 - 160/9 // comparing with ref this is pretty close
return (this.toTemperatureF(word) - 32) * 5/9;
}
Expand All @@ -231,6 +240,9 @@ class EecIvDecoder {
}

toAirFlowMeter(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word) * 100/256;
}

Expand All @@ -243,16 +255,24 @@ class EecIvDecoder {
}

toInjectionPulseClk(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word) * 32;
}

toThrottlePositionRef(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
//return ((256 * (word[1]&0xF) + word[0]) - (256 * (word[1]&0xF) + word[0]) * 5 / 200) * 5;
return this.toDec(word) * 4.875;
}

toThrottlePositionAD(word) {
// TODO as percentage
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word);
}

Expand All @@ -279,6 +299,9 @@ class EecIvDecoder {
}

toSpeedDec(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word);
}

Expand All @@ -290,10 +313,16 @@ class EecIvDecoder {
}

toSpeedKmh(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toSpeedMph(word) * 1.60934;
}

toVaporValveMode(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word) == 3200 ? "Open" : "Closed";
}

Expand All @@ -311,6 +340,35 @@ class EecIvDecoder {
return word[0] & 0x80;
}

toPressure(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return word[0] / 8;
}


toPressureMBar(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toPressure(word) * 33.8639;
}

toSpeedUnfiltered(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return word[0] / 32;
}

toRatch(word) {
if (!this.validWord(word) || !this.validChecksum(word)) {
return null;
}
return this.toDec(word) / 4;
}

getAllFaultCodes(data) {
let faultCodes = [];
console.log(data);
Expand Down Expand Up @@ -354,6 +412,16 @@ class EecIvDecoder {
liveData.fuelVaporModeHex = this.toHexString(data.slice(28, 30));
liveData.fuelPumpModeDec = this.toDec(data.slice(30, 32));
liveData.fuelPumpModeHex = this.toHexString(data.slice(30, 32));
liveData.manifoldAbsolutePressure = this.toPressure(data.slice(32, 34));
liveData.barometricPressureMilliBar = this.toPressureMBar(data.slice(34, 36));
liveData.manifoldAbsolutePressureMilliBar = this.toPressureMBar(data.slice(32, 34));
liveData.barometricPressure = this.toPressure(data.slice(34, 36));
liveData.scap = this.toHexString(data.slice(36, 38));
liveData.egrDuty = this.toHexString(data.slice(38, 40));
liveData.speedUnfiltered = this.toSpeedUnfiltered(data.slice(40, 42));
liveData.airChargeValue = this.toHexString(data.slice(42, 44));
liveData.adaptiveFuelCorrection = this.toHexString(data.slice(44, 46));
liveData.ratch = this.toRatch(data.slice(46, 48));

return liveData;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Serial {
this.onReadingStarted(line.slice(3, 4));
} else if (messageType == 0x03) {
console.log("Live Data");
this.onLiveData(line.slice(3, 35));
this.onLiveData(line.slice(3, 51));
} else if (messageType == 0x04) {
console.log("Fault Codes");
this.onFaultCodes(line.slice(3, 37));
Expand Down
4 changes: 1 addition & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { app, BrowserWindow, ipcMain } = require('electron')
const path = require('path')
const electronDl = require('electron-dl');

electronDl();
require('update-electron-app')()


if (handleSquirrelEvent()) {
Expand Down
Loading

0 comments on commit 3160c1a

Please sign in to comment.