Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
5176e8ad50
|
@ -89,10 +89,16 @@ jobs:
|
|||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install multilib, mingw, ncftp and mtools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 ncftp mtools
|
||||
|
||||
- name: Generate Configs
|
||||
if: ${{ matrix.skip-config != 'yes' }}
|
||||
working-directory: ./firmware/
|
||||
|
@ -137,12 +143,6 @@ jobs:
|
|||
- name: Test Compiler
|
||||
run: arm-none-eabi-gcc -v
|
||||
|
||||
- name: Install multilib, mingw, and ncftp
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 ncftp
|
||||
|
||||
|
||||
- name: Configs Set FTP variables
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||
|
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
|
||||
- name: Install Tools
|
||||
run: sudo apt-get install ncftp sshpass
|
||||
run: sudo apt-get install ncftp sshpass mtools
|
||||
|
||||
- name: Generate Enum Strings
|
||||
working-directory: ./firmware/
|
||||
|
|
|
@ -202,6 +202,7 @@ $(info LDSCRIPT: $(LDSCRIPT))
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(CHIBIOS)/os/various/syscalls.c \
|
||||
$(CHIBIOS_CONTRIB)/os/various/ramdisk.c \
|
||||
$(TRIGGER_SRC) \
|
||||
$(TRIGGER_DECODERS_SRC) \
|
||||
$(DEV_SRC) \
|
||||
|
|
|
@ -10,7 +10,7 @@ mkdir deliver
|
|||
#echo "TIMESTAMP $(date "+%D %T.%2N")"
|
||||
|
||||
#EXTRA_PARAMS="-DDUMMY -DFIRMWARE_ID=\\\"default_no_assert\\\" -DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE"
|
||||
#make -j4 DEBUG_LEVEL_OPT='-O2'
|
||||
#make -j$(nproc) DEBUG_LEVEL_OPT='-O2'
|
||||
#EXTRA_PARAMS=""
|
||||
|
||||
# mv build/rusefi.elf deliver/rusefi_no_asserts.elf
|
||||
|
@ -25,7 +25,7 @@ mkdir deliver
|
|||
bash clean.sh
|
||||
echo "TIMESTAMP $(date "+%D %T.%2N")"
|
||||
EXTRA_PARAMS="-DDUMMY -DFIRMWARE_ID=\\\"default\\\""
|
||||
make -j4
|
||||
make -j$(nproc)
|
||||
EXTRA_PARAMS=""
|
||||
|
||||
mv build/rusefi.elf deliver/rusefi.elf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:21 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:51 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:21 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:51 UTC 2021
|
||||
|
|
|
@ -1242,7 +1242,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD hellen_cypress
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1039053165
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1577,7 +1577,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.hellen_cypress.1039053165"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.hellen_cypress.1039053165"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:19 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:49 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3859,4 +3859,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:19 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:49 UTC 2021
|
||||
|
|
|
@ -1226,7 +1226,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD kin
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 3259727249
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1561,7 +1561,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator true
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.kin.3259727249"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.kin.3259727249"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:22 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:52 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:22 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:52 UTC 2021
|
||||
|
|
|
@ -1242,7 +1242,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD subaru_eg33_f7
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 3175160971
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1577,7 +1577,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port false
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.subaru_eg33_f7.3175160971"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.subaru_eg33_f7.3175160971"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -253,6 +253,10 @@
|
|||
#define EFI_FILE_LOGGING TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_EMBED_INI_MSD
|
||||
#define EFI_EMBED_INI_MSD TRUE
|
||||
#endif
|
||||
|
||||
#ifndef EFI_USB_SERIAL
|
||||
#define EFI_USB_SERIAL TRUE
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#undef EFI_MAP_AVERAGING
|
||||
#define EFI_MAP_AVERAGING FALSE
|
||||
|
||||
#undef EFI_USE_FAST_ADC
|
||||
#define EFI_USE_FAST_ADC FALSE
|
||||
|
||||
|
|
|
@ -236,6 +236,11 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
slowCallBackWasInvoked = true;
|
||||
|
||||
#if HW_PROTEUS
|
||||
void baroUpdate();
|
||||
baroUpdate();
|
||||
#endif
|
||||
|
||||
#if ANALOG_HW_CHECK_MODE
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, isAdcChannelValid(CONFIG(clt).adcChannel), "No CLT setting");
|
||||
efitimesec_t secondsNow = getTimeNowSeconds();
|
||||
|
|
|
@ -237,6 +237,9 @@ public:
|
|||
*/
|
||||
floatms_t injectionDuration = 0;
|
||||
|
||||
// Per-injection fuel mass, including TPS accel enrich
|
||||
float injectionMass = 0;
|
||||
|
||||
/**
|
||||
* This one with wall wetting accounted for, used for logging.
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "closed_loop_fuel.h"
|
||||
#include "sensor.h"
|
||||
#include "launch_control.h"
|
||||
#include "injector_model.h"
|
||||
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
@ -170,7 +171,11 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
auto tps = Sensor::get(SensorType::Tps1);
|
||||
updateTChargeK(rpm, tps.value_or(0) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float injectionMass = getInjectionMass(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
ENGINE(injectionMass) = injectionMass;
|
||||
// Store the pre-wall wetting injection duration for scheduling purposes only, not the actual injection duration
|
||||
ENGINE(injectionDuration) = ENGINE(injectorModel)->getInjectionDuration(injectionMass);
|
||||
|
||||
float fuelLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
injectionOffset = getInjectionOffset(rpm, fuelLoad PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
|
|
@ -44,6 +44,8 @@ typedef enum {
|
|||
FO_1_5_4_2_6_3_7_8 = 12,
|
||||
FO_1_2_7_8_4_5_6_3 = 19,
|
||||
FO_1_3_7_2_6_5_4_8 = 20, // Ford 5.0 HO and 351W
|
||||
FO_1_2_3_4_5_6_7_8 = 25, // linearly incrementing, for V8 testing
|
||||
FO_1_5_4_8_6_3_7_2 = 26, // Audi 4.2 40v V8
|
||||
|
||||
// 9 cylinder - for instance radial :)
|
||||
// PS: Matt says that 9cyl is actually 1-3-5-7-9-2-4-6-8 or 1-8-6-4-2-9-7-5-3 for reverse rotation
|
||||
|
@ -63,7 +65,7 @@ typedef enum {
|
|||
// unfortunately not supported by default firmware because INJECTION_PIN_COUNT=IGNITION_PIN_COUNT=12 by default
|
||||
FO_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10 = 22, // WR16
|
||||
|
||||
// max used = 24
|
||||
// max used = 26
|
||||
|
||||
Force_4b_firing_order = ENUM_32_BITS,
|
||||
} firing_order_e;
|
||||
|
|
|
@ -100,3 +100,8 @@ float InjectorModelBase::getInjectionDuration(float fuelMassGram) const {
|
|||
return baseDuration + m_deadtime;
|
||||
}
|
||||
}
|
||||
|
||||
float InjectorModelBase::getFuelMassForDuration(floatms_t duration) const {
|
||||
// Convert from ms -> grams
|
||||
return duration * m_massFlowRate * 0.001f;
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
struct IInjectorModel {
|
||||
virtual void prepare() = 0;
|
||||
virtual floatms_t getInjectionDuration(float fuelMassGram) const = 0;
|
||||
virtual float getFuelMassForDuration(floatms_t duration) const = 0;
|
||||
};
|
||||
|
||||
class InjectorModelBase : public IInjectorModel {
|
||||
public:
|
||||
void prepare() override;
|
||||
floatms_t getInjectionDuration(float fuelMassGram) const override;
|
||||
float getFuelMassForDuration(floatms_t duration) const override;
|
||||
|
||||
virtual floatms_t getDeadtime() const = 0;
|
||||
virtual float getInjectorMassFlowRate() const = 0;
|
||||
|
|
|
@ -300,7 +300,7 @@ static float getCycleFuelMass(bool isCranking, float baseFuelMass DECLARE_ENGINE
|
|||
* @returns Length of each individual fuel injection, in milliseconds
|
||||
* in case of single point injection mode the amount of fuel into all cylinders, otherwise the amount for one cylinder
|
||||
*/
|
||||
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
floatms_t getInjectionMass(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
ScopePerf perf(PE::GetInjectionDuration);
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
|
@ -317,16 +317,19 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
float durationMultiplier = getInjectionModeDurationMultiplier(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
float injectionFuelMass = cycleFuelMass * durationMultiplier;
|
||||
|
||||
// Prepare injector flow rate & deadtime
|
||||
ENGINE(injectorModel)->prepare();
|
||||
|
||||
// TODO: move everything below here to injector scheduling, so that wall wetting works properly
|
||||
floatms_t injectionDuration = ENGINE(injectorModel)->getInjectionDuration(injectionFuelMass);
|
||||
|
||||
floatms_t tpsAccelEnrich = ENGINE(tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(tpsAccelEnrich), "NaN tpsAccelEnrich", 0);
|
||||
ENGINE(engineState.tpsAccelEnrich) = tpsAccelEnrich;
|
||||
|
||||
return injectionDuration + (durationMultiplier * tpsAccelEnrich);
|
||||
// For legacy reasons, the TPS accel table is in units of milliseconds, so we have to convert BACK to mass
|
||||
float tpsAccelPerInjection = durationMultiplier * tpsAccelEnrich;
|
||||
|
||||
float tpsFuelMass = ENGINE(injectorModel)->getFuelMassForDuration(tpsAccelPerInjection);
|
||||
|
||||
return injectionFuelMass + tpsFuelMass;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_
|
|||
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
float getCrankingFuel(float baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getInjectionMass(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
float getStandardAirCharge(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#pragma once
|
||||
#define VCS_DATE 20210303
|
||||
#define VCS_DATE 20210305
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "engine.h"
|
||||
#include "perf_trace.h"
|
||||
#include "sensor.h"
|
||||
#include "injector_model.h"
|
||||
#if EFI_LAUNCH_CONTROL
|
||||
#include "launch_control.h"
|
||||
#endif
|
||||
|
@ -203,13 +204,11 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* todo: this is a bit tricky with batched injection. is it? Does the same
|
||||
* wetting coefficient works the same way for any injection mode, or is something
|
||||
* x2 or /2?
|
||||
*/
|
||||
// Perform wall wetting adjustment on fuel mass, not duration, so that
|
||||
// it's correct during fuel pressure (injector flow) or battery voltage (deadtime) transients
|
||||
const float injectionMass = wallFuel.adjust(ENGINE(injectionMass) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
const floatms_t injectionDuration = ENGINE(injectorModel)->getInjectionDuration(injectionMass);
|
||||
|
||||
const floatms_t injectionDuration = wallFuel.adjust(ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#if EFI_PRINTF_FUEL_DETAILS
|
||||
if (printFuelDebug) {
|
||||
printf("fuel index=%d injectionDuration=%.2fms adjusted=%.2fms\n",
|
||||
|
@ -320,6 +319,12 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm,
|
|||
efiAssertVoid(CUSTOM_STACK_6627, getCurrentRemainingStack() > 128, "lowstck#3");
|
||||
efiAssertVoid(CUSTOM_ERR_6628, trgEventIndex < engine->engineCycleEventCount, "handleFuel/event index");
|
||||
|
||||
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::get(SensorType::Tps1).value_or(0) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
if (trgEventIndex == 0) {
|
||||
ENGINE(tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
}
|
||||
|
||||
if (limitedFuel) {
|
||||
return;
|
||||
}
|
||||
|
@ -348,12 +353,6 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm,
|
|||
}
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::get(SensorType::Tps1).value_or(0) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
if (trgEventIndex == 0) {
|
||||
ENGINE(tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
}
|
||||
|
||||
fs->onTriggerTooth(trgEventIndex, rpm, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
|
@ -542,7 +541,7 @@ static void showMainInfo(Engine *engine) {
|
|||
int rpm = GET_RPM();
|
||||
float el = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el);
|
||||
scheduleMsg(logger, "fuel %.2fms timing %.2f", getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX), engine->engineState.timingAdvance);
|
||||
scheduleMsg(logger, "fuel %.2fms timing %.2f", ENGINE(injectionDuration), engine->engineState.timingAdvance);
|
||||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
FSIO_SETTING_FANONTEMPERATURE = 1000,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
case FSIO_SETTING_FANONTEMPERATURE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
static LENameOrdinalPair lefanOnTemperature(FSIO_SETTING_FANONTEMPERATURE, "cfg_fanOnTemperature");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
case FSIO_SETTING_FANONTEMPERATURE:
|
||||
|
|
|
@ -1239,7 +1239,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD all
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 2140302013
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1574,7 +1574,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.all.2140302013"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.all.2140302013"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD all
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 2140302013
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.all.2140302013"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.all.2140302013"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD frankenso_na6
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 4226303790
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.frankenso_na6.4226303790"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.frankenso_na6.4226303790"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD hellen72
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 96926268
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.hellen72.96926268"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.hellen72.96926268"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD hellen_cypress
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1039053165
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.hellen_cypress.1039053165"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.hellen_cypress.1039053165"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD kin
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 3259727249
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.kin.3259727249"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.kin.3259727249"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD mre_f4
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1364465751
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.mre_f4.1364465751"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.mre_f4.1364465751"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD mre_f7
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1364465751
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.mre_f7.1364465751"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.mre_f7.1364465751"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD prometheus_405
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1829005451
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.prometheus_405.1829005451"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.prometheus_405.1829005451"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD prometheus_469
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 1829005451
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.prometheus_469.1829005451"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.prometheus_469.1829005451"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD proteus_f4
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 413377170
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.proteus_f4.413377170"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.proteus_f4.413377170"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD proteus_f7
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 413377170
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.proteus_f7.413377170"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.proteus_f7.413377170"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD subaru_eg33_f7
|
||||
#define SIGNATURE_DATE 2021.03.01
|
||||
#define SIGNATURE_DATE 2021.03.05
|
||||
#define SIGNATURE_HASH 3175160971
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.01.subaru_eg33_f7.3175160971"
|
||||
#define TS_SIGNATURE "rusEFI 2021.03.05.subaru_eg33_f7.3175160971"
|
||||
|
|
|
@ -158,6 +158,8 @@ static const int order_1_8_7_2_6_5_4_3[] = { 1, 8, 7, 2, 6, 5, 4, 3 };
|
|||
static const int order_1_5_4_2_6_3_7_8[] = { 1, 5, 4, 2, 6, 3, 7, 8 };
|
||||
static const int order_1_2_7_8_4_5_6_3[] = { 1, 2, 7, 8, 4, 5, 6, 3 };
|
||||
static const int order_1_3_7_2_6_5_4_8[] = { 1, 3, 7, 2, 6, 5, 4, 8 };
|
||||
static const int order_1_2_3_4_5_6_7_8[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
static const int order_1_5_4_8_6_3_7_2[] = { 1, 5, 4, 8, 6, 3, 7, 2 };
|
||||
|
||||
// 9 cylinder
|
||||
static const int order_1_2_3_4_5_6_7_8_9[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
|
@ -209,6 +211,8 @@ static int getFiringOrderLength(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
case FO_1_5_4_2_6_3_7_8:
|
||||
case FO_1_2_7_8_4_5_6_3:
|
||||
case FO_1_3_7_2_6_5_4_8:
|
||||
case FO_1_2_3_4_5_6_7_8:
|
||||
case FO_1_5_4_8_6_3_7_2:
|
||||
return 8;
|
||||
|
||||
// 9 cylinder radial
|
||||
|
@ -305,7 +309,12 @@ int getCylinderId(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
return order_1_2_7_8_4_5_6_3[index];
|
||||
case FO_1_3_7_2_6_5_4_8:
|
||||
return order_1_3_7_2_6_5_4_8[index];
|
||||
case FO_1_2_3_4_5_6_7_8:
|
||||
return order_1_2_3_4_5_6_7_8[index];
|
||||
case FO_1_5_4_8_6_3_7_2:
|
||||
return order_1_5_4_8_6_3_7_2[index];
|
||||
|
||||
// 9 cylinder
|
||||
case FO_1_2_3_4_5_6_7_8_9:
|
||||
return order_1_2_3_4_5_6_7_8_9[index];
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "Lps25Sensor.h"
|
||||
#include "global.h"
|
||||
|
||||
Lps25Sensor::Lps25Sensor(Lps25& sensor)
|
||||
: StoredValueSensor(SensorType::BarometricPressure, MS2NT(1000))
|
||||
, m_sensor(&sensor)
|
||||
{
|
||||
}
|
||||
|
||||
void Lps25Sensor::update() {
|
||||
auto result = m_sensor->readPressureKpa();
|
||||
|
||||
if (result) {
|
||||
setValidValue(result.Value, getTimeNowNt());
|
||||
} else {
|
||||
invalidate();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "stored_value_sensor.h"
|
||||
#include "lps25.h"
|
||||
|
||||
class Lps25Sensor : public StoredValueSensor {
|
||||
public:
|
||||
explicit Lps25Sensor(Lps25& sensor);
|
||||
void update();
|
||||
|
||||
void showInfo(Logging* logger, const char* sensorName) const override;
|
||||
|
||||
private:
|
||||
Lps25* m_sensor;
|
||||
};
|
|
@ -3,6 +3,7 @@
|
|||
#include "functional_sensor.h"
|
||||
#include "redundant_sensor.h"
|
||||
#include "rpm_calculator.h"
|
||||
#include "Lps25Sensor.h"
|
||||
#include "linear_func.h"
|
||||
#include "resistance_func.h"
|
||||
#include "thermistor_func.h"
|
||||
|
@ -46,6 +47,10 @@ void RpmCalculator::showInfo(Logging* logger, const char* /*sensorName*/) const
|
|||
);
|
||||
}
|
||||
|
||||
void Lps25Sensor::showInfo(Logging* logger, const char* sensorName) const {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void LinearFunc::showInfo(Logging* logger, float testRawValue) const {
|
||||
scheduleMsg(logger, " Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput);
|
||||
const auto [valid, value] = convert(testRawValue);
|
||||
|
|
|
@ -16,6 +16,7 @@ CONTROLLERS_SENSORS_SRC_CPP = $(PROJECT_DIR)/controllers/sensors/thermistors.cp
|
|||
$(PROJECT_DIR)/controllers/sensors/AemXSeriesLambda.cpp \
|
||||
$(PROJECT_DIR)/cotnrollers/sensors/flex_sensor.cpp \
|
||||
$(PROJECT_DIR)/controllers/sensors/software_knock.cpp \
|
||||
$(PROJECT_DIR)/controllers/sensors/Lps25Sensor.cpp \
|
||||
$(PROJECT_DIR)/controllers/sensors/converters/linear_func.cpp \
|
||||
$(PROJECT_DIR)/controllers/sensors/converters/resistance_func.cpp \
|
||||
$(PROJECT_DIR)/controllers/sensors/converters/thermistor_func.cpp
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# file gen_config_board.sh
|
||||
|
||||
#set -x
|
||||
set -e
|
||||
|
||||
echo "This script reads rusefi_config.txt and produces firmware persistent configuration headers"
|
||||
echo "the storage section of rusefiXXX.ini is updated as well"
|
||||
|
@ -38,4 +38,6 @@ java -DSystemOut.name=gen_config_board \
|
|||
|
||||
[ $? -eq 0 ] || { echo "ERROR generating TunerStudio config for ${BOARDNAME}"; exit 1; }
|
||||
|
||||
./hw_layer/mass_storage/create_ini_image.sh ./tunerstudio/generated/rusefi_${SHORT_BOARDNAME}.ini ./hw_layer/mass_storage/ramdisk_image.h
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "perf_trace.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
static NO_CACHE adcsample_t slowAdcSampleBuf[ADC_BUF_DEPTH_SLOW * ADC_MAX_CHANNELS_COUNT];
|
||||
static adcsample_t slowAdcSamples[ADC_MAX_CHANNELS_COUNT];
|
||||
static NO_CACHE adcsample_t fastAdcSampleBuf[ADC_BUF_DEPTH_FAST * ADC_MAX_CHANNELS_COUNT];
|
||||
|
||||
static adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
|
||||
|
@ -55,6 +55,7 @@ float getVoltage(const char *msg, adc_channel_e hwChannel DECLARE_ENGINE_PARAMET
|
|||
return adcToVolts(getAdcValue(msg, hwChannel));
|
||||
}
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
AdcDevice::AdcDevice(ADCConversionGroup* hwConfig, adcsample_t *buf, size_t buf_len) {
|
||||
this->hwConfig = hwConfig;
|
||||
this->samples = buf;
|
||||
|
@ -82,17 +83,14 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig, adcsample_t *buf, size_t buf_
|
|||
#define GPT_PERIOD_FAST 10 /* PWM period (in PWM ticks). */
|
||||
#endif /* GPT_FREQ_FAST GPT_PERIOD_FAST */
|
||||
|
||||
// is there a reason to have this configurable at runtime?
|
||||
#ifndef ADC_SLOW_DEVICE
|
||||
#define ADC_SLOW_DEVICE ADCD1
|
||||
#endif /* ADC_SLOW_DEVICE */
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
// is there a reason to have this configurable at runtime?
|
||||
#ifndef ADC_FAST_DEVICE
|
||||
#define ADC_FAST_DEVICE ADCD2
|
||||
#endif /* ADC_FAST_DEVICE */
|
||||
|
||||
static volatile int slowAdcCounter = 0;
|
||||
static uint32_t slowAdcCounter = 0;
|
||||
static LoggingWithStorage logger("ADC");
|
||||
|
||||
// todo: move this flag to Engine god object
|
||||
|
@ -115,57 +113,6 @@ static adcsample_t getAvgAdcValue(int index, adcsample_t *samples, int bufDepth,
|
|||
// See https://github.com/rusefi/rusefi/issues/976 for discussion on these values
|
||||
#define ADC_SAMPLING_SLOW ADC_SAMPLE_56
|
||||
#define ADC_SAMPLING_FAST ADC_SAMPLE_28
|
||||
/*
|
||||
* ADC conversion group.
|
||||
*/
|
||||
static ADCConversionGroup adcgrpcfgSlow = {
|
||||
.circular = FALSE,
|
||||
.num_channels = 0,
|
||||
.end_cb = nullptr,
|
||||
.error_cb = nullptr,
|
||||
/* HW dependent part.*/
|
||||
.cr1 = 0,
|
||||
.cr2 = ADC_CR2_SWSTART,
|
||||
/**
|
||||
* here we configure all possible channels for slow mode. Some channels would not actually
|
||||
* be used hopefully that's fine to configure all possible channels.
|
||||
*/
|
||||
// sample times for channels 10...18
|
||||
.smpr1 =
|
||||
ADC_SMPR1_SMP_AN10(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN11(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN12(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN13(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN14(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN15(ADC_SAMPLING_SLOW) |
|
||||
#if defined(STM32F7XX)
|
||||
ADC_SMPR1_SMP_VBAT(ADC_SAMPLE_144) | /* input18 - temperature and vbat input on some STM32F7xx */
|
||||
#endif
|
||||
ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144), /* input16 - temperature sensor input on STM32F4xx */
|
||||
// In this field must be specified the sample times for channels 0...9
|
||||
.smpr2 =
|
||||
ADC_SMPR2_SMP_AN0(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN1(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN2(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN3(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN4(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN5(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN6(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN7(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN8(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN9(ADC_SAMPLING_SLOW),
|
||||
.htr = 0,
|
||||
.ltr = 0,
|
||||
.sqr1 = 0, // Conversion group sequence 13...16 + sequence length
|
||||
.sqr2 = 0, // Conversion group sequence 7...12
|
||||
.sqr3 = 0, // Conversion group sequence 1...6
|
||||
#if ADC_MAX_CHANNELS_COUNT > 16
|
||||
.sqr4 = 0, // Conversion group sequence 19...24
|
||||
.sqr5 = 0 // Conversion group sequence 25...30
|
||||
#endif /* ADC_MAX_CHANNELS_COUNT */
|
||||
};
|
||||
|
||||
AdcDevice slowAdc(&adcgrpcfgSlow, slowAdcSampleBuf, ARRAY_SIZE(slowAdcSampleBuf));
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
void adc_callback_fast(ADCDriver *adcp);
|
||||
|
@ -271,11 +218,11 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
|
|||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
if (adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
|
||||
// todo: make this not happen during hardware continuous integration
|
||||
// todo: make this not happen during hardware continuous integration
|
||||
warning(CUSTOM_OBD_WRONG_ADC_MODE, "ADC is off [%s] index=%d", msg, hwChannel);
|
||||
}
|
||||
|
||||
return slowAdc.getAdcValueByHwChannel(hwChannel);
|
||||
return slowAdcSamples[hwChannel - 1];
|
||||
}
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
|
@ -287,19 +234,17 @@ static GPTConfig fast_adc_config = {
|
|||
#endif /* EFI_USE_FAST_ADC */
|
||||
|
||||
adc_channel_mode_e getAdcMode(adc_channel_e hwChannel) {
|
||||
if (slowAdc.isHwUsed(hwChannel)) {
|
||||
return ADC_SLOW;
|
||||
}
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (fastAdc.isHwUsed(hwChannel)) {
|
||||
return ADC_FAST;
|
||||
}
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
return ADC_OFF;
|
||||
return ADC_SLOW;
|
||||
}
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
|
||||
int AdcDevice::size() const {
|
||||
return channelCount;
|
||||
}
|
||||
|
@ -364,19 +309,24 @@ void AdcDevice::enableChannelAndPin(const char *msg, adc_channel_e hwChannel) {
|
|||
efiSetPadMode(msg, pin, PAL_MODE_INPUT_ANALOG);
|
||||
}
|
||||
|
||||
adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) const {
|
||||
return hardwareIndexByIndernalAdcIndex[index];
|
||||
}
|
||||
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
static void printAdcValue(int channel) {
|
||||
int value = getAdcValue("print", (adc_channel_e)channel);
|
||||
float volts = adcToVoltsDivided(value);
|
||||
scheduleMsg(&logger, "adc voltage : %.2f", volts);
|
||||
}
|
||||
|
||||
adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) const {
|
||||
return hardwareIndexByIndernalAdcIndex[index];
|
||||
}
|
||||
static uint32_t slowAdcConversionCount = 0;
|
||||
static uint32_t slowAdcErrorsCount = 0;
|
||||
|
||||
static void printFullAdcReport(Logging *logger) {
|
||||
#if EFI_USE_FAST_ADC
|
||||
scheduleMsg(logger, "fast %d slow %d", fastAdc.conversionCount, slowAdc.conversionCount);
|
||||
scheduleMsg(logger, "fast %d slow %d", fastAdc.conversionCount, slowAdcConversionCount);
|
||||
|
||||
for (int index = 0; index < fastAdc.size(); index++) {
|
||||
appendMsgPrefix(logger);
|
||||
|
@ -399,16 +349,16 @@ static void printFullAdcReport(Logging *logger) {
|
|||
}
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
for (int index = 0; index < slowAdc.size(); index++) {
|
||||
for (int index = 0; index < ADC_MAX_CHANNELS_COUNT; index++) {
|
||||
appendMsgPrefix(logger);
|
||||
|
||||
adc_channel_e hwIndex = slowAdc.getAdcHardwareIndexByInternalIndex(index);
|
||||
adc_channel_e hwIndex = static_cast<adc_channel_e>(index + EFI_ADC_0);
|
||||
|
||||
if (isAdcChannelValid(hwIndex)) {
|
||||
ioportid_t port = getAdcChannelPort("print", hwIndex);
|
||||
int pin = getAdcChannelPin(hwIndex);
|
||||
|
||||
int adcValue = slowAdc.getAdcValueByIndex(index);
|
||||
int adcValue = slowAdcSamples[index];
|
||||
logger->appendPrintf(" S ch%d %s%d", index, portname(port), pin);
|
||||
logger->appendPrintf(" ADC%d 12bit=%d", hwIndex, adcValue);
|
||||
float volts = adcToVolts(adcValue);
|
||||
|
@ -426,10 +376,6 @@ static void setAdcDebugReporting(int value) {
|
|||
}
|
||||
|
||||
void waitForSlowAdc(int lastAdcCounter) {
|
||||
// don't halt the firmware if there are no slow channels assigned
|
||||
if (slowAdc.size() < 1)
|
||||
return;
|
||||
|
||||
// we use slowAdcCounter instead of slowAdc.conversionCount because we need ADC_COMPLETE state
|
||||
// todo: use sync.objects?
|
||||
while (slowAdcCounter <= lastAdcCounter) {
|
||||
|
@ -453,12 +399,9 @@ public:
|
|||
{
|
||||
ScopePerf perf(PE::AdcConversionSlow);
|
||||
|
||||
slowAdc.conversionCount++;
|
||||
msg_t result = adcConvert(&ADC_SLOW_DEVICE, &adcgrpcfgSlow, slowAdc.samples, ADC_BUF_DEPTH_SLOW);
|
||||
|
||||
// If something went wrong - try again later
|
||||
if (result == MSG_RESET || result == MSG_TIMEOUT) {
|
||||
slowAdc.errorsCount++;
|
||||
slowAdcConversionCount++;
|
||||
if (!readSlowAnalogInputs(slowAdcSamples)) {
|
||||
slowAdcErrorsCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -474,15 +417,6 @@ public:
|
|||
{
|
||||
ScopePerf perf(PE::AdcProcessSlow);
|
||||
|
||||
/* Calculates the average values from the ADC samples.*/
|
||||
for (int i = 0; i < slowAdc.size(); i++) {
|
||||
adcsample_t value = getAvgAdcValue(i, slowAdc.samples, ADC_BUF_DEPTH_SLOW, slowAdc.size());
|
||||
adcsample_t prev = slowAdc.values.adc_data[i];
|
||||
float result = (slowAdcCounter == 0) ? value :
|
||||
CONFIG(slowAdcAlpha) * value + (1 - CONFIG(slowAdcAlpha)) * prev;
|
||||
|
||||
slowAdc.values.adc_data[i] = (adcsample_t)result;
|
||||
}
|
||||
slowAdcCounter++;
|
||||
|
||||
AdcSubscription::UpdateSubscribers(nowNt);
|
||||
|
@ -501,15 +435,16 @@ void addChannel(const char *name, adc_channel_e setting, adc_channel_mode_e mode
|
|||
|
||||
adcHwChannelEnabled[setting] = mode;
|
||||
|
||||
AdcDevice* dev = &slowAdc;
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (mode == ADC_FAST) {
|
||||
dev = &fastAdc;
|
||||
fastAdc.enableChannelAndPin(name, setting);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
dev->enableChannelAndPin(name, setting);
|
||||
// Slow ADC always samples all channels, simply set the input mode
|
||||
brain_pin_e pin = getAdcChannelBrainPin(name, setting);
|
||||
efiSetPadMode(name, pin, PAL_MODE_INPUT_ANALOG);
|
||||
}
|
||||
|
||||
void removeChannel(const char *name, adc_channel_e setting) {
|
||||
|
@ -533,7 +468,7 @@ static void configureInputs(void) {
|
|||
*/
|
||||
|
||||
addChannel("MAP", engineConfiguration->map.sensor.hwChannel, ADC_FAST);
|
||||
addChannel("MAF", engineConfiguration->mafAdcChannel, ADC_FAST);
|
||||
addChannel("MAF", engineConfiguration->mafAdcChannel, ADC_SLOW);
|
||||
|
||||
addChannel("HIP9011", engineConfiguration->hipOutputChannel, ADC_FAST);
|
||||
|
||||
|
@ -595,8 +530,6 @@ void initAdcInputs() {
|
|||
#if EFI_INTERNAL_ADC
|
||||
portInitAdc();
|
||||
|
||||
slowAdc.init();
|
||||
|
||||
// Start the slow ADC thread
|
||||
slowAdcController.Start();
|
||||
|
||||
|
|
|
@ -8,28 +8,35 @@
|
|||
|
||||
#include "i2c_bb.h"
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
#include "io_pins.h"
|
||||
#include "efi_gpio.h"
|
||||
|
||||
void BitbangI2c::sda_high() {
|
||||
#if EFI_PROD_CODE
|
||||
palSetPad(m_sdaPort, m_sdaPin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BitbangI2c::sda_low() {
|
||||
#if EFI_PROD_CODE
|
||||
palClearPad(m_sdaPort, m_sdaPin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BitbangI2c::scl_high() {
|
||||
#if EFI_PROD_CODE
|
||||
palSetPad(m_sclPort, m_sclPin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BitbangI2c::scl_low() {
|
||||
#if EFI_PROD_CODE
|
||||
palClearPad(m_sclPort, m_sclPin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BitbangI2c::init(brain_pin_e scl, brain_pin_e sda) {
|
||||
#if EFI_PROD_CODE
|
||||
if (m_sdaPort) return;
|
||||
|
||||
efiSetPadMode("i2c", scl, PAL_MODE_OUTPUT_OPENDRAIN); //PAL_STM32_OTYPE_OPENDRAIN
|
||||
|
@ -40,6 +47,7 @@ void BitbangI2c::init(brain_pin_e scl, brain_pin_e sda) {
|
|||
|
||||
m_sdaPort = getHwPort("i2c", sda);
|
||||
m_sdaPin = getHwPin("i2c", sda);
|
||||
#endif
|
||||
|
||||
// Both lines idle high
|
||||
scl_high();
|
||||
|
@ -99,8 +107,12 @@ bool BitbangI2c::readBit() {
|
|||
waitQuarterBit();
|
||||
waitQuarterBit();
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
// Read just before we set the clock low (ie, as late as possible)
|
||||
bool val = palReadPad(m_sdaPort, m_sdaPin);
|
||||
#else
|
||||
bool val = false;
|
||||
#endif
|
||||
|
||||
scl_low();
|
||||
waitQuarterBit();
|
||||
|
@ -209,5 +221,3 @@ void BitbangI2c::writeRegister(uint8_t addr, uint8_t reg, uint8_t val) {
|
|||
|
||||
write(addr, buf, 2);
|
||||
}
|
||||
|
||||
#endif // EFI_PROD_CODE
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#pragma once
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
#include "hal.h"
|
||||
#endif
|
||||
|
||||
#include "rusefi_hw_enums.h"
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
@ -53,10 +54,10 @@ private:
|
|||
// Wait for 1/4 of a bit time
|
||||
void waitQuarterBit();
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
ioportid_t m_sclPort = 0;
|
||||
ioportmask_t m_sclPin = 0;
|
||||
ioportid_t m_sdaPort = 0;
|
||||
ioportmask_t m_sdaPin = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // EFI_PROD_CODE
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ramdisk_image.h
|
|
@ -0,0 +1,4 @@
|
|||
Welcome to rusEFI!
|
||||
|
||||
Unzip rusefi.ini.zip to your PC, and use the extracted
|
||||
ini file with TunerStudio to connect to your ECU.
|
|
@ -1,40 +0,0 @@
|
|||
https://github.com/tegesoft/Chibios-USB-Devices/
|
||||
http://www.chibios.com/forum/viewtopic.php?f=3&t=619
|
||||
|
||||
Mass Storage Device
|
||||
===================
|
||||
|
||||
This driver implements a USB mass storage device. It requires a Chibios block device (e.g mmc_spi or SDC)
|
||||
|
||||
Example usage:
|
||||
--------------
|
||||
```c
|
||||
|
||||
USBMassStorageDriver UMSD1;
|
||||
|
||||
mmcObjectInit(&MMCD1);
|
||||
mmcStart(&MMCD1, &mmccfg);
|
||||
mmcConnect(&MMCD1);
|
||||
|
||||
msdInit(&USBD1, &MMCD1, &UMSD1);
|
||||
```
|
||||
|
||||
Events:
|
||||
--------------
|
||||
```c
|
||||
chEvtRegisterMask(&UMSD1.evt_connected, &listener_connected, 1);
|
||||
chEvtRegisterMask(&UMSD1.evt_ejected, &listener_ejected, 2);
|
||||
|
||||
while(TRUE) {
|
||||
if(chEvtWaitOneTimeout(1, TIME_IMMEDIATE)) {
|
||||
/* drive is now connected */
|
||||
|
||||
/* wait until the drive is ejected */
|
||||
chEvtWaitOne(2);
|
||||
|
||||
/* drive is now ejected. do something */
|
||||
}
|
||||
|
||||
chThdSleepMilliseconds(1000);
|
||||
}
|
||||
```
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# fail on error
|
||||
set -e
|
||||
|
||||
rm -f rusefi.zip ramdisk_image.h
|
||||
|
||||
# copy 100KB of zeroes
|
||||
dd if=/dev/zero of=ramdisk.image bs=1024 count=100
|
||||
|
||||
# create a FAT filesystem inside, name it RUSEFI
|
||||
mkfs.fat ramdisk.image
|
||||
fatlabel ramdisk.image RUSEFI
|
||||
|
||||
# -j option dumps all files in the root of the zip (instead of inside directories)
|
||||
zip -j rusefi.ini.zip $1
|
||||
|
||||
# Put the zip inside the filesystem
|
||||
mcopy -i ramdisk.image rusefi.ini.zip ::
|
||||
# Put a readme text file in there too
|
||||
mcopy -i ramdisk.image hw_layer/mass_storage/README.txt ::
|
||||
|
||||
# write out as a C array, with "static const" tacked on the front
|
||||
xxd -i ramdisk.image \
|
||||
| cat <(echo -n "static const ") - \
|
||||
> $2
|
||||
|
||||
rm ramdisk.image rusefi.ini.zip
|
|
@ -10,6 +10,18 @@
|
|||
|
||||
#include "hal.h"
|
||||
|
||||
#if EFI_EMBED_INI_MSD
|
||||
#include "ramdisk.h"
|
||||
#include "ramdisk_image.h"
|
||||
|
||||
// If the ramdisk image told us not to use it, don't use it.
|
||||
#ifdef RAMDISK_INVALID
|
||||
#undef EFI_EMBED_INI_MSD
|
||||
#define EFI_EMBED_INI_MSD FALSE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
struct NullDevice {
|
||||
|
@ -65,11 +77,34 @@ static const struct BaseBlockDeviceVMT ndVmt = {
|
|||
nd_get_info
|
||||
};
|
||||
|
||||
#if EFI_EMBED_INI_MSD
|
||||
static RamDisk ramdisk;
|
||||
#else
|
||||
// This device is always ready and has no state
|
||||
static NullDevice nd = { &ndVmt, BLK_READY };
|
||||
#endif
|
||||
|
||||
#if HAL_USE_USB_MSD
|
||||
void msdMountNullDevice(USBMassStorageDriver* msdp, USBDriver *usbp, uint8_t* blkbuf, const scsi_inquiry_response_t* inquiry) {
|
||||
// TODO: implement multi-LUN so we can mount the ini image and SD card at the same time
|
||||
|
||||
#if EFI_EMBED_INI_MSD
|
||||
ramdiskObjectInit(&ramdisk);
|
||||
|
||||
constexpr size_t ramdiskSize = sizeof(ramdisk_image);
|
||||
constexpr size_t blockSize = 512;
|
||||
constexpr size_t blockCount = ramdiskSize / blockSize;
|
||||
|
||||
// Ramdisk should be a round number of blocks
|
||||
static_assert(ramdiskSize % blockSize == 0);
|
||||
|
||||
ramdiskStart(&ramdisk, const_cast<uint8_t*>(ramdisk_image), blockSize, blockCount, /*readonly =*/ true);
|
||||
|
||||
msdStart(msdp, usbp, (BaseBlockDevice*)&ramdisk, blkbuf, inquiry, nullptr);
|
||||
|
||||
#else
|
||||
// No embedded ini file, just mount the null device instead
|
||||
msdStart(msdp, usbp, (BaseBlockDevice*)&nd, blkbuf, inquiry, nullptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -270,4 +270,9 @@ float getMcuTemperature() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool readSlowAnalogInputs(adcsample_t* convertedSamples) {
|
||||
// TODO: implement me!
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
|
|
@ -275,4 +275,9 @@ float getMcuTemperature() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool readSlowAnalogInputs(adcsample_t* convertedSamples) {
|
||||
// TODO: implement me!
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
|
|
@ -11,9 +11,12 @@ void baseMCUInit(void);
|
|||
void jump_to_bootloader();
|
||||
|
||||
// ADC
|
||||
#if HAL_USE_ADC
|
||||
void portInitAdc();
|
||||
float getMcuTemperature();
|
||||
|
||||
// Convert all slow ADC inputs. Returns true if the conversion succeeded, false if a failure occured.
|
||||
bool readSlowAnalogInputs(adcsample_t* convertedSamples);
|
||||
#endif
|
||||
|
||||
// CAN bus
|
||||
#if HAL_USE_CAN
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
|
||||
EXTERN_CONFIG;
|
||||
|
||||
/* Depth of the conversion buffer, channels are sampled X times each.*/
|
||||
#ifndef ADC_BUF_DEPTH_SLOW
|
||||
#define ADC_BUF_DEPTH_SLOW 8
|
||||
#endif /* ADC_BUF_DEPTH_SLOW */
|
||||
|
||||
void portInitAdc() {
|
||||
// Init slow ADC
|
||||
adcStart(&ADCD1, NULL);
|
||||
|
@ -101,4 +106,74 @@ float getMcuTemperature() {
|
|||
return degrees;
|
||||
}
|
||||
|
||||
// See https://github.com/rusefi/rusefi/issues/976 for discussion on these values
|
||||
#define ADC_SAMPLING_SLOW ADC_SAMPLE_56
|
||||
#define ADC_SAMPLING_FAST ADC_SAMPLE_28
|
||||
|
||||
// Slow ADC has 16 channels we can sample
|
||||
constexpr size_t slowChannelCount = 16;
|
||||
|
||||
// Conversion group for slow channels
|
||||
// This simply samples every channel in sequence
|
||||
static constexpr ADCConversionGroup convGroupSlow = {
|
||||
.circular = FALSE,
|
||||
.num_channels = slowChannelCount,
|
||||
.end_cb = nullptr,
|
||||
.error_cb = nullptr,
|
||||
/* HW dependent part.*/
|
||||
.cr1 = 0,
|
||||
.cr2 = ADC_CR2_SWSTART,
|
||||
// Configure all channels to ADC_SAMPLING_SLOW sample time
|
||||
.smpr1 =
|
||||
ADC_SMPR1_SMP_AN10(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN11(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN12(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN13(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN14(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN15(ADC_SAMPLING_SLOW),
|
||||
.smpr2 =
|
||||
ADC_SMPR2_SMP_AN0(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN1(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN2(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN3(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN4(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN5(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN6(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN7(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN8(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN9(ADC_SAMPLING_SLOW),
|
||||
.htr = 0,
|
||||
.ltr = 0,
|
||||
// Simply sequence every channel in order
|
||||
.sqr1 = ADC_SQR1_SQ13_N(12) | ADC_SQR1_SQ14_N(13) | ADC_SQR1_SQ15_N(14) | ADC_SQR1_SQ16_N(15) | ADC_SQR1_NUM_CH(16), // Conversion group sequence 13...16 + sequence length
|
||||
.sqr2 = ADC_SQR2_SQ7_N(6) | ADC_SQR2_SQ8_N(7) | ADC_SQR2_SQ9_N(8) | ADC_SQR2_SQ10_N(8) | ADC_SQR2_SQ11_N(10) | ADC_SQR2_SQ12_N(11), // Conversion group sequence 7...12
|
||||
.sqr3 = ADC_SQR3_SQ1_N(0) | ADC_SQR3_SQ2_N(1) | ADC_SQR3_SQ3_N(2) | ADC_SQR3_SQ4_N(3) | ADC_SQR3_SQ5_N(4) | ADC_SQR3_SQ6_N(5), // Conversion group sequence 1...6
|
||||
};
|
||||
|
||||
static NO_CACHE adcsample_t slowSampleBuffer[ADC_BUF_DEPTH_SLOW * slowChannelCount];
|
||||
|
||||
bool readSlowAnalogInputs(adcsample_t* convertedSamples) {
|
||||
msg_t result = adcConvert(&ADCD1, &convGroupSlow, slowSampleBuffer, ADC_BUF_DEPTH_SLOW);
|
||||
|
||||
// If something went wrong - try again later
|
||||
if (result == MSG_RESET || result == MSG_TIMEOUT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Average samples to get some noise filtering and oversampling
|
||||
for (int i = 0; i < slowChannelCount; i++) {
|
||||
uint32_t sum = 0;
|
||||
size_t index = i;
|
||||
for (size_t j = 0; j < ADC_BUF_DEPTH_SLOW; j++) {
|
||||
sum += slowSampleBuffer[index];
|
||||
index += slowChannelCount;
|
||||
}
|
||||
|
||||
adcsample_t value = static_cast<adcsample_t>(sum / ADC_BUF_DEPTH_SLOW);
|
||||
convertedSamples[i] = value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // HAL_USE_ADC
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
* @file stm32_adc_v4.cpp
|
||||
* @brief Port implementation for the STM32 "v4" ADC found on the STM32H7
|
||||
*
|
||||
* @date February 25, 2021
|
||||
* @author Matthew Kennedy, (c) 2021
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "hal.h"
|
||||
#include "mpu_util.h"
|
||||
|
||||
void portInitAdc() {
|
||||
// Init slow ADC
|
||||
adcStart(&ADCD1, NULL);
|
||||
|
||||
// Connect the analog switches between {PA0_C, PA1_C, PC2_C, PC3_C} and their non-C counterparts
|
||||
// This lets us use normal (non-direct) analog on those channels
|
||||
SYSCFG->PMCR &= ~(SYSCFG_PMCR_PA0SO | SYSCFG_PMCR_PA1SO | SYSCFG_PMCR_PC2SO | SYSCFG_PMCR_PC3SO);
|
||||
}
|
||||
|
||||
float getMcuTemperature() {
|
||||
// Ugh, internal temp sensor is wired to ADC3, which makes it nearly useless on the H7.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: use a define instead of magic number
|
||||
#define ADC_SAMPLING_SLOW (7)
|
||||
|
||||
// Sample the 16 channels that line up with the STM32F4/F7
|
||||
constexpr size_t slowChannelCount = 16;
|
||||
|
||||
// Conversion group for slow channels
|
||||
// This simply samples every channel in sequence
|
||||
static constexpr ADCConversionGroup convGroupSlow = {
|
||||
.circular = FALSE,
|
||||
.num_channels = slowChannelCount,
|
||||
.end_cb = nullptr,
|
||||
.error_cb = nullptr,
|
||||
.cfgr = 0,
|
||||
.cfgr2 = 0, // no oversampling (yet)
|
||||
.ccr = 0,
|
||||
.pcsel = 0xFFFFFFFF, // enable analog switches on all channels
|
||||
// Thresholds aren't used
|
||||
.ltr1 = 0, .htr1 = 0, .ltr2 = 0, .htr2 = 0, .ltr3 = 0, .htr3 = 0,
|
||||
.smpr = {
|
||||
// Configure all channels to use ADC_SAMPLING_SLOW time
|
||||
ADC_SMPR1_SMP_AN0(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN1(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN2(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN3(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN4(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN5(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN6(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN7(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN8(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR1_SMP_AN9(ADC_SAMPLING_SLOW),
|
||||
ADC_SMPR2_SMP_AN10(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN11(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN12(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN13(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN14(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN15(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN16(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN17(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN18(ADC_SAMPLING_SLOW) |
|
||||
ADC_SMPR2_SMP_AN19(ADC_SAMPLING_SLOW)
|
||||
},
|
||||
.sqr = {
|
||||
// The seemingly insane values here exist to put the values
|
||||
// in the buffer in the same order as the ADCv2 (F4/F7) ADC
|
||||
ADC_SQR1_SQ1_N(16) | // PA0 (aka PA0_C)
|
||||
ADC_SQR1_SQ2_N(17) | // PA1 (aka PA1_C)
|
||||
ADC_SQR1_SQ3_N(14) | // PA2
|
||||
ADC_SQR1_SQ4_N(15), // PA3
|
||||
ADC_SQR2_SQ5_N(18) | // PA4
|
||||
ADC_SQR2_SQ6_N(19) | // PA5
|
||||
ADC_SQR2_SQ7_N(3) | // PA6
|
||||
ADC_SQR2_SQ8_N(7) | // PA7
|
||||
ADC_SQR2_SQ9_N(9), // PB0
|
||||
ADC_SQR3_SQ10_N(5) | // PB1
|
||||
ADC_SQR3_SQ11_N(10) | // PC0
|
||||
ADC_SQR3_SQ12_N(11) | // PC1
|
||||
ADC_SQR3_SQ13_N(12) | // PC2 (aka PC2_C)
|
||||
ADC_SQR3_SQ14_N(13), // PC3 (aka PC3_C)
|
||||
ADC_SQR4_SQ15_N(4) | // PC4
|
||||
ADC_SQR4_SQ16_N(8) // PC5
|
||||
},
|
||||
};
|
||||
|
||||
static NO_CACHE adcsample_t slowSampleBuffer[slowChannelCount];
|
||||
|
||||
bool readSlowAnalogInputs(adcsample_t* convertedSamples) {
|
||||
msg_t result = adcConvert(&ADCD1, &convGroupSlow, slowSampleBuffer, 1);
|
||||
|
||||
// If something went wrong - try again later
|
||||
if (result != MSG_OK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// V4 ADC can oversample in hardware, so no need to oversample in software
|
||||
for (int i = 0; i < slowChannelCount; i++) {
|
||||
// Convert from 16b result to 12b result
|
||||
convertedSamples[i] = slowSampleBuffer[i] >> 4;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -35,10 +35,6 @@
|
|||
|
||||
#include "rusefi_halconf.h"
|
||||
|
||||
// TODO: implement ADC on H7
|
||||
#undef HAL_USE_ADC
|
||||
#define HAL_USE_ADC FALSE
|
||||
|
||||
/**
|
||||
* @brief Enables the cryptographic subsystem.
|
||||
*/
|
||||
|
|
|
@ -225,7 +225,7 @@
|
|||
*/
|
||||
#define STM32_ADC_DUAL_MODE FALSE
|
||||
#define STM32_ADC_COMPACT_SAMPLES FALSE
|
||||
#define STM32_ADC_USE_ADC12 FALSE
|
||||
#define STM32_ADC_USE_ADC12 TRUE
|
||||
#define STM32_ADC_USE_ADC3 FALSE
|
||||
#define STM32_ADC_ADC12_DMA_STREAM STM32_DMA_STREAM_ID_ANY
|
||||
#define STM32_ADC_ADC3_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
|
||||
|
|
|
@ -3,7 +3,8 @@ include $(PROJECT_DIR)/hw_layer/ports/stm32/stm32_common.mk
|
|||
HW_LAYER_EMS += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash.c \
|
||||
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash_ex.c
|
||||
|
||||
HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32h7/mpu_util.cpp
|
||||
HW_LAYER_EMS_CPP += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32h7/mpu_util.cpp \
|
||||
$(PROJECT_DIR)/hw_layer/ports/stm32/stm32_adc_v4.cpp \
|
||||
|
||||
DDEFS += -DSTM32H743xx
|
||||
MCU = cortex-m7
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* @author Matthew Kennedy, (c) 2020
|
||||
*/
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
#include "lps25.h"
|
||||
|
||||
static constexpr uint8_t addr = 0x5C;
|
||||
|
@ -51,6 +49,10 @@ bool Lps25::init(brain_pin_e scl, brain_pin_e sda) {
|
|||
}
|
||||
|
||||
expected<float> Lps25::readPressureKpa() {
|
||||
if (!m_hasInit) {
|
||||
return unexpected;
|
||||
}
|
||||
|
||||
// First read the status reg to check if there are data available
|
||||
uint8_t sr = m_i2c.readRegister(addr, REG_Status);
|
||||
|
||||
|
@ -99,5 +101,3 @@ expected<float> Lps25::readPressureKpa() {
|
|||
|
||||
return kilopascal;
|
||||
}
|
||||
|
||||
#endif // EFI_PROD_CODE
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
#include "i2c_bb.h"
|
||||
|
||||
#include "expected.h"
|
||||
|
@ -25,5 +23,3 @@ private:
|
|||
BitbangI2c m_i2c;
|
||||
bool m_hasInit = false;
|
||||
};
|
||||
|
||||
#endif // EFI_PROD_CODE
|
||||
|
|
|
@ -27,6 +27,7 @@ void initThermistors(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
|||
void initCanSensors();
|
||||
void initLambda(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void initFlexSensor(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
void initBaro();
|
||||
|
||||
// Sensor reconfiguration
|
||||
void reconfigureVbatt(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -8,3 +8,4 @@ INIT_SRC_CPP = $(PROJECT_DIR)/init/sensor/init_sensors.cpp \
|
|||
$(PROJECT_DIR)/init/sensor/init_map.cpp \
|
||||
$(PROJECT_DIR)/init/sensor/init_flex.cpp \
|
||||
$(PROJECT_DIR)/init/sensor/init_vbatt.cpp \
|
||||
$(PROJECT_DIR)/init/sensor/init_baro.cpp \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#include "engine.h"
|
||||
#include "Lps25Sensor.h"
|
||||
|
||||
#include "rusefi_hw_enums.h"
|
||||
|
||||
static Lps25 device;
|
||||
static Lps25Sensor sensor(device);
|
||||
|
||||
void initBaro() {
|
||||
// If there's already an external (analog) baro sensor configured,
|
||||
// don't configure the internal one.
|
||||
if (Sensor::hasSensor(SensorType::BarometricPressure)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if HW_PROTEUS
|
||||
if (device.init(GPIOB_10, GPIOB_11)) {
|
||||
sensor.Register();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void baroUpdate() {
|
||||
#if EFI_PROD_CODE
|
||||
sensor.update();
|
||||
#endif
|
||||
}
|
|
@ -20,6 +20,7 @@ void initNewSensors(Logging* logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
initThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initLambda(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initBaro();
|
||||
|
||||
// Init CLI functionality for sensors (mocking)
|
||||
initSensorCli(logger);
|
||||
|
|
|
@ -575,7 +575,7 @@ cylinders_count_t cylindersCount;
|
|||
! FO_1_8_4_3_6_5_7_2 = 5
|
||||
! FO_1_2_4_5_3 = 6
|
||||
|
||||
custom firing_order_e 4 bits, U32, @OFFSET@, [0:4], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "1-2-4-5-3", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "1-8-7-2-6-5-4-3", "1-5-4-2-6-3-7-8", "1-6-3-2-5-4", "1-10-9-4-3-6-5-8-7_2", "1-7-5-11-3-9-6-12-2-8-4-10", "1-7-4-10-2-8-6-12-3-9-5-11", "1-4-3-2", "1-12-5-8-3-10-6-7-2-11-4-9", "1-2-7-8-4-5-6-3", "1-3-7-2-6-5-4-8", "1-2-3-4-5-6-7-8-9", "INVALID", "1-2-3-4-5-6-7-8-9-10-11-12", "1-3-2", "INVALID", "INVALID"
|
||||
custom firing_order_e 4 bits, U32, @OFFSET@, [0:4], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "1-2-4-5-3", "1-4-2-5-3-6", "1-2", "1-2-3-4-5-6", "1-2-3", "1-8-7-2-6-5-4-3", "1-5-4-2-6-3-7-8", "1-6-3-2-5-4", "1-10-9-4-3-6-5-8-7_2", "1-7-5-11-3-9-6-12-2-8-4-10", "1-7-4-10-2-8-6-12-3-9-5-11", "1-4-3-2", "1-12-5-8-3-10-6-7-2-11-4-9", "1-2-7-8-4-5-6-3", "1-3-7-2-6-5-4-8", "1-2-3-4-5-6-7-8-9", "INVALID", "1-2-3-4-5-6-7-8-9-10-11-12", "1-3-2", "1-2-3-4-5-6-7-8", "1-5-4-8-6-3-7-2"
|
||||
firing_order_e firingOrder;
|
||||
end_struct
|
||||
|
||||
|
|
Binary file not shown.
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.all.2140302013"
|
||||
signature = "rusEFI 2021.03.05.all.2140302013"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.all.2140302013" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.all.2140302013" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.frankenso_na6.4226303790"
|
||||
signature = "rusEFI 2021.03.05.frankenso_na6.4226303790"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.frankenso_na6.4226303790" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.frankenso_na6.4226303790" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:01 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:34 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.hellen72.96926268"
|
||||
signature = "rusEFI 2021.03.05.hellen72.96926268"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.hellen72.96926268" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.hellen72.96926268" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:56 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:28 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.hellen_cypress.1039053165"
|
||||
signature = "rusEFI 2021.03.05.hellen_cypress.1039053165"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.hellen_cypress.1039053165" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.hellen_cypress.1039053165" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:21 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:51 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.kin.3259727249"
|
||||
signature = "rusEFI 2021.03.05.kin.3259727249"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.kin.3259727249" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.kin.3259727249" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Mon Mar 01 14:54:19 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Fri Mar 05 22:43:49 UTC 2021
|
||||
|
||||
pageSize = 19972
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.mre_f4.1364465751"
|
||||
signature = "rusEFI 2021.03.05.mre_f4.1364465751"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.mre_f4.1364465751" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.mre_f4.1364465751" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:59 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:32 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.mre_f7.1364465751"
|
||||
signature = "rusEFI 2021.03.05.mre_f7.1364465751"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.mre_f7.1364465751" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.mre_f7.1364465751" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:58 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:30 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.prometheus_405.1829005451"
|
||||
signature = "rusEFI 2021.03.05.prometheus_405.1829005451"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.prometheus_405.1829005451" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.prometheus_405.1829005451" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:05 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:38 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.prometheus_469.1829005451"
|
||||
signature = "rusEFI 2021.03.05.prometheus_469.1829005451"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.prometheus_469.1829005451" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.prometheus_469.1829005451" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:03 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:36 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.proteus_f4.413377170"
|
||||
signature = "rusEFI 2021.03.05.proteus_f4.413377170"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.proteus_f4.413377170" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.proteus_f4.413377170" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:16 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:45 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.proteus_f7.413377170"
|
||||
signature = "rusEFI 2021.03.05.proteus_f7.413377170"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.proteus_f7.413377170" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.proteus_f7.413377170" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:06 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:42 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.03.01.subaru_eg33_f7.3175160971"
|
||||
signature = "rusEFI 2021.03.05.subaru_eg33_f7.3175160971"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.03.01.subaru_eg33_f7.3175160971" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.03.05.subaru_eg33_f7.3175160971" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:54:22 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:52 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Mon Mar 01 14:53:54 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Fri Mar 05 22:43:26 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
@ -1478,7 +1478,7 @@ public class Fields {
|
|||
public static final char TS_SD_R_COMMAND = 'r';
|
||||
public static final char TS_SD_W_COMMAND = 'w';
|
||||
public static final char TS_SET_LOGGER_SWITCH = 'l';
|
||||
public static final String TS_SIGNATURE = "rusEFI 2021.03.01.all.2140302013";
|
||||
public static final String TS_SIGNATURE = "rusEFI 2021.03.05.all.2140302013";
|
||||
public static final char TS_SINGLE_WRITE_COMMAND = 'W';
|
||||
public static final int TT_TT_1_16 = 50;
|
||||
public static final int TT_TT_2JZ_1_12 = 29;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<roms>
|
||||
|
||||
<!-- was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh Mon Mar 01 14:53:55 UTC 2021 -->
|
||||
<!-- was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh Fri Mar 05 22:43:27 UTC 2021 -->
|
||||
|
||||
<rom>
|
||||
<romid>
|
||||
|
|
|
@ -164,7 +164,7 @@ public class EcuStimulator {
|
|||
double advance = advances.get(MEASURES / 2);
|
||||
|
||||
// if (dwell > 40)
|
||||
// throw new IllegalStateException("Unexpected value, how comes? " + dwell);
|
||||
// throw new IllegalStateException("Unexpected value, how come? " + dwell);
|
||||
|
||||
log("Stimulator result: " + rpm + "@" + engineLoad + ": " + dwell + ", adv=" + advance);
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SensorSnifferPane {
|
|||
|
||||
lowerPanel.add(new EnumConfigField(uiContext, Fields.SENSORCHARTMODE, "Mode").getContent());
|
||||
lowerPanel.add(new ConfigField(uiContext, Fields.SENSORCHARTFREQUENCY, "Every XXX engine cycles").getContent());
|
||||
lowerPanel.add(new ConfigField(uiContext, Fields.SENSORSNIFFERRPMTHRESHOLD, "RPM threashold").getContent());
|
||||
lowerPanel.add(new ConfigField(uiContext, Fields.SENSORSNIFFERRPMTHRESHOLD, "RPM threshold").getContent());
|
||||
}
|
||||
|
||||
private void setPaused(JButton pauseButton, boolean isPaused) {
|
||||
|
|
|
@ -134,7 +134,7 @@ public class EngineSnifferPanel {
|
|||
lowerButtons.add(new BitConfigField(uiContext, Fields.ISENGINECHARTENABLED, "Collect Engine Data").getContent());
|
||||
lowerButtons.add(new ConfigField(uiContext, Fields.SENSORCHARTFREQUENCY, "Frequency").getContent());
|
||||
lowerButtons.add(new ConfigField(uiContext, Fields.ENGINECHARTSIZE, "Engine Sniffer size").getContent());
|
||||
lowerButtons.add(new ConfigField(uiContext, Fields.ENGINESNIFFERRPMTHRESHOLD, "RPM threashold").getContent());
|
||||
lowerButtons.add(new ConfigField(uiContext, Fields.ENGINESNIFFERRPMTHRESHOLD, "RPM threshold").getContent());
|
||||
bottomPanel.add(lowerButtons, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class EtbMonteCarloSequence {
|
|||
boolean shouldRun = currentValue < bestResultSoFar;
|
||||
if (!shouldRun) {
|
||||
MessagesCentral.getInstance().postMessage(EtbMonteCarloSequence.class,
|
||||
"Two much error accumulated, aborting! " + currentValue + " > " + bestResultSoFar);
|
||||
"Too much error accumulated, aborting! " + currentValue + " > " + bestResultSoFar);
|
||||
|
||||
}
|
||||
return shouldRun;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "table_helper.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "airmass.h"
|
||||
#include "injector_model.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
|
@ -66,3 +67,10 @@ public:
|
|||
|
||||
MOCK_METHOD(AirmassResult, getAirmass, (int rpm), (override));
|
||||
};
|
||||
|
||||
class MockInjectorModel2 : public IInjectorModel {
|
||||
public:
|
||||
MOCK_METHOD(void, prepare, (), (override));
|
||||
MOCK_METHOD(floatms_t, getInjectionDuration, (float fuelMassGram), (const, override));
|
||||
MOCK_METHOD(float, getFuelMassForDuration, (floatms_t duration), (const, override));
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "engine_test_helper.h"
|
||||
#include "main_trigger_callback.h"
|
||||
#include "injector_model.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include "mocks.h"
|
||||
|
@ -23,7 +24,9 @@ TEST(injectionScheduling, NormalDutyCycle) {
|
|||
event.outputs[0] = &pin;
|
||||
|
||||
// Injection duration of 20ms
|
||||
engine->injectionDuration = 20.0f;
|
||||
MockInjectorModel2 im;
|
||||
EXPECT_CALL(im, getInjectionDuration(_)).WillOnce(Return(20.0f));
|
||||
engine->injectorModel = &im;
|
||||
|
||||
{
|
||||
InSequence is;
|
||||
|
|
|
@ -704,7 +704,13 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
assertInjectors("#0_inj", 0, 0);
|
||||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
engine->injectionDuration = 12.5f;
|
||||
// Injection duration of 12.5ms
|
||||
MockInjectorModel2 im;
|
||||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(12.5f));
|
||||
engine->injectorModel = &im;
|
||||
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
|
||||
|
@ -860,6 +866,11 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
assertInjectionEvent("#3#", &t->elements[3], 1, 0, 45 + 90);
|
||||
|
||||
engine->injectionDuration = 17.5;
|
||||
// Injection duration of 17.5ms
|
||||
MockInjectorModel2 im2;
|
||||
EXPECT_CALL(im2, getInjectionDuration(_)).WillRepeatedly(Return(17.5f));
|
||||
engine->injectorModel = &im2;
|
||||
|
||||
// duty cycle above 75% is a special use-case because 'special' fuel event overlappes the next normal event in batch mode
|
||||
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
|
@ -987,7 +998,13 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
||||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
engine->injectionDuration = 17.5f;
|
||||
// Injection duration of 17.5ms
|
||||
MockInjectorModel2 im;
|
||||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(17.5f));
|
||||
engine->injectorModel = &im;
|
||||
|
||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
|
||||
|
@ -1048,7 +1065,13 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
ASSERT_EQ( 0, engine->executor.size()) << "Lqs#04";
|
||||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
// Injection duration of 2ms
|
||||
engine->injectionDuration = 2.0f;
|
||||
MockInjectorModel2 im2;
|
||||
EXPECT_CALL(im2, getInjectionDuration(_)).WillRepeatedly(Return(2.0f));
|
||||
engine->injectorModel = &im2;
|
||||
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(GET_RPM() PASS_ENGINE_PARAMETER_SUFFIX)) << "Lduty for maf=3";
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue