auto-sync
This commit is contained in:
parent
ed4d3e12a1
commit
dc3d613a01
|
@ -26,8 +26,6 @@
|
|||
* These two commands are enough to get working gauges. In order to start configuring the ECU using
|
||||
* tuner studio, three more commands should be implemented:
|
||||
*
|
||||
* todo: merge this file with tunerstudio.c?
|
||||
*
|
||||
*
|
||||
* @date Oct 22, 2013
|
||||
* @author Andrey Belomutskiy, (c) 2012-2015
|
||||
|
@ -45,7 +43,6 @@
|
|||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @author Andrey Belomutskiy, (c) 2012-2015
|
||||
*
|
||||
* This file is part of rusEfi - see http://rusefi.com
|
||||
*
|
||||
|
|
|
@ -32,6 +32,8 @@ EXTERN_ENGINE
|
|||
|
||||
static Logging *logger;
|
||||
|
||||
WallFuel wallFuel;
|
||||
|
||||
WallFuel::WallFuel() {
|
||||
wallFuel = 0;
|
||||
}
|
||||
|
@ -49,6 +51,10 @@ floatms_t WallFuel::adjust(floatms_t target DECLARE_ENGINE_PARAMETER_S) {
|
|||
return result;
|
||||
}
|
||||
|
||||
floatms_t WallFuel::getWallFuel() {
|
||||
return wallFuel;
|
||||
}
|
||||
|
||||
float AccelEnrichmemnt::getDelta() {
|
||||
return cb.maxValue(cb.getSize());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
class AccelEnrichmemnt {
|
||||
public:
|
||||
AccelEnrichmemnt();
|
||||
/**
|
||||
* @return Extra MAP value for Speed Density calculation
|
||||
*/
|
||||
float getMapEnrichment(DECLARE_ENGINE_PARAMETER_F);
|
||||
/**
|
||||
* @return Extra fuel squirt duration for TPS acceleration
|
||||
*/
|
||||
floatms_t getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F);
|
||||
float getDelta();
|
||||
|
||||
|
@ -35,8 +41,10 @@ private:
|
|||
};
|
||||
|
||||
class WallFuel {
|
||||
public:
|
||||
WallFuel();
|
||||
floatms_t adjust(floatms_t target DECLARE_ENGINE_PARAMETER_S);
|
||||
floatms_t getWallFuel();
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -585,7 +585,7 @@ fileVersion = { 20150625 }
|
|||
|
||||
ochGetCommand = "O"
|
||||
|
||||
|
||||
; see OUTPUT_CHANNELS_SIZE in console source code
|
||||
ochBlockSize = 196
|
||||
|
||||
rpm = scalar, U32, 0, "RPM", 1, 0.00000
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package com.rusefi.binaryprotocol;
|
||||
|
||||
import com.rusefi.*;
|
||||
import com.rusefi.config.Field;
|
||||
import com.rusefi.config.FieldType;
|
||||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.core.Pair;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
import com.rusefi.io.DataListener;
|
||||
import com.rusefi.io.IoStream;
|
||||
|
@ -10,12 +14,13 @@ import com.rusefi.io.LinkManager;
|
|||
import com.rusefi.io.CommunicationLoggingHolder;
|
||||
import com.rusefi.io.serial.PortHolder;
|
||||
import com.rusefi.io.serial.SerialIoStream;
|
||||
import etch.util.CircularByteBuffer;
|
||||
import jssc.SerialPort;
|
||||
import jssc.SerialPortException;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
@ -29,6 +34,8 @@ import static com.rusefi.binaryprotocol.IoHelper.*;
|
|||
* 3/6/2015
|
||||
*/
|
||||
public class BinaryProtocol {
|
||||
private static final int OUTPUT_CHANNELS_SIZE = 196;
|
||||
|
||||
private static final int BLOCKING_FACTOR = 256;
|
||||
private static final byte RESPONSE_OK = 0;
|
||||
private static final byte RESPONSE_BURN_OK = 0x04;
|
||||
|
@ -117,6 +124,7 @@ public class BinaryProtocol {
|
|||
|
||||
/**
|
||||
* this method would switch controller to binary protocol and read configuration snapshot from controller
|
||||
*
|
||||
* @return true if everything fine
|
||||
*/
|
||||
public boolean connectAndReadConfiguration(DataListener listener) {
|
||||
|
@ -142,7 +150,8 @@ public class BinaryProtocol {
|
|||
LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String text = requestText();
|
||||
requestOutputChannels();
|
||||
String text = requestPendingMessages();
|
||||
if (text != null)
|
||||
listener.onDataArrived((text + "\r\n").getBytes());
|
||||
}
|
||||
|
@ -426,7 +435,7 @@ public class BinaryProtocol {
|
|||
return true;
|
||||
}
|
||||
|
||||
public String requestText() {
|
||||
public String requestPendingMessages() {
|
||||
if (isClosed)
|
||||
return null;
|
||||
try {
|
||||
|
@ -439,4 +448,29 @@ public class BinaryProtocol {
|
|||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void requestOutputChannels() {
|
||||
if (isClosed)
|
||||
return;
|
||||
// try {
|
||||
byte[] response = executeCommand(new byte[]{'O'}, "output channels", false);
|
||||
if (response == null || response.length != (OUTPUT_CHANNELS_SIZE + 1) || response[0] != RESPONSE_OK)
|
||||
return;
|
||||
|
||||
for (Sensor sensor : Sensor.values()) {
|
||||
if (sensor.getType() == FieldType.FLOAT) {
|
||||
|
||||
ByteBuffer bb = ByteBuffer.wrap(response, 1 + sensor.getOffset(), 4);
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
double value = bb.getFloat();
|
||||
|
||||
SensorCentral.getInstance().setValue(value, sensor);
|
||||
}
|
||||
}
|
||||
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new IllegalStateException(e);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.core;
|
||||
|
||||
import com.rusefi.config.FieldType;
|
||||
import eu.hansolo.steelseries.tools.BackgroundColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -86,6 +87,7 @@ public enum Sensor {
|
|||
INJECTOR_3_DWELL("inj #3", SensorCategory.SNIFFING),
|
||||
INJECTOR_4_DWELL("inj #4", SensorCategory.SNIFFING),
|
||||
|
||||
CURRENT_VE(SensorCategory.OPERATIONS, FieldType.FLOAT, 112, BackgroundColor.MUD),
|
||||
|
||||
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
|
||||
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),
|
||||
|
@ -97,6 +99,19 @@ public enum Sensor {
|
|||
private final double minValue;
|
||||
private final double maxValue;
|
||||
private final BackgroundColor color;
|
||||
private final FieldType type;
|
||||
private final int offset;
|
||||
|
||||
Sensor(SensorCategory category, FieldType type, int offset, BackgroundColor color) {
|
||||
name = name();
|
||||
this.type = type;
|
||||
this.offset = offset;
|
||||
this.category = category;
|
||||
this.color = color;
|
||||
units = "n/a";
|
||||
minValue = 0;
|
||||
maxValue = 100;
|
||||
}
|
||||
|
||||
Sensor(String name, SensorCategory category) {
|
||||
this(name, category, "", 255);
|
||||
|
@ -117,6 +132,8 @@ public enum Sensor {
|
|||
this.minValue = minValue;
|
||||
this.maxValue = maxValue;
|
||||
this.color = color;
|
||||
type = null;
|
||||
offset = -1;
|
||||
}
|
||||
|
||||
public static ArrayList<Sensor> getSensorsForCategory(String category) {
|
||||
|
@ -169,6 +186,14 @@ public enum Sensor {
|
|||
return color;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public FieldType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public double translateValue(double value) {
|
||||
switch (this) {
|
||||
case ADVANCE0:
|
||||
|
|
|
@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see com.rusefi.StartupFrame
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20150820;
|
||||
public static final int CONSOLE_VERSION = 20150823;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
Loading…
Reference in New Issue