auto-sync
This commit is contained in:
parent
abb65372d6
commit
1091825172
|
@ -1,4 +1,4 @@
|
|||
// this section was generated by config_definition.jar on Sun Oct 18 13:04:59 EDT 2015
|
||||
// this section was generated by config_definition.jar on Sun Oct 18 19:32:33 EDT 2015
|
||||
// begin
|
||||
#include "rusefi_types.h"
|
||||
typedef struct {
|
||||
|
@ -1044,6 +1044,7 @@ typedef struct {
|
|||
offset 1496 bit 4 */
|
||||
bool_t useConstantDwellDuringCranking : 1;
|
||||
/**
|
||||
* This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
|
||||
offset 1496 bit 5 */
|
||||
bool_t isEngineChartEnabled : 1;
|
||||
/**
|
||||
|
@ -1517,4 +1518,4 @@ typedef struct {
|
|||
} persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated by config_definition.jar on Sun Oct 18 13:04:59 EDT 2015
|
||||
// this section was generated by config_definition.jar on Sun Oct 18 19:32:33 EDT 2015
|
||||
|
|
|
@ -808,6 +808,8 @@ static void setSpiMode(int index, bool mode) {
|
|||
static void enableOrDisable(const char *param, bool isEnabled) {
|
||||
if (strEqualCaseInsensitive(param, "fastadc")) {
|
||||
boardConfiguration->isFastAdcEnabled = isEnabled;
|
||||
} else if (strEqualCaseInsensitive(param, "engine_sniffer")) {
|
||||
engineConfiguration->isEngineChartEnabled = isEnabled;
|
||||
} else if (strEqualCaseInsensitive(param, "step1limimter")) {
|
||||
boardConfiguration->enabledStep1Limiter = isEnabled;
|
||||
} else if (strEqualCaseInsensitive(param, "serial")) {
|
||||
|
|
|
@ -488,7 +488,7 @@ bit hasMapSensor;@see isMapAveragingEnabled
|
|||
bit hasBaroSensor
|
||||
bit hasAfrSensor
|
||||
bit useConstantDwellDuringCranking
|
||||
bit isEngineChartEnabled
|
||||
bit isEngineChartEnabled;This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
|
||||
bit isCanEnabled
|
||||
bit hasCltSensor
|
||||
bit canReadEnabled
|
||||
|
|
|
@ -40,7 +40,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated by ConfigDefinition.jar on Sun Oct 18 13:05:04 EDT 2015
|
||||
; this section was generated by ConfigDefinition.jar on Sun Oct 18 19:32:39 EDT 2015
|
||||
|
||||
pageSize = 15288
|
||||
page = 1
|
||||
|
|
|
@ -89,7 +89,7 @@ public class SensorSnifferPane {
|
|||
upperPanel.add(pauseButton);
|
||||
upperPanel.add(new RpmLabel(2).getContent());
|
||||
|
||||
upperPanel.add(new AnyCommand(config, true, false).getContent());
|
||||
upperPanel.add(AnyCommand.createField(config, true, false).getContent());
|
||||
|
||||
upperPanel.add(new URLLabel(EngineSnifferPanel.HELP_TEXT, HELP_URL));
|
||||
pauseButton.addActionListener(new
|
||||
|
|
|
@ -190,7 +190,7 @@ public class GaugesPanel {
|
|||
JPanel leftUpperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
leftUpperPanel.add(createSaveImageButton());
|
||||
leftUpperPanel.add(new RpmLabel(2).getContent());
|
||||
AnyCommand command = new AnyCommand(config, false, false);
|
||||
AnyCommand command = AnyCommand.createField(config, false, false);
|
||||
leftUpperPanel.add(command.getContent());
|
||||
return leftUpperPanel;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class MessagesPane {
|
|||
public MessagesPane(final Node config) {
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
|
||||
AnyCommand command = new AnyCommand(config, true, false);
|
||||
AnyCommand command = AnyCommand.createArea(config, config.getProperty(AnyCommand.KEY), true, false);
|
||||
final MessagesPanel upperPanel = new MessagesPanel(command.getContent());
|
||||
upperPanel.loadFont(config);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ public class EngineSnifferPanel {
|
|||
upperPanel.add(pauseButton);
|
||||
upperPanel.add(new RpmLabel(2).getContent());
|
||||
|
||||
JComponent command = new AnyCommand(config, "chartsize " + EFI_DEFAULT_CHART_SIZE, true, true).getContent();
|
||||
JComponent command = AnyCommand.createField(config, "chartsize " + EFI_DEFAULT_CHART_SIZE, true, true).getContent();
|
||||
upperPanel.add(command);
|
||||
|
||||
upperPanel.add(zoomControl);
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Date: 3/20/13
|
||||
|
@ -20,23 +21,14 @@ import java.awt.event.KeyEvent;
|
|||
*/
|
||||
public class AnyCommand {
|
||||
public static final String KEY = "last_value";
|
||||
private final JTextField text = new JTextField() {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size = super.getPreferredSize();
|
||||
return new Dimension(200, size.height);
|
||||
}
|
||||
};
|
||||
|
||||
private final JTextComponent text;
|
||||
private JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
private boolean reentrant;
|
||||
private int index;
|
||||
private Listener listener;
|
||||
|
||||
public AnyCommand(final Node config, boolean listenToCommands, boolean withCommandCaption) {
|
||||
this(config, config.getProperty(KEY), listenToCommands, withCommandCaption);
|
||||
}
|
||||
|
||||
public AnyCommand(final Node config, String defaultCommand, final boolean listenToCommands, boolean withCommandCaption) {
|
||||
private AnyCommand(final JTextComponent text, final Node config, String defaultCommand, final boolean listenToCommands, boolean withCommandCaption) {
|
||||
this.text = text;
|
||||
text.setText(defaultCommand);
|
||||
content.setBorder(BorderFactory.createLineBorder(Color.PINK));
|
||||
if (withCommandCaption) {
|
||||
|
@ -61,25 +53,6 @@ public class AnyCommand {
|
|||
}
|
||||
});
|
||||
|
||||
text.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||
String command = RecentCommands.getRecent(++index);
|
||||
text.setText(command);
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
String command = RecentCommands.getRecent(--index);
|
||||
text.setText(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
text.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
send();
|
||||
}
|
||||
});
|
||||
text.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
|
@ -93,7 +66,7 @@ public class AnyCommand {
|
|||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
boolean isOk = isValidInput(text);
|
||||
boolean isOk = isValidInput(text.getText());
|
||||
text.setBorder(isOk ? null : BorderFactory.createLineBorder(Color.red));
|
||||
config.setProperty(KEY, text.getText());
|
||||
}
|
||||
|
@ -111,19 +84,25 @@ public class AnyCommand {
|
|||
}
|
||||
|
||||
private void send() {
|
||||
index = 0;
|
||||
String cmd = text.getText();
|
||||
if (!isValidInput(text))
|
||||
for (String s : cmd.split("\n"))
|
||||
doSend(s);
|
||||
}
|
||||
|
||||
private void doSend(String cmd) {
|
||||
if (!isValidInput(cmd))
|
||||
return;
|
||||
if (listener != null)
|
||||
listener.onSend();
|
||||
int timeout = CommandQueue.getTimeout(cmd);
|
||||
reentrant = true;
|
||||
CommandQueue.getInstance().write(cmd.toLowerCase(), timeout);
|
||||
reentrant = false;
|
||||
}
|
||||
|
||||
private static boolean isValidInput(JTextComponent text) {
|
||||
private static boolean isValidInput(String text) {
|
||||
boolean isOk = true;
|
||||
for (char c : text.getText().toCharArray()) {
|
||||
for (char c : text.toCharArray()) {
|
||||
if (c > 127) {
|
||||
/**
|
||||
* https://sourceforge.net/p/rusefi/tickets/63/
|
||||
|
@ -143,4 +122,66 @@ public class AnyCommand {
|
|||
public void setContent(JPanel content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
void onSend();
|
||||
}
|
||||
|
||||
public static AnyCommand createField(Node config, boolean listenToCommands, boolean withCommandCaption) {
|
||||
return createField(config, config.getProperty(KEY), listenToCommands, withCommandCaption);
|
||||
}
|
||||
|
||||
public static AnyCommand createField(Node config, String defaultCommand, boolean listenToCommands, boolean withCommandCaption) {
|
||||
final JTextField text = new JTextField() {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size = super.getPreferredSize();
|
||||
return new Dimension(200, size.height);
|
||||
}
|
||||
};
|
||||
|
||||
final AnyCommand command = new AnyCommand(text, config, defaultCommand, listenToCommands, withCommandCaption);
|
||||
text.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
command.send();
|
||||
}
|
||||
});
|
||||
|
||||
final AtomicInteger index = new AtomicInteger();
|
||||
command.listener = new Listener() {
|
||||
@Override
|
||||
public void onSend() {
|
||||
index.set(0);
|
||||
}
|
||||
};
|
||||
|
||||
text.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||
String command = RecentCommands.getRecent(index.incrementAndGet());
|
||||
text.setText(command);
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
String command = RecentCommands.getRecent(index.decrementAndGet());
|
||||
text.setText(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
public static AnyCommand createArea(Node config, String defaultCommand, boolean listenToCommands, boolean withCommandCaption) {
|
||||
final JTextArea text = new JTextArea(3, 20) {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size = super.getPreferredSize();
|
||||
return new Dimension(200, size.height);
|
||||
}
|
||||
};
|
||||
// text.setMax
|
||||
|
||||
return new AnyCommand(text, config, defaultCommand, listenToCommands, withCommandCaption);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue