From 65ffcc4f377f24b969e6350a17d32b075ff669be Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 29 Jun 2022 03:27:51 -0400 Subject: [PATCH] logging of live data structs was: data points #3614 --- .../controllers/actuators/boost_control.cpp | 10 +- .../actuators/boost_control_generated.h | 20 +++- .../actuators/electronic_throttle.cpp | 8 +- .../actuators/electronic_throttle_generated.h | 19 +++- .../controllers/algo/engine_state_generated.h | 99 +++++++++---------- 5 files changed, 87 insertions(+), 69 deletions(-) diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index 3dcf758651..4155143802 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -45,8 +45,8 @@ expected BoostController::getSetpoint() { // Open loop needs to work even in case of invalid closed loop config isNotClosedLoop = engineConfiguration->boostType != CLOSED_LOOP; if (isNotClosedLoop) { - closedLoopPart = 0; - return closedLoopPart; + boostControllerClosedLoopPart = 0; + return (float)boostControllerClosedLoopPart; } float rpm = Sensor::getOrZero(SensorType::Rpm); @@ -122,11 +122,9 @@ expected BoostController::getClosedLoop(float target, float manifoldP m_pid.postState(engine->outputChannels.boostStatus); -#if EFI_TUNER_STUDIO - engine->outputChannels.boostControlTarget = target; -#endif /* EFI_TUNER_STUDIO */ + boostControlTarget = target; - return closedLoopPart; + return (float)boostControllerClosedLoopPart; } void BoostController::setOutput(expected output) { diff --git a/firmware/controllers/actuators/boost_control_generated.h b/firmware/controllers/actuators/boost_control_generated.h index 47f36ae264..b9bf0fdee9 100644 --- a/firmware/controllers/actuators/boost_control_generated.h +++ b/firmware/controllers/actuators/boost_control_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/boost_control.txt Sun Apr 17 20:27:25 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/boost_control.txt Wed Jun 29 03:21:07 EDT 2022 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -106,11 +106,25 @@ struct boost_control_s { */ float openLoopPart = (float)0; /** + * @@GAUGE_NAME_BOOST_CLOSED_LOOP@@ + % * offset 8 */ - float closedLoopPart = (float)0; + scaled_channel boostControllerClosedLoopPart = (int8_t)0; + /** + * need 4 byte alignment + units + * offset 9 + */ + uint8_t alignmentFill_at_9[1]; + /** + * @@GAUGE_NAME_BOOST_TARGET@@ + kPa + * offset 10 + */ + scaled_channel boostControlTarget = (int16_t)0; }; static_assert(sizeof(boost_control_s) == 12); // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/boost_control.txt Sun Apr 17 20:27:25 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/boost_control.txt Wed Jun 29 03:21:07 EDT 2022 diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index c2f656b0e5..895c0db352 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -367,17 +367,15 @@ percent_t EtbController2::getThrottleTrim(float /*rpm*/, percent_t /*targetPosit } expected EtbController::getOpenLoop(percent_t target) { - float ff = 0; + etbFeedForward = 0; // Don't apply open loop for wastegate/idle valve, only real ETB if (m_function != ETB_Wastegate && m_function != ETB_IdleValve) { - ff = interpolate2d(target, config->etbBiasBins, config->etbBiasValues); + etbFeedForward = interpolate2d(target, config->etbBiasBins, config->etbBiasValues); } - engine->engineState.etbFeedForward = ff; - - return ff; + return etbFeedForward; } expected EtbController::getClosedLoopAutotune(percent_t target, percent_t actualThrottlePosition) { diff --git a/firmware/controllers/actuators/electronic_throttle_generated.h b/firmware/controllers/actuators/electronic_throttle_generated.h index 65be43b2e6..6ffbc87ef8 100644 --- a/firmware/controllers/actuators/electronic_throttle_generated.h +++ b/firmware/controllers/actuators/electronic_throttle_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/electronic_throttle.txt Sun Apr 17 20:27:25 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/electronic_throttle.txt Wed Jun 29 03:21:08 EDT 2022 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -17,8 +17,21 @@ struct electronic_throttle_s { * offset 8 */ float luaAdjustment = (float)0; + /** + * offset 12 + */ + percent_t etbFeedForward = (percent_t)0; + /** + * offset 16 + */ + float etbIntegralError = (float)0; + /** + % + * offset 20 + */ + float etbCurrentTarget = (float)0; }; -static_assert(sizeof(electronic_throttle_s) == 12); +static_assert(sizeof(electronic_throttle_s) == 24); // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/electronic_throttle.txt Sun Apr 17 20:27:25 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/actuators/electronic_throttle.txt Wed Jun 29 03:21:08 EDT 2022 diff --git a/firmware/controllers/algo/engine_state_generated.h b/firmware/controllers/algo/engine_state_generated.h index 40c88102f5..b8cbb530d9 100644 --- a/firmware/controllers/algo/engine_state_generated.h +++ b/firmware/controllers/algo/engine_state_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jun 29 06:20:31 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jun 29 03:21:08 EDT 2022 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -246,146 +246,141 @@ struct engine_state_s { * offset 80 */ running_fuel_s running; - /** - * offset 108 - */ - percent_t etbFeedForward = (percent_t)0; - /** - * offset 112 - */ - percent_t targetFromTable = (percent_t)0; /** * ignition dwell duration in ms * See also dwellAngle - * offset 116 + * offset 108 */ floatms_t sparkDwell = (floatms_t)0; /** * ignition dwell duration as crankshaft angle * NAN if engine is stopped * See also sparkDwell - * offset 120 + * offset 112 */ angle_t dwellAngle = (angle_t)0; /** deg - * offset 124 + * offset 116 */ scaled_channel cltTimingCorrection = (int16_t)0; /** deg - * offset 126 + * offset 118 */ scaled_channel timingIatCorrection = (int16_t)0; /** deg - * offset 128 + * offset 120 */ scaled_channel timingPidCorrection = (int16_t)0; /** * How does this board self identifies id - * offset 130 + * offset 122 */ int16_t hellenBoardId = (int16_t)0; /** - offset 132 bit 0 */ + * @@INDICATOR_NAME_CLUTCH_UP@@ + offset 124 bit 0 */ + bool clutchUpState : 1 {}; + /** + * @@INDICATOR_NAME_CLUTCH_DOWN@@ + offset 124 bit 1 */ bool clutchDownState : 1 {}; /** - offset 132 bit 1 */ - bool unusedBit_21_1 : 1 {}; + * @@INDICATOR_NAME_BRAKE_DOWN@@ + offset 124 bit 2 */ + bool brakePedalState : 1 {}; /** - offset 132 bit 2 */ - bool unusedBit_21_2 : 1 {}; - /** - offset 132 bit 3 */ + offset 124 bit 3 */ bool unusedBit_21_3 : 1 {}; /** - offset 132 bit 4 */ + offset 124 bit 4 */ bool unusedBit_21_4 : 1 {}; /** - offset 132 bit 5 */ + offset 124 bit 5 */ bool unusedBit_21_5 : 1 {}; /** - offset 132 bit 6 */ + offset 124 bit 6 */ bool unusedBit_21_6 : 1 {}; /** - offset 132 bit 7 */ + offset 124 bit 7 */ bool unusedBit_21_7 : 1 {}; /** - offset 132 bit 8 */ + offset 124 bit 8 */ bool unusedBit_21_8 : 1 {}; /** - offset 132 bit 9 */ + offset 124 bit 9 */ bool unusedBit_21_9 : 1 {}; /** - offset 132 bit 10 */ + offset 124 bit 10 */ bool unusedBit_21_10 : 1 {}; /** - offset 132 bit 11 */ + offset 124 bit 11 */ bool unusedBit_21_11 : 1 {}; /** - offset 132 bit 12 */ + offset 124 bit 12 */ bool unusedBit_21_12 : 1 {}; /** - offset 132 bit 13 */ + offset 124 bit 13 */ bool unusedBit_21_13 : 1 {}; /** - offset 132 bit 14 */ + offset 124 bit 14 */ bool unusedBit_21_14 : 1 {}; /** - offset 132 bit 15 */ + offset 124 bit 15 */ bool unusedBit_21_15 : 1 {}; /** - offset 132 bit 16 */ + offset 124 bit 16 */ bool unusedBit_21_16 : 1 {}; /** - offset 132 bit 17 */ + offset 124 bit 17 */ bool unusedBit_21_17 : 1 {}; /** - offset 132 bit 18 */ + offset 124 bit 18 */ bool unusedBit_21_18 : 1 {}; /** - offset 132 bit 19 */ + offset 124 bit 19 */ bool unusedBit_21_19 : 1 {}; /** - offset 132 bit 20 */ + offset 124 bit 20 */ bool unusedBit_21_20 : 1 {}; /** - offset 132 bit 21 */ + offset 124 bit 21 */ bool unusedBit_21_21 : 1 {}; /** - offset 132 bit 22 */ + offset 124 bit 22 */ bool unusedBit_21_22 : 1 {}; /** - offset 132 bit 23 */ + offset 124 bit 23 */ bool unusedBit_21_23 : 1 {}; /** - offset 132 bit 24 */ + offset 124 bit 24 */ bool unusedBit_21_24 : 1 {}; /** - offset 132 bit 25 */ + offset 124 bit 25 */ bool unusedBit_21_25 : 1 {}; /** - offset 132 bit 26 */ + offset 124 bit 26 */ bool unusedBit_21_26 : 1 {}; /** - offset 132 bit 27 */ + offset 124 bit 27 */ bool unusedBit_21_27 : 1 {}; /** - offset 132 bit 28 */ + offset 124 bit 28 */ bool unusedBit_21_28 : 1 {}; /** - offset 132 bit 29 */ + offset 124 bit 29 */ bool unusedBit_21_29 : 1 {}; /** - offset 132 bit 30 */ + offset 124 bit 30 */ bool unusedBit_21_30 : 1 {}; /** - offset 132 bit 31 */ + offset 124 bit 31 */ bool unusedBit_21_31 : 1 {}; }; -static_assert(sizeof(engine_state_s) == 136); +static_assert(sizeof(engine_state_s) == 128); // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jun 29 06:20:31 UTC 2022 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/engine_state.txt Wed Jun 29 03:21:08 EDT 2022