merc128: engine config defaults #3236

This commit is contained in:
rusefillc 2021-09-18 21:27:17 -04:00
parent 6610c80408
commit 3e50319eb7
7 changed files with 24 additions and 4 deletions

View File

@ -115,7 +115,6 @@ void setBoardConfigOverrides(void) {
engineConfiguration->canTxPin = GPIOD_1; engineConfiguration->canTxPin = GPIOD_1;
engineConfiguration->canRxPin = GPIOD_0; engineConfiguration->canRxPin = GPIOD_0;
setHellenDefaultVrThresholds(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->vrThreshold[0].pin = GPIOD_14; engineConfiguration->vrThreshold[0].pin = GPIOD_14;
} }

View File

@ -765,6 +765,6 @@ void setHellen72etb(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setHellenDefaultVrThresholds(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setHellenDefaultVrThresholds(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
for (int i = 0;i<VR_THRESHOLD_COUNT;i++) { for (int i = 0;i<VR_THRESHOLD_COUNT;i++) {
setLinearCurve(engineConfiguration->vrThreshold[i].rpmBins, 600, 7000, 100); setLinearCurve(engineConfiguration->vrThreshold[i].rpmBins, 600, 7000, 100);
setLinearCurve(engineConfiguration->vrThreshold[i].values, 0.6, 1.2, 0.1); setLinearCurve(engineConfiguration->vrThreshold[i].values, PACK_PERCENT_BYTE_MULT * 0.6, PACK_PERCENT_BYTE_MULT * 1.2, PACK_PERCENT_BYTE_MULT * 0.1);
} }
} }

View File

@ -6,9 +6,19 @@
*/ */
#include "pch.h" #include "pch.h"
#include "custom_engine.h"
static void common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setHellenDefaultVrThresholds(PASS_CONFIG_PARAMETER_SIGNATURE);
}
void setHellenMercedes128_4_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
common(PASS_CONFIG_PARAMETER_SIGNATURE);
}
// is this M104 or M112 or both? // is this M104 or M112 or both?
void setHellenMercedes128_6_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setHellenMercedes128_6_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
common(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->specs.cylindersCount = 6; engineConfiguration->specs.cylindersCount = 6;
// 1-4-2-5-3-6 M104 // 1-4-2-5-3-6 M104
engineConfiguration->specs.firingOrder = FO_1_4_3_6_2_5; // M112 engineConfiguration->specs.firingOrder = FO_1_4_3_6_2_5; // M112
@ -16,6 +26,7 @@ void setHellenMercedes128_6_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// M113 // M113
void setHellenMercedes128_8_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setHellenMercedes128_8_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
common(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->specs.cylindersCount = 8; engineConfiguration->specs.cylindersCount = 8;
engineConfiguration->specs.firingOrder = FO_1_5_4_2_6_3_7_8; engineConfiguration->specs.firingOrder = FO_1_5_4_2_6_3_7_8;
} }

View File

@ -9,5 +9,6 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setHellenMercedes128_4_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setHellenMercedes128_6_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setHellenMercedes128_6_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setHellenMercedes128_8_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setHellenMercedes128_8_cyl(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -859,7 +859,6 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e
// todo: is it time to replace MICRO_RUS_EFI, PROTEUS, PROMETHEUS_DEFAULTS with MINIMAL_PINS? maybe rename MINIMAL_PINS to DEFAULT? // todo: is it time to replace MICRO_RUS_EFI, PROTEUS, PROMETHEUS_DEFAULTS with MINIMAL_PINS? maybe rename MINIMAL_PINS to DEFAULT?
case PROTEUS_DEFAULTS: case PROTEUS_DEFAULTS:
case PROMETHEUS_DEFAULTS: case PROMETHEUS_DEFAULTS:
case HELLEN_128_MERCEDES_4_CYL:
case MINIMAL_PINS: case MINIMAL_PINS:
// all basic settings are already set in prepareVoidConfiguration(), no need to set anything here // all basic settings are already set in prepareVoidConfiguration(), no need to set anything here
// nothing to do - we do it all in setBoardDefaultConfiguration // nothing to do - we do it all in setBoardDefaultConfiguration
@ -938,6 +937,9 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e
#endif // HARDWARE_CI #endif // HARDWARE_CI
#endif // HW_PROTEUS #endif // HW_PROTEUS
#if HW_HELLEN #if HW_HELLEN
case HELLEN_128_MERCEDES_4_CYL:
setHellenMercedes128_4_cyl(PASS_CONFIG_PARAMETER_SIGNATURE);
break;
case HELLEN_128_MERCEDES_6_CYL: case HELLEN_128_MERCEDES_6_CYL:
setHellenMercedes128_6_cyl(PASS_CONFIG_PARAMETER_SIGNATURE); setHellenMercedes128_6_cyl(PASS_CONFIG_PARAMETER_SIGNATURE);
break; break;

View File

@ -12,7 +12,7 @@ static void updateVrPwm(int rpm, size_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
return; return;
} }
float thresholdVoltage = interpolate2d(rpm / RPM_1_BYTE_PACKING_MULT, cfg.rpmBins, cfg.values) / 100.0f; float thresholdVoltage = interpolate2d(rpm / RPM_1_BYTE_PACKING_MULT, cfg.rpmBins, cfg.values) / PACK_PERCENT_BYTE_MULT;
// 0v threshold voltage = 3.3v output from mcu = 100% duty // 0v threshold voltage = 3.3v output from mcu = 100% duty
// 2.5v threshold voltage = 0v output from mcu = 0% duty // 2.5v threshold voltage = 0v output from mcu = 0% duty

View File

@ -7,6 +7,13 @@
#include "pch.h" #include "pch.h"
TEST(sensors, vrThreshold) {
WITH_ENGINE_TEST_HELPER(HELLEN_128_MERCEDES_4_CYL);
auto& cfg = CONFIG(vrThreshold)[0];
ASSERT_FLOAT_EQ(0.8 * PACK_PERCENT_BYTE_MULT, cfg.values[2]);
}
TEST(sensors, mapDecoding) { TEST(sensors, mapDecoding) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);