parent
f035255530
commit
cb9c1fe19c
|
@ -1993,3 +1993,6 @@ end_struct
|
||||||
|
|
||||||
#define CAN_SERIAL_RX_ID 0x100
|
#define CAN_SERIAL_RX_ID 0x100
|
||||||
#define CAN_SERIAL_TX_ID 0x102
|
#define CAN_SERIAL_TX_ID 0x102
|
||||||
|
|
||||||
|
#define CAN_ECU_SERIAL_RX_ID 0x100
|
||||||
|
#define CAN_ECU_SERIAL_TX_ID 0x102
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class Elm327Connector implements Closeable {
|
||||||
private final static int TIMEOUT = 70;
|
private final static int TIMEOUT = 70;
|
||||||
public static final String HELLO = "ATZ";
|
public static final String HELLO = "ATZ";
|
||||||
public static final String ELM_EOL = "\r";
|
public static final String ELM_EOL = "\r";
|
||||||
|
// those are inverted between ECU side and PC side
|
||||||
|
private static final int CAN_PC_SERIAL_RX_ID = Fields.CAN_SERIAL_TX_ID;
|
||||||
|
private static final int CAN_PC_SERIAL_TX_ID = Fields.CAN_SERIAL_RX_ID;
|
||||||
|
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
|
@ -63,16 +66,16 @@ public class Elm327Connector implements Closeable {
|
||||||
sendCommand("ATSP6", "OK");
|
sendCommand("ATSP6", "OK");
|
||||||
|
|
||||||
// set rx ID
|
// set rx ID
|
||||||
sendCommand("ATCF " + Integer.toHexString(Fields.CAN_SERIAL_RX_ID), "OK");
|
sendCommand("ATCF " + Integer.toHexString(CAN_PC_SERIAL_RX_ID), "OK");
|
||||||
|
|
||||||
// rx ID mask = "all bits set"
|
// rx ID mask = "all bits set"
|
||||||
sendCommand("ATCM FFF", "OK");
|
sendCommand("ATCM FFF", "OK");
|
||||||
|
|
||||||
// set tx ID
|
// set tx ID
|
||||||
sendCommand("ATSH " + Integer.toHexString(Fields.CAN_SERIAL_TX_ID), "OK");
|
sendCommand("ATSH " + Integer.toHexString(CAN_PC_SERIAL_TX_ID), "OK");
|
||||||
|
|
||||||
// set FC tx ID (should match our tx ID)
|
// set FC tx ID (should match our tx ID)
|
||||||
sendCommand("ATFCSH " + Integer.toHexString(Fields.CAN_SERIAL_TX_ID), "OK");
|
sendCommand("ATFCSH " + Integer.toHexString(CAN_PC_SERIAL_TX_ID), "OK");
|
||||||
// set FC data
|
// set FC data
|
||||||
sendCommand("ATFCSD 30 00 00", "OK");
|
sendCommand("ATFCSD 30 00 00", "OK");
|
||||||
// use custom FC ID & data
|
// use custom FC ID & data
|
||||||
|
|
Loading…
Reference in New Issue