auto-sync

This commit is contained in:
rusEfi 2015-05-01 23:08:51 -04:00
parent 0f43fef112
commit 3e50b1266f
8 changed files with 45 additions and 16 deletions

View File

@ -66,7 +66,7 @@ float getBaseAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {
float iatCorrection = iatAdvanceCorrectionMap.getValue(engine->engineState.clt, (float) rpm); float iatCorrection = iatAdvanceCorrectionMap.getValue(engine->engineState.clt, (float) rpm);
float result = advanceMap.getValue(engineLoad, (float) rpm) + iatCorrection; float result = advanceMap.getValue(engineLoad, (float) rpm) + iatCorrection;
engine->m.advanceTime = GET_TIMESTAMP() - engine->m.beforeAdvance; engine->m.advanceLookupTime = GET_TIMESTAMP() - engine->m.beforeAdvance;
return result; return result;
} }

View File

@ -112,6 +112,9 @@ typedef struct {
#define MAF_DECODING_CACHE_MULT (MAF_DECODING_CACHE_SIZE / 5.0) #define MAF_DECODING_CACHE_MULT (MAF_DECODING_CACHE_SIZE / 5.0)
typedef struct { typedef struct {
uint32_t beforeMainTrigger;
uint32_t mainTriggerCallbackTime;
uint32_t beforeIgnitionMath; uint32_t beforeIgnitionMath;
uint32_t ignitionMathTime; uint32_t ignitionMathTime;
@ -125,7 +128,7 @@ typedef struct {
uint32_t zeroTestTime; uint32_t zeroTestTime;
uint32_t beforeAdvance; uint32_t beforeAdvance;
uint32_t advanceTime; uint32_t advanceLookupTime;
uint32_t beforeFuelCalc; uint32_t beforeFuelCalc;
uint32_t fuelCalcTime; uint32_t fuelCalcTime;

View File

@ -73,9 +73,9 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_S) {
} }
floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) { floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
floatms_t tpsAccelEnrich = engine->tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_F); floatms_t tpsAccelEnrich = ENGINE(tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_F));
if (engineConfiguration->algorithm == LM_SPEED_DENSITY) { if (CONFIG(algorithm) == LM_SPEED_DENSITY) {
return tpsAccelEnrich + getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER); return tpsAccelEnrich + getSpeedDensityFuel(rpm PASS_ENGINE_PARAMETER);
} else if (engineConfiguration->algorithm == LM_REAL_MAF) { } else if (engineConfiguration->algorithm == LM_REAL_MAF) {
float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F); float maf = getRealMaf(PASS_ENGINE_PARAMETER_F) + engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F);

View File

@ -53,7 +53,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
float getCrankshaftRevolutionTimeMs(int rpm); float getCrankshaftRevolutionTimeMs(int rpm);
#define isCrankingR(rpm) ((rpm) > 0 && (rpm) < engineConfiguration->cranking.rpm) #define isCrankingR(rpm) ((rpm) > 0 && (rpm) < CONFIG(cranking.rpm))
float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F); float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F);

View File

