trigger counters to formula, docs & improvements

This commit is contained in:
rusefi 2019-07-20 14:56:56 -04:00
parent 0f03030455
commit e5b953db84
23 changed files with 117 additions and 20 deletions

View File

@ -258,6 +258,8 @@ static const void * getStructAddr(int structId) {
return static_cast<engine_state2_s*>(&engine->engineState);
case LDS_FUEL_TRIM_INDEX:
return static_cast<wall_fuel_state*>(&engine->wallFuel);
case LDS_TRIGGER_INDEX:
return static_cast<trigger_central_s*>(&engine->triggerCentral);
default:
return NULL;
}

View File

@ -812,6 +812,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190713;
return 20190720;
}
#endif /* EFI_UNIT_TEST */

View File

@ -1,4 +1,5 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Jul 20 12:28:04 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
#define CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
@ -85,4 +86,4 @@ typedef struct engine_state2_s engine_state2_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Jul 20 12:28:04 EDT 2019

View File

@ -1 +1,5 @@
All the code here was generated by tools.
All the code here was generated by tools.
See gen_config.bat
See gen_config2.bat
See java_console\models\src\com\rusefi\config\generated

View File

@ -1,4 +1,5 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Mon Jun 17 20:32:33 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Sat Jul 20 12:28:04 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_THERMISTOR_H
#define CONTROLLERS_GENERATED_THERMISTOR_H
@ -24,4 +25,4 @@ typedef struct thermistor_state_s thermistor_state_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Mon Jun 17 20:32:33 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Sat Jul 20 12:28:04 EDT 2019

View File

@ -1,4 +1,5 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Jun 29 20:53:25 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Jul 20 12:29:51 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_TRIGGER_STRUCTS_H
#define CONTROLLERS_GENERATED_TRIGGER_STRUCTS_H
@ -18,4 +19,4 @@ typedef struct trigger_central_s trigger_central_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Jun 29 20:53:25 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Jul 20 12:29:51 EDT 2019

View File

@ -1,4 +1,5 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Fri Jul 12 22:41:50 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Sat Jul 20 12:28:05 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_WALL_FUEL_H
#define CONTROLLERS_GENERATED_WALL_FUEL_H
@ -22,4 +23,4 @@ typedef struct wall_fuel_state wall_fuel_state;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Fri Jul 12 22:41:50 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Sat Jul 20 12:28:05 EDT 2019

View File

