Remove sensor chart (#568)

* delete sensor chart from firmware

* delete sensor sniffer UI
This commit is contained in:
Matthew Kennedy 2025-03-07 03:28:29 -08:00 committed by GitHub
parent b0b8b300ce
commit 442c75cc4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 2 additions and 585 deletions

View File

@ -4,7 +4,6 @@ DDEFS += -DFIRMWARE_ID=\"small-can-board\"
SHORT_BOARD_NAME = small-can-board
DDEFS += -DSTATIC_BOARD_ID=STATIC_BOARD_ID_SMALL_CAN_BOARD
DDEFS += -DEFI_SENSOR_CHART=FALSE
DDEFS += -DLUA_USER_HEAP=50000
DDEFS += -DEFI_LOGIC_ANALYZER=FALSE
DDEFS += -DEFI_MALFUNCTION_INDICATOR=FALSE

View File

@ -100,5 +100,4 @@ void setFordAspireEngineConfiguration() {
engineConfiguration->map.sensor.type = MT_DENSO183;
engineConfiguration->engineSnifferRpmThreshold = 13000;
engineConfiguration->sensorSnifferRpmThreshold = 13000;
}

View File

@ -42,10 +42,6 @@
#define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE
#define EFI_ENABLE_ENGINE_WARNING TRUE
#ifndef SC_BUFFER_SIZE
#define SC_BUFFER_SIZE 4000
#endif
/**
* if you have a 60-2 trigger, or if you just want better performance, you
* probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
@ -267,10 +263,6 @@
#define EFI_ENGINE_SNIFFER TRUE
#endif
#ifndef EFI_SENSOR_CHART
#define EFI_SENSOR_CHART TRUE
#endif
#ifndef DL_OUTPUT_BUFFER
#define DL_OUTPUT_BUFFER 6500
#endif

View File

@ -76,8 +76,6 @@ extern bool main_loop_started;
extern WaveChart waveChart;
#endif /* EFI_ENGINE_SNIFFER */
#include "sensor_chart.h"
extern int maxTriggerReentrant;
extern uint32_t maxLockedDuration;
@ -156,10 +154,6 @@ void printOverallStatus() {
waveChart.publishIfFull();
#endif /* EFI_ENGINE_SNIFFER */
#if EFI_SENSOR_CHART
publishSensorChartIfFull();
#endif // EFI_SENSOR_CHART
/**
* we report the version every second - this way the console does not need to
* request it and we will display it pretty soon

View File

@ -168,7 +168,6 @@ void Engine::updateSlowSensors() {
#if EFI_SHAFT_POSITION_INPUT
float rpm = Sensor::getOrZero(SensorType::Rpm);
triggerCentral.isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
getEngineState()->sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
#endif // EFI_SHAFT_POSITION_INPUT
}

View File

@ -464,7 +464,6 @@ static void setDefaultEngineConfiguration() {
engineConfiguration->hardCutRpmRange = 500;
engineConfiguration->engineSnifferRpmThreshold = 2500;
engineConfiguration->sensorSnifferRpmThreshold = 2500;
/**
* Idle control defaults
@ -499,9 +498,6 @@ static void setDefaultEngineConfiguration() {
engineConfiguration->analogInputDividerCoefficient = 2;
#endif
// performance optimization
engineConfiguration->sensorChartMode = SC_OFF;
setTPS1Calibration(convertVoltageTo10bitADC(0),
convertVoltageTo10bitADC(5),
convertVoltageTo10bitADC(5),

View File

@ -25,11 +25,6 @@ public:
bool useOddFireWastedSpark = false;
/**
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings
*/
sensor_chart_e sensorChartMode = SC_OFF;
float injectionStage2Fraction = 0;
Timer crankingTimer;

View File

@ -411,18 +411,6 @@ typedef enum __attribute__ ((__packed__)) {
} air_pressure_sensor_type_e;
typedef enum __attribute__ ((__packed__)) {
SC_OFF = 0,
/**
* You would use this value if you want to see a detailed graph of your trigger events
*/
SC_TRIGGER = 1,
// unused 2
SC_RPM_ACCEL = 3,
SC_DETAILED_RPM = 4,
} sensor_chart_e;
typedef enum {
REVERSE = -1,
NEUTRAL = 0,

View File

@ -51,10 +51,6 @@
#include "vr_pwm.h"
#include "adc_subscription.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif /* EFI_SENSOR_CHART */
#if EFI_TUNER_STUDIO
#include "tunerstudio.h"
#endif /* EFI_TUNER_STUDIO */
@ -413,10 +409,6 @@ void commonInitEngineController() {
engine->injectionEvents.addFuelEvents();
#endif // EFI_ENGINE_CONTROL
#if EFI_SENSOR_CHART
initSensorChart();
#endif /* EFI_SENSOR_CHART */
#if EFI_PROD_CODE || EFI_SIMULATOR
initSettings();

View File

@ -17,10 +17,6 @@
#include "trigger_central.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif // EFI_SENSOR_CHART
#include "engine_sniffer.h"
// See RpmCalculator::checkIfSpinning()
@ -286,16 +282,6 @@ void rpmShaftPositionCallback(TriggerEvent ckpSignalType,
rpmState->onNewEngineCycle();
}
#if EFI_SENSOR_CHART
// this 'index==0' case is here so that it happens after cycle callback so
// it goes into sniffer report into the first position
if (getEngineState()->sensorChartMode == SC_TRIGGER) {
angle_t crankAngle = engine->triggerCentral.getCurrentEnginePhase(nowNt).value_or(0);
int signal = 1000 * (int)ckpSignalType + trgEventIndex;
scAddData(crankAngle, signal);
}
#endif /* EFI_SENSOR_CHART */
// Always update instant RPM even when not spinning up
engine->triggerCentral.instantRpm.updateInstantRpm(
engine->triggerCentral.triggerState.currentCycle.current_index,

View File

@ -25,10 +25,6 @@
#include "trigger_central.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif /* EFI_SENSOR_CHART */
// not have a real physical pin - it's only used for engine sniffer
static NamedOutputPin mapAveragingPin("map");

View File

@ -24,7 +24,6 @@
#include "pch.h"
#if !EFI_UNIT_TEST
#include "sensor_chart.h"
#include "trigger_central.h"
persistent_config_container_s persistentState CCM_OPTIONAL;

View File

@ -49,10 +49,6 @@ static void setIdleSolenoidFrequency(int value) {
incrementGlobalConfigurationVersion();
}
static void setSensorChartMode(int value) {
engineConfiguration->sensorChartMode = (sensor_chart_e) value;
}
static void setCrankingRpm(int value) {
engineConfiguration->cranking.rpm = value;
}
@ -399,7 +395,6 @@ const command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
#if EFI_ENGINE_CONTROL
{"cranking_rpm", setCrankingRpm},
{"injection_mode", setInjectionMode},
{"sensor_chart_mode", setSensorChartMode},
{"timing_mode", setTimingMode},
{CMD_ENGINE_TYPE, setEngineType},
{"rpm_hard_limit", setRpmHardLimit},

View File

@ -39,10 +39,6 @@
#include "trigger_universal.h"
#include "trigger_mercedes.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif /* EFI_SENSOR_CHART */
TriggerWaveform::TriggerWaveform() {
initialize(OM_NONE, SyncEdge::Rise);
}

View File

@ -2,15 +2,6 @@
#include "pch.h"
#include "instant_rpm_calculator.h"
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif
/**
* sensorChartMode
*/
#include "engine_state.h"
#if EFI_SHAFT_POSITION_INPUT
InstantRpmCalculator::InstantRpmCalculator() :
@ -127,17 +118,6 @@ void InstantRpmCalculator::updateInstantRpm(
m_instantRpm = calculateInstantRpm(triggerShape, triggerFormDetails, index,
nowNt);
#if EFI_SENSOR_CHART
if (getEngineState()->sensorChartMode == SC_RPM_ACCEL || getEngineState()->sensorChartMode == SC_DETAILED_RPM) {
angle_t currentAngle = triggerFormDetails->eventAngles[current_index];
if (engineConfiguration->sensorChartMode == SC_DETAILED_RPM) {
scAddData(currentAngle, m_instantRpm);
} else {
scAddData(currentAngle, m_instantRpmRatio);
}
}
#endif /* EFI_SENSOR_CHART */
}
#endif // EFI_SHAFT_POSITION_INPUT

View File

@ -1,6 +1,6 @@
DEVELOPMENT_DIR=$(PROJECT_DIR)/development
DEV_SRC_CPP = $(DEVELOPMENT_DIR)/sensor_chart.cpp \
DEV_SRC_CPP = \
$(DEVELOPMENT_DIR)/engine_emulator.cpp \
$(DEVELOPMENT_DIR)/engine_sniffer.cpp \
$(DEVELOPMENT_DIR)/logic_analyzer.cpp \

View File

@ -1,95 +0,0 @@
/**
* @file sensor_chart.cpp
*
* @date Dec 20, 2013
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
#include "sensor_chart.h"
#if EFI_SENSOR_CHART
#include "status_loop.h"
#if EFI_TEXT_LOGGING
static char LOGGING_BUFFER[SC_BUFFER_SIZE];
static Logging scLogging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
#endif /* EFI_TEXT_LOGGING */
static int initialized = false;
enum class ScState {
PreArm,
Armed,
Logging,
Full
};
static ScState state = ScState::PreArm;
static uint32_t lastRevCount = 0;
void scAddData(float angle, float value) {
#if EFI_TEXT_LOGGING
if (!initialized) {
return; // this is possible because of initialization sequence
}
// Don't log if we need a flush
if (state == ScState::Full) {
return;
}
auto currentRev = getRevolutionCounter();
if (state == ScState::PreArm) {
// nothing to do - we just need to grab the rev counter once so we can detect a change
state = ScState::Armed;
} else if (state == ScState::Armed) {
// If armed, wait for a NEW revolution to start
if (lastRevCount != currentRev) {
state = ScState::Logging;
// Reset logging and append header
scLogging.reset();
scLogging.appendPrintf(PROTOCOL_ANALOG_CHART LOG_DELIMITER);
}
} else if (state == ScState::Logging) {
// If running and the revolution idx changes, terminate logging and wait for flush
if (lastRevCount != currentRev) {
state = ScState::Full;
}
}
lastRevCount = currentRev;
if (state == ScState::Logging) {
if (scLogging.remainingSize() > 100) {
scLogging.appendPrintf( "%.2f|%.2f|", angle, value);
} else {
state = ScState::Full;
}
}
#endif /* EFI_TEXT_LOGGING */
}
void initSensorChart(void) {
#if EFI_SIMULATOR
printf("initSensorChart\n");
#endif
initialized = true;
}
void publishSensorChartIfFull() {
if (state != ScState::Full) {
return;
}
scLogging.appendPrintf(LOG_DELIMITER);
scheduleLogging(&scLogging);
state = ScState::Armed;
}
#endif /* EFI_SENSOR_CHART */

View File

@ -1,14 +0,0 @@
/**
* @file sensor_chart.h
*
* @date Dec 20, 2013
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#include "global.h"
void scAddData(float angle, float value);
void initSensorChart(void);
void publishSensorChartIfFull();

View File

@ -21,7 +21,6 @@
#include "accelerometer.h"
#include "eficonsole.h"
#include "console_io.h"
#include "sensor_chart.h"
#include "idle_thread.h"
#include "kline.h"

View File

@ -365,7 +365,6 @@ end_struct
custom engine_type_e 4 bits, S32, @OFFSET@, [0:6], @@engine_type_e_auto_enum@@
engine_type_e engineType;http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
uint16_t sensorSnifferRpmThreshold;Disable sensor sniffer above this rpm;"RPM", 1, 0, 0, 10000, 0
uint16_t launchRpm;A secondary Rev limit engaged by the driver to help launch the vehicle faster;"rpm", 1, 0, 0, 20000, 0
uint16_t rpmHardLimit;Hard cut above this RPM. Set slightly lower than absolute maximum RPM - may overshoot slightly.;"rpm", 1, 0, 0, 20000, 0
uint16_t engineSnifferRpmThreshold;Engine sniffer would be disabled above this rpm;"RPM", 1, 0, 0, 30000, 0
@ -777,11 +776,6 @@ custom uart_device_e 1 bits, U08, @OFFSET@, [0:1], "Off", "UART1", "UART2", "UAR
Gpio spi3sckPin;
uart_device_e consoleUartDevice;
#define sensor_chart_e_enum "none", "trigger", "INVALID", "RPM ACCEL", "DETAILED RPM", "INVALID"
custom sensor_chart_e 1 bits, S08, @OFFSET@, [0:2], @@sensor_chart_e_enum@@
sensor_chart_e sensorChartMode;FOME console sensor sniffer mode;
#define CAN_RX_PREFIX "CAN_rx"
#define CRITICAL_PREFIX "CRITICAL"
@ -1798,7 +1792,6 @@ end_struct
#define MLQ_FIELD_HEADER_SIZE 89
#define PROTOCOL_OUTPIN "outpin"
#define PROTOCOL_ANALOG_CHART "analog_chart"
#define PROTOCOL_ENGINE_SNIFFER "wave_chart"
#define PROTOCOL_VERSION_TAG "fomeVersion"
#define PROTOCOL_TEST_RESPONSE_TAG "ts_p_alive"

View File

@ -3881,8 +3881,6 @@ dialog = launch_control_stateDialog, "launch_control_state"
field = "Access point password", wifiAccessPointPassword
dialog = monitoringSettings, "FOME Console Settings"
field = "Sensor Sniffer", sensorChartMode
field = " Threshold", sensorSnifferRpmThreshold
field = "Engine Sniffer Threshold", engineSnifferRpmThreshold
dialog = generalSettings, "Fuel"

View File

@ -1,70 +0,0 @@
package com.rusefi;
import com.devexperts.logging.Logging;
import com.opensr5.Logger;
import com.rusefi.config.generated.Fields;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
* This command line utility is part of rusEfi unknown trigger discovery
* https://rusefi.com/wiki/index.php?title=Manual:Software:Trigger
*
* 2/15/2015
*/
public class AverageAnglesUtil {
private final static Logging log = Logging.getLogging(AverageAnglesUtil.class);
public static final String KEY = Fields.PROTOCOL_ANALOG_CHART;
public static final String ANALOG_CHART = KEY + ",";
private static int currentRpm = -1;
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.out.println("One parameter expected: log_file_name.csv");
System.exit(-1);
}
String fileName = args[0];
runUtil(fileName);
}
public static void runUtil(String fileName) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
String line;
AverageAngles aa = new AverageAngles();
while ((line = br.readLine()) != null) {
int index = line.indexOf(Logger.END_OF_TIMESTAND_TAG);
if (index == -1)
continue;
line = line.substring(index + Logger.END_OF_TIMESTAND_TAG.length());
if (line.startsWith("time")) {
String[] f = line.split(",");
if (f.length > 3 && f[2].equals("rpm")) {
currentRpm = Integer.parseInt(f[3]);
log.info("New rpm " + currentRpm);
}
continue;
}
if (!line.startsWith(ANALOG_CHART))
continue;
line = line.substring(ANALOG_CHART.length());
String[] p = line.split(",");
line = p[0];
aa.add(currentRpm, line);
log.info("Got " + line);
}
System.out.println(aa.getReport());
}
}

View File

@ -159,7 +159,6 @@ public class IoUtil {
public static void realHardwareConnect(LinkManager linkManager, String port) {
linkManager.getEngineState().registerStringValueAction(Fields.PROTOCOL_OUTPIN, (s) -> { });
linkManager.getEngineState().registerStringValueAction(AverageAnglesUtil.KEY, (s) -> { });
try {
linkManager.connect(port).await(60, TimeUnit.SECONDS);

View File

@ -16,8 +16,6 @@ import static com.rusefi.config.generated.Fields.PROTOCOL_ES_UP;
*
* Date: 6/23/13
* Andrey Belomutskiy, (c) 2013-2020
*
* @see SensorSnifferPane
*/
public class EngineReport {
public static final String ENGINE_CHART = Fields.PROTOCOL_ENGINE_SNIFFER;

View File

@ -1,56 +0,0 @@
package com.rusefi;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.ui.UIContext;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import static com.rusefi.ui.util.LocalizedMessages.RESET;
public class AverageAnglePanel {
private final JPanel panel = new JPanel(new BorderLayout());
private final AverageAngles aa = new AverageAngles();
private final JTextArea text = new JTextArea();
public AverageAnglePanel(UIContext uiContext) {
JButton reset = new JButton(RESET.getMessage());
reset.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
aa.clear();
showResults();
}
});
panel.add(reset, BorderLayout.NORTH);
panel.add(new JScrollPane(text, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
@Override
public Dimension getPreferredSize() {
return new Dimension(400, 400);
}
}, BorderLayout.CENTER);
uiContext.sensorSnifferCentral.addListener(new SensorSnifferCentral.AnalogChartListener() {
@Override
public void onAnalogChart(String message) {
int rpm = (int) SensorCentral.getInstance().getValue(Sensor.RPMValue);
aa.add(rpm, message);
showResults();
}
}
);
}
private void showResults() {
String test = aa.getReport();
text.setText(test);
}
public JPanel getPanel() {
return panel;
}
}

View File

@ -45,8 +45,6 @@ public class ConsoleUI {
public final UIContext uiContext = new UIContext();
public boolean showTriggerShapePane = false;
/**
* We can listen to tab activation event if we so desire
*/
@ -85,19 +83,12 @@ public class ConsoleUI {
tabbedPaneAdd("Engine Sniffer", engineSnifferPanel.getPanel(), engineSnifferPanel.getTabSelectedListener());
SensorSnifferPane sensorSniffer = new SensorSnifferPane(uiContext, getConfig().getRoot().getChild("sensor_sniffer"));
tabbedPaneAdd("Sensor Sniffer", sensorSniffer.getPanel(), sensorSniffer.getTabSelectedListener());
// if (tabbedPane.paneSettings.showStimulatorPane && !LinkManager.isSimulationMode && !LinkManager.isLogViewerMode(port)) {
// // todo: rethink this UI? special command line key to enable it?
// EcuStimulator stimulator = EcuStimulator.getInstance();
// tabbedPane.addTab("ECU stimulation", stimulator.getPanel());
// }
// TODO: always false?
if (showTriggerShapePane)
tabbedPane.addTab("Trigger Shape", new AverageAnglePanel(uiContext).getPanel());
int selectedIndex = getConfig().getRoot().getIntProperty(TAB_INDEX, DEFAULT_TAB_INDEX);
if (selectedIndex < tabbedPane.tabbedPane.getTabCount())
tabbedPane.tabbedPane.setSelectedIndex(selectedIndex);

View File

@ -1,25 +0,0 @@
package com.rusefi;
import com.rusefi.io.LinkManager;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class SensorSnifferCentral {
private final List<AnalogChartListener> listeners = new CopyOnWriteArrayList<>();
public SensorSnifferCentral(LinkManager linkManager) {
linkManager.getEngineState().registerStringValueAction(AverageAnglesUtil.KEY, (String message) -> {
for (AnalogChartListener listener : listeners)
listener.onAnalogChart(message);
});
}
public void addListener(AnalogChartListener listener) {
listeners.add(listener);
}
interface AnalogChartListener {
void onAnalogChart(String analogChart);
}
}

View File

@ -1,193 +0,0 @@
package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.config.generated.Fields;
import com.rusefi.ui.RpmLabel;
import com.rusefi.ui.RpmModel;
import com.rusefi.ui.UIContext;
import com.rusefi.ui.config.ConfigUiField;
import com.rusefi.ui.config.EnumConfigField;
import com.rusefi.ui.engine.EngineSnifferPanel;
import com.rusefi.core.preferences.storage.Node;
import com.rusefi.ui.util.URLLabel;
import com.rusefi.ui.util.UiUtils;
import com.rusefi.ui.widgets.AnyCommand;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import java.util.List;
import static com.devexperts.logging.Logging.getLogging;
/**
* Date: 12/21/13
* Andrey Belomutskiy, (c) 2013-2020
*/
public class SensorSnifferPane {
private static final Logging log = getLogging(SensorSnifferPane.class);
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Analog_Chart";
private final TreeMap<Double, Double> values = new TreeMap<>();
private final SensorSnifferCanvas canvas = new SensorSnifferCanvas();
private double minX;
private double maxX;
private double minY;
private double maxY;
private final JPanel content = new JPanel(new BorderLayout());
private final AnyCommand command;
private boolean paused = false;
public SensorSnifferPane(UIContext uiContext, Node config) {
uiContext.sensorSnifferCentral.addListener(new SensorSnifferCentral.AnalogChartListener() {
@Override
public void onAnalogChart(final String message) {
// this callback is invoked from the connectivity thread, need to handle in AWT for thread-safety
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
unpackValues(message, values);
if (!paused) {
processValues();
UiUtils.trueRepaint(canvas);
}
}
});
}
});
final JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
final JButton pauseButton = UiUtils.createPauseButton();
JButton clearButton = UiUtils.createClearButton();
clearButton.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
clear();
UiUtils.trueRepaint(canvas);
setPaused(pauseButton, false);
}
});
upperPanel.add(clearButton);
JButton saveImageButton = UiUtils.createSaveImageButton();
upperPanel.add(saveImageButton);
saveImageButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int rpm = RpmModel.getInstance().getValue();
String fileName = FileLog.getDate() + "_rpm_" + rpm + "_sensor" + ".png";
UiUtils.saveImageWithPrompt(fileName, upperPanel, canvas);
}
}
);
upperPanel.add(pauseButton);
upperPanel.add(new RpmLabel(2).getContent());
command = AnyCommand.createField(uiContext, config, true, false);
upperPanel.add(command.getContent());
upperPanel.add(new URLLabel(EngineSnifferPanel.HELP_TEXT, HELP_URL));
pauseButton.addActionListener(new
ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setPaused(pauseButton, !paused);
}
}
);
// upperPanel.setBorder(BorderFactory.createLineBorder(Color.orange));
content.add(upperPanel, BorderLayout.NORTH);
content.add(canvas, BorderLayout.CENTER);
final JPanel lowerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
lowerPanel.setBorder(BorderFactory.createLineBorder(Color.cyan));
content.add(lowerPanel, BorderLayout.SOUTH);
lowerPanel.add(new EnumConfigField(uiContext, Fields.SENSORCHARTMODE, "Mode").getContent());
lowerPanel.add(new ConfigUiField(uiContext, Fields.SENSORSNIFFERRPMTHRESHOLD, "RPM threshold").getContent());
}
private void setPaused(JButton pauseButton, boolean isPaused) {
paused = isPaused;
UiUtils.setPauseButtonText(pauseButton, paused);
}
private void clear() {
minX = maxX = minY = maxY = 0;
values.clear();
}
private void processValues() {
List<Double> keys = new ArrayList<>(values.keySet());
minX = keys.get(0);
maxX = keys.get(keys.size() - 1);
log.info("Analog chart from " + minX + " to " + maxX);
TreeSet<Double> sortedValues = new TreeSet<>(values.values());
List<Double> values = new ArrayList<>(sortedValues);
minY = values.get(0);
maxY = values.get(values.size() - 1);
}
public JComponent getPanel() {
return content;
}
public ActionListener getTabSelectedListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
command.requestFocus();
}
};
}
private class SensorSnifferCanvas extends JComponent {
@Override
public void paint(Graphics g) {
super.paint(g);
Dimension size = getSize();
g.drawString("X range from " + minX + " to " + maxX, 4, 20);
g.drawString("Y range from " + minY + " to " + maxY, 4, 40);
int prevX = 0;
int prevY = size.height;
double bX = size.width / (maxX - minX);
double bY = size.height / (maxY - minY);
for (Map.Entry<Double, Double> e : values.entrySet()) {
int x = (int) ((e.getKey() - minX) * bX);
int y = size.height - (int) ((e.getValue() - minY) * bY);
g.drawLine(prevX, prevY, x, y);
prevX = x;
prevY = y;
}
}
}
private static void unpackValues(String chart, TreeMap<Double, Double> destination) {
destination.clear();
String[] tokens = chart.split("\\|");
for (int i = 0; i < tokens.length - 1; ) {
String key = tokens[i++];
String value = tokens[i++];
destination.put(Double.parseDouble(key), Double.parseDouble(value));
}
}
}

