aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJohn Whittington <git@jbrengineering.co.uk>2020-08-05 18:22:29 +0200
committerJohn Whittington <git@jbrengineering.co.uk>2020-08-05 18:22:29 +0200
commit517fe4a632b57a6c4ee2754bbb06470055427a5e (patch)
tree982ca56447615221c9a66de551cb2f79e4fc973d /bin
parent26e34cd6f2471f04ba097001a215caed12a8574a (diff)
parent88dc641c8d582f28243141052517fe03e92e6687 (diff)
Merge remote-tracking branch 'sej7278/python3'
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ard-reset-arduino17
-rwxr-xr-xbin/ardmk-init6
-rwxr-xr-xbin/robotis-loader4
3 files changed, 8 insertions, 19 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]
diff --git a/bin/ardmk-init b/bin/ardmk-init
index 51b12f0..11d1126 100755
--- a/bin/ardmk-init
+++ b/bin/ardmk-init
@@ -1,4 +1,5 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
+
"""
Arduino-mk Makefile and project initialiser
@@ -17,7 +18,6 @@ Example:
See `armk-init --help` for CLI arguments
"""
-from __future__ import print_function
import os
import argparse
@@ -54,7 +54,7 @@ PARSER.add_argument('--cli', action='store_true', help='run with user prompts (r
PARSER.add_argument('-P', '--project', action='store_true',
help='create boilerplate project with src, lib and bin folder structure')
PARSER.add_argument('-t', '--template', action='store_true',
- help='create bare minimum Arduino source file')
+ help='create bare minimum Arduino source file')
PARSER.add_argument('-V', '--version', action='version', version='%(prog)s '+ VERSION)
ARGS = PARSER.parse_args()
diff --git a/bin/robotis-loader b/bin/robotis-loader
index 95d4e71..3f3c21b 100755
--- a/bin/robotis-loader
+++ b/bin/robotis-loader
@@ -1,8 +1,8 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This script sends a program on a robotis board (OpenCM9.04 or CM900)
# using the robotis bootloader (used in OpenCM IDE)
-#
+#
# Usage:
# python robotis-loader.py <serial port> <binary>
#