only:live data fix

This commit is contained in:
rusefillc 2023-07-02 11:58:58 -04:00
parent 6afdbca105
commit a4f4e79991
3 changed files with 44 additions and 33 deletions

View File

@ -11,6 +11,7 @@
#
# see gen_live_documentation.sh which is the main generation script
# todo: what is sequence of events in terms of 'live_data_e' code generation?
# todo: code generate StateDictionaryFactory.java
#
Usages:
# output_channels always goes first at least because it has protocol version at well-known offset

View File

@ -0,0 +1,40 @@
package com.rusefi.enums;
import com.rusefi.config.generated.*;
import com.rusefi.ldmp.StateDictionary;
public class StateDictionaryFactory {
public static void initialize(StateDictionary stateDictionary) {
//register(live_data_e.LDS_ETB_PID, PidState.VALUES); // 7
//register(live_data_e.LDS_IDLE_PID, PidState.VALUES);
//register(live_data_e.LDS_ALTERNATOR_PID,
// LDS_CJ125_PID
//register(live_data_e.LDS_IDLE, IdleState.VALUES);
// todo: code generate this!
stateDictionary.register(live_data_e.LDS_output_channels, TsOutputs.VALUES, "status_loop");
stateDictionary.register(live_data_e.LDS_engine_state, EngineState.VALUES, "engine");
stateDictionary.register(live_data_e.LDS_trigger_central, TriggerCentral.VALUES, "trigger_central");
stateDictionary.register(live_data_e.LDS_trigger_state, TriggerState.VALUES, "trigger_decoder");
stateDictionary.register(live_data_e.LDS_ac_control, AcControl.VALUES, "ac_control");
stateDictionary.register(live_data_e.LDS_fan_control, FuelPump.VALUES, "fan_control");
stateDictionary.register(live_data_e.LDS_injector_model, InjectorModel.VALUES, "injector_model");
stateDictionary.register(live_data_e.LDS_idle_state, IdleState.VALUES, "idle_thread");
stateDictionary.register(live_data_e.LDS_fuel_pump_control, FuelPump.VALUES, "fuel_pump");
stateDictionary.register(live_data_e.LDS_wall_fuel_state, WallFuelState.VALUES, "wall_fuel");
stateDictionary.register(live_data_e.LDS_tps_accel_state, TpsAccelState.VALUES, "accel_enrichment");
stateDictionary.register(live_data_e.LDS_main_relay, MainRelay.VALUES, "main_relay");
stateDictionary.register(live_data_e.LDS_boost_control, BoostControl.VALUES, "boost_control");
stateDictionary.register(live_data_e.LDS_launch_control_state, LaunchControl.VALUES, "launch_control");
stateDictionary.register(live_data_e.LDS_high_pressure_fuel_pump, HighPressureFuelPump.VALUES, "high_pressure_fuel_pump");
stateDictionary.register(live_data_e.LDS_ignition_state, IgnitionState.VALUES, "advance_map");
stateDictionary.register(live_data_e.LDS_electronic_throttle, ElectronicThrottle.VALUES, "electronic_throttle");
stateDictionary.register(live_data_e.LDS_knock_controller, KnockController.VALUES, "knock_controller");
stateDictionary.register(live_data_e.LDS_wideband_state, WidebandController.VALUES, "AemXSeriesLambda");
stateDictionary.register(live_data_e.LDS_trigger_state_primary, TriggerStatePrimary.VALUES, "trigger_decoder");
stateDictionary.register(live_data_e.LDS_fuel_computer, FuelComputer.VALUES, "fuel_computer");
stateDictionary.register(live_data_e.LDS_antilag_system_state, AntilagSystem.VALUES, "antilag_system");
stateDictionary.register(live_data_e.LDS_dc_motors, DcMotors.VALUES, "dc_motors");
stateDictionary.register(live_data_e.LDS_sent_state, SentState.VALUES, "sent");
stateDictionary.register(live_data_e.LDS_throttle_model, ThrottleModel.VALUES, "throttle_model");
}
}

