Please make gauges in Freedom Fahrenheit units celsius #4788

only: experiments
This commit is contained in:
Andrey 2024-08-04 17:14:29 -04:00
parent c470613ffb
commit d0c939d7f9
2 changed files with 22 additions and 9 deletions

View File

@ -54,9 +54,14 @@ public class ConnectionAndMeta {
return getBoolead("show_simulator");
}
// TS multiplier is technically different from autoscale, open question when we shall allow multiplier without autoscale
public static boolean flexibleAutoscale() {
return getBoolead("flexible_autoscale");
}
private static boolean getBoolead(String propertyName) {
String flag = getProperties().getProperty(propertyName);
return Boolean.TRUE.toString().equals(flag);
return Boolean.TRUE.toString().equalsIgnoreCase(flag);
}
private static Properties getProperties() throws RuntimeException {

View File

@ -3,6 +3,7 @@ package com.rusefi;
import com.devexperts.logging.Logging;
import com.opensr5.ini.field.EnumIniField;
import com.rusefi.core.Pair;
import com.rusefi.core.net.ConnectionAndMeta;
import com.rusefi.output.ConfigStructure;
import com.rusefi.output.JavaFieldsConsumer;
@ -91,7 +92,7 @@ public class ConfigFieldImpl implements ConfigField {
this.arraySizes = arraySizes;
this.tsInfo = tsInfo == null ? null : state.getVariableRegistry().applyVariables(tsInfo);
this.isIterate = isIterate;
if (tsInfo != null) {
if (tsInfo != null && !ConnectionAndMeta.flexibleAutoscale()) {
String[] tokens = getTokens();
if (tokens.length > 1) {
String scale = tokens[1].trim();
@ -176,13 +177,7 @@ public class ConfigFieldImpl implements ConfigField {
String[] nameTokens = nameString.split("\\s");
String name = nameTokens[nameTokens.length - 1];
boolean hasAutoscale = false;
for (String autoscaler : nameTokens) {
if (autoscaler.equals("autoscale")) {
hasAutoscale = true;
break;
}
}
boolean hasAutoscale = isHasAutoscale(nameTokens);
String comment = matcher.group(10);
validateComment(comment);
@ -219,6 +214,17 @@ public class ConfigFieldImpl implements ConfigField {
return field;
}
private static boolean isHasAutoscale(String[] nameTokens) {
boolean hasAutoscale = false;
for (String autoscaler : nameTokens) {
if (autoscaler.equals("autoscale")) {
hasAutoscale = true;
break;
}
}
return hasAutoscale;
}
private static void validateComment(String comment) {
if (comment == null)
return;
@ -318,6 +324,8 @@ public class ConfigFieldImpl implements ConfigField {
@Override
public String autoscaleSpec() {
if (!hasAutoscale)
return null;
Pair<Integer, Integer> pair = autoscaleSpecPair();
if (pair == null)
return null;