live data objects evaluated at runtime (#4857)
* live data objects evaluated at runtime * guard * s
This commit is contained in:
parent
dab7349253
commit
65b459d461
|
@ -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<KnockController>().unmock();
|
||||
}
|
||||
|
||||
template<>
|
||||
const high_pressure_fuel_pump_s* getLiveDataAddr() {
|
||||
const high_pressure_fuel_pump_s* getLiveData(size_t) {
|
||||
#if EFI_HPFP
|
||||
return &engine->module<HpfpController>().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<InjectorModel>().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<AcController>().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<FuelPumpController>().unmock();
|
||||
}
|
||||
|
||||
template<>
|
||||
const main_relay_s* getLiveDataAddr() {
|
||||
const main_relay_s* getLiveData(size_t) {
|
||||
return &engine->module<MainRelayController>().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<IdleController>().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) };
|
||||
}
|
||||
|
|
|
@ -6,10 +6,4 @@
|
|||
|
||||
#include <rusefi/fragments.h>
|
||||
|
||||
template <typename TStruct>
|
||||
const TStruct* getLiveDataAddr();
|
||||
|
||||
template <typename TStruct>
|
||||
const TStruct* getLiveDataAddr(size_t index);
|
||||
|
||||
FragmentList getLiveDataFragments();
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e87a4bc95459fe757299591db65ec4286f8faab3
|
||||
Subproject commit 16a8e0b636f0a8d5f88dfdd6a1a4639ad90da936
|
Binary file not shown.
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue