From 6ff42cc031d58bc2132a62a860f75a547b4b838f Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 26 Nov 2021 20:46:30 -0500 Subject: [PATCH] automation around outputs section #197 --- firmware/console/binary/output_channels.txt | 7 +++++++ firmware/console/binary/ts_outputs_generated.h | 18 +++++++++++++++--- firmware/console/binary/tunerstudio_outputs.h | 6 ------ .../actuators/electronic_throttle.cpp | 12 ++++++------ firmware/controllers/bench_test.cpp | 2 +- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index be24562a59..bfeb2fa82c 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -140,4 +140,11 @@ uint16_t rpmAcceleration;;"",1, 0, 0, 0, 0 ! The ECU simply has to sequentially set a mode/value, wait briefly, then repeat until all the values ! it wants to send have been sent. float autoscale calibrationValue;;"", 1, 0, 0, 0, 0 + uint8_t autoscale calibrationMode;;"", 1, 0, 0, 0, 0 + uint8_t autoscale padding;;"", 1, 0, 0, 0, 0 + + ! Values used for load axes for fuel/ign tables + ! These may or may not be the same value, depending on mode + uint16_t autoscale fuelingLoad;;"",{1/100}, 0, 0, 0, 0 + end_struct diff --git a/firmware/console/binary/ts_outputs_generated.h b/firmware/console/binary/ts_outputs_generated.h index 3b6a76da10..6e66d55e7c 100644 --- a/firmware/console/binary/ts_outputs_generated.h +++ b/firmware/console/binary/ts_outputs_generated.h @@ -1,4 +1,4 @@ -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Fri Nov 26 18:55:26 EST 2021 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Fri Nov 26 19:33:53 EST 2021 // by class com.rusefi.output.CHeaderConsumer // begin #pragma once @@ -350,8 +350,20 @@ struct ts_outputs_s { * offset 128 */ scaled_channel calibrationValue = (float)0; - /** total size 132*/ + /** + * offset 132 + */ + scaled_channel calibrationMode = (uint8_t)0; + /** + * offset 133 + */ + scaled_channel padding = (uint8_t)0; + /** + * offset 134 + */ + scaled_channel fuelingLoad = (uint16_t)0; + /** total size 136*/ }; // end -// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Fri Nov 26 18:55:26 EST 2021 +// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) console/binary/output_channels.txt Fri Nov 26 19:33:53 EST 2021 diff --git a/firmware/console/binary/tunerstudio_outputs.h b/firmware/console/binary/tunerstudio_outputs.h index ce2bdf6d55..916eb5659a 100644 --- a/firmware/console/binary/tunerstudio_outputs.h +++ b/firmware/console/binary/tunerstudio_outputs.h @@ -44,12 +44,6 @@ enum class TsCalMode : uint8_t { struct TunerStudioOutputChannels : ts_outputs_s { /* see also [OutputChannels] in rusefi.input */ - TsCalMode calibrationMode; // 132 - uint8_t padding[1]; // 133 - - // Values used for load axes for fuel/ign tables - // These may or may not be the same value, depending on mode - scaled_channel fuelingLoad; // 134 scaled_channel ignitionLoad; // 136 // we want a hash of engineMake+engineCode+vehicleName in the log file in order to match TS logs to rusEFI Online tune diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 0b01c2b2c6..da192a070e 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -414,7 +414,7 @@ expected EtbController::getClosedLoopAutotune(percent_t target, perce m_autotuneCounter++; // Multiplex 3 signals on to the {mode, value} format - tsOutputChannels.calibrationMode = static_cast(m_autotuneCurrentParam + 3); + tsOutputChannels.calibrationMode = (uint8_t)static_cast(m_autotuneCurrentParam + 3); switch (m_autotuneCurrentParam) { case 0: @@ -635,21 +635,21 @@ struct EtbImpl final : public EtbController { } // Write out the learned values to TS, waiting briefly after setting each to let TS grab it - tsOutputChannels.calibrationMode = functionToCalModePriMax(myFunction); + tsOutputChannels.calibrationMode = (uint8_t)functionToCalModePriMax(myFunction); tsOutputChannels.calibrationValue = primaryMax * TPS_TS_CONVERSION; chThdSleepMilliseconds(500); - tsOutputChannels.calibrationMode = functionToCalModePriMin(myFunction); + tsOutputChannels.calibrationMode = (uint8_t)functionToCalModePriMin(myFunction); tsOutputChannels.calibrationValue = primaryMin * TPS_TS_CONVERSION; chThdSleepMilliseconds(500); - tsOutputChannels.calibrationMode = functionToCalModeSecMax(myFunction); + tsOutputChannels.calibrationMode = (uint8_t)functionToCalModeSecMax(myFunction); tsOutputChannels.calibrationValue = secondaryMax * TPS_TS_CONVERSION; chThdSleepMilliseconds(500); - tsOutputChannels.calibrationMode = functionToCalModeSecMin(myFunction); + tsOutputChannels.calibrationMode = (uint8_t)functionToCalModeSecMin(myFunction); tsOutputChannels.calibrationValue = secondaryMin * TPS_TS_CONVERSION; chThdSleepMilliseconds(500); - tsOutputChannels.calibrationMode = TsCalMode::None; + tsOutputChannels.calibrationMode = (uint8_t)TsCalMode::None; m_isAutocal = false; return; diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 5859c8d169..825a4b9744 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -379,7 +379,7 @@ static void handleCommandX14(uint16_t index) { case 0x10: engine->etbAutoTune = false; #if EFI_TUNER_STUDIO - tsOutputChannels.calibrationMode = TsCalMode::None; + tsOutputChannels.calibrationMode = (uint8_t)TsCalMode::None; #endif // EFI_TUNER_STUDIO return; #endif