auto-sync

This commit is contained in:
rusEfi 2015-04-21 23:10:36 -04:00
parent 0af06b178e
commit fa8d8eae9d
5 changed files with 67 additions and 10 deletions

View File

@ -337,6 +337,33 @@ static void getShort(int offset) {
scheduleMsg(&logger, "short @%d is %d", offset, value);
}
static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr) {
int offset = atoi(offsetStr);
if (absI(offset) == absI(ERROR_CODE)) {
scheduleMsg(&logger, "invalid offset [%s]", offsetStr);
return;
}
if (isOutOfBounds(offset)) {
return;
}
int bit = atoi(bitStr);
if (absI(bit) == absI(ERROR_CODE)) {
scheduleMsg(&logger, "invalid bit [%s]", bitStr);
return;
}
int value = atoi(valueStr);
if (absI(value) == absI(ERROR_CODE)) {
scheduleMsg(&logger, "invalid value [%s]", valueStr);
return;
}
int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
*ptr ^= (-value ^ *ptr) & (1 << bit);
/**
* this response is part of dev console API
*/
scheduleMsg(&logger, "bit @%d/%d is %d", offset, bit, value);
}
static void setShort(const int offset, const int value) {
if (isOutOfBounds(offset))
return;
@ -345,6 +372,17 @@ static void setShort(const int offset, const int value) {
getShort(offset);
}
static void getBit(int offset, int bit) {
if (isOutOfBounds(offset))
return;
int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
int value = (*ptr >> bit) & 1;
/**
* this response is part of dev console API
*/
scheduleMsg(&logger, "bit @%d/%d is %d", offset, bit, value);
}
static void getInt(int offset) {
if (isOutOfBounds(offset))
return;
@ -404,9 +442,11 @@ void initConfigActions(void) {
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
addConsoleActionII("set_int", (VoidIntInt) setInt);
addConsoleActionII("set_short", (VoidIntInt) setShort);
addConsoleActionSSS("set_bit", setBit);
addConsoleActionI("get_float", getFloat);
addConsoleActionI("get_int", getInt);
addConsoleActionI("get_short", getShort);
addConsoleActionII("get_bit", getBit);
}
// todo: move this logic somewhere else?

View File

@ -0,0 +1,13 @@
package com.rusefi.config;
/**
* todo: make this file completely auto-generated
*/
public class Fields {
public static final Field SENSOR_SNIFFER_FREQUENCY = new Field(@@analogChartFrequency@@, FieldType.INT);
public static final Field SENSOR_SNIFFER_MODE = new Field(@@analogChartMode@@, FieldType.ANALOG_CHART_E);
public static final Field GLOBAL_FUEL_CORRECTION = new Field(@@globalFuelCorrection@@, FieldType.FLOAT);
public static final Field ENGINE_SNIFFER_SIZE = new Field(@@digitalChartSize@@, FieldType.INT);
public static final Field isDigitalChartEnabled = new Field(@@isDigitalChartEnabled@@, FieldType.BIT, 5);
}

View File

@ -290,5 +290,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 20150418;
return 20150421;
}

View File

@ -1,8 +1,12 @@
package com.rusefi.config;
/**
* todo: make this file completely auto-generated
*/
public class Fields {
public static final Field ANALOGCHARTFREQUENCY = new Field(768, FieldType.INT);
public static final Field ANALOGCHARTMODE = new Field(1648, FieldType.ANALOG_CHART_E);
public static final Field globalFuelCorrection = new Field(808, FieldType.FLOAT);
public static final Field digitalChartSize = new Field(4892, FieldType.INT);
}
public static final Field SENSOR_SNIFFER_FREQUENCY = new Field(512, FieldType.INT);
public static final Field SENSOR_SNIFFER_MODE = new Field(1400, FieldType.ANALOG_CHART_E);
public static final Field GLOBAL_FUEL_CORRECTION = new Field(552, FieldType.FLOAT);
public static final Field ENGINE_SNIFFER_SIZE = new Field(1504, FieldType.INT);
}

View File

@ -106,10 +106,10 @@ public class AnalogChartPanel {
lowerPanel.setBorder(BorderFactory.createLineBorder(Color.white));
content.add(lowerPanel, BorderLayout.SOUTH);
lowerPanel.add(new ConfigField(Fields.ANALOGCHARTMODE, "Sensor chart mode").getContent());
lowerPanel.add(new ConfigField(Fields.ANALOGCHARTFREQUENCY, "Every XXX engine cycles").getContent());
lowerPanel.add(new ConfigField(Fields.globalFuelCorrection, "Global Fuel Correction").getContent());
lowerPanel.add(new ConfigField(Fields.digitalChartSize, "Engine Sniffer size").getContent());
lowerPanel.add(new ConfigField(Fields.SENSOR_SNIFFER_MODE, "Sensor chart mode").getContent());
lowerPanel.add(new ConfigField(Fields.SENSOR_SNIFFER_FREQUENCY, "Every XXX engine cycles").getContent());
lowerPanel.add(new ConfigField(Fields.GLOBAL_FUEL_CORRECTION, "Global Fuel Correction").getContent());
lowerPanel.add(new ConfigField(Fields.ENGINE_SNIFFER_SIZE, "Engine Sniffer size").getContent());
}
private void clear() {