Serial Port is now provided as argument

This commit is contained in:
GHOSCHT 2021-08-24 21:44:51 +02:00
parent 61d36a8f90
commit 2a5c3e8e13
4 changed files with 45 additions and 10 deletions

View file

@ -52,7 +52,7 @@ upload_flags =
-v
-V
-D
upload_command = python switchDevice.py && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_command = python switchDevice.py ${env:Upload_UART_Forwarded.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to upload with this environment

View file

@ -1,6 +1,23 @@
import serial
import time
ser = serial.Serial("COM5")
ser.write(b's')
ser.close()
time.sleep(1)
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
if len(sys.argv) == 1:
print(f"{bcolors.FAIL}Please enter COM Port as argument{bcolors.ENDC}")
else:
ser = serial.Serial(sys.argv[1])
ser.write(b's')
ser.close()
print(f"{bcolors.OKGREEN}Forwarding activated{bcolors.ENDC}")
time.sleep(1)

View file

@ -1,6 +1,24 @@
import serial
import time
ser = serial.Serial("COM5")
ser.write(b'r')
ser.close()
time.sleep(1)
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
if len(sys.argv) == 1:
print(f"{bcolors.FAIL}Please enter COM Port as argument{bcolors.ENDC}")
else:
ser = serial.Serial(sys.argv[1])
ser.write(b'r')
ser.close()
print(f"{bcolors.OKGREEN}Reset enabled{bcolors.ENDC}")
time.sleep(1)

View file

@ -43,7 +43,7 @@ upload_flags =
-v
-V
-D
upload_command = python enableReset.py && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
upload_command = python enableReset.py ${env:Upload_UART.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to upload with this environment
; pio run -e Upload_ISP -t upload