-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FBT: Optimize icons blob -4KB DFU, scrub unused icons (#291)
* Unused icons to check later * Exclude disabled icons from firmware * Format * Also report free flash in gh comment * Fix free flash calc * Fix? * Fix?? * Split to next line * Remove dead icons * Some spring cleaning of icons cooker * Improve unused icons script * Disable icons that cant be used in asset packs * These will need a workaround for external * Revert "These will need a workaround for external" This reverts commit fb23d97. * Here's the workaround: split assets lib now there is "assets" and "fwassets" firmware links with fwassets and includes all icons however not all of them are exposed to api if an app needs a firmware icon not in api, it can use fap_libs=["assets"] this will link against this dummy assets lib it only contains the icons that arent exposed to api this way, an app using assets lib will still benefit from asset packs but at same time, we can remove pointless icons from dfu blob * Update changelog
- Loading branch information
Showing
24 changed files
with
183 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ App( | |
stack_size=1 * 1024, | ||
order=1000, | ||
fap_category="assets", | ||
fap_libs=["assets"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ App( | |
stack_size=1 * 1024, | ||
order=40, | ||
fap_category="assets", | ||
fap_libs=["assets"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ App( | |
stack_size=2 * 1024, | ||
order=30, | ||
fap_category="assets", | ||
fap_libs=["assets"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
import pathlib | ||
|
||
root = pathlib.Path(__file__).parent / ".." | ||
icons = root / "assets/icons" | ||
|
||
|
||
def count_icon_usages(name: str): | ||
count = 0 | ||
name = name.encode() | ||
# EXTREMELY wasteful, but who cares | ||
for dir in ("applications", "furi", "lib", "targets"): | ||
for filetype in (".c", ".cpp", ".h", ".fam"): | ||
for file in (root / dir).glob(f"**/*{filetype}"): | ||
try: | ||
if name in file.read_bytes(): | ||
count += 1 | ||
except Exception: | ||
print(f"Failed to read {file}") | ||
return count | ||
|
||
|
||
if __name__ == "__main__": | ||
counts = {} | ||
|
||
for category in icons.iterdir(): | ||
if not category.is_dir(): | ||
continue | ||
for icon in category.iterdir(): | ||
if icon.is_dir() and (icon / "frame_rate").is_file(): | ||
name = "A_" + icon.name.replace("-", "_") | ||
elif icon.is_file() and icon.suffix == ".png": | ||
name = "I_" + "_".join(icon.name.split(".")[:-1]).replace("-", "_") | ||
else: | ||
continue | ||
counts[name[2:]] = count_icon_usages(name) | ||
|
||
for name, count in sorted(counts.items(), key=lambda x: x[1], reverse=True): | ||
print(f"{name} used {count} times") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.