Skip to content

Commit df224c9

Browse files
author
Brendan Whitfield
committed
allow sending AT commands, fixed test
1 parent 5afb8c5 commit df224c9

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

obd/elm327.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,10 @@ def send_and_parse(self, cmd, delay=None):
264264
if no appropriate response was recieved.
265265
"""
266266

267-
if not self.__status == SerialStatus.NOT_CONNECTED:
267+
if self.__status == SerialStatus.NOT_CONNECTED:
268268
debug("cannot send_and_parse() when unconnected", True)
269269
return None
270270

271-
if "AT" in cmd.upper():
272-
debug("Rejected sending AT command", True)
273-
return None
274-
275271
lines = self.__send(cmd, delay)
276272

277273
# parses string into list of messages

tests/test_OBD.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import obd
3+
from obd.utils import SerialStatus
34
from obd.OBDResponse import OBDResponse
45
from obd.OBDCommand import OBDCommand
56
from obd.decoders import noop
@@ -31,6 +32,7 @@ def write(cmd):
3132

3233
o.is_connected = lambda *args: True
3334
o.port.is_connected = lambda *args: True
35+
o.port._ELM327__status = SerialStatus.CAR_CONNECTED
3436
o.port._ELM327__protocol = SAE_J1850_PWM()
3537
o.port._ELM327__primary_ecu = 0x10
3638
o.port._ELM327__write = write

0 commit comments

Comments
 (0)