only:proteus_f7

setConfigValueByName into text console
This commit is contained in:
Andrey 2023-06-27 15:05:15 -04:00
parent 7399d9ac71
commit 8ca776d3e0
5 changed files with 20 additions and 9 deletions

View File

@ -4282,6 +4282,6 @@ bool setConfigValueByName(const char *name, float value) {
engineConfiguration->lambdaProtectionTimeout = (int)value;
return 1;
}
return 0;
}
return 0;
}

View File

@ -842,7 +842,12 @@ void configureRusefiLuaHooks(lua_State* l) {
auto propertyName = luaL_checklstring(l, 1, nullptr);
auto value = luaL_checknumber(l, 2);
auto incrementVersion = lua_toboolean(l, 3);
setConfigValueByName(propertyName, value);
bool isGoodName = setConfigValueByName(propertyName, value);
if (isGoodName) {
efiPrintf("LUA: applying [%s][%f]", propertyName, value);
} else {
efiPrintf("LUA: invalid calibration key [%s]", propertyName);
}
if (incrementVersion) {
incrementGlobalConfigurationVersion("lua");
}

View File

@ -915,6 +915,12 @@ static void setValue(const char *paramStr, const char *valueStr) {
// rusEfi console invokes this method with timestamp in local timezone
setDateTime(valueStr);
}
bool isGoodName = setConfigValueByName(paramStr, valueF);
if (isGoodName) {
efiPrintf("Settings: applying [%s][%f]", paramStr, valueF);
}
engine->resetEngineSnifferIfInTestMode();
}
@ -947,8 +953,8 @@ void initSettings(void) {
addConsoleActionS(CMD_ENABLE, enable);
addConsoleActionS(CMD_DISABLE, disable);
addConsoleActionSS("set", setValue);
addConsoleActionS("get", getValue);
addConsoleActionSS(CMD_SET, setValue);
addConsoleActionS(CMD_GET, getValue);
#if EFI_PROD_CODE
addConsoleActionS("showpin", showPinFunction);

View File

@ -57,8 +57,9 @@ public class GetConfigValueConsumerTest {
"\t\tconfig->iat.adcChannel = (int)value;\n" +
"\t\treturn 1;\n" +
"\t}\n" +
"return 0;\n" +
"\t}\n", getConfigValueConsumer.getSetterBody());
"\t}\n" +
"\treturn 0;\n",
getConfigValueConsumer.getSetterBody());
assertEquals("// generated by GetConfigValueConsumer.java\n" +
"#include \"pch.h\"\n" +
@ -88,8 +89,8 @@ public class GetConfigValueConsumerTest {
"\t\tconfig->iat.adcChannel = (int)value;\n" +
"\t\treturn 1;\n" +
"\t}\n" +
"return 0;\n" +
"\t}\n" +
"\treturn 0;\n" +
"}\n", getConfigValueConsumer.getContent());

View File

@ -163,11 +163,10 @@ public class GetConfigValueConsumer implements ConfigurationConsumer {
setterBody.append(str);
}
}
switchBody.append("return 0;\n");
String fullSwitch = GetOutputValueConsumer.wrapSwitchStatement(switchBody);
return fullSwitch + setterBody;
return fullSwitch + "\treturn 0;\n" + setterBody;
}
public String getContent() {