ELM327: Minor fix for canceled messages contaimnating future messages.
parent
dd8d0ff27b
commit
a70d0a722d
|
@ -849,6 +849,9 @@ static void ICACHE_FLASH_ATTR elm_rx_cb(void *arg, char *data, uint16_t len) {
|
|||
if(loopcount){
|
||||
os_timer_disarm(&elm_timeout);
|
||||
loopcount = 0;
|
||||
got_msg_this_run = false;
|
||||
can_tx_worked = false;
|
||||
did_multimessage = false;
|
||||
|
||||
os_printf("Interrupting operation, stopping timer. msg len: %d\n", len);
|
||||
elm_append_rsp_const("STOPPED\r\r>");
|
||||
|
|
|
@ -333,6 +333,36 @@ def test_elm_send_can_multiline_msg_throughput():
|
|||
sim.join()
|
||||
s.close()
|
||||
|
||||
def test_elm_interrupted_obd_cmd_resets_state():
|
||||
s = elm_connect()
|
||||
serial = os.getenv("CANSIMSERIAL") if os.getenv("CANSIMSERIAL") else None
|
||||
sim = elm_car_simulator.ELMCanCarSimulator(serial, silent=True)
|
||||
sim.start()
|
||||
|
||||
try:
|
||||
sync_reset(s)
|
||||
send_compare(s, b'ATE0\r', b'ATE0\rOK\r\r>') # Echo OFF
|
||||
send_compare(s, b'ATS0\r', b'OK\r\r>') # Spaces OFF
|
||||
s.send(b"09fd\r")
|
||||
ready = select.select([s], [], [], 4)
|
||||
assert ready[0], "Socket did not receive data within the timeout duration."
|
||||
s.send(b"ATI\r")
|
||||
|
||||
assert b"236\r0:49FD01AAAAAA\r" in s.recv(10000)
|
||||
|
||||
#Will likely have to be improved to scan for STOPPED if the FW gets more responsive.
|
||||
ready = select.select([s], [], [], 4)
|
||||
assert ready[0], "Socket did not receive data within the timeout duration."
|
||||
|
||||
assert b"STOPPED" in s.recv(10000)
|
||||
|
||||
sim.set_enable(False)
|
||||
send_compare(s, b'09fd\r', b"NO DATA\r\r>")
|
||||
finally:
|
||||
sim.stop()
|
||||
sim.join()
|
||||
s.close()
|
||||
|
||||
def test_elm_can_baud():
|
||||
s = elm_connect()
|
||||
serial = os.getenv("CANSIMSERIAL") if os.getenv("CANSIMSERIAL") else None
|
||||
|
|
Loading…
Reference in New Issue