Remove sensor reporting loc (#1064)

* remove raw rept loc

* remove normal reporting location

* fix up oil pressure

* format
This commit is contained in:
Matthew Kennedy 2019-12-16 19:45:46 -08:00 committed by rusefi
parent 0a7884241d
commit 08a8fa8d1e
5 changed files with 11 additions and 38 deletions

View File

@ -756,7 +756,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
// offset 108
// For air-interpolated tCharge mode, we calculate a decent massAirFlow approximation, so we can show it to users even without MAF sensor!
tsOutputChannels->massAirFlow = getAirFlowGauge(PASS_ENGINE_PARAMETER_SIGNATURE);
tsOutputChannels->massAirFlow = getAirFlowGauge(PASS_ENGINE_PARAMETER_SIGNATURE);
// offset 116
// TPS acceleration
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getMaxDelta();
@ -793,12 +793,14 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->firmwareVersion = getRusEfiVersion();
// 268
tsOutputChannels->fuelPidCorrection = ENGINE(engineState.running.pidCorrection);
// 276
tsOutputChannels->accelerationX = engine->sensors.accelerometer.x;
// 278
tsOutputChannels->accelerationY = engine->sensors.accelerometer.y;
// 288
tsOutputChannels->injectionOffset = engine->engineState.injectionOffset;
// 276
tsOutputChannels->accelerationX = engine->sensors.accelerometer.x;
// 278
tsOutputChannels->accelerationY = engine->sensors.accelerometer.y;
// 280
tsOutputChannels->oilPressure = Sensor::get(SensorType::OilPressure).Value;
// 288
tsOutputChannels->injectionOffset = engine->engineState.injectionOffset;
if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
float mapValue = getMap(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -1,12 +1,6 @@
#include "functional_sensor.h"
void FunctionalSensor::postRawValue(float inputValue) {
// Report the raw value
float *rawReportLocation = m_rawReportingLocation;
if (rawReportLocation) {
*rawReportLocation = inputValue;
}
// If no function is set, this sensor isn't valid.
if (!m_function) {
invalidate();

View File

@ -30,17 +30,11 @@ public:
void postRawValue(float inputValue);
void setRawReportingLocation(float *rawReportingLocation) {
m_rawReportingLocation = rawReportingLocation;
}
void setFunction(SensorConverter& func) {
m_function = &func;
}
private:
float *m_rawReportingLocation = nullptr;
// Conversion function for this sensor
SensorConverter* m_function = nullptr;
};

View File

@ -34,15 +34,11 @@ public:
return {valid, value};
}
void setReportingLocation(float *reportLocation) {
m_reportingLocation = reportLocation;
}
protected:
explicit StoredValueSensor(SensorType type)
: Sensor(type)
//, m_reportingLocation(reportingLocation)
{}
{
}
// Invalidate the stored value.
void invalidate() {
@ -54,17 +50,9 @@ protected:
// Set value before valid - so we don't briefly have the valid bit set on an invalid value
m_value = value;
m_isValid = true;
// Report value
float *reportLoc = m_reportingLocation;
if (reportLoc) {
*reportLoc = value;
}
}
private:
bool m_isValid = false;
float m_value = 0.0f;
float *m_reportingLocation = nullptr;
};

View File

@ -33,11 +33,6 @@ void initOilPressure() {
oilpSensorFunc.configure(sensorCfg->v1, val1, sensorCfg->v2, val2, /*minOutput*/ -5, greaterOutput);
oilpSensor.setFunction(oilpSensorFunc);
#if EFI_TUNER_STUDIO
// Tell it to report to its output channel
oilpSensor.setReportingLocation(&tsOutputChannels.oilPressure);
#endif
// Subscribe the sensor to the ADC
AdcSubscription::SubscribeSensor(oilpSensor, channel);