diff options
| author | Sudar Muthu <sudar@sudarmuthu.com> | 2020-09-03 07:22:54 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-03 07:22:54 +0530 |
| commit | e6881e2a43f02e0abf22bf28abc46b3c2e406d84 (patch) | |
| tree | 78df2b3c6e1fc185f13199add4f784026c58f6b6 /bin/ard-reset-arduino | |
| parent | 6f786a96b0acfb0c9b2d2f4e39911d2803088729 (diff) | |
| parent | 2329d19b97a3a3a115b6a414a6235f5d398bae2b (diff) | |
Merge pull request #640 from tuna-f1sh/travis
Fix Travis CI, add SAMD test support, support GNU grep on macOS
Diffstat (limited to 'bin/ard-reset-arduino')
| -rwxr-xr-x | bin/ard-reset-arduino | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino index d6f974f..69a442e 100755 --- a/bin/ard-reset-arduino +++ b/bin/ard-reset-arduino @@ -1,18 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/python3 -from __future__ import print_function import serial import serial.tools.list_ports import os.path import argparse from time import sleep -pyserial_version = None -try: - pyserial_version = int(serial.VERSION[0]) -except: - pyserial_version = 2 # less than 2.3 - parser = argparse.ArgumentParser(description='Reset an Arduino') parser.add_argument('--zero', action='store_true', help='Reset Arduino Zero or similar Native USB to enter bootloader') parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.') @@ -65,11 +58,7 @@ if args.zero: ser = serial.Serial(args.port[0], 57600) ser.close() - - if pyserial_version < 3: - ser.setBaudrate(1200) - else: - ser.baudrate = 1200 + ser.baudrate = 1200 # do the open/close at 1200 BAUD ser.open() @@ -100,7 +89,7 @@ if args.zero: # check if a new port has attached and return the index if it has port_index = new_port(initial_ports, reset_ports) # return the new port if detected, otherwise return passed port - if port_index is -1: + if port_index == -1: bootloader_port = args.port[0] else: bootloader_port = reset_ports[port_index] |
