mirror of https://github.com/FOME-Tech/fome-fw.git
more inspection cleanup
This commit is contained in:
parent
9649fbfc3a
commit
b6995d6fb1
|
@ -23,6 +23,7 @@ public class MiscTest extends RusefiTestBase {
|
|||
double mcuTemp = Double.NaN;
|
||||
long start = System.currentTimeMillis();
|
||||
while (Double.isNaN(mcuTemp) && (System.currentTimeMillis() - start) < 5 * SECOND) {
|
||||
//noinspection BusyWait
|
||||
Thread.sleep(100);
|
||||
mcuTemp = SensorCentral.getInstance().getValue(Sensor.INT_TEMP);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class Logging {
|
|||
* need to print their debugging information in production environment.
|
||||
*/
|
||||
public final void configureDebugEnabled(boolean defaultDebugEnabled) {
|
||||
IMPL.setDebugEnabled(peer, Boolean.valueOf(DefaultLogging.getProperty(getName() + ".debug",
|
||||
IMPL.setDebugEnabled(peer, Boolean.parseBoolean(DefaultLogging.getProperty(getName() + ".debug",
|
||||
String.valueOf(defaultDebugEnabled))));
|
||||
}
|
||||
|
||||
|
|
|
@ -50,22 +50,19 @@ public class EngineState {
|
|||
private final Set<String> keys = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
public EngineState(@NotNull final EngineStateListener listener) {
|
||||
buffer = new ResponseBuffer(new ResponseBuffer.ResponseListener() {
|
||||
public void onResponse(String response) {
|
||||
if (response != null) {
|
||||
// let's remove timestamp if we get content from a log file not controller
|
||||
int i = response.indexOf(Logger.END_OF_TIMESTAND_TAG);
|
||||
if (i != -1)
|
||||
response = response.substring(i + Logger.END_OF_TIMESTAND_TAG.length());
|
||||
String copy = response;
|
||||
listener.beforeLine(response);
|
||||
while (!response.isEmpty())
|
||||
response = handleResponse(response, listener);
|
||||
listener.afterLine(copy);
|
||||
}
|
||||
buffer = new ResponseBuffer(response -> {
|
||||
if (response != null) {
|
||||
// let's remove timestamp if we get content from a log file not controller
|
||||
int i = response.indexOf(Logger.END_OF_TIMESTAND_TAG);
|
||||
if (i != -1)
|
||||
response = response.substring(i + Logger.END_OF_TIMESTAND_TAG.length());
|
||||
String copy = response;
|
||||
listener.beforeLine(response);
|
||||
while (!response.isEmpty())
|
||||
response = handleResponse(response, listener);
|
||||
listener.afterLine(copy);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
registerStringValueAction(Fields.PROTOCOL_MSG, value -> MessagesCentral.getInstance().postMessage(ENGINE_STATE_CLASS, value));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TS2C {
|
|||
IniFileModel model = IniFileModel.getInstance();
|
||||
|
||||
String methodName = tableName.equalsIgnoreCase("none") ? loadSectionName : tableName;
|
||||
methodName = methodName.toUpperCase().substring(0, 1) + methodName.substring(1);
|
||||
methodName = methodName.toUpperCase().charAt(0) + methodName.substring(1);
|
||||
|
||||
BufferedWriter w = new BufferedWriter(new FileWriter("generated_" + methodName + ".cpp"));
|
||||
|
||||
|
|
|
@ -70,13 +70,10 @@ public class ConsoleTools {
|
|||
registerTool("dfu", DfuTool::run, "Program specified file into ECU via DFU");
|
||||
|
||||
registerTool("detect", ConsoleTools::detect, "Find attached rusEFI");
|
||||
registerTool("send_command", new ConsoleTool() {
|
||||
@Override
|
||||
public void runTool(String[] args) throws Exception {
|
||||
String command = args[1];
|
||||
System.out.println("Sending command " + command);
|
||||
sendCommand(command);
|
||||
}
|
||||
registerTool("send_command", args -> {
|
||||
String command = args[1];
|
||||
System.out.println("Sending command " + command);
|
||||
sendCommand(command);
|
||||
}, "Sends command specified as second argument");
|
||||
registerTool("reboot_ecu", args -> sendCommand(Fields.CMD_REBOOT), "Sends a command to reboot rusEFI controller.");
|
||||
registerTool(Fields.CMD_REBOOT_DFU, args -> {
|
||||
|
|
|
@ -217,8 +217,7 @@ public class RecentCommands {
|
|||
|
||||
Entry entry = (Entry) o;
|
||||
|
||||
return !(command != null ? !command.equals(entry.command) : entry.command != null);
|
||||
|
||||
return Objects.equals(command, entry.command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,30 +77,17 @@ public class EngineSnifferPanel {
|
|||
statusPanel.setTimeAxisTranslator(crank.createTranslator());
|
||||
|
||||
final JButton pauseButton = UiUtils.createPauseButton();
|
||||
pauseButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setPaused(pauseButton, !isPaused);
|
||||
}
|
||||
});
|
||||
pauseButton.addActionListener(e -> setPaused(pauseButton, !isPaused));
|
||||
|
||||
JButton clearButton = UiUtils.createClearButton();
|
||||
clearButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (UpDownImage image : images.values())
|
||||
image.setWaveReport(EngineReport.MOCK, null);
|
||||
setPaused(pauseButton, false);
|
||||
}
|
||||
clearButton.addActionListener(e -> {
|
||||
for (UpDownImage image : images.values())
|
||||
image.setWaveReport(EngineReport.MOCK, null);
|
||||
setPaused(pauseButton, false);
|
||||
});
|
||||
|
||||
JButton saveImageButton = UiUtils.createSaveImageButton();
|
||||
saveImageButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
saveImage();
|
||||
}
|
||||
});
|
||||
saveImageButton.addActionListener(e -> saveImage());
|
||||
|
||||
|
||||
JPanel upperPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
|
||||
|
@ -148,13 +135,10 @@ public class EngineSnifferPanel {
|
|||
|
||||
resetImagePanel();
|
||||
|
||||
uiContext.getLinkManager().getEngineState().registerStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
if (isPaused)
|
||||
return;
|
||||
displayChart(value);
|
||||
}
|
||||
uiContext.getLinkManager().getEngineState().registerStringValueAction(EngineReport.ENGINE_CHART, value -> {
|
||||
if (isPaused)
|
||||
return;
|
||||
displayChart(value);
|
||||
});
|
||||
|
||||
mainPanel.add(chartPanel, BorderLayout.CENTER);
|
||||
|
@ -167,19 +151,16 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
|
||||
public void setOutpinListener(EngineState engineState) {
|
||||
engineState.registerStringValueAction(Fields.PROTOCOL_OUTPIN, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
String[] pinInfo = value.split("@");
|
||||
if (pinInfo.length != 2)
|
||||
return;
|
||||
String channel = pinInfo[0];
|
||||
String pin = pinInfo[1];
|
||||
UpDownImage image = images.get(channel);
|
||||
ChannelNaming.INSTANCE.channelName2PhysicalPin.put(channel, pin);
|
||||
if (image != null)
|
||||
image.setPhysicalPin(pin);
|
||||
}
|
||||
engineState.registerStringValueAction(Fields.PROTOCOL_OUTPIN, value -> {
|
||||
String[] pinInfo = value.split("@");
|
||||
if (pinInfo.length != 2)
|
||||
return;
|
||||
String channel = pinInfo[0];
|
||||
String pin = pinInfo[1];
|
||||
UpDownImage image = images.get(channel);
|
||||
ChannelNaming.INSTANCE.channelName2PhysicalPin.put(channel, pin);
|
||||
if (image != null)
|
||||
image.setPhysicalPin(pin);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -313,12 +294,9 @@ public class EngineSnifferPanel {
|
|||
}
|
||||
|
||||
public ActionListener getTabSelectedListener() {
|
||||
return new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (command != null)
|
||||
command.requestFocus();
|
||||
}
|
||||
return e -> {
|
||||
if (command != null)
|
||||
command.requestFocus();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -173,9 +173,9 @@ public class LiveDataProcessor {
|
|||
};
|
||||
|
||||
|
||||
ArrayList<LinkedHashMap> liveDocs = (ArrayList<LinkedHashMap>) data.get("Usages");
|
||||
ArrayList<LinkedHashMap<String, Object>> liveDocs = (ArrayList<LinkedHashMap<String, Object>>) data.get("Usages");
|
||||
|
||||
for (LinkedHashMap entry : liveDocs) {
|
||||
for (LinkedHashMap<String, Object> entry : liveDocs) {
|
||||
String name = (String) entry.get("name");
|
||||
String java = (String) entry.get("java");
|
||||
String folder = (String) entry.get("folder");
|
||||
|
|
|
@ -64,10 +64,10 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
|||
@Override
|
||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) {
|
||||
if (structure.getComment() != null) {
|
||||
content.append(packComment(structure.getComment(), "// ") + EOL);
|
||||
content.append(packComment(structure.getComment(), "// ")).append(EOL);
|
||||
}
|
||||
|
||||
content.append("struct " + structure.getName() + " {" + EOL);
|
||||
content.append("struct ").append(structure.getName()).append(" {").append(EOL);
|
||||
|
||||
FieldIteratorWithOffset iterator = new FieldIteratorWithOffset(structure.getcFields());
|
||||
for (int i = 0; i < structure.getcFields().size(); i++) {
|
||||
|
@ -79,7 +79,7 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
|
|||
}
|
||||
|
||||
content.append("};" + EOL);
|
||||
content.append("static_assert(sizeof(" + structure.getName() + ") == " + iterator.currentOffset + ");\n");
|
||||
content.append("static_assert(sizeof(").append(structure.getName()).append(") == ").append(iterator.currentOffset).append(");\n");
|
||||
content.append(EOL);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class CHeaderConsumer extends BaseCHeaderConsumer {
|
|||
public void endFile() throws IOException {
|
||||
if (withC_Defines)
|
||||
cHeader.write(variableRegistry.getDefinesSection());
|
||||
cHeader.write(getContent().toString());
|
||||
cHeader.write(getContent());
|
||||
cHeader.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue