This commit is contained in:
rusefi 2021-11-24 14:53:26 -05:00
parent 622888d5d4
commit d981f54aa5
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,9 @@ import org.jetbrains.annotations.NotNull;
import java.util.*;
/**
* this weird class helps us match generated {@link live_data_e} with manually maintained {@link LiveDataView}
*/
public enum StateDictionary {
INSTANCE;
@ -30,7 +33,7 @@ public enum StateDictionary {
register(live_data_e.LDS_MAIN_RELAY, MainRelay.VALUES);
register(live_data_e.LDS_BOOST_CONTROL, BoostControl.VALUES);
if (map.size() != live_data_e.values().length) {
Set<live_data_e> missing = new HashSet<live_data_e>(Arrays.asList(live_data_e.values()));
Set<live_data_e> missing = new HashSet<>(Arrays.asList(live_data_e.values()));
missing.removeAll(map.keySet());
throw new IllegalStateException("Some live_data_e does not have values: " + missing);
}

View File

@ -3,7 +3,11 @@ package com.rusefi.livedata;
import com.rusefi.config.Field;
import com.rusefi.config.generated.*;
import com.rusefi.enums.live_data_e;
import com.rusefi.ldmp.StateDictionary;
/**
* @see StateDictionary
*/
public enum LiveDataView {
AC_CONTROL(live_data_e.LDS_AC_CONTROL, AcControl.VALUES, "ac_control.cpp"),
FUEL_PUMP(live_data_e.LDS_FUEL_PUMP, FuelPump.VALUES, "fuel_pump.cpp"),