auto-sync

This commit is contained in:
rusEfi 2015-05-30 10:06:27 -04:00
parent 8f7a5635f2
commit 594dad46ab
4 changed files with 17 additions and 8 deletions

View File

@ -90,7 +90,8 @@ typedef struct {
float currentMapAccelDelta;
float tpsAccelFuel;
float baroCorrection;
int unused3[15];
float pedalPosition;
int unused3[14];
} TunerStudioOutputChannels;
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */

View File

@ -572,6 +572,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
tsOutputChannels->triggerErrorsCounter = triggerCentral.triggerState.totalTriggerErrorCounter;
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
tsOutputChannels->pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_F);
tsOutputChannels->checkEngine = hasErrorCodes();
#if EFI_PROD_CODE || defined(__DOXYGEN__)

View File

@ -97,15 +97,16 @@ static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
return tpsValue;
}
// todo: static float getSecondaryRawTPS
#define NO_TPS_MAGIC_VALUE 66.611
#define NO_TPS_MAGIC_VALUE 66.6
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F) {
float voltage = getVoltageDivided("pPS", engineConfiguration->pedalPositionChannel);
float result = interpolate(engineConfiguration->pedalPositionMin, 0, engineConfiguration->pedalPositionMax, 100, voltage);
// this would put the value into the 0-100 range
return maxF(0, minF(100, result));
}
/*
* In case of dual TPS this function would return logical TPS position
*
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
*/
percent_t getTPS(DECLARE_ENGINE_PARAMETER_F) {
if (!engineConfiguration->hasTpsSensor)
return NO_TPS_MAGIC_VALUE;

View File

@ -13,6 +13,12 @@
#include "global.h"
#include "engine_configuration.h"
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F);
/**
* Throttle Position Sensor
* In case of dual TPS this function would return logical TPS position
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
*/
percent_t getTPS(DECLARE_ENGINE_PARAMETER_F);
int convertVoltageTo10bitADC(float voltage);
int getTPS10bitAdc(DECLARE_ENGINE_PARAMETER_F);