View File

@ -1,6 +1,5 @@
package com.rusefi.ui;
import com.rusefi.SensorSnifferCentral;
import com.rusefi.io.CommandQueue;
import com.rusefi.io.LinkManager;
import org.jetbrains.annotations.NotNull;
@ -8,8 +7,6 @@ import org.jetbrains.annotations.NotNull;
public class UIContext {
private final LinkManager linkManager = new LinkManager();
public final SensorSnifferCentral sensorSnifferCentral = new SensorSnifferCentral(linkManager);
@NotNull
public LinkManager getLinkManager() {
return linkManager;

View File

@ -171,7 +171,6 @@ CSRC = $(ALLCSRC) \
# setting.
CPPSRC = $(ALLCPPSRC) \
$(CHIBIOS)/os/various/cpp_wrappers/ch.cpp \
$(PROJECT_DIR)/development/sensor_chart.cpp \
$(HW_LAYER_DRIVERS_CPP) \
$(HW_LAYER_DRIVERS_CORE_CPP) \
$(CONSOLE_SRC_CPP) \

View File

@ -32,8 +32,6 @@
#define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE
#define EFI_ENABLE_ENGINE_WARNING TRUE
#define SC_BUFFER_SIZE 4000
#define EFI_BOOST_CONTROL TRUE
#define EFI_CLOCK_LOCKS FALSE
@ -117,8 +115,6 @@
#define EFI_VEHICLE_SPEED TRUE
#define EFI_TCU FALSE
#define EFI_SENSOR_CHART TRUE
#define EFI_TUNER_STUDIO TRUE
#define EFI_BOARD_TEST FALSE

View File

@ -38,7 +38,6 @@ CPPSRC += $(ALLCPPSRC) \
$(FRAMEWORK_SRC_CPP) \
$(TESTS_SRC_CPP) \
$(DEVELOPMENT_DIR)/engine_sniffer.cpp \
$(DEVELOPMENT_DIR)/sensor_chart.cpp \
$(CONSOLE_COMMON_SRC_CPP) \
$(PROJECT_DIR)/config/boards/hellen/hellen_board_id.cpp \
$(PROJECT_DIR)/hw_layer/drivers/can/can_hw.cpp \

View File

@ -19,10 +19,6 @@
#define EFI_ENGINE_SNIFFER TRUE
#define EFI_SENSOR_CHART TRUE
#define SC_BUFFER_SIZE 4000
#define EFI_PRINTF_FUEL_DETAILS TRUE
#define EFI_CJ125 TRUE

View File

@ -348,11 +348,10 @@ TEST(trigger, testTriggerDecoder) {
testTriggerDecoder2("testCitroen", engine_type_e::CITROEN_TU3JP, 0, 0.4833, 0);
testTriggerDecoder2("testMitsu", engine_type_e::MITSU_4G93, 9, 0.3553, 0.3752);
{
EngineTestHelper eth(engine_type_e::MITSU_4G93);
eth.persistentConfig.engineConfiguration.sensorChartMode = SC_DETAILED_RPM;
applyNonPersistentConfiguration();
}