Prusa MINI Firmware overview
create_custom_upload_command_CDC Namespace Reference

Functions

def get_com_port (com_search_text, descr_search_text, start)
 

Variables

 current_OS = platform.system()
 
 env = DefaultEnvironment()
 
 build_type = os.environ.get("BUILD_TYPE", 'Not Set')
 
 UPLOAD_PROTOCOL
 
string com_first = ''
 
string com_last = ''
 
string com_CDC = ''
 
string description_first = ''
 
string description_last = ''
 
string description_CDC = ''
 
string avrdude_conf_path = 'buildroot\\share\\atom\\avrdude.conf'
 
string avrdude_exe_path = 'buildroot\\share\\atom\\avrdude_5.10.exe'
 
string source_path = '.pio\\build\\' + env.get("PIOENV") + '\\firmware.hex'
 
string upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'
 
 UPLOADCMD
 
 MAXIMUM_RAM_SIZE
 
 MAXIMUM_SIZE
 

Function Documentation

◆ get_com_port()

def create_custom_upload_command_CDC.get_com_port (   com_search_text,
  descr_search_text,
  start 
)
42  def get_com_port(com_search_text, descr_search_text, start):
43 
44  global com_first
45  global com_last
46  global com_CDC
47  global description_first
48  global description_last
49  global description_CDC
50 
51 
52  print('\nLooking for Serial Port\n')
53 
54  # stream output from subprocess and split it into lines
55  pio_subprocess = subprocess.Popen(['platformio', 'device', 'list'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
56 
57  looking_for_description = False
58  for line in iter(pio_subprocess.stdout.readline, ''):
59  if 0 <= line.find(com_search_text):
60  looking_for_description = True
61  com_last = line.replace('\n', '')
62  if com_first == '':
63  com_first = com_last
64  if 0 <= line.find(descr_search_text) and looking_for_description:
65  looking_for_description = False
66  description_last = line[ start : ]
67  if description_first == '':
68  description_first = description_last
69  if 0 <= description_last.find('CDC'):
70  com_CDC = com_last
71  description_CDC = description_last
72 
73  if com_CDC == '' and com_first != '':
74  com_CDC = com_first
75  description_CDC = description_first
76  elif com_CDC == '':
77  com_CDC = 'COM_PORT_NOT_FOUND'
78 
79  while 0 <= com_CDC.find('\n'):
80  com_CDC = com_CDC.replace('\n', '')
81  while 0 <= com_CDC.find('\r'):
82  com_CDC = com_CDC.replace('\r', '')
83 
84  if com_CDC == 'COM_PORT_NOT_FOUND':
85  print(com_CDC, '\n')
86  else:
87  print('FOUND: ', com_CDC)
88  print('DESCRIPTION: ', description_CDC, '\n')
89 

Variable Documentation

◆ current_OS

create_custom_upload_command_CDC.current_OS = platform.system()

◆ env

create_custom_upload_command_CDC.env = DefaultEnvironment()

◆ build_type

create_custom_upload_command_CDC.build_type = os.environ.get("BUILD_TYPE", 'Not Set')

◆ UPLOAD_PROTOCOL

create_custom_upload_command_CDC.UPLOAD_PROTOCOL

◆ com_first

string create_custom_upload_command_CDC.com_first = ''

◆ com_last

string create_custom_upload_command_CDC.com_last = ''

◆ com_CDC

string create_custom_upload_command_CDC.com_CDC = ''

◆ description_first

string create_custom_upload_command_CDC.description_first = ''

◆ description_last

string create_custom_upload_command_CDC.description_last = ''

◆ description_CDC

string create_custom_upload_command_CDC.description_CDC = ''

◆ avrdude_conf_path

string create_custom_upload_command_CDC.avrdude_conf_path = 'buildroot\\share\\atom\\avrdude.conf'

◆ avrdude_exe_path

string create_custom_upload_command_CDC.avrdude_exe_path = 'buildroot\\share\\atom\\avrdude_5.10.exe'

◆ source_path

string create_custom_upload_command_CDC.source_path = '.pio\\build\\' + env.get("PIOENV") + '\\firmware.hex'

◆ upload_string

string create_custom_upload_command_CDC.upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'

◆ UPLOADCMD

create_custom_upload_command_CDC.UPLOADCMD

◆ MAXIMUM_RAM_SIZE

create_custom_upload_command_CDC.MAXIMUM_RAM_SIZE

◆ MAXIMUM_SIZE

create_custom_upload_command_CDC.MAXIMUM_SIZE
create_custom_upload_command_CDC.get_com_port
def get_com_port(com_search_text, descr_search_text, start)
Definition: create_custom_upload_command_CDC.py:42