Skip to content

Commit

Permalink
Merge pull request #144 from openxc/print-flush
Browse files Browse the repository at this point in the history
Flush After Print Statements
  • Loading branch information
pjt0620 committed Mar 16, 2020
2 parents c960b76 + 437be38 commit 4ff2ca4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions openxc/tools/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from openxc.formats.json import JsonFormatter
from .common import device_options, configure_logging, select_device

import functools
print = functools.partial(print, flush=True)

def receive(message, **kwargs):
message['timestamp'] = time.time()
print((JsonFormatter.serialize(message)))
Expand Down
4 changes: 3 additions & 1 deletion openxc/tools/obd2scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from .common import device_options, configure_logging, select_device
import json

import functools
print = functools.partial(print, flush=True)

def scan(controller, bus=None):

# TODO could read the response from the "PIDs supported" requests to see
Expand All @@ -28,7 +31,6 @@ def scan(controller, bus=None):

if (no_response == True):
print("PID 0x%x did not respond" % pid)
sys.stdout.flush()

def parse_options():
parser = argparse.ArgumentParser(description="Send requests for all "
Expand Down
3 changes: 3 additions & 0 deletions openxc/tools/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

from .common import device_options, configure_logging, select_device

import functools
print = functools.partial(print, flush=True)

TESTER_PRESENT_MODE = 0x3e
TESTER_PRESENT_PAYLOAD = bytearray([0])

Expand Down

0 comments on commit 4ff2ca4

Please sign in to comment.