Usability: TS project rework #811

trying to address encoding nightmare
This commit is contained in:
rusefi 2019-06-01 17:15:01 -04:00
parent cd36259258
commit 4c75ebde21
6 changed files with 39 additions and 31 deletions

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:53:28 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Sat Jun 01 17:13:22 EDT 2019
// begin
#ifndef CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
#define CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -2635,7 +2635,7 @@ struct persistent_config_s {
float cltIdleCorr[CLT_CURVE_SIZE];
/**
* kg/hour value.
* By the way 2.081989116 kg/h = 1 ft<EFBFBD>/m
* By the way 2.081989116 kg/h = 1 ft3/m
* offset 10784
*/
float mafDecoding[MAF_DECODING_COUNT];
@ -2788,4 +2788,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Wed May 29 23:53:28 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on integration\rusefi_config.txt Sat Jun 01 17:13:22 EDT 2019

View File

@ -1080,7 +1080,7 @@ float[IAT_CURVE_SIZE] iatFuelCorr;;"Ratio", 1, 0, 0.0, 10.0,
float[CLT_CURVE_SIZE] cltIdleCorrBins;CLT-based idle position multiplier for simple manual idle controller;"C", 1, 0, -100.0, 250.0, 2
float[CLT_CURVE_SIZE] cltIdleCorr; CLT-based idle position multiplier for simple manual idle controller;"%", 1, 0, 0.0, 1000.0, 2
float[MAF_DECODING_COUNT] mafDecoding;kg/hour value.\nBy the way 2.081989116 kg/h = 1 ft<EFBFBD>/m;"kg/hour", 1, 0, -500.0, 4000.0, 2
float[MAF_DECODING_COUNT] mafDecoding;kg/hour value.\nBy the way 2.081989116 kg/h = 1 ft3/m;"kg/hour", 1, 0, -500.0, 4000.0, 2
float[MAF_DECODING_COUNT] mafDecodingBins;; "V", 1, 0, -5.0, 150.0, 2
angle_table_t ignitionIatCorrTable;

View File

@ -158,14 +158,14 @@ fileVersion = { 20171101 }
;
RPMValue = scalar, U32, 0, "RPM", 1, 0.00000
#if CELSIUS
coolant = scalar, F32, 4, "°C", 1, 0.0
coolant = scalar, F32, 4, "°C", 1, 0.0
#else
coolant = scalar, F32, 4, "°F", {9/5}, 17.77777
coolant = scalar, F32, 4, "°F", {9/5}, 17.77777
#endif
#if CELSIUS
intake = scalar, F32, 8, "°C", 1, 0.0
intake = scalar, F32, 8, "°C", 1, 0.0
#else
intake = scalar, F32, 8, "°F", {9/5}, 17.77777
intake = scalar, F32, 8, "°F", {9/5}, 17.77777
#endif
TPSValue = scalar, F32, 12, "%", 1, 0
MAFValue = scalar, F32, 16, "V", 1, 0
@ -215,14 +215,14 @@ fileVersion = { 20171101 }
ind_hasFatalError=bits, U32, 80, [6:6], "true", "false";
ind_isWarnNow =bits, U32, 80, [7:7], "true", "false";
firmwareTsVersion = scalar,U32, 84, "version_p", 1, 0
egt1 = scalar, S16, 88, "°C", 1, 0
egt2 = scalar, S16, 90, "°C", 1, 0
egt3 = scalar, S16, 92, "°C", 1, 0
egt4 = scalar, S16, 94, "°C", 1, 0
egt5 = scalar, S16, 96, "°C", 1, 0
egt6 = scalar, S16, 98, "°C", 1, 0
egt7 = scalar, S16, 100, "°C", 1, 0
egt8 = scalar, S16, 102, "°C", 1, 0
egt1 = scalar, S16, 88, "°C", 1, 0
egt2 = scalar, S16, 90, "°C", 1, 0
egt3 = scalar, S16, 92, "°C", 1, 0
egt4 = scalar, S16, 94, "°C", 1, 0
egt5 = scalar, S16, 96, "°C", 1, 0
egt6 = scalar, S16, 98, "°C", 1, 0
egt7 = scalar, S16, 100, "°C", 1, 0
egt8 = scalar, S16, 102, "°C", 1, 0
rpmAcceleration = scalar, F32, 104, "dRpm", 1, 0
massAirFlowValue= scalar, F32, 108, "Kg/h", 1, 0
veValue = scalar, F32, 112, "ratio", 1, 0
@ -780,14 +780,14 @@ gaugeCategory = Debug
gaugeCategory = Sensors
RPMGauge = RPMValue, "Engine Speed", "RPM", 0, 15000, 200, 500, 6000, 6000, 0, 0
#if CELSIUS
CLTGauge = coolant, "Coolant Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1
CLTGauge = coolant, "Coolant Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1
#else
CLTGauge = coolant, "Coolant Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1
CLTGauge = coolant, "Coolant Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1
#endif
#if CELSIUS
IATGauge = intake, "Intake Air Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1
IATGauge = intake, "Intake Air Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1
#else
IATGauge = intake, "Intake Air Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1
IATGauge = intake, "Intake Air Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1
#endif
TPSGauge = TPSValue, "Throttle Position", "%", 0, 100, 0, 0, 100, 100, 2, 2
afr1Gauge = AFRValue, "Air:Fuel Ratio 1", "", 10, 19.4, 12, 13, 15, 16, 2, 2
@ -825,9 +825,9 @@ gaugeCategory = Accel Data
gaugeCategory = Fuel Data
;Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld
#if CELSIUS
tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°C", -40, 140, -15, 1, 95, 110, 1, 1
tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°C", -40, 140, -15, 1, 95, 110, 1, 1
#else
tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°F", -40, 285, 5, 35, 205, 230, 1, 1
tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°F", -40, 285, 5, 35, 205, 230, 1, 1
#endif
baroCorrectionGauge = baroCorrection,"BaroCorr", "%", 0, 120, 10, 10, 100, 100, 1, 1
crankingFuelGauge = crankingFuelMs, @@GAUGE_NAME_FUEL_CRANKING@@, "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1
@ -1445,7 +1445,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->AUX1 Thermistor Sensor Setting
dialog = auxTempSensor1Sensor, "aux1 Thermistor Settings"
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = ""
field = "Lowest temperature", auxTempSensor1_tempC_1
field = "Resistance @ LT", auxTempSensor1_resistance_1
@ -1459,7 +1459,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->AUX2 Thermistor Sensor Setting
dialog = auxTempSensor2Sensor, "aux2 Thermistor Settings"
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = ""
field = "Lowest temperature", auxTempSensor2_tempC_1
field = "Resistance @ LT", auxTempSensor2_resistance_1
@ -1701,7 +1701,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->CLT sensor
dialog = clt_thermistor, "CLT sensor"
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = ""
field = "Lowest temperature", clt_tempC_1
field = "Resistance @ LT", clt_resistance_1
@ -1721,7 +1721,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->IAT sensor
dialog = iat_thermistor, "IAT sensor"
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = "#Typical temperatures is -40°C, 0°C and 100°C"
field = ""
field = "Lowest temperature", iat_tempC_1
field = "Resistance @ LT", iat_resistance_1

