tune via CAN #3361

one step back - sandbox reads signature again!
This commit is contained in:
rusefillc 2021-12-04 21:57:45 -05:00
parent eba6fa232a
commit 241f0402bd
2 changed files with 9 additions and 3 deletions

View File

@ -1993,3 +1993,6 @@ end_struct
#define CAN_SERIAL_RX_ID 0x100
#define CAN_SERIAL_TX_ID 0x102
#define CAN_ECU_SERIAL_RX_ID 0x100
#define CAN_ECU_SERIAL_TX_ID 0x102

View File

@ -23,6 +23,9 @@ public class Elm327Connector implements Closeable {
private final static int TIMEOUT = 70;
public static final String HELLO = "ATZ";
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();
@ -63,16 +66,16 @@ public class Elm327Connector implements Closeable {
sendCommand("ATSP6", "OK");
// 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"
sendCommand("ATCM FFF", "OK");
// 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)
sendCommand("ATFCSH " + Integer.toHexString(Fields.CAN_SERIAL_TX_ID), "OK");
sendCommand("ATFCSH " + Integer.toHexString(CAN_PC_SERIAL_TX_ID), "OK");
// set FC data
sendCommand("ATFCSD 30 00 00", "OK");
// use custom FC ID & data