Remove sensor reporting loc (#1064)
* remove raw rept loc * remove normal reporting location * fix up oil pressure * format
This commit is contained in:
parent
0a7884241d
commit
08a8fa8d1e
|
@ -797,6 +797,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->accelerationX = engine->sensors.accelerometer.x;
|
tsOutputChannels->accelerationX = engine->sensors.accelerometer.x;
|
||||||
// 278
|
// 278
|
||||||
tsOutputChannels->accelerationY = engine->sensors.accelerometer.y;
|
tsOutputChannels->accelerationY = engine->sensors.accelerometer.y;
|
||||||
|
// 280
|
||||||
|
tsOutputChannels->oilPressure = Sensor::get(SensorType::OilPressure).Value;
|
||||||
// 288
|
// 288
|
||||||
tsOutputChannels->injectionOffset = engine->engineState.injectionOffset;
|
tsOutputChannels->injectionOffset = engine->engineState.injectionOffset;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
#include "functional_sensor.h"
|
#include "functional_sensor.h"
|
||||||
|
|
||||||
void FunctionalSensor::postRawValue(float inputValue) {
|
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 no function is set, this sensor isn't valid.
|
||||||
if (!m_function) {
|
if (!m_function) {
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
|
@ -30,17 +30,11 @@ public:
|
||||||
|
|
||||||
void postRawValue(float inputValue);
|
void postRawValue(float inputValue);
|
||||||
|
|
||||||
void setRawReportingLocation(float *rawReportingLocation) {
|
|
||||||
m_rawReportingLocation = rawReportingLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFunction(SensorConverter& func) {
|
void setFunction(SensorConverter& func) {
|
||||||
m_function = &func;
|
m_function = &func;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float *m_rawReportingLocation = nullptr;
|
|
||||||
|
|
||||||
// Conversion function for this sensor
|
// Conversion function for this sensor
|
||||||
SensorConverter* m_function = nullptr;
|
SensorConverter* m_function = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,15 +34,11 @@ public:
|
||||||
return {valid, value};
|
return {valid, value};
|
||||||
}
|
}
|
||||||
|
|
||||||
void setReportingLocation(float *reportLocation) {
|
|
||||||
m_reportingLocation = reportLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit StoredValueSensor(SensorType type)
|
explicit StoredValueSensor(SensorType type)
|
||||||
: Sensor(type)
|
: Sensor(type)
|
||||||
//, m_reportingLocation(reportingLocation)
|
{
|
||||||
{}
|
}
|
||||||
|
|
||||||
// Invalidate the stored value.
|
// Invalidate the stored value.
|
||||||
void invalidate() {
|
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
|
// Set value before valid - so we don't briefly have the valid bit set on an invalid value
|
||||||
m_value = value;
|
m_value = value;
|
||||||
m_isValid = true;
|
m_isValid = true;
|
||||||
|
|
||||||
// Report value
|
|
||||||
float *reportLoc = m_reportingLocation;
|
|
||||||
if (reportLoc) {
|
|
||||||
*reportLoc = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isValid = false;
|
bool m_isValid = false;
|
||||||
float m_value = 0.0f;
|
float m_value = 0.0f;
|
||||||
|
|
||||||
float *m_reportingLocation = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,11 +33,6 @@ void initOilPressure() {
|
||||||
oilpSensorFunc.configure(sensorCfg->v1, val1, sensorCfg->v2, val2, /*minOutput*/ -5, greaterOutput);
|
oilpSensorFunc.configure(sensorCfg->v1, val1, sensorCfg->v2, val2, /*minOutput*/ -5, greaterOutput);
|
||||||
oilpSensor.setFunction(oilpSensorFunc);
|
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
|
// Subscribe the sensor to the ADC
|
||||||
AdcSubscription::SubscribeSensor(oilpSensor, channel);
|
AdcSubscription::SubscribeSensor(oilpSensor, channel);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue