auto-sync

This commit is contained in:
rusEfi 2014-11-02 14:03:03 -06:00
parent b6bacbf8bb
commit ee6a864777
9 changed files with 28 additions and 16 deletions

View File

@ -12,10 +12,14 @@ void configureNeon2003TriggerShape(trigger_shape_s *s) {
// voodoo magic - we always need 720 at the end
int base = 10;
s->useRiseEdge = true;
s->gapBothDirections = true;
setTriggerSynchronizationGap(s, 4);
/**
* Theoretical gap is 4, but in reality it's
*/
setTriggerSynchronizationGap2(s, 2.7, 5);
s->addEvent(base + 26, T_PRIMARY, TV_HIGH);
s->addEvent(base + 62, T_PRIMARY, TV_LOW);

View File

@ -36,14 +36,14 @@
static cyclic_buffer errorDetection;
#if ! EFI_PROD_CODE
bool printGapRatio = false;
#else
Logging logger;
#endif /* ! EFI_PROD_CODE */
#if (EFI_PROD_CODE || EFI_SIMULATOR)
Logging logger;
#endif
/**
* @return TRUE is something is wrong with trigger decoding
*/
@ -395,7 +395,7 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con
#endif
void initTriggerDecoder(void) {
#if EFI_PROD_CODE || EFI_SIMULATOR
#if (EFI_PROD_CODE || EFI_SIMULATOR)
initLogging(&logger, "trigger decoder");
#endif
}

View File

@ -284,10 +284,14 @@ void setToothedWheelConfiguration(trigger_shape_s *s, int total, int skipped,
getOperationMode(engineConfiguration));
}
void setTriggerSynchronizationGap(trigger_shape_s *s, float synchGap) {
void setTriggerSynchronizationGap2(trigger_shape_s *s, float syncGapFrom, float syncRatioTo) {
s->isSynchronizationNeeded = true;
s->syncRatioFrom = synchGap * 0.75;
s->syncRatioTo = synchGap * 1.25;
s->syncRatioFrom = syncGapFrom;
s->syncRatioTo = syncRatioTo;
}
void setTriggerSynchronizationGap(trigger_shape_s *s, float synchGap) {
setTriggerSynchronizationGap2(s, synchGap * 0.75f, synchGap * 1.25f);
}
#define S24 (720.0f / 24 / 2)

View File

@ -121,6 +121,7 @@ private:
};
void setTriggerSynchronizationGap(trigger_shape_s *s, float synchGap);
void setTriggerSynchronizationGap2(trigger_shape_s *s, float syncGapFrom, float syncRatioTo);
void setToothedWheelConfiguration(trigger_shape_s *s, int total, int skipped, engine_configuration_s const *engineConfiguration);
#endif /* TRIGGER_STRUCTURE_H_ */

View File

@ -7,7 +7,7 @@ package com.irnems.waves;
public interface TimeAxisTranslator {
int timeToScreen(int time, int width, ZoomProvider zoomProvider);
double screenToTime(int screen, int width, ZoomProvider zoomProvider);
double screenToTime(int screenX, int screenWidth, ZoomProvider zoomProvider);
int getMaxTime();

View File

@ -116,10 +116,10 @@ public class WaveReport implements TimeAxisTranslator {
}
@Override
public double screenToTime(int screen, int width, ZoomProvider zoomProvider) {
public double screenToTime(int screenX, int screenWidth, ZoomProvider zoomProvider) {
// / SYS_TICKS_PER_MS / 1000
double time = 1.0 * screen * getDuration() / width / zoomProvider.getZoomValue() + minTime;
int x2 = timeToScreen((int) time, width, zoomProvider);
double time = 1.0 * screenX * getDuration() / screenWidth / zoomProvider.getZoomValue() + minTime;
int x2 = timeToScreen((int) time, screenWidth, zoomProvider);
// FileLog.rlog("screenToTime " + (screen - x2));
return (int) time;
}

View File

@ -19,7 +19,7 @@ import javax.swing.*;
* @see WavePanel
*/
public class Launcher extends FrameHelper {
public static final int CONSOLE_VERSION = 20141013;
public static final int CONSOLE_VERSION = 20141102;
public static final boolean SHOW_STIMULATOR = true;
private final String port;

View File

@ -35,10 +35,12 @@ public class ChartStatusPanel {
int x = event.getX();
xLabel.setText("" + x);
UpDownImage s = (UpDownImage) event.getSource();
/**
* Time which corresponds to the mouse cursor screen location
*/
double time = translator.screenToTime(x, infoPanel.getWidth(), zoomProvider);
double time = translator.screenToTime(x, s.getWidth(), zoomProvider);
timeLabel.setText("" + String.format("%.5f sec", time));
String text = time2rpm == null ? "n/a" : time2rpm.getCrankAngleByTimeString(time);

View File

@ -532,6 +532,7 @@ void testTriggerDecoder(void) {
printGapRatio = true;
testTriggerDecoder2("neon NGC", DODGE_NEON_2003, 12, 0.5139, 0.0);
printGapRatio = false;
testMazda323();