View File

@ -1,7 +1,7 @@
package com.rusefi.ldmp;
import com.rusefi.config.Field;
import com.rusefi.config.generated.*;
import com.rusefi.enums.StateDictionaryFactory;
import com.rusefi.enums.live_data_e;
import org.jetbrains.annotations.NotNull;
@ -17,37 +17,7 @@ public enum StateDictionary {
private final Map<live_data_e, String> fileNames = new HashMap<>();
StateDictionary() {
//register(live_data_e.LDS_ETB_PID, PidState.VALUES); // 7
//register(live_data_e.LDS_IDLE_PID, PidState.VALUES);
//register(live_data_e.LDS_ALTERNATOR_PID,
// LDS_CJ125_PID
//register(live_data_e.LDS_IDLE, IdleState.VALUES);
// todo: code generate this!
register(live_data_e.LDS_output_channels, TsOutputs.VALUES, "status_loop");
register(live_data_e.LDS_engine_state, EngineState.VALUES, "engine");
register(live_data_e.LDS_trigger_central, TriggerCentral.VALUES, "trigger_central");
register(live_data_e.LDS_trigger_state, TriggerState.VALUES, "trigger_decoder");
register(live_data_e.LDS_ac_control, AcControl.VALUES, "ac_control");
register(live_data_e.LDS_fan_control, FuelPump.VALUES, "fan_control");
register(live_data_e.LDS_injector_model, InjectorModel.VALUES, "injector_model");
register(live_data_e.LDS_idle_state, IdleState.VALUES, "idle_thread");
register(live_data_e.LDS_fuel_pump_control, FuelPump.VALUES, "fuel_pump");
register(live_data_e.LDS_wall_fuel_state, WallFuelState.VALUES, "wall_fuel");
register(live_data_e.LDS_tps_accel_state, TpsAccelState.VALUES, "accel_enrichment");
register(live_data_e.LDS_main_relay, MainRelay.VALUES, "main_relay");
register(live_data_e.LDS_boost_control, BoostControl.VALUES, "boost_control");
register(live_data_e.LDS_launch_control_state, LaunchControl.VALUES, "launch_control");
register(live_data_e.LDS_high_pressure_fuel_pump, HighPressureFuelPump.VALUES, "high_pressure_fuel_pump");
register(live_data_e.LDS_ignition_state, IgnitionState.VALUES, "advance_map");
register(live_data_e.LDS_electronic_throttle, ElectronicThrottle.VALUES, "electronic_throttle");
register(live_data_e.LDS_knock_controller, KnockController.VALUES, "knock_controller");
register(live_data_e.LDS_wideband_state, WidebandController.VALUES, "AemXSeriesLambda");
register(live_data_e.LDS_trigger_state_primary, TriggerStatePrimary.VALUES, "trigger_decoder");
register(live_data_e.LDS_fuel_computer, FuelComputer.VALUES, "fuel_computer");
register(live_data_e.LDS_antilag_system_state, AntilagSystem.VALUES, "antilag_system");
register(live_data_e.LDS_dc_motors, DcMotors.VALUES, "dc_motors");
register(live_data_e.LDS_sent_state, SentState.VALUES, "sent");
register(live_data_e.LDS_throttle_model, ThrottleModel.VALUES, "throttle");
StateDictionaryFactory.initialize(this);
if (map.size() != live_data_e.values().length) {
Set<live_data_e> missing = new HashSet<>(Arrays.asList(live_data_e.values()));
missing.removeAll(map.keySet());
@ -69,7 +39,7 @@ public enum StateDictionary {
return result;
}
private void register(live_data_e ldsIndex, Field[] values, String fileName) {
public void register(live_data_e ldsIndex, Field[] values, String fileName) {
map.put(ldsIndex, values);
fileNames.put(ldsIndex, fileName);
}