diff --git a/firmware/console/binary/live_data.cpp b/firmware/console/binary/live_data.cpp index 03ac7a36de..c4af95006f 100644 --- a/firmware/console/binary/live_data.cpp +++ b/firmware/console/binary/live_data.cpp @@ -9,17 +9,17 @@ #include "fuel_computer.h" template<> -const output_channels_s* getLiveDataAddr() { +const output_channels_s* getLiveData(size_t) { return &engine->outputChannels; } template<> -const knock_controller_s* getLiveDataAddr() { +const knock_controller_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const high_pressure_fuel_pump_s* getLiveDataAddr() { +const high_pressure_fuel_pump_s* getLiveData(size_t) { #if EFI_HPFP return &engine->module().unmock(); #else @@ -28,7 +28,7 @@ const high_pressure_fuel_pump_s* getLiveDataAddr() { } template<> -const launch_control_state_s* getLiveDataAddr() { +const launch_control_state_s* getLiveData(size_t) { #if EFI_LAUNCH_CONTROL return &engine->launchController; #else @@ -37,12 +37,12 @@ const launch_control_state_s* getLiveDataAddr() { } template<> -const injector_model_s* getLiveDataAddr() { +const injector_model_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const boost_control_s* getLiveDataAddr() { +const boost_control_s* getLiveData(size_t) { #if EFI_BOOST_CONTROL return &engine->boostController; #else @@ -51,17 +51,17 @@ const boost_control_s* getLiveDataAddr() { } template<> -const ac_control_s* getLiveDataAddr() { +const ac_control_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const fuel_computer_s* getLiveDataAddr() { +const fuel_computer_s* getLiveData(size_t) { return &engine->fuelComputer; } template<> -const fan_control_s* getLiveDataAddr(size_t idx) { +const fan_control_s* getLiveData(size_t idx) { switch (idx) { case 0: return &engine->fan1; case 1: return &engine->fan2; @@ -70,32 +70,32 @@ const fan_control_s* getLiveDataAddr(size_t idx) { } template<> -const fuel_pump_control_s* getLiveDataAddr() { +const fuel_pump_control_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const main_relay_s* getLiveDataAddr() { +const main_relay_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const engine_state_s* getLiveDataAddr() { +const engine_state_s* getLiveData(size_t) { return &engine->engineState; } template<> -const tps_accel_state_s* getLiveDataAddr() { +const tps_accel_state_s* getLiveData(size_t) { return &engine->tpsAccelEnrichment; } template<> -const trigger_central_s* getLiveDataAddr() { +const trigger_central_s* getLiveData(size_t) { return &engine->triggerCentral; } template<> -const trigger_state_s* getLiveDataAddr(size_t idx) { +const trigger_state_s* getLiveData(size_t idx) { #if EFI_SHAFT_POSITION_INPUT switch (idx) { case 0: return &engine->triggerCentral.triggerState; @@ -111,7 +111,7 @@ const trigger_state_s* getLiveDataAddr(size_t idx) { } template<> -const trigger_state_primary_s* getLiveDataAddr() { +const trigger_state_primary_s* getLiveData(size_t) { #if EFI_SHAFT_POSITION_INPUT return &engine->triggerCentral.triggerState; #else @@ -120,34 +120,25 @@ const trigger_state_primary_s* getLiveDataAddr() { } template<> -const wall_fuel_state_s* getLiveDataAddr() { +const wall_fuel_state_s* getLiveData(size_t) { return &engine->injectionEvents.elements[0].wallFuel; } template<> -const idle_state_s* getLiveDataAddr() { +const idle_state_s* getLiveData(size_t) { return &engine->module().unmock(); } template<> -const ignition_state_s* getLiveDataAddr() { +const ignition_state_s* getLiveData(size_t) { return &engine->ignitionState; } -template<> -const electronic_throttle_s* getLiveDataAddr(size_t) { - EtbController *etb = (EtbController *)engine->etbControllers[0]; - return etb; -} +static const FragmentEntry fragments[] = { +// This header is generated - do not edit by hand! +#include "live_data_fragments.h" +}; FragmentList getLiveDataFragments() { - // currently we initialize the array on first invocation - // this is quite a hack in terms of order of execution in real firmware code! - // todo: this still only allows for ONE unit test to work properly?! - static FragmentEntry fragments[] = { - // This header is generated - do not edit by hand! - #include "live_data_fragments.h" - }; - return { fragments, efi::size(fragments) }; } diff --git a/firmware/console/binary/live_data.h b/firmware/console/binary/live_data.h index b9f3ee3b14..0a0203b87c 100644 --- a/firmware/console/binary/live_data.h +++ b/firmware/console/binary/live_data.h @@ -6,10 +6,4 @@ #include -template -const TStruct* getLiveDataAddr(); - -template -const TStruct* getLiveDataAddr(size_t index); - FragmentList getLiveDataFragments(); diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 048c272f12..a40ae69143 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -60,9 +60,10 @@ #include "pch.h" +#include "electronic_throttle_impl.h" + #if EFI_ELECTRONIC_THROTTLE_BODY -#include "electronic_throttle_impl.h" #include "dc_motor.h" #include "dc_motors.h" #include "pid_auto_tune.h" @@ -1151,3 +1152,16 @@ void setProteusHitachiEtbDefaults() { } #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ + +template<> +const electronic_throttle_s* getLiveData(size_t idx) { +#if EFI_ELECTRONIC_THROTTLE_BODY + if (idx >= efi::size(etbControllers)) { + return nullptr; + } + + return etbControllers[idx]; +#else + return nullptr; +#endif +} diff --git a/firmware/init/sensor/init_lambda.cpp b/firmware/init/sensor/init_lambda.cpp index 8034c6674e..f5cf18a844 100644 --- a/firmware/init/sensor/init_lambda.cpp +++ b/firmware/init/sensor/init_lambda.cpp @@ -26,7 +26,7 @@ static AemXSeriesWideband aem2(1, SensorType::Lambda2); #endif template <> -const wideband_state_s* getLiveDataAddr(size_t idx) { +const wideband_state_s* getLiveData(size_t idx) { #if EFI_CAN_SUPPORT switch (idx) { case 0: return &aem1; diff --git a/firmware/libfirmware b/firmware/libfirmware index e87a4bc954..16a8e0b636 160000 --- a/firmware/libfirmware +++ b/firmware/libfirmware @@ -1 +1 @@ -Subproject commit e87a4bc95459fe757299591db65ec4286f8faab3 +Subproject commit 16a8e0b636f0a8d5f88dfdd6a1a4639ad90da936 diff --git a/java_tools/ConfigDefinition.jar b/java_tools/ConfigDefinition.jar index d2b822dc54..b123e58410 100644 Binary files a/java_tools/ConfigDefinition.jar and b/java_tools/ConfigDefinition.jar differ diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/LiveDataProcessor.java b/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/LiveDataProcessor.java index 0f9b4991b8..d419d64823 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/LiveDataProcessor.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/ldmp/LiveDataProcessor.java @@ -167,9 +167,9 @@ public class LiveDataProcessor { if (outputNamesArr.length < 2) { fragmentsContent - .append("getLiveDataAddr<") + .append("decl_frag<") .append(type) - .append(">(),\n"); + .append(">{},\n"); } else { for (int i = 0; i < outputNamesArr.length; i++) { if (i != 0) { @@ -178,11 +178,11 @@ public class LiveDataProcessor { } fragmentsContent - .append("getLiveDataAddr<") + .append("decl_frag<") .append(type) - .append(">(") + .append(", ") .append(i) - .append("),\t// ") + .append(">{},\t// ") .append(outputNamesArr[i]) .append("\n"); }