Skip to content

Commit d9247fc

Browse files
committed
dump build flags with value
... I'm still trying to write C code in python ;-)
1 parent 42e7805 commit d9247fc

File tree

1 file changed

+53
-16
lines changed

1 file changed

+53
-16
lines changed

pio-scripts/output_bins.py

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,75 @@ def _create_dirs(dirs=["firmware", "map"]):
2323
os.mkdir("{}{}".format(OUTPUT_DIR, d))
2424

2525

26+
# trick for py2/3 compatibility
27+
if 'basestring' not in globals():
28+
basestring = str
29+
30+
# WLEDMM : custom print function
31+
def print_my_item(items):
32+
print(" ", end='')
33+
if isinstance(items, basestring):
34+
# print a single string
35+
print(items, end='')
36+
else:
37+
# print a list
38+
first = True
39+
for item in items:
40+
if not first: print("=", end='')
41+
print(item, end='')
42+
first = False
43+
2644
# WLEDMM : dump out buildflags : usermods, disable, enable, use_..
2745
def wledmm_print_build_info(env):
46+
all_flags = env["CPPDEFINES"]
2847
first = True
2948

30-
for item in env["CPPDEFINES"]:
31-
if 'USERMOD_' in item or 'UM_' in item:
49+
found = False
50+
for item in all_flags:
51+
if 'WLED_RELEASE_NAME' in item[0] or 'WLED_VERSION' in item[0] or 'ARDUINO_USB_CDC_ON_BOOT' in item[0]:
3252
if first: print("\nUsermods and Features:")
33-
print(" " + item, end='')
53+
print_my_item(item)
3454
first = False
35-
if not first: print("")
55+
found = True
56+
if found: print("")
3657

37-
for item in env["CPPDEFINES"]:
38-
if 'WLED_DISABLE' in item or 'NET_DEBUG_' in item or 'WIFI_FIX' in item:
58+
found = False
59+
for item in all_flags:
60+
if 'USERMOD_' in item or 'UM_' in item:
3961
if first: print("\nUsermods and Features:")
40-
print(" " + item, end='')
62+
print_my_item(item)
4163
first = False
42-
if not first: print("")
64+
found = True
65+
if found: print("")
4366

44-
for item in env["CPPDEFINES"]:
45-
if 'WLED_' in item and not 'WLED_USE_MY_CONFIG' in item and not 'WLED_RELEASE_NAME' in item and not 'WLED_VESION' in item and not 'WLED_WATCHDOG_TIMEOUT' in item and not 'WLED_DISABLE' in item and not 'ARDUINO_PARTITION' in item:
67+
found = False
68+
for item in all_flags:
69+
if 'WLED_DISABLE' in item or 'WIFI_FIX' in item:
4670
if first: print("\nUsermods and Features:")
47-
print(" " + item, end='')
71+
print_my_item(item)
4872
first = False
49-
if not first: print("")
73+
found = True
74+
if found: print("")
75+
76+
found = False
77+
for item in all_flags:
78+
if 'WLED_' in item or 'WLED_' in item[0] or 'MAX_LED' in item[0]:
79+
if not 'WLED_RELEASE_NAME' in item[0] and not 'WLED_VERSION' in item[0] and not 'WLED_WATCHDOG_TIMEOUT' in item[0] and not 'WLED_DISABLE' in item and not 'WLED_USE_MY_CONFIG' in item and not 'ARDUINO_PARTITION' in item:
80+
if first: print("\nUsermods and Features:")
81+
print_my_item(item)
82+
first = False
83+
found = True
84+
if found: print("")
5085

5186
first = True
52-
for item in env["CPPDEFINES"]:
53-
if 'WLEDMM_' in item or 'O2' in item or 'O3' in item or 'fast_' in item:
87+
found = False
88+
for item in all_flags:
89+
if 'WLEDMM_' in item[0] or 'WLEDMM_' in item or 'TROYHACKS' in item:
5490
if first: print("\nWLEDMM Features:")
55-
print(" " + item, end='')
91+
print_my_item(item)
5692
first = False
57-
if not first: print("\n")
93+
found = True
94+
if found: print("\n")
5895

5996

6097
def bin_rename_copy(source, target, env):

0 commit comments

Comments
 (0)