refactoring: engine sniffer magic constants
This commit is contained in:
parent
f5452a922f
commit
7a7dbb8c30
|
@ -414,15 +414,15 @@ void printOverallStatus(systime_t nowSeconds) {
|
|||
int seconds = getTimeNowSeconds();
|
||||
printCurrentState(&logger, seconds, getConfigurationName(engineConfiguration->engineType), FIRMWARE_ID);
|
||||
#if EFI_PROD_CODE
|
||||
printOutPin(CRANK1, CONFIGB(triggerInputPins)[0]);
|
||||
printOutPin(CRANK2, CONFIGB(triggerInputPins)[1]);
|
||||
printOutPin(VVT_NAME, engineConfiguration->camInputs[0]);
|
||||
printOutPin(HIP_NAME, CONFIGB(hip9011IntHoldPin));
|
||||
printOutPin(TACH_NAME, CONFIGB(tachOutputPin));
|
||||
printOutPin(DIZZY_NAME, engineConfiguration->dizzySparkOutputPin);
|
||||
printOutPin(PROTOCOL_CRANK1, CONFIGB(triggerInputPins)[0]);
|
||||
printOutPin(PROTOCOL_CRANK2, CONFIGB(triggerInputPins)[1]);
|
||||
printOutPin(PROTOCOL_VVT_NAME, engineConfiguration->camInputs[0]);
|
||||
printOutPin(PROTOCOL_HIP_NAME, CONFIGB(hip9011IntHoldPin));
|
||||
printOutPin(PROTOCOL_TACH_NAME, CONFIGB(tachOutputPin));
|
||||
printOutPin(PROTOCOL_DIZZY_NAME, engineConfiguration->dizzySparkOutputPin);
|
||||
#if EFI_WAVE_ANALYZER
|
||||
printOutPin(WA_CHANNEL_1, CONFIGB(logicAnalyzerPins)[0]);
|
||||
printOutPin(WA_CHANNEL_2, CONFIGB(logicAnalyzerPins)[1]);
|
||||
printOutPin(PROTOCOL_WA_CHANNEL_1, CONFIGB(logicAnalyzerPins)[0]);
|
||||
printOutPin(PROTOCOL_WA_CHANNEL_2, CONFIGB(logicAnalyzerPins)[1]);
|
||||
#endif /* EFI_WAVE_ANALYZER */
|
||||
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
// https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename
|
||||
#include <rusefi_hw_enums.h>
|
||||
|
||||
#define HIP_NAME "HIP"
|
||||
#define TACH_NAME "tach"
|
||||
#define DIZZY_NAME "dizzy"
|
||||
|
||||
#define ENUM_16_BITS 20000
|
||||
|
||||
#define DIGIPOT_COUNT 4
|
||||
|
|
|
@ -1521,10 +1521,25 @@
|
|||
#define primingSquirtDurationMs_offset 96
|
||||
#define primingSquirtDurationMs_offset_hex 60
|
||||
#define PROTOCOL_ANALOG_CHART "analog_chart"
|
||||
#define PROTOCOL_COIL1_SHORT_NAME "c1"
|
||||
#define PROTOCOL_CRANK1 "t1"
|
||||
#define PROTOCOL_CRANK2 "t2"
|
||||
#define PROTOCOL_CRANK3 "t3"
|
||||
#define PROTOCOL_DIZZY_NAME "dizzy"
|
||||
#define PROTOCOL_ENGINE_SNIFFER "wave_chart"
|
||||
#define PROTOCOL_ES_DOWN "d"
|
||||
#define PROTOCOL_ES_UP "u"
|
||||
#define PROTOCOL_HIP_NAME "HIP"
|
||||
#define PROTOCOL_INJ1_SHORT_NAME "i1"
|
||||
#define PROTOCOL_OUTPIN "outpin"
|
||||
#define PROTOCOL_TACH_NAME "tach"
|
||||
#define PROTOCOL_TEST_RESPONSE_TAG "ts_p_alive"
|
||||
#define PROTOCOL_VERSION_TAG "rusEfiVersion"
|
||||
#define PROTOCOL_VVT_NAME "VVT"
|
||||
#define PROTOCOL_WA_CHANNEL_1 "input1"
|
||||
#define PROTOCOL_WA_CHANNEL_2 "input2"
|
||||
#define PROTOCOL_WA_CHANNEL_3 "input3"
|
||||
#define PROTOCOL_WA_CHANNEL_4 "input4"
|
||||
#define RPM_1_BYTE_PACKING_MULT 50
|
||||
#define rpmHardLimit_offset 416
|
||||
#define rpmHardLimit_offset_hex 1a0
|
||||
|
@ -1722,6 +1737,7 @@
|
|||
#define tle8888_csPinMode_offset_hex c22
|
||||
#define tle8888spiDevice_offset 4000
|
||||
#define tle8888spiDevice_offset_hex fa0
|
||||
#define TOP_DEAD_CENTER_MESSAGE "r"
|
||||
#define TOTAL_CONFIG_SIZE 20000
|
||||
#define TOTAL_CONFIG_SIZE_hex 4e20
|
||||
#define tps1_1AdcChannel_offset 512
|
||||
|
|
|
@ -37,7 +37,7 @@ static const char *sparkNames[] = { "coil1", "coil2", "coil3", "coil4", "coil5",
|
|||
"coil9", "coil10", "coil11", "coil12"};
|
||||
|
||||
// these short names are part of engine sniffer protocol
|
||||
static const char *sparkShortNames[] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8",
|
||||
static const char *sparkShortNames[] = { PROTOCOL_COIL1_SHORT_NAME, "c2", "c3", "c4", "c5", "c6", "c7", "c8",
|
||||
"c9", "cA", "cB", "cD"};
|
||||
|
||||
static const char *injectorNames[] = { "injector1", "injector2", "injector3", "injector4", "injector5", "injector6",
|
||||
|
@ -49,8 +49,8 @@ static const char *injectorShortNames[] = { "i1", "i2", "i3", "i4", "i5", "i6",
|
|||
static const char *auxValveShortNames[] = { "a1", "a2"};
|
||||
|
||||
EnginePins::EnginePins() {
|
||||
dizzyOutput.name = DIZZY_NAME;
|
||||
tachOut.name = TACH_NAME;
|
||||
dizzyOutput.name = PROTOCOL_DIZZY_NAME;
|
||||
tachOut.name = PROTOCOL_TACH_NAME;
|
||||
|
||||
efiAssertVoid(CUSTOM_ERR_PIN_COUNT_TOO_LARGE, (sizeof(sparkNames) / sizeof(char*)) >= IGNITION_PIN_COUNT, "spark pin count");
|
||||
for (int i = 0; i < IGNITION_PIN_COUNT;i++) {
|
||||
|
@ -243,7 +243,7 @@ void NamedOutputPin::setHigh() {
|
|||
|
||||
#if EFI_ENGINE_SNIFFER
|
||||
|
||||
addEngineSnifferEvent(getShortName(), WC_UP);
|
||||
addEngineSnifferEvent(getShortName(), PROTOCOL_ES_UP);
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void NamedOutputPin::setLow() {
|
|||
#endif /* EFI_DEFAILED_LOGGING */
|
||||
|
||||
#if EFI_ENGINE_SNIFFER
|
||||
addEngineSnifferEvent(getShortName(), WC_DOWN);
|
||||
addEngineSnifferEvent(getShortName(), PROTOCOL_ES_DOWN);
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,6 @@
|
|||
#include "global.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
// see TOP_DEAD_CENTER_MESSAGE in rusEfi console source code
|
||||
#define TOP_DEAD_CENTER_MESSAGE "r"
|
||||
|
||||
#define WC_DOWN "d"
|
||||
#define WC_UP "u"
|
||||
/**
|
||||
* See also 'CRANK1' in java rusEfi console code
|
||||
*/
|
||||
#define CRANK1 "t1"
|
||||
#define CRANK2 "t2"
|
||||
#define CRANK3 "t3"
|
||||
|
||||
#define VVT_NAME "VVT"
|
||||
|
||||
// we use this value in case of noise on trigger input lines
|
||||
#define NOISY_RPM -1
|
||||
#define UNREALISTIC_RPM 30000
|
||||
|
|
|
@ -89,7 +89,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E
|
|||
}
|
||||
|
||||
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
addEngineSnifferEvent(VVT_NAME, front == TV_RISE ? WC_UP : WC_DOWN);
|
||||
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
|
||||
|
||||
if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
|
||||
return;
|
||||
|
@ -227,7 +227,7 @@ void TriggerCentral::resetCounters() {
|
|||
static char shaft_signal_msg_index[15];
|
||||
|
||||
static const bool isUpEvent[6] = { false, true, false, true, false, true };
|
||||
static const char *eventId[6] = { CRANK1, CRANK1, CRANK2, CRANK2, CRANK3, CRANK3 };
|
||||
static const char *eventId[6] = { PROTOCOL_CRANK1, PROTOCOL_CRANK1, PROTOCOL_CRANK2, PROTOCOL_CRANK2, PROTOCOL_CRANK3, PROTOCOL_CRANK3 };
|
||||
|
||||
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (!ENGINE(isEngineChartEnabled)) { // this is here just as a shortcut so that we avoid engine sniffer as soon as possible
|
||||
|
|
|
@ -62,7 +62,7 @@ static void waAnaWidthCallback(WaveReader *reader) {
|
|||
reader->riseEventCounter++;
|
||||
reader->lastActivityTimeUs = nowUs;
|
||||
assertIsrContext(CUSTOM_ERR_6670);
|
||||
addEngineSnifferEvent(reader->name, WC_UP);
|
||||
addEngineSnifferEvent(reader->name, PROTOCOL_ES_UP);
|
||||
|
||||
uint32_t width = nowUs - reader->periodEventTimeUs;
|
||||
reader->last_wave_low_widthUs = width;
|
||||
|
@ -76,7 +76,7 @@ void WaveReader::onFallEvent() {
|
|||
fallEventCounter++;
|
||||
lastActivityTimeUs = nowUs;
|
||||
assertIsrContext(CUSTOM_ERR_6670);
|
||||
addEngineSnifferEvent(name, WC_DOWN);
|
||||
addEngineSnifferEvent(name, PROTOCOL_ES_DOWN);
|
||||
|
||||
efitick_t width = nowUs - widthEventTimeUs;
|
||||
last_wave_high_widthUs = width;
|
||||
|
@ -265,8 +265,8 @@ void initWaveAnalyzer(Logging *sharedLogger) {
|
|||
return;
|
||||
}
|
||||
#if EFI_WAVE_ANALYZER
|
||||
initWave(WA_CHANNEL_1, 0);
|
||||
initWave(WA_CHANNEL_2, 1);
|
||||
initWave(PROTOCOL_WA_CHANNEL_1, 0);
|
||||
initWave(PROTOCOL_WA_CHANNEL_2, 1);
|
||||
|
||||
addTriggerEventListener(waTriggerEventListener, "wave analyzer", engine);
|
||||
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
#include "digital_input_hw.h"
|
||||
#include "engine_sniffer.h"
|
||||
|
||||
#define WA_CHANNEL_1 "input1"
|
||||
#define WA_CHANNEL_2 "input2"
|
||||
#define WA_CHANNEL_3 "input3"
|
||||
#define WA_CHANNEL_4 "input4"
|
||||
|
||||
class WaveReader {
|
||||
public:
|
||||
WaveReader();
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#if EFI_HIP_9011
|
||||
|
||||
static NamedOutputPin intHold(HIP_NAME);
|
||||
static NamedOutputPin intHold(PROTOCOL_HIP_NAME);
|
||||
|
||||
extern uint32_t lastExecutionCount;
|
||||
extern EnginePins enginePins;
|
||||
|
|
|
@ -1238,6 +1238,31 @@ end_struct
|
|||
#define PROTOCOL_VERSION_TAG "rusEfiVersion"
|
||||
#define PROTOCOL_TEST_RESPONSE_TAG "ts_p_alive"
|
||||
|
||||
! Engine Sniffer Protocol
|
||||
#define PROTOCOL_ES_DOWN "d"
|
||||
#define PROTOCOL_ES_UP "u"
|
||||
#define TOP_DEAD_CENTER_MESSAGE "r"
|
||||
|
||||
! Engine Sniffer channel names
|
||||
#define PROTOCOL_CRANK1 "t1"
|
||||
#define PROTOCOL_CRANK2 "t2"
|
||||
#define PROTOCOL_CRANK3 "t3"
|
||||
|
||||
#define PROTOCOL_VVT_NAME "VVT"
|
||||
#define PROTOCOL_HIP_NAME "HIP"
|
||||
#define PROTOCOL_TACH_NAME "tach"
|
||||
#define PROTOCOL_DIZZY_NAME "dizzy"
|
||||
|
||||
#define PROTOCOL_WA_CHANNEL_1 "input1"
|
||||
#define PROTOCOL_WA_CHANNEL_2 "input2"
|
||||
#define PROTOCOL_WA_CHANNEL_3 "input3"
|
||||
#define PROTOCOL_WA_CHANNEL_4 "input4"
|
||||
|
||||
|
||||
|
||||
#define PROTOCOL_COIL1_SHORT_NAME "c1"
|
||||
#define PROTOCOL_INJ1_SHORT_NAME "i1"
|
||||
|
||||
#define GAUGE_NAME_DWELL_DUTY "dwell: coil duty cycle"
|
||||
|
||||
#define GAUGE_COIL_DWELL_TIME "dwell: coil charge time"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sun Aug 18 12:24:07 EDT 2019
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sun Aug 18 14:59:42 EDT 2019
|
||||
|
||||
// by class com.rusefi.output.JavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
@ -999,10 +999,25 @@ public class Fields {
|
|||
public static final int primingSquirtDurationMs_offset = 96;
|
||||
public static final int primingSquirtDurationMs_offset_hex = 60;
|
||||
public static final String PROTOCOL_ANALOG_CHART = "analog_chart";
|
||||
public static final String PROTOCOL_COIL1_SHORT_NAME = "c1";
|
||||
public static final String PROTOCOL_CRANK1 = "t1";
|
||||
public static final String PROTOCOL_CRANK2 = "t2";
|
||||
public static final String PROTOCOL_CRANK3 = "t3";
|
||||
public static final String PROTOCOL_DIZZY_NAME = "dizzy";
|
||||
public static final String PROTOCOL_ENGINE_SNIFFER = "wave_chart";
|
||||
public static final String PROTOCOL_ES_DOWN = "d";
|
||||
public static final String PROTOCOL_ES_UP = "u";
|
||||
public static final String PROTOCOL_HIP_NAME = "HIP";
|
||||
public static final String PROTOCOL_INJ1_SHORT_NAME = "i1";
|
||||
public static final String PROTOCOL_OUTPIN = "outpin";
|
||||
public static final String PROTOCOL_TACH_NAME = "tach";
|
||||
public static final String PROTOCOL_TEST_RESPONSE_TAG = "ts_p_alive";
|
||||
public static final String PROTOCOL_VERSION_TAG = "rusEfiVersion";
|
||||
public static final String PROTOCOL_VVT_NAME = "VVT";
|
||||
public static final String PROTOCOL_WA_CHANNEL_1 = "input1";
|
||||
public static final String PROTOCOL_WA_CHANNEL_2 = "input2";
|
||||
public static final String PROTOCOL_WA_CHANNEL_3 = "input3";
|
||||
public static final String PROTOCOL_WA_CHANNEL_4 = "input4";
|
||||
public static final int RPM_1_BYTE_PACKING_MULT = 50;
|
||||
public static final int rpmHardLimit_offset = 416;
|
||||
public static final int runningLedPin_offset = 1813;
|
||||
|
@ -1114,6 +1129,7 @@ public class Fields {
|
|||
public static final int tle8888_cs_offset = 3105;
|
||||
public static final int tle8888_csPinMode_offset = 3106;
|
||||
public static final int tle8888spiDevice_offset = 4000;
|
||||
public static final String TOP_DEAD_CENTER_MESSAGE = "r";
|
||||
public static final int TOTAL_CONFIG_SIZE = 20000;
|
||||
public static final int tps1_1AdcChannel_offset = 512;
|
||||
public static final int tps1_1AdcChannel_offset_hex = 200;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.rusefi.waves;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +39,7 @@ public class EngineChart {
|
|||
}
|
||||
|
||||
public RevolutionLog getRevolutionsLog() {
|
||||
StringBuilder revolutions = get(RevolutionLog.TOP_DEAD_CENTER_MESSAGE);
|
||||
StringBuilder revolutions = get(Fields.TOP_DEAD_CENTER_MESSAGE);
|
||||
return RevolutionLog.parseRevolutions(revolutions);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.rusefi.config.generated.Fields.PROTOCOL_ES_DOWN;
|
||||
import static com.rusefi.config.generated.Fields.PROTOCOL_ES_UP;
|
||||
|
||||
/**
|
||||
* A model of a digital signal represented as a sequence of {@link UpDown}
|
||||
*
|
||||
|
@ -25,8 +28,6 @@ public class EngineReport implements TimeAxisTranslator {
|
|||
public static final double SYS_TICKS_PER_MS = 100;
|
||||
public static final double RATIO = 0.05;
|
||||
public static final int mult = (int) (100 * SYS_TICKS_PER_MS); // 100ms
|
||||
private static final String WC_DOWN = "d";
|
||||
private static final String WC_UP = "u";
|
||||
|
||||
private final List<UpDown> list;
|
||||
private int maxTime;
|
||||
|
@ -88,15 +89,15 @@ public class EngineReport implements TimeAxisTranslator {
|
|||
List<UpDown> times = new ArrayList<>();
|
||||
|
||||
int index = 0;
|
||||
if (array[0].equals(WC_DOWN))
|
||||
if (array[0].equals(PROTOCOL_ES_DOWN))
|
||||
index += 2;
|
||||
|
||||
while (index + 3 < array.length) {
|
||||
if (!array[index].startsWith(WC_UP)) {
|
||||
if (!array[index].startsWith(PROTOCOL_ES_UP)) {
|
||||
index += 2;
|
||||
continue;
|
||||
}
|
||||
if (!array[index + 2].startsWith(WC_DOWN)) {
|
||||
if (!array[index + 2].startsWith(PROTOCOL_ES_DOWN)) {
|
||||
index += 2;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import static com.rusefi.models.Utils.parseIntWithReason;
|
|||
* (c) Andrey Belomutskiy
|
||||
*/
|
||||
public class RevolutionLog {
|
||||
public static final String TOP_DEAD_CENTER_MESSAGE = "r";
|
||||
private final TreeMap<Integer, Integer> time2rpm;
|
||||
|
||||
public RevolutionLog(TreeMap<Integer, Integer> time2rpm) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.waves.test;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.waves.EngineChart;
|
||||
import com.rusefi.waves.EngineReport;
|
||||
import com.rusefi.waves.RevolutionLog;
|
||||
|
@ -42,7 +43,7 @@ public class EngineChartParserTest {
|
|||
EngineChart result = EngineChartParser.unpackToMap("r!1199!64224414!crank2!u!64225149_3!Injector 2!u!64225149!Spark 1!u!64225249!Injector 2!d!64225303!Spark 1!d!64225649!crank2!d!64226105_4!crank!d!64226980_5!crank2!u!64227730_6!Injector 1!u!64227730!Spark 1!u!64227830!Injector 1!d!64227884!Spark 1!d!64228230!crank2!d!64228678_7!crank2!u!64230212_8!Injector 3!u!64230212!Spark 1!u!64230312!Injector 3!d!64230366!Spark 1!d!64230712!crank2!d!64231156_9!crank!u!64231982_0!crank2!u!64232672_1!Injector 4!u!64232672!Spark 1!u!64232772!Injector 4!d!64232826!Spark 1!d!64233172!crank2!d!64233626_2!r!1200!64234412!crank2!u!64235150_3!Injector 2!u!64235150!Spark 1!u!64235250!Injector 2!d!64235304!Spark 1!d!64235650!crank2!d!64236106_4!crank!d!64236981_5!crank2!u!64237730_6!Injector 1!u!64237730!Spark 1!u!64237830!Injector 1!d!64237884!Spark 1!d!64238230!crank2!d!64238677_7!crank2!u!64240213_8!Injector 3!u!64240213!Spark 1!u!64240313!Injector 3!d!64240367!Spark 1!d!64240713!crank2!d!64241158_9!crank!u!64241982_0!crank2!u!64242674_1!Injector 4!u!64242674!Spark 1!u!64242774!Injector 4!d!64242828!Spark 1!d!64243174!crank2!d!64243625_2!r!1200!64244412!crank2!u!64245149_3!Injector 2!u!64245149!Spark 1!u!64245249!Injector 2!d!64245303!Spark 1!d!64245649!crank2!d!64246106_4!crank!d!64246980_5!crank2!u!64247728_6!Injector 1!u!64247728!Spark 1!u!64247828!Injector 1!d!64247882!Spark 1!d!64248228!crank2!d!64248679_7!crank2!u!64250212_8!Injector 3!u!64250212!Spark 1!u!64250312!Injector 3!d!64250366!Spark 1!d!64250712!crank2!d!64251158_9!crank!u!64251982_0!crank2!u!64252674_1!Injector 4!u!64252674!Spark 1!u!64252774!Injector 4!d!64252828!Spark 1!d!64253174!crank2!d!64253625_2!r!1200!64254412!crank2!u!64255150_3!Injector 2!u!64255150!Spark 1!u!64255250!Injector 2!d!64255304!Spark 1!d!64255650!crank2!d!64256106_4!crank!d!64256982_5!crank2!u!64257728_6!Injector 1!u!64257728!Spark 1!u!64257828!Injector 1!d!64257882!Spark 1!d!64258228!crank2!d!64258678_7!crank2!u!64260214_8!Injector 3!u!64260214!Spark 1!u!64260314!Injector 3!d!64260368!Spark 1!d!64260714!,");
|
||||
assertFalse(result.getMap().isEmpty());
|
||||
|
||||
StringBuilder revolutions = result.get(RevolutionLog.TOP_DEAD_CENTER_MESSAGE);
|
||||
StringBuilder revolutions = result.get(Fields.TOP_DEAD_CENTER_MESSAGE);
|
||||
|
||||
RevolutionLog rl = RevolutionLog.parseRevolutions(revolutions);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class EngineSnifferPanel {
|
|||
|
||||
private final ZoomControl zoomControl = new ZoomControl();
|
||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
||||
private final UpDownImage crank = createImage(NameUtil.CRANK1);
|
||||
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
|
||||
private final ChartScrollControl scrollControl;
|
||||
// todo: move it some sort of a singleton?
|
||||
public final HashMap<String, String> channelName2PhysicalPin = new HashMap<>();
|
||||
|
@ -204,13 +204,13 @@ public class EngineSnifferPanel {
|
|||
private void resetImagePanel() {
|
||||
imagePanel.removeAll();
|
||||
imagePanel.add(crank);
|
||||
images.put(NameUtil.CRANK1, crank);
|
||||
images.put(Fields.PROTOCOL_CRANK1, crank);
|
||||
}
|
||||
|
||||
public void displayChart(String value) {
|
||||
EngineChart map = EngineChartParser.unpackToMap(value);
|
||||
|
||||
StringBuilder revolutions = map.get(RevolutionLog.TOP_DEAD_CENTER_MESSAGE);
|
||||
StringBuilder revolutions = map.get(Fields.TOP_DEAD_CENTER_MESSAGE);
|
||||
|
||||
statusPanel.setRevolutions(revolutions);
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
|
||||
private void createSecondaryImage(String name) {
|
||||
if (images.containsKey(name) || RevolutionLog.TOP_DEAD_CENTER_MESSAGE.equalsIgnoreCase(name))
|
||||
if (images.containsKey(name) || Fields.TOP_DEAD_CENTER_MESSAGE.equalsIgnoreCase(name))
|
||||
return;
|
||||
|
||||
int index = getInsertIndex(name, images.keySet());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.ui.engine;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.Sensor;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -8,20 +9,16 @@ import java.util.TreeMap;
|
|||
|
||||
// todo: merge with EngineChart
|
||||
public class NameUtil {
|
||||
/**
|
||||
* See also 'CRANK1' in rusEfi firmware code
|
||||
*/
|
||||
public static final String CRANK1 = "t1";
|
||||
protected static final Map<String, Sensor> name2sensor = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
static String getUiName(String name) {
|
||||
if (name.isEmpty())
|
||||
return name;
|
||||
if (name.charAt(0) == 't')
|
||||
if (name.charAt(0) == Fields.PROTOCOL_CRANK1.charAt(0))
|
||||
return "Trigger #" + name.substring(1);
|
||||
if (name.charAt(0) == 'c')
|
||||
if (name.charAt(0) == Fields.PROTOCOL_COIL1_SHORT_NAME.charAt(0))
|
||||
return "Coil #" + name.substring(1);
|
||||
if (name.charAt(0) == 'i')
|
||||
if (name.charAt(0) == Fields.PROTOCOL_INJ1_SHORT_NAME.charAt(0))
|
||||
return "Injector #" + name.substring(1);
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.ui.engine.test;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.ui.engine.NameUtil;
|
||||
import com.rusefi.ui.test.WavePanelSandbox;
|
||||
import com.rusefi.waves.EngineChart;
|
||||
|
@ -24,7 +25,7 @@ public class UpDownSandbox {
|
|||
String report = "t1!u_9425!0!t2!u_9426!202!t2!d_9427!604!t2!u_9428!956!t2!d_9429!1382!t2!u_9430!1750!t2!d_9431!2204!t2!u_9432!2573!t2!d_9433!3032!t1!d_9434!3160!t2!u_9435!3427!t2!d_9436!3870!t2!u_9437!4251!t2!d_9438!4730!t2!u_9439!5101!t2!d_9440!5593!t2!u_9441!5972!t1!u_9442!6114!t2!d_9443!8007!t2!u_9444!8392!t2!d_9445!8712!t2!u_9446!9031!t2!d_9447!9397!t2!u_9448!9693!t2!d_9449!10077!t2!u_9450!10388!t2!d_9451!10768!t2!u_9452!11067!t2!d_9453!11478!t2!u_9454!11828!t2!d_9455!12218!t2!u_9456!12566!t2!d_9457!12998!t2!u_9458!13438!t2!d_9459!13836!t2!u_9460!14200!t2!d_9461!14655!t2!u_9462!15036!t2!d_9463!15445!t2!u_9464!15815!t2!d_9465!16283!t2!u_9466!16745!t2!d_9467!17099!t1!d_9468!17420!t2!u_9469!17482!t2!d_9470!17958!t2!u_9471!18336!t2!d_9472!18813!t2!u_9473!19194!t2!d_9474!19683!t2!u_9475!20069!t2!d_9476!20463!t1!u_9477!20626!t2!u_9478!22327!t2!d_9479!22775!t2!u_9480!23091!t1!d_9481!23274!t2!d_9482!23452!t2!u_9483!23738!t2!d_9484!24123!t2!u_9485!24424!t2!d_9486!24803!t2!u_9487!25101!t2!d_9488!25502!t1!u_9489!25642!t2!u_9490!25861!t2!d_9491!26230!t2!u_9492!26611!t2!d_9493!26997!t2!u_9494!27434!t2!d_9495!27818!t2!u_9496!28199!t1!d_9497!28486!t2!d_9498!28656!t2!u_9499!29043!t2!d_9500!29444!t2!u_9501!29834!t2!d_9502!30274!t2!u_9503!30646!t1!u_9504!31000!t2!d_9505!31096!t2!u_9506!31532!t2!d_9507!31951!t2!u_9508!32349!t2!d_9509!32809!t2!u_9510!33185!t2!d_9511!33683!t2!u_9512!34087!t1!d_9513!34091!t2!d_9514!36081!t2!u_9515!36401!t2!d_9516!36775!t2!u_9517!37086!t2!d_9518!37447!t2!u_9519!37749!t2!d_9520!38114!t2!u_9521!38419!t2!d_9522!38787!t2!u_9523!39085!t2!d_9524!39476!t2!u_9525!39836!t2!d_9526!40191!t2!u_9527!40517!t2!d_9528!40941!t2!u_9529!41289!t2!d_9530!41747!t2!u_9531!42152!t2!d_9532!42599!t2!u_9533!42956!t2!d_9534!43386!t2!u_9535!43750!t2!d_9536!44203!t2!u_9537!44572!t1!u_9538!44764!t2!d_9539!45040!t2!u_9540!45404!t2!d_9541!45875!t2!u_9542!46253!t2!d_9543!46746!t2!u_9544!47127!t2!d_9545!47602!t2!u_9546!47986!t1!d_9547!48321!t2!d_9548!48388!t2!u_9549!50288!t2!d_9550!50739!t1!u_9551!50785!t2!u_9552!51035!t2!d_9553!51418!t2!u_9554!51759!t2!d_9555!52090!t2!u_9556!52400!t2!d_9557!52769!t2!u_9558!53090!t2!d_9559!53464!t1!d_9560!53565!t2!u_9561!53773!t2!d_9562!54187!t2!u_9563!54529!t2!d_9564!54946!t2!u_9565!55284!t2!d_9566!55755!t1!u_9567!56041!t2!u_9568!56158!t2!d_9569!56599!t2!u_9570!56965!t2!d_9571!57377!t2!u_9572!57753!t2!d_9573!58201!t2!u_9574!58589!t2!d_9575!59025!t1!d_9576!59229!t2!u_9577!59388!t2!d_9578!59866!t2!u_9579!60244!t2!d_9580!60723!t2!u_9581!61085!t2!d_9582!61585!t2!u_9583!61980!t1!u_9584!62170!t2!d_9585!63992!t2!u_9586!64329!t2!d_9587!64694!t2!u_9588!64993!t2!d_9589!65376!t2!u_9590!65707!t2!d_9591!66055!t2!u_9592!66378!t2!d_9593!66745!t2!u_9594!67049!t2!d_9595!67452!t2!u_9596!67799!t2!d_9597!68190!t2!u_9598!68515!t2!d_9599!68967!t2!u_9600!69412!t2!d_9601!69803!t2!u_9602!70196!t2!d_9603!70629!t2!u_9604!70963!t2!d_9605!71415!t2!u_9606!71862!t2!d_9607!72252!t2!u_9608!72636!t2!d_9609!73068!t2!u_9610!73423!t1!d_9611!73453!t2!d_9612!73923!t2!u_9613!74303!t2!d_9614!74780!t2!u_9615!75160!t2!d_9616!75646!t2!u_9617!76090!t2!d_9618!76424!t1!u_9619!76624!t2!u_9620!78352!t2!d_9621!78744!t2!u_9622!79047!t1!d_9623!79265!t2!d_9624!79422!t2!u_9625!79752!t2!d_9626!80096!t2!u_9627!80393!t2!d_9628!80781!t2!u_9629!81089!t2!d_9630!81483!t1!u_9631!81634!t2!u_9632!81861!t2!d_9633!82216!t2!u_9634!82544!t2!d_9635!82988!t2!u_9636!83335!t2!d_9637!83814!t2!u_9638!84194!t1!d_9639!84534!t2!d_9640!84646!t2!u_9641!84990!t2!d_9642!85429!t2!u_9643!85801!t2!d_9644!86260!t2!u_9645!86621!t1!u_9646!87022!t2!d_9647!87080!t2!u_9648!87435!t2!d_9649!87935!t2!u_9650!88312!t2!d_9651!88789!t2!u_9652!89183!t2!d_9653!89663!t2!u_9654!90043!t1!d_9655!90125!t2!d_9656!92056!t2!u_9657!92381!t2!d_9658!92750!t2!u_9659!93053!t2!d_9660!93423!t2!u_9661!93715!t2!d_9662!94088!t2!u_9663!94426!t2!d_9664!94761!t2!u_9665!95090!t2!d_9666!95450!t2!u_9667!95759!t2!d_9668!96166!t2!u_9669!96526!t2!d_9670!96918!t2!u_9671!97282!t2!d_9672!97721!t2!u_9673!98092!t2!d_9674!98574!t2!u_9675!98930!t2!d_9676!99358!t2!u_9677!99736!t2!d_9678!100183!t2!u_9679!100565!t1!u_9680!100720!t2!d_9681!101010!t2!u_9682!101374!t2!d_9683!101852!t2!u_9684!102239!t2!d_9685!102717!t2!u_9686!103089!t2!d_9687!103578!t2!u_9688!104089!t1!d_9689!104293!t2!d_9690!104365!t2!u_9691!106238!t2!d_9692!106687!t1!u_9693!106763!t2!u_9694!106988!t2!d_9695!107362!t2!u_9696!107719!t2!d_9697!108029!t2!u_9698!108360!t2!d_9699!108704!t2!u_9700!108995!t2!d_9701!109394!t1!d_9702!109509!t2!u_9703!109755!t2!d_9704!110112!t2!u_9705!110422!t2!d_9706!110864!t2!u_9707!111221!t2!d_9708!111657!t1!u_9709!111915!t2!u_9710!112088!t2!d_9711!112486!t2!u_9712!112858!t2!d_9713!113332!t2!u_9714!113762!t2!d_9715!114199!t2!u_9716!114762!t2!d_9717!115104!t1!d_9718!115284!t2!u_9719!115508!t2!d_9720!116034!t2!u_9721!116458!t2!d_9722!116998!t2!u_9723!117426!t2!d_9724!118003!t2!u_9725!118428!t1!u_9726!118667!t2!d_9727!120774!t2!u_9728!121118!t2!d_9729!121561!t2!u_9730!122095!t2!d_9731!122321!t2!u_9732!122761!t2!d_9733!123078!";
|
||||
EngineChart r = EngineChartParser.unpackToMap(report);
|
||||
|
||||
EngineReport wr = new EngineReport(r.get(NameUtil.CRANK1).toString());
|
||||
EngineReport wr = new EngineReport(r.get(Fields.PROTOCOL_CRANK1).toString());
|
||||
|
||||
UpDownImage image = new UpDownImage(wr, "test");
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.ui.test;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
import com.rusefi.ui.engine.NameUtil;
|
||||
import org.junit.Test;
|
||||
|
@ -18,7 +19,7 @@ public class EngineSnifferPanelTest {
|
|||
@Test
|
||||
public void testInsertIndex() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
names.add(NameUtil.CRANK1);
|
||||
names.add(Fields.PROTOCOL_CRANK1);
|
||||
|
||||
String name;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.ui.test;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.ui.engine.NameUtil;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
|
@ -44,7 +45,7 @@ public class WavePanelSandbox {
|
|||
|
||||
double angle = 720.0 * (time - from) / (to - from);
|
||||
|
||||
boolean isPrimary = NameUtil.CRANK1.equals(a);
|
||||
boolean isPrimary = Fields.PROTOCOL_CRANK1.equals(a);
|
||||
// if (!isPrimary)
|
||||
// continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue