diff --git a/applications/debug/locale_test/application.fam b/applications/debug/locale_test/application.fam index 32d065299..e46eeff51 100644 --- a/applications/debug/locale_test/application.fam +++ b/applications/debug/locale_test/application.fam @@ -8,4 +8,4 @@ App( stack_size=2 * 1024, order=70, fap_category="Debug", -) \ No newline at end of file +) diff --git a/applications/main/application.fam b/applications/main/application.fam index 376af8c42..9820ee3ac 100644 --- a/applications/main/application.fam +++ b/applications/main/application.fam @@ -25,13 +25,13 @@ App( apptype=FlipperAppType.METAPACKAGE, provides=[ "gpio", - #"ibutton", + # "ibutton", "infrared", "lfrfid", "nfc", "subghz", - #"bad_usb", - #"u2f", + # "bad_usb", + # "u2f", "fap_loader", "archive", ], diff --git a/applications/plugins/application.fam b/applications/plugins/application.fam index 3e5a654aa..3331888f2 100644 --- a/applications/plugins/application.fam +++ b/applications/plugins/application.fam @@ -3,7 +3,7 @@ App( name="Basic applications for plug-in menu", apptype=FlipperAppType.METAPACKAGE, provides=[ - "music_player", + "music_player", "music_beeper", "snake_game", "bt_hid", diff --git a/applications/plugins/asteroids/application.fam b/applications/plugins/asteroids/application.fam index 0a56122e7..f5ad2cdb9 100644 --- a/applications/plugins/asteroids/application.fam +++ b/applications/plugins/asteroids/application.fam @@ -5,7 +5,7 @@ App( entry_point="asteroids_app_entry", cdefines=["APP_PROTOVIEW"], requires=["gui"], - stack_size=8*1024, + stack_size=8 * 1024, order=50, fap_icon="appicon.png", fap_category="Games", diff --git a/applications/plugins/blackjack/application.fam b/applications/plugins/blackjack/application.fam index 8230cd047..489ce2aeb 100644 --- a/applications/plugins/blackjack/application.fam +++ b/applications/plugins/blackjack/application.fam @@ -4,10 +4,10 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="blackjack_app", cdefines=["APP_BLACKJACK"], - requires=["gui","storage","canvas"], + requires=["gui", "storage", "canvas"], stack_size=2 * 1024, order=30, fap_icon="blackjack_10px.png", fap_category="Games", - fap_icon_assets="assets" -) \ No newline at end of file + fap_icon_assets="assets", +) diff --git a/applications/plugins/cli_bridge/application.fam b/applications/plugins/cli_bridge/application.fam index 60cd9648d..f5f294d9b 100644 --- a/applications/plugins/cli_bridge/application.fam +++ b/applications/plugins/cli_bridge/application.fam @@ -3,7 +3,7 @@ App( name="CLI (subghz chat)", apptype=FlipperAppType.EXTERNAL, entry_point="cligui_main", - requires=["gui","cli"], + requires=["gui", "cli"], stack_size=8 * 1024, fap_icon="cligui.png", fap_category="Tools", diff --git a/applications/plugins/clock_app/application.fam b/applications/plugins/clock_app/application.fam index 644fbb65f..a6a2eff3e 100644 --- a/applications/plugins/clock_app/application.fam +++ b/applications/plugins/clock_app/application.fam @@ -7,4 +7,4 @@ App( stack_size=2 * 1024, fap_icon="clock.png", fap_category="Tools", -) \ No newline at end of file +) diff --git a/applications/plugins/counter/application.fam b/applications/plugins/counter/application.fam index bb2e58df1..5d164f20c 100644 --- a/applications/plugins/counter/application.fam +++ b/applications/plugins/counter/application.fam @@ -9,4 +9,4 @@ App( fap_category="Misc", fap_icon="icons/counter_icon.png", fap_icon_assets="icons", -) \ No newline at end of file +) diff --git a/applications/plugins/dolphinbackup/application.fam b/applications/plugins/dolphinbackup/application.fam index 024c1b197..166f9a22b 100644 --- a/applications/plugins/dolphinbackup/application.fam +++ b/applications/plugins/dolphinbackup/application.fam @@ -9,4 +9,4 @@ App( order=85, fap_icon="bckupIcon.png", fap_category="Tools", -) \ No newline at end of file +) diff --git a/applications/plugins/dolphinrestorer/application.fam b/applications/plugins/dolphinrestorer/application.fam index 46699404a..afd263c45 100644 --- a/applications/plugins/dolphinrestorer/application.fam +++ b/applications/plugins/dolphinrestorer/application.fam @@ -4,9 +4,9 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="drestorer_app", cdefines=["APP_DRESTORER"], - requires=["gui","storage"], - stack_size= 2 * 1024, + requires=["gui", "storage"], + stack_size=2 * 1024, order=90, fap_icon="restoreIcon.png", fap_category="Tools", -) \ No newline at end of file +) diff --git a/applications/plugins/flashlight/application.fam b/applications/plugins/flashlight/application.fam index 368e14833..6d70a036f 100644 --- a/applications/plugins/flashlight/application.fam +++ b/applications/plugins/flashlight/application.fam @@ -11,4 +11,4 @@ App( order=20, fap_icon="flash10px.png", fap_category="GPIO", -) \ No newline at end of file +) diff --git a/applications/plugins/flipper_i2ctools/application.fam b/applications/plugins/flipper_i2ctools/application.fam index d8d10dfce..f6522a86e 100644 --- a/applications/plugins/flipper_i2ctools/application.fam +++ b/applications/plugins/flipper_i2ctools/application.fam @@ -10,4 +10,4 @@ App( fap_icon="i2ctools.png", fap_category="GPIO", fap_icon_assets="images", -) \ No newline at end of file +) diff --git a/applications/plugins/game_2048/application.fam b/applications/plugins/game_2048/application.fam index c8940c881..f2456668e 100644 --- a/applications/plugins/game_2048/application.fam +++ b/applications/plugins/game_2048/application.fam @@ -10,6 +10,6 @@ App( ], stack_size=1 * 1024, order=90, - fap_icon="game_2048.png", - fap_category="Games" -) \ No newline at end of file + fap_icon="game_2048.png", + fap_category="Games", +) diff --git a/applications/plugins/gpioreader2/application.fam b/applications/plugins/gpioreader2/application.fam index 57792fd0c..bf25c323d 100644 --- a/applications/plugins/gpioreader2/application.fam +++ b/applications/plugins/gpioreader2/application.fam @@ -8,4 +8,4 @@ App( fap_category="GPIO", fap_icon="icon.png", order=1, -) \ No newline at end of file +) diff --git a/applications/plugins/hc_sr04/application.fam b/applications/plugins/hc_sr04/application.fam index da91a0864..bfbb2daa8 100644 --- a/applications/plugins/hc_sr04/application.fam +++ b/applications/plugins/hc_sr04/application.fam @@ -11,4 +11,4 @@ App( order=20, fap_icon="dist_sensor10px.png", fap_category="GPIO", -) \ No newline at end of file +) diff --git a/applications/plugins/htu21d_temp_sensor/application.fam b/applications/plugins/htu21d_temp_sensor/application.fam index 5807d7f51..724f55cd5 100644 --- a/applications/plugins/htu21d_temp_sensor/application.fam +++ b/applications/plugins/htu21d_temp_sensor/application.fam @@ -9,6 +9,6 @@ App( ], stack_size=2 * 1024, order=90, - fap_icon="temperature_sensor.png", + fap_icon="temperature_sensor.png", fap_category="GPIO", ) diff --git a/applications/plugins/ifttt/application.fam b/applications/plugins/ifttt/application.fam index 495627429..75e5beb67 100644 --- a/applications/plugins/ifttt/application.fam +++ b/applications/plugins/ifttt/application.fam @@ -11,4 +11,4 @@ App( order=20, fap_icon="icon.png", fap_category="GPIO", -) \ No newline at end of file +) diff --git a/applications/plugins/morse_code/application.fam b/applications/plugins/morse_code/application.fam index 1cc7bdaa1..73ad2ba81 100644 --- a/applications/plugins/morse_code/application.fam +++ b/applications/plugins/morse_code/application.fam @@ -10,6 +10,5 @@ App( stack_size=1 * 1024, order=20, fap_icon="morse_code_10px.png", - fap_category="Music" - -) \ No newline at end of file + fap_category="Music", +) diff --git a/applications/plugins/mouse_jiggler/application.fam b/applications/plugins/mouse_jiggler/application.fam index 6c529a883..6115315f5 100644 --- a/applications/plugins/mouse_jiggler/application.fam +++ b/applications/plugins/mouse_jiggler/application.fam @@ -9,4 +9,4 @@ App( order=150, fap_icon="mouse_10px.png", fap_category="Misc", -) \ No newline at end of file +) diff --git a/applications/plugins/namechanger/application.fam b/applications/plugins/namechanger/application.fam index 545f0b905..704b643c5 100644 --- a/applications/plugins/namechanger/application.fam +++ b/applications/plugins/namechanger/application.fam @@ -4,10 +4,10 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="namechanger_app", cdefines=["APP_NAMECHANGER"], - requires=["gui","storage"], + requires=["gui", "storage"], stack_size=2 * 1024, order=90, fap_icon="namechanger_10px.png", fap_category="Tools", - fap_icon_assets="icons", -) \ No newline at end of file + fap_icon_assets="icons", +) diff --git a/applications/plugins/paint/application.fam b/applications/plugins/paint/application.fam index 0630abbce..d727ab2d2 100644 --- a/applications/plugins/paint/application.fam +++ b/applications/plugins/paint/application.fam @@ -9,4 +9,4 @@ App( order=175, fap_icon="paintIcon.png", fap_category="Misc", -) \ No newline at end of file +) diff --git a/applications/plugins/passgen/application.fam b/applications/plugins/passgen/application.fam index 78d810a1d..94005e716 100644 --- a/applications/plugins/passgen/application.fam +++ b/applications/plugins/passgen/application.fam @@ -9,4 +9,4 @@ App( fap_category="Tools", fap_icon="icons/passgen_icon.png", fap_icon_assets="icons", -) \ No newline at end of file +) diff --git a/applications/plugins/protoview/application.fam b/applications/plugins/protoview/application.fam index 6cd31372e..d3614524c 100644 --- a/applications/plugins/protoview/application.fam +++ b/applications/plugins/protoview/application.fam @@ -5,7 +5,7 @@ App( entry_point="protoview_app_entry", cdefines=["APP_PROTOVIEW"], requires=["gui"], - stack_size=8*1024, + stack_size=8 * 1024, order=50, fap_icon="appicon.png", fap_category="Tools", diff --git a/applications/plugins/qrcode/application.fam b/applications/plugins/qrcode/application.fam index 6de585837..68a378fa4 100644 --- a/applications/plugins/qrcode/application.fam +++ b/applications/plugins/qrcode/application.fam @@ -1,7 +1,7 @@ App( appid="QRCode", name="QR Code", - fap_version=(1,0), + fap_version=(1, 0), fap_description="Display qrcodes", fap_author="Bob Matcuk", fap_weburl="https://github.com/bmatcuk/flipperzero-qrcode", @@ -17,4 +17,4 @@ App( fap_icon="icons/qrcode_10px.png", fap_icon_assets="icons", fap_icon_assets_symbol="qrcode", -) \ No newline at end of file +) diff --git a/applications/plugins/solitaire/application.fam b/applications/plugins/solitaire/application.fam index 66e4567ec..4011c343e 100644 --- a/applications/plugins/solitaire/application.fam +++ b/applications/plugins/solitaire/application.fam @@ -4,10 +4,10 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="solitaire_app", cdefines=["APP_SOLITAIRE"], - requires=["gui","storage","canvas"], + requires=["gui", "storage", "canvas"], stack_size=2 * 1024, order=30, fap_icon="solitaire_10px.png", fap_category="Games", - fap_icon_assets="assets" -) \ No newline at end of file + fap_icon_assets="assets", +) diff --git a/applications/plugins/subbrute/application.fam b/applications/plugins/subbrute/application.fam index 455bb822f..20a5f5367 100644 --- a/applications/plugins/subbrute/application.fam +++ b/applications/plugins/subbrute/application.fam @@ -4,7 +4,7 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="subbrute_app", cdefines=["APP_SUB_BRUTE"], - requires=["gui","dialogs"], + requires=["gui", "dialogs"], stack_size=2 * 1024, order=11, fap_icon="images/subbrute_10px.png", diff --git a/applications/plugins/timelapse/application.fam b/applications/plugins/timelapse/application.fam index ee725fe52..f5eaae551 100644 --- a/applications/plugins/timelapse/application.fam +++ b/applications/plugins/timelapse/application.fam @@ -4,18 +4,13 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="zeitraffer_app", cdefines=["APP_ZEITRAFFER"], - requires=[ - "gui", - "input", - "notification", - "gpio" - ], + requires=["gui", "input", "notification", "gpio"], stack_size=2 * 1024, order=90, - fap_icon_assets="icons", - fap_icon="zeitraffer.png", + fap_icon_assets="icons", + fap_icon="zeitraffer.png", fap_category="GPIO", - fap_description="Simple intervalometer app", + fap_description="Simple intervalometer app", fap_author="Aurelius Rosenbaum", - fap_weburl="https://github.com/theageoflove/flipperzero-zeitraffer", -) \ No newline at end of file + fap_weburl="https://github.com/theageoflove/flipperzero-zeitraffer", +) diff --git a/applications/plugins/totp/application.fam b/applications/plugins/totp/application.fam index ffb6d6137..81b0e22c3 100644 --- a/applications/plugins/totp/application.fam +++ b/applications/plugins/totp/application.fam @@ -4,14 +4,7 @@ App( apptype=FlipperAppType.EXTERNAL, entry_point="totp_app", cdefines=["APP_TOTP"], - requires=[ - "gui", - "cli", - "dialogs", - "storage", - "input", - "notification" - ], + requires=["gui", "cli", "dialogs", "storage", "input", "notification"], stack_size=2 * 1024, order=20, fap_category="Misc", diff --git a/applications/plugins/unitemp/application.fam b/applications/plugins/unitemp/application.fam index 3ac128eef..d975da5ff 100644 --- a/applications/plugins/unitemp/application.fam +++ b/applications/plugins/unitemp/application.fam @@ -9,11 +9,11 @@ App( ], stack_size=2 * 1024, order=100, - fap_description = "Universal temperature sensors reader", - fap_author = "Quenon", - fap_weburl = "https://github.com/quen0n/Unitemp-Flipper-Zero-Plugin", + fap_description="Universal temperature sensors reader", + fap_author="Quenon", + fap_weburl="https://github.com/quen0n/Unitemp-Flipper-Zero-Plugin", fap_category="GPIO", fap_icon="icon.png", fap_icon_assets="assets", fap_libs=["assets"], -) \ No newline at end of file +) diff --git a/applications/plugins/wii_ec_anal/application.fam b/applications/plugins/wii_ec_anal/application.fam index 655b5f938..4dc251713 100644 --- a/applications/plugins/wii_ec_anal/application.fam +++ b/applications/plugins/wii_ec_anal/application.fam @@ -1,36 +1,28 @@ # qv. https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/AppManifests.md App( - # --- App Info - appid="wii_ec_anal", - name="Wii EC Analyser", - - # --- Entry point - apptype=FlipperAppType.EXTERNAL, - entry_point="wii_ec_anal", - - # --- Interaction - cdefines=["APP_WII_EC_ANAL"], - requires=[ - "gui", - ], - -# conflicts="", -# sdk_headers="", - - # --- Run-time info - stack_size=2 * 1024, - order=20, - - # --- FAP details - sources=["wii_*.c", "gfx/*.c"], - -# fap_weburl="https://github.com/csBlueChip/FlipperZero_plugin_WiiChuck/", -# fap_author="BlueChip", - -# fap_description="Wii Extension Controller Protocol Analyser", -# fap_version=(1,0), - - fap_icon="WiiEC.png", - fap_category="GPIO", + # --- App Info + appid="wii_ec_anal", + name="Wii EC Analyser", + # --- Entry point + apptype=FlipperAppType.EXTERNAL, + entry_point="wii_ec_anal", + # --- Interaction + cdefines=["APP_WII_EC_ANAL"], + requires=[ + "gui", + ], + # conflicts="", + # sdk_headers="", + # --- Run-time info + stack_size=2 * 1024, + order=20, + # --- FAP details + sources=["wii_*.c", "gfx/*.c"], + # fap_weburl="https://github.com/csBlueChip/FlipperZero_plugin_WiiChuck/", + # fap_author="BlueChip", + # fap_description="Wii Extension Controller Protocol Analyser", + # fap_version=(1,0), + fap_icon="WiiEC.png", + fap_category="GPIO", ) diff --git a/applications/plugins/yatzee/application.fam b/applications/plugins/yatzee/application.fam index 183021854..b30e90d23 100644 --- a/applications/plugins/yatzee/application.fam +++ b/applications/plugins/yatzee/application.fam @@ -9,5 +9,4 @@ App( fap_icon="images/yatzee_icon_10px.png", fap_category="Games", fap_icon_assets="images", - ) diff --git a/applications/services/namechangersrv/application.fam b/applications/services/namechangersrv/application.fam index b4bace40d..3263a3708 100644 --- a/applications/services/namechangersrv/application.fam +++ b/applications/services/namechangersrv/application.fam @@ -4,4 +4,4 @@ App( entry_point="namechanger_on_system_start", requires=["storage"], order=1000, -) \ No newline at end of file +) diff --git a/assets/SConscript b/assets/SConscript index aace521d2..ef5d83c79 100644 --- a/assets/SConscript +++ b/assets/SConscript @@ -96,4 +96,4 @@ if assetsenv["IS_BASE_FIRMWARE"]: env.Replace(FW_RESOURCES=resources) assetsenv.Alias("resources", resources) -Return("assetslib") \ No newline at end of file +Return("assetslib") diff --git a/assets/resources/subghz/assets/extend_range.txt b/assets/resources/subghz/assets/extend_range.txt index e66e7ceb2..1b404a0e5 100644 --- a/assets/resources/subghz/assets/extend_range.txt +++ b/assets/resources/subghz/assets/extend_range.txt @@ -2,7 +2,7 @@ Filetype: Flipper SubGhz Setting File Version: 1 # Whether to allow extended ranges that can break your flipper -use_ext_range_at_own_risk: true +use_ext_range_at_own_risk: false # Whether to ignore the default TX region settings -ignore_default_tx_region: true +ignore_default_tx_region: false diff --git a/lib/STM32CubeWB.scons b/lib/STM32CubeWB.scons index cbdde9814..a1b484ad1 100644 --- a/lib/STM32CubeWB.scons +++ b/lib/STM32CubeWB.scons @@ -14,9 +14,15 @@ env.Append( "USE_FULL_LL_DRIVER", ], SDK_HEADERS=[ - *env.GlobRecursive("*_ll_*.h", "#/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/", exclude="*usb.h"), + *env.GlobRecursive( + "*_ll_*.h", + "#/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/", + exclude="*usb.h", + ), File("STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h"), - File("STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/include/stream_buffer.h"), + File( + "STM32CubeWB/Middlewares/Third_Party/FreeRTOS/Source/include/stream_buffer.h" + ), ], ) diff --git a/scripts/FlipperPlaylist.py b/scripts/FlipperPlaylist.py index 4a688f2fb..6db250717 100644 --- a/scripts/FlipperPlaylist.py +++ b/scripts/FlipperPlaylist.py @@ -1,12 +1,14 @@ # Flipper Zero SUB-GHZ Playlist Generator import os import pip + try: from easygui import diropenbox except ImportError: - pip.main(['Install'], "easygui") + pip.main(["Install"], "easygui") from easygui import diropenbox + def main(): folder_path = diropenbox("Select the folder with Subghz files", "Subghz selector") output_path = diropenbox("Select your output location", "Output location") @@ -23,5 +25,6 @@ def main(): playlist_file.close() print("Done!") -if __name__ == '__main__': - main() \ No newline at end of file + +if __name__ == "__main__": + main() diff --git a/scripts/User/decode.py b/scripts/User/decode.py index f6779d967..64072b82f 100644 --- a/scripts/User/decode.py +++ b/scripts/User/decode.py @@ -6,69 +6,85 @@ import os import sys - def padded_hex(i, l): given_int = i given_len = l - hex_result = hex(given_int)[2:] # remove '0x' from beginning of str + hex_result = hex(given_int)[2:] # remove '0x' from beginning of str num_hex_chars = len(hex_result) - extra_zeros = '0' * (given_len - num_hex_chars) # may not get used.. + extra_zeros = "0" * (given_len - num_hex_chars) # may not get used.. - return ('0x' + hex_result if num_hex_chars == given_len else - '?' * given_len if num_hex_chars > given_len else - '0x' + extra_zeros + hex_result if num_hex_chars < given_len else - None) + return ( + "0x" + hex_result + if num_hex_chars == given_len + else "?" * given_len + if num_hex_chars > given_len + else "0x" + extra_zeros + hex_result + if num_hex_chars < given_len + else None + ) -parser = argparse.ArgumentParser(description='Turn cooked Flipper .bm files back into .xbm') -parser.add_argument('infile', metavar='i', - help='Input file') -parser.add_argument('outfile', metavar='o', - help='File to write to') -parser.add_argument('Width', metavar='W', type=int, nargs="?", default="128", - help='Width of the image. Find from meta.txt or directory name') -parser.add_argument('Height', metavar='H', type=int, nargs="?", default="64", - help='Height of the image. Find from meta.txt or directory name') +parser = argparse.ArgumentParser( + description="Turn cooked Flipper .bm files back into .xbm" +) + +parser.add_argument("infile", metavar="i", help="Input file") +parser.add_argument("outfile", metavar="o", help="File to write to") +parser.add_argument( + "Width", + metavar="W", + type=int, + nargs="?", + default="128", + help="Width of the image. Find from meta.txt or directory name", +) +parser.add_argument( + "Height", + metavar="H", + type=int, + nargs="?", + default="64", + help="Height of the image. Find from meta.txt or directory name", +) args = vars(parser.parse_args()) -r = open(args["infile"],"rb") -w = open(args["outfile"],"w") +r = open(args["infile"], "rb") +w = open(args["outfile"], "w") -fileStream=r.read() -filename=os.path.splitext(os.path.basename(args["outfile"]))[0] +fileStream = r.read() +filename = os.path.splitext(os.path.basename(args["outfile"]))[0] -imageWidth=args["Width"] -imageHeight=args["Height"] +imageWidth = args["Width"] +imageHeight = args["Height"] -#remove headers and padding -if(fileStream[0:2] == bytes([0x01,0x00])): - unpad=fileStream[4:] +# remove headers and padding +if fileStream[0:2] == bytes([0x01, 0x00]): + unpad = fileStream[4:] else: - if(fileStream[0:1] == bytes([0x00])): - unpad=fileStream[2:] + if fileStream[0:1] == bytes([0x00]): + unpad = fileStream[2:] - -#lzss decompress +# lzss decompress data_decoded_str = subprocess.check_output( - ["heatshrink", "-d","-w8","-l4"], input=unpad + ["heatshrink", "-d", "-w8", "-l4"], input=unpad ) -#turn it back into xbm +# turn it back into xbm -b=list(data_decoded_str) -c=', '.join(padded_hex(my_int,2) for my_int in b) +b = list(data_decoded_str) +c = ", ".join(padded_hex(my_int, 2) for my_int in b) -width_out = "#define "+ filename+ "_width "+ str(imageWidth) + "\n" -height_out = "#define "+ filename+ "_height "+ str(imageHeight) + "\n" -bytes_out = "static unsigned char "+ filename+ "_bits[] = {"+ str(c) + "};" +width_out = "#define " + filename + "_width " + str(imageWidth) + "\n" +height_out = "#define " + filename + "_height " + str(imageHeight) + "\n" +bytes_out = "static unsigned char " + filename + "_bits[] = {" + str(c) + "};" -data=width_out+height_out+bytes_out +data = width_out + height_out + bytes_out w.write(data) r.close() -w.close() \ No newline at end of file +w.close() diff --git a/scripts/User/encode.py b/scripts/User/encode.py index d2d533ea3..d88ec25f1 100644 --- a/scripts/User/encode.py +++ b/scripts/User/encode.py @@ -6,17 +6,17 @@ import os import sys -parser = argparse.ArgumentParser(description='Turn .xbm files into cooked .bm files for flipper FS') +parser = argparse.ArgumentParser( + description="Turn .xbm files into cooked .bm files for flipper FS" +) -parser.add_argument('infile', metavar='i', - help='Input file') -parser.add_argument('outfile', metavar='o', - help='File to write to') +parser.add_argument("infile", metavar="i", help="Input file") +parser.add_argument("outfile", metavar="o", help="File to write to") args = vars(parser.parse_args()) -r = open(args["infile"],"r") -w = open(args["outfile"],"wb") +r = open(args["infile"], "r") +w = open(args["outfile"], "wb") output = subprocess.check_output(["cat", args["infile"]]) diff --git a/scripts/User/icondecode.py b/scripts/User/icondecode.py index 596545269..c1177bc18 100644 --- a/scripts/User/icondecode.py +++ b/scripts/User/icondecode.py @@ -5,60 +5,82 @@ import io import os import sys + def padded_hex(i, l): given_int = i given_len = l - hex_result = hex(given_int)[2:] # remove '0x' from beginning of str + hex_result = hex(given_int)[2:] # remove '0x' from beginning of str num_hex_chars = len(hex_result) - extra_zeros = '0' * (given_len - num_hex_chars) # may not get used.. + extra_zeros = "0" * (given_len - num_hex_chars) # may not get used.. - return ('0x' + hex_result if num_hex_chars == given_len else - '?' * given_len if num_hex_chars > given_len else - '0x' + extra_zeros + hex_result if num_hex_chars < given_len else - None) + return ( + "0x" + hex_result + if num_hex_chars == given_len + else "?" * given_len + if num_hex_chars > given_len + else "0x" + extra_zeros + hex_result + if num_hex_chars < given_len + else None + ) -parser = argparse.ArgumentParser(description='Turn icon char arrays back into .xbm') +parser = argparse.ArgumentParser(description="Turn icon char arrays back into .xbm") -parser.add_argument('infile', metavar='i', - help='Input file') -parser.add_argument('outfile', metavar='o', - help='File to write to') -parser.add_argument('Width', metavar='W', type=int, nargs="?", default="128", - help='Width of the image. Find from meta.txt or directory name') -parser.add_argument('Height', metavar='H', type=int, nargs="?", default="64", - help='Height of the image. Find from meta.txt or directory name') -parser.add_argument('Trim', metavar='T', type=int, nargs="?", default="8", - help='Number of bytes off the start/header to trim. Multiples of 2 required.') +parser.add_argument("infile", metavar="i", help="Input file") +parser.add_argument("outfile", metavar="o", help="File to write to") +parser.add_argument( + "Width", + metavar="W", + type=int, + nargs="?", + default="128", + help="Width of the image. Find from meta.txt or directory name", +) +parser.add_argument( + "Height", + metavar="H", + type=int, + nargs="?", + default="64", + help="Height of the image. Find from meta.txt or directory name", +) +parser.add_argument( + "Trim", + metavar="T", + type=int, + nargs="?", + default="8", + help="Number of bytes off the start/header to trim. Multiples of 2 required.", +) args = vars(parser.parse_args()) -r = open(args["infile"],"r") -w = open(args["outfile"],"w") -imageWidth=args["Width"] -imageHeight=args["Height"] -trimStart=args["Trim"] +r = open(args["infile"], "r") +w = open(args["outfile"], "w") +imageWidth = args["Width"] +imageHeight = args["Height"] +trimStart = args["Trim"] -output = subprocess.check_output(["cat", args["infile"]]) #yes this is terrible. +output = subprocess.check_output(["cat", args["infile"]]) # yes this is terrible. f = io.StringIO(output.decode().strip()) -data = f.read().strip().replace(";","").replace("{","").replace("}","") +data = f.read().strip().replace(";", "").replace("{", "").replace("}", "") data_str = data.replace(",", "").replace("0x", "") data_bin = bytearray.fromhex(data_str[trimStart:]) data_decoded_str = subprocess.check_output( - ["heatshrink", "-d","-w8","-l4"], input=data_bin + ["heatshrink", "-d", "-w8", "-l4"], input=data_bin ) -b=list(data_decoded_str) +b = list(data_decoded_str) -c=', '.join(padded_hex(my_int,2) for my_int in b) +c = ", ".join(padded_hex(my_int, 2) for my_int in b) -width_out = "#define icon_width "+ str(imageWidth) + "\n" -height_out = "#define icon_height "+ str(imageHeight) + "\n" -bytes_out = "static unsigned char icon_bits[] = {"+ str(c) + "};" +width_out = "#define icon_width " + str(imageWidth) + "\n" +height_out = "#define icon_height " + str(imageHeight) + "\n" +bytes_out = "static unsigned char icon_bits[] = {" + str(c) + "};" -data=width_out+height_out+bytes_out +data = width_out + height_out + bytes_out w.write(data) r.close() diff --git a/scripts/User/iconencode.py b/scripts/User/iconencode.py index 67ba05d1b..e41e597dd 100644 --- a/scripts/User/iconencode.py +++ b/scripts/User/iconencode.py @@ -5,64 +5,81 @@ import io import os import sys + def padded_hex(i, l): given_int = i given_len = l - hex_result = hex(given_int)[2:] # remove '0x' from beginning of str + hex_result = hex(given_int)[2:] # remove '0x' from beginning of str num_hex_chars = len(hex_result) - extra_zeros = '0' * (given_len - num_hex_chars) # may not get used.. + extra_zeros = "0" * (given_len - num_hex_chars) # may not get used.. - return ('0x' + hex_result if num_hex_chars == given_len else - '?' * given_len if num_hex_chars > given_len else - '0x' + extra_zeros + hex_result if num_hex_chars < given_len else - None) + return ( + "0x" + hex_result + if num_hex_chars == given_len + else "?" * given_len + if num_hex_chars > given_len + else "0x" + extra_zeros + hex_result + if num_hex_chars < given_len + else None + ) -parser = argparse.ArgumentParser(description='Turn icon char arrays back into .xbm') +parser = argparse.ArgumentParser(description="Turn icon char arrays back into .xbm") -parser.add_argument('infile', metavar='i', - help='Input file') -parser.add_argument('Width', metavar='W', type=int, nargs="?", default="128", - help='Width of the image. Find from meta.txt or directory name') -parser.add_argument('Height', metavar='H', type=int, nargs="?", default="64", - help='Height of the image. Find from meta.txt or directory name') +parser.add_argument("infile", metavar="i", help="Input file") +parser.add_argument( + "Width", + metavar="W", + type=int, + nargs="?", + default="128", + help="Width of the image. Find from meta.txt or directory name", +) +parser.add_argument( + "Height", + metavar="H", + type=int, + nargs="?", + default="64", + help="Height of the image. Find from meta.txt or directory name", +) args = vars(parser.parse_args()) -r = open(args["infile"],"r") -infile=args["infile"].split(".")[0] +r = open(args["infile"], "r") +infile = args["infile"].split(".")[0] -imageWidth=args["Width"] -imageHeight=args["Height"] -dims=str(imageWidth)+"x"+str(imageHeight) +imageWidth = args["Width"] +imageHeight = args["Height"] +dims = str(imageWidth) + "x" + str(imageHeight) -output = subprocess.check_output(["cat", args["infile"]]) #yes this is terrible. +output = subprocess.check_output(["cat", args["infile"]]) # yes this is terrible. f = io.StringIO(output.decode().strip()) -data = f.read().strip().replace(";","").replace("{","").replace("}","") +data = f.read().strip().replace(";", "").replace("{", "").replace("}", "") data_str = data.replace(",", "").replace("0x", "") data_bin = bytearray.fromhex(data_str) data_encoded_str = subprocess.check_output( - ["heatshrink", "-e","-w8","-l4"], input=data_bin + ["heatshrink", "-e", "-w8", "-l4"], input=data_bin ) -b=list(data_encoded_str) +b = list(data_encoded_str) -c=','.join(padded_hex(my_int,2) for my_int in b) +c = ",".join(padded_hex(my_int, 2) for my_int in b) # a bit ugly. -framename="_I_"+infile+"_"+dims +framename = "_I_" + infile + "_" + dims print(len(b)) -#d=len(b) +# d=len(b) # if b > 255 split 0x1234 into 0x34,0x12 -#d=hex(len(b)) +# d=hex(len(b)) -char_out = "const uint8_t "+framename+"_0[] = {"+ str(c) + ",};" -char_out2 = "const uint8_t "+framename+"[] = {"+framename+"_0};" -#data=bytes_out +char_out = "const uint8_t " + framename + "_0[] = {" + str(c) + ",};" +char_out2 = "const uint8_t " + framename + "[] = {" + framename + "_0};" +# data=bytes_out print(char_out) print(char_out2) -#w.write(data) -#w.close() +# w.write(data) +# w.close() diff --git a/scripts/asset_packer.py b/scripts/asset_packer.py index 54c598ea5..aea755811 100755 --- a/scripts/asset_packer.py +++ b/scripts/asset_packer.py @@ -43,7 +43,9 @@ def convert_bmx(img: "Image.Image | pathlib.Path") -> bytes: return data -def pack(input: "str | pathlib.Path", output: "str | pathlib.Path", logger: typing.Callable): +def pack( + input: "str | pathlib.Path", output: "str | pathlib.Path", logger: typing.Callable +): input = pathlib.Path(input) output = pathlib.Path(output) output.mkdir(parents=True, exist_ok=True) @@ -68,7 +70,9 @@ def pack(input: "str | pathlib.Path", output: "str | pathlib.Path", logger: typi if (source / "Anims/manifest.txt").exists(): (packed / "Anims").mkdir(parents=True, exist_ok=True) - shutil.copyfile(source / "Anims/manifest.txt", packed / "Anims/manifest.txt") + shutil.copyfile( + source / "Anims/manifest.txt", packed / "Anims/manifest.txt" + ) for anim in (source / "Anims").iterdir(): if not anim.is_dir(): continue @@ -77,9 +81,13 @@ def pack(input: "str | pathlib.Path", output: "str | pathlib.Path", logger: typi if not frame.is_file(): continue if frame.name == "meta.txt": - shutil.copyfile(frame, packed / "Anims" / anim.name / "meta.txt") + shutil.copyfile( + frame, packed / "Anims" / anim.name / "meta.txt" + ) elif frame.name.startswith("frame_"): - (packed / "Anims" / anim.name / frame.with_suffix(".bm").name).write_bytes(convert_bm(frame)) + ( + packed / "Anims" / anim.name / frame.with_suffix(".bm").name + ).write_bytes(convert_bm(frame)) if (source / "Icons").is_dir(): for icons in (source / "Icons").iterdir(): @@ -89,7 +97,9 @@ def pack(input: "str | pathlib.Path", output: "str | pathlib.Path", logger: typi for icon in icons.iterdir(): if not icon.is_file(): continue - (packed / "Icons" / icons.name / icon.with_suffix(".bmx").name).write_bytes(convert_bmx(icon)) + ( + packed / "Icons" / icons.name / icon.with_suffix(".bmx").name + ).write_bytes(convert_bmx(icon)) if __name__ == "__main__": @@ -105,7 +115,4 @@ if __name__ == "__main__": pack(here, here / "dolphin_custom", logger=print) end = time.perf_counter() - input( - f"\nFinished in {round(end - start, 2)}s\n" - "Press [Enter] to exit" - ) + input(f"\nFinished in {round(end - start, 2)}s\n" "Press [Enter] to exit") diff --git a/scripts/assets.py b/scripts/assets.py index c616a4ab1..e7c5a6d12 100755 --- a/scripts/assets.py +++ b/scripts/assets.py @@ -30,11 +30,16 @@ valid_dirs = list() # This will not stay, dont worry! This is temp code until we got time to rewrite this all root_dir = pathlib.Path(__file__).absolute().parent.parent dolphin_external = root_dir / "assets/dolphin/external/" -potential_directories = [item for item in dolphin_external.iterdir() if item.is_dir()] # Get all animation directories +potential_directories = [ + item for item in dolphin_external.iterdir() if item.is_dir() +] # Get all animation directories + +for directory in potential_directories: # loop through all of them + if ( + directory / "manifest.txt" + ).exists(): # check if they contain a manifest.txt TODO: This code should be moved to wherever manifest.txt files are validated! + valid_dirs.append(directory) # append valid directory to list -for directory in potential_directories: # loop through all of them - if (directory / "manifest.txt").exists(): # check if they contain a manifest.txt TODO: This code should be moved to wherever manifest.txt files are validated! - valid_dirs.append(directory) # append valid directory to list class Main(App): def init(self): @@ -259,13 +264,24 @@ class Main(App): self.logger.info("Manifest is up-to-date!") # This will not stay, dont worry! This is temp code until we got time to rewrite this all - global valid_dirs # access our global variable - for valid_dir in valid_dirs: # We can copy the manifest for all of the valid dirs! - (root_dir / f"assets/resources/dolphin/{valid_dir.name}").mkdir(parents=True, exist_ok=True) - shutil.copyfile(valid_dir / "manifest.txt", root_dir / f"assets/resources/dolphin/{valid_dir.name}/manifest.txt") + global valid_dirs # access our global variable + for ( + valid_dir + ) in valid_dirs: # We can copy the manifest for all of the valid dirs! + (root_dir / f"assets/resources/dolphin/{valid_dir.name}").mkdir( + parents=True, exist_ok=True + ) + shutil.copyfile( + valid_dir / "manifest.txt", + root_dir / f"assets/resources/dolphin/{valid_dir.name}/manifest.txt", + ) (root_dir / "assets/resources/dolphin/manifest.txt").unlink() self.logger.info("Packing custom asset packs") - asset_packer.pack(root_dir / "assets/dolphin/custom", root_dir / f"assets/resources/dolphin_custom", self.logger.info) + asset_packer.pack( + root_dir / "assets/dolphin/custom", + root_dir / f"assets/resources/dolphin_custom", + self.logger.info, + ) self.logger.info(f"Complete") @@ -295,7 +311,9 @@ class Main(App): self.logger.info(f"Processing Dolphin sources") dolphin = Dolphin() self.logger.info(f"Loading data") - if f"dolphin{os.sep}external" in str(self.args.input_directory): # AHEM... oopsie. This script apparently just loads all assets, not only external assets, lol. + if f"dolphin{os.sep}external" in str( + self.args.input_directory + ): # AHEM... oopsie. This script apparently just loads all assets, not only external assets, lol. dolphin.load(self.args.input_directory, valid_dirs) else: dolphin.load(self.args.input_directory) diff --git a/scripts/flipper/assets/dolphin.py b/scripts/flipper/assets/dolphin.py index 899a8a615..45ed3e19f 100644 --- a/scripts/flipper/assets/dolphin.py +++ b/scripts/flipper/assets/dolphin.py @@ -35,7 +35,7 @@ class DolphinBubbleAnimation: min_level: int, max_level: int, weight: int, - subpath: str = None + subpath: str = None, ): # Manifest self.name = name @@ -188,7 +188,9 @@ class DolphinBubbleAnimation: def save(self, output_directory: str): if self.subpath: - animation_directory = os.path.join(output_directory, self.subpath, self.name) + animation_directory = os.path.join( + output_directory, self.subpath, self.name + ) else: animation_directory = os.path.join(output_directory, self.name) os.makedirs(animation_directory, exist_ok=True) @@ -294,7 +296,13 @@ class DolphinManifest: # Initialize animation animation = DolphinBubbleAnimation( - name, min_butthurt, max_butthurt, min_level, max_level, weight, subpath + name, + min_butthurt, + max_butthurt, + min_level, + max_level, + weight, + subpath, ) # Load Animation meta and frames diff --git a/scripts/runfap.py b/scripts/runfap.py index 14d885e8a..9f544fd90 100644 --- a/scripts/runfap.py +++ b/scripts/runfap.py @@ -103,4 +103,4 @@ class Main(App): if __name__ == "__main__": - Main()() \ No newline at end of file + Main()() diff --git a/scripts/sconsdist.py b/scripts/sconsdist.py index 0fa120d87..ce261954c 100644 --- a/scripts/sconsdist.py +++ b/scripts/sconsdist.py @@ -166,11 +166,13 @@ class Main(App): ) ) bundle_args.extend(self.other_args) - log_custom_fz_name = ( - environ.get("CUSTOM_FLIPPER_NAME", None) - or "" - ) - if (log_custom_fz_name != "") and (len(log_custom_fz_name) <= 8) and (log_custom_fz_name.isalnum()) and (log_custom_fz_name.isascii()): + log_custom_fz_name = environ.get("CUSTOM_FLIPPER_NAME", None) or "" + if ( + (log_custom_fz_name != "") + and (len(log_custom_fz_name) <= 8) + and (log_custom_fz_name.isalnum()) + and (log_custom_fz_name.isascii()) + ): self.logger.info( f"Flipper Custom Name is set:\n\tName: {log_custom_fz_name} : length - {len(log_custom_fz_name)} chars" ) diff --git a/scripts/version.py b/scripts/version.py index 363df0aeb..7f0a11349 100644 --- a/scripts/version.py +++ b/scripts/version.py @@ -11,7 +11,11 @@ from datetime import date, datetime class GitVersion: def __init__(self, source_dir): self.source_dir = source_dir - self.gitlist = [("commit", "rev-parse --short HEAD"), ("branch", "rev-parse --abbrev-ref") , ("branch_num", "rev-list -count HEAD")] + self.gitlist = [ + ("commit", "rev-parse --short HEAD"), + ("branch", "rev-parse --abbrev-ref"), + ("branch_num", "rev-list -count HEAD"), + ] def get_version_info(self): commit = branch = branch_num = "XFW-0040" @@ -36,20 +40,19 @@ class GitVersion: # If WORKFLOW_BRANCH_OR_TAG is set in environment, is has precedence # (set by CI) - custom_fz_name = ( - os.environ.get("CUSTOM_FLIPPER_NAME", None) - or "" - ) + custom_fz_name = os.environ.get("CUSTOM_FLIPPER_NAME", None) or "" - force_no_dirty = ( - os.environ.get("FORCE_NO_DIRTY", None) - or "" - ) + force_no_dirty = os.environ.get("FORCE_NO_DIRTY", None) or "" - if (force_no_dirty != ""): + if force_no_dirty != "": dirty = False - if (custom_fz_name != "") and (len(custom_fz_name) <= 8) and (custom_fz_name.isalnum()) and (custom_fz_name.isascii()): + if ( + (custom_fz_name != "") + and (len(custom_fz_name) <= 8) + and (custom_fz_name.isalnum()) + and (custom_fz_name.isascii()) + ): return { "GIT_COMMIT": commit, "GIT_BRANCH": "dev", diff --git a/site_scons/cc.scons b/site_scons/cc.scons index 95888dc95..1eb6a3376 100644 --- a/site_scons/cc.scons +++ b/site_scons/cc.scons @@ -44,4 +44,4 @@ ENV.AppendUnique( "-mlittle-endian", "-mthumb", ], -) \ No newline at end of file +) diff --git a/site_scons/commandline.scons b/site_scons/commandline.scons index 837fd0b85..722dd3cfa 100644 --- a/site_scons/commandline.scons +++ b/site_scons/commandline.scons @@ -243,4 +243,4 @@ vars.AddVariables( ), ) -Return("vars") \ No newline at end of file +Return("vars") diff --git a/site_scons/environ.scons b/site_scons/environ.scons index ab60d4e71..0ffc8a6a2 100644 --- a/site_scons/environ.scons +++ b/site_scons/environ.scons @@ -88,4 +88,4 @@ SetOption("max_drift", 1) wrap_tempfile(coreenv, "LINKCOM") wrap_tempfile(coreenv, "ARCOM") -Return("coreenv") \ No newline at end of file +Return("coreenv") diff --git a/site_scons/extapps.scons b/site_scons/extapps.scons index ea16d1e78..bff9a8c30 100644 --- a/site_scons/extapps.scons +++ b/site_scons/extapps.scons @@ -152,4 +152,4 @@ if appenv["FORCE"]: appenv.AlwaysBuild(sdk_source, sdk_tree, sdk_apicheck, sdk_apisyms) -Return("extapps") \ No newline at end of file +Return("extapps")