mirror of https://github.com/FOME-Tech/fome-fw.git
auto-sync
This commit is contained in:
parent
4b163a3614
commit
3adc4f3599
|
@ -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
|
// begin
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1044,6 +1044,7 @@ typedef struct {
|
||||||
offset 1496 bit 4 */
|
offset 1496 bit 4 */
|
||||||
bool_t useConstantDwellDuringCranking : 1;
|
bool_t useConstantDwellDuringCranking : 1;
|
||||||
/**
|
/**
|
||||||
|
* This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
|
||||||
offset 1496 bit 5 */
|
offset 1496 bit 5 */
|
||||||
bool_t isEngineChartEnabled : 1;
|
bool_t isEngineChartEnabled : 1;
|
||||||
/**
|
/**
|
||||||
|
@ -1517,4 +1518,4 @@ typedef struct {
|
||||||
} persistent_config_s;
|
} persistent_config_s;
|
||||||
|
|
||||||
// end
|
// 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) {
|
static void enableOrDisable(const char *param, bool isEnabled) {
|
||||||
if (strEqualCaseInsensitive(param, "fastadc")) {
|
if (strEqualCaseInsensitive(param, "fastadc")) {
|
||||||
boardConfiguration->isFastAdcEnabled = isEnabled;
|
boardConfiguration->isFastAdcEnabled = isEnabled;
|
||||||
|
} else if (strEqualCaseInsensitive(param, "engine_sniffer")) {
|
||||||
|
engineConfiguration->isEngineChartEnabled = isEnabled;
|
||||||
} else if (strEqualCaseInsensitive(param, "step1limimter")) {
|
} else if (strEqualCaseInsensitive(param, "step1limimter")) {
|
||||||
boardConfiguration->enabledStep1Limiter = isEnabled;
|
boardConfiguration->enabledStep1Limiter = isEnabled;
|
||||||
} else if (strEqualCaseInsensitive(param, "serial")) {
|
} else if (strEqualCaseInsensitive(param, "serial")) {
|
||||||
|
|
|
@ -488,7 +488,7 @@ bit hasMapSensor;@see isMapAveragingEnabled
|
||||||
bit hasBaroSensor
|
bit hasBaroSensor
|
||||||
bit hasAfrSensor
|
bit hasAfrSensor
|
||||||
bit useConstantDwellDuringCranking
|
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 isCanEnabled
|
||||||
bit hasCltSensor
|
bit hasCltSensor
|
||||||
bit canReadEnabled
|
bit canReadEnabled
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class SensorSnifferPane {
|
||||||
upperPanel.add(pauseButton);
|
upperPanel.add(pauseButton);
|
||||||
upperPanel.add(new RpmLabel(2).getContent());
|
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));
|
upperPanel.add(new URLLabel(EngineSnifferPanel.HELP_TEXT, HELP_URL));
|
||||||
pauseButton.addActionListener(new
|
pauseButton.addActionListener(new
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class GaugesPanel {
|
||||||
JPanel leftUpperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
JPanel leftUpperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||||
leftUpperPanel.add(createSaveImageButton());
|
leftUpperPanel.add(createSaveImageButton());
|
||||||
leftUpperPanel.add(new RpmLabel(2).getContent());
|
leftUpperPanel.add(new RpmLabel(2).getContent());
|
||||||
AnyCommand command = new AnyCommand(config, false, false);
|
AnyCommand command = AnyCommand.createField(config, false, false);
|
||||||
leftUpperPanel.add(command.getContent());
|
leftUpperPanel.add(command.getContent());
|
||||||
return leftUpperPanel;
|
return leftUpperPanel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class MessagesPane {
|
||||||
public MessagesPane(final Node config) {
|
public MessagesPane(final Node config) {
|
||||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
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());
|
final MessagesPanel upperPanel = new MessagesPanel(command.getContent());
|
||||||
upperPanel.loadFont(config);
|
upperPanel.loadFont(config);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class EngineSnifferPanel {
|
||||||
upperPanel.add(pauseButton);
|
upperPanel.add(pauseButton);
|
||||||
upperPanel.add(new RpmLabel(2).getContent());
|
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(command);
|
||||||
|
|
||||||
upperPanel.add(zoomControl);
|
upperPanel.add(zoomControl);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 3/20/13
|
* Date: 3/20/13
|
||||||
|
@ -20,23 +21,14 @@ import java.awt.event.KeyEvent;
|
||||||
*/
|
*/
|
||||||
public class AnyCommand {
|
public class AnyCommand {
|
||||||
public static final String KEY = "last_value";
|
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 JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
private boolean reentrant;
|
private boolean reentrant;
|
||||||
private int index;
|
private Listener listener;
|
||||||
|
|
||||||
public AnyCommand(final Node config, boolean listenToCommands, boolean withCommandCaption) {
|
private AnyCommand(final JTextComponent text, final Node config, String defaultCommand, final boolean listenToCommands, boolean withCommandCaption) {
|
||||||
this(config, config.getProperty(KEY), listenToCommands, withCommandCaption);
|
this.text = text;
|
||||||
}
|
|
||||||
|
|
||||||
public AnyCommand(final Node config, String defaultCommand, final boolean listenToCommands, boolean withCommandCaption) {
|
|
||||||
text.setText(defaultCommand);
|
text.setText(defaultCommand);
|
||||||
content.setBorder(BorderFactory.createLineBorder(Color.PINK));
|
content.setBorder(BorderFactory.createLineBorder(Color.PINK));
|
||||||
if (withCommandCaption) {
|
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() {
|
text.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
|
@ -93,7 +66,7 @@ public class AnyCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
boolean isOk = isValidInput(text);
|
boolean isOk = isValidInput(text.getText());
|
||||||
text.setBorder(isOk ? null : BorderFactory.createLineBorder(Color.red));
|
text.setBorder(isOk ? null : BorderFactory.createLineBorder(Color.red));
|
||||||
config.setProperty(KEY, text.getText());
|
config.setProperty(KEY, text.getText());
|
||||||
}
|
}
|
||||||
|
@ -111,19 +84,25 @@ public class AnyCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send() {
|
private void send() {
|
||||||
index = 0;
|
|
||||||
String cmd = text.getText();
|
String cmd = text.getText();
|
||||||
if (!isValidInput(text))
|
for (String s : cmd.split("\n"))
|
||||||
|
doSend(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doSend(String cmd) {
|
||||||
|
if (!isValidInput(cmd))
|
||||||
return;
|
return;
|
||||||
|
if (listener != null)
|
||||||
|
listener.onSend();
|
||||||
int timeout = CommandQueue.getTimeout(cmd);
|
int timeout = CommandQueue.getTimeout(cmd);
|
||||||
reentrant = true;
|
reentrant = true;
|
||||||
CommandQueue.getInstance().write(cmd.toLowerCase(), timeout);
|
CommandQueue.getInstance().write(cmd.toLowerCase(), timeout);
|
||||||
reentrant = false;
|
reentrant = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidInput(JTextComponent text) {
|
private static boolean isValidInput(String text) {
|
||||||
boolean isOk = true;
|
boolean isOk = true;
|
||||||
for (char c : text.getText().toCharArray()) {
|
for (char c : text.toCharArray()) {
|
||||||
if (c > 127) {
|
if (c > 127) {
|
||||||
/**
|
/**
|
||||||
* https://sourceforge.net/p/rusefi/tickets/63/
|
* https://sourceforge.net/p/rusefi/tickets/63/
|
||||||
|
@ -143,4 +122,66 @@ public class AnyCommand {
|
||||||
public void setContent(JPanel content) {
|
public void setContent(JPanel content) {
|
||||||
this.content = 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