fixing throttle pedal settings storage & better names

This commit is contained in:
rusEfi 2017-05-29 22:35:24 -04:00
parent 7117e96fff
commit 5a2884bf77
9 changed files with 58 additions and 35 deletions

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 28 22:30:58 EDT 2017
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 29 22:21:18 EDT 2017
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -1165,11 +1165,7 @@ typedef struct {
/**
* offset 572
*/
int16_t pedalPositionMin;
/**
* offset 574
*/
int16_t pedalPositionMax;
int unusedAnother;
/**
* maximum total number of degrees to subtract from ignition advance
* when knocking
@ -1538,7 +1534,16 @@ typedef struct {
/**
* offset 2012
*/
float unusedetb[4];
float throttlePedalUpVoltage;
/**
* Pedal in the floor
* offset 2016
*/
float throttlePedalWOTVoltage;
/**
* offset 2020
*/
float unusedetb[2];
/**
* CLT-based target RPM for automatic idle controller
* offset 2028
@ -2107,4 +2112,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 28 22:30:58 EDT 2017
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 29 22:21:18 EDT 2017

View File

@ -319,10 +319,8 @@
#define hip9011SpiDevice_offset_hex 234
#define globalFuelCorrection_offset 568
#define globalFuelCorrection_offset_hex 238
#define pedalPositionMin_offset 572
#define pedalPositionMin_offset_hex 23c
#define pedalPositionMax_offset 574
#define pedalPositionMax_offset_hex 23e
#define unusedAnother_offset 572
#define unusedAnother_offset_hex 23c
#define maxKnockSubDeg_offset 576
#define maxKnockSubDeg_offset_hex 240
#define mafAdcChannel_offset 580
@ -1097,8 +1095,12 @@
#define knockNoise_offset_hex 79c
#define knockNoiseRpmBins_offset 1980
#define knockNoiseRpmBins_offset_hex 7bc
#define unusedetb_offset 2012
#define unusedetb_offset_hex 7dc
#define throttlePedalUpVoltage_offset 2012
#define throttlePedalUpVoltage_offset_hex 7dc
#define throttlePedalWOTVoltage_offset 2016
#define throttlePedalWOTVoltage_offset_hex 7e0
#define unusedetb_offset 2020
#define unusedetb_offset_hex 7e4
#define cltIdleRpmBins_offset 2028
#define cltIdleRpmBins_offset_hex 7ec
#define cltIdleRpm_offset 2092

View File

@ -137,7 +137,7 @@ static void setThrottleConsole(int level) {
static void showEthInfo(void) {
static char pinNameBuffer[16];
scheduleMsg(&logger, "pedal=%f %d/%d @", getPedalPosition(), engineConfiguration->pedalPositionMin, engineConfiguration->pedalPositionMax,
scheduleMsg(&logger, "pedal=%f %f/%f @", getPedalPosition(), engineConfiguration->throttlePedalUpVoltage, engineConfiguration->throttlePedalWOTVoltage,
getPinNameByAdcChannel("etb", engineConfiguration->pedalPositionChannel, pinNameBuffer));
scheduleMsg(&logger, "TPS=%f", getTPS());
@ -168,7 +168,9 @@ void setEtbIFactor(float value) {
}
void setDefaultEtbParameters(void) {
engineConfiguration->pedalPositionMax = 6;
engineConfiguration->throttlePedalUpVoltage = 0; // that's voltage, not ADC like with TPS
engineConfiguration->throttlePedalWOTVoltage = 6; // that's voltage, not ADC like with TPS
engineConfiguration->etb.pFactor = 1;
engineConfiguration->etb.iFactor = 0.5;
engineConfiguration->etb.period = 100;

View File

@ -124,7 +124,7 @@ bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float voltage = getVoltageDivided("pPS", engineConfiguration->pedalPositionChannel);
float result = interpolate(engineConfiguration->pedalPositionMin, 0, engineConfiguration->pedalPositionMax, 100, voltage);
float result = interpolate(engineConfiguration->throttlePedalUpVoltage, 0, engineConfiguration->throttlePedalWOTVoltage, 100, voltage);
// this would put the value into the 0-100 range
return maxF(0, minF(100, result));
@ -144,6 +144,14 @@ percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return getPrimatyRawTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
}
void setBosch0280750009(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// see http://rusefi.com/wiki/index.php?title=Vehicle:VW_Passat_2002_1.8
engineConfiguration->tpsMin = 159;
engineConfiguration->tpsMax = 957;
// todo: add 2nd TPS sensor calibration
}
int convertVoltageTo10bitADC(float voltage) {
// divided by 2 because of voltage divider, then converted into 10bit ADC value (TunerStudio format)
return (int) (voltage / 2 * 1024 / 3.3);

View File

@ -29,6 +29,7 @@ int convertVoltageTo10bitADC(float voltage);
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_SIGNATURE);
percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX);
void setBosch0280750009(DECLARE_ENGINE_PARAMETER_SIGNATURE);
typedef struct {
efitimeus_t prevTime;

View File

@ -374,9 +374,7 @@ custom spi_device_e 4 bits,U32, @OFFSET@, [0:1], "Off", "SPI1", "SPI2", "SPI3"
float globalFuelCorrection;;"coef", 1, 0.0, 0, 1000.0, 2
int16_t pedalPositionMin;;"ADC", 1, 0, 0, 1023, 0
int16_t pedalPositionMax;;"ADC", 1, 0, 0, 1023, 0
int unusedAnother;
float maxKnockSubDeg;maximum total number of degrees to subtract from ignition advance\nwhen knocking
adc_channel_e mafAdcChannel;See hasMafSensor
@ -705,7 +703,10 @@ custom pin_mode_e 4 bits, U32, @OFFSET@, [0:5], @@pin_mode_e_enum@@
brain_pin_e consoleSerialRxPin;todo: finish pin migration from hard-coded to configurable?
float[ENGINE_NOISE_CURVE_SIZE] knockNoise;Knock sensor output knock detection threshold depending on current RPM;"v", 1, 0, 0.0, 10, 2
float[ENGINE_NOISE_CURVE_SIZE] knockNoiseRpmBins;;"RPM", 1, 0, 0.0, 18000, 2
float[4] unusedetb;
float throttlePedalUpVoltage;;"voltage", 1, 0, -6, 6, 2
float throttlePedalWOTVoltage;+Pedal in the floor;"voltage", 1, 0, -6, 6, 2
float[2] unusedetb;
float[CLT_CURVE_SIZE] cltIdleRpmBins;CLT-based target RPM for automatic idle controller;"C", 1, 0, -100.0, 250.0, 2
float[CLT_CURVE_SIZE] cltIdleRpm;;"RPM", 1, 0, 0.0, 400.0, 0

View File

@ -45,7 +45,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 29 21:58:00 EDT 2017
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 29 22:21:18 EDT 2017
pageSize = 16376
page = 1
@ -169,8 +169,7 @@ page = 1
trigger_unusedcustomUseRiseEdge = bits, U32, 560, [0:0], "false", "true"
hip9011SpiDevice = bits,U32, 564, [0:1], "Off", "SPI1", "SPI2", "SPI3"
globalFuelCorrection = scalar, F32, 568, "coef", 1, 0.0, 0, 1000.0, 2
pedalPositionMin = scalar, S16, 572, "ADC", 1, 0, 0, 1023, 0
pedalPositionMax = scalar, S16, 574, "ADC", 1, 0, 0, 1023, 0
;skipping unusedAnother offset 572
;skipping maxKnockSubDeg offset 576
mafAdcChannel = bits, U32, 580, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
afr_hwChannel = bits, U32, 584, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
@ -550,7 +549,9 @@ page = 1
consoleSerialRxPin = bits, U32, 1944, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
knockNoise = array, F32, 1948, [8], "v", 1, 0, 0.0, 10, 2
knockNoiseRpmBins = array, F32, 1980, [8], "RPM", 1, 0, 0.0, 18000, 2
;skipping unusedetb offset 2012
throttlePedalUpVoltage = scalar, F32, 2012, "voltage", 1, 0, -6, 6, 2
throttlePedalWOTVoltage = scalar, F32, 2016, "voltage", 1, 0, -6, 6, 2
;skipping unusedetb offset 2020
cltIdleRpmBins = array, F32, 2028, [16], "C", 1, 0, -100.0, 250.0, 2
cltIdleRpm = array, F32, 2092, [16], "RPM", 1, 0, 0.0, 400.0, 0
targetVBatt = scalar, F32, 2156, "Volts", 1, 0, 0,30, 1
@ -806,6 +807,7 @@ page = 1
ignMathCalculateAtIndex = "At what trigger index should some ignition-related math be executed? This is a performance trick to reduce load on synchronization trigger callback."
mapAveragingSchedulingAtIndex = "At what trigger index should some MAP-related math be executed? This is a performance trick to reduce load on synchronization trigger callback."
tachPulseTriggerIndex = "Trigger cycle index at which we start tach pulse (performance consideration)"
throttlePedalWOTVoltage = "Pedal in the floor"
slowAdcAlpha = "ExpAverage alpha coefficient"
dizzySparkOutputPin = "This implementation makes a pulse every time one of the coils is charged. See also tachOutputPin"
@ -2388,8 +2390,8 @@ cmd_call_from_pit = "w\x00\x20\x34\x56"
dialog = etbDialog, "Electronic Thtottle Body (alpha)"
field = "pedal Position Channel", pedalPositionChannel
field = "verbose", isVerboseETB
field = "Pedal min", pedalPositionMin
field = "Pedal max", pedalPositionMax
field = "Throttle Pedal Up", throttlePedalUpVoltage
field = "Throttle Pedal Wide Open", throttlePedalWOTVoltage
field = "PWM Frequency", etbFreq
field = "Dir #1", etbDirectionPin1
field = "Dir #2", etbDirectionPin2

View File

@ -1626,8 +1626,8 @@ cmd_call_from_pit = "w\x00\x20\x34\x56"
dialog = etbDialog, "Electronic Thtottle Body (alpha)"
field = "pedal Position Channel", pedalPositionChannel
field = "verbose", isVerboseETB
field = "Pedal min", pedalPositionMin
field = "Pedal max", pedalPositionMax
field = "Throttle Pedal Up", throttlePedalUpVoltage
field = "Throttle Pedal Wide Open", throttlePedalWOTVoltage
field = "PWM Frequency", etbFreq
field = "Dir #1", etbDirectionPin1
field = "Dir #2", etbDirectionPin2

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 28 22:30:58 EDT 2017
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon May 29 22:21:18 EDT 2017
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int FSIO_ADC_COUNT = 4;
@ -249,8 +249,7 @@ public class Fields {
public static final int hip9011SpiDevice_offset_hex = 234;
public static final int globalFuelCorrection_offset = 568;
public static final int globalFuelCorrection_offset_hex = 238;
public static final int pedalPositionMin_offset = 572;
public static final int pedalPositionMax_offset = 574;
public static final int unusedAnother_offset = 572;
public static final int maxKnockSubDeg_offset = 576;
public static final int maxKnockSubDeg_offset_hex = 240;
public static final int mafAdcChannel_offset = 580;
@ -799,7 +798,9 @@ public class Fields {
public static final int consoleSerialRxPin_offset_hex = 798;
public static final int knockNoise_offset = 1948;
public static final int knockNoiseRpmBins_offset = 1980;
public static final int unusedetb_offset = 2012;
public static final int throttlePedalUpVoltage_offset = 2012;
public static final int throttlePedalWOTVoltage_offset = 2016;
public static final int unusedetb_offset = 2020;
public static final int cltIdleRpmBins_offset = 2028;
public static final int cltIdleRpm_offset = 2092;
public static final int targetVBatt_offset = 2156;
@ -1207,8 +1208,7 @@ public class Fields {
public static final Field TRIGGER_UNUSEDCUSTOMUSERISEEDGE = Field.create("TRIGGER_UNUSEDCUSTOMUSERISEEDGE", 560, FieldType.INT);
public static final Field HIP9011SPIDEVICE = Field.create("HIP9011SPIDEVICE", 564, FieldType.INT);
public static final Field GLOBALFUELCORRECTION = Field.create("GLOBALFUELCORRECTION", 568, FieldType.FLOAT);
public static final Field PEDALPOSITIONMIN = Field.create("PEDALPOSITIONMIN", 572, FieldType.INT);
public static final Field PEDALPOSITIONMAX = Field.create("PEDALPOSITIONMAX", 574, FieldType.INT);
public static final Field UNUSEDANOTHER = Field.create("UNUSEDANOTHER", 572, FieldType.INT);
public static final Field MAXKNOCKSUBDEG = Field.create("MAXKNOCKSUBDEG", 576, FieldType.FLOAT);
public static final Field MAFADCCHANNEL = Field.create("MAFADCCHANNEL", 580, FieldType.INT, adc_channel_e);
public static final Field AFR_HWCHANNEL = Field.create("AFR_HWCHANNEL", 584, FieldType.INT, adc_channel_e);
@ -1586,6 +1586,8 @@ public class Fields {
public static final Field BINARYSERIALRXPIN = Field.create("BINARYSERIALRXPIN", 1936, FieldType.INT, brain_pin_e);
public static final Field CONSOLESERIALTXPIN = Field.create("CONSOLESERIALTXPIN", 1940, FieldType.INT, brain_pin_e);
public static final Field CONSOLESERIALRXPIN = Field.create("CONSOLESERIALRXPIN", 1944, FieldType.INT, brain_pin_e);
public static final Field THROTTLEPEDALUPVOLTAGE = Field.create("THROTTLEPEDALUPVOLTAGE", 2012, FieldType.FLOAT);
public static final Field THROTTLEPEDALWOTVOLTAGE = Field.create("THROTTLEPEDALWOTVOLTAGE", 2016, FieldType.FLOAT);
public static final Field TARGETVBATT = Field.create("TARGETVBATT", 2156, FieldType.FLOAT);
public static final Field ALTERNATOROFFABOVETPS = Field.create("ALTERNATOROFFABOVETPS", 2160, FieldType.FLOAT);
public static final Field TPSACCELLENGTH = Field.create("TPSACCELLENGTH", 2184, FieldType.INT);