Пример #1
0
def get_id(ent):
    logging.debug('get_id')
    with Serial(PORT, 115200, timeout=1) as ser:
        ent.config(state='normal')
        ent.delete(0, tk.END)
        ent.insert(0, get_flash_id(ser))
        ent.config(state='readonly')
Пример #2
0
    save_default_port(PORT)

    if is_logging(ser):
        r = input(
            'Cannot rename logger while it is running. Stop it? (yes/no; default=no)'
        )
        if 'yes' == r.strip():
            stop_logging(ser)
        else:
            print('Terminating.')
            sys.exit()

    try:
        name = get_logger_name(ser)
        flash_id = get_flash_id(ser)

        print('Current logger name: {} (ID={})'.format(name, flash_id))
    except UnicodeDecodeError:
        pass

    name = ''
    while True:
        newname = input('Enter new name (max. 15 characters): ')
        if len(newname) <= 15:
            break

    cool = False
    for i in range(10):
        ser.write('set_logger_name{}\n'.format(newname).encode())
        time.sleep(0.5)
Пример #3
0
 def get_id(self):
     logging.debug('get_id')
     with Serial(PORT, 115200, timeout=1) as ser:
         self.label1.set(get_flash_id(ser))