@ -474,6 +474,19 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
bool isSynchronizationPoint;
bool wasSynchronized = shaft_is_synchronized;
DISPLAY(DISPLAY_CONFIG(TRIGGERINPUTPINS1));
DISPLAY_TEXT(Trigger_1_Fall);
DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS1));
DISPLAY_TEXT(Rise);
DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS2));
DISPLAY_TEXT(EOL);
DISPLAY(DISPLAY_CONFIG(TRIGGERINPUTPINS2));
DISPLAY_TEXT(Trigger_2_Fall);
DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS3));
DISPLAY_TEXT(Rise);
DISPLAY(DISPLAY_FIELD(HWEVENTCOUNTERS4));
if (triggerShape->isSynchronizationNeeded) {
// this is getting a little out of hand, any ideas?

View File

@ -29,6 +29,7 @@ java -DSystemOut.name=gen_config2 ^
-java_destination ../java_console/models/src/com/rusefi/config/generated/TriggerState.java ^
-c_destination controllers/generated/trigger_structs.h
%LIVE_DOCS_COMMAND% controllers/trigger/trigger_decoder.cpp
%LIVE_DOCS_COMMAND% controllers/sensors/thermistors.cpp
%LIVE_DOCS_COMMAND% controllers/sensors/tps.cpp
%LIVE_DOCS_COMMAND% controllers/math/speed_density.cpp

View File

@ -1,8 +1,8 @@
#define HW_EVENT_TYPES 6
struct_no_prefix trigger_central_s
struct_no_prefix define_contructor trigger_central_s
int[HW_EVENT_TYPES] hwEventCounters;
int[HW_EVENT_TYPES iterate] hwEventCounters;
end_struct

View File

@ -1,7 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Sat Jul 20 12:28:04 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
public class EngineState {

View File

@ -1,7 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Jul 18 18:26:35 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Jul 20 12:06:16 EDT 2019
// class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
public class Fields {

View File

@ -1,7 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Mon Jun 17 20:32:33 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Sat Jul 20 12:28:04 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
public class ThermistorState {

View File

@ -0,0 +1,24 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger.txt Sat Jul 20 12:28:04 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
public class TriggerState {
public static final int HW_EVENT_TYPES = 6;
public static final Field HWEVENTCOUNTERS1 = Field.create("HWEVENTCOUNTERS1", 0, FieldType.INT);
public static final Field HWEVENTCOUNTERS2 = Field.create("HWEVENTCOUNTERS2", 4, FieldType.INT);
public static final Field HWEVENTCOUNTERS3 = Field.create("HWEVENTCOUNTERS3", 8, FieldType.INT);
public static final Field HWEVENTCOUNTERS4 = Field.create("HWEVENTCOUNTERS4", 12, FieldType.INT);
public static final Field HWEVENTCOUNTERS5 = Field.create("HWEVENTCOUNTERS5", 16, FieldType.INT);
public static final Field HWEVENTCOUNTERS6 = Field.create("HWEVENTCOUNTERS6", 20, FieldType.INT);
public static final Field[] VALUES = {
HWEVENTCOUNTERS1,
HWEVENTCOUNTERS2,
HWEVENTCOUNTERS3,
HWEVENTCOUNTERS4,
HWEVENTCOUNTERS5,
HWEVENTCOUNTERS6,
};
}

View File

@ -1,7 +1,8 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Fri Jul 12 22:41:50 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/wall_fuel.txt Sat Jul 20 12:28:05 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
public class WallFuelState {

View File

@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20190714;
public static final int CONSOLE_VERSION = 20190720;
public static final String INPUT_FILES_PATH = "..";
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";

View File

@ -0,0 +1,19 @@
package com.rusefi.ldmp.generated;
import com.rusefi.ldmp.*;
public class TriggerDecoderMeta {
public static final Request[] CONTENT = new Request[]{
new ConfigRequest("TRIGGERINPUTPINS1"),
new TextRequest("Trigger_1_Fall"),
new FieldRequest("HWEVENTCOUNTERS1"),
new TextRequest("Rise"),
new FieldRequest("HWEVENTCOUNTERS2"),
new TextRequest("EOL"),
new ConfigRequest("TRIGGERINPUTPINS2"),
new TextRequest("Trigger_2_Fall"),
new FieldRequest("HWEVENTCOUNTERS3"),
new TextRequest("Rise"),
new FieldRequest("HWEVENTCOUNTERS4"),
};
}

View File

@ -6,12 +6,14 @@ import com.rusefi.config.Field;
import com.rusefi.config.generated.EngineState;
import com.rusefi.config.generated.Fields;
import com.rusefi.config.generated.ThermistorState;
import com.rusefi.config.generated.TriggerState;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.ldmp.*;
import com.rusefi.ldmp.generated.SpeedDensityMeta;
import com.rusefi.ldmp.generated.ThermistorsMeta;
import com.rusefi.ldmp.generated.TpsMeta;
import com.rusefi.ldmp.generated.TriggerDecoderMeta;
import com.rusefi.ui.livedocs.controls.Toolbox;
import com.rusefi.ui.util.UiUtils;
import org.jetbrains.annotations.NotNull;
@ -177,6 +179,9 @@ public class LiveDocPanel {
liveDocs.add(getPanel("tCharge", "", Fields.LDS_ENGINE_STATE_INDEX,
EngineState.VALUES, SpeedDensityMeta.CONTENT));
liveDocs.add(getPanel("Trigger", "", Fields.LDS_TRIGGER_INDEX,
TriggerState.VALUES, TriggerDecoderMeta.CONTENT));
return liveDocs;
}
}

Binary file not shown.

View File

@ -18,6 +18,7 @@ public class ConfigStructure {
public final String name;
public final String comment;
public final boolean withPrefix;
private final boolean withContructor;
/**
* We have two different collections because if 'array iterate' feature which is handled differently
* in C and TS
@ -29,10 +30,15 @@ public class ConfigStructure {
public int totalSize;
public BitState bitState = new BitState();
public ConfigStructure(String name, String comment, boolean withPrefix) {
public ConfigStructure(String name, String comment, boolean withPrefix, boolean withContructor) {
this.name = name;
this.comment = comment;
this.withPrefix = withPrefix;
this.withContructor = withContructor;
}
public boolean isWithContructor() {
return withContructor;
}
public String getName() {

View File

@ -25,6 +25,7 @@ public class ReaderState {
private static final String END_STRUCT = "end_struct";
private static final String STRUCT_NO_PREFIX = "struct_no_prefix ";
private static final String STRUCT = "struct ";
private static final String DEFINE_CONTRUCTOR = "define_contructor";
public Stack<ConfigStructure> stack = new Stack<>();
public Map<String, Integer> tsCustomSize = new HashMap<>();
public Map<String, String> tsCustomLine = new HashMap<>();
@ -136,6 +137,15 @@ public class ReaderState {
}
private static void handleStartStructure(ReaderState state, String line, boolean withPrefix) {
boolean withContructor;
if (line.toLowerCase().startsWith(DEFINE_CONTRUCTOR)) {
withContructor = true;
line = line.substring(DEFINE_CONTRUCTOR.length()).trim();
} else {
withContructor = false;
}
String name;
String comment;
if (line.contains(" ")) {
@ -146,7 +156,7 @@ public class ReaderState {
name = line;
comment = null;
}
ConfigStructure structure = new ConfigStructure(name, comment, withPrefix);
ConfigStructure structure = new ConfigStructure(name, comment, withPrefix, withContructor);
state.stack.push(structure);
SystemOut.println("Starting structure " + structure.getName());
}

View File

@ -21,6 +21,7 @@ public class CHeaderConsumer implements ConfigurationConsumer {
SystemOut.println("Writing C header to " + destCHeader);
cHeader = new LazyFile(destCHeader);
cHeader.write("// this section " + ConfigDefinition.MESSAGE + EOL);
cHeader.write("// by " + getClass() + EOL);
cHeader.write("// begin" + EOL);
String id = destCHeader.replaceAll("[\\\\\\.\\/]", "_").toUpperCase();
cHeader.write("#ifndef " + id + EOL);
@ -50,7 +51,7 @@ public class CHeaderConsumer implements ConfigurationConsumer {
}
@Override
public void startFile() throws IOException {
public void startFile() {
}
@Override
@ -61,6 +62,9 @@ public class CHeaderConsumer implements ConfigurationConsumer {
content.append("// start of " + structure.name + EOL);
content.append("struct " + structure.name + " {" + EOL);
if (structure.isWithContructor()) {
content.append("\t" + structure.name + "();" + EOL);
}
structure.bitState.reset();
for (int i = 0; i < structure.cFields.size(); i++) {

View File

@ -104,6 +104,7 @@ public class JavaFieldsConsumer implements ConfigurationConsumer {
public void startFile() {
javaFields.write("package " + JAVA_PACKAGE + ";" + ConfigDefinition.EOL + ConfigDefinition.EOL);
javaFields.write("// this file " + ConfigDefinition.MESSAGE + ConfigDefinition.EOL + EOL);
javaFields.write("// by " + getClass() + EOL);
javaFields.write("import com.rusefi.config.*;" + EOL + EOL);
javaFields.write("public class " + className + " {" + ConfigDefinition.EOL);
}