|
@ -654,9 +654,6 @@ def line_print(line_input): |
|
|
global warning_continue |
|
|
global warning_continue |
|
|
global line_counter |
|
|
global line_counter |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# all '0' elements must precede all '1' elements or they'll be skipped |
|
|
# all '0' elements must precede all '1' elements or they'll be skipped |
|
|
platformio_highlights = [ |
|
|
platformio_highlights = [ |
|
|
['Environment', 0, 'highlight_blue'], |
|
|
['Environment', 0, 'highlight_blue'], |
|
@ -715,7 +712,6 @@ def line_print(line_input): |
|
|
# end - write_to_screen_with_replace |
|
|
# end - write_to_screen_with_replace |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# scan the line |
|
|
# scan the line |
|
|
line_counter = line_counter + 1 |
|
|
line_counter = line_counter + 1 |
|
|
max_search = len(line_input) |
|
|
max_search = len(line_input) |
|
@ -810,9 +806,6 @@ def line_print(line_input): |
|
|
# end - line_print |
|
|
# end - line_print |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_PIO(dummy): |
|
|
|
|
|
|
|
|
|
|
|
########################################################################## |
|
|
########################################################################## |
|
|
# # |
|
|
# # |
|
|
# run Platformio # |
|
|
# run Platformio # |
|
@ -830,6 +823,60 @@ def run_PIO(dummy): |
|
|
# debug platformio debug -e target_env |
|
|
# debug platformio debug -e target_env |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sys_PIO(): |
|
|
|
|
|
|
|
|
|
|
|
########################################################################## |
|
|
|
|
|
# # |
|
|
|
|
|
# run Platformio inside the same shell as this Python script # |
|
|
|
|
|
# # |
|
|
|
|
|
########################################################################## |
|
|
|
|
|
|
|
|
|
|
|
global build_type |
|
|
|
|
|
global target_env |
|
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
print('build_type: ', build_type) |
|
|
|
|
|
print('starting platformio') |
|
|
|
|
|
|
|
|
|
|
|
if build_type == 'build': |
|
|
|
|
|
# pio_result = os.system("echo -en '\033c'") |
|
|
|
|
|
pio_result = os.system('platformio run -e ' + target_env) |
|
|
|
|
|
elif build_type == 'clean': |
|
|
|
|
|
pio_result = os.system('platformio run --target clean -e ' + target_env) |
|
|
|
|
|
elif build_type == 'upload': |
|
|
|
|
|
pio_result = os.system('platformio run --target upload -e ' + target_env) |
|
|
|
|
|
elif build_type == 'traceback': |
|
|
|
|
|
pio_result = os.system('platformio run --target upload -e ' + target_env) |
|
|
|
|
|
elif build_type == 'program': |
|
|
|
|
|
pio_result = os.system('platformio run --target program -e ' + target_env) |
|
|
|
|
|
elif build_type == 'test': |
|
|
|
|
|
pio_result = os.system('platformio test upload -e ' + target_env) |
|
|
|
|
|
elif build_type == 'remote': |
|
|
|
|
|
pio_result = os.system('platformio remote run --target program -e ' + target_env) |
|
|
|
|
|
elif build_type == 'debug': |
|
|
|
|
|
pio_result = os.system('platformio debug -e ' + target_env) |
|
|
|
|
|
else: |
|
|
|
|
|
print('ERROR - unknown build type: ', build_type) |
|
|
|
|
|
raise SystemExit(0) # kill everything |
|
|
|
|
|
|
|
|
|
|
|
# stream output from subprocess and split it into lines |
|
|
|
|
|
#for line in iter(pio_subprocess.stdout.readline, ''): |
|
|
|
|
|
# line_print(line.replace('\n', '')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# append info used to run PlatformIO |
|
|
|
|
|
# write_to_screen_queue('\nBoard name: ' + board_name + '\n') # put build info at the bottom of the screen |
|
|
|
|
|
# write_to_screen_queue('Build type: ' + build_type + '\n') |
|
|
|
|
|
# write_to_screen_queue('Environment used: ' + target_env + '\n') |
|
|
|
|
|
# write_to_screen_queue(str(datetime.now()) + '\n') |
|
|
|
|
|
|
|
|
|
|
|
# end - sys_PIO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_PIO(dummy): |
|
|
|
|
|
|
|
|
global build_type |
|
|
global build_type |
|
|
global target_env |
|
|
global target_env |
|
|
global board_name |
|
|
global board_name |
|
@ -906,6 +953,7 @@ def run_PIO(dummy): |
|
|
# end - run_PIO |
|
|
# end - run_PIO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######################################################################## |
|
|
######################################################################## |
|
|
|
|
|
|
|
|
import time |
|
|
import time |
|
@ -926,7 +974,6 @@ from tkMessageBox import askokcancel |
|
|
import tkFileDialog |
|
|
import tkFileDialog |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class output_window(Text): |
|
|
class output_window(Text): |
|
|
# based on Super Text |
|
|
# based on Super Text |
|
|
global continue_updates |
|
|
global continue_updates |
|
@ -1238,6 +1285,10 @@ def main(): |
|
|
os.environ["TARGET_ENV"] = target_env |
|
|
os.environ["TARGET_ENV"] = target_env |
|
|
os.environ["BOARD_NAME"] = board_name |
|
|
os.environ["BOARD_NAME"] = board_name |
|
|
|
|
|
|
|
|
|
|
|
# Re-use the VSCode terminal, if possible |
|
|
|
|
|
if os.environ.get('PLATFORMIO_CALLER', '') == 'vscode': |
|
|
|
|
|
sys_PIO() |
|
|
|
|
|
else: |
|
|
auto_build = output_window() |
|
|
auto_build = output_window() |
|
|
auto_build.start_thread() # executes the "run_PIO" function |
|
|
auto_build.start_thread() # executes the "run_PIO" function |
|
|
|
|
|
|
|
|