Update `202207`, add `generate` script (#130)

This commit is contained in:
Piotr Rogowski 2022-10-18 14:13:52 +02:00 committed by GitHub
parent 46edf163d8
commit 8181db8a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 46 deletions

View File

@ -11,7 +11,7 @@
Make sure you have registry specified in the `.npmrc` file:
```bash
@speedy-tuner:registry=https://npm.pkg.github.com
@hyper-tuner:registry=https://npm.pkg.github.com
```
Authenticate to GitHub Packages:

View File

@ -20,7 +20,8 @@
"prepublishOnly": "npm run build",
"start": "tsc --watch",
"lint": "tsc && eslint --max-warnings=0 src/**/*.ts src/*.ts",
"test": "npm run build && node test/test.js"
"test": "npm run build && node test/test.js",
"generate": "npm run build && node test/test.js generate"
},
"devDependencies": {
"@hyper-tuner/eslint-config": "^0.1.6",

View File

@ -7,7 +7,7 @@
MTversion = 2.25
queryCommand = "Q"
signature = "speeduino 202210-dev"
signature = "speeduino 202207"
versionInfo = "S" ;This info is what is displayed to user
[TunerStudio]
@ -288,7 +288,7 @@ page = 1
#if CELSIUS
aeColdTaperMin= scalar, U08, 2, "C", 1.0, -40, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#else
aeColdTaperMin= scalar, U08, 2, "F", 1.8, -22.23, -40, 419, 0 ;AE cold adjustment, taper start clt (full adjustment)
aeColdTaperMin= scalar, U08, 2, "F", 1.8, -22.23, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#endif
aeMode = bits, U08, 3, [0:1], "TPS", "MAP", "INVALID", "INVALID"
@ -353,7 +353,7 @@ page = 1
#if CELSIUS
aeColdTaperMax = scalar, U08, 39, "C", 1.0, -40, -40, 215, 0 ;AE cold adjustment, taper start clt (full adjustment)
#else
aeColdTaperMax = scalar, U08, 39, "F", 1.8, -22.23, -40, 419, 0 ;AE cold adjustment, taper end clt (no adjustment)
aeColdTaperMax = scalar, U08, 39, "F", 1.8, -22.23, -40, 215, 0 ;AE cold adjustment, taper end clt (no adjustment)
#endif
dutyLim = scalar, U08, 40, "%", 1.0, 0.0, 0.0, 95.0, 0
@ -399,13 +399,13 @@ page = 1
#if CELSIUS
aseBins = array, U08, 79, [4], "C", 1.0, -40, -40, 215, 0
#else
aseBins = array, U08, 79, [4], "F", 1.8, -22.23, -40, 419, 0
aseBins = array, U08, 79, [4], "F", 1.8, -22.23, -40, 215, 0
#endif
primePulse = array, U08, 83, [4], "ms", 0.5, 0.0, 0.0, 127.5, 1
#if CELSIUS
primeBins = array, U08, 87, [4], "C", 1.0, -40, -40, 215, 0
#else
primeBins = array, U08, 87, [4], "F", 1.8, -22.23, -40, 419, 0
primeBins = array, U08, 87, [4], "F", 1.8, -22.23, -40, 215, 0
#endif
CTPSPin = bits, U08, 91, [0:5], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "INVALID", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID"
CTPSPolarity = bits, U08, 91, [6:6], "Normal", "Inverted"
@ -423,7 +423,7 @@ page = 1
#if CELSIUS
dfcoMinCLT = scalar, U08, 101, "C", 1.0, -40, -40, 215, 0
#else
dfcoMinCLT = scalar, U08, 101, "F", 1.8, -22.23, -40, 419, 0
dfcoMinCLT = scalar, U08, 101, "F", 1.8, -22.23, -40, 215, 0
#endif
;VSS settings
@ -605,7 +605,7 @@ page = 4
#if CELSIUS
vvtMinClt = scalar, U08, 126, "C", 1.0, -40, -40, 215, 0
#else
vvtMinClt = scalar, U08, 126, "F", 1.8, -22.23, -40, 419, 0
vvtMinClt = scalar, U08, 126, "F", 1.8, -22.23, -40, 215, 0
#endif
vvtDelay = scalar, U08, 127, "S", 5.0, 0.0, 0, 1275, 0
@ -640,7 +640,7 @@ page = 6
#if CELSIUS
egoTemp = scalar, U08, 4, "C", 1.0, -40, -40, 102.0, 0
#else
egoTemp = scalar, U08, 4, "F", 1.8, -22.23, -40, 419.0, 0
egoTemp = scalar, U08, 4, "F", 1.8, -22.23, -40, 215.0, 0
#endif
egoCount = scalar, U08, 5, "", 4.0, 0.0, 4.0, 255.0, 0 ; * ( 1 byte)
vvtMode = bits, U08, 6, [0:1], "On/Off", "Open Loop", "Closed loop", "INVALID"
@ -666,7 +666,7 @@ page = 6
#if CELSIUS
airDenBins = array, U08, 27, [9], "C", 1.0, -40, -40, 215, 0 ; Bins for the air density correction curve
#else
airDenBins = array, U08, 27, [9], "F", 1.8, -22.23, -40, 419, 0 ; Bins for the air density correction curve
airDenBins = array, U08, 27, [9], "F", 1.8, -22.23, -40, 215, 0 ; Bins for the air density correction curve
#endif
airDenRates = array, U08, 36, [9], "%", 1.0, 0.0, 0, 255, 0 ; Values for the air density correction curve
@ -711,14 +711,14 @@ page = 6
#if CELSIUS
iacBins = array, U08, 94, [10], "C", 1.0, -40, -40, 215, 0
#else
iacBins = array, U08, 94, [10], "F", 1.8, -22.23, -40, 419, 0
iacBins = array, U08, 94, [10], "F", 1.8, -22.23, -40, 215, 0
#endif
iacCrankSteps= array, U08, 104, [4], "Steps", 3, 0, 0, 765, 0
iacCrankDuty = array, U08, 108, [4], "Duty %", 1.0, 0, 0, 100, 0
#if CELSIUS
iacCrankBins = array, U08, 112, [4], "C", 1.0, -40, -40, 215, 0
#else
iacCrankBins = array, U08, 112, [4], "F", 1.8, -22.23, -40, 419, 0
iacCrankBins = array, U08, 112, [4], "F", 1.8, -22.23, -40, 215, 0
#endif
iacAlgorithm = bits , U08, 116, [0:2], "None", "On/Off", "PWM Open loop", "PWM Closed loop", "Stepper Open Loop", "Stepper Closed Loop", "PWM Closed+Open loop", "Stepper Closed+Open loop"
@ -729,7 +729,7 @@ page = 6
#if CELSIUS
iacFastTemp = scalar, U08, 117, "C", 1.0, -40, -40, 215, 0
#else
iacFastTemp = scalar, U08, 117, "F", 1.8, -22.23, -40, 419, 0
iacFastTemp = scalar, U08, 117, "F", 1.8, -22.23, -40, 215, 0
#endif
iacStepHome = scalar, U08, 118, "Steps", 3, 0, 0, 765, 0
@ -743,14 +743,14 @@ page = 6
fanSP = scalar, U08, 121, "C", 1.0, -40, -40, 215.0, 0
fanHyster = scalar, U08, 122, "C", 1.0, 0.0, 0.0, 40, 0
#else
fanSP = scalar, U08, 121, "F", 1.8, -22.23, -40, 419.0, 0
fanSP = scalar, U08, 121, "F", 1.8, -22.23, -40, 215.0, 0
fanHyster = scalar, U08, 122, "F", 1.0, 0.0, 0.0, 40, 0
#endif
fanFreq = scalar, U08 , 123, "Hz", 2.0, 0.0, 10, 511, 0
#if CELSIUS
fanPWMBins = array, U08, 124, [4], "C", 1.0, -40, -40, 215, 0
#else
fanPWMBins = array, U08, 124, [4], "F", 1.8, -22.23, -40, 419, 0
fanPWMBins = array, U08, 124, [4], "F", 1.8, -22.23, -40, 215, 0
#endif
;--------------------------------------------------
@ -1058,7 +1058,7 @@ page = 9
#if CELSIUS
coolantProtTemp = array, U08, 173, [6], "C", 1.0, -40, -40, 215, 0
#else
coolantProtTemp = array, U08, 173, [6], "F", 1.8, -22.23, -40, 419, 0
coolantProtTemp = array, U08, 173, [6], "F", 1.8, -22.23, -40, 215, 0
#endif
unused179_184 = array, U08, 179, [6], "", 1, 0, 0, 255, 0
@ -1080,7 +1080,7 @@ page = 10
#if CELSIUS
crankingEnrichBins = array, U08, 0, [4], "C", 1.0, -40, -40, 215, 0
#else
crankingEnrichBins = array, U08, 0, [4], "F", 1.8, -22.23, -40, 419, 0
crankingEnrichBins = array, U08, 0, [4], "F", 1.8, -22.23, -40, 215, 0
#endif
crankingEnrichValues= array, U08, 4, [4], "%", 5.0, 0.0, 0, 1275, 0 ; Values for the cranking enrichment curve
@ -1111,7 +1111,7 @@ page = 10
#if CELSIUS
n2o_minCLT = scalar, U08, 76, "C", 1.0, -40, -40, 215, 0
#else
n2o_minCLT = scalar, U08, 76, "F", 1.8, -22.23, -40, 419, 0
n2o_minCLT = scalar, U08, 76, "F", 1.8, -22.23, -40, 215, 0
#endif
n2o_maxMAP = scalar, U08, 77, "kPa", 2.0, 0.0, 0.0, 511.0, 0
n2o_minTPS = scalar, U08, 78, "%TPS", 0.5, 0.0, 0.0, 100.0, 1
@ -1195,7 +1195,7 @@ page = 10
fuelPressureMax = scalar, U08, 138, "BAR", 0.0698, 0.0, 0.0, 17.8, 2
oilPressureMin = scalar, S08, 139, "BAR", 0.0698, 0.0, -7.0, 8.9, 2 ;Note signed int
oilPressureMax = scalar, U08, 140, "BAR", 0.0698, 0.0, 0.0, 17.8, 2
oilPressureProtMins = array, U08, 145, [ 4], "BAR", 0.0698, 0.0, 0.0, 17.8, 2
oilPressureProtMins = array, U08, 145, [ 4], "BAR", 0.0698, 0.0, 0.0, 17.8, 2
#else
fuelPressureMin = scalar, S08, 137, "psi", 1.0, 0.0, -100, 127, 0 ;Note signed int
fuelPressureMax = scalar, U08, 138, "psi", 1.0, 0.0, 0.0, 255, 0
@ -1217,7 +1217,7 @@ page = 10
#if CELSIUS
wmiIAT = scalar, U08, 154, "C", 1.0, -40, -40, 215, 0
#else
wmiIAT = scalar, U08, 154, "F", 1.8, -22.23, -40, 419, 0
wmiIAT = scalar, U08, 154, "F", 1.8, -22.23, -40, 215, 0
#endif
wmiOffset = scalar, S08, 155, "ms", 1.0, 0.0, -12.7, 12.7, 0 ;Note signed int
@ -1245,7 +1245,7 @@ page = 10
#if CELSIUS
fuelTempBins = array, U08, 174, [6], "C", 1.0, -40, -40, 215, 0
#else
fuelTempBins = array, U08, 174, [6], "F", 1.8, -22.23, -40, 419, 0
fuelTempBins = array, U08, 174, [6], "F", 1.8, -22.23, -40, 215, 0
#endif
fuelTempValues = array, U08, 180, [6], "%", 1.0, 0.0, 0, 255, 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
megaTune:
signature: speeduino 202210-dev
signature: speeduino 202207
MTversion: 2.25
queryCommand: Q
versionInfo: S

View File

@ -1,5 +1,5 @@
megaTune:
signature: speeduino 202210-dev
signature: speeduino 202207
MTversion: 2.25
queryCommand: Q
versionInfo: S

View File

@ -29,31 +29,37 @@ const hashReference = (version) => {
};
};
VERSIONS.forEach((version) => {
fs.readFile(pathFor(`ini/${version}.ini`), 'utf8', (_err, data) => {
const result = new INI((new TextEncoder()).encode(data))
.parse()
.getResults();
const run = (generateOnly) => {
VERSIONS.forEach((version) => {
fs.readFile(pathFor(`ini/${version}.ini`), 'utf8', (_err, data) => {
const result = new INI((new TextEncoder()).encode(data))
.parse()
.getResults();
const yamlContent = yaml.dump(result);
const jsonContent = JSON.stringify(result);
const yamlContent = yaml.dump(result);
const jsonContent = JSON.stringify(result);
const md5YamlNew = crypto.createHash('md5');
const md5JsonNew = crypto.createHash('md5');
const md5YamlNew = crypto.createHash('md5');
const md5JsonNew = crypto.createHash('md5');
const yamlNew = md5YamlNew.update(yamlContent).digest('hex');
const jsonNew = md5JsonNew.update(jsonContent).digest('hex');
const yamlNew = md5YamlNew.update(yamlContent).digest('hex');
const jsonNew = md5JsonNew.update(jsonContent).digest('hex');
const { yamlOld, jsonOld } = hashReference(version);
const { yamlOld, jsonOld } = hashReference(version);
// write temp files to disk so we can debug more easily
fs.writeFileSync(pathFor(`tmp/${version}.yml`), yamlContent);
fs.writeFileSync(pathFor(`tmp/${version}.json`), jsonContent);
// write temp files to disk so we can debug more easily
fs.writeFileSync(pathFor(`tmp/${version}.yml`), yamlContent);
fs.writeFileSync(pathFor(`tmp/${version}.json`), jsonContent);
assert.equal(yamlNew, yamlOld, `Generated file ${version}.yaml looks different than expected`);
assert.equal(jsonNew, jsonOld, `Generated file ${version}.json looks different than expected`);
if (!generateOnly) {
assert.equal(yamlNew, yamlOld, `Generated file ${version}.yaml looks different than expected`);
assert.equal(jsonNew, jsonOld, `Generated file ${version}.json looks different than expected`);
}
// fs.unlinkSync(pathFor(`tmp/${version}.yml`));
// fs.unlinkSync(pathFor(`tmp/${version}.json`));
// fs.unlinkSync(pathFor(`tmp/${version}.yml`));
// fs.unlinkSync(pathFor(`tmp/${version}.json`));
});
});
});
};
run(process.argv[2] === 'generate');