auto-sync

This commit is contained in:
rusEfi 2014-09-07 18:02:51 -05:00
parent f7835b3df1
commit b557a2e2ed
4 changed files with 28 additions and 15 deletions

View File

@ -29,6 +29,7 @@ typedef struct {
} cranking_parameters_s;
#define INJECTION_PIN_COUNT 12
#define IGNITION_PIN_COUNT 12
#define FUEL_RPM_COUNT 16
#define FUEL_LOAD_COUNT 16
@ -120,7 +121,7 @@ typedef struct {
brain_pin_e injectionPins[INJECTION_PIN_COUNT];
pin_output_mode_e injectionPinMode;
brain_pin_e ignitionPins[12];
brain_pin_e ignitionPins[IGNITION_PIN_COUNT];
pin_output_mode_e ignitionPinMode;
brain_pin_e malfunctionIndicatorPin;

View File

@ -428,6 +428,20 @@ static void setPotSpi(int spi) {
boardConfiguration->digitalPotentiometerSpiDevice = (spi_device_e) spi;
}
static void setIgnitionPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr);
if (index < 0 || index > IGNITION_PIN_COUNT)
return;
brain_pin_e pin = parseBrainPin(pinName);
// todo: extract method - code duplication with other 'set_xxx_pin' methods?
if (pin == GPIO_INVALID) {
scheduleMsg(&logger, "invalid pin name [%s]", pinName);
return;
}
scheduleMsg(&logger, "setting ignition pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->ignitionPins[index] = pin;
}
static void setInjectionPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr);
if (index < 0 || index > INJECTION_PIN_COUNT)
@ -688,6 +702,7 @@ void initSettings(void) {
#if EFI_PROD_CODE
addConsoleActionSS("set_injection_pin", setInjectionPin);
addConsoleActionSS("set_ignition_pin", setIgnitionPin);
addConsoleActionSS("set_trigger_input_pin", setTriggerInputPin);
addConsoleActionSS("set_trigger_simulator_pin", setTriggerSimulatorPin);
addConsoleActionSS("set_trigger_simulator_mode", setTriggerSimulatorMode);

View File

@ -19,10 +19,12 @@ import javax.swing.*;
* @see WavePanel
*/
public class Launcher extends FrameHelper {
public static final int CONSOLE_VERSION = 20140905;
public static final int CONSOLE_VERSION = 20140907;
public static final boolean SHOW_STIMULATOR = true;
private final String port;
public Launcher(String port) {
this.port = port;
FileLog.MAIN.start();
LinkManager.start(port);
@ -50,9 +52,6 @@ public class Launcher extends FrameHelper {
tabbedPane.setSelectedIndex(2);
// tabbedPane.setSelectedIndex(5);
for (String p : SerialPortList.getPortNames())
MessagesCentral.getInstance().postMessage(Launcher.class, "Available port: " + p);
showFrame(tabbedPane);
}
@ -73,7 +72,7 @@ public class Launcher extends FrameHelper {
}
private void setTitle(String value) {
frame.setTitle("Console " + CONSOLE_VERSION + "; firmware=" + value);
frame.setTitle("Console " + CONSOLE_VERSION + "; firmware=" + value + "@" + port);
}
@Override
@ -103,6 +102,8 @@ public class Launcher extends FrameHelper {
if (isPortDefined) {
new Launcher(args[0]);
} else {
for (String p : SerialPortList.getPortNames())
MessagesCentral.getInstance().postMessage(Launcher.class, "Available port: " + p);
PortLookupFrame.chooseSerialPort();
}

View File

@ -34,18 +34,14 @@ import java.util.concurrent.CountDownLatch;
* @see EcuStimulatorSandbox
*/
public class EcuStimulator {
// private static final String TITLE = "Spark Advance";
private static final String TITLE = "Fuel Table";
private static final String DELIMITER = ",";
private static final long SLEEP_TIME = 300;
private static final double EPS = 0.001;
public boolean isDisplayingDwell = true;
public boolean isDisplayingFuel = true;
private static final Sensor DWELL_SENSOR = Sensor.DWELL1;
public static final Sensor ADVANCE_SENSOR = Sensor.ADVANCE1;
private static final Sensor DWELL_SENSOR = Sensor.DWELL0;
public static final Sensor ADVANCE_SENSOR = Sensor.ADVANCE0;
private static final int MEASURES = 7;
// private static final String C_FILE_NAME = "advance_map.c";
@ -66,7 +62,7 @@ public class EcuStimulator {
private final JLabel statusLabel = new JLabel();
private EcuStimulator() {
JPanel panel = ChartHelper.create3DControl(data, model, TITLE);
JPanel panel = ChartHelper.create3DControl(data, model, isDisplayingFuel ? "Fuel Table" : "Timing");
content.add(statusLabel, BorderLayout.NORTH);
content.add(panel, BorderLayout.CENTER);
content.add(inputs.getContent(), BorderLayout.SOUTH);
@ -100,7 +96,7 @@ public class EcuStimulator {
ResultListener listener = new ResultListener() {
@Override
public void onResult(int rpm, double engineLoad, double advance, double dwell) {
data.addPoint(new Point3D(rpm, engineLoad, isDisplayingDwell ? (float) dwell : (float) advance));
data.addPoint(new Point3D(rpm, engineLoad, isDisplayingFuel ? (float) dwell : (float) advance));
model.plot().execute();
String msg = putValue("rpm", rpm) +