Refactoring, technical debt: export more of trigger attributes into triggers.txt file #2077
This commit is contained in:
parent
9825e011ee
commit
de72978255
|
@ -390,7 +390,7 @@ typedef enum {
|
|||
TT_UNUSED = 58, // this is used if we want to iterate over all trigger types
|
||||
|
||||
Force_4_bytes_size_trigger_type = ENUM_32_BITS,
|
||||
} trigger_type_e;
|
||||
} trigger_type_e; // TriggerProcessor.java has this "trigger_type_e" name hard-coded!
|
||||
|
||||
typedef enum {
|
||||
ADC_OFF = 0,
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# this file is consumed by TriggerProcessor.java during the gen_config.sh code generation phase
|
||||
|
||||
triggers:
|
||||
- name: TT_GM_LS_24
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_HONDA_K_12_1
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_RENIX_44_2_2
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_RENIX_66_2_2_2
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_MIATA_VVT
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_TRI_TACH
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_60_2_VW
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_SKODA_FAVORIT
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_KAWA_KX450F
|
||||
isFirstCrankBased: true
|
||||
|
||||
- name: TT_GM_7X
|
||||
isFirstCrankBased: true
|
|
@ -0,0 +1,42 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.enum_reader.Value;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class TriggerProcessor {
|
||||
|
||||
private static final String CONTROLLERS_TRIGGER_DECODERS_TRIGGERS_META_YAML = "firmware/controllers/trigger/decoders/triggers-meta.yaml";
|
||||
|
||||
public void run(EnumsReader enumsReader, VariableRegistry instance) {
|
||||
Map<String, Map<String, Value>> enums = enumsReader.getEnums();
|
||||
|
||||
Map<String/*enum member*/, Value> triggers = enums.get("trigger_type_e");
|
||||
System.out.println("triggers2: " + triggers);
|
||||
|
||||
System.out.println(instance.intValues);
|
||||
|
||||
TreeMap<Integer, String> valueNameById = instance.resolveEnumValues(enumsReader, "trigger_type_e");
|
||||
|
||||
System.out.println("resolved: " + valueNameById);
|
||||
System.exit(-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* this method is used for manual testing only
|
||||
*/
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
readTriggers("../../" + CONTROLLERS_TRIGGER_DECODERS_TRIGGERS_META_YAML);
|
||||
}
|
||||
|
||||
private static void readTriggers(String triggerMetaYamlFile) throws FileNotFoundException {
|
||||
Yaml yaml = new Yaml();
|
||||
yaml.load(new FileReader(triggerMetaYamlFile));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue