auto-sync
This commit is contained in:
parent
9697d25ff9
commit
b074e31171
|
@ -120,7 +120,8 @@ typedef struct {
|
|||
float debugFloatField5; // 212
|
||||
int debugIntField2; // 216
|
||||
int debugIntField3; // 220
|
||||
int unused3[13];
|
||||
int timeSeconds; // 224
|
||||
int unused3[12];
|
||||
} TunerStudioOutputChannels;
|
||||
|
||||
#endif /* TUNERSTUDIO_CONFIGURATION_H_ */
|
||||
|
|
|
@ -602,6 +602,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
||||
tsOutputChannels->runningFuel = ENGINE(engineState.runningFuel);
|
||||
tsOutputChannels->injectorLagMs = ENGINE(engineState.injectorLag);
|
||||
tsOutputChannels->timeSeconds = getTimeNowSeconds();
|
||||
|
||||
if (engineConfiguration->debugMode == TPS_ACCEL) {
|
||||
tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize();
|
||||
|
|
|
@ -275,5 +275,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 20160205;
|
||||
return 20160212;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,6 @@ public class BinaryProtocol {
|
|||
public void requestOutputChannels() {
|
||||
if (isClosed)
|
||||
return;
|
||||
// try {
|
||||
byte[] response = executeCommand(new byte[]{COMMAND_OUTPUTS}, "output channels", false);
|
||||
if (response == null || response.length != (OUTPUT_CHANNELS_SIZE + 1) || response[0] != RESPONSE_OK)
|
||||
return;
|
||||
|
@ -477,19 +476,16 @@ public class BinaryProtocol {
|
|||
currentOutputs = response;
|
||||
|
||||
for (Sensor sensor : Sensor.values()) {
|
||||
ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4);
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
if (sensor.getType() == FieldType.FLOAT) {
|
||||
|
||||
ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4);
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
double value = bb.getFloat();
|
||||
|
||||
SensorCentral.getInstance().setValue(value, sensor);
|
||||
} else if (sensor.getType() == FieldType.INT) {
|
||||
int value = bb.getInt();
|
||||
SensorCentral.getInstance().setValue(value, sensor);
|
||||
}
|
||||
}
|
||||
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new IllegalStateException(e);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class LinkManager {
|
|||
@Override
|
||||
public void beforeLine(String fullLine) {
|
||||
FileLog.MAIN.logLine(fullLine);
|
||||
ConnectionWatchdog.onDataArrived();
|
||||
}
|
||||
});
|
||||
public static LinkConnector connector;
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.ArrayList;
|
|||
* 2/11/13
|
||||
*/
|
||||
public enum Sensor {
|
||||
RPM("RPM", SensorCategory.SENSOR_INPUTS, "rpm", 8000),
|
||||
MAP("MAP", SensorCategory.SENSOR_INPUTS),
|
||||
MAP_RAW("MAP_RAW", SensorCategory.SENSOR_INPUTS),
|
||||
BARO("Baro", SensorCategory.SENSOR_INPUTS),
|
||||
|
@ -109,6 +108,9 @@ public enum Sensor {
|
|||
debugFloatField4(SensorCategory.OPERATIONS, FieldType.FLOAT, 208, BackgroundColor.MUD, 0, 5),
|
||||
debugFloatField5(SensorCategory.OPERATIONS, FieldType.FLOAT, 212, BackgroundColor.MUD, 0, 5),
|
||||
|
||||
RPM(SensorCategory.SENSOR_INPUTS, FieldType.INT, 0, BackgroundColor.RED, 0, 8000),
|
||||
TIME_SECONDS(SensorCategory.OPERATIONS, FieldType.INT, 224, BackgroundColor.MUD, 0, 5),
|
||||
|
||||
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
|
||||
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),
|
||||
;
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.rusefi.core.EngineState;
|
|||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.io.ConnectionWatchdog;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.serial.PortHolder;
|
||||
import com.rusefi.io.tcp.BinaryProtocolServer;
|
||||
import com.rusefi.maintenance.VersionChecker;
|
||||
import com.rusefi.ui.*;
|
||||
|
@ -33,10 +34,11 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20160209;
|
||||
public static final int CONSOLE_VERSION = 20160212;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
protected static final String SPEED_KEY = "speed";
|
||||
private final String port;
|
||||
private final JTabbedPane tabbedPane = new JTabbedPane();
|
||||
private static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
@ -73,6 +75,7 @@ public class Launcher {
|
|||
FileLog.MAIN.logLine("Console " + CONSOLE_VERSION);
|
||||
|
||||
getConfig().getRoot().setProperty(PORT_KEY, port);
|
||||
getConfig().getRoot().setProperty(SPEED_KEY, PortHolder.BAUD_RATE);
|
||||
|
||||
LinkManager.start(port);
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ public class StartupFrame {
|
|||
|
||||
connectPanel.add(comboPorts);
|
||||
final JComboBox<String> comboSpeeds = createSpeedCombo();
|
||||
connectPanel.add(comboSpeeds);
|
||||
|
||||
final JButton connect = new JButton("Connect");
|
||||
connectPanel.add(connect);
|
||||
|
@ -197,17 +198,16 @@ public class StartupFrame {
|
|||
comboPorts.removeAllItems();
|
||||
for (final String port : ports)
|
||||
comboPorts.addItem(port);
|
||||
String defaultPort = getConfig().getRoot().getProperty(Launcher.PORT_KEY);
|
||||
String defaultPort = getConfig().getRoot().getProperty(Launcher.PORT_KEY);
|
||||
comboPorts.setSelectedItem(defaultPort);
|
||||
}
|
||||
|
||||
private static JComboBox<String> createSpeedCombo() {
|
||||
JComboBox<String> combo = new JComboBox<>();
|
||||
int defaultSpeed = 115200;
|
||||
for (int speed : new int[]{9600, 14400, 38400, 115200, 460800, 921600})
|
||||
String defaultSpeed = getConfig().getRoot().getProperty(Launcher.SPEED_KEY, "115200");
|
||||
for (int speed : new int[]{9600, 14400, 19200, 38400, 115200, 460800, 921600})
|
||||
combo.addItem(Integer.toString(speed));
|
||||
combo.setSelectedItem(Integer.toString(defaultSpeed));
|
||||
combo.setSelectedItem(defaultSpeed);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,9 @@ package com.rusefi.ui;
|
|||
|
||||
import com.rusefi.core.EngineTimeListener;
|
||||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.io.ConnectionWatchdog;
|
||||
import com.rusefi.io.LinkManager;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -10,6 +13,9 @@ import java.awt.event.ActionListener;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* todo: eliminate logic duplication with {@link ConnectionWatchdog}
|
||||
*/
|
||||
public class ConnectionStatus {
|
||||
// todo: react to any message as connected? how to know if message from controller, not internal message?
|
||||
private static final String FATAL_MESSAGE_PREFIX = "FATAL";
|
||||
|
@ -33,6 +39,13 @@ public class ConnectionStatus {
|
|||
}
|
||||
});
|
||||
|
||||
SensorCentral.getInstance().addListener(Sensor.TIME_SECONDS, new SensorCentral.SensorListener() {
|
||||
@Override
|
||||
public void onSensorUpdate(double value) {
|
||||
setConnected(true);
|
||||
}
|
||||
});
|
||||
|
||||
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
||||
@Override
|
||||
public void onMessage(Class clazz, String message) {
|
||||
|
@ -42,12 +55,12 @@ public class ConnectionStatus {
|
|||
});
|
||||
}
|
||||
|
||||
private void markConnected(Timer timer1) {
|
||||
private void markConnected(Timer timer) {
|
||||
setConnected(true);
|
||||
/**
|
||||
* this timer will catch engine inactivity and display a warning
|
||||
*/
|
||||
timer1.restart();
|
||||
timer.restart();
|
||||
}
|
||||
|
||||
private void setConnected(boolean isConnected) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
|
@ -41,6 +44,7 @@ public class RpmLabel {
|
|||
@Override
|
||||
public void onConnectionStatus(boolean isConnected) {
|
||||
if (isConnected) {
|
||||
rpmValue.setText("" + SensorCentral.getInstance().getValue(Sensor.RPM));
|
||||
rpmValue.setForeground(Color.green);
|
||||
} else {
|
||||
rpmValue.setText(NO_CONNECTION);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class RpmModel {
|
|||
private static final double SMOOTHING_RATIO = 0.05;
|
||||
private int displayedValue;
|
||||
private int value;
|
||||
private final List<RpmListener> listeners = new ArrayList<RpmListener>();
|
||||
private final List<RpmListener> listeners = new ArrayList<>();
|
||||
private long timeAtLastUpdate;
|
||||
|
||||
public static RpmModel getInstance() {
|
||||
|
|
Loading…
Reference in New Issue