This commit is contained in:
rusefi 2017-11-16 20:30:56 -05:00
parent adb41de7f8
commit 1d799a5496
2 changed files with 10 additions and 5 deletions

View File

@ -78,9 +78,9 @@ public class EngineState {
SensorCentral.getInstance().initialize(this);
// SensorStats.start(Sensor.CLT, Sensor.COOLANT_WIDTH);
// SensorStats.start(Sensor.IAT, Sensor.INTAKE_AIR_WIDTH);
SensorStats.start(Sensor.VREF, Sensor.VREF_WIDTH);
// SensorStats.startRangeMeasurement(Sensor.CLT, Sensor.COOLANT_WIDTH);
// SensorStats.startRangeMeasurement(Sensor.IAT, Sensor.INTAKE_AIR_WIDTH);
SensorStats.startRangeMeasurement(Sensor.VREF, Sensor.VREF_WIDTH);
SensorStats.startStandardDeviation(Sensor.DWELL0, Sensor.DWELL0_SD);
SensorStats.startDelta(Sensor.INJECTOR_1_DWELL, Sensor.INJECTOR_2_DWELL, Sensor.INJ_1_2_DELTA);

View File

@ -9,7 +9,12 @@ import com.rusefi.waves.EngineReport;
* (c) Andrey Belomutskiy
*/
public class SensorStats {
public static void start(final Sensor source, final Sensor destination) {
/**
* here we listen of source sensor
* and on each 10th update post the difference between min and max values to widthDestination
*/
public static void startRangeMeasurement(final Sensor source, final Sensor widthDestination) {
SensorCentral.getInstance().addListener(source, new SensorCentral.SensorListener() {
int counter;
@ -27,7 +32,7 @@ public class SensorStats {
counter = 0;
double width = max - min;
SensorCentral.getInstance().setValue(width, destination);
SensorCentral.getInstance().setValue(width, widthDestination);
min = Double.MAX_VALUE;
max = Double.MIN_VALUE;