Compare commits
303 Commits
subghz_pro
...
unlshd-037
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d801c38f9 | ||
|
|
08a2e51feb | ||
|
|
e62ac748ad | ||
|
|
1f881c6e47 | ||
|
|
127f436315 | ||
|
|
f62de11de7 | ||
|
|
6e810aacb4 | ||
|
|
2ff1e22ca9 | ||
|
|
8afdb5b7b4 | ||
|
|
c80405f880 | ||
|
|
83624b1dee | ||
|
|
b3ddca1aee | ||
|
|
df8a57c972 | ||
|
|
0444a80f19 | ||
|
|
3d90e6151c | ||
|
|
5660111b28 | ||
|
|
445a1aa7b0 | ||
|
|
0917494a80 | ||
|
|
1d91a572cc | ||
|
|
60ac2e9881 | ||
|
|
f7024cff78 | ||
|
|
6ec62f48f9 | ||
|
|
d14364a86c | ||
|
|
76d3f84a5e | ||
|
|
56c11c70b3 | ||
|
|
56adcf1ad8 | ||
|
|
9e94b1fae0 | ||
|
|
682ac85e0a | ||
|
|
9a93551a2d | ||
|
|
147a1c7aaa | ||
|
|
58d4f3b531 | ||
|
|
eb355d4a16 | ||
|
|
3444c5245e | ||
|
|
9941457cdb | ||
|
|
54cefb7884 | ||
|
|
7de7fa293b | ||
|
|
ad27f87a0c | ||
|
|
346cf299ee | ||
|
|
b0928fb3cd | ||
|
|
559b0e9b40 | ||
|
|
67e7325f43 | ||
|
|
2cefc9aab0 | ||
|
|
cda605f578 | ||
|
|
25fd3c3400 | ||
|
|
771c47f809 | ||
|
|
3c3ac216dc | ||
|
|
5de507b0c8 | ||
|
|
bb9ac1389b | ||
|
|
49378f0893 | ||
|
|
6aa0c08f3a | ||
|
|
e90042368f | ||
|
|
9fbf327028 | ||
|
|
353adf4fb7 | ||
|
|
968d6d578f | ||
|
|
2046ac6604 | ||
|
|
2a040f245f | ||
|
|
d8385b7f91 | ||
|
|
c27d4d78f9 | ||
|
|
a69ae93871 | ||
|
|
e22668e196 | ||
|
|
3a242e5fc3 | ||
|
|
d12f76dacb | ||
|
|
fe403c6994 | ||
|
|
05e53cac26 | ||
|
|
8b8b78d001 | ||
|
|
dd99c22792 | ||
|
|
ccaa3864d5 | ||
|
|
53435579b3 | ||
|
|
84b2242636 | ||
|
|
d5ea5168a0 | ||
|
|
c560394358 | ||
|
|
5ddb9bd444 | ||
|
|
eb57f4c7e4 | ||
|
|
027ae3f3f6 | ||
|
|
d32c73ad57 | ||
|
|
f67a02203b | ||
|
|
4bd3dca16f | ||
|
|
c5db1aaaf5 | ||
|
|
a04c01a2fd | ||
|
|
a48adfbaf7 | ||
|
|
68fed0e03d | ||
|
|
0190a161ba | ||
|
|
5b05aeea82 | ||
|
|
780da7d4d5 | ||
|
|
c68a9f325d | ||
|
|
4fd043398a | ||
|
|
dfc45eb0f9 | ||
|
|
50ef5deefc | ||
|
|
05489fda7d | ||
|
|
319108b11c | ||
|
|
ee41413c6a | ||
|
|
71daa3e0f8 | ||
|
|
1249ce9b94 | ||
|
|
da9b968fc9 | ||
|
|
b0af6f4b53 | ||
|
|
7a413f390d | ||
|
|
16df48bac6 | ||
|
|
3b2d0486a0 | ||
|
|
ed06aa48e9 | ||
|
|
e941ef5952 | ||
|
|
5d9174ac9d | ||
|
|
5be15152eb | ||
|
|
90958a6d23 | ||
|
|
ab91dc1882 | ||
|
|
cad2f2a065 | ||
|
|
086be92f69 | ||
|
|
28eb4d1060 | ||
|
|
2ff937a278 | ||
|
|
cdc44c502e | ||
|
|
b37c3ccf92 | ||
|
|
74259c2276 | ||
|
|
3dcd5538d0 | ||
|
|
eb5dae1cda | ||
|
|
f0471a62e5 | ||
|
|
9819306731 | ||
|
|
b872a12517 | ||
|
|
eefca9f498 | ||
|
|
e0905597fc | ||
|
|
6511252140 | ||
|
|
27000f1763 | ||
|
|
ada343b7df | ||
|
|
9dd1fb64b7 | ||
|
|
c0e0403b44 | ||
|
|
6d0c3eb3b6 | ||
|
|
f25af91d23 | ||
|
|
507c8582ca | ||
|
|
d780752d9e | ||
|
|
2f567f3c3f | ||
|
|
f612357150 | ||
|
|
f1f2718598 | ||
|
|
4ab832cc46 | ||
|
|
920bee0532 | ||
|
|
1a9544778b | ||
|
|
dbee87a6c6 | ||
|
|
7e80ed6693 | ||
|
|
db0c34f63e | ||
|
|
056f2eb7d5 | ||
|
|
fe84e9521c | ||
|
|
91e2b466d3 | ||
|
|
b90060e574 | ||
|
|
5d4057f722 | ||
|
|
0b7d205253 | ||
|
|
72ca6b25e9 | ||
|
|
4be64b6206 | ||
|
|
6cc5119c64 | ||
|
|
42d27d04f6 | ||
|
|
fed4c28925 | ||
|
|
24f084d282 | ||
|
|
12b760e2e3 | ||
|
|
43ef3d9bff | ||
|
|
3bdd171ce2 | ||
|
|
6ff0a5f318 | ||
|
|
f3ab4bc292 | ||
|
|
806428efeb | ||
|
|
4359e2eaa9 | ||
|
|
777a4d109d | ||
|
|
f8dc1939cd | ||
|
|
1b8cf6a5b1 | ||
|
|
1b12526357 | ||
|
|
1f6382e93d | ||
|
|
ab6b3f8ed3 | ||
|
|
cc52253e22 | ||
|
|
cf6dc9f895 | ||
|
|
8deb29a8ff | ||
|
|
e0f9697750 | ||
|
|
c3a6ba3c02 | ||
|
|
75a8f0a7b4 | ||
|
|
caa4ba67d6 | ||
|
|
9f6f391354 | ||
|
|
24726ab8a3 | ||
|
|
6bd5e22872 | ||
|
|
cbb09b6812 | ||
|
|
9c9688dd5b | ||
|
|
21c52df090 | ||
|
|
2c95a7cba4 | ||
|
|
568176d775 | ||
|
|
04250632d7 | ||
|
|
9ae58f5462 | ||
|
|
e6d1bcc421 | ||
|
|
4439a83733 | ||
|
|
0f8d7dd6db | ||
|
|
182296d8af | ||
|
|
cd14380dba | ||
|
|
5b0c5a82c0 | ||
|
|
478390de19 | ||
|
|
b054912167 | ||
|
|
09edf66a2a | ||
|
|
1d55aee39c | ||
|
|
3efb7d4050 | ||
|
|
0c06e54831 | ||
|
|
a61286bd43 | ||
|
|
9bda3e62ee | ||
|
|
905273e066 | ||
|
|
16fe62e98d | ||
|
|
958797062d | ||
|
|
2bb76e09c6 | ||
|
|
33dd256dfb | ||
|
|
295fd3d0c0 | ||
|
|
efdf24d711 | ||
|
|
12c1ec37a2 | ||
|
|
03f889962b | ||
|
|
802035d92e | ||
|
|
0bc995bfab | ||
|
|
a19768e376 | ||
|
|
0bf0267edd | ||
|
|
b3559bf058 | ||
|
|
2b8f55322e | ||
|
|
b15a15411f | ||
|
|
39329eb422 | ||
|
|
115257ea59 | ||
|
|
a71abedd25 | ||
|
|
b53924c27a | ||
|
|
543346f885 | ||
|
|
a435959ee3 | ||
|
|
d33b092a9d | ||
|
|
f676072e15 | ||
|
|
098d6944c4 | ||
|
|
172c0e077f | ||
|
|
4dbb55d740 | ||
|
|
ba09da107a | ||
|
|
eaf965c66f | ||
|
|
e999c35749 | ||
|
|
203adabc46 | ||
|
|
82ad44a863 | ||
|
|
a24d0f1958 | ||
|
|
86da6a7ffe | ||
|
|
36e7b9185a | ||
|
|
f8eda660d2 | ||
|
|
f3e3e828aa | ||
|
|
c230d09dad | ||
|
|
72fd448541 | ||
|
|
07ff0c7d97 | ||
|
|
76f84b50e6 | ||
|
|
1f3e937471 | ||
|
|
32f11f59b0 | ||
|
|
202a97eb74 | ||
|
|
f9db06b781 | ||
|
|
5132b16305 | ||
|
|
a0b02b0110 | ||
|
|
36debf25fb | ||
|
|
d16d1f43fc | ||
|
|
11b3484f4b | ||
|
|
2bcb15b8bc | ||
|
|
9690dba7fe | ||
|
|
663eb6cd6d | ||
|
|
e9aa2d3449 | ||
|
|
7d4bffb575 | ||
|
|
b89902942b | ||
|
|
0a3ff7f85a | ||
|
|
b15c4afea1 | ||
|
|
738e0df4f4 | ||
|
|
3de6ae07b7 | ||
|
|
78afaab7e8 | ||
|
|
80a64d8e1a | ||
|
|
c7fbc8323b | ||
|
|
335f8b9aff | ||
|
|
009c9b1b71 | ||
|
|
ab515aeebb | ||
|
|
487d03eca4 | ||
|
|
32b74b968e | ||
|
|
1e98361299 | ||
|
|
ee2f6581bb | ||
|
|
5b0f74bffa | ||
|
|
faac423772 | ||
|
|
aae37121d6 | ||
|
|
660f97f241 | ||
|
|
387e9431f5 | ||
|
|
fd46bd1886 | ||
|
|
883f67d6d1 | ||
|
|
a52f64acfd | ||
|
|
4f4ccaa727 | ||
|
|
85f6ee2870 | ||
|
|
d81653461c | ||
|
|
55cfccafaf | ||
|
|
58e9acc19e | ||
|
|
6bcb9a60f7 | ||
|
|
5a02a51bd9 | ||
|
|
4aae197cf7 | ||
|
|
2fdebb639b | ||
|
|
25e8947282 | ||
|
|
34f0aced2f | ||
|
|
da68f2e4ed | ||
|
|
8f16dbb8e7 | ||
|
|
49e458f1b5 | ||
|
|
5cf46d2aa9 | ||
|
|
beedf54e75 | ||
|
|
70ccb89c3d | ||
|
|
5ea43a2a4b | ||
|
|
41f60dbbf4 | ||
|
|
827341ec08 | ||
|
|
5c36043d03 | ||
|
|
cf5811f8d9 | ||
|
|
ec6a169bf8 | ||
|
|
f1dec87c1b | ||
|
|
ab29951a99 | ||
|
|
bbe9f88bbe | ||
|
|
9188bf0013 | ||
|
|
f33ed59567 | ||
|
|
3fd8c80861 | ||
|
|
7b8ac3a5a0 | ||
|
|
6fef957001 | ||
|
|
0de1c9df89 | ||
|
|
a0e8cfbe97 |
@@ -36,13 +36,6 @@ Min level: 1
|
||||
Max level: 1
|
||||
Weight: 3
|
||||
|
||||
Name: L1_Happy_holidays_128x64
|
||||
Min butthurt: 0
|
||||
Max butthurt: 14
|
||||
Min level: 1
|
||||
Max level: 3
|
||||
Weight: 4
|
||||
|
||||
Name: L1_Read_books_128x64
|
||||
Min butthurt: 0
|
||||
Max butthurt: 8
|
||||
@@ -141,9 +134,9 @@ Min level: 3
|
||||
Max level: 3
|
||||
Weight: 3
|
||||
|
||||
Name: L1_Sleigh_ride_128x64
|
||||
Name: L1_Senpai_128x64
|
||||
Min butthurt: 0
|
||||
Max butthurt: 14
|
||||
Max butthurt: 5
|
||||
Min level: 1
|
||||
Max level: 3
|
||||
Weight: 4
|
||||
|
||||
12
.drone.yml
@@ -192,13 +192,16 @@ steps:
|
||||
Version: {{build.tag}}
|
||||
|
||||
|
||||
[-> Sponsor our project](https://boosty.to/mmxdev)
|
||||
|
||||
|
||||
[-Github - Changelog-](https://github.com/DarkFlippers/unleashed-firmware/releases/tag/${DRONE_TAG})
|
||||
|
||||
|
||||
[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
|
||||
|
||||
|
||||
[-Download latest extra apps pack-](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)
|
||||
[-Download latest extra apps pack-](https://github.com/xMasterX/unleashed-extra-pack/archive/refs/heads/main.zip)
|
||||
|
||||
|
||||
[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=release-cfw&version=${DRONE_TAG})
|
||||
@@ -220,7 +223,7 @@ steps:
|
||||
commands:
|
||||
- wget "https://raw.githubusercontent.com/fieu/discord.sh/e1dc1a7595efad2cad8f072f0b3531c470f5b7c8/discord.sh"
|
||||
- chmod +x ./discord.sh
|
||||
- ./discord.sh --text 'New Unleashed firmware released!\n\nVersion - '${DRONE_TAG}'\n\n[[Github - Changelog]](https://github.com/DarkFlippers/unleashed-firmware/releases/tag/'${DRONE_TAG}')\n\n[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)\n\n[-Download latest extra apps pack-](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)\n\n[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/'${DRONE_TAG}'/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')\n\n[-Version without custom animations - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)\n\n[-Version with extra apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'e.tgz&channel=release-cfw&version='${DRONE_TAG}'e)'
|
||||
- ./discord.sh --text 'New Unleashed firmware released!\n\nVersion - '${DRONE_TAG}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[[Github - Changelog]](https://github.com/DarkFlippers/unleashed-firmware/releases/tag/'${DRONE_TAG}')\n\n[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)\n\n[-Download latest extra apps pack-](https://github.com/xMasterX/unleashed-extra-pack/archive/refs/heads/main.zip)\n\n[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/'${DRONE_TAG}'/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')\n\n[-Version without custom animations - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)\n\n[-Version with extra apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'e.tgz&channel=release-cfw&version='${DRONE_TAG}'e)'
|
||||
|
||||
- name: "Send extra pack build to telegram"
|
||||
image: appleboy/drone-telegram
|
||||
@@ -385,6 +388,9 @@ steps:
|
||||
Commit: {{commit.message}}
|
||||
|
||||
|
||||
[-> Sponsor our project](https://boosty.to/mmxdev)
|
||||
|
||||
|
||||
[-Version with extra apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-${DRONE_BUILD_NUMBER}e.tgz&channel=dev-cfw&version=${DRONE_BUILD_NUMBER}e)
|
||||
|
||||
|
||||
@@ -413,7 +419,7 @@ steps:
|
||||
commands:
|
||||
- wget "https://raw.githubusercontent.com/fieu/discord.sh/e1dc1a7595efad2cad8f072f0b3531c470f5b7c8/discord.sh"
|
||||
- chmod +x ./discord.sh
|
||||
- ./discord.sh --text 'Unleashed firmware dev build successful!\n\nBuild - '${DRONE_BUILD_NUMBER}'\n\nSHA - '${DRONE_COMMIT_SHA}'\n\n[-Version with extra apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'e.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'e)\n\n[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}')'
|
||||
- ./discord.sh --text 'Unleashed firmware dev build successful!\n\nBuild - '${DRONE_BUILD_NUMBER}'\n\nSHA - '${DRONE_COMMIT_SHA}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[-Version with extra apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'e.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'e)\n\n[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}')'
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
|
||||
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*~
|
||||
*.swp
|
||||
*.swo
|
||||
*.gdb_history
|
||||
|
||||
10
.gitmodules
vendored
@@ -28,9 +28,9 @@
|
||||
[submodule "lib/cxxheaderparser"]
|
||||
path = lib/cxxheaderparser
|
||||
url = https://github.com/robotpy/cxxheaderparser.git
|
||||
[submodule "applications/plugins/subbrute"]
|
||||
path = applications/plugins/subbrute
|
||||
url = https://github.com/derskythe/flipperzero-subbrute.git
|
||||
[submodule "applications/plugins/dap_link/lib/free-dap"]
|
||||
path = applications/plugins/dap_link/lib/free-dap
|
||||
[submodule "applications/external/dap_link/lib/free-dap"]
|
||||
path = applications/external/dap_link/lib/free-dap
|
||||
url = https://github.com/ataradov/free-dap.git
|
||||
[submodule "applications/external/subbrute"]
|
||||
path = applications/external/subbrute
|
||||
url = https://github.com/derskythe/flipperzero-subbrute.git
|
||||
@@ -44,3 +44,6 @@
|
||||
|
||||
# Functions that always return the same error code
|
||||
//-V:picopass_device_decrypt:1048
|
||||
|
||||
# Examples
|
||||
//V_EXCLUDE_PATH applications/examples/
|
||||
@@ -1 +1 @@
|
||||
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/plugins/dap_link/lib/free-dap
|
||||
--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
|
||||
|
||||
5
.vscode/example/launch.json
vendored
@@ -11,9 +11,10 @@
|
||||
"args": {
|
||||
"useSingleResult": true,
|
||||
"env": {
|
||||
"PATH": "${workspaceFolder};${env:PATH}"
|
||||
"PATH": "${workspaceFolder};${env:PATH}",
|
||||
"FBT_QUIET": 1
|
||||
},
|
||||
"command": "./fbt get_blackmagic",
|
||||
"command": "fbt get_blackmagic",
|
||||
"description": "Get Blackmagic device",
|
||||
}
|
||||
}
|
||||
|
||||
22
CHANGELOG.md
@@ -1,21 +1,23 @@
|
||||
### New changes
|
||||
* SubGHz: **Nice ON2E (Nice One)** support (by @assasinfil | PR #335)
|
||||
* SubGHz: Remove 467.75 From freq analyzer since it has too much noise (Frequency is still can be used, just excluded from FA to avoid false detections)
|
||||
* Archive and FileBrowser: **Fixed more navigation issues** (by @Willy-JL | PR #334)
|
||||
* Plugins -> SubGHz Bruteforcer: Fix Linear Delta 3 repeats (now its more stable and we will be sure signal is received correctly)
|
||||
* Plugins: Updated TOTP (Authenticator) [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator)
|
||||
* OFW: **Fix Cyfral & Metakom emulation (My temp fix removed and proper fix from OFW applied)**
|
||||
* OFW: BadUSB: disable CDC mode, USB mode switch fix
|
||||
* OFW: Updater visual fixes
|
||||
* Plugins: Fix minesweeper freeze bugs, do some refactoring
|
||||
* Plugins: Update WAV Player, 16 bit support by @LTVA1
|
||||
* Infrared: Update universal remote assets (by @amec0e | PR #394)
|
||||
* OFW PR: Fixed writing gen1a magic tags with invalid BCC [(PR 2511 by AloneLiberty)](https://github.com/AloneLiberty/flipperzero-firmware/tree/nfc-magic-write-fix)
|
||||
* OFW: BadUSB: Script interpreter refactoring
|
||||
* OFW: SubGhz: fix Incorrect comparison in subghz_setting_get_hopper_frequency
|
||||
* OFW: Add one_wire lib to f18, separate ibutton
|
||||
* OFW: Improved debugging experience for external apps
|
||||
* OFW: SD Driver: reinit sd card on error
|
||||
* OFW: OTP programmer: return exit code based on error type
|
||||
|
||||
#### [🎲 Download latest extra apps pack](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)
|
||||
#### [🎲 Download latest extra apps pack](https://github.com/xMasterX/unleashed-extra-pack/archive/refs/heads/main.zip)
|
||||
|
||||
[-> How to install firmware](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
|
||||
|
||||
[-> Download qFlipper (official link)](https://flipperzero.one/update)
|
||||
|
||||
## Please support development of the project
|
||||
* Boosty: https://boosty.to/mmxdev
|
||||
* **Boosty** (patreon alternative): https://boosty.to/mmxdev
|
||||
* Ko-Fi: https://ko-fi.com/masterx
|
||||
* cloudtips (only RU payments accepted): https://pay.cloudtips.ru/p/7b3e9d65
|
||||
* YooMoney (only RU payments accepted): https://yoomoney.ru/fundraise/XA49mgQLPA0.221209
|
||||
|
||||
74
ReadMe.md
@@ -12,8 +12,6 @@
|
||||
|
||||
Our goal is to make all features possible on this device without any limitations!
|
||||
|
||||
Please help us implement emulation for all Sub-GHz dynamic (rolling code) protocols!
|
||||
|
||||
<br>
|
||||
|
||||
### This software is for experimental purposes only and is not meant for any illegal activity/purposes. <br> We do not condone illegal activity and strongly encourage keeping transmissions to legal/valid uses allowed by law. <br> Also, this software is made without any support from Flipper Devices and is in no way related to the official devs.
|
||||
@@ -27,7 +25,7 @@ Our Discord Community:
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Dev builds
|
||||
## Dev builds (unstable)
|
||||
- https://dev.unleashedflip.com/
|
||||
- https://t.me/kotnehleb
|
||||
## Releases in Telegram
|
||||
@@ -37,7 +35,7 @@ Our Discord Community:
|
||||
* Sub-GHz regional TX restrictions removed
|
||||
* Sub-GHz frequency range can be extended in settings file (Warning: It can damage Flipper's hardware)
|
||||
* Many rolling code protocols now have the ability to save & send captured signals
|
||||
* FAAC SLH (Spa) & BFT Mitto (secure with seed) manual creation
|
||||
* FAAC SLH (Spa) & BFT Mitto (keeloq secure with seed) manual creation
|
||||
* Sub-GHz static code brute-force plugin
|
||||
* LFRFID Fuzzer plugin
|
||||
* Custom community plugins and games added + all known working apps can be downloaded in extra pack in every release
|
||||
@@ -45,18 +43,31 @@ Our Discord Community:
|
||||
* Picopass/iClass plugin included in releases
|
||||
* Recompiled IR TV Universal Remote for ALL buttons
|
||||
* Universal remote for Projectors, Fans, A/Cs and Audio(soundbars, etc.)
|
||||
* BadUSB keyboard layouts
|
||||
* Customizable Flipper name
|
||||
- BadUSB -> Keyboard layouts [(by rien > dummy-decoy)](https://github.com/dummy-decoy/flipperzero-firmware/tree/dummy_decoy/bad_usb_keyboard_layout)
|
||||
- Sub-GHz -> External CC1101 module support - [(by quen0n)](https://github.com/DarkFlippers/unleashed-firmware/pull/307)
|
||||
- Sub-GHz -> `Add manually` menu extended with new protocols
|
||||
- Sub-GHz -> New frequency analyzer - [(by ClusterM)](https://github.com/DarkFlippers/unleashed-firmware/pull/43)
|
||||
- Sub-GHz -> Save last used frequency [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
|
||||
- Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
|
||||
- Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
|
||||
- Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
|
||||
* Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes
|
||||
* Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu
|
||||
* Sub-GHz -> External CC1101 module support
|
||||
* SubGHz -> **Hold right in received signal list to delete selected signal**
|
||||
* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis / Security+ 2.0** - now you can use arrow buttons to send signal with different button code
|
||||
* SubGHz -> BFT Mitto / Somfy Telis / Nice Flor S manual creation with programming new remote into receiver (use button 0xF for BFT Mitto, 0x8 (Prog) on Somfy Telis)
|
||||
* SubGHz -> Debug mode counter increase settings (+1 -> +5, +10, default: +1)
|
||||
* SubGHz -> Debug PIN output settings for protocol development
|
||||
* Infrared -> Debug TX PIN output settings
|
||||
* Other small fixes and changes throughout
|
||||
* See other changes in changelog and in readme below
|
||||
* See other changes in readme below
|
||||
|
||||
Also check the changelog in releases for latest updates!
|
||||
|
||||
### Current modified and new Sub-GHz protocols list:
|
||||
Thanks to Official team (to thier SubGHz Developer, Skorp) for implementing decoders for these protocols.
|
||||
Thanks to Official team (to their SubGHz Developer, Skorp) for implementing decoders for these protocols.
|
||||
|
||||
Encoders/sending made by Eng1n33r & @xMasterX:
|
||||
|
||||
@@ -70,10 +81,13 @@ Encoders/sending made by Eng1n33r & @xMasterX:
|
||||
- Keeloq: FAAC RC,XT
|
||||
- Keeloq: Mutancode
|
||||
- Keeloq: Normstahl
|
||||
- Keeloq: Beninca
|
||||
- Keeloq: Stilmatic / Schellenberg
|
||||
- Keeloq: CAME Space
|
||||
- CAME Atomo
|
||||
- Nice Flor S
|
||||
- FAAC SLH (Spa) [External seed calculation required (For info contact me in Discord: Nano#8998)]
|
||||
- BFT Mitto [External seed calculation required (For info contact me in Discord: Nano#8998)]
|
||||
- Keeloq: BFT Mitto [External seed calculation required (For info contact me in Discord: Nano#8998)]
|
||||
- Security+ v1 & v2
|
||||
- Star Line
|
||||
|
||||
@@ -97,7 +111,7 @@ Our team is small and the guys are working on this project as much as they can s
|
||||
The amount of work done on this project is huge and we need your support, no matter how large or small. Even if you just say, "Thank you Unleashed firmware developers!" somewhere. Doing so will help us continue our work and will help drive us to make the firmware better every time.
|
||||
Also, regarding our releases, every build has and always will be free and open-source. There will be no paywall releases or closed-source apps within the firmware. As long as I am working on this project it will never happen.
|
||||
You can support us by using links or addresses below:
|
||||
* Boosty: https://boosty.to/mmxdev
|
||||
* **Boosty** (patreon alternative): https://boosty.to/mmxdev
|
||||
* Ko-Fi: https://ko-fi.com/masterx
|
||||
* cloudtips (only RU payments accepted): https://pay.cloudtips.ru/p/7b3e9d65
|
||||
* YooMoney (only RU payments accepted): https://yoomoney.ru/fundraise/XA49mgQLPA0.221209
|
||||
@@ -118,11 +132,10 @@ You can support us by using links or addresses below:
|
||||
- ESP8266 Deauther plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-Wifi-ESP8266-Deauther-Module)
|
||||
- WiFi Scanner plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-WiFi-Scanner_Module)
|
||||
- MultiConverter plugin [(by theisolinearchip)](https://github.com/theisolinearchip/flipperzero_stuff)
|
||||
- USB Keyboard plugin [(by huuck)](https://github.com/huuck/FlipperZeroUSBKeyboard)
|
||||
- WAV Player [(OFW: DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) - Fixed and improved by [LTVA1](https://github.com/LTVA1/wav_player)
|
||||
- WAV Player [(OFW: DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) - Fixed and improved by [LTVA1](https://github.com/LTVA1/wav_player) -> Also outputs audio on `PA6` - `3(A6)` pin
|
||||
- Barcode generator plugin [(original by McAzzaMan)](https://github.com/McAzzaMan/flipperzero-firmware/tree/UPC-A_Barcode_Generator/applications/barcode_generator) - [EAN-8 and refactoring](https://github.com/DarkFlippers/unleashed-firmware/pull/154) by @msvsergey
|
||||
- GPIO: Sentry Safe plugin [(by H4ckd4ddy)](https://github.com/H4ckd4ddy/flipperzero-sentry-safe-plugin)
|
||||
- ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion)
|
||||
- ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) - Saving .pcap on flipper microSD [by tcpassos](https://github.com/tcpassos/flipperzero-firmware-with-wifi-marauder-companion) -> Only with custom marauder build (It is necessary to uncomment "#define WRITE_PACKETS_SERIAL" in configs.h (in marauder fw) and compile the firmware for the wifi board.) Or download precompiled build -> [Download esp32_marauder_ver_flipper_sd_serial.bin](https://github.com/justcallmekoko/ESP32Marauder/releases/latest)
|
||||
- NRF24: Sniffer & MouseJacker (with changes) [(by mothball187)](https://github.com/mothball187/flipperzero-nrf24/tree/main/mousejacker)
|
||||
- Simple Clock (timer by GMMan) [(original by CompaqDisc)](https://gist.github.com/CompaqDisc/4e329c501bd03c1e801849b81f48ea61)
|
||||
- **Sub-GHz Remote** (UniversalRF Remix) [(by @darmiel & @xMasterX)](https://github.com/darmiel/flipper-playlist/tree/feat/unirf-protocols) (original by @ESurge)
|
||||
@@ -142,6 +155,7 @@ You can support us by using links or addresses below:
|
||||
- Text Viewer [(by kowalski7cc & kyhwana)](https://github.com/kowalski7cc/flipper-zero-text-viewer/tree/refactor-text-app)
|
||||
- **UART Terminal** [(by cool4uma)](https://github.com/cool4uma/UART_Terminal/tree/main)
|
||||
- **ProtoView** [(by antirez)](https://github.com/antirez/protoview)
|
||||
- **SWD Probe** [(by g3gg0)](https://github.com/g3gg0/flipper-swd_probe)
|
||||
|
||||
Games:
|
||||
- DOOM (fixed) [(by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
|
||||
@@ -157,15 +171,6 @@ Games:
|
||||
- BlackJack [(by teeebor)](https://github.com/teeebor/flipper_games)
|
||||
- 2048 game [(by eugene-kirzhanov)](https://github.com/eugene-kirzhanov/flipper-zero-2048-game)
|
||||
|
||||
### Other changes
|
||||
|
||||
- BadUSB -> Keyboard layouts [(by rien > dummy-decoy)](https://github.com/dummy-decoy/flipperzero-firmware/tree/dummy_decoy/bad_usb_keyboard_layout)
|
||||
- Sub-GHz -> External CC1101 module support - [(by quen0n)](https://github.com/DarkFlippers/unleashed-firmware/pull/307)
|
||||
- Sub-GHz -> New frequency analyzer - [(by ClusterM)](https://github.com/DarkFlippers/unleashed-firmware/pull/43)
|
||||
- Sub-GHz -> Save last used frequency [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
|
||||
- Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
|
||||
- Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
|
||||
- Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
|
||||
|
||||
# Instructions
|
||||
## [- How to install firmware](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
|
||||
@@ -178,12 +183,20 @@ Games:
|
||||
|
||||
## [- How to change Flipper name](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/CustomFlipperName.md)
|
||||
|
||||
### **Sub-GHz**
|
||||
|
||||
## [- Transmission is blocked? - How to extend Sub-GHz frequency range](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/DangerousSettings.md)
|
||||
|
||||
## [- How to add extra Sub-GHz frequencies](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzSettings.md)
|
||||
|
||||
## [- How to use Flipper as new remote (Nice FlorS, BFT Mitto, Somfy Telis)](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemoteProg.md)
|
||||
|
||||
## [- Configure Sub-GHz Remote App](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md)
|
||||
|
||||
### **Plugins**
|
||||
|
||||
## [- 🎲 Download Extra plugins for Unleashed](https://github.com/xMasterX/unleashed-extra-pack)
|
||||
|
||||
## [- Configure Sub-GHz Remote App](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md)
|
||||
|
||||
## [- TOTP (Authenticator) config description](https://github.com/akopachov/flipper-zero_authenticator/blob/master/docs/conf-file_description.md)
|
||||
|
||||
## [- Barcode Generator](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/BarcodeGenerator.md)
|
||||
@@ -198,9 +211,9 @@ Games:
|
||||
|
||||
## [- How to use: Unitemp - Temperature sensors reader](https://github.com/quen0n/unitemp-flipperzero#readme)
|
||||
|
||||
## [- How to use: [NMEA] GPS](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/plugins/gps_nmea_uart/README.md)
|
||||
## [- How to use: [NMEA] GPS](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/external/gps_nmea_uart/README.md)
|
||||
|
||||
## [- How to use: i2c Tools](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/plugins/flipper_i2ctools/README.md)
|
||||
## [- How to use: i2c Tools](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/external/flipper_i2ctools/README.md)
|
||||
|
||||
## [- How to use: [NRF24] plugins](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/NRF24.md)
|
||||
|
||||
@@ -218,20 +231,12 @@ Games:
|
||||
|
||||
## [- How to use: [GPIO] SentrySafe plugin](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SentrySafe.md)
|
||||
|
||||
### **Sub-GHz**
|
||||
|
||||
## [- Transmission is blocked? - How to extend Sub-GHz frequency range](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/DangerousSettings.md)
|
||||
|
||||
## [- How to add extra Sub-GHz frequencies](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzSettings.md)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
# Where I can find IR, Sub-GHz, ... files, DBs, and other stuff?
|
||||
## [UberGuidoZ Playground - Large collection of files - Github](https://github.com/UberGuidoZ/Flipper)
|
||||
## [Awesome Flipper Zero - Github](https://github.com/djsime1/awesome-flipperzero)
|
||||
## [CAME-12bit, NICE-12bit, Linear-10bit, PT-2240 - Sub-GHz fixed code bruteforce](https://github.com/tobiabocchi/flipperzero-bruteforce)
|
||||
## [SMC5326, UNILARM - Sub-GHz fixed code bruteforce](https://github.com/Hong5489/flipperzero-gate-bruteforce)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
@@ -239,6 +244,9 @@ Games:
|
||||
# Links
|
||||
|
||||
* Unofficial Discord: [discord.unleashedflip.com](https://discord.unleashedflip.com)
|
||||
* Hello world - plugin tutorial (English): [https://github.com/DroomOne/Flipper-Plugin-Tutorial](https://github.com/DroomOne/Flipper-Plugin-Tutorial)
|
||||
* Hello world - plugin tutorial (in Russian): [https://yakovlev.me/hello-flipper-zero/](https://yakovlev.me/hello-flipper-zero/)
|
||||
* CLion IDE - How to setup workspace for flipper firmware development: [https://krasovs.ky/2022/11/01/flipper-zero-clion.html](https://krasovs.ky/2022/11/01/flipper-zero-clion.html)
|
||||
* Docs by atmanos / How to write your own app (outdated API): [https://flipper.atmanos.com/docs/overview/intro](https://flipper.atmanos.com/docs/overview/intro)
|
||||
|
||||
* Official Docs: [http://docs.flipperzero.one](http://docs.flipperzero.one)
|
||||
|
||||
27
SConstruct
@@ -139,34 +139,33 @@ if GetOption("fullenv") or any(
|
||||
basic_dist = distenv.DistCommand("fw_dist", distenv["DIST_DEPENDS"])
|
||||
distenv.Default(basic_dist)
|
||||
|
||||
dist_dir = distenv.GetProjetDirName()
|
||||
dist_dir_name = distenv.GetProjectDirName()
|
||||
dist_dir = distenv.Dir(f"#/dist/{dist_dir_name}")
|
||||
external_apps_artifacts = firmware_env["FW_EXTAPPS"]
|
||||
external_app_list = external_apps_artifacts.application_map.values()
|
||||
|
||||
fap_dist = [
|
||||
distenv.Install(
|
||||
distenv.Dir(f"#/dist/{dist_dir}/apps/debug_elf"),
|
||||
list(
|
||||
app_artifact.debug
|
||||
for app_artifact in firmware_env["FW_EXTAPPS"].applications.values()
|
||||
),
|
||||
dist_dir.Dir("debug_elf"),
|
||||
list(app_artifact.debug for app_artifact in external_app_list),
|
||||
),
|
||||
*(
|
||||
distenv.Install(
|
||||
f"#/dist/{dist_dir}/apps/{app_artifact.app.fap_category}",
|
||||
app_artifact.compact[0],
|
||||
dist_dir.File(dist_entry[1]).dir,
|
||||
app_artifact.compact,
|
||||
)
|
||||
for app_artifact in firmware_env["FW_EXTAPPS"].applications.values()
|
||||
for app_artifact in external_app_list
|
||||
for dist_entry in app_artifact.dist_entries
|
||||
),
|
||||
]
|
||||
Depends(
|
||||
fap_dist,
|
||||
list(
|
||||
app_artifact.validator
|
||||
for app_artifact in firmware_env["FW_EXTAPPS"].applications.values()
|
||||
),
|
||||
list(app_artifact.validator for app_artifact in external_app_list),
|
||||
)
|
||||
Alias("fap_dist", fap_dist)
|
||||
# distenv.Default(fap_dist)
|
||||
|
||||
distenv.Depends(firmware_env["FW_RESOURCES"], firmware_env["FW_EXTAPPS"].resources_dist)
|
||||
distenv.Depends(firmware_env["FW_RESOURCES"], external_apps_artifacts.resources_dist)
|
||||
|
||||
# Copy all faps to device
|
||||
|
||||
|
||||
@@ -36,15 +36,20 @@ Applications for main Flipper menu.
|
||||
- `u2f` - U2F Application
|
||||
|
||||
|
||||
## plugins
|
||||
## External
|
||||
|
||||
Extra apps for Plugins & App Loader menus.
|
||||
External applications deployed to SD Card
|
||||
|
||||
- `bt_hid_app` - BT Remote controller
|
||||
- `clock` - Clock application
|
||||
- `dap_link` - DAP Link OnChip debugger
|
||||
- `hid_app` - USB/BT Remote controller
|
||||
- `music_player` - Music player app (demo)
|
||||
- `picopass` - Picopass tool
|
||||
- `nfc_magic` - NFC MFC Magic card application
|
||||
- `picopass` - Picopass reader / writer
|
||||
- `signal_generator` - Signal generator app: PWM and clock generator
|
||||
- `snake_game` - Snake game application
|
||||
|
||||
- `spi_mem_manager` - SPI Memory reader / flasher
|
||||
- `weather_station` - SubGHz weather station
|
||||
|
||||
## services
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ typedef struct {
|
||||
uint16_t left;
|
||||
uint16_t right;
|
||||
uint16_t ok;
|
||||
FuriMutex* mutex;
|
||||
} KeypadTestState;
|
||||
|
||||
static void keypad_test_reset_state(KeypadTestState* state) {
|
||||
@@ -22,7 +23,8 @@ static void keypad_test_reset_state(KeypadTestState* state) {
|
||||
}
|
||||
|
||||
static void keypad_test_render_callback(Canvas* canvas, void* ctx) {
|
||||
KeypadTestState* state = (KeypadTestState*)acquire_mutex((ValueMutex*)ctx, 25);
|
||||
KeypadTestState* state = ctx;
|
||||
furi_mutex_acquire(state->mutex, FuriWaitForever);
|
||||
canvas_clear(canvas);
|
||||
char strings[5][20];
|
||||
|
||||
@@ -51,7 +53,7 @@ static void keypad_test_render_callback(Canvas* canvas, void* ctx) {
|
||||
|
||||
canvas_draw_str(canvas, 10, 63, "[back] - reset, hold to exit");
|
||||
|
||||
release_mutex((ValueMutex*)ctx, state);
|
||||
furi_mutex_release(state->mutex);
|
||||
}
|
||||
|
||||
static void keypad_test_input_callback(InputEvent* input_event, void* ctx) {
|
||||
@@ -64,17 +66,17 @@ int32_t keypad_test_app(void* p) {
|
||||
FuriMessageQueue* event_queue = furi_message_queue_alloc(32, sizeof(InputEvent));
|
||||
furi_check(event_queue);
|
||||
|
||||
KeypadTestState _state = {{false, false, false, false, false}, 0, 0, 0, 0, 0};
|
||||
KeypadTestState state = {{false, false, false, false, false}, 0, 0, 0, 0, 0, NULL};
|
||||
state.mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
|
||||
ValueMutex state_mutex;
|
||||
if(!init_mutex(&state_mutex, &_state, sizeof(KeypadTestState))) {
|
||||
if(!state.mutex) {
|
||||
FURI_LOG_E(TAG, "cannot create mutex");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
|
||||
view_port_draw_callback_set(view_port, keypad_test_render_callback, &state_mutex);
|
||||
view_port_draw_callback_set(view_port, keypad_test_render_callback, &state);
|
||||
view_port_input_callback_set(view_port, keypad_test_input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
@@ -83,7 +85,7 @@ int32_t keypad_test_app(void* p) {
|
||||
|
||||
InputEvent event;
|
||||
while(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) {
|
||||
KeypadTestState* state = (KeypadTestState*)acquire_mutex_block(&state_mutex);
|
||||
furi_mutex_acquire(state.mutex, FuriWaitForever);
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
"key: %s type: %s",
|
||||
@@ -92,54 +94,54 @@ int32_t keypad_test_app(void* p) {
|
||||
|
||||
if(event.key == InputKeyRight) {
|
||||
if(event.type == InputTypePress) {
|
||||
state->press[0] = true;
|
||||
state.press[0] = true;
|
||||
} else if(event.type == InputTypeRelease) {
|
||||
state->press[0] = false;
|
||||
state.press[0] = false;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
++state->right;
|
||||
++state.right;
|
||||
}
|
||||
} else if(event.key == InputKeyLeft) {
|
||||
if(event.type == InputTypePress) {
|
||||
state->press[1] = true;
|
||||
state.press[1] = true;
|
||||
} else if(event.type == InputTypeRelease) {
|
||||
state->press[1] = false;
|
||||
state.press[1] = false;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
++state->left;
|
||||
++state.left;
|
||||
}
|
||||
} else if(event.key == InputKeyUp) {
|
||||
if(event.type == InputTypePress) {
|
||||
state->press[2] = true;
|
||||
state.press[2] = true;
|
||||
} else if(event.type == InputTypeRelease) {
|
||||
state->press[2] = false;
|
||||
state.press[2] = false;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
++state->up;
|
||||
++state.up;
|
||||
}
|
||||
} else if(event.key == InputKeyDown) {
|
||||
if(event.type == InputTypePress) {
|
||||
state->press[3] = true;
|
||||
state.press[3] = true;
|
||||
} else if(event.type == InputTypeRelease) {
|
||||
state->press[3] = false;
|
||||
state.press[3] = false;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
++state->down;
|
||||
++state.down;
|
||||
}
|
||||
} else if(event.key == InputKeyOk) {
|
||||
if(event.type == InputTypePress) {
|
||||
state->press[4] = true;
|
||||
state.press[4] = true;
|
||||
} else if(event.type == InputTypeRelease) {
|
||||
state->press[4] = false;
|
||||
state.press[4] = false;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
++state->ok;
|
||||
++state.ok;
|
||||
}
|
||||
} else if(event.key == InputKeyBack) {
|
||||
if(event.type == InputTypeLong) {
|
||||
release_mutex(&state_mutex, state);
|
||||
furi_mutex_release(state.mutex);
|
||||
break;
|
||||
} else if(event.type == InputTypeShort) {
|
||||
keypad_test_reset_state(state);
|
||||
keypad_test_reset_state(&state);
|
||||
}
|
||||
}
|
||||
|
||||
release_mutex(&state_mutex, state);
|
||||
furi_mutex_release(state.mutex);
|
||||
view_port_update(view_port);
|
||||
}
|
||||
|
||||
@@ -147,7 +149,7 @@ int32_t keypad_test_app(void* p) {
|
||||
gui_remove_view_port(gui, view_port);
|
||||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
delete_mutex(&state_mutex);
|
||||
furi_mutex_free(state.mutex);
|
||||
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
|
||||
@@ -53,15 +53,17 @@ static void (*text_box_test_render[])(Canvas* canvas) = {
|
||||
|
||||
typedef struct {
|
||||
uint32_t idx;
|
||||
FuriMutex* mutex;
|
||||
} TextBoxTestState;
|
||||
|
||||
static void text_box_test_render_callback(Canvas* canvas, void* ctx) {
|
||||
TextBoxTestState* state = acquire_mutex((ValueMutex*)ctx, 25);
|
||||
TextBoxTestState* state = ctx;
|
||||
furi_mutex_acquire(state->mutex, FuriWaitForever);
|
||||
canvas_clear(canvas);
|
||||
|
||||
text_box_test_render[state->idx](canvas);
|
||||
|
||||
release_mutex((ValueMutex*)ctx, state);
|
||||
furi_mutex_release(state->mutex);
|
||||
}
|
||||
|
||||
static void text_box_test_input_callback(InputEvent* input_event, void* ctx) {
|
||||
@@ -74,17 +76,17 @@ int32_t text_box_test_app(void* p) {
|
||||
FuriMessageQueue* event_queue = furi_message_queue_alloc(32, sizeof(InputEvent));
|
||||
furi_check(event_queue);
|
||||
|
||||
TextBoxTestState _state = {.idx = 0};
|
||||
TextBoxTestState state = {.idx = 0, .mutex = NULL};
|
||||
state.mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
|
||||
ValueMutex state_mutex;
|
||||
if(!init_mutex(&state_mutex, &_state, sizeof(TextBoxTestState))) {
|
||||
if(!state.mutex) {
|
||||
FURI_LOG_E(TAG, "Cannot create mutex");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
|
||||
view_port_draw_callback_set(view_port, text_box_test_render_callback, &state_mutex);
|
||||
view_port_draw_callback_set(view_port, text_box_test_render_callback, &state);
|
||||
view_port_input_callback_set(view_port, text_box_test_input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
@@ -94,24 +96,24 @@ int32_t text_box_test_app(void* p) {
|
||||
uint32_t test_renders_num = COUNT_OF(text_box_test_render);
|
||||
InputEvent event;
|
||||
while(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) {
|
||||
TextBoxTestState* state = acquire_mutex_block(&state_mutex);
|
||||
furi_mutex_acquire(state.mutex, FuriWaitForever);
|
||||
|
||||
if(event.type == InputTypeShort) {
|
||||
if(event.key == InputKeyRight) {
|
||||
if(state->idx < test_renders_num - 1) {
|
||||
state->idx++;
|
||||
if(state.idx < test_renders_num - 1) {
|
||||
state.idx++;
|
||||
}
|
||||
} else if(event.key == InputKeyLeft) {
|
||||
if(state->idx > 0) {
|
||||
state->idx--;
|
||||
if(state.idx > 0) {
|
||||
state.idx--;
|
||||
}
|
||||
} else if(event.key == InputKeyBack) {
|
||||
release_mutex(&state_mutex, state);
|
||||
furi_mutex_release(state.mutex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
release_mutex(&state_mutex, state);
|
||||
furi_mutex_release(state.mutex);
|
||||
view_port_update(view_port);
|
||||
}
|
||||
|
||||
@@ -119,7 +121,7 @@ int32_t text_box_test_app(void* p) {
|
||||
gui_remove_view_port(gui, view_port);
|
||||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
delete_mutex(&state_mutex);
|
||||
furi_mutex_free(state.mutex);
|
||||
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
App(
|
||||
appid="UART_Echo",
|
||||
name="UART Echo",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="uart_echo_app",
|
||||
cdefines=["APP_UART_ECHO"],
|
||||
requires=["gui"],
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
// v2 tests
|
||||
void test_furi_create_open();
|
||||
void test_furi_valuemutex();
|
||||
void test_furi_concurrent_access();
|
||||
void test_furi_pubsub();
|
||||
|
||||
@@ -30,10 +29,6 @@ MU_TEST(mu_test_furi_create_open) {
|
||||
test_furi_create_open();
|
||||
}
|
||||
|
||||
MU_TEST(mu_test_furi_valuemutex) {
|
||||
test_furi_valuemutex();
|
||||
}
|
||||
|
||||
MU_TEST(mu_test_furi_pubsub) {
|
||||
test_furi_pubsub();
|
||||
}
|
||||
@@ -51,7 +46,6 @@ MU_TEST_SUITE(test_suite) {
|
||||
|
||||
// v2 tests
|
||||
MU_RUN_TEST(mu_test_furi_create_open);
|
||||
MU_RUN_TEST(mu_test_furi_valuemutex);
|
||||
MU_RUN_TEST(mu_test_furi_pubsub);
|
||||
MU_RUN_TEST(mu_test_furi_memmgr);
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <furi.h>
|
||||
|
||||
#include "../minunit.h"
|
||||
|
||||
void test_furi_valuemutex() {
|
||||
const int init_value = 0xdeadbeef;
|
||||
const int changed_value = 0x12345678;
|
||||
|
||||
int value = init_value;
|
||||
bool result;
|
||||
ValueMutex valuemutex;
|
||||
|
||||
// init mutex case
|
||||
result = init_mutex(&valuemutex, &value, sizeof(value));
|
||||
mu_assert(result, "init mutex failed");
|
||||
|
||||
// acquire mutex case
|
||||
int* value_pointer = acquire_mutex(&valuemutex, 100);
|
||||
mu_assert_pointers_eq(value_pointer, &value);
|
||||
|
||||
// second acquire mutex case
|
||||
int* value_pointer_second = acquire_mutex(&valuemutex, 100);
|
||||
mu_assert_pointers_eq(value_pointer_second, NULL);
|
||||
|
||||
// change value case
|
||||
*value_pointer = changed_value;
|
||||
mu_assert_int_eq(value, changed_value);
|
||||
|
||||
// release mutex case
|
||||
result = release_mutex(&valuemutex, &value);
|
||||
mu_assert(result, "release mutex failed");
|
||||
|
||||
// TODO
|
||||
//acquire mutex blocking case
|
||||
//write mutex blocking case
|
||||
//read mutex blocking case
|
||||
|
||||
mu_check(delete_mutex(&valuemutex));
|
||||
}
|
||||
@@ -3,56 +3,63 @@
|
||||
#include "../minunit.h"
|
||||
|
||||
static void power_test_deinit(void) {
|
||||
// Try to reset to default charging voltage
|
||||
furi_hal_power_set_battery_charging_voltage(4.208f);
|
||||
// Try to reset to default charge voltage limit
|
||||
furi_hal_power_set_battery_charge_voltage_limit(4.208f);
|
||||
}
|
||||
|
||||
MU_TEST(test_power_charge_voltage_exact) {
|
||||
// Power of 16mV charge voltages get applied exactly
|
||||
MU_TEST(test_power_charge_voltage_limit_exact) {
|
||||
// Power of 16mV charge voltage limits get applied exactly
|
||||
// (bq25896 charge controller works in 16mV increments)
|
||||
//
|
||||
// This test may need adapted if other charge controllers are used in the future.
|
||||
for(uint16_t charge_mv = 3840; charge_mv <= 4208; charge_mv += 16) {
|
||||
float charge_volt = (float)charge_mv / 1000.0f;
|
||||
furi_hal_power_set_battery_charging_voltage(charge_volt);
|
||||
mu_assert_double_eq(charge_volt, furi_hal_power_get_battery_charging_voltage());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(charge_volt);
|
||||
mu_assert_double_eq(charge_volt, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
}
|
||||
}
|
||||
|
||||
MU_TEST(test_power_charge_voltage_floating_imprecision) {
|
||||
MU_TEST(test_power_charge_voltage_limit_floating_imprecision) {
|
||||
// 4.016f should act as 4.016 V, even with floating point imprecision
|
||||
furi_hal_power_set_battery_charging_voltage(4.016f);
|
||||
mu_assert_double_eq(4.016f, furi_hal_power_get_battery_charging_voltage());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(4.016f);
|
||||
mu_assert_double_eq(4.016f, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
}
|
||||
|
||||
MU_TEST(test_power_charge_voltage_inexact) {
|
||||
// Charge voltages that are not power of 16mV get truncated down
|
||||
furi_hal_power_set_battery_charging_voltage(3.841f);
|
||||
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charging_voltage());
|
||||
MU_TEST(test_power_charge_voltage_limit_inexact) {
|
||||
// Charge voltage limits that are not power of 16mV get truncated down
|
||||
furi_hal_power_set_battery_charge_voltage_limit(3.841f);
|
||||
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
|
||||
furi_hal_power_set_battery_charging_voltage(3.900f);
|
||||
mu_assert_double_eq(3.888, furi_hal_power_get_battery_charging_voltage());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(3.900f);
|
||||
mu_assert_double_eq(3.888, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
|
||||
furi_hal_power_set_battery_charging_voltage(4.200f);
|
||||
mu_assert_double_eq(4.192, furi_hal_power_get_battery_charging_voltage());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(4.200f);
|
||||
mu_assert_double_eq(4.192, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
}
|
||||
|
||||
MU_TEST(test_power_charge_voltage_invalid_clamped) {
|
||||
// Out-of-range charge voltages get clamped to 3.840 V and 4.208 V
|
||||
furi_hal_power_set_battery_charging_voltage(3.808f);
|
||||
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charging_voltage());
|
||||
MU_TEST(test_power_charge_voltage_limit_invalid_clamped) {
|
||||
// Out-of-range charge voltage limits get clamped to 3.840 V and 4.208 V
|
||||
furi_hal_power_set_battery_charge_voltage_limit(3.808f);
|
||||
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(1.0f);
|
||||
mu_assert_double_eq(3.840, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
|
||||
// NOTE: Intentionally picking a small increment above 4.208 V to reduce the risk of an
|
||||
// unhappy battery if this fails.
|
||||
furi_hal_power_set_battery_charging_voltage(4.240f);
|
||||
mu_assert_double_eq(4.208, furi_hal_power_get_battery_charging_voltage());
|
||||
furi_hal_power_set_battery_charge_voltage_limit(4.240f);
|
||||
mu_assert_double_eq(4.208, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
// Likewise, picking a number that the uint8_t wraparound in the driver would result in a
|
||||
// VREG value under 23 if this test fails.
|
||||
// E.g. (uint8_t)((8105-3840)/16) -> 10
|
||||
furi_hal_power_set_battery_charge_voltage_limit(8.105f);
|
||||
mu_assert_double_eq(4.208, furi_hal_power_get_battery_charge_voltage_limit());
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(test_power_suite) {
|
||||
MU_RUN_TEST(test_power_charge_voltage_exact);
|
||||
MU_RUN_TEST(test_power_charge_voltage_floating_imprecision);
|
||||
MU_RUN_TEST(test_power_charge_voltage_inexact);
|
||||
MU_RUN_TEST(test_power_charge_voltage_invalid_clamped);
|
||||
MU_RUN_TEST(test_power_charge_voltage_limit_exact);
|
||||
MU_RUN_TEST(test_power_charge_voltage_limit_floating_imprecision);
|
||||
MU_RUN_TEST(test_power_charge_voltage_limit_inexact);
|
||||
MU_RUN_TEST(test_power_charge_voltage_limit_invalid_clamped);
|
||||
power_test_deinit();
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ static void clean_directory(Storage* fs_api, const char* clean_dir) {
|
||||
size_t size = strlen(clean_dir) + strlen(name) + 1 + 1;
|
||||
char* fullname = malloc(size);
|
||||
snprintf(fullname, size, "%s/%s", clean_dir, name);
|
||||
if(fileinfo.flags & FSF_DIRECTORY) {
|
||||
if(file_info_is_dir(&fileinfo)) {
|
||||
clean_directory(fs_api, fullname);
|
||||
}
|
||||
FS_Error error = storage_common_remove(fs_api, fullname);
|
||||
@@ -608,9 +608,8 @@ static void test_rpc_storage_list_create_expected_list(
|
||||
}
|
||||
|
||||
if(path_contains_only_ascii(name)) {
|
||||
list->file[i].type = (fileinfo.flags & FSF_DIRECTORY) ?
|
||||
PB_Storage_File_FileType_DIR :
|
||||
PB_Storage_File_FileType_FILE;
|
||||
list->file[i].type = file_info_is_dir(&fileinfo) ? PB_Storage_File_FileType_DIR :
|
||||
PB_Storage_File_FileType_FILE;
|
||||
list->file[i].size = fileinfo.size;
|
||||
list->file[i].data = NULL;
|
||||
/* memory free inside rpc_encode_and_send() -> pb_release() */
|
||||
@@ -873,7 +872,7 @@ static void test_rpc_storage_stat_run(const char* path, uint32_t command_id) {
|
||||
if(error == FSE_OK) {
|
||||
response->which_content = PB_Main_storage_stat_response_tag;
|
||||
response->content.storage_stat_response.has_file = true;
|
||||
response->content.storage_stat_response.file.type = (fileinfo.flags & FSF_DIRECTORY) ?
|
||||
response->content.storage_stat_response.file.type = file_info_is_dir(&fileinfo) ?
|
||||
PB_Storage_File_FileType_DIR :
|
||||
PB_Storage_File_FileType_FILE;
|
||||
response->content.storage_stat_response.file.size = fileinfo.size;
|
||||
|
||||
@@ -179,7 +179,7 @@ MU_TEST_1(test_dirwalk_full, Storage* storage) {
|
||||
|
||||
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
|
||||
furi_string_right(path, strlen(EXT_PATH("dirwalk/")));
|
||||
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
|
||||
mu_check(storage_test_paths_mark(paths, path, file_info_is_dir(&fileinfo)));
|
||||
}
|
||||
|
||||
dir_walk_free(dir_walk);
|
||||
@@ -204,7 +204,7 @@ MU_TEST_1(test_dirwalk_no_recursive, Storage* storage) {
|
||||
|
||||
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
|
||||
furi_string_right(path, strlen(EXT_PATH("dirwalk/")));
|
||||
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
|
||||
mu_check(storage_test_paths_mark(paths, path, file_info_is_dir(&fileinfo)));
|
||||
}
|
||||
|
||||
dir_walk_free(dir_walk);
|
||||
@@ -219,7 +219,7 @@ static bool test_dirwalk_filter_no_folder_ext(const char* name, FileInfo* filein
|
||||
UNUSED(ctx);
|
||||
|
||||
// only files
|
||||
if(!(fileinfo->flags & FSF_DIRECTORY)) {
|
||||
if(!file_info_is_dir(fileinfo)) {
|
||||
// with ".test" in name
|
||||
if(strstr(name, ".test") != NULL) {
|
||||
return true;
|
||||
@@ -243,7 +243,7 @@ MU_TEST_1(test_dirwalk_filter, Storage* storage) {
|
||||
|
||||
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
|
||||
furi_string_right(path, strlen(EXT_PATH("dirwalk/")));
|
||||
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
|
||||
mu_check(storage_test_paths_mark(paths, path, file_info_is_dir(&fileinfo)));
|
||||
}
|
||||
|
||||
dir_walk_free(dir_walk);
|
||||
|
||||
@@ -2,9 +2,40 @@
|
||||
#include <furi.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
// DO NOT USE THIS IN PRODUCTION CODE
|
||||
// This is a hack to access internal storage functions and definitions
|
||||
#include <storage/storage_i.h>
|
||||
|
||||
#define UNIT_TESTS_PATH(path) EXT_PATH("unit_tests/" path)
|
||||
|
||||
#define STORAGE_LOCKED_FILE EXT_PATH("locked_file.test")
|
||||
#define STORAGE_LOCKED_DIR STORAGE_INT_PATH_PREFIX
|
||||
|
||||
#define STORAGE_TEST_DIR UNIT_TESTS_PATH("test_dir")
|
||||
|
||||
static bool storage_file_create(Storage* storage, const char* path, const char* data) {
|
||||
File* file = storage_file_alloc(storage);
|
||||
bool result = false;
|
||||
do {
|
||||
if(!storage_file_open(file, path, FSAM_WRITE, FSOM_CREATE_NEW)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(storage_file_write(file, data, strlen(data)) != strlen(data)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!storage_file_close(file)) {
|
||||
break;
|
||||
}
|
||||
|
||||
result = true;
|
||||
} while(0);
|
||||
|
||||
storage_file_free(file);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void storage_file_open_lock_setup() {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(storage);
|
||||
@@ -115,7 +146,7 @@ static int32_t storage_dir_locker(void* ctx) {
|
||||
File* file = storage_file_alloc(storage);
|
||||
furi_check(storage_dir_open(file, STORAGE_LOCKED_DIR));
|
||||
furi_semaphore_release(semaphore);
|
||||
furi_delay_ms(1000);
|
||||
furi_delay_ms(100);
|
||||
|
||||
furi_check(storage_dir_close(file));
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
@@ -152,9 +183,21 @@ MU_TEST(storage_dir_open_lock) {
|
||||
mu_assert(result, "cannot open locked dir");
|
||||
}
|
||||
|
||||
MU_TEST(storage_dir_exists_test) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
mu_check(!storage_dir_exists(storage, STORAGE_TEST_DIR));
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, STORAGE_TEST_DIR));
|
||||
mu_check(storage_dir_exists(storage, STORAGE_TEST_DIR));
|
||||
mu_assert_int_eq(FSE_OK, storage_common_remove(storage, STORAGE_TEST_DIR));
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(storage_dir) {
|
||||
MU_RUN_TEST(storage_dir_open_close);
|
||||
MU_RUN_TEST(storage_dir_open_lock);
|
||||
MU_RUN_TEST(storage_dir_exists_test);
|
||||
}
|
||||
|
||||
static const char* const storage_copy_test_paths[] = {
|
||||
@@ -303,9 +346,256 @@ MU_TEST_SUITE(storage_rename) {
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
#define APPSDATA_APP_PATH(path) APPS_DATA_PATH "/" path
|
||||
|
||||
static const char* storage_test_apps[] = {
|
||||
"-_twilight_-",
|
||||
"-_rainbow_-",
|
||||
"-_pinkie_-",
|
||||
"-_apple_-",
|
||||
"-_flutter_-",
|
||||
"-_rare_-",
|
||||
};
|
||||
|
||||
static size_t storage_test_apps_count = COUNT_OF(storage_test_apps);
|
||||
|
||||
static int32_t storage_test_app(void* arg) {
|
||||
UNUSED(arg);
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
storage_common_remove(storage, "/data/test");
|
||||
int32_t ret = storage_file_create(storage, "/data/test", "test");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
MU_TEST(test_storage_data_path_apps) {
|
||||
for(size_t i = 0; i < storage_test_apps_count; i++) {
|
||||
FuriThread* thread =
|
||||
furi_thread_alloc_ex(storage_test_apps[i], 1024, storage_test_app, NULL);
|
||||
furi_thread_set_appid(thread, storage_test_apps[i]);
|
||||
furi_thread_start(thread);
|
||||
furi_thread_join(thread);
|
||||
|
||||
mu_assert_int_eq(true, furi_thread_get_return_code(thread));
|
||||
|
||||
// Check if app data dir and file exists
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FuriString* expected = furi_string_alloc();
|
||||
furi_string_printf(expected, APPSDATA_APP_PATH("%s"), storage_test_apps[i]);
|
||||
|
||||
mu_check(storage_dir_exists(storage, furi_string_get_cstr(expected)));
|
||||
furi_string_cat(expected, "/test");
|
||||
mu_check(storage_file_exists(storage, furi_string_get_cstr(expected)));
|
||||
|
||||
furi_string_printf(expected, APPSDATA_APP_PATH("%s"), storage_test_apps[i]);
|
||||
storage_simply_remove_recursive(storage, furi_string_get_cstr(expected));
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
furi_string_free(expected);
|
||||
furi_thread_free(thread);
|
||||
}
|
||||
}
|
||||
|
||||
MU_TEST(test_storage_data_path) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
File* file = storage_file_alloc(storage);
|
||||
mu_check(storage_dir_open(file, "/data"));
|
||||
mu_check(storage_dir_close(file));
|
||||
storage_file_free(file);
|
||||
|
||||
// check that appsdata folder exists
|
||||
mu_check(storage_dir_exists(storage, APPS_DATA_PATH));
|
||||
|
||||
// check that cli folder exists
|
||||
mu_check(storage_dir_exists(storage, APPSDATA_APP_PATH("cli")));
|
||||
|
||||
storage_simply_remove(storage, APPSDATA_APP_PATH("cli"));
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
MU_TEST(test_storage_common_migrate) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
// Setup test folders
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
|
||||
// Test migration from non existing
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
// Test migration from existing folder to non existing
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file1"), "test1"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file2.ext"), "test2"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file3.ext.ext"), "test3"));
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file1")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file2.ext")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file3.ext.ext")));
|
||||
mu_check(storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
|
||||
// Test migration from existing folder to existing folder
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file1"), "test1"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file2.ext"), "test2"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old/file3.ext.ext"), "test3"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file1")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file2.ext")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file3.ext.ext")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file11")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file21.ext")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new/file3.ext1.ext")));
|
||||
mu_check(storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
|
||||
// Test migration from empty folder to existing file
|
||||
// Expected result: FSE_OK, folder removed, file untouched
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_new"), "test1"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
|
||||
// Test migration from empty folder to existing folder
|
||||
// Expected result: FSE_OK, old folder removed, new folder untouched
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
|
||||
// Test migration from existing file to non existing, no extension
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old"), "test1"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_file_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
|
||||
// Test migration from existing file to non existing, with extension
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old.file"), "test1"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old.file"), UNIT_TESTS_PATH("migrate_new.file")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new.file")));
|
||||
mu_check(!storage_file_exists(storage, UNIT_TESTS_PATH("migrate_old.file")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old.file"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new.file"));
|
||||
|
||||
// Test migration from existing file to existing file, no extension
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old"), "test1"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_new"), "test2"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_file_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new1")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new1"));
|
||||
|
||||
// Test migration from existing file to existing file, with extension
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old.file"), "test1"));
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_new.file"), "test2"));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old.file"), UNIT_TESTS_PATH("migrate_new.file")));
|
||||
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new.file")));
|
||||
mu_check(!storage_file_exists(storage, UNIT_TESTS_PATH("migrate_old.file")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new1.file")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old.file"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new.file"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new1.file"));
|
||||
|
||||
// Test migration from existing file to existing folder
|
||||
mu_check(storage_file_create(storage, UNIT_TESTS_PATH("migrate_old"), "test1"));
|
||||
mu_assert_int_eq(FSE_OK, storage_common_mkdir(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_assert_int_eq(
|
||||
FSE_OK,
|
||||
storage_common_migrate(
|
||||
storage, UNIT_TESTS_PATH("migrate_old"), UNIT_TESTS_PATH("migrate_new")));
|
||||
|
||||
mu_check(storage_dir_exists(storage, UNIT_TESTS_PATH("migrate_new")));
|
||||
mu_check(!storage_file_exists(storage, UNIT_TESTS_PATH("migrate_old")));
|
||||
mu_check(storage_file_exists(storage, UNIT_TESTS_PATH("migrate_new1")));
|
||||
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_old"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new"));
|
||||
storage_simply_remove_recursive(storage, UNIT_TESTS_PATH("migrate_new1"));
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(test_data_path) {
|
||||
MU_RUN_TEST(test_storage_data_path);
|
||||
MU_RUN_TEST(test_storage_data_path_apps);
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(test_storage_common) {
|
||||
MU_RUN_TEST(test_storage_common_migrate);
|
||||
}
|
||||
|
||||
int run_minunit_test_storage() {
|
||||
MU_RUN_SUITE(storage_file);
|
||||
MU_RUN_SUITE(storage_dir);
|
||||
MU_RUN_SUITE(storage_rename);
|
||||
MU_RUN_SUITE(test_data_path);
|
||||
MU_RUN_SUITE(test_storage_common);
|
||||
return MU_EXIT_CODE;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ App(
|
||||
requires=["gui"],
|
||||
stack_size=1 * 1024,
|
||||
order=60,
|
||||
fap_icon="../../plugins/mousejacker/mouse_10px.png",
|
||||
fap_icon="../../external/mousejacker/mouse_10px.png",
|
||||
fap_category="Debug",
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# Placeholder
|
||||
App(
|
||||
appid="example_apps",
|
||||
name="Example apps bundle",
|
||||
|
||||
58
applications/examples/example_apps_assets/README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Apps Assets folder Example
|
||||
|
||||
This example shows how to use the Apps Assets folder to store data that is not part of the application itself, but is required for its operation, and that data is provided with the application.
|
||||
|
||||
## What is the Apps Assets Folder?
|
||||
|
||||
The **Apps Assets** folder is a folder where external applications unpack their assets.
|
||||
|
||||
The path to the current application folder is related to the `appid` of the app. The `appid` is used to identify the app in the app store and is stored in the `application.fam` file.
|
||||
The Apps Assets folder is located only on the external storage, the SD card.
|
||||
|
||||
For example, if the `appid` of the app is `snake_game`, the path to the Apps Assets folder will be `/ext/apps_assets/snake_game`. But using raw paths is not recommended, because the path to the Apps Assets folder can change in the future. Use the `/assets` alias instead.
|
||||
|
||||
## How to get the path to the Apps Assets folder?
|
||||
|
||||
You can use `/assets` alias to get the path to the current application data folder. For example, if you want to open a file `database.txt` in the Apps Assets folder, you can use the next path: `/data/database.txt`. But this way is not recommended, because even the `/assets` alias can change in the future.
|
||||
|
||||
We recommend to use the `APP_ASSETS_PATH` macro to get the path to the Apps Assets folder. For example, if you want to open a file `database.txt` in the Apps Assets folder, you can use the next path: `APP_ASSETS_PATH("database.txt")`.
|
||||
|
||||
## What is the difference between the Apps Assets folder and the Apps Data folder?
|
||||
|
||||
The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (contant data) in the Apps Assets folder.
|
||||
|
||||
The Apps Data folder is used to store data <u>generated</u> by the application. For example, if you want to create a game, you can save the progress of the game (user-generated data) in the Apps Data folder.
|
||||
|
||||
## How to provide the data with the app?
|
||||
|
||||
To provide data with an application, you need to create a folder inside your application folder (eg "files") and place the data in it. After that, you need to add `fap_file_assets="files"` to your application.fam file.
|
||||
|
||||
For example, if you want to provide game levels with the application, you need to create a "levels" folder inside the "files" folder and put the game levels in it. After that, you need to add `fap_file_assets="files"` to your application.fam file. The final application folder structure will look like this:
|
||||
|
||||
```
|
||||
snake_game
|
||||
├── application.fam
|
||||
├── snake_game.c
|
||||
└── files
|
||||
└── levels
|
||||
├── level1.txt
|
||||
├── level2.txt
|
||||
└── level3.txt
|
||||
```
|
||||
|
||||
When app is launched, the `files` folder will be unpacked to the Apps Assets folder. The final structure of the Apps Assets folder will look like this:
|
||||
|
||||
```
|
||||
/assets
|
||||
├── .assets.signature
|
||||
└── levels
|
||||
├── level1.txt
|
||||
├── level2.txt
|
||||
└── level3.txt
|
||||
```
|
||||
|
||||
## When will the data be unpacked?
|
||||
|
||||
The data is unpacked when the application starts, if the application is launched for the first time, or if the data within the application is updated.
|
||||
|
||||
When an application is compiled, the contents of the "files" folder are hashed and stored within the application itself. When the application starts, this hash is compared to the hash stored in the `.assets.signature` file. If the hashes differ or the `.assets.signature` file does not exist, the application folder is deleted and the new data is unpacked.
|
||||
10
applications/examples/example_apps_assets/application.fam
Normal file
@@ -0,0 +1,10 @@
|
||||
App(
|
||||
appid="example_apps_assets",
|
||||
name="Example: Apps Assets",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="example_apps_assets_main",
|
||||
requires=["gui"],
|
||||
stack_size=4 * 1024,
|
||||
fap_category="Examples",
|
||||
fap_file_assets="files",
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <furi.h>
|
||||
#include <storage/storage.h>
|
||||
#include <toolbox/stream/stream.h>
|
||||
#include <toolbox/stream/file_stream.h>
|
||||
|
||||
// Define log tag
|
||||
#define TAG "example_apps_assets"
|
||||
|
||||
static void example_apps_data_print_file_content(Storage* storage, const char* path) {
|
||||
Stream* stream = file_stream_alloc(storage);
|
||||
FuriString* line = furi_string_alloc();
|
||||
|
||||
FURI_LOG_I(TAG, "----------------------------------------");
|
||||
FURI_LOG_I(TAG, "File \"%s\" content:", path);
|
||||
if(file_stream_open(stream, path, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
while(stream_read_line(stream, line)) {
|
||||
furi_string_replace_all(line, "\r", "");
|
||||
furi_string_replace_all(line, "\n", "");
|
||||
FURI_LOG_I(TAG, "%s", furi_string_get_cstr(line));
|
||||
}
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to open file");
|
||||
}
|
||||
FURI_LOG_I(TAG, "----------------------------------------");
|
||||
|
||||
furi_string_free(line);
|
||||
file_stream_close(stream);
|
||||
stream_free(stream);
|
||||
}
|
||||
|
||||
// Application entry point
|
||||
int32_t example_apps_assets_main(void* p) {
|
||||
// Mark argument as unused
|
||||
UNUSED(p);
|
||||
|
||||
// Open storage
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
example_apps_data_print_file_content(storage, APP_ASSETS_PATH("test_asset.txt"));
|
||||
example_apps_data_print_file_content(storage, APP_ASSETS_PATH("poems/a jelly-fish.txt"));
|
||||
example_apps_data_print_file_content(storage, APP_ASSETS_PATH("poems/theme in yellow.txt"));
|
||||
example_apps_data_print_file_content(storage, APP_ASSETS_PATH("poems/my shadow.txt"));
|
||||
|
||||
// Close storage
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
A Jelly-Fish by Marianne Moore
|
||||
|
||||
Visible, invisible,
|
||||
A fluctuating charm,
|
||||
An amber-colored amethyst
|
||||
Inhabits it; your arm
|
||||
Approaches, and
|
||||
It opens and
|
||||
It closes;
|
||||
You have meant
|
||||
To catch it,
|
||||
And it shrivels;
|
||||
You abandon
|
||||
Your intent—
|
||||
It opens, and it
|
||||
Closes and you
|
||||
Reach for it—
|
||||
The blue
|
||||
Surrounding it
|
||||
Grows cloudy, and
|
||||
It floats away
|
||||
From you.
|
||||
|
||||
source: "https://poets.org/anthology/poems-your-poetry-project-public-domain"
|
||||
@@ -0,0 +1,23 @@
|
||||
My Shadow by Robert Louis Stevenson
|
||||
|
||||
I have a little shadow that goes in and out with me,
|
||||
And what can be the use of him is more than I can see.
|
||||
He is very, very like me from the heels up to the head;
|
||||
And I see him jump before me, when I jump into my bed.
|
||||
|
||||
The funniest thing about him is the way he likes to grow—
|
||||
Not at all like proper children, which is always very slow;
|
||||
For he sometimes shoots up taller like an India-rubber ball,
|
||||
And he sometimes gets so little that there’s none of him at all.
|
||||
|
||||
He hasn’t got a notion of how children ought to play,
|
||||
And can only make a fool of me in every sort of way.
|
||||
He stays so close beside me, he’s a coward you can see;
|
||||
I’d think shame to stick to nursie as that shadow sticks to me!
|
||||
|
||||
One morning, very early, before the sun was up,
|
||||
I rose and found the shining dew on every buttercup;
|
||||
But my lazy little shadow, like an arrant sleepy-head,
|
||||
Had stayed at home behind me and was fast asleep in bed.
|
||||
|
||||
source: "https://poets.org/anthology/poems-your-poetry-project-public-domain"
|
||||
@@ -0,0 +1,19 @@
|
||||
Theme in Yellow by Carl Sandburg
|
||||
|
||||
I spot the hills
|
||||
With yellow balls in autumn.
|
||||
I light the prairie cornfields
|
||||
Orange and tawny gold clusters
|
||||
And I am called pumpkins.
|
||||
On the last of October
|
||||
When dusk is fallen
|
||||
Children join hands
|
||||
And circle round me
|
||||
Singing ghost songs
|
||||
And love to the harvest moon;
|
||||
I am a jack-o'-lantern
|
||||
With terrible teeth
|
||||
And the children know
|
||||
I am fooling.
|
||||
|
||||
source: "https://poets.org/anthology/poems-your-poetry-project-public-domain"
|
||||
@@ -0,0 +1 @@
|
||||
## This is test file content
|
||||
24
applications/examples/example_apps_data/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Apps Data folder Example
|
||||
|
||||
This example demonstrates how to utilize the Apps Data folder to store data that is not part of the app itself, such as user data, configuration files, and so forth.
|
||||
|
||||
## What is the Apps Data Folder?
|
||||
|
||||
The **Apps Data** folder is a folder used to store data for external apps that are not part of the main firmware.
|
||||
|
||||
The path to the current application folder is related to the `appid` of the app. The `appid` is used to identify the app in the app store and is stored in the `application.fam` file.
|
||||
The Apps Data folder is located only on the external storage, the SD card.
|
||||
|
||||
For example, if the `appid` of the app is `snake_game`, the path to the Apps Data folder will be `/ext/apps_data/snake_game`. But using raw paths is not recommended, because the path to the Apps Data folder can change in the future. Use the `/data` alias instead.
|
||||
|
||||
## How to get the path to the Apps Data folder?
|
||||
|
||||
You can use `/data` alias to get the path to the current application data folder. For example, if you want to open a file `config.txt` in the Apps Data folder, you can use the next path: `/data/config.txt`. But this way is not recommended, because even the `/data` alias can change in the future.
|
||||
|
||||
We recommend to use the `APP_DATA_PATH` macro to get the path to the Apps Data folder. For example, if you want to open a file `config.txt` in the Apps Data folder, you can use the next path: `APP_DATA_PATH("config.txt")`.
|
||||
|
||||
## What is the difference between the Apps Assets folder and the Apps Data folder?
|
||||
|
||||
The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (contant data) in the Apps Assets folder.
|
||||
|
||||
The Apps Data folder is used to store data <u>generated</u> by the application. For example, if you want to create a game, you can save the progress of the game (user-generated data) in the Apps Data folder.
|
||||
9
applications/examples/example_apps_data/application.fam
Normal file
@@ -0,0 +1,9 @@
|
||||
App(
|
||||
appid="example_apps_data",
|
||||
name="Example: Apps Data",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="example_apps_data_main",
|
||||
requires=["gui"],
|
||||
stack_size=1 * 1024,
|
||||
fap_category="Examples",
|
||||
)
|
||||
40
applications/examples/example_apps_data/example_apps_data.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <furi.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
// Define log tag
|
||||
#define TAG "example_apps_data"
|
||||
|
||||
// Application entry point
|
||||
int32_t example_apps_data_main(void* p) {
|
||||
// Mark argument as unused
|
||||
UNUSED(p);
|
||||
|
||||
// Open storage
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
// Allocate file
|
||||
File* file = storage_file_alloc(storage);
|
||||
|
||||
// Get the path to the current application data folder
|
||||
// That is: /ext/apps_data/<app_name>
|
||||
// And it will create folders in the path if they don't exist
|
||||
// In this example it will create /ext/apps_data/example_apps_data
|
||||
// And file will be /ext/apps_data/example_apps_data/test.txt
|
||||
|
||||
// Open file, write data and close it
|
||||
if(!storage_file_open(file, APP_DATA_PATH("test.txt"), FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||
FURI_LOG_E(TAG, "Failed to open file");
|
||||
}
|
||||
if(!storage_file_write(file, "Hello World!", strlen("Hello World!"))) {
|
||||
FURI_LOG_E(TAG, "Failed to write to file");
|
||||
}
|
||||
storage_file_close(file);
|
||||
|
||||
// Deallocate file
|
||||
storage_file_free(file);
|
||||
|
||||
// Close storage
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
31
applications/examples/example_plugins/application.fam
Normal file
@@ -0,0 +1,31 @@
|
||||
App(
|
||||
appid="example_plugins",
|
||||
name="Example: App w/plugin",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="example_plugins_app",
|
||||
stack_size=2 * 1024,
|
||||
fap_category="Examples",
|
||||
)
|
||||
|
||||
App(
|
||||
appid="example_plugins_multi",
|
||||
name="Example: App w/plugins",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="example_plugins_multi_app",
|
||||
stack_size=2 * 1024,
|
||||
fap_category="Examples",
|
||||
)
|
||||
|
||||
App(
|
||||
appid="example_plugin1",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
entry_point="example_plugin1_ep",
|
||||
requires=["example_plugins", "example_plugins_multi"],
|
||||
)
|
||||
|
||||
App(
|
||||
appid="example_plugin2",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
entry_point="example_plugin2_ep",
|
||||
requires=["example_plugins_multi"],
|
||||
)
|
||||
70
applications/examples/example_plugins/example_plugins.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* An example of a plugin host application.
|
||||
* Loads a single plugin and calls its methods.
|
||||
*/
|
||||
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAG "example_plugins"
|
||||
|
||||
int32_t example_plugins_app(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
FURI_LOG_I(TAG, "Starting");
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface);
|
||||
|
||||
do {
|
||||
FlipperApplicationPreloadStatus preload_res =
|
||||
flipper_application_preload(app, APP_DATA_PATH("plugins/example_plugin1.fal"));
|
||||
|
||||
if(preload_res != FlipperApplicationPreloadStatusSuccess) {
|
||||
FURI_LOG_E(TAG, "Failed to preload plugin");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!flipper_application_is_plugin(app)) {
|
||||
FURI_LOG_E(TAG, "Plugin file is not a library");
|
||||
break;
|
||||
}
|
||||
|
||||
FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(app);
|
||||
if(load_status != FlipperApplicationLoadStatusSuccess) {
|
||||
FURI_LOG_E(TAG, "Failed to load plugin file");
|
||||
break;
|
||||
}
|
||||
|
||||
const FlipperAppPluginDescriptor* app_descriptor =
|
||||
flipper_application_plugin_get_descriptor(app);
|
||||
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
"Loaded plugin for appid '%s', API %lu",
|
||||
app_descriptor->appid,
|
||||
app_descriptor->ep_api_version);
|
||||
|
||||
furi_check(app_descriptor->ep_api_version == PLUGIN_API_VERSION);
|
||||
furi_check(strcmp(app_descriptor->appid, PLUGIN_APP_ID) == 0);
|
||||
|
||||
const ExamplePlugin* plugin = app_descriptor->entry_point;
|
||||
|
||||
FURI_LOG_I(TAG, "Plugin name: %s", plugin->name);
|
||||
FURI_LOG_I(TAG, "Plugin method1: %d", plugin->method1());
|
||||
FURI_LOG_I(TAG, "Plugin method2(7,8): %d", plugin->method2(7, 8));
|
||||
FURI_LOG_I(TAG, "Plugin method2(1337,228): %d", plugin->method2(1337, 228));
|
||||
} while(false);
|
||||
flipper_application_free(app);
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
FURI_LOG_I(TAG, "Goodbye!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* An example of an advanced plugin host application.
|
||||
* It uses PluginManager to load all plugins from a directory
|
||||
*/
|
||||
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <flipper_application/plugins/plugin_manager.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#define TAG "example_plugins"
|
||||
|
||||
int32_t example_plugins_multi_app(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
FURI_LOG_I(TAG, "Starting");
|
||||
|
||||
PluginManager* manager =
|
||||
plugin_manager_alloc(PLUGIN_APP_ID, PLUGIN_API_VERSION, firmware_api_interface);
|
||||
|
||||
if(plugin_manager_load_all(manager, APP_DATA_PATH("plugins")) != PluginManagerErrorNone) {
|
||||
FURI_LOG_E(TAG, "Failed to load all libs");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t plugin_count = plugin_manager_get_count(manager);
|
||||
FURI_LOG_I(TAG, "Loaded %lu plugin(s)", plugin_count);
|
||||
|
||||
for(uint32_t i = 0; i < plugin_count; i++) {
|
||||
const ExamplePlugin* plugin = plugin_manager_get_ep(manager, i);
|
||||
FURI_LOG_I(TAG, "plugin name: %s", plugin->name);
|
||||
FURI_LOG_I(TAG, "plugin method1: %d", plugin->method1());
|
||||
FURI_LOG_I(TAG, "plugin method2(7,8): %d", plugin->method2(7, 8));
|
||||
}
|
||||
|
||||
plugin_manager_free(manager);
|
||||
FURI_LOG_I(TAG, "Goodbye!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
32
applications/examples/example_plugins/plugin1.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* A simple plugin implementing example_plugins application's plugin interface */
|
||||
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
|
||||
static int example_plugin1_method1() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
static int example_plugin1_method2(int arg1, int arg2) {
|
||||
return arg1 + arg2;
|
||||
}
|
||||
|
||||
/* Actual implementation of app<>plugin interface */
|
||||
static const ExamplePlugin example_plugin1 = {
|
||||
.name = "Demo App Plugin 1",
|
||||
.method1 = &example_plugin1_method1,
|
||||
.method2 = &example_plugin1_method2,
|
||||
};
|
||||
|
||||
/* Plugin descriptor to comply with basic plugin specification */
|
||||
static const FlipperAppPluginDescriptor example_plugin1_descriptor = {
|
||||
.appid = PLUGIN_APP_ID,
|
||||
.ep_api_version = PLUGIN_API_VERSION,
|
||||
.entry_point = &example_plugin1,
|
||||
};
|
||||
|
||||
/* Plugin entry point - must return a pointer to const descriptor */
|
||||
const FlipperAppPluginDescriptor* example_plugin1_ep() {
|
||||
return &example_plugin1_descriptor;
|
||||
}
|
||||
32
applications/examples/example_plugins/plugin2.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Second plugin implementing example_plugins application's plugin interface */
|
||||
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
|
||||
static int example_plugin2_method1() {
|
||||
return 1337;
|
||||
}
|
||||
|
||||
static int example_plugin2_method2(int arg1, int arg2) {
|
||||
return arg1 - arg2;
|
||||
}
|
||||
|
||||
/* Actual implementation of app<>plugin interface */
|
||||
static const ExamplePlugin example_plugin2 = {
|
||||
.name = "Demo App Plugin 2",
|
||||
.method1 = &example_plugin2_method1,
|
||||
.method2 = &example_plugin2_method2,
|
||||
};
|
||||
|
||||
/* Plugin descriptor to comply with basic plugin specification */
|
||||
static const FlipperAppPluginDescriptor example_plugin2_descriptor = {
|
||||
.appid = PLUGIN_APP_ID,
|
||||
.ep_api_version = PLUGIN_API_VERSION,
|
||||
.entry_point = &example_plugin2,
|
||||
};
|
||||
|
||||
/* Plugin entry point - must return a pointer to const descriptor */
|
||||
const FlipperAppPluginDescriptor* example_plugin2_ep() {
|
||||
return &example_plugin2_descriptor;
|
||||
}
|
||||
12
applications/examples/example_plugins/plugin_interface.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
/* Common interface between a plugin and host applicaion */
|
||||
|
||||
#define PLUGIN_APP_ID "example_plugins"
|
||||
#define PLUGIN_API_VERSION 1
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
int (*method1)();
|
||||
int (*method2)(int, int);
|
||||
} ExamplePlugin;
|
||||
25
applications/examples/example_plugins_advanced/app_api.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "app_api.h"
|
||||
|
||||
/* Actual implementation of app's API and its private state */
|
||||
|
||||
static uint32_t accumulator = 0;
|
||||
|
||||
void app_api_accumulator_set(uint32_t value) {
|
||||
accumulator = value;
|
||||
}
|
||||
|
||||
uint32_t app_api_accumulator_get() {
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
void app_api_accumulator_add(uint32_t value) {
|
||||
accumulator += value;
|
||||
}
|
||||
|
||||
void app_api_accumulator_sub(uint32_t value) {
|
||||
accumulator -= value;
|
||||
}
|
||||
|
||||
void app_api_accumulator_mul(uint32_t value) {
|
||||
accumulator *= value;
|
||||
}
|
||||
25
applications/examples/example_plugins_advanced/app_api.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* This file contains an API that is internally implemented by the application
|
||||
* It is also exposed to plugins to allow them to use the application's API.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void app_api_accumulator_set(uint32_t value);
|
||||
|
||||
uint32_t app_api_accumulator_get();
|
||||
|
||||
void app_api_accumulator_add(uint32_t value);
|
||||
|
||||
void app_api_accumulator_sub(uint32_t value);
|
||||
|
||||
void app_api_accumulator_mul(uint32_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <flipper_application/api_hashtable/api_hashtable.h>
|
||||
|
||||
/*
|
||||
* Resolver interface with private application's symbols.
|
||||
* Implementation is contained in app_api_table.c
|
||||
*/
|
||||
extern const ElfApiInterface* const application_api_interface;
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <flipper_application/api_hashtable/api_hashtable.h>
|
||||
#include <flipper_application/api_hashtable/compilesort.hpp>
|
||||
|
||||
/*
|
||||
* This file contains an implementation of a symbol table
|
||||
* with private app's symbols. It is used by composite API resolver
|
||||
* to load plugins that use internal application's APIs.
|
||||
*/
|
||||
#include "app_api_table_i.h"
|
||||
|
||||
static_assert(!has_hash_collisions(app_api_table), "Detected API method hash collision!");
|
||||
|
||||
constexpr HashtableApiInterface applicaton_hashtable_api_interface{
|
||||
{
|
||||
.api_version_major = 0,
|
||||
.api_version_minor = 0,
|
||||
/* generic resolver using pre-sorted array */
|
||||
.resolver_callback = &elf_resolve_from_hashtable,
|
||||
},
|
||||
/* pointers to application's API table boundaries */
|
||||
.table_cbegin = app_api_table.cbegin(),
|
||||
.table_cend = app_api_table.cend(),
|
||||
};
|
||||
|
||||
/* Casting to generic resolver to use in Composite API resolver */
|
||||
extern "C" const ElfApiInterface* const application_api_interface =
|
||||
&applicaton_hashtable_api_interface;
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "app_api.h"
|
||||
|
||||
/*
|
||||
* A list of app's private functions and objects to expose for plugins.
|
||||
* It is used to generate a table of symbols for import resolver to use.
|
||||
* TBD: automatically generate this table from app's header files
|
||||
*/
|
||||
static constexpr auto app_api_table = sort(create_array_t<sym_entry>(
|
||||
API_METHOD(app_api_accumulator_set, void, (uint32_t)),
|
||||
API_METHOD(app_api_accumulator_get, uint32_t, ()),
|
||||
API_METHOD(app_api_accumulator_add, void, (uint32_t)),
|
||||
API_METHOD(app_api_accumulator_sub, void, (uint32_t)),
|
||||
API_METHOD(app_api_accumulator_mul, void, (uint32_t))));
|
||||
@@ -0,0 +1,24 @@
|
||||
App(
|
||||
appid="example_advanced_plugins",
|
||||
name="Example: advanced plugins",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="example_advanced_plugins_app",
|
||||
stack_size=2 * 1024,
|
||||
fap_category="Examples",
|
||||
)
|
||||
|
||||
App(
|
||||
appid="advanced_plugin1",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
entry_point="advanced_plugin1_ep",
|
||||
requires=["example_advanced_plugins"],
|
||||
sources=["plugin1.c"],
|
||||
)
|
||||
|
||||
App(
|
||||
appid="advanced_plugin2",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
entry_point="advanced_plugin2_ep",
|
||||
requires=["example_advanced_plugins"],
|
||||
sources=["plugin2.c"],
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "app_api.h"
|
||||
#include "plugin_interface.h"
|
||||
#include "app_api_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <flipper_application/plugins/plugin_manager.h>
|
||||
#include <flipper_application/plugins/composite_resolver.h>
|
||||
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
#define TAG "example_advanced_plugins"
|
||||
|
||||
int32_t example_advanced_plugins_app(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
FURI_LOG_I(TAG, "Starting");
|
||||
|
||||
CompositeApiResolver* resolver = composite_api_resolver_alloc();
|
||||
composite_api_resolver_add(resolver, firmware_api_interface);
|
||||
composite_api_resolver_add(resolver, application_api_interface);
|
||||
|
||||
PluginManager* manager = plugin_manager_alloc(
|
||||
PLUGIN_APP_ID, PLUGIN_API_VERSION, composite_api_resolver_get(resolver));
|
||||
|
||||
do {
|
||||
if(plugin_manager_load_all(manager, APP_DATA_PATH("plugins")) != PluginManagerErrorNone) {
|
||||
FURI_LOG_E(TAG, "Failed to load all libs");
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t plugin_count = plugin_manager_get_count(manager);
|
||||
FURI_LOG_I(TAG, "Loaded libs: %lu", plugin_count);
|
||||
|
||||
for(uint32_t i = 0; i < plugin_count; i++) {
|
||||
const AdvancedPlugin* plugin = plugin_manager_get_ep(manager, i);
|
||||
FURI_LOG_I(TAG, "plugin name: %s. Calling methods", plugin->name);
|
||||
plugin->method1(228);
|
||||
plugin->method2();
|
||||
FURI_LOG_I(TAG, "Accumulator: %lu", app_api_accumulator_get());
|
||||
}
|
||||
} while(0);
|
||||
|
||||
plugin_manager_free(manager);
|
||||
composite_api_resolver_free(resolver);
|
||||
FURI_LOG_I(TAG, "Goodbye!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
40
applications/examples/example_plugins_advanced/plugin1.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This plugin uses both firmware's API interface and private application headers.
|
||||
* It can be loaded by a plugin manager that uses CompoundApiInterface,
|
||||
* which combines both interfaces.
|
||||
*/
|
||||
|
||||
#include "app_api.h"
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <furi.h>
|
||||
|
||||
static void advanced_plugin1_method1(int arg1) {
|
||||
/* This function is implemented inside host application */
|
||||
app_api_accumulator_add(arg1);
|
||||
}
|
||||
|
||||
static void advanced_plugin1_method2() {
|
||||
/* Accumulator value is stored inside host application */
|
||||
FURI_LOG_I("TEST", "Plugin 1, accumulator: %lu", app_api_accumulator_get());
|
||||
}
|
||||
|
||||
/* Actual implementation of app<>plugin interface */
|
||||
static const AdvancedPlugin advanced_plugin1 = {
|
||||
.name = "Advanced Plugin 1",
|
||||
.method1 = &advanced_plugin1_method1,
|
||||
.method2 = &advanced_plugin1_method2,
|
||||
};
|
||||
|
||||
/* Plugin descriptor to comply with basic plugin specification */
|
||||
static const FlipperAppPluginDescriptor advanced_plugin1_descriptor = {
|
||||
.appid = PLUGIN_APP_ID,
|
||||
.ep_api_version = PLUGIN_API_VERSION,
|
||||
.entry_point = &advanced_plugin1,
|
||||
};
|
||||
|
||||
/* Plugin entry point - must return a pointer to const descriptor */
|
||||
const FlipperAppPluginDescriptor* advanced_plugin1_ep() {
|
||||
return &advanced_plugin1_descriptor;
|
||||
}
|
||||
40
applications/examples/example_plugins_advanced/plugin2.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This plugin uses both firmware's API interface and private application headers.
|
||||
* It can be loaded by a plugin manager that uses CompoundApiInterface,
|
||||
* which combines both interfaces.
|
||||
*/
|
||||
|
||||
#include "app_api.h"
|
||||
#include "plugin_interface.h"
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <furi.h>
|
||||
|
||||
static void advanced_plugin2_method1(int arg1) {
|
||||
/* This function is implemented inside host application */
|
||||
app_api_accumulator_mul(arg1);
|
||||
}
|
||||
|
||||
static void advanced_plugin2_method2() {
|
||||
/* Accumulator value is stored inside host application */
|
||||
FURI_LOG_I("TEST", "Plugin 2, accumulator: %lu", app_api_accumulator_get());
|
||||
}
|
||||
|
||||
/* Actual implementation of app<>plugin interface */
|
||||
static const AdvancedPlugin advanced_plugin2 = {
|
||||
.name = "Advanced Plugin 2",
|
||||
.method1 = &advanced_plugin2_method1,
|
||||
.method2 = &advanced_plugin2_method2,
|
||||
};
|
||||
|
||||
/* Plugin descriptor to comply with basic plugin specification */
|
||||
static const FlipperAppPluginDescriptor advanced_plugin2_descriptor = {
|
||||
.appid = PLUGIN_APP_ID,
|
||||
.ep_api_version = PLUGIN_API_VERSION,
|
||||
.entry_point = &advanced_plugin2,
|
||||
};
|
||||
|
||||
/* Plugin entry point - must return a pointer to const descriptor */
|
||||
const FlipperAppPluginDescriptor* advanced_plugin2_ep() {
|
||||
return &advanced_plugin2_descriptor;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
/* Common interface between a plugin and host applicaion */
|
||||
|
||||
#define PLUGIN_APP_ID "example_plugins_advanced"
|
||||
#define PLUGIN_API_VERSION 1
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
void (*method1)(int);
|
||||
void (*method2)();
|
||||
} AdvancedPlugin;
|
||||
6
applications/external/application.fam
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Placeholder
|
||||
App(
|
||||
appid="external_apps",
|
||||
name="External apps bundle",
|
||||
apptype=FlipperAppType.METAPACKAGE,
|
||||
)
|
||||
@@ -3,7 +3,6 @@ App(
|
||||
name="Arkanoid",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="arkanoid_game_app",
|
||||
cdefines=["APP_ARKANOID_GAME"],
|
||||
requires=["gui"],
|
||||
stack_size=1 * 1024,
|
||||
order=30,
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -38,6 +38,7 @@ typedef struct {
|
||||
} BallState;
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* mutex;
|
||||
BallState ball_state;
|
||||
BrickState brick_state;
|
||||
NotificationApp* notify;
|
||||
@@ -310,10 +311,9 @@ static void arkanoid_state_init(ArkanoidState* arkanoid_state) {
|
||||
}
|
||||
|
||||
static void arkanoid_draw_callback(Canvas* const canvas, void* ctx) {
|
||||
ArkanoidState* arkanoid_state = acquire_mutex((ValueMutex*)ctx, 25);
|
||||
if(arkanoid_state == NULL) {
|
||||
return;
|
||||
}
|
||||
furi_assert(ctx);
|
||||
ArkanoidState* arkanoid_state = ctx;
|
||||
furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
|
||||
|
||||
//Initial level draw
|
||||
if(!arkanoid_state->initialDraw) {
|
||||
@@ -352,7 +352,7 @@ static void arkanoid_draw_callback(Canvas* const canvas, void* ctx) {
|
||||
arkanoid_state->score = 0;
|
||||
}
|
||||
|
||||
release_mutex((ValueMutex*)ctx, arkanoid_state);
|
||||
furi_mutex_release(arkanoid_state->mutex);
|
||||
}
|
||||
|
||||
static void arkanoid_input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
|
||||
@@ -378,8 +378,8 @@ int32_t arkanoid_game_app(void* p) {
|
||||
ArkanoidState* arkanoid_state = malloc(sizeof(ArkanoidState));
|
||||
arkanoid_state_init(arkanoid_state);
|
||||
|
||||
ValueMutex state_mutex;
|
||||
if(!init_mutex(&state_mutex, arkanoid_state, sizeof(ArkanoidState))) {
|
||||
arkanoid_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
if(!arkanoid_state->mutex) {
|
||||
FURI_LOG_E(TAG, "Cannot create mutex\r\n");
|
||||
return_code = 255;
|
||||
goto free_and_exit;
|
||||
@@ -387,7 +387,7 @@ int32_t arkanoid_game_app(void* p) {
|
||||
|
||||
// Set system callbacks
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
view_port_draw_callback_set(view_port, arkanoid_draw_callback, &state_mutex);
|
||||
view_port_draw_callback_set(view_port, arkanoid_draw_callback, arkanoid_state);
|
||||
view_port_input_callback_set(view_port, arkanoid_input_callback, event_queue);
|
||||
|
||||
FuriTimer* timer =
|
||||
@@ -404,7 +404,7 @@ int32_t arkanoid_game_app(void* p) {
|
||||
GameEvent event;
|
||||
for(bool processing = true; processing;) {
|
||||
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
|
||||
ArkanoidState* arkanoid_state = (ArkanoidState*)acquire_mutex_block(&state_mutex);
|
||||
furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
|
||||
|
||||
if(event_status == FuriStatusOk) {
|
||||
// Key events
|
||||
@@ -461,7 +461,7 @@ int32_t arkanoid_game_app(void* p) {
|
||||
}
|
||||
|
||||
view_port_update(view_port);
|
||||
release_mutex(&state_mutex, arkanoid_state);
|
||||
furi_mutex_release(arkanoid_state->mutex);
|
||||
}
|
||||
furi_timer_free(timer);
|
||||
view_port_enabled_set(view_port, false);
|
||||
@@ -469,7 +469,7 @@ int32_t arkanoid_game_app(void* p) {
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
view_port_free(view_port);
|
||||
delete_mutex(&state_mutex);
|
||||
furi_mutex_free(arkanoid_state->mutex);
|
||||
|
||||
free_and_exit:
|
||||
free(arkanoid_state);
|
||||
@@ -3,7 +3,6 @@ App(
|
||||
name="Barcode Generator",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="barcode_generator_app",
|
||||
cdefines=["APP_BARCODE_GEN"],
|
||||
requires=[
|
||||
"gui",
|
||||
"dialogs",
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -130,10 +130,9 @@ int calculate_check_digit(PluginState* plugin_state, BarcodeType* type) {
|
||||
}
|
||||
|
||||
static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
PluginState* plugin_state = acquire_mutex((ValueMutex*)ctx, 25);
|
||||
if(plugin_state == NULL) {
|
||||
return;
|
||||
}
|
||||
furi_assert(ctx);
|
||||
PluginState* plugin_state = ctx;
|
||||
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
|
||||
|
||||
if(plugin_state->mode == MenuMode) {
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
@@ -239,7 +238,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
canvas_draw_box(canvas, (endSafetyPosition + 2), BARCODE_Y_START, 1, BARCODE_HEIGHT + 2);
|
||||
}
|
||||
|
||||
release_mutex((ValueMutex*)ctx, plugin_state);
|
||||
furi_mutex_release(plugin_state->mutex);
|
||||
}
|
||||
|
||||
static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
|
||||
@@ -387,8 +386,9 @@ int32_t barcode_generator_app(void* p) {
|
||||
|
||||
PluginState* plugin_state = malloc(sizeof(PluginState));
|
||||
barcode_generator_state_init(plugin_state);
|
||||
ValueMutex state_mutex;
|
||||
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
||||
|
||||
plugin_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
if(!plugin_state->mutex) {
|
||||
FURI_LOG_E("barcode_generator", "cannot create mutex\r\n");
|
||||
furi_message_queue_free(event_queue);
|
||||
free(plugin_state);
|
||||
@@ -397,7 +397,7 @@ int32_t barcode_generator_app(void* p) {
|
||||
|
||||
// Set system callbacks
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
view_port_draw_callback_set(view_port, render_callback, &state_mutex);
|
||||
view_port_draw_callback_set(view_port, render_callback, plugin_state);
|
||||
view_port_input_callback_set(view_port, input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
@@ -407,7 +407,7 @@ int32_t barcode_generator_app(void* p) {
|
||||
PluginEvent event;
|
||||
for(bool processing = true; processing;) {
|
||||
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
|
||||
PluginState* plugin_state = (PluginState*)acquire_mutex_block(&state_mutex);
|
||||
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
|
||||
|
||||
if(event_status == FuriStatusOk) {
|
||||
// press events
|
||||
@@ -430,7 +430,7 @@ int32_t barcode_generator_app(void* p) {
|
||||
}
|
||||
|
||||
view_port_update(view_port);
|
||||
release_mutex(&state_mutex, plugin_state);
|
||||
furi_mutex_release(plugin_state->mutex);
|
||||
}
|
||||
|
||||
view_port_enabled_set(view_port, false);
|
||||
@@ -438,6 +438,7 @@ int32_t barcode_generator_app(void* p) {
|
||||
furi_record_close(RECORD_GUI);
|
||||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
furi_mutex_free(plugin_state->mutex);
|
||||
// save settings
|
||||
SAVE_BARCODE_SETTINGS(&plugin_state->barcode_state);
|
||||
free(plugin_state);
|
||||
@@ -81,6 +81,7 @@ typedef struct {
|
||||
} BarcodeState;
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* mutex;
|
||||
BarcodeState barcode_state;
|
||||
int editingIndex; //The index of the editing symbol
|
||||
int menuIndex; //The index of the menu cursor
|
||||
@@ -3,7 +3,6 @@ App(
|
||||
name="Blackjack",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="blackjack_app",
|
||||
cdefines=["APP_BLACKJACK"],
|
||||
requires=["gui","storage","canvas"],
|
||||
stack_size=2 * 1024,
|
||||
order=30,
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 409 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -33,11 +33,9 @@ static void draw_ui(Canvas* const canvas, const GameState* game_state) {
|
||||
}
|
||||
|
||||
static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
const GameState* game_state = acquire_mutex((ValueMutex*)ctx, 25);
|
||||
|
||||
if(game_state == NULL) {
|
||||
return;
|
||||
}
|
||||
furi_assert(ctx);
|
||||
const GameState* game_state = ctx;
|
||||
furi_mutex_acquire(game_state->mutex, FuriWaitForever);
|
||||
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_frame(canvas, 0, 0, 128, 64);
|
||||
@@ -60,7 +58,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
settings_page(canvas, game_state);
|
||||
}
|
||||
|
||||
release_mutex((ValueMutex*)ctx, game_state);
|
||||
furi_mutex_release(game_state->mutex);
|
||||
}
|
||||
|
||||
//region card draw
|
||||
@@ -553,21 +551,21 @@ int32_t blackjack_app(void* p) {
|
||||
|
||||
game_state->state = GameStateStart;
|
||||
|
||||
ValueMutex state_mutex;
|
||||
if(!init_mutex(&state_mutex, game_state, sizeof(GameState))) {
|
||||
game_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
if(!game_state->mutex) {
|
||||
FURI_LOG_E(APP_NAME, "cannot create mutex\r\n");
|
||||
return_code = 255;
|
||||
goto free_and_exit;
|
||||
}
|
||||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
view_port_draw_callback_set(view_port, render_callback, &state_mutex);
|
||||
view_port_draw_callback_set(view_port, render_callback, game_state);
|
||||
view_port_input_callback_set(view_port, input_callback, event_queue);
|
||||
|
||||
FuriTimer* timer = furi_timer_alloc(update_timer_callback, FuriTimerTypePeriodic, event_queue);
|
||||
furi_timer_start(timer, furi_kernel_get_tick_frequency() / 25);
|
||||
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
AppEvent event;
|
||||
@@ -577,47 +575,44 @@ int32_t blackjack_app(void* p) {
|
||||
|
||||
for(bool processing = true; processing;) {
|
||||
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
|
||||
GameState* localstate = (GameState*)acquire_mutex_block(&state_mutex);
|
||||
furi_mutex_acquire(game_state->mutex, FuriWaitForever);
|
||||
if(event_status == FuriStatusOk) {
|
||||
if(event.type == EventTypeKey) {
|
||||
if(event.input.type == InputTypePress) {
|
||||
switch(event.input.key) {
|
||||
case InputKeyUp:
|
||||
localstate->selectDirection = DirectionUp;
|
||||
game_state->selectDirection = DirectionUp;
|
||||
break;
|
||||
case InputKeyDown:
|
||||
localstate->selectDirection = DirectionDown;
|
||||
game_state->selectDirection = DirectionDown;
|
||||
break;
|
||||
case InputKeyRight:
|
||||
localstate->selectDirection = DirectionRight;
|
||||
game_state->selectDirection = DirectionRight;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
localstate->selectDirection = DirectionLeft;
|
||||
game_state->selectDirection = DirectionLeft;
|
||||
break;
|
||||
case InputKeyBack:
|
||||
if(localstate->state == GameStateSettings) {
|
||||
localstate->state = GameStateStart;
|
||||
save_settings(localstate->settings);
|
||||
if(game_state->state == GameStateSettings) {
|
||||
game_state->state = GameStateStart;
|
||||
save_settings(game_state->settings);
|
||||
} else
|
||||
processing = false;
|
||||
break;
|
||||
case InputKeyOk:
|
||||
localstate->selectDirection = Select;
|
||||
game_state->selectDirection = Select;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(event.type == EventTypeTick) {
|
||||
tick(localstate);
|
||||
processing = localstate->processing;
|
||||
tick(game_state);
|
||||
processing = game_state->processing;
|
||||
}
|
||||
} else {
|
||||
//FURI_LOG_D(APP_NAME, "osMessageQueue: event timeout");
|
||||
// event timeout
|
||||
}
|
||||
view_port_update(view_port);
|
||||
release_mutex(&state_mutex, localstate);
|
||||
furi_mutex_release(game_state->mutex);
|
||||
}
|
||||
|
||||
furi_timer_free(timer);
|
||||
@@ -625,7 +620,7 @@ int32_t blackjack_app(void* p) {
|
||||
gui_remove_view_port(gui, view_port);
|
||||
furi_record_close(RECORD_GUI);
|
||||
view_port_free(view_port);
|
||||
delete_mutex(&state_mutex);
|
||||
furi_mutex_free(game_state->mutex);
|
||||
|
||||
free_and_exit:
|
||||
free(game_state->deck.cards);
|
||||
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
@@ -173,7 +173,7 @@ uint8_t hand_count(const Card* cards, uint8_t count) {
|
||||
}
|
||||
|
||||
for(uint8_t i = 0; i < aceCount; i++) {
|
||||
if((score + 11) <= 21)
|
||||
if((score + 11 + (aceCount - 1)) <= 21)
|
||||
score += 11;
|
||||
else
|
||||
score++;
|
||||
@@ -350,4 +350,4 @@ void add_hand_region(Hand* to, Hand* from) {
|
||||
add_to_hand(to, from->cards[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ typedef enum {
|
||||
} Direction;
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* mutex;
|
||||
Card player_cards[21];
|
||||
Card dealer_cards[21];
|
||||
uint8_t player_card_count;
|
||||
@@ -1,7 +1,7 @@
|
||||
App(
|
||||
appid="dap_link",
|
||||
name="DAP Link",
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
entry_point="dap_link_app",
|
||||
requires=[
|
||||
"gui",
|
||||
@@ -10,7 +10,7 @@ App(
|
||||
stack_size=4 * 1024,
|
||||
order=20,
|
||||
fap_icon="dap_link.png",
|
||||
fap_category="Tools",
|
||||
fap_category="GPIO",
|
||||
fap_private_libs=[
|
||||
Lib(
|
||||
name="free-dap",
|
||||
|
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |