mirror of https://github.com/rusefi/rusefi-1.git
tune CRC progress
This commit is contained in:
parent
7d8384d7fa
commit
4a5d52f87d
|
@ -93,7 +93,7 @@ public enum Sensor {
|
||||||
FIRMWARE_VERSION(GAUGE_NAME_VERSION, SensorCategory.OPERATIONS, FieldType.INT, 120, 1, 0, 100, "version_f"),
|
FIRMWARE_VERSION(GAUGE_NAME_VERSION, SensorCategory.OPERATIONS, FieldType.INT, 120, 1, 0, 100, "version_f"),
|
||||||
TS_CONFIG_VERSION(".ini version", SensorCategory.OPERATIONS, FieldType.INT, 124),
|
TS_CONFIG_VERSION(".ini version", SensorCategory.OPERATIONS, FieldType.INT, 124),
|
||||||
|
|
||||||
engineMakeCodeNameCrc16("engine crc16", SensorCategory.STATUS, FieldType.INT16, 134, 0, 5),
|
engineMakeCodeNameCrc16("engine crc16", SensorCategory.STATUS, FieldType.UINT16, 134, 0, 5),
|
||||||
// Errors
|
// Errors
|
||||||
totalTriggerErrorCounter(GAUGE_NAME_TRG_ERR, SensorCategory.STATUS, FieldType.INT, 136, 0, 5),
|
totalTriggerErrorCounter(GAUGE_NAME_TRG_ERR, SensorCategory.STATUS, FieldType.INT, 136, 0, 5),
|
||||||
lastErrorCode("last error", SensorCategory.STATUS, FieldType.INT, 138, 0, 5),
|
lastErrorCode("last error", SensorCategory.STATUS, FieldType.INT, 138, 0, 5),
|
||||||
|
@ -112,7 +112,7 @@ public enum Sensor {
|
||||||
debugIntField4("debug i4", SensorCategory.DEBUG, FieldType.INT16, 196, 0, 5),
|
debugIntField4("debug i4", SensorCategory.DEBUG, FieldType.INT16, 196, 0, 5),
|
||||||
debugIntField5("debug i5", SensorCategory.DEBUG, FieldType.INT16, 198, 0, 5),
|
debugIntField5("debug i5", SensorCategory.DEBUG, FieldType.INT16, 198, 0, 5),
|
||||||
|
|
||||||
tuneCrc16("tune crc16", SensorCategory.STATUS, FieldType.INT16, 240, 0, 5),
|
tuneCrc16("tune crc16", SensorCategory.STATUS, FieldType.UINT16, 240, 0, 5),
|
||||||
|
|
||||||
// Synthetic (console only) channels
|
// Synthetic (console only) channels
|
||||||
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
|
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
|
||||||
|
@ -257,4 +257,19 @@ public enum Sensor {
|
||||||
throw new UnsupportedOperationException("Type " + type);
|
throw new UnsupportedOperationException("Type " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLogValue(double value) {
|
||||||
|
if (scale == 1 && type != null) {
|
||||||
|
// only handle sensors without scale, i.e. not packed floats
|
||||||
|
switch (type) {
|
||||||
|
case UINT16: {
|
||||||
|
int v = ((int) value) & 0xFFFF;
|
||||||
|
return Integer.toString(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Double.toString(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@ package com.rusefi;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class rusEFIVersion {
|
public class rusEFIVersion {
|
||||||
public static final int CONSOLE_VERSION = 20200617;
|
public static final int CONSOLE_VERSION = 20200618;
|
||||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import static javax.swing.JOptionPane.YES_NO_OPTION;
|
||||||
*/
|
*/
|
||||||
public class StartupFrame {
|
public class StartupFrame {
|
||||||
// todo: figure out a better way to work with absolute path
|
// todo: figure out a better way to work with absolute path
|
||||||
private static final String APPICON = "appicon.png";
|
private static final String APPICON = "/appicon.png";
|
||||||
private static final String LOGO = "/com/rusefi/logo.gif";
|
private static final String LOGO = "/com/rusefi/logo.gif";
|
||||||
public static final String LINK_TEXT = "rusEFI (c) 2012-2020";
|
public static final String LINK_TEXT = "rusEFI (c) 2012-2020";
|
||||||
private static final String URI = "http://rusefi.com/?java_console";
|
private static final String URI = "http://rusefi.com/?java_console";
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class PlainTextSensorLog implements SensorLog {
|
||||||
try {
|
try {
|
||||||
logFile.write(getSecondsSinceFileStart() + "\t");
|
logFile.write(getSecondsSinceFileStart() + "\t");
|
||||||
for (Sensor sensor : SensorLogger.SENSORS) {
|
for (Sensor sensor : SensorLogger.SENSORS) {
|
||||||
logFile.write(SensorCentral.getInstance().getValue(sensor) + "\t");
|
logFile.write( sensor.getLogValue(SensorCentral.getInstance().getValue(sensor)) + "\t");
|
||||||
}
|
}
|
||||||
logFile.write("\r\n");
|
logFile.write("\r\n");
|
||||||
logFile.flush();
|
logFile.flush();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.rusefi.tools;
|
||||||
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
||||||
import com.opensr5.ConfigurationImage;
|
import com.opensr5.ConfigurationImage;
|
||||||
import com.opensr5.Logger;
|
import com.opensr5.Logger;
|
||||||
|
import com.opensr5.ini.IniFileModel;
|
||||||
import com.opensr5.io.ConfigurationImageFile;
|
import com.opensr5.io.ConfigurationImageFile;
|
||||||
import com.rusefi.*;
|
import com.rusefi.*;
|
||||||
import com.rusefi.autodetect.PortDetector;
|
import com.rusefi.autodetect.PortDetector;
|
||||||
|
@ -34,6 +35,7 @@ import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
||||||
|
import static com.rusefi.binaryprotocol.IoHelper.getCrc32;
|
||||||
|
|
||||||
public class ConsoleTools {
|
public class ConsoleTools {
|
||||||
public static final String SET_AUTH_TOKEN = "set_auth_token";
|
public static final String SET_AUTH_TOKEN = "set_auth_token";
|
||||||
|
@ -50,6 +52,9 @@ public class ConsoleTools {
|
||||||
registerTool("functional_test", ConsoleTools::runFunctionalTest, "NOT A USER TOOL. Development tool related to functional testing");
|
registerTool("functional_test", ConsoleTools::runFunctionalTest, "NOT A USER TOOL. Development tool related to functional testing");
|
||||||
registerTool("convert_binary_configuration_to_xml", ConsoleTools::convertBinaryToXml, "NOT A USER TOOL. Development tool to convert binary configuration into XML form.");
|
registerTool("convert_binary_configuration_to_xml", ConsoleTools::convertBinaryToXml, "NOT A USER TOOL. Development tool to convert binary configuration into XML form.");
|
||||||
|
|
||||||
|
registerTool("get_image_tune_crc", ConsoleTools::calcBinaryImageTuneCrc, "Calculate tune CRC for given binary tune");
|
||||||
|
registerTool("get_xml_tune_crc", ConsoleTools::calcXmlImageTuneCrc, "Calculate tune CRC for given XML tune");
|
||||||
|
|
||||||
registerTool("compile_fsio_line", ConsoleTools::invokeCompileExpressionTool, "Convert a line to RPN form.");
|
registerTool("compile_fsio_line", ConsoleTools::invokeCompileExpressionTool, "Convert a line to RPN form.");
|
||||||
registerTool("compile_fsio_file", ConsoleTools::runCompileTool, "Convert all lines from a file to RPN form.");
|
registerTool("compile_fsio_file", ConsoleTools::runCompileTool, "Convert all lines from a file to RPN form.");
|
||||||
|
|
||||||
|
@ -66,6 +71,26 @@ public class ConsoleTools {
|
||||||
registerTool(Fields.CMD_REBOOT_DFU, args -> sendCommand(Fields.CMD_REBOOT_DFU), "Sends a command to switch rusEFI controller into DFU mode.");
|
registerTool(Fields.CMD_REBOOT_DFU, args -> sendCommand(Fields.CMD_REBOOT_DFU), "Sends a command to switch rusEFI controller into DFU mode.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void calcXmlImageTuneCrc(String[] args) throws Exception {
|
||||||
|
String fileName = args[1];
|
||||||
|
Msq msq = Msq.readTune(fileName);
|
||||||
|
ConfigurationImage image = msq.asImage(IniFileModel.getInstance());
|
||||||
|
printCrc(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void calcBinaryImageTuneCrc(String[] args) throws IOException {
|
||||||
|
String fileName = args[1];
|
||||||
|
ConfigurationImage image = ConfigurationImageFile.readFromFile(fileName);
|
||||||
|
printCrc(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void printCrc(ConfigurationImage image) {
|
||||||
|
for (int i = 0; i < Fields.ERROR_BUFFER_SIZE; i++)
|
||||||
|
image.getContent()[Fields.warning_message_offset + i] = 0;
|
||||||
|
int crc16 = getCrc32(image.getContent()) & 0xFFFF;
|
||||||
|
System.out.println("tune_CRC16=" + crc16);
|
||||||
|
}
|
||||||
|
|
||||||
private static void lightUI(String[] strings) {
|
private static void lightUI(String[] strings) {
|
||||||
LightweightGUI.start();
|
LightweightGUI.start();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue