auto-sync
This commit is contained in:
parent
516438115a
commit
d021a93aed
|
@ -118,6 +118,28 @@ static void setIdleValvePosition(int positionPercent) {
|
|||
doSetIdleValvePosition(positionPercent);
|
||||
}
|
||||
|
||||
static int idlePositionBeforeBlip;
|
||||
static efitimeus_t timeToStopBlip = 0;
|
||||
|
||||
/**
|
||||
* I use this questionable feature to tune acceleration enrichment
|
||||
*/
|
||||
static void blipIdle(int idlePosition, int durationMs) {
|
||||
if (timeToStopBlip != 0) {
|
||||
return; // already in idle blip
|
||||
}
|
||||
idlePositionBeforeBlip = boardConfiguration->idlePosition;
|
||||
setIdleValvePosition(idlePosition);
|
||||
timeToStopBlip = getTimeNowUs() + 1000 * durationMs;
|
||||
}
|
||||
|
||||
static void undoIdleBlipIfNeeded() {
|
||||
if (timeToStopBlip != 0 && getTimeNowUs() > timeToStopBlip) {
|
||||
timeToStopBlip = 0;
|
||||
setIdleValvePosition(idlePositionBeforeBlip);
|
||||
}
|
||||
}
|
||||
|
||||
static msg_t ivThread(int param) {
|
||||
(void) param;
|
||||
chRegSetThreadName("IdleValve");
|
||||
|
@ -136,6 +158,8 @@ static msg_t ivThread(int param) {
|
|||
getHwPin(boardConfiguration->clutchUpPin));
|
||||
}
|
||||
|
||||
undoIdleBlipIfNeeded();
|
||||
|
||||
if (engineConfiguration->idleMode != IM_AUTO) {
|
||||
// let's re-apply CLT correction
|
||||
doSetIdleValvePosition(boardConfiguration->idlePosition);
|
||||
|
@ -208,6 +232,8 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
|
|||
addConsoleActionI("set_idle_position", setIdleValvePosition);
|
||||
|
||||
addConsoleActionI("set_idle_enabled", (VoidInt) setIdleControlEnabled);
|
||||
|
||||
addConsoleActionII("blipidle", blipIdle);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -291,5 +291,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20150830;
|
||||
return 20150901;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see com.rusefi.StartupFrame
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20150831;
|
||||
public static final int CONSOLE_VERSION = 20150901;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
@ -40,8 +40,6 @@ public class Launcher {
|
|||
private final JTabbedPane tabbedPane = new JTabbedPane();
|
||||
private static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
public static int defaultFontSize;
|
||||
|
||||
private static Frame staticFrame;
|
||||
private final TableEditorPane tableEditor = new TableEditorPane();
|
||||
private final SettingsTab settingsTab = new SettingsTab();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SensorLiveGraph extends JPanel {
|
|||
public void mouseClicked(MouseEvent e) {
|
||||
if (SwingUtilities.isRightMouseButton(e)) {
|
||||
showPopupMenu(e);
|
||||
} else if (e.getClickCount() == 2) {
|
||||
// } else if (e.getClickCount() == 2) {
|
||||
// handleDoubleClick(e, gauge, sensor);
|
||||
}
|
||||
}
|
||||
|
@ -192,25 +192,16 @@ public class SensorLiveGraph extends JPanel {
|
|||
return; // it's hopeless
|
||||
g.setColor(Color.black);
|
||||
|
||||
double minValue;
|
||||
double maxValue;
|
||||
if (autoScale) {
|
||||
VisibleRange getVisibleRange = new VisibleRange().invoke();
|
||||
minValue = getVisibleRange.getMinValue();
|
||||
maxValue = getVisibleRange.getMaxValue();
|
||||
} else {
|
||||
minValue = sensor.getMinValue();
|
||||
maxValue = sensor.getMaxValue();
|
||||
}
|
||||
VisibleRange range = getRange();
|
||||
|
||||
paintGraph(g, d, minValue, maxValue);
|
||||
paintGraph(g, d, range.minValue, range.maxValue);
|
||||
|
||||
g.setColor(Color.red);
|
||||
int minY = d.height;
|
||||
int maxY = g.getFont().getSize();
|
||||
g.drawString(String.format("%.2f", minValue), 5, minY);
|
||||
g.drawString(String.format("%.2f", (minValue + maxValue) / 2), 5, (minY + maxY) / 2);
|
||||
g.drawString(String.format("%.2f", maxValue), 5, maxY);
|
||||
g.drawString(String.format("%.2f", range.minValue), 5, minY);
|
||||
g.drawString(String.format("%.2f", (range.minValue + range.maxValue) / 2), 5, (minY + maxY) / 2);
|
||||
g.drawString(String.format("%.2f", range.maxValue), 5, maxY);
|
||||
|
||||
g.setColor(Color.blue);
|
||||
String sensorName = sensor.getName() + " ";
|
||||
|
@ -224,6 +215,16 @@ public class SensorLiveGraph extends JPanel {
|
|||
paintLastValue(g, d);
|
||||
}
|
||||
|
||||
private VisibleRange getRange() {
|
||||
VisibleRange range;
|
||||
if (autoScale) {
|
||||
range = VisibleRange.findRange(values);
|
||||
} else {
|
||||
range = new VisibleRange(sensor.getMinValue(), sensor.getMaxValue());
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
private void paintLastValue(Graphics g, Dimension d) {
|
||||
Double last = values.getLast();
|
||||
if (!Double.isNaN(last)) {
|
||||
|
@ -253,21 +254,18 @@ public class SensorLiveGraph extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private class VisibleRange {
|
||||
private double minValue;
|
||||
private double maxValue;
|
||||
private static class VisibleRange {
|
||||
private final double minValue;
|
||||
private final double maxValue;
|
||||
|
||||
public double getMinValue() {
|
||||
return minValue;
|
||||
public VisibleRange(double minValue, double maxValue) {
|
||||
this.minValue = minValue;
|
||||
this.maxValue = maxValue;
|
||||
}
|
||||
|
||||
public double getMaxValue() {
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
public VisibleRange invoke() {
|
||||
minValue = Double.MAX_VALUE;
|
||||
maxValue = -Double.MAX_VALUE;
|
||||
public static VisibleRange findRange(LinkedList<Double> values) {
|
||||
double minValue = Double.MAX_VALUE;
|
||||
double maxValue = -Double.MAX_VALUE;
|
||||
for (double value : values) {
|
||||
minValue = Math.min(minValue, value);
|
||||
maxValue = Math.max(maxValue, value);
|
||||
|
@ -282,7 +280,7 @@ public class SensorLiveGraph extends JPanel {
|
|||
minValue -= 0.05 * diff;
|
||||
maxValue += 0.05 * diff;
|
||||
}
|
||||
return this;
|
||||
return new VisibleRange(minValue, maxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,4 +98,8 @@ public class Node {
|
|||
"prefix='" + prefix + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public void setProperty(String key, double value) {
|
||||
setProperty(key, Double.toString(value));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue