auto-sync

This commit is contained in:
rusEfi 2015-01-12 19:07:40 -06:00
parent f8ee4cf62c
commit afc48b6ad4
16 changed files with 3941 additions and 55 deletions

View File

@ -420,6 +420,4 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPinMode = OM_DEFAULT;
}

View File

@ -96,9 +96,7 @@ void Engine::watchdog() {
isSpinning = false;
#if EFI_PROD_CODE || EFI_SIMULATOR
scheduleMsg(&logger, "engine has STOPPED");
if (engineConfiguration->isPrintTriggerSynchDetails) {
triggerInfo(engine);
}
triggerInfo(engine);
#endif
stopPins();

View File

@ -17,18 +17,27 @@
#include "trigger_structure.h"
#include "table_helper.h"
/**
* This class knows about when to inject fuel
*/
class FuelSchedule {
public:
FuelSchedule();
void clear();
ActuatorEventList events;
/**
* this method schedules all fuel events for an engine cycle
*/
void addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_S);
void registerInjectionEvent(
io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
/**
* This is a performance optimization for https://sourceforge.net/p/rusefi/tickets/64/
* TODO: better data structure? better algorithm?
*/
uint8_t hasEvents[PWM_PHASE_MAX_COUNT];
private:
void clear();
void registerInjectionEvent(io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
};
/**

View File

@ -452,7 +452,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[3] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[4] = ADC_FAST;
boardConfiguration->adcHwChannelEnabled[5] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[6] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[7] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[11] = ADC_SLOW;

View File

@ -17,7 +17,8 @@
/**
* This structure defines an angle position within the trigger
*/
typedef struct {
class event_trigger_position_s {
public:
/**
* That's trigger event index
*/
@ -27,7 +28,7 @@ typedef struct {
* Angle offset from the trigger event
*/
float angleOffset;
} event_trigger_position_s;
};
typedef struct {
event_trigger_position_s position;

View File

@ -97,7 +97,6 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
OutputSignalList injectonSignals CCM_OPTIONAL;
void initializeIgnitionActions(float advance, float dwellAngle, IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
efiAssertVoid(engineConfiguration->cylindersCount > 0, "cylindersCount");
list->reset();
@ -120,26 +119,24 @@ void initializeIgnitionActions(float advance, float dwellAngle, IgnitionEventLis
}
void FuelSchedule::registerInjectionEvent(io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
ActuatorEventList *list = &events;
if (!isSimultanious && !isPinAssigned(pin)) {
// todo: extact method for this index math
warning(OBD_PCM_Processor_Fault, "no_pin_inj #%d", (int) pin - (int) INJECTOR_1_OUTPUT + 1);
}
InjectionEvent *ev = list->add();
InjectionEvent *ev = events.add();
if (ev == NULL) {
// error already reported
return;
}
OutputSignal *actuator = injectonSignals.add();
initOutputSignal(actuator, pin);
ev->isSimultanious = isSimultanious;
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized trigger_shape_s");
if (ev == NULL) {
// error already reported
return;
}
ev->actuator = actuator;
findTriggerPosition(&ev->position, angle PASS_ENGINE_PARAMETER);

View File

@ -161,10 +161,6 @@ static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLARE_ENGINE
ActuatorEventList *source = &fs->events;
/**
* This is a performance optimization for https://sourceforge.net/p/rusefi/tickets/64/
* TODO: better data structure? better algorithm?
*/
if (!fs->hasEvents[eventIndex])
return;

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
(via_costs 50)
(plane_via_costs 5)
(start_ripup_costs 100)
(start_pass_no 108)
(start_pass_no 413)
(layer_rule F.Cu
(active on)
(preferred_direction vertical)

View File

@ -16,6 +16,7 @@ public enum FileLog {
SIMULATOR_CONSOLE;
private static final String DIR = "out/";
public static final String END_OF_TIMESTAND_TAG = "<EOT>: ";
@Nullable
private OutputStream fileLog; // null if not opened yet or already closed
@ -58,7 +59,7 @@ public enum FileLog {
if (fileLog == null)
return;
try {
fileLog.write((new Date() + ": " + fullLine + "\r\n").getBytes());
fileLog.write((new Date() + END_OF_TIMESTAND_TAG + fullLine + "\r\n").getBytes());
fileLog.flush();
System.out.println(fullLine);
} catch (IOException e) {

View File

@ -53,10 +53,9 @@ public class EngineState {
public void onResponse(String message) {
String response = unpackString(message);
if (response != null) {
// todo: improve this hack
int i = response.indexOf("2014: ");
int i = response.indexOf(FileLog.END_OF_TIMESTAND_TAG);
if (i != -1)
response = response.substring(i + 6);
response = response.substring(i + FileLog.END_OF_TIMESTAND_TAG.length());
String copy = response;
listener.beforeLine(response);
while (!response.isEmpty())

View File

@ -13,13 +13,13 @@ import javax.swing.*;
* this is the main entry point of rusEfi ECU console
* <p/>
* <p/>
* Date: 12/25/12
* (c) Andrey Belomutskiy
* 12/25/12
* (c) Andrey Belomutskiy 2013-2015
*
* @see WavePanel
*/
public class Launcher extends FrameHelper {
public static final int CONSOLE_VERSION = 20141228;
public static final int CONSOLE_VERSION = 20150112;
public static final boolean SHOW_STIMULATOR = true;
private final String port;

View File

@ -10,7 +10,7 @@ import java.util.List;
public class ChartRepository {
private static final ChartRepository instance = new ChartRepository();
private final List<String> charts = new ArrayList<String>();
private final List<String> charts = new ArrayList<>();
private ChartRepository() {
}
@ -20,6 +20,8 @@ public class ChartRepository {
}
public String getChart(int index) {
if (index < 0 || index >= charts.size())
throw new IllegalArgumentException("No chart by index " + index);
return charts.get(index);
}

View File

@ -32,7 +32,7 @@ public class ChartScrollControl {
prev.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
previousPage();
previousPage();
}
});
@ -54,11 +54,16 @@ public class ChartScrollControl {
}
private void previousPage() {
if (ChartRepository.getInstance().getSize() < index.get()) {
index.set(0);
}
if (ChartRepository.getInstance().getSize() == 0)
return;
if (index.intValue() > 0) {
index.decrementAndGet();
showChart();
} else if (index.intValue() == 0) {
// let's go to the last chart
// let's go to the last chart if chart repository is not empty
index.set(ChartRepository.getInstance().getSize() - 1);
showChart();
}

View File

@ -18,6 +18,9 @@ import java.io.FileFilter;
import java.util.Arrays;
/**
* This tab is the entry point of rusEfi own log browser
* <p/>
* <p/>
* 7/27/13
* (c) Andrey Belomutskiy
*/
@ -28,6 +31,7 @@ public class LogViewer extends JPanel {
return pathname.getName().contains("MAIN_rfi_report");
}
};
public static final String DEFAULT_LOG_LOCATION = "out";
private final JLabel folderLabel = new JLabel();
private final JLabel fileLabel = new JLabel();
private final DefaultListModel<FIleItem> fileListModel = new DefaultListModel<FIleItem>();
@ -43,8 +47,10 @@ public class LogViewer extends JPanel {
setBackground(Color.green);
// todo: this is not perfect
openFolder("out");
/**
* scan the default folder on start-up
*/
openFolder(DEFAULT_LOG_LOCATION);
JPanel folderPanel = new JPanel(new FlowLayout());
@ -64,8 +70,6 @@ public class LogViewer extends JPanel {
folderPanel.add(folderLabel);
folderPanel.add(fileLabel);
//folderPanel.setBackground(Color.red);
add(folderPanel, BorderLayout.NORTH);
refreshCountPanel();
@ -107,15 +111,14 @@ public class LogViewer extends JPanel {
throw new IllegalStateException("Not directory: " + folder);
File[] files = folder.listFiles(FILE_FILTER);
Arrays.sort(files);
Arrays.sort(files);
fileListModel.removeAllElements();
for (File file : files)
fileListModel.addElement(getFileDesc(file));
if (files.length > 0 && LinkManager.isLogViewer())
openFile(files[0]);
}
private FIleItem getFileDesc(File file) {
@ -153,18 +156,16 @@ public class LogViewer extends JPanel {
private void openFile(File file) {
fileLabel.setText("Current file: " + file.getName());
String filename = file.getAbsolutePath();
EngineState.EngineStateListener listener = new EngineState.EngineStateListenerImpl() {
};
EngineState.EngineStateListener listener = new EngineState.EngineStateListenerImpl();
ChartRepository.getInstance().clear();
EngineState engineState = new EngineState(listener);
engineState.registerStringValueAction("wave_chart", new EngineState.ValueCallback<String>() {
@Override
public void onUpdate(String value) {
FileLog.rlog("chart " + value);
FileLog.rlog("Got wave_chart: " + value);
ChartRepository.getInstance().addChart(value);
}
});
FileUtils.readFile2(filename, engineState);

View File

@ -7,8 +7,7 @@
#ifndef ENGINE_TEST_HELPER_H_
#define ENGINE_TEST_HELPER_H_
#include "engine_configuration.h"
#include "ec2.h"
#include "engine.h"
#include "trigger_central.h"
#include "rpm_calculator.h"