Skip to content

Commit

Permalink
Merge scan_pjon.py into scan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jorticus committed Aug 12, 2019
1 parent 79e4961 commit 6834797
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 73 deletions.
16 changes: 13 additions & 3 deletions scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@
# and displays the result.
#

from pymate.matenet import MateNET, MateDevice
from settings import SERIAL_PORT
from pymate.matenet import MateNET, MateNETPJON, MateDevice
import settings

print("MATE Bus Scan")

# Create a MateNET bus connection
bus = MateNET(SERIAL_PORT)

if settings.SERIAL_PROTO == 'PJON':
port = MateNETPJON(settings.SERIAL_PORT)
bus = MateNET(port)

# PJON is more reliable, so we don't need to retry packets
bus.RETRY_PACKET = 0

else:
bus = MateNET(settings.SERIAL_PORT)


def print_device(d):
dtype = d.scan()
Expand Down
68 changes: 0 additions & 68 deletions scan_pjon.py

This file was deleted.

5 changes: 3 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#SERIAL_PORT = '/dev/ttyUSB0'
SERIAL_PORT = 'COM1'
#SERIAL_PORT = '/dev/ttyUSB0'
SERIAL_PORT = 'COM1'
SERIAL_PROTO = 'MATE' # 'PJON' or 'MATE'

0 comments on commit 6834797

Please sign in to comment.