@ -298,6 +298,7 @@ static void ignitionCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
* Both injection and ignition are controlled from this method. * Both injection and ignition are controlled from this method.
*/ */
void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_S) { void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_S) {
engine->m.beforeMainTrigger = GET_TIMESTAMP();
if (hasFirmwareError()) { if (hasFirmwareError()) {
/** /**
* In case on a major error we should not process any more events. * In case on a major error we should not process any more events.
@ -409,6 +410,10 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
if (diff > 0) if (diff > 0)
hsAdd(&mainLoopHisto, diff); hsAdd(&mainLoopHisto, diff);
#endif /* EFI_HISTOGRAMS */ #endif /* EFI_HISTOGRAMS */
if (eventIndex == 0) {
engine->m.mainTriggerCallbackTime = GET_TIMESTAMP() - engine->m.beforeMainTrigger;
}
} }
#if EFI_WAVE_CHART || defined(__DOXYGEN__) #if EFI_WAVE_CHART || defined(__DOXYGEN__)

View File

@ -294,18 +294,18 @@ void triggerInfo(Engine *engine) {
scheduleMsg(logger, "zeroTestTime=%d maxHowFarOff=%d", engine->m.zeroTestTime, maxHowFarOff); scheduleMsg(logger, "zeroTestTime=%d maxHowFarOff=%d", engine->m.zeroTestTime, maxHowFarOff);
maxHowFarOff = 0; maxHowFarOff = 0;
scheduleMsg(logger, "advanceLookupTime=%d", engine->m.advanceTime); scheduleMsg(logger, "advanceLookupTime=%d", engine->m.advanceLookupTime);
scheduleMsg(logger, scheduleMsg(logger,
"ignitionMathTime=%d schTime=%d injectonSchTime=%d", "ignitionMathTime=%d ignitionSchTime=%d injectonSchTime=%d",
engine->m.ignitionMathTime, engine->m.ignitionSchTime, engine->m.ignitionMathTime, engine->m.ignitionSchTime,
engine->m.injectonSchTime); engine->m.injectonSchTime);
scheduleMsg(logger, "mapTime=%d/hipTime=%d/rpmTime=%d", scheduleMsg(logger, "mapTime=%d/hipTime=%d/rpmTime=%d/mainTriggerCallbackTime=%d",
engine->m.mapAveragingCbTime, engine->m.mapAveragingCbTime,
engine->m.hipCbTime, engine->m.hipCbTime,
engine->m.rpmCbTime); engine->m.rpmCbTime,
engine->m.mainTriggerCallbackTime);
scheduleMsg(logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint); scheduleMsg(logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint);
scheduleMsg(logger, "maxEventQueueTime=%d", maxEventQueueTime); scheduleMsg(logger, "maxEventQueueTime=%d", maxEventQueueTime);

View File

@ -43,6 +43,8 @@ public class GaugesPanel {
}; };
private static final String GAUGES_ROWS = "gauges_rows"; private static final String GAUGES_ROWS = "gauges_rows";
private static final String GAUGES_COLUMNS = "gauges_cols"; private static final String GAUGES_COLUMNS = "gauges_cols";
public static final String SHOW_MESSAGES = "show_messages";
public static final String SHOW_RPM = "show_rpm";
static { static {
if (DEFAULT_LAYOUT.length != SizeSelectorPanel.WIDTH * SizeSelectorPanel.HEIGHT) if (DEFAULT_LAYOUT.length != SizeSelectorPanel.WIDTH * SizeSelectorPanel.HEIGHT)
@ -58,9 +60,10 @@ public class GaugesPanel {
private JPanel lowerRpmPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); private JPanel lowerRpmPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
private JPanel smallMessagePanel = new JPanel(new BorderLayout()); private JPanel smallMessagePanel = new JPanel(new BorderLayout());
public GaugesPanel(Node config) { public GaugesPanel(final Node config) {
this.config = config; this.config = config;
// Radial radial2 = createRadial("title"); showRpmPanel = config.getBoolProperty(SHOW_RPM, true);
showMessagesPanel = config.getBoolProperty(SHOW_MESSAGES, true);
MessagesPanel mp = new MessagesPanel(config, false); MessagesPanel mp = new MessagesPanel(config, false);
smallMessagePanel.add(BorderLayout.NORTH, mp.getButtonPanel()); smallMessagePanel.add(BorderLayout.NORTH, mp.getButtonPanel());
@ -102,16 +105,22 @@ public class GaugesPanel {
JPopupMenu menu = new JPopupMenu(); JPopupMenu menu = new JPopupMenu();
final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM"); final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM");
final JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands");
showRpmItem.setSelected(showRpmPanel); showRpmItem.setSelected(showRpmPanel);
showRpmItem.addActionListener(new ActionListener() { ActionListener showCheckboxListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
GaugesPanel.this.showRpmPanel = showRpmItem.isSelected(); showRpmPanel = showRpmItem.isSelected();
showMessagesPanel = showCommandsItem.isSelected();
config.setProperty(SHOW_RPM, showRpmPanel);
config.setProperty(SHOW_MESSAGES, showMessagesPanel);
applyShowFlags(); applyShowFlags();
} }
}); };
showRpmItem.addActionListener(showCheckboxListener);
showCommandsItem.addActionListener(showCheckboxListener);
menu.add(showRpmItem); menu.add(showRpmItem);
JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands");
showCommandsItem.setSelected(showMessagesPanel); showCommandsItem.setSelected(showMessagesPanel);
menu.add(showCommandsItem); menu.add(showCommandsItem);
menu.add(new JPopupMenu.Separator()); menu.add(new JPopupMenu.Separator());
@ -171,6 +180,7 @@ public class GaugesPanel {
private void applyShowFlags() { private void applyShowFlags() {
lowerRpmPanel.setVisible(showRpmPanel); lowerRpmPanel.setVisible(showRpmPanel);
smallMessagePanel.setVisible(showMessagesPanel);
} }
public JComponent getContent() { public JComponent getContent() {

View File

@ -40,6 +40,13 @@ public class Node {
} }
} }
public boolean getBoolProperty(String key, boolean defaultValue) {
String value = (String) config.get(key);
if (value == null)
return defaultValue;
return Boolean.parseBoolean(value);
}
public void setProperty(String key, String value) { public void setProperty(String key, String value) {
config.put(key, value); config.put(key, value);
} }
@ -48,6 +55,10 @@ public class Node {
config.put(key, "" + value); config.put(key, "" + value);
} }
public void setProperty(String key, boolean value) {
config.put(key, "" + value);
}
public String getProperty(String key, String defaultValue) { public String getProperty(String key, String defaultValue) {
String value = (String) config.get(key); String value = (String) config.get(key);
return value == null ? defaultValue : value; return value == null ? defaultValue : value;