|
@ -38,15 +38,19 @@ def on_service_state_change(zeroconf, service_type, name, state_change): |
|
|
device['app'] = info.properties.get('app_name', '') |
|
|
device['app'] = info.properties.get('app_name', '') |
|
|
device['version'] = info.properties.get('app_version', '') |
|
|
device['version'] = info.properties.get('app_version', '') |
|
|
device['device'] = info.properties.get('target_board', '') |
|
|
device['device'] = info.properties.get('target_board', '') |
|
|
device['mem_size'] = info.properties.get('mem_size', '') |
|
|
|
|
|
device['sdk_size'] = info.properties.get('sdk_size', '') |
|
|
|
|
|
|
|
|
if 'mem_size' in info.properties: |
|
|
|
|
|
device['mem_size'] = info.properties.get('mem_size') |
|
|
|
|
|
if 'sdk_size' in info.properties: |
|
|
|
|
|
device['sdk_size'] = info.properties.get('sdk_size') |
|
|
|
|
|
if 'free_space' in info.properties: |
|
|
|
|
|
device['free_space'] = info.properties.get('free_space') |
|
|
devices.append(device) |
|
|
devices.append(device) |
|
|
|
|
|
|
|
|
def list(): |
|
|
def list(): |
|
|
''' |
|
|
''' |
|
|
Shows the list of discovered devices |
|
|
Shows the list of discovered devices |
|
|
''' |
|
|
''' |
|
|
output_format="{:>3} {:<25}{:<25}{:<15}{:<15}{:<30}{:<10}{:<10}" |
|
|
|
|
|
|
|
|
output_format="{:>3} {:<25}{:<25}{:<15}{:<15}{:<30}{:<10}{:<10}{:<10}" |
|
|
print(output_format.format( |
|
|
print(output_format.format( |
|
|
"#", |
|
|
"#", |
|
|
"HOSTNAME", |
|
|
"HOSTNAME", |
|
@ -56,8 +60,9 @@ def list(): |
|
|
"DEVICE", |
|
|
"DEVICE", |
|
|
"MEM_SIZE", |
|
|
"MEM_SIZE", |
|
|
"SDK_SIZE", |
|
|
"SDK_SIZE", |
|
|
|
|
|
"FREE_SPACE" |
|
|
)) |
|
|
)) |
|
|
print "-" * 135 |
|
|
|
|
|
|
|
|
print "-" * 146 |
|
|
|
|
|
|
|
|
index = 0 |
|
|
index = 0 |
|
|
for device in devices: |
|
|
for device in devices: |
|
@ -71,6 +76,7 @@ def list(): |
|
|
device.get('device', ''), |
|
|
device.get('device', ''), |
|
|
device.get('mem_size', ''), |
|
|
device.get('mem_size', ''), |
|
|
device.get('sdk_size', ''), |
|
|
device.get('sdk_size', ''), |
|
|
|
|
|
device.get('free_space', ''), |
|
|
)) |
|
|
)) |
|
|
|
|
|
|
|
|
print |
|
|
print |
|
@ -161,6 +167,7 @@ if __name__ == '__main__': |
|
|
# Parse command line options |
|
|
# Parse command line options |
|
|
parser = argparse.ArgumentParser(description=description) |
|
|
parser = argparse.ArgumentParser(description=description) |
|
|
#parser.add_argument("-v", "--verbose", help="show verbose output", default=0, action='count') |
|
|
#parser.add_argument("-v", "--verbose", help="show verbose output", default=0, action='count') |
|
|
|
|
|
parser.add_argument("-c", "--core", help="flash ESPurna core", default=0, action='count') |
|
|
parser.add_argument("-f", "--flash", help="flash device", default=0, action='count') |
|
|
parser.add_argument("-f", "--flash", help="flash device", default=0, action='count') |
|
|
parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') |
|
|
parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') |
|
|
args = parser.parse_args() |
|
|
args = parser.parse_args() |
|
@ -194,6 +201,10 @@ if __name__ == '__main__': |
|
|
device = flash() |
|
|
device = flash() |
|
|
if device: |
|
|
if device: |
|
|
|
|
|
|
|
|
|
|
|
# Flash core version? |
|
|
|
|
|
if args.core > 0: |
|
|
|
|
|
device['flags'] = "-DESPURNA_CORE " + device['flags'] |
|
|
|
|
|
|
|
|
env = "esp8266-%sm-ota" % device['size'] |
|
|
env = "esp8266-%sm-ota" % device['size'] |
|
|
|
|
|
|
|
|
# Summary |
|
|
# Summary |
|
|