Binary file not shown.

View File

@ -8,6 +8,8 @@ import com.rusefi.util.LazyFile;
import java.io.*;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
@ -21,6 +23,7 @@ import java.util.List;
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
public class ConfigDefinition {
public static final String EOL = "\n";
public static final Charset CHARSET = StandardCharsets.ISO_8859_1;
public static final String GENERATED_AUTOMATICALLY_TAG = "was generated automatically by ConfigDefinition.jar based on ";
public static String MESSAGE;
@ -95,7 +98,7 @@ public class ConfigDefinition {
if (prependFile != null)
readPrependValues(prependFile);
BufferedReader definitionReader = new BufferedReader(new FileReader(definitionInputFile));
BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), CHARSET.name()));
ReaderState state = new ReaderState();
List<ConfigurationConsumer> destinations = new ArrayList<>();

View File

@ -3,6 +3,8 @@ package com.rusefi.util;
import com.rusefi.ConfigDefinition;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.Scanner;
import java.util.regex.Pattern;
@ -43,10 +45,14 @@ public class LazyFile {
for (int i = 0; i < Math.min(fileContent.length(), newContent.length()); i++) {
if (fileContent.charAt(i) != newContent.charAt(i)) {
System.out.println(getClass().getSimpleName() + " " + filename + ": Not same at " + i);
if (i > 15) {
System.out.println("file " + fileContent.substring(i - 15, i + 5));
System.out.println("newContent " + newContent.substring(i - 15, i + 5));
}
break;
}
}
FileWriter fw = new FileWriter(filename);
Writer fw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(filename), ConfigDefinition.CHARSET));
fw.write(content.toString());
fw.close();
}
@ -58,10 +64,9 @@ public class LazyFile {
private String readCurrentContent(String filename) throws IOException {
if (!new File(filename).exists())
return "";
BufferedReader br = new BufferedReader(new FileReader(filename));
Scanner in = new Scanner(Paths.get(filename), "UTF-8");
String line;
Scanner in = new Scanner(Paths.get(filename), ConfigDefinition.CHARSET.name());
Pattern pat = Pattern.compile(".*\\R|.+\\z");
String line;
StringBuffer sb = new StringBuffer();
while ((line = in.findWithinHorizon(pat, 0)) != null) {
if (!line.contains(ConfigDefinition.GENERATED_AUTOMATICALLY_TAG))