Small bump in the road

- Update assets and references for new project
- Revert DFU image and CLI motd
- Remove NSFW text and flag
- Remove credits animation (will be replaced with a setting menu soon)
- New EvilPortal example HTML and better error message
- Initial standalone naming for asset packs and mainmenu apps
- File migration fixes/improvements
- Remove hotfix workflow
This commit is contained in:
Willy-JL
2024-02-28 01:22:45 +00:00
parent fed49ad256
commit b7220237de
167 changed files with 1795 additions and 2096 deletions

16
.github/CODEOWNERS vendored
View File

@@ -1,15 +1 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# More details are here: https://help.github.com/articles/about-codeowners/
# The '*' pattern is global owners.
# Order is important. The last matching pattern has the most precedence.
# The folders are ordered as follows:
# In each subsection folders are ordered first by depth, then alphabetically.
# This should make it easy to add new rules without breaking existing ones.
# Global rule:
* @ClaraCrazy
* @Willy-JL @Sil333033

15
.github/FUNDING.yml vendored
View File

@@ -1,13 +1,2 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: crazyco
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
ko_fi: willyjl
custom: ["https://bunq.me/WillyJL", "https://paypal.me/willyjl1"]

BIN
.github/assets/badkb.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
.github/assets/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
.github/assets/packs-done.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
.github/assets/packs-folder.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
.github/assets/packs-select.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
.github/assets/settings.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -5,26 +5,21 @@ import requests
import json
import os
dev_share = os.environ["NC_HOST"] + "s/sGHsQB94a9x5CRs/download?path=/&files={files}"
dev_share_id = ""
dev_share = os.environ["NC_HOST"] + f"s/{dev_share_id}/download?path=/&files={{files}}"
if __name__ == "__main__":
with open(os.environ["GITHUB_EVENT_PATH"], "r") as f:
event = json.load(f)
client = nextcloud_client.Client(os.environ["NC_HOST"])
_session = requests.session
def session(*args, **kwargs):
s = _session(*args, **kwargs)
s.headers["User-Agent"] = os.environ["NC_USERAGENT"]
return s
requests.session = session
client.login(os.environ["NC_USER"], os.environ["NC_PASS"])
for file in (
os.environ["ARTIFACT_TGZ"],
os.environ["ARTIFACT_SDK"],
):
path = f"XFW-Dev/{file}"
path = f"MNTM-Dev/{file}"
# try:
# client.delete(path)
# except Exception:
@@ -38,7 +33,7 @@ if __name__ == "__main__":
"content": None,
"embeds": [
{
"title": "Devbuild infos:",
"title": "New Devbuild:",
"description": "",
"url": "",
"color": 16734443,
@@ -58,12 +53,12 @@ if __name__ == "__main__":
],
"author": {
"name": "Build Succeeded!",
"icon_url": "https://cdn.discordapp.com/emojis/1080005692485795930.png"
},
"footer": {
"text": "Build go brrrr",
"icon_url": "https://cdn.discordapp.com/emojis/1059798228725403719.png"
# "icon_url": ""
},
# "footer": {
# "text": "Build go brrrr",
# "icon_url": ""
# },
"timestamp": dt.datetime.utcnow().isoformat()
}
],

View File

@@ -1,88 +0,0 @@
#!/usr/bin/env python
import datetime as dt
import requests
import pathlib
import json
import sys
import os
import re
if __name__ == "__main__":
with open(os.environ["GITHUB_EVENT_PATH"], "r") as f:
event = json.load(f)
release = requests.get(
event["repository"]["releases_url"].rsplit("{/")[0] + "/latest",
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
}
).json()
artifacts = {
os.environ['ARTIFACT_TGZ']: "application/gzip",
os.environ['ARTIFACT_ZIP']: "application/zip",
os.environ['ARTIFACT_SDK']: "application/zip",
}
for asset in release["assets"]:
req = requests.delete(
asset["url"],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
}
)
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)
for artifact, mediatype in artifacts.items():
req = requests.post(
release["upload_url"].rsplit("{?", 1)[0],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}",
"Content-Type": mediatype
},
params={
"name": artifact
},
data=pathlib.Path(artifact).read_bytes()
)
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)
hotfix_time = dt.datetime.now().strftime(r"%d-%m-%Y %H:%M")
hotfix_desc = event['pull_request']['body']
hotfix = f"- `{hotfix_time}`: {hotfix_desc}\n"
body = release["body"]
body = re.sub(
r"(https://github\.com/Flipper-XFW/Xtreme-Firmware/releases/download/[A-Za-z0-9_-]+?/)[A-Za-z0-9_-]+",
r"\1" + os.environ['VERSION_TAG'],
body
)
body = body.replace("<!--- <HOTFIXES>\n", "")
body = body.replace("\n<HOTFIXES> -->", "")
insert = body.find("\n [//]: <NEXT_HOTFIX>\n")
body = body[:insert] + hotfix + body[insert:]
req = requests.patch(
release["url"],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
},
json={
"body": body
}
)
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)
changelog = body.split("## 🚀 Changelog", 1)[1]
with open(os.environ["ARTIFACT_TGZ"].removesuffix(".tgz") + ".md", "w") as f:
f.write(changelog.strip() + "\n\n")

View File

@@ -1,30 +1,32 @@
## ⬇️ Download
>### [🖥️ Web Updater (chrome)](https://flipper-xtre.me/update) [recommended]
>### [🖥️ Web Updater (chrome)](https://momentum-fw.dev/update) [recommended]
>### [🐬 qFlipper Package (.tgz)](https://github.com/Flipper-XFW/Xtreme-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_TGZ})
>### [🐬 qFlipper Package (.tgz)](https://github.com/Next-Flip/Momentum-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_TGZ})
>### [📦 Zipped Archive (.zip)](https://github.com/Flipper-XFW/Xtreme-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_ZIP})
>### [📦 Zipped Archive (.zip)](https://github.com/Next-Flip/Momentum-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_ZIP})
**Check the [install guide](https://github.com/Flipper-XFW/Xtreme-Firmware#install) if you're not sure, or [join our Discord](https://discord.gg/flipper-xtreme) if you have questions or encounter issues!**
**Check the [install guide](https://github.com/Next-Flip/Momentum-Firmware#install) if you're not sure, or [join our Discord](https://discord.gg/momentum) if you have questions or encounter issues!**
## ❤️ Support
If you like what you're seeing, **please consider donating to us**. We won't ever put this behind a paywall, but we'd still appreciate a few bucks!
If you enjoy the firmware, please consider donating to the team, or sharing it with others! :D
- **[Patreon](https://patreon.com/CynthiaLabs)**: ❤️ Account needed, subscription with perks across my entire org.
- **[Wire-transfer](https://bunq.me/ClaraK)**: No account needed, one-time
- **[Paypal](https://paypal.me/RdX2020)**: Account needed, one-time
- **[ko-fi](https://ko-fi.com/cynthialabs)**: No account needed, one-time
- **Monero**: `41kyWeeoVdK4quzQ4M9ikVGs6tCQCLfdx8jLExTNsAu2SF1QAyDqRdjfGM6EL8L9NpXwt89HJeAoGf1aoArk7nDr4AMMV4T`
> **[Ko-fi](https://ko-fi.com/willyjl)**: One-off or Recurring, No signup required
**Thanks for all your support <3**
> **[Bank transfer](https://bunq.me/WillyJL)**: One-off, No signup required
> **[PayPal](https://paypal.me/willyjl1)**: One-off, Signup required
> **BCH**: `1EnCi1HF8Jw6m2dWSUwHLbCRbVBCQSyDKm`
> **ETH**: `0x90b8284c3eba44108427e3148ff8efa0ae7a61a8`
> **BTC**: `1EnCi1HF8Jw6m2dWSUwHLbCRbVBCQSyDKm`
> **SHIB**: `0x90b8284c3eba44108427e3148ff8efa0ae7a61a8`
> **DOGE**: `DNUdUqtmWaAiJ6yoV6hRNEh6Nn1Tg4Aorr`
**Thank you <3**
## 🚀 Changelog
{CHANGELOG}
<!--- <HOTFIXES>
### Hotfixes:
[//]: <NEXT_HOTFIX>
**If you have any of the above issues, please re-download and re-install!**
<HOTFIXES> -->

View File

@@ -6,8 +6,8 @@ import json
import os
with open(os.environ["GITHUB_EVENT_PATH"], "r") as f:
event = json.load(f)
version = int(event["pull_request"]["title"].removeprefix("V").removesuffix(" Release").removesuffix(" Hotfix"))
version = int(event["pull_request"]["title"].removeprefix("V").removesuffix(" Release")
date = dt.datetime.now().strftime("%d%m%Y")
print(f"XFW-{version:04}_{date}", end="")
print(f"MNTM-{version:03}_{date}", end="")
''')"
echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV

View File

@@ -5,16 +5,10 @@ import os
if __name__ == "__main__":
client = nextcloud_client.Client(os.environ["NC_HOST"])
_session = requests.session
def session(*args, **kwargs):
s = _session(*args, **kwargs)
s.headers["User-Agent"] = os.environ["NC_USERAGENT"]
return s
requests.session = session
client.login(os.environ["NC_USER"], os.environ["NC_PASS"])
file = os.environ["ARTIFACT_TGZ"]
path = f"XFW-Updater/{file}"
path = f"MNTM-Release/{file}"
try:
client.delete(path)
except Exception:
@@ -34,7 +28,7 @@ if __name__ == "__main__":
os.environ['ARTIFACT_TGZ'],
os.environ['ARTIFACT_TGZ'].removesuffix(".tgz") + ".md"
)
for file in client.list("XFW-Updater"):
for file in client.list("MNTM-Release"):
if file.name.startswith(version) and file.name not in files:
try:
client.delete(file.path)

View File

@@ -1,73 +0,0 @@
name: "Hotfix"
on:
pull_request_review:
types: [submitted]
env:
TARGETS: f7
DEFAULT_TARGET: f7
jobs:
hotfix:
if: |
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name &&
endsWith(github.event.pull_request.title, ' Hotfix') &&
github.event.review.author_association == 'OWNER' &&
startsWith(github.event.pull_request.title, 'V') &&
github.event.pull_request.base.ref == 'main' &&
github.event.pull_request.head.ref == 'dev' &&
github.event.pull_request.state == 'open' &&
github.event.pull_request.draft == false &&
github.event.review.state == 'APPROVED'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Checkout code'
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: "Read version tag"
run: bash .github/workflow_data/version.sh
- name: 'Build the firmware'
run: |
set -e
for TARGET in ${TARGETS}; do
TARGET_HW="$(echo "${TARGET}" | sed 's/f//')"; \
./fbt TARGET_HW=$TARGET_HW DIST_SUFFIX=$VERSION_TAG updater_package
done
- name: "Check for uncommitted changes"
run: |
git diff --exit-code
- name: "Make tgz, zip and sdk"
run: bash .github/workflow_data/package.sh
- name: "Upload hotfix"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
python -m pip install requests
python .github/workflow_data/hotfix.py
- name: "Upload to webupdater"
env:
NC_HOST: "https://cloud.cynthialabs.net/"
NC_USERAGENT: "${{ secrets.NC_USERAGENT }}"
NC_USER: "${{ secrets.NC_USER }}"
NC_PASS: "${{ secrets.NC_PASS }}"
run: |
python -m pip install pyncclient
python .github/workflow_data/webupdater.py
- name: "Merge pull request"
uses: "pascalgn/automerge-action@v0.15.6"
env:
MERGE_LABELS: ""
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -13,7 +13,6 @@ on:
workflow_run:
workflows:
- "Build"
- "Hotfix"
- "Lint"
- "Release"
- "SonarCloud"

2
.gitmodules vendored
View File

@@ -1,6 +1,6 @@
[submodule "applications/external"]
path = applications/external
url = https://github.com/Flipper-XFW/Xtreme-Apps.git
url = https://github.com/Next-Flip/Momentum-Apps.git
[submodule "lib/mlib"]
path = lib/mlib
url = https://github.com/P-p-H-d/mlib.git

142
ReadMe.md
View File

@@ -1,81 +1,68 @@
<h1 align="center">XFW - <code>Xtreme Firmware</code> for the Flipper Zero</h1>
<p align="center">
<img src="https://github.com/Flipper-XFW/Xtreme-Firmware/assets/55334727/767a3e1b-a96c-43c8-b58f-a49a533b3bb4">
<img src=".github/assets/logo.png" alt="Momentum Firmware">
<h2 align="center">for Flipper Zero</h2>
</p>
<h2 align="center">
<a href="https://flipper-xtre.me">Website</a> | <a href="https://github.com/Flipper-XFW/Xtreme-Firmware#What-makes-it-special">Intro</a> | <a href="https://github.com/Flipper-XFW/Xtreme-Firmware#Install">Install</a> | <a href="https://github.com/Flipper-XFW/Xtreme-Firmware#list-of-changes">Changelog</a> | <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/wiki">Wiki</a> | <a href="https://discord.gg/flipper-xtreme">Discord</a> | <a href="https://github.com/Flipper-XFW/Xtreme-Firmware#%EF%B8%8F-support">Donate</a>
<a href="#Install">Install</a> | <a href="#list-of-changes">Features</a> | <a href="https://discord.gg/momentum">Discord</a> | <a href="#%EF%B8%8F-support">Donate</a>
</h2>
This firmware is an extensive overhaul of the [Official Firmware](https://github.com/flipperdevices/flipperzero-firmware), and also features most of the awesome code-bits from [Unleashed](https://github.com/DarkFlippers/unleashed-firmware).
This custom firmware is based on the [Official Firmware](https://github.com/flipperdevices/flipperzero-firmware), and features most of the awesome features from [Unleashed](https://github.com/DarkFlippers/unleashed-firmware). It is a direct continuation of the Xtreme firmware, built by the same (and only) developers who made that project special, until being unfairly thrown out.
-----
<br>
<h2 align="center">What makes it special?</h2>
<h2 align="center">Modus Operandi:</h2>
We have spent many hours perfecting this code even further, and getting the most out of it.
The goal of this Firmware is to regularly bring out amazing updates based on what the community wants, with an actual understanding of whats going on. Fixing bugs that are regularly talked about, broadening the capabilities of the Flipper with new exciting functionality, and most importantly, ensuring the easiest user experience possible.
The goal of this firmware is to constantly push the bounds of what is possible with Flipper Zero, driving the innovation of many new groundbreaking features, while maintaining the easiest and most customizable user experience of any firmware. Fixing bugs promptly and ensuring a stable and compatible system is also of our utmost importance.
<br><br>
- <h4>Feature-rich: We include all commonly found apps in the firmware, as long as they work.</h4>
- <h4>Feature-rich: We include all third-party features and apps as long as they fulfill a useful purpose and they work correctly, aswell as implement ourselves many new exciting functionalities.</h4>
- <h4>Stable: Many hours have been spent rewriting core parts of the Flipper's firmware as well as some of its apps to ensure stability. A task that was long needed on all Firmware, so we tackled it right away.</h4>
- <h4>Stable: We ensure the most stable experience possible by having an actual understanding of what's going on, and proactively making all tweaks and additions backwards-, and inter-, compatible.</h4>
- <h4>Customizable: Dont like the Animations, want to turn on/off the Home screen icons (battery, SD card etc), change the flippers name or anything like that? You absolutely can. No need to mess with code or deal with weird manifest files. Its all done with an App.</h4>
- <h4>Customizable: You can tweak just about everything you see: add/remove apps from the menu, change the animations, replace icon graphics, change your Flipper's name, change how the main menu looks, setup different keybinds like never before, and so much more. All on-device, with no complicated configuration.</h4>
<br><br>
Note, the below mentioned changes are only a few things we did. For a full list check [down here](https://github.com/Flipper-XFW/Xtreme-Firmware#List-of-Changes)
Note that mentioned below are only a few of our staple additions to the firmware. For a full list check [down here](https://github.com/Next-Flip/Momentum-Firmware#List-of-Changes).
-----
<br>
<h2 align="center">Xtreme Settings:</h2>
<h2 align="center">Momentum Settings:</h2>
We wrote a powerful yet easy-to-use application specifically for our Firmware, that gives you easy-access to most of the fancy things we implemented:
We offer a powerful and easy-to-use application tailor-made for our firmware, that lets you configure everything you could dream of, and more:
<!--
This image needs to be updated!
Also, perhaps a bigger height, with set width (yes distrotion issues ik) so it fits all our bulletpoints without issues
-->
<img src="https://user-images.githubusercontent.com/49810075/228392945-1e68b996-4e2c-46c6-8aae-d0aadd8ea001.gif" align="left" height="160vh"/>
<img src=".github/assets/settings.png" align="left" height="160vh"/>
<img align="left" height="180vh" width="10" src="https://upload.wikimedia.org/wikipedia/commons/3/3d/1_120_transparent.png">
- <ins><b>Interface:</b></ins> Customize every bit of your Flipper, from the desktop animations, to the main menu apps, lockscreen style etc.
- <ins><b>Interface:</b></ins> Tweak every part of your Flipper, from the desktop animations, to the main menu, lockscreen behavior, file browser, etc.
- <ins><b>Protocols:</b></ins> Here you can configure <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/wiki/Generic-Guides#badbt--kb">BadKB</a>, manage custom Subghz frequencies, and setup the GPIO pins mappings.
- <ins><b>Protocols:</b></ins> Configure SubGhz settings, add/remove custom frequencies, and setup which GPIO pins are used by different external modules.
- <ins><b>Misc:</b></ins> All the other options that don't fit elsewhere. Change your Flipper's name, xp level, and configure the <a href="https://github.com/Z3BRO/Flipper-Zero-RGB-Backlight">RGB backlight</a>.
- <ins><b>Misc:</b></ins> Everything else that doesn't fit the previous categories. Change your Flipper's name, XP level, screen options, and configure the <a href="https://github.com/Z3BRO/Flipper-Zero-RGB-Backlight">RGB backlight</a>.
<br>
-----
<br>
<h2 align="center">Animations / Asset Packs:
<h3 align="center">Want to try some asset packs? Check <a href="https://flipper-xtre.me/asset-packs">here</a>
</h3>
</h2>
<h2 align="center">Animations / Asset Packs:</h2>
We created our own improved Animation / Asset system that lets you create and cycle through your own `Asset Packs` with only a few button presses, allowing you to easily load custom Animations, Icons and Fonts like never before.
We created our own improved Animation / Asset system that lets you create and cycle through your own `Asset Packs` with only a few button presses, allowing you to easily load custom Animations, Icons and Fonts like never before. Think of it as a Theme system that's never been easier.
<img src="https://github.com/Flipper-XFW/Xtreme-Firmware/assets/49810075/7c040ca1-3d59-478e-8a35-21abe5c26ab1" align="left" width="200px"/>
You can easily create your own pack, or find some user made ones on our website or on discord. Check <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/wiki/Asset-Packs">here</a> for a tutorial on creating your own. Essentially, each <code>Asset Pack</code> can configure its own <code>Anims</code>, <code>Icons</code> & <code>Fonts</code>.
<img src=".github/assets/packs-folder.png" align="left" width="200px"/>
You can easily create your own pack, or find some community-made ones on <b><a href="https://momentum-fw.dev/asset-packs">our website</a> or on Discord</b>. Check <a href="https://github.com/Next-Flip/Momentum-Firmware/blob/dev/documentation/file_formats/AssetPacks.md">here</a> for a tutorial on creating your own. Essentially, each <code>Asset Pack</code> can configure its own <code>Anims</code>, <code>Icons</code> & <code>Fonts</code>.
<br clear="left"/>
<br>
<img src="https://github.com/Flipper-XFW/Xtreme-Firmware/assets/49810075/dbeed26b-45be-4cb4-983e-69d6d7ef5850" align="left" width="200px"/>
Once you have some packs, upload them to your Flipper in <code>SD/asset_packs</code> (if you did this right you should see <code>SD/asset_packs/PackName/Anims</code> and/or <code>SD/asset_packs/PackName/Icons</code>).
<img src=".github/assets/packs-select.png" align="left" width="200px"/>
Once you have some asset packs, upload them to your Flipper in <code>SD/asset_packs</code> (if you did this right you should see <code>SD/asset_packs/PackName/Anims</code> and/or <code>SD/asset_packs/PackName/Icons</code>). Alternatively, install directly using the website.
<br clear="left"/>
<br>
<img src="https://user-images.githubusercontent.com/55334727/214013624-25dad48e-72ea-4a90-9060-66e137e0d61a.png" align="left" width="200px"/>
After installing the packs to Flipper, hit the <code>Arrow UP</code> button on the main menu and go to <code>Xtreme Settings</code>. Here choose which pack you want and tweak the other settings how you prefer, then press back to reboot and enjoy your newly fully customized Flipper!
<img src=".github/assets/packs-done.png" align="left" width="200px"/>
After installing the packs to Flipper, hit the <code>Arrow Up</code> button on the main menu and go to <code>Momentum Settings > Interface > Graphics</code>. Here choose which asset pack you want and tweak the other settings how you prefer, then exit the app to reboot and enjoy your fully customized Flipper!
<br clear="left"/>
@@ -83,45 +70,41 @@ After installing the packs to Flipper, hit the <code>Arrow UP</code> button on t
<br>
<h2 align="center">Bad Keyboard:</h2>
<img src="https://user-images.githubusercontent.com/49810075/223855940-b8ee6770-4520-4bcc-a4cc-089196cf904b.png" align="left" width="250px"/>
<! -- This fuckshit needs a captured image, but bc of blockage, i cant get one. someone do some magic plz -- !>
BadUSB is a wonderful app, but it lacks bluetooth capabilities. Now some might argue that its useless as you will always need authentication from both sides, but what if I told you that we found a solution to this problem?
<br><br>
Bad-KB allows you to toggle between USB and Bluetooth mode for your attacks. In Bluetooth mode it allows you to spoof the name & MAC of the device to whatever you want. Being a JBL speaker or a wireless razer keyboard is easily doable, allowing you to trick people so you can run your payloads without needing a cable at hand.
<img src=".github/assets/badkb.png" align="left" width="250px"/>
BadUSB is a great app, but it lacks Bluetooth connectivity. Bad-KB allows you to toggle between USB and Bluetooth mode for your attacks.
-----
<br>
<h2 align="center">Levels:</h2>
In Bluetooth mode it allows you to spoof the display name and MAC address of the device to whatever you want. Showing up as a portable speaker or a wireless keyboard is easily doable, allowing you to get the attention of your target without needing a cable at hand.
This Firmware has 30 levels, not just the basic 3 the official one has.
With this new system in place, it allows for some cool stuff like locking animations behind a certain level. This can be done fairly easy: The idle_animations are tied to the level system. Specifically, the `Min level` variable of your manifest file is used here. Each level you reach, unlocks a new animation. The higher your level, the more animations people can see.
In USB mode it also enables additional functionality to spoof the manufacturer and product names, as well as vendor and product IDs (VID/PID).
-----
<br>
<h2 align="center">List of changes:</h2>
There are too many to name them all, this is a **non-comprehensive** list of the **most notable from an end-user perspective**. For a more detailed list, read through the [**changelogs**](https://github.com/Flipper-XFW/Xtreme-Firmware/releases) and commits/code. Also, you can find a **feature comparison with other firmwares** on [our website](https://flipper-xtre.me/#features).
There are too many to name them all, this is a **non-comprehensive** list of the **most notable from an end-user perspective**. For a more detailed list, you can read through the [**changelogs**](https://github.com/Next-Flip/Momentum-Firmware/releases) and commits/code. Also, you can find a **feature comparison with other firmwares** on [our website](https://momentum-fw.dev/#features).
Note that this repo is always updated with the great work from our friends at [Unleashed](https://github.com/DarkFlippers/unleashed-firmware) and the latest changes from [OFW](https://github.com/flipperdevices/flipperzero-firmware). Below are mentioned only **our** changes that we can actually be credited for, so make sure to check their fantastic additions aswell. And a huge thank you to both teams!
```txt
[Added]
- Xtreme App (Easy configuration of most features exclusive to Xtreme)
- Momentum App (Easy configuration of features and behavior of the firmware)
- Asset Packs (Unparalleled theming and customization)
- More UI customization, redesigns and optimizations
- Bad-Keyboard App
- BLE Spam App
- NFC Maker App
- Wardriver App
- File Search across SD Card
- Easy spoofing (Name, Mac, Serial)
- Additional NFC parsers and protocols
- Subdriving (saving GPS coordinates for Sub-GHz)
- Easy spoofing (Name, MAC address, Serial number)
- Enhanced RGB Backlight modes (Full customization & Rainbow mode)
- File management on device (Cut, Copy, Paste, Show, New Dir, etc.)
- Remember Infrared GPIO settings and add IR Blaster support in apps
- Advanced Security measures (Lock on Boot, reset on false pins, etc.)
- Remember Infrared GPIO and IR Blaster auto-detection + support in apps
- Disk Image management (Mount and view image contents, open in Mass Storage)
- Extended JavaScript API (Support for UsbDisk/Mass Storage, File operations)
```
```txt
[Updated]
@@ -129,12 +112,12 @@ Note that this repo is always updated with the great work from our friends at [U
- Enhanced WiFi support for easiest setup ever
- Extended keyboard with cursor movevent and symbols
- File Browser with Sorting, More supported File Types
- Advanced and optimized Level System (Read more above)
- Storage backend with instant rename and more optimizations
- Advanced and optimized Level System (Up to 30 levels)
- Desktop Keybind system for full key and press/hold remapping
- Storage backend with instant rename and virtual mounting for disk images
- Weather Station, POCSAG, TPMS protocols and more integrated into Sub-GHz
- Expanded Sub-GHz App (Duplicate detection & Ignore, Autosave, History improvements)
- Improved Error Messages (Showing actual root)
- Improved Error Messages (Showing source file paths)
```
```txt
[Removed]
@@ -148,26 +131,27 @@ Note that this repo is always updated with the great work from our friends at [U
<h2 align="center">Install:</h2>
<br>
There are 3 methods to install Xtreme, we recommend you use the **Web Updater**, but choose whichever one you prefer:
There are 3 methods to install Momentum, we recommend you use the **Web Updater**, but choose whichever one you prefer:
<br>
> <details><summary><code>Web Updater (Chrome)</code></summary><ul>
> <li>Open the <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/releases/latest">latest release page</a> and click on the <code>Web Updater</code> link</li>
> <li>Make sure qFlipper is closed</li>
> <li>Open the <a href="https://momentum-fw.dev/update">Web Updater</a></li>
> <li>Click <code>Connect</code> and select your Flipper from the list</li>
> <li>Click <code>Flash</code> and wait for the update to complete</li>
> </ul></details>
> <details><summary><code>qFlipper Package (.tgz)</code></summary><ul>
> <li>Download the qFlipper package (.tgz) from the <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/releases/latest">latest release page</a></li>
> <li>Download the qFlipper package (.tgz) from the <a href="https://github.com/Next-Flip/Momentum-Firmware/releases/latest">latest release page</a></li>
> <li>Make sure the <code>WebUpdater</code> and <code>lab.flipper.net</code> are closed</li>
> <li>Open <a href="https://flipperzero.one/update">qFlipper</a> and connect your Flipper</li>
> <li>Click <code>Install from file</code></li>
> <li>Select the .tgz you downloaded and wait for the update to complete</li>
> </ul></details>
> <details><summary><code>Zipped Archive (.zip)</code></summary><ul>
> <li>Download the zipped archive (.zip) from the <a href="https://github.com/Flipper-XFW/Xtreme-Firmware/releases/latest">latest release page</a></li>
> <li>Download the zipped archive (.zip) from the <a href="https://github.com/Next-Flip/Momentum-Firmware/releases/latest">latest release page</a></li>
> <li>Extract the archive. This is now your new Firmware folder</li>
> <li>Open <a href="https://flipperzero.one/update">qFlipper</a>, head to <code>SD/update</code> and simply move the firmware folder there</li>
> <li>On the Flipper, hit the <code>Arrow Down</code> button, this will get you to the file menu. In there simply search for your updates folder</li>
@@ -180,13 +164,10 @@ There are 3 methods to install Xtreme, we recommend you use the **Web Updater**,
<br>
<h2 align="center">Build it yourself:</h2>
> **Warning**
> We will not give basic support for compiling in our server. This is intended for people that already *know* what they are doing!
```bash
To download the needed tools:
$ git clone --recursive --jobs 8 https://github.com/Flipper-XFW/Xtreme-Firmware.git
$ cd Xtreme-Firmware/
To download the repository:
$ git clone --recursive --jobs 8 https://github.com/Next-Flip/Momentum-Firmware.git
$ cd Momentum-Firmware/
To flash directly to the Flipper (Needs to be connected via USB, qFlipper closed)
$ ./fbt flash_usb_full
@@ -201,25 +182,32 @@ $ ./fbt launch APPSRC=your_appid
----
<h2 align="center">Stargazers over time</h2>
[![Stargazers over time](https://starchart.cc/Flipper-XFW/Xtreme-Firmware.svg)](https://starchart.cc/Flipper-XFW/Xtreme-Firmware)
[![Stargazers over time](https://starchart.cc/Next-Flip/Momentum-Firmware.svg)](https://starchart.cc/Next-Flip/Momentum-Firmware)
----
<!-- ----
<h2 align="center">Contributors</h2>
[![Contributors](https://github.com/Flipper-XFW/Xtreme-Firmware/assets/49810075/b6653d57-5e70-4398-af31-3f3dc7065bff)](https://github.com/Flipper-XFW/Xtreme-Firmware/graphs/contributors)
[![Contributors]()](https://github.com/Next-Flip/Momentum-Firmware/graphs/contributors) -->
## ❤️ Support
If you like what you're seeing, **please consider donating to us**. We won't ever put this behind a paywall, but we'd still appreciate a few bucks!
If you enjoy the firmware, please consider donating to the team, or sharing it with others! :D
- **[Patreon](https://patreon.com/crazyco)**: ❤️ Account needed, subscription with perks across my entire org.
- **[Wire-transfer](https://bunq.me/ClaraK)**: No account needed, one-time
- **[Paypal](https://paypal.me/ClaraCrazy)**: Account needed, one-time
- **[ko-fi](https://ko-fi.com/cynthialabs)**: No account needed, one-time
- **Monero**: `41kyWeeoVdK4quzQ4M9ikVGs6tCQCLfdx8jLExTNsAu2SF1QAyDqRdjfGM6EL8L9NpXwt89HJeAoGf1aoArk7nDr4AMMV4T`
> **[Ko-fi](https://ko-fi.com/willyjl)**: One-off or Recurring, No signup required
**Thanks for all your support <3**
> **[Bank transfer](https://bunq.me/WillyJL)**: One-off, No signup required
----
<p align="center"> "What we do for ourselves dies with us. What we do for others and the world remains and is immortal.” ― Albert Pine </p>
> **[PayPal](https://paypal.me/willyjl1)**: One-off, Signup required
> **BCH**: `1EnCi1HF8Jw6m2dWSUwHLbCRbVBCQSyDKm`
> **ETH**: `0x90b8284c3eba44108427e3148ff8efa0ae7a61a8`
> **BTC**: `1EnCi1HF8Jw6m2dWSUwHLbCRbVBCQSyDKm`
> **SHIB**: `0x90b8284c3eba44108427e3148ff8efa0ae7a61a8`
> **DOGE**: `DNUdUqtmWaAiJ6yoV6hRNEh6Nn1Tg4Aorr`
**Thank you <3**

View File

@@ -225,15 +225,15 @@ bool subghz_device_cc1101_ext_alloc(SubGhzDeviceConf* conf) {
subghz_device_cc1101_ext->async_rx.capture_delta_duration = 0;
subghz_device_cc1101_ext->spi_bus_handle =
(xtreme_settings.spi_cc1101_handle == SpiDefault ?
(momentum_settings.spi_cc1101_handle == SpiDefault ?
&furi_hal_spi_bus_handle_external :
&furi_hal_spi_bus_handle_external_extra);
// this is needed if multiple SPI devices are connected to the same bus but with different CS pins
if(xtreme_settings.spi_cc1101_handle == SpiDefault && !furi_hal_subghz_get_ext_power_amp()) {
if(momentum_settings.spi_cc1101_handle == SpiDefault && !furi_hal_subghz_get_ext_power_amp()) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pc3, true);
} else if(xtreme_settings.spi_cc1101_handle == SpiExtra) {
} else if(momentum_settings.spi_cc1101_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
furi_hal_gpio_write(&gpio_ext_pa4, true);
}
@@ -254,9 +254,9 @@ void subghz_device_cc1101_ext_free() {
furi_hal_spi_bus_handle_deinit(subghz_device_cc1101_ext->spi_bus_handle);
// resetting the CS pins to floating
if(xtreme_settings.spi_nrf24_handle == SpiDefault || subghz_device_cc1101_ext->power_amp) {
if(momentum_settings.spi_nrf24_handle == SpiDefault || subghz_device_cc1101_ext->power_amp) {
furi_hal_gpio_init_simple(&gpio_ext_pc3, GpioModeAnalog);
} else if(xtreme_settings.spi_nrf24_handle == SpiExtra) {
} else if(momentum_settings.spi_nrf24_handle == SpiExtra) {
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog);
}

View File

@@ -11,7 +11,7 @@
#include <stddef.h>
#include <toolbox/level_duration.h>
#include <furi_hal_gpio.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#ifdef __cplusplus
extern "C" {

View File

@@ -11,7 +11,7 @@ App(
"subghz",
"bad_kb",
"u2f",
"xtreme_app",
"momentum_app",
"archive",
"main_apps_on_start",
],

View File

@@ -553,7 +553,7 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
} else {
tab = (tab + 1) % ArchiveTabTotal;
}
if(tab == ArchiveTabInternal && !xtreme_settings.show_internal_tab) continue;
if(tab == ArchiveTabInternal && !momentum_settings.show_internal_tab) continue;
break;
}
@@ -587,7 +587,7 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) {
// Hide dot files everywhere except Browser if in debug mode
bool hide_dot_files = !is_browser ? true :
tab == ArchiveTabInternal ? false :
!xtreme_settings.show_hidden_files;
!momentum_settings.show_hidden_files;
archive_file_browser_set_path(
browser, browser->path, archive_get_tab_ext(tab), skip_assets, hide_dot_files);
tab_empty = false; // Empty check will be performed later

View File

@@ -2,9 +2,8 @@
#include <storage/storage.h>
#define ARCHIVE_FAV_OLD_PATH EXT_PATH("favorites.txt")
#define ARCHIVE_FAV_PATH CFG_PATH("favorites.txt")
#define ARCHIVE_FAV_TEMP_PATH CFG_PATH("favorites.tmp")
#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt")
#define ARCHIVE_FAV_TEMP_PATH ANY_PATH("favorites.tmp")
uint16_t archive_favorites_count();
bool archive_favorites_read(void* context);

View File

@@ -5,7 +5,7 @@
#include <m-algo.h>
#include <storage/storage.h>
#include "toolbox/path.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define FAP_MANIFEST_MAX_ICON_SIZE 32
@@ -87,7 +87,7 @@ static void ArchiveFile_t_clear(ArchiveFile_t* obj) {
}
static int ArchiveFile_t_cmp(const ArchiveFile_t* a, const ArchiveFile_t* b) {
if(xtreme_settings.sort_dirs_first) {
if(momentum_settings.sort_dirs_first) {
if(a->type == ArchiveFileTypeFolder && b->type != ArchiveFileTypeFolder) {
return -1;
}

View File

@@ -1,5 +1,5 @@
#include "archive_helpers_ext.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
bool process_favorite_launch(char** args) {
if(*args && strlen(*args) > 4 && strncmp(*args, "fav/", 4) == 0) {
@@ -17,7 +17,7 @@ void favorite_timeout_callback(void* _ctx) {
}
void favorite_timeout_run(ViewDispatcher* view_dispatcher, SceneManager* scene_manager) {
uint32_t timeout = xtreme_settings.favorite_timeout;
uint32_t timeout = momentum_settings.favorite_timeout;
if(timeout == 0) {
view_dispatcher_run(view_dispatcher);
return;

View File

@@ -41,7 +41,7 @@ uint32_t archive_scene_search_dirwalk(void* context) {
uint32_t count = 1;
DirWalk* dir_walk = dir_walk_alloc(furi_record_open(RECORD_STORAGE));
const char* ignore[] = {
XTREME_ASSETS_PATH,
ASSET_PACKS_PATH,
BASE_ANIMATION_DIR,
};
dir_walk_set_recurse_filter(dir_walk, ignore, COUNT_OF(ignore));

View File

@@ -3,7 +3,7 @@
#include <furi_hal.h>
#include <storage/storage.h>
#include <lib/toolbox/path.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <lib/flipper_format/flipper_format.h>
#include <bt/bt_service/bt_i.h>
#include "helpers/ducky_script_i.h"
@@ -267,11 +267,11 @@ void bad_kb_config_refresh(BadKbApp* app) {
scene_manager_previous_scene(app->scene_manager);
// Update settings
if(xtreme_settings.bad_bt != app->is_bt ||
xtreme_settings.bad_bt_remember != app->bt_remember) {
xtreme_settings.bad_bt = app->is_bt;
xtreme_settings.bad_bt_remember = app->bt_remember;
xtreme_settings_save();
if(momentum_settings.bad_bt != app->is_bt ||
momentum_settings.bad_bt_remember != app->bt_remember) {
momentum_settings.bad_bt = app->is_bt;
momentum_settings.bad_bt_remember = app->bt_remember;
momentum_settings_save();
}
}
@@ -308,8 +308,8 @@ BadKbApp* bad_kb_app_alloc(char* arg) {
Bt* bt = furi_record_open(RECORD_BT);
app->bt = bt;
app->bt->suppress_pin_screen = true;
app->is_bt = xtreme_settings.bad_bt;
app->bt_remember = xtreme_settings.bad_bt_remember;
app->is_bt = momentum_settings.bad_bt;
app->bt_remember = momentum_settings.bad_bt_remember;
bad_kb_config_adjust(&app->config);
// Save prev config

View File

@@ -6,7 +6,7 @@ ENTER
DELAY 1000
CTRL l
DELAY 100
STRING https://github.com/Flipper-XFW/Xtreme-Firmware
STRING https://github.com/Next-Flip/Momentum-Firmware
DELAY 100
ENTER
DELAY 500

View File

@@ -4,7 +4,7 @@ GUI h
DELAY 1000
GUI SPACE
DELAY 250
STRING https://github.com/Flipper-XFW/Xtreme-Firmware
STRING https://github.com/Next-Flip/Momentum-Firmware
DELAY 75
TAB
DELAY 75

View File

@@ -1,7 +1,7 @@
#include "../bad_kb_app_i.h"
#include "furi_hal_power.h"
#include "furi_hal_usb.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
enum VarItemListIndex {
VarItemListIndexKeyboardLayout,

View File

@@ -15,7 +15,7 @@ static bool bad_kb_file_select(BadKbApp* bad_kb) {
dialog_message_set_text(
message,
"A badusb folder was found!\n"
"XFW uses the badkb folder.\n"
"Momentum uses the badkb folder.\n"
"Want to transfer the files?",
64,
32,

View File

@@ -4,7 +4,7 @@
#include <toolbox/path.h>
#include <gui/elements.h>
#include <assets_icons.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <bt/bt_service/bt_i.h>
#define MAX_NAME_LEN 64
@@ -57,11 +57,7 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
if((state == BadKbStateIdle) || (state == BadKbStateDone) ||
(state == BadKbStateNotConnected)) {
if(xtreme_assets.is_nsfw) {
elements_button_center(canvas, "Cum");
} else {
elements_button_center(canvas, "Run");
}
elements_button_center(canvas, "Run");
elements_button_left(canvas, "Config");
} else if((state == BadKbStateRunning) || (state == BadKbStateDelay)) {
elements_button_center(canvas, "Stop");
@@ -80,21 +76,12 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) {
if(state == BadKbStateNotConnected) {
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
canvas_set_font(canvas, FontPrimary);
if(xtreme_assets.is_nsfw) {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Plug me");
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "in, Daddy");
} else {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect to");
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "a device");
}
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect to");
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "a device");
} else if(state == BadKbStateWillRun) {
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
canvas_set_font(canvas, FontPrimary);
if(xtreme_assets.is_nsfw) {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum");
} else {
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run");
}
canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run");
canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect");
} else if(state == BadKbStateFileError) {
canvas_draw_icon(canvas, 4, 26, &I_Error_18x18);

View File

@@ -1,6 +1,6 @@
#include "../lfrfid_i.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
FuriTimer* timer_auto_exit = NULL;
@@ -35,7 +35,8 @@ void lfrfid_scene_emulate_on_enter(void* context) {
timer_auto_exit =
furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app);
furi_timer_start(
timer_auto_exit, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
timer_auto_exit,
momentum_settings.favorite_timeout * furi_kernel_get_tick_frequency());
}
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);

View File

@@ -1,11 +1,11 @@
App(
appid="xtreme_app",
name="Xtreme",
appid="momentum_app",
name="Momentum",
apptype=FlipperAppType.MENUEXTERNAL,
entry_point="xtreme_app",
entry_point="momentum_app",
stack_size=2 * 1024,
flags=["InsomniaSafe"],
icon="A_Xtreme_14",
icon="A_Momentum_14",
order=90,
fap_icon="icon.png",
fap_category="assets",

View File

Before

Width:  |  Height:  |  Size: 620 B

After

Width:  |  Height:  |  Size: 620 B

View File

@@ -1,8 +1,8 @@
#include "xtreme_app.h"
#include "momentum_app.h"
static bool xtreme_app_custom_event_callback(void* context, uint32_t event) {
static bool momentum_app_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
XtremeApp* app = context;
MomentumApp* app = context;
return scene_manager_handle_custom_event(app->scene_manager, event);
}
@@ -11,12 +11,12 @@ void callback_reboot(void* context) {
power_reboot(PowerBootModeNormal);
}
bool xtreme_app_apply(XtremeApp* app) {
bool momentum_app_apply(MomentumApp* app) {
Storage* storage = furi_record_open(RECORD_STORAGE);
if(app->save_mainmenu_apps) {
Stream* stream = file_stream_alloc(storage);
if(file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) {
if(file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) {
stream_write_format(stream, "MenuAppList Version %u\n", 0);
CharList_it_t it;
CharList_it(it, app->mainmenu_app_exes);
@@ -116,7 +116,7 @@ bool xtreme_app_apply(XtremeApp* app) {
}
if(app->save_settings) {
xtreme_settings_save();
momentum_settings_save();
}
if(app->show_slideshow) {
@@ -128,30 +128,30 @@ bool xtreme_app_apply(XtremeApp* app) {
popup_set_context(app->popup, app);
popup_set_timeout(app->popup, 1000);
popup_enable_timeout(app->popup);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewPopup);
return true;
} else if(app->apply_pack) {
xtreme_assets_free();
asset_packs_free();
popup_set_header(app->popup, "Reloading...", 64, 26, AlignCenter, AlignCenter);
popup_set_text(app->popup, "Applying asset pack...", 64, 40, AlignCenter, AlignCenter);
popup_set_callback(app->popup, NULL);
popup_set_context(app->popup, NULL);
popup_set_timeout(app->popup, 0);
popup_disable_timeout(app->popup);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
xtreme_assets_init();
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewPopup);
asset_packs_init();
}
furi_record_close(RECORD_STORAGE);
return false;
}
static bool xtreme_app_back_event_callback(void* context) {
static bool momentum_app_back_event_callback(void* context) {
furi_assert(context);
XtremeApp* app = context;
MomentumApp* app = context;
if(!scene_manager_has_previous_scene(app->scene_manager, XtremeAppSceneStart)) {
if(xtreme_app_apply(app)) {
if(!scene_manager_has_previous_scene(app->scene_manager, MomentumAppSceneStart)) {
if(momentum_app_apply(app)) {
return true;
}
}
@@ -159,22 +159,22 @@ static bool xtreme_app_back_event_callback(void* context) {
return scene_manager_handle_back_event(app->scene_manager);
}
XtremeApp* xtreme_app_alloc() {
XtremeApp* app = malloc(sizeof(XtremeApp));
MomentumApp* momentum_app_alloc() {
MomentumApp* app = malloc(sizeof(MomentumApp));
app->gui = furi_record_open(RECORD_GUI);
app->dialogs = furi_record_open(RECORD_DIALOGS);
app->notification = furi_record_open(RECORD_NOTIFICATION);
// View Dispatcher and Scene Manager
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&xtreme_app_scene_handlers, app);
app->scene_manager = scene_manager_alloc(&momentum_app_scene_handlers, app);
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
view_dispatcher_set_custom_event_callback(
app->view_dispatcher, xtreme_app_custom_event_callback);
app->view_dispatcher, momentum_app_custom_event_callback);
view_dispatcher_set_navigation_event_callback(
app->view_dispatcher, xtreme_app_back_event_callback);
app->view_dispatcher, momentum_app_back_event_callback);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
@@ -182,27 +182,28 @@ XtremeApp* xtreme_app_alloc() {
app->var_item_list = variable_item_list_alloc();
view_dispatcher_add_view(
app->view_dispatcher,
XtremeAppViewVarItemList,
MomentumAppViewVarItemList,
variable_item_list_get_view(app->var_item_list));
app->submenu = submenu_alloc();
view_dispatcher_add_view(
app->view_dispatcher, XtremeAppViewSubmenu, submenu_get_view(app->submenu));
app->view_dispatcher, MomentumAppViewSubmenu, submenu_get_view(app->submenu));
app->text_input = text_input_alloc();
view_dispatcher_add_view(
app->view_dispatcher, XtremeAppViewTextInput, text_input_get_view(app->text_input));
app->view_dispatcher, MomentumAppViewTextInput, text_input_get_view(app->text_input));
app->byte_input = byte_input_alloc();
view_dispatcher_add_view(
app->view_dispatcher, XtremeAppViewByteInput, byte_input_get_view(app->byte_input));
app->view_dispatcher, MomentumAppViewByteInput, byte_input_get_view(app->byte_input));
app->popup = popup_alloc();
view_dispatcher_add_view(app->view_dispatcher, XtremeAppViewPopup, popup_get_view(app->popup));
view_dispatcher_add_view(
app->view_dispatcher, MomentumAppViewPopup, popup_get_view(app->popup));
app->dialog_ex = dialog_ex_alloc();
view_dispatcher_add_view(
app->view_dispatcher, XtremeAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
app->view_dispatcher, MomentumAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
// Settings init
@@ -211,9 +212,9 @@ XtremeApp* xtreme_app_alloc() {
Storage* storage = furi_record_open(RECORD_STORAGE);
File* folder = storage_file_alloc(storage);
FileInfo info;
char* name = malloc(XTREME_ASSETS_PACK_NAME_LEN);
if(storage_dir_open(folder, XTREME_ASSETS_PATH)) {
while(storage_dir_read(folder, &info, name, XTREME_ASSETS_PACK_NAME_LEN)) {
char* name = malloc(ASSET_PACKS_NAME_LEN);
if(storage_dir_open(folder, ASSET_PACKS_PATH)) {
while(storage_dir_read(folder, &info, name, ASSET_PACKS_NAME_LEN)) {
if(info.flags & FSF_DIRECTORY) {
char* copy = strdup(name);
size_t idx = 0;
@@ -227,7 +228,7 @@ XtremeApp* xtreme_app_alloc() {
if(app->asset_pack_index != 0) {
if(idx < app->asset_pack_index) app->asset_pack_index++;
} else {
if(strcmp(copy, xtreme_settings.asset_pack) == 0)
if(strcmp(copy, momentum_settings.asset_pack) == 0)
app->asset_pack_index = idx + 1;
}
}
@@ -240,7 +241,7 @@ XtremeApp* xtreme_app_alloc() {
CharList_init(app->mainmenu_app_exes);
Stream* stream = file_stream_alloc(storage);
FuriString* line = furi_string_alloc();
if(file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
if(file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
stream_read_line(stream, line);
while(stream_read_line(stream, line)) {
furi_string_replace_all(line, "\r", "");
@@ -301,27 +302,35 @@ XtremeApp* xtreme_app_alloc() {
app->dolphin_angry = stats.butthurt;
furi_record_close(RECORD_DOLPHIN);
app->version_tag =
furi_string_alloc_printf("%s %s", version_get_version(NULL), version_get_builddate(NULL));
if(strcmp(version_get_version(NULL), "MNTM-DEV") == 0) {
app->version_tag = furi_string_alloc_printf("%s ", version_get_version(NULL));
const char* sha = version_get_githash(NULL);
for(size_t i = 0; i < strlen(sha); ++i) {
furi_string_push_back(app->version_tag, toupper(sha[i]));
}
} else {
app->version_tag = furi_string_alloc_printf(
"%s %s", version_get_version(NULL), version_get_builddate(NULL));
}
return app;
}
void xtreme_app_free(XtremeApp* app) {
void momentum_app_free(MomentumApp* app) {
furi_assert(app);
// Gui modules
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewVarItemList);
variable_item_list_free(app->var_item_list);
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewSubmenu);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewSubmenu);
submenu_free(app->submenu);
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewTextInput);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewTextInput);
text_input_free(app->text_input);
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewByteInput);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewByteInput);
byte_input_free(app->byte_input);
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewPopup);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewPopup);
popup_free(app->popup);
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewDialogEx);
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewDialogEx);
dialog_ex_free(app->dialog_ex);
// View Dispatcher and Scene Manager
@@ -357,11 +366,11 @@ void xtreme_app_free(XtremeApp* app) {
free(app);
}
extern int32_t xtreme_app(void* p) {
extern int32_t momentum_app(void* p) {
UNUSED(p);
XtremeApp* app = xtreme_app_alloc();
scene_manager_next_scene(app->scene_manager, XtremeAppSceneStart);
MomentumApp* app = momentum_app_alloc();
scene_manager_next_scene(app->scene_manager, MomentumAppSceneStart);
view_dispatcher_run(app->view_dispatcher);
xtreme_app_free(app);
momentum_app_free(app);
return 0;
}

View File

@@ -16,7 +16,7 @@
#include <gui/modules/popup.h>
#include <lib/toolbox/value_index.h>
#include <toolbox/stream/file_stream.h>
#include "scenes/xtreme_app_scene.h"
#include "scenes/momentum_app_scene.h"
#include "dolphin/helpers/dolphin_state.h"
#include "dolphin/dolphin.h"
#include "dolphin/dolphin_i.h"
@@ -27,10 +27,8 @@
#include <power/power_service/power.h>
#include <rgb_backlight.h>
#include <m-array.h>
#include <xtreme/namespoof.h>
#include <xtreme/xtreme.h>
#define XTREME_SUBGHZ_FREQ_BUFFER_SIZE 7
#include <momentum/namespoof.h>
#include <momentum/momentum.h>
ARRAY_DEF(CharList, char*)
@@ -57,7 +55,7 @@ typedef struct {
uint8_t subghz_static_index;
FrequencyList_t subghz_hopper_freqs;
uint8_t subghz_hopper_index;
char subghz_freq_buffer[XTREME_SUBGHZ_FREQ_BUFFER_SIZE];
char subghz_freq_buffer[7];
bool subghz_extend;
RgbColor lcd_color;
char device_name[FURI_HAL_VERSION_ARRAY_NAME_LENGTH];
@@ -76,15 +74,15 @@ typedef struct {
bool apply_pack;
bool show_slideshow;
bool require_reboot;
} XtremeApp;
} MomentumApp;
typedef enum {
XtremeAppViewVarItemList,
XtremeAppViewSubmenu,
XtremeAppViewTextInput,
XtremeAppViewByteInput,
XtremeAppViewPopup,
XtremeAppViewDialogEx,
} XtremeAppView;
MomentumAppViewVarItemList,
MomentumAppViewSubmenu,
MomentumAppViewTextInput,
MomentumAppViewByteInput,
MomentumAppViewPopup,
MomentumAppViewDialogEx,
} MomentumAppView;
bool xtreme_app_apply(XtremeApp* app);
bool momentum_app_apply(MomentumApp* app);

View File

@@ -0,0 +1,30 @@
#include "momentum_app_scene.h"
// Generate scene on_enter handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
void (*const momentum_app_on_enter_handlers[])(void*) = {
#include "momentum_app_scene_config.h"
};
#undef ADD_SCENE
// Generate scene on_event handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
bool (*const momentum_app_on_event_handlers[])(void* context, SceneManagerEvent event) = {
#include "momentum_app_scene_config.h"
};
#undef ADD_SCENE
// Generate scene on_exit handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
void (*const momentum_app_on_exit_handlers[])(void* context) = {
#include "momentum_app_scene_config.h"
};
#undef ADD_SCENE
// Initialize scene handlers configuration structure
const SceneManagerHandlers momentum_app_scene_handlers = {
.on_enter_handlers = momentum_app_on_enter_handlers,
.on_event_handlers = momentum_app_on_event_handlers,
.on_exit_handlers = momentum_app_on_exit_handlers,
.scene_num = MomentumAppSceneNum,
};

View File

@@ -3,27 +3,27 @@
#include <gui/scene_manager.h>
// Generate scene id and total number
#define ADD_SCENE(prefix, name, id) XtremeAppScene##id,
#define ADD_SCENE(prefix, name, id) MomentumAppScene##id,
typedef enum {
#include "xtreme_app_scene_config.h"
XtremeAppSceneNum,
} XtremeAppScene;
#include "momentum_app_scene_config.h"
MomentumAppSceneNum,
} MomentumAppScene;
#undef ADD_SCENE
extern const SceneManagerHandlers xtreme_app_scene_handlers;
extern const SceneManagerHandlers momentum_app_scene_handlers;
// Generate scene on_enter handlers declaration
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
#include "xtreme_app_scene_config.h"
#include "momentum_app_scene_config.h"
#undef ADD_SCENE
// Generate scene on_event handlers declaration
#define ADD_SCENE(prefix, name, id) \
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
#include "xtreme_app_scene_config.h"
#include "momentum_app_scene_config.h"
#undef ADD_SCENE
// Generate scene on_exit handlers declaration
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
#include "xtreme_app_scene_config.h"
#include "momentum_app_scene_config.h"
#undef ADD_SCENE

View File

@@ -0,0 +1,21 @@
ADD_SCENE(momentum_app, start, Start)
ADD_SCENE(momentum_app, interface, Interface)
ADD_SCENE(momentum_app, interface_graphics, InterfaceGraphics)
ADD_SCENE(momentum_app, interface_mainmenu, InterfaceMainmenu)
ADD_SCENE(momentum_app, interface_mainmenu_add, InterfaceMainmenuAdd)
ADD_SCENE(momentum_app, interface_mainmenu_add_main, InterfaceMainmenuAddMain)
ADD_SCENE(momentum_app, interface_mainmenu_reset, InterfaceMainmenuReset)
ADD_SCENE(momentum_app, interface_lockscreen, InterfaceLockscreen)
ADD_SCENE(momentum_app, interface_statusbar, InterfaceStatusbar)
ADD_SCENE(momentum_app, interface_filebrowser, InterfaceFilebrowser)
ADD_SCENE(momentum_app, protocols, Protocols)
ADD_SCENE(momentum_app, protocols_freqs, ProtocolsFreqs)
ADD_SCENE(momentum_app, protocols_freqs_static, ProtocolsFreqsStatic)
ADD_SCENE(momentum_app, protocols_freqs_hopper, ProtocolsFreqsHopper)
ADD_SCENE(momentum_app, protocols_freqs_add, ProtocolsFreqsAdd)
ADD_SCENE(momentum_app, protocols_gpio, ProtocolsGpio)
ADD_SCENE(momentum_app, misc, Misc)
ADD_SCENE(momentum_app, misc_screen, MiscScreen)
ADD_SCENE(momentum_app, misc_screen_color, MiscScreenColor)
ADD_SCENE(momentum_app, misc_dolphin, MiscDolphin)
ADD_SCENE(momentum_app, misc_rename, MiscRename)

View File

@@ -0,0 +1,90 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexGraphics,
VarItemListIndexMainmenu,
VarItemListIndexLockscreen,
VarItemListIndexStatusbar,
VarItemListIndexFileBrowser,
};
void momentum_app_scene_interface_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
void momentum_app_scene_interface_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(var_item_list, "Graphics", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Mainmenu", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Lockscreen", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Statusbar", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "File Browser", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_interface_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterface));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_interface_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneInterface, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexGraphics:
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceGraphics, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceGraphics);
break;
case VarItemListIndexMainmenu:
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceMainmenu, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceMainmenu);
break;
case VarItemListIndexLockscreen:
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceLockscreen, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceLockscreen);
break;
case VarItemListIndexStatusbar:
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceStatusbar, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceStatusbar);
break;
case VarItemListIndexFileBrowser:
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceFilebrowser, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceFilebrowser);
break;
default:
break;
}
}
return consumed;
}
void momentum_app_scene_interface_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -0,0 +1,124 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexSortDirsFirst,
VarItemListIndexShowHiddenFiles,
VarItemListIndexShowInternalTab,
VarItemListIndexFavoriteTimeout,
};
void momentum_app_scene_interface_filebrowser_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void momentum_app_scene_interface_filebrowser_sort_dirs_first_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.sort_dirs_first = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_filebrowser_show_hidden_files_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.show_hidden_files = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_filebrowser_show_internal_tab_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.show_internal_tab = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_filebrowser_favorite_timeout_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint32_t value = variable_item_get_current_value_index(item);
char text[6];
snprintf(text, sizeof(text), "%lu S", value);
variable_item_set_current_value_text(item, value ? text : "OFF");
momentum_settings.favorite_timeout = value;
app->save_settings = true;
}
void momentum_app_scene_interface_filebrowser_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Folders Above Files",
2,
momentum_app_scene_interface_filebrowser_sort_dirs_first_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.sort_dirs_first);
variable_item_set_current_value_text(item, momentum_settings.sort_dirs_first ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Hidden Files",
2,
momentum_app_scene_interface_filebrowser_show_hidden_files_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.show_hidden_files);
variable_item_set_current_value_text(item, momentum_settings.show_hidden_files ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Internal Tab",
2,
momentum_app_scene_interface_filebrowser_show_internal_tab_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.show_internal_tab);
variable_item_set_current_value_text(item, momentum_settings.show_internal_tab ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Favorite Timeout",
61,
momentum_app_scene_interface_filebrowser_favorite_timeout_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.favorite_timeout);
char text[4];
snprintf(text, sizeof(text), "%lu S", momentum_settings.favorite_timeout);
variable_item_set_current_value_text(item, momentum_settings.favorite_timeout ? text : "OFF");
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_interface_filebrowser_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterfaceFilebrowser));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_interface_filebrowser_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceFilebrowser, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void momentum_app_scene_interface_filebrowser_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,31 +1,26 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexAssetPack,
VarItemListIndexAnimSpeed,
VarItemListIndexCycleAnims,
VarItemListIndexUnlockAnims,
VarItemListIndexCreditsAnim,
};
void xtreme_app_scene_interface_graphics_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_interface_graphics_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_interface_graphics_asset_pack_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_graphics_asset_pack_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(
item, index == 0 ? "Default" : *CharList_get(app->asset_pack_names, index - 1));
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexCreditsAnim),
index != 0,
"Credits\nare in\ndefault pack!");
strlcpy(
xtreme_settings.asset_pack,
momentum_settings.asset_pack,
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
XTREME_ASSETS_PACK_NAME_LEN);
ASSET_PACKS_NAME_LEN);
app->asset_pack_index = index;
app->save_settings = true;
app->apply_pack = true;
@@ -59,11 +54,11 @@ const uint32_t anim_speed_values[COUNT_OF(anim_speed_names)] = {
275,
300,
};
static void xtreme_app_scene_interface_graphics_anim_speed_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_graphics_anim_speed_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, anim_speed_names[index]);
xtreme_settings.anim_speed = anim_speed_values[index];
momentum_settings.anim_speed = anim_speed_values[index];
app->save_settings = true;
}
@@ -101,32 +96,24 @@ const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] = {
43200,
86400,
};
static void xtreme_app_scene_interface_graphics_cycle_anims_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_graphics_cycle_anims_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, cycle_anims_names[index]);
xtreme_settings.cycle_anims = cycle_anims_values[index];
momentum_settings.cycle_anims = cycle_anims_values[index];
app->save_settings = true;
}
static void xtreme_app_scene_interface_graphics_unlock_anims_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_graphics_unlock_anims_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.unlock_anims = value;
momentum_settings.unlock_anims = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_graphics_credits_anim_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.credits_anim = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_graphics_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_graphics_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -135,7 +122,7 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
var_item_list,
"Asset Pack",
CharList_size(app->asset_pack_names) + 1,
xtreme_app_scene_interface_graphics_asset_pack_changed,
momentum_app_scene_interface_graphics_asset_pack_changed,
app);
variable_item_set_current_value_index(item, app->asset_pack_index);
variable_item_set_current_value_text(
@@ -148,10 +135,10 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
var_item_list,
"Anim Speed",
COUNT_OF(anim_speed_names),
xtreme_app_scene_interface_graphics_anim_speed_changed,
momentum_app_scene_interface_graphics_anim_speed_changed,
app);
value_index = value_index_uint32(
xtreme_settings.anim_speed, anim_speed_values, COUNT_OF(anim_speed_values));
momentum_settings.anim_speed, anim_speed_values, COUNT_OF(anim_speed_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, anim_speed_names[value_index]);
@@ -159,10 +146,10 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
var_item_list,
"Cycle Anims",
COUNT_OF(cycle_anims_names),
xtreme_app_scene_interface_graphics_cycle_anims_changed,
momentum_app_scene_interface_graphics_cycle_anims_changed,
app);
value_index = value_index_int32(
xtreme_settings.cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_values));
momentum_settings.cycle_anims, cycle_anims_values, COUNT_OF(cycle_anims_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
@@ -170,38 +157,28 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
var_item_list,
"Unlock Anims",
2,
xtreme_app_scene_interface_graphics_unlock_anims_changed,
momentum_app_scene_interface_graphics_unlock_anims_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.unlock_anims);
variable_item_set_current_value_text(item, xtreme_settings.unlock_anims ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Credits Anim",
2,
xtreme_app_scene_interface_graphics_credits_anim_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.credits_anim);
variable_item_set_current_value_text(item, xtreme_settings.credits_anim ? "ON" : "OFF");
variable_item_set_locked(item, app->asset_pack_index != 0, "Credits\nare in\ndefault pack!");
variable_item_set_current_value_index(item, momentum_settings.unlock_anims);
variable_item_set_current_value_text(item, momentum_settings.unlock_anims ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_graphics_var_item_list_callback, app);
var_item_list, momentum_app_scene_interface_graphics_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceGraphics));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterfaceGraphics));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_interface_graphics_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_interface_graphics_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceGraphics, event.event);
app->scene_manager, MomentumAppSceneInterfaceGraphics, event.event);
consumed = true;
switch(event.event) {
default:
@@ -212,7 +189,7 @@ bool xtreme_app_scene_interface_graphics_on_event(void* context, SceneManagerEve
return consumed;
}
void xtreme_app_scene_interface_graphics_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_graphics_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -0,0 +1,234 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexLockOnBoot,
VarItemListIndexFormatOn10BadPins,
VarItemListIndexPinUnlockFromApp,
VarItemListIndexShowTime,
VarItemListIndexShowSeconds,
VarItemListIndexShowDate,
VarItemListIndexShowStatusbar,
VarItemListIndexUnlockPrompt,
};
void momentum_app_scene_interface_lockscreen_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void momentum_app_scene_interface_lockscreen_lock_on_boot_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lock_on_boot = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_lockscreen_bad_pins_format_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.bad_pins_format = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.allow_locked_rpc_commands = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_lockscreen_lockscreen_poweroff_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_poweroff = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_lockscreen_lockscreen_time_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_time = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_lockscreen_lockscreen_seconds_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_seconds = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_lockscreen_lockscreen_date_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_date = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_lockscreen_lockscreen_statusbar_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_statusbar = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_lockscreen_lockscreen_prompt_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_prompt = value;
app->save_settings = true;
}
static void
momentum_app_scene_interface_lockscreen_lockscreen_transparent_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.lockscreen_transparent = value;
app->save_settings = true;
}
void momentum_app_scene_interface_lockscreen_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Lock on Boot",
2,
momentum_app_scene_interface_lockscreen_lock_on_boot_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lock_on_boot);
variable_item_set_current_value_text(item, momentum_settings.lock_on_boot ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Format on 10 Bad PINs",
2,
momentum_app_scene_interface_lockscreen_bad_pins_format_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.bad_pins_format);
variable_item_set_current_value_text(item, momentum_settings.bad_pins_format ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Allow RPC While Locked",
2,
momentum_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.allow_locked_rpc_commands);
variable_item_set_current_value_text(
item, momentum_settings.allow_locked_rpc_commands ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Allow Poweroff",
2,
momentum_app_scene_interface_lockscreen_lockscreen_poweroff_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_poweroff);
variable_item_set_current_value_text(
item, momentum_settings.lockscreen_poweroff ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Time",
2,
momentum_app_scene_interface_lockscreen_lockscreen_time_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_time);
variable_item_set_current_value_text(item, momentum_settings.lockscreen_time ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Seconds",
2,
momentum_app_scene_interface_lockscreen_lockscreen_seconds_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_seconds);
variable_item_set_current_value_text(
item, momentum_settings.lockscreen_seconds ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Date",
2,
momentum_app_scene_interface_lockscreen_lockscreen_date_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_date);
variable_item_set_current_value_text(item, momentum_settings.lockscreen_date ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Statusbar",
2,
momentum_app_scene_interface_lockscreen_lockscreen_statusbar_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_statusbar);
variable_item_set_current_value_text(
item, momentum_settings.lockscreen_statusbar ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Unlock Prompt",
2,
momentum_app_scene_interface_lockscreen_lockscreen_prompt_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_prompt);
variable_item_set_current_value_text(item, momentum_settings.lockscreen_prompt ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Transparent (see animation)",
2,
momentum_app_scene_interface_lockscreen_lockscreen_transparent_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.lockscreen_transparent);
variable_item_set_current_value_text(
item, momentum_settings.lockscreen_transparent ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_interface_lockscreen_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterfaceLockscreen));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_interface_lockscreen_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceLockscreen, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void momentum_app_scene_interface_lockscreen_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexMenuStyle,
@@ -9,8 +9,8 @@ enum VarItemListIndex {
VarItemListIndexRemoveApp,
};
void xtreme_app_scene_interface_mainmenu_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
@@ -24,16 +24,16 @@ const char* const menu_style_names[MenuStyleCount] = {
"Compact",
"Terminal",
};
static void xtreme_app_scene_interface_mainmenu_menu_style_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_mainmenu_menu_style_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, menu_style_names[index]);
xtreme_settings.menu_style = index;
momentum_settings.menu_style = index;
app->save_settings = true;
}
static void xtreme_app_scene_interface_mainmenu_app_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_mainmenu_app_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->mainmenu_app_index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(
item, *CharList_get(app->mainmenu_app_labels, app->mainmenu_app_index));
@@ -43,8 +43,8 @@ static void xtreme_app_scene_interface_mainmenu_app_changed(VariableItem* item)
variable_item_set_item_label(item, label);
}
static void xtreme_app_scene_interface_mainmenu_move_app_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_interface_mainmenu_move_app_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t idx = app->mainmenu_app_index;
size_t size = CharList_size(app->mainmenu_app_labels);
uint8_t dir = variable_item_get_current_value_index(item);
@@ -65,8 +65,8 @@ static void xtreme_app_scene_interface_mainmenu_move_app_changed(VariableItem* i
variable_item_set_current_value_index(item, 1);
}
void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -74,16 +74,16 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
var_item_list,
"Menu Style",
MenuStyleCount,
xtreme_app_scene_interface_mainmenu_menu_style_changed,
momentum_app_scene_interface_mainmenu_menu_style_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.menu_style);
variable_item_set_current_value_text(item, menu_style_names[xtreme_settings.menu_style]);
variable_item_set_current_value_index(item, momentum_settings.menu_style);
variable_item_set_current_value_text(item, menu_style_names[momentum_settings.menu_style]);
variable_item_list_add(var_item_list, "Reset Menu", 0, NULL, app);
size_t count = CharList_size(app->mainmenu_app_labels);
item = variable_item_list_add(
var_item_list, "App", count, xtreme_app_scene_interface_mainmenu_app_changed, app);
var_item_list, "App", count, momentum_app_scene_interface_mainmenu_app_changed, app);
if(count) {
app->mainmenu_app_index = CLAMP(app->mainmenu_app_index, count - 1, 0U);
char label[20];
@@ -100,7 +100,7 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
variable_item_list_add(var_item_list, "Add App", 0, NULL, app);
item = variable_item_list_add(
var_item_list, "Move App", 3, xtreme_app_scene_interface_mainmenu_move_app_changed, app);
var_item_list, "Move App", 3, momentum_app_scene_interface_mainmenu_move_app_changed, app);
variable_item_set_current_value_text(item, "");
variable_item_set_current_value_index(item, 1);
variable_item_set_locked(item, count < 2, "Can't move\nwith less\nthan 2 apps!");
@@ -108,26 +108,26 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
variable_item_list_add(var_item_list, "Remove App", 0, NULL, app);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_mainmenu_var_item_list_callback, app);
var_item_list, momentum_app_scene_interface_mainmenu_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceMainmenu));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterfaceMainmenu));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceMainmenu, event.event);
app->scene_manager, MomentumAppSceneInterfaceMainmenu, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexResetMenu:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuReset);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceMainmenuReset);
break;
case VarItemListIndexRemoveApp:
if(!CharList_size(app->mainmenu_app_labels)) break;
@@ -161,7 +161,7 @@ bool xtreme_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEve
break;
}
case VarItemListIndexAddApp:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuAdd);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceMainmenuAdd);
break;
default:
break;
@@ -171,7 +171,7 @@ bool xtreme_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEve
return consumed;
}
void xtreme_app_scene_interface_mainmenu_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum SubmenuIndex {
SubmenuIndexMainApp,
@@ -18,13 +18,13 @@ static bool fap_selector_item_callback(
}
static void
xtreme_app_scene_interface_mainmenu_add_submenu_callback(void* context, uint32_t index) {
XtremeApp* app = context;
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceMainmenuAdd, index);
momentum_app_scene_interface_mainmenu_add_submenu_callback(void* context, uint32_t index) {
MomentumApp* app = context;
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneInterfaceMainmenuAdd, index);
switch(index) {
case SubmenuIndexMainApp:
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuAddMain);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterfaceMainmenuAddMain);
break;
case SubmenuIndexExternalApp: {
const DialogsFileBrowserOptions browser_options = {
@@ -53,7 +53,7 @@ static void
app->save_mainmenu_apps = true;
app->require_reboot = true;
scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, XtremeAppSceneInterfaceMainmenu);
app->scene_manager, MomentumAppSceneInterfaceMainmenu);
}
furi_string_free(temp_path);
break;
@@ -63,8 +63,8 @@ static void
}
}
void xtreme_app_scene_interface_mainmenu_add_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_add_on_enter(void* context) {
MomentumApp* app = context;
Submenu* submenu = app->submenu;
submenu_set_header(submenu, "Add Menu App:");
@@ -73,20 +73,20 @@ void xtreme_app_scene_interface_mainmenu_add_on_enter(void* context) {
submenu,
"Main App",
SubmenuIndexMainApp,
xtreme_app_scene_interface_mainmenu_add_submenu_callback,
momentum_app_scene_interface_mainmenu_add_submenu_callback,
app);
submenu_add_item(
submenu,
"External App",
SubmenuIndexExternalApp,
xtreme_app_scene_interface_mainmenu_add_submenu_callback,
momentum_app_scene_interface_mainmenu_add_submenu_callback,
app);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewSubmenu);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewSubmenu);
}
bool xtreme_app_scene_interface_mainmenu_add_on_event(void* context, SceneManagerEvent event) {
bool momentum_app_scene_interface_mainmenu_add_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
bool consumed = false;
@@ -97,7 +97,7 @@ bool xtreme_app_scene_interface_mainmenu_add_on_event(void* context, SceneManage
return consumed;
}
void xtreme_app_scene_interface_mainmenu_add_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_add_on_exit(void* context) {
MomentumApp* app = context;
submenu_reset(app->submenu);
}

View File

@@ -1,8 +1,8 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
static void
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback(void* context, uint32_t index) {
XtremeApp* app = context;
momentum_app_scene_interface_mainmenu_add_main_submenu_callback(void* context, uint32_t index) {
MomentumApp* app = context;
const char* name = (const char*)index;
CharList_push_back(app->mainmenu_app_exes, strdup(name));
@@ -11,11 +11,11 @@ static void
app->save_mainmenu_apps = true;
app->require_reboot = true;
scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, XtremeAppSceneInterfaceMainmenu);
app->scene_manager, MomentumAppSceneInterfaceMainmenu);
}
void xtreme_app_scene_interface_mainmenu_add_main_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_add_main_on_enter(void* context) {
MomentumApp* app = context;
Submenu* submenu = app->submenu;
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
@@ -23,7 +23,7 @@ void xtreme_app_scene_interface_mainmenu_add_main_on_enter(void* context) {
submenu,
FLIPPER_APPS[i].name,
(uint32_t)FLIPPER_APPS[i].name,
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback,
momentum_app_scene_interface_mainmenu_add_main_submenu_callback,
app);
}
for(size_t i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT - 1; i++) {
@@ -31,14 +31,16 @@ void xtreme_app_scene_interface_mainmenu_add_main_on_enter(void* context) {
submenu,
FLIPPER_EXTERNAL_APPS[i].name,
(uint32_t)FLIPPER_EXTERNAL_APPS[i].name,
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback,
momentum_app_scene_interface_mainmenu_add_main_submenu_callback,
app);
}
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewSubmenu);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewSubmenu);
}
bool xtreme_app_scene_interface_mainmenu_add_main_on_event(void* context, SceneManagerEvent event) {
bool momentum_app_scene_interface_mainmenu_add_main_on_event(
void* context,
SceneManagerEvent event) {
UNUSED(context);
bool consumed = false;
@@ -49,7 +51,7 @@ bool xtreme_app_scene_interface_mainmenu_add_main_on_event(void* context, SceneM
return consumed;
}
void xtreme_app_scene_interface_mainmenu_add_main_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_add_main_on_exit(void* context) {
MomentumApp* app = context;
submenu_reset(app->submenu);
}

View File

@@ -1,15 +1,15 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
static void xtreme_app_scene_interface_mainmenu_reset_dialog_callback(
static void momentum_app_scene_interface_mainmenu_reset_dialog_callback(
DialogExResult result,
void* context) {
XtremeApp* app = context;
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, result);
}
void xtreme_app_scene_interface_mainmenu_reset_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_reset_on_enter(void* context) {
MomentumApp* app = context;
DialogEx* dialog_ex = app->dialog_ex;
dialog_ex_set_header(dialog_ex, "Reset Menu Apps?", 64, 10, AlignCenter, AlignCenter);
@@ -19,23 +19,23 @@ void xtreme_app_scene_interface_mainmenu_reset_on_enter(void* context) {
dialog_ex_set_context(dialog_ex, app);
dialog_ex_set_result_callback(
dialog_ex, xtreme_app_scene_interface_mainmenu_reset_dialog_callback);
dialog_ex, momentum_app_scene_interface_mainmenu_reset_dialog_callback);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewDialogEx);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewDialogEx);
}
bool xtreme_app_scene_interface_mainmenu_reset_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_interface_mainmenu_reset_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DialogExResultRight:
storage_common_remove(furi_record_open(RECORD_STORAGE), XTREME_MENU_PATH);
storage_common_remove(furi_record_open(RECORD_STORAGE), MAINMENU_APPS_PATH);
furi_record_close(RECORD_STORAGE);
app->save_mainmenu_apps = false;
app->require_reboot = true;
xtreme_app_apply(app);
momentum_app_apply(app);
break;
case DialogExResultLeft:
scene_manager_previous_scene(app->scene_manager);
@@ -50,8 +50,8 @@ bool xtreme_app_scene_interface_mainmenu_reset_on_event(void* context, SceneMana
return consumed;
}
void xtreme_app_scene_interface_mainmenu_reset_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_interface_mainmenu_reset_on_exit(void* context) {
MomentumApp* app = context;
DialogEx* dialog_ex = app->dialog_ex;
dialog_ex_reset(dialog_ex);

View File

@@ -0,0 +1,147 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexBatteryIcon,
VarItemListIndexShowClock,
VarItemListIndexStatusIcons,
VarItemListIndexBarBorders,
VarItemListIndexBarBackground,
};
void momentum_app_scene_interface_statusbar_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
const char* const battery_icon_names[BatteryIconCount] = {
"OFF",
"Bar",
"%",
"Inv. %",
"Retro 3",
"Retro 5",
"Bar %",
};
static void momentum_app_scene_interface_statusbar_battery_icon_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, battery_icon_names[index]);
momentum_settings.battery_icon = index;
app->save_settings = true;
power_set_battery_icon_enabled(furi_record_open(RECORD_POWER), index != BatteryIconOff);
furi_record_close(RECORD_POWER);
}
static void momentum_app_scene_interface_statusbar_statusbar_clock_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.statusbar_clock = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_statusbar_status_icons_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.status_icons = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_statusbar_bar_borders_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.bar_borders = value;
app->save_settings = true;
}
static void momentum_app_scene_interface_statusbar_bar_background_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.bar_background = value;
app->save_settings = true;
}
void momentum_app_scene_interface_statusbar_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Battery Icon",
BatteryIconCount,
momentum_app_scene_interface_statusbar_battery_icon_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.battery_icon);
variable_item_set_current_value_text(item, battery_icon_names[momentum_settings.battery_icon]);
item = variable_item_list_add(
var_item_list,
"Show Clock",
2,
momentum_app_scene_interface_statusbar_statusbar_clock_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.statusbar_clock);
variable_item_set_current_value_text(item, momentum_settings.statusbar_clock ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Status Icons",
2,
momentum_app_scene_interface_statusbar_status_icons_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.status_icons);
variable_item_set_current_value_text(item, momentum_settings.status_icons ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Bar Borders",
2,
momentum_app_scene_interface_statusbar_bar_borders_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.bar_borders);
variable_item_set_current_value_text(item, momentum_settings.bar_borders ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Bar Background",
2,
momentum_app_scene_interface_statusbar_bar_background_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.bar_background);
variable_item_set_current_value_text(item, momentum_settings.bar_background ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_interface_statusbar_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneInterfaceStatusbar));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_interface_statusbar_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneInterfaceStatusbar, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void momentum_app_scene_interface_statusbar_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,31 +1,31 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexScreen,
VarItemListIndexDolphin,
VarItemListIndexChangeDeviceName,
VarItemListIndexChargeCap,
VarItemListIndexShowXtremeIntro,
VarItemListIndexShowMomentumIntro,
};
void xtreme_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
#define CHARGE_CAP_INTV 5
static void xtreme_app_scene_misc_charge_cap_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_charge_cap_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
char cap_str[6];
uint32_t value = (variable_item_get_current_value_index(item) + 1) * CHARGE_CAP_INTV;
snprintf(cap_str, 6, "%lu%%", value);
variable_item_set_current_value_text(item, cap_str);
xtreme_settings.charge_cap = value;
momentum_settings.charge_cap = value;
app->save_settings = true;
}
void xtreme_app_scene_misc_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -39,56 +39,56 @@ void xtreme_app_scene_misc_on_enter(void* context) {
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
char cap_str[6];
value_index = xtreme_settings.charge_cap / CHARGE_CAP_INTV;
value_index = momentum_settings.charge_cap / CHARGE_CAP_INTV;
snprintf(cap_str, 6, "%lu%%", (uint32_t)value_index * CHARGE_CAP_INTV);
item = variable_item_list_add(
var_item_list,
"Charge Cap",
100 / CHARGE_CAP_INTV,
xtreme_app_scene_misc_charge_cap_changed,
momentum_app_scene_misc_charge_cap_changed,
app);
variable_item_set_current_value_index(item, value_index - 1);
variable_item_set_current_value_text(item, cap_str);
variable_item_list_add(var_item_list, "Show Xtreme Intro", 0, NULL, app);
variable_item_list_add(var_item_list, "Show Momentum Intro", 0, NULL, app);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_misc_var_item_list_callback, app);
var_item_list, momentum_app_scene_misc_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMisc));
var_item_list, scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMisc));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMisc, event.event);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMisc, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexScreen:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscScreen, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreen);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscScreen, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscScreen);
break;
case VarItemListIndexDolphin:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscDolphin, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscDolphin);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscDolphin, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscDolphin);
break;
case VarItemListIndexChangeDeviceName:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscRename, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscRename);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscRename, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscRename);
break;
case VarItemListIndexShowXtremeIntro: {
case VarItemListIndexShowMomentumIntro: {
for(int i = 0; i < 10; i++) {
if(storage_common_copy(
furi_record_open(RECORD_STORAGE),
EXT_PATH("dolphin/xfwfirstboot.bin"),
EXT_PATH("dolphin/firstboot.bin"),
EXT_PATH(".slideshow"))) {
app->show_slideshow = true;
xtreme_app_apply(app);
momentum_app_apply(app);
break;
}
}
@@ -102,7 +102,7 @@ bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
return consumed;
}
void xtreme_app_scene_misc_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexDolphinLevel,
@@ -6,13 +6,13 @@ enum VarItemListIndex {
VarItemListIndexButthurtTimer,
};
void xtreme_app_scene_misc_dolphin_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_misc_dolphin_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_misc_dolphin_dolphin_level_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_dolphin_dolphin_level_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->dolphin_level = variable_item_get_current_value_index(item) + 1;
char level_str[4];
snprintf(level_str, 4, "%li", app->dolphin_level);
@@ -20,8 +20,8 @@ static void xtreme_app_scene_misc_dolphin_dolphin_level_changed(VariableItem* it
app->save_level = true;
}
static void xtreme_app_scene_misc_dolphin_dolphin_angry_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_dolphin_dolphin_angry_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->dolphin_angry = variable_item_get_current_value_index(item);
char angry_str[4];
snprintf(angry_str, 4, "%li", app->dolphin_angry);
@@ -53,17 +53,17 @@ const uint32_t butthurt_timer_values[COUNT_OF(butthurt_timer_names)] = {
86400,
172800,
};
static void xtreme_app_scene_misc_dolphin_butthurt_timer_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_dolphin_butthurt_timer_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, butthurt_timer_names[index]);
xtreme_settings.butthurt_timer = butthurt_timer_values[index];
momentum_settings.butthurt_timer = butthurt_timer_values[index];
app->save_settings = true;
app->require_reboot = true;
}
void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_dolphin_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
@@ -74,7 +74,7 @@ void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
var_item_list,
"Dolphin Level",
DOLPHIN_LEVEL_COUNT + 1,
xtreme_app_scene_misc_dolphin_dolphin_level_changed,
momentum_app_scene_misc_dolphin_dolphin_level_changed,
app);
variable_item_set_current_value_index(item, app->dolphin_level - 1);
variable_item_set_current_value_text(item, level_str);
@@ -85,7 +85,7 @@ void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
var_item_list,
"Dolphin Angry",
BUTTHURT_MAX + 1,
xtreme_app_scene_misc_dolphin_dolphin_angry_changed,
momentum_app_scene_misc_dolphin_dolphin_angry_changed,
app);
variable_item_set_current_value_index(item, app->dolphin_angry);
variable_item_set_current_value_text(item, angry_str);
@@ -94,29 +94,30 @@ void xtreme_app_scene_misc_dolphin_on_enter(void* context) {
var_item_list,
"Butthurt Timer",
COUNT_OF(butthurt_timer_names),
xtreme_app_scene_misc_dolphin_butthurt_timer_changed,
momentum_app_scene_misc_dolphin_butthurt_timer_changed,
app);
value_index = value_index_uint32(
xtreme_settings.butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_values));
momentum_settings.butthurt_timer, butthurt_timer_values, COUNT_OF(butthurt_timer_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, butthurt_timer_names[value_index]);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_misc_dolphin_var_item_list_callback, app);
var_item_list, momentum_app_scene_misc_dolphin_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMiscDolphin));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscDolphin));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_misc_dolphin_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_misc_dolphin_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscDolphin, event.event);
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneMiscDolphin, event.event);
consumed = true;
switch(event.event) {
default:
@@ -127,7 +128,7 @@ bool xtreme_app_scene_misc_dolphin_on_event(void* context, SceneManagerEvent eve
return consumed;
}
void xtreme_app_scene_misc_dolphin_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_dolphin_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,11 +1,11 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum TextInputIndex {
TextInputResultOk,
};
static void xtreme_app_scene_misc_rename_text_input_callback(void* context) {
XtremeApp* app = context;
static void momentum_app_scene_misc_rename_text_input_callback(void* context) {
MomentumApp* app = context;
app->save_name = true;
app->require_reboot = true;
@@ -13,7 +13,7 @@ static void xtreme_app_scene_misc_rename_text_input_callback(void* context) {
}
static bool
xtreme_app_scene_misc_rename_validator(const char* text, FuriString* error, void* context) {
momentum_app_scene_misc_rename_validator(const char* text, FuriString* error, void* context) {
UNUSED(context);
for(; *text; ++text) {
@@ -27,29 +27,29 @@ static bool
return true;
}
void xtreme_app_scene_misc_rename_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_rename_on_enter(void* context) {
MomentumApp* app = context;
TextInput* text_input = app->text_input;
text_input_set_header_text(text_input, "Leave empty for default");
text_input_set_validator(text_input, xtreme_app_scene_misc_rename_validator, NULL);
text_input_set_validator(text_input, momentum_app_scene_misc_rename_validator, NULL);
text_input_set_minimum_length(text_input, 0);
text_input_set_result_callback(
text_input,
xtreme_app_scene_misc_rename_text_input_callback,
momentum_app_scene_misc_rename_text_input_callback,
app,
app->device_name,
FURI_HAL_VERSION_ARRAY_NAME_LENGTH,
true);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewTextInput);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewTextInput);
}
bool xtreme_app_scene_misc_rename_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_misc_rename_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
@@ -66,7 +66,7 @@ bool xtreme_app_scene_misc_rename_on_event(void* context, SceneManagerEvent even
return consumed;
}
void xtreme_app_scene_misc_rename_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_rename_on_exit(void* context) {
MomentumApp* app = context;
text_input_reset(app->text_input);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexDarkMode,
@@ -13,20 +13,20 @@ enum VarItemListIndex {
VarItemListIndexRainbowSaturation,
};
void xtreme_app_scene_misc_screen_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_misc_screen_dark_mode_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_dark_mode_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.dark_mode = value;
momentum_settings.dark_mode = value;
app->save_settings = true;
}
static void xtreme_app_scene_misc_screen_hand_orient_changed(VariableItem* item) {
static void momentum_app_scene_misc_screen_hand_orient_changed(VariableItem* item) {
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
if(value) {
@@ -49,29 +49,29 @@ static const struct {
{"White", {255, 192, 203}},
};
static const size_t lcd_sz = COUNT_OF(lcd_colors);
static void xtreme_app_scene_misc_screen_lcd_color_changed(VariableItem* item, uint8_t led) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_lcd_color_changed(VariableItem* item, uint8_t led) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, lcd_colors[index].name);
rgb_backlight_set_color(led, &lcd_colors[index].color);
app->save_backlight = true;
}
static void xtreme_app_scene_misc_screen_lcd_color_0_changed(VariableItem* item) {
xtreme_app_scene_misc_screen_lcd_color_changed(item, 0);
static void momentum_app_scene_misc_screen_lcd_color_0_changed(VariableItem* item) {
momentum_app_scene_misc_screen_lcd_color_changed(item, 0);
}
static void xtreme_app_scene_misc_screen_lcd_color_1_changed(VariableItem* item) {
xtreme_app_scene_misc_screen_lcd_color_changed(item, 1);
static void momentum_app_scene_misc_screen_lcd_color_1_changed(VariableItem* item) {
momentum_app_scene_misc_screen_lcd_color_changed(item, 1);
}
static void xtreme_app_scene_misc_screen_lcd_color_2_changed(VariableItem* item) {
xtreme_app_scene_misc_screen_lcd_color_changed(item, 2);
static void momentum_app_scene_misc_screen_lcd_color_2_changed(VariableItem* item) {
momentum_app_scene_misc_screen_lcd_color_changed(item, 2);
}
static const struct {
uint8_t led;
VariableItemChangeCallback cb;
} lcd_cols[] = {
{0, xtreme_app_scene_misc_screen_lcd_color_0_changed},
{1, xtreme_app_scene_misc_screen_lcd_color_1_changed},
{2, xtreme_app_scene_misc_screen_lcd_color_2_changed},
{0, momentum_app_scene_misc_screen_lcd_color_0_changed},
{1, momentum_app_scene_misc_screen_lcd_color_1_changed},
{2, momentum_app_scene_misc_screen_lcd_color_2_changed},
};
const char* const rainbow_lcd_names[RGBBacklightRainbowModeCount] = {
@@ -79,16 +79,16 @@ const char* const rainbow_lcd_names[RGBBacklightRainbowModeCount] = {
"Wave",
"Static",
};
static void xtreme_app_scene_misc_screen_rainbow_lcd_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_rainbow_lcd_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, rainbow_lcd_names[index]);
rgb_backlight_set_rainbow_mode(index);
app->save_backlight = true;
}
static void xtreme_app_scene_misc_screen_rainbow_speed_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_rainbow_speed_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item) + 1;
char str[4];
snprintf(str, sizeof(str), "%d", index);
@@ -129,16 +129,16 @@ const uint32_t rainbow_interval_values[COUNT_OF(rainbow_interval_names)] = {
4000,
5000,
};
static void xtreme_app_scene_misc_screen_rainbow_interval_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_rainbow_interval_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, rainbow_interval_names[index]);
rgb_backlight_set_rainbow_interval(rainbow_interval_values[index]);
app->save_backlight = true;
}
static void xtreme_app_scene_misc_screen_rainbow_saturation_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_misc_screen_rainbow_saturation_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item) + 1;
char str[4];
snprintf(str, sizeof(str), "%d", index);
@@ -147,25 +147,25 @@ static void xtreme_app_scene_misc_screen_rainbow_saturation_changed(VariableItem
app->save_backlight = true;
}
void xtreme_app_scene_misc_screen_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
uint8_t value_index;
item = variable_item_list_add(
var_item_list, "Dark Mode", 2, xtreme_app_scene_misc_screen_dark_mode_changed, app);
variable_item_set_current_value_index(item, xtreme_settings.dark_mode);
variable_item_set_current_value_text(item, xtreme_settings.dark_mode ? "ON" : "OFF");
var_item_list, "Dark Mode", 2, momentum_app_scene_misc_screen_dark_mode_changed, app);
variable_item_set_current_value_index(item, momentum_settings.dark_mode);
variable_item_set_current_value_text(item, momentum_settings.dark_mode ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list, "Left Handed", 2, xtreme_app_scene_misc_screen_hand_orient_changed, app);
var_item_list, "Left Handed", 2, momentum_app_scene_misc_screen_hand_orient_changed, app);
bool value = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
variable_item_set_current_value_index(item, value);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "RGB Backlight", 1, NULL, app);
variable_item_set_current_value_text(item, xtreme_settings.rgb_backlight ? "ON" : "OFF");
variable_item_set_current_value_text(item, momentum_settings.rgb_backlight ? "ON" : "OFF");
RgbColor color;
for(size_t i = 0; i < COUNT_OF(lcd_cols); i++) {
@@ -188,38 +188,38 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
snprintf(str, sizeof(str), "%02X%02X%02X", color.r, color.g, color.b);
variable_item_set_current_value_text(item, str);
}
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !momentum_settings.rgb_backlight, "Needs RGB\nBacklight!");
}
item = variable_item_list_add(
var_item_list,
"Rainbow LCD",
RGBBacklightRainbowModeCount,
xtreme_app_scene_misc_screen_rainbow_lcd_changed,
momentum_app_scene_misc_screen_rainbow_lcd_changed,
app);
value_index = rgb_backlight_get_rainbow_mode();
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, rainbow_lcd_names[value_index]);
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !momentum_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
"Rainbow Speed",
25,
xtreme_app_scene_misc_screen_rainbow_speed_changed,
momentum_app_scene_misc_screen_rainbow_speed_changed,
app);
value_index = rgb_backlight_get_rainbow_speed();
variable_item_set_current_value_index(item, value_index - 1);
char speed_str[4];
snprintf(speed_str, sizeof(speed_str), "%d", value_index);
variable_item_set_current_value_text(item, speed_str);
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !momentum_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
"Rainbow Interval",
COUNT_OF(rainbow_interval_values),
xtreme_app_scene_misc_screen_rainbow_interval_changed,
momentum_app_scene_misc_screen_rainbow_interval_changed,
app);
value_index = value_index_uint32(
rgb_backlight_get_rainbow_interval(),
@@ -227,41 +227,41 @@ void xtreme_app_scene_misc_screen_on_enter(void* context) {
COUNT_OF(rainbow_interval_values));
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, rainbow_interval_names[value_index]);
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !momentum_settings.rgb_backlight, "Needs RGB\nBacklight!");
item = variable_item_list_add(
var_item_list,
"Rainbow Saturation",
255,
xtreme_app_scene_misc_screen_rainbow_saturation_changed,
momentum_app_scene_misc_screen_rainbow_saturation_changed,
app);
value_index = rgb_backlight_get_rainbow_saturation();
variable_item_set_current_value_index(item, value_index - 1);
char saturation_str[4];
snprintf(saturation_str, sizeof(saturation_str), "%d", value_index);
variable_item_set_current_value_text(item, saturation_str);
variable_item_set_locked(item, !xtreme_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_set_locked(item, !momentum_settings.rgb_backlight, "Needs RGB\nBacklight!");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_misc_screen_var_item_list_callback, app);
var_item_list, momentum_app_scene_misc_screen_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMiscScreen));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscScreen));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_misc_screen_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscScreen, event.event);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMiscScreen, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexRgbBacklight: {
bool change = xtreme_settings.rgb_backlight;
bool change = momentum_settings.rgb_backlight;
if(!change) {
DialogMessage* msg = dialog_message_alloc();
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
@@ -279,35 +279,35 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
dialog_message_free(msg);
}
if(change) {
xtreme_settings.rgb_backlight = !xtreme_settings.rgb_backlight;
momentum_settings.rgb_backlight = !momentum_settings.rgb_backlight;
app->save_settings = true;
app->save_backlight = true;
notification_message(app->notification, &sequence_display_backlight_on);
rgb_backlight_reconfigure(xtreme_settings.rgb_backlight);
rgb_backlight_reconfigure(momentum_settings.rgb_backlight);
variable_item_set_current_value_text(
variable_item_list_get(app->var_item_list, VarItemListIndexRgbBacklight),
xtreme_settings.rgb_backlight ? "ON" : "OFF");
momentum_settings.rgb_backlight ? "ON" : "OFF");
for(size_t i = 0; i < COUNT_OF(lcd_cols); i++) {
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexLcdColor0 + i),
!xtreme_settings.rgb_backlight,
!momentum_settings.rgb_backlight,
"Needs RGB\nBacklight!");
}
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexRainbowLcd),
!xtreme_settings.rgb_backlight,
!momentum_settings.rgb_backlight,
"Needs RGB\nBacklight!");
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexRainbowSpeed),
!xtreme_settings.rgb_backlight,
!momentum_settings.rgb_backlight,
"Needs RGB\nBacklight!");
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexRainbowInterval),
!xtreme_settings.rgb_backlight,
!momentum_settings.rgb_backlight,
"Needs RGB\nBacklight!");
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexRainbowSaturation),
!xtreme_settings.rgb_backlight,
!momentum_settings.rgb_backlight,
"Needs RGB\nBacklight!");
}
break;
@@ -317,9 +317,9 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
case VarItemListIndexLcdColor2:
scene_manager_set_scene_state(
app->scene_manager,
XtremeAppSceneMiscScreenColor,
MomentumAppSceneMiscScreenColor,
event.event - VarItemListIndexLcdColor0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreenColor);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMiscScreenColor);
break;
default:
break;
@@ -329,7 +329,7 @@ bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent even
return consumed;
}
void xtreme_app_scene_misc_screen_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,38 +1,38 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum ByteInputResult {
ByteInputResultOk,
};
void xtreme_app_scene_misc_screen_color_byte_input_callback(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_color_byte_input_callback(void* context) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, ByteInputResultOk);
}
void xtreme_app_scene_misc_screen_color_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_color_on_enter(void* context) {
MomentumApp* app = context;
ByteInput* byte_input = app->byte_input;
byte_input_set_header_text(byte_input, "Set LCD Color (#RRGGBB)");
rgb_backlight_get_color(
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMiscScreenColor),
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscScreenColor),
&app->lcd_color);
byte_input_set_result_callback(
byte_input,
xtreme_app_scene_misc_screen_color_byte_input_callback,
momentum_app_scene_misc_screen_color_byte_input_callback,
NULL,
app,
(void*)&app->lcd_color,
sizeof(app->lcd_color));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewByteInput);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewByteInput);
}
bool xtreme_app_scene_misc_screen_color_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_misc_screen_color_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
@@ -40,7 +40,7 @@ bool xtreme_app_scene_misc_screen_color_on_event(void* context, SceneManagerEven
switch(event.event) {
case ByteInputResultOk:
rgb_backlight_set_color(
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMiscScreenColor),
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneMiscScreenColor),
&app->lcd_color);
app->save_backlight = true;
scene_manager_previous_scene(app->scene_manager);
@@ -53,8 +53,8 @@ bool xtreme_app_scene_misc_screen_color_on_event(void* context, SceneManagerEven
return consumed;
}
void xtreme_app_scene_misc_screen_color_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_misc_screen_color_on_exit(void* context) {
MomentumApp* app = context;
byte_input_set_result_callback(app->byte_input, NULL, NULL, NULL, NULL, 0);
byte_input_set_header_text(app->byte_input, "");
}

View File

@@ -0,0 +1,124 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexBadkbMode,
VarItemListIndexBadbtRemember,
VarItemListIndexSubghzFreqs,
VarItemListIndexSubghzExtend,
VarItemListIndexGpioPins,
};
void momentum_app_scene_protocols_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void momentum_app_scene_protocols_bad_bt_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "BT" : "USB");
momentum_settings.bad_bt = value;
app->save_settings = true;
}
static void momentum_app_scene_protocols_bad_bt_remember_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
momentum_settings.bad_bt_remember = value;
app->save_settings = true;
}
static void momentum_app_scene_protocols_subghz_extend_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->subghz_extend = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
app->save_subghz = true;
}
static void momentum_app_scene_protocols_file_naming_prefix_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "After" : "Before");
momentum_settings.file_naming_prefix_after = value;
app->save_settings = true;
}
void momentum_app_scene_protocols_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list, "BadKB Mode", 2, momentum_app_scene_protocols_bad_bt_changed, app);
variable_item_set_current_value_index(item, momentum_settings.bad_bt);
variable_item_set_current_value_text(item, momentum_settings.bad_bt ? "BT" : "USB");
item = variable_item_list_add(
var_item_list,
"BadBT Remember",
2,
momentum_app_scene_protocols_bad_bt_remember_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.bad_bt_remember);
variable_item_set_current_value_text(item, momentum_settings.bad_bt_remember ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "SubGHz Freqs", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(
var_item_list, "SubGHz Extend", 2, momentum_app_scene_protocols_subghz_extend_changed, app);
variable_item_set_current_value_index(item, app->subghz_extend);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "GPIO Pins", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(
var_item_list,
"File Naming Prefix",
2,
momentum_app_scene_protocols_file_naming_prefix_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.file_naming_prefix_after);
variable_item_set_current_value_text(
item, momentum_settings.file_naming_prefix_after ? "After" : "Before");
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_protocols_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocols));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_protocols_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneProtocols, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexSubghzFreqs:
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneProtocolsFreqs, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsFreqs);
break;
case VarItemListIndexGpioPins:
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneProtocolsGpio, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsGpio);
break;
default:
break;
}
}
return consumed;
}
void momentum_app_scene_protocols_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexUseDefaults,
@@ -6,21 +6,21 @@ enum VarItemListIndex {
VarItemListIndexHopperFreqs,
};
void xtreme_app_scene_protocols_freqs_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_protocols_freqs_use_defaults_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_protocols_freqs_use_defaults_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
app->subghz_use_defaults = value;
app->save_subghz_freqs = true;
}
void xtreme_app_scene_protocols_freqs_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -28,7 +28,7 @@ void xtreme_app_scene_protocols_freqs_on_enter(void* context) {
var_item_list,
"Use Defaults",
2,
xtreme_app_scene_protocols_freqs_use_defaults_changed,
momentum_app_scene_protocols_freqs_use_defaults_changed,
app);
variable_item_set_current_value_index(item, app->subghz_use_defaults);
variable_item_set_current_value_text(item, app->subghz_use_defaults ? "ON" : "OFF");
@@ -40,33 +40,33 @@ void xtreme_app_scene_protocols_freqs_on_enter(void* context) {
variable_item_set_current_value_text(item, ">");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_freqs_var_item_list_callback, app);
var_item_list, momentum_app_scene_protocols_freqs_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFreqs));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocolsFreqs));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_protocols_freqs_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_protocols_freqs_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqs, event.event);
app->scene_manager, MomentumAppSceneProtocolsFreqs, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexStaticFreqs:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsStatic, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsFreqsStatic);
app->scene_manager, MomentumAppSceneProtocolsFreqsStatic, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsFreqsStatic);
break;
case VarItemListIndexHopperFreqs:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsHopper, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsFreqsHopper);
app->scene_manager, MomentumAppSceneProtocolsFreqsHopper, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsFreqsHopper);
break;
default:
break;
@@ -76,7 +76,7 @@ bool xtreme_app_scene_protocols_freqs_on_event(void* context, SceneManagerEvent
return consumed;
}
void xtreme_app_scene_protocols_freqs_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,12 +1,12 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum TextInputResult {
TextInputResultOk,
TextInputResultError,
};
static void xtreme_app_scene_protocols_freqs_add_text_input_callback(void* context) {
XtremeApp* app = context;
static void momentum_app_scene_protocols_freqs_add_text_input_callback(void* context) {
MomentumApp* app = context;
char* end;
uint32_t value = strtol(app->subghz_freq_buffer, &end, 0) * 1000;
@@ -15,7 +15,7 @@ static void xtreme_app_scene_protocols_freqs_add_text_input_callback(void* conte
return;
}
bool is_hopper =
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFreqsAdd);
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocolsFreqsAdd);
if(is_hopper) {
FrequencyList_push_back(app->subghz_hopper_freqs, value);
} else {
@@ -25,32 +25,32 @@ static void xtreme_app_scene_protocols_freqs_add_text_input_callback(void* conte
view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultOk);
}
void xtreme_app_scene_protocols_freqs_add_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_add_on_enter(void* context) {
MomentumApp* app = context;
TextInput* text_input = app->text_input;
text_input_set_header_text(text_input, "Ex: 123456 for 123.456 MHz");
strlcpy(app->subghz_freq_buffer, "", XTREME_SUBGHZ_FREQ_BUFFER_SIZE);
strlcpy(app->subghz_freq_buffer, "", sizeof(app->subghz_freq_buffer));
text_input_set_result_callback(
text_input,
xtreme_app_scene_protocols_freqs_add_text_input_callback,
momentum_app_scene_protocols_freqs_add_text_input_callback,
app,
app->subghz_freq_buffer,
XTREME_SUBGHZ_FREQ_BUFFER_SIZE,
sizeof(app->subghz_freq_buffer),
true);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewTextInput);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewTextInput);
}
void callback_return(void* context) {
XtremeApp* app = context;
MomentumApp* app = context;
scene_manager_previous_scene(app->scene_manager);
}
bool xtreme_app_scene_protocols_freqs_add_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_protocols_freqs_add_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
@@ -67,7 +67,7 @@ bool xtreme_app_scene_protocols_freqs_add_on_event(void* context, SceneManagerEv
popup_set_context(app->popup, app);
popup_set_timeout(app->popup, 1000);
popup_enable_timeout(app->popup);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewPopup);
break;
default:
break;
@@ -77,7 +77,7 @@ bool xtreme_app_scene_protocols_freqs_add_on_event(void* context, SceneManagerEv
return consumed;
}
void xtreme_app_scene_protocols_freqs_add_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_add_on_exit(void* context) {
MomentumApp* app = context;
text_input_reset(app->text_input);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexHopperFrequency,
@@ -6,13 +6,15 @@ enum VarItemListIndex {
VarItemListIndexAddHopperFreq,
};
void xtreme_app_scene_protocols_freqs_hopper_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_hopper_var_item_list_callback(
void* context,
uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_protocols_freqs_hopper_frequency_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_protocols_freqs_hopper_frequency_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->subghz_hopper_index = variable_item_get_current_value_index(item);
uint32_t value = *FrequencyList_get(app->subghz_hopper_freqs, app->subghz_hopper_index);
char text[10] = {0};
@@ -20,8 +22,8 @@ static void xtreme_app_scene_protocols_freqs_hopper_frequency_changed(VariableIt
variable_item_set_current_value_text(item, text);
}
void xtreme_app_scene_protocols_freqs_hopper_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_hopper_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -29,7 +31,7 @@ void xtreme_app_scene_protocols_freqs_hopper_on_enter(void* context) {
var_item_list,
"Hopper Freq",
FrequencyList_size(app->subghz_hopper_freqs),
xtreme_app_scene_protocols_freqs_hopper_frequency_changed,
momentum_app_scene_protocols_freqs_hopper_frequency_changed,
app);
app->subghz_hopper_index = 0;
variable_item_set_current_value_index(item, app->subghz_hopper_index);
@@ -47,22 +49,22 @@ void xtreme_app_scene_protocols_freqs_hopper_on_enter(void* context) {
variable_item_list_add(var_item_list, "Add Hopper Freq", 0, NULL, app);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_freqs_hopper_var_item_list_callback, app);
var_item_list, momentum_app_scene_protocols_freqs_hopper_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFreqsHopper));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocolsFreqsHopper));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_protocols_freqs_hopper_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_protocols_freqs_hopper_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsHopper, event.event);
app->scene_manager, MomentumAppSceneProtocolsFreqsHopper, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexRemoveHopperFreq:
@@ -100,8 +102,8 @@ bool xtreme_app_scene_protocols_freqs_hopper_on_event(void* context, SceneManage
break;
case VarItemListIndexAddHopperFreq:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsAdd, true);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsFreqsAdd);
app->scene_manager, MomentumAppSceneProtocolsFreqsAdd, true);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsFreqsAdd);
break;
default:
break;
@@ -111,7 +113,7 @@ bool xtreme_app_scene_protocols_freqs_hopper_on_event(void* context, SceneManage
return consumed;
}
void xtreme_app_scene_protocols_freqs_hopper_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_hopper_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexStaticFrequency,
@@ -6,13 +6,15 @@ enum VarItemListIndex {
VarItemListIndexAddStaticFreq,
};
void xtreme_app_scene_protocols_freqs_static_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_static_var_item_list_callback(
void* context,
uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_protocols_freqs_static_frequency_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
static void momentum_app_scene_protocols_freqs_static_frequency_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
app->subghz_static_index = variable_item_get_current_value_index(item);
uint32_t value = *FrequencyList_get(app->subghz_static_freqs, app->subghz_static_index);
char text[10] = {0};
@@ -20,8 +22,8 @@ static void xtreme_app_scene_protocols_freqs_static_frequency_changed(VariableIt
variable_item_set_current_value_text(item, text);
}
void xtreme_app_scene_protocols_freqs_static_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_static_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -29,7 +31,7 @@ void xtreme_app_scene_protocols_freqs_static_on_enter(void* context) {
var_item_list,
"Static Freq",
FrequencyList_size(app->subghz_static_freqs),
xtreme_app_scene_protocols_freqs_static_frequency_changed,
momentum_app_scene_protocols_freqs_static_frequency_changed,
app);
app->subghz_static_index = 0;
variable_item_set_current_value_index(item, app->subghz_static_index);
@@ -47,22 +49,22 @@ void xtreme_app_scene_protocols_freqs_static_on_enter(void* context) {
variable_item_list_add(var_item_list, "Add Static Freq", 0, NULL, app);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_freqs_static_var_item_list_callback, app);
var_item_list, momentum_app_scene_protocols_freqs_static_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsFreqsStatic));
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocolsFreqsStatic));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_protocols_freqs_static_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_protocols_freqs_static_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsStatic, event.event);
app->scene_manager, MomentumAppSceneProtocolsFreqsStatic, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexRemoveStaticFreq:
@@ -100,8 +102,8 @@ bool xtreme_app_scene_protocols_freqs_static_on_event(void* context, SceneManage
break;
case VarItemListIndexAddStaticFreq:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsFreqsAdd, false);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsFreqsAdd);
app->scene_manager, MomentumAppSceneProtocolsFreqsAdd, false);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocolsFreqsAdd);
break;
default:
break;
@@ -111,7 +113,7 @@ bool xtreme_app_scene_protocols_freqs_static_on_event(void* context, SceneManage
return consumed;
}
void xtreme_app_scene_protocols_freqs_static_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_protocols_freqs_static_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -0,0 +1,158 @@
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexSpiCc1101Handle,
VarItemListIndexSpiNrf24Handle,
VarItemListIndexUartEspChannel,
VarItemListIndexUartNmeaChannel,
VarItemListIndexUartGeneralChannel,
};
#define SPI_DEFAULT "Default 4"
#define SPI_EXTRA "Extra 7"
#define UART_DEFAULT "Default 13,14"
#define UART_EXTRA "Extra 15,16"
void momentum_app_scene_protocols_gpio_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void momentum_app_scene_protocols_gpio_cc1101_handle_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
momentum_settings.spi_cc1101_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, momentum_settings.spi_cc1101_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
app->save_settings = true;
}
static void momentum_app_scene_protocols_gpio_nrf24_handle_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
momentum_settings.spi_nrf24_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, momentum_settings.spi_nrf24_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
app->save_settings = true;
}
static void momentum_app_scene_protocols_gpio_esp32_channel_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
momentum_settings.uart_esp_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
momentum_settings.uart_esp_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
app->save_settings = true;
}
static void momentum_app_scene_protocols_gpio_nmea_channel_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
momentum_settings.uart_nmea_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
momentum_settings.uart_nmea_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
app->save_settings = true;
}
static void momentum_app_scene_protocols_gpio_general_channel_changed(VariableItem* item) {
MomentumApp* app = variable_item_get_context(item);
momentum_settings.uart_general_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
momentum_settings.uart_general_channel == FuriHalSerialIdUsart ? UART_DEFAULT :
UART_EXTRA);
app->save_settings = true;
}
void momentum_app_scene_protocols_gpio_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"CC1101 SPI",
2,
momentum_app_scene_protocols_gpio_cc1101_handle_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.spi_cc1101_handle);
variable_item_set_current_value_text(
item, momentum_settings.spi_cc1101_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
item = variable_item_list_add(
var_item_list, "NRF24 SPI", 2, momentum_app_scene_protocols_gpio_nrf24_handle_changed, app);
variable_item_set_current_value_index(item, momentum_settings.spi_nrf24_handle);
variable_item_set_current_value_text(
item, momentum_settings.spi_nrf24_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
item = variable_item_list_add(
var_item_list,
"ESP32/8266 UART",
2,
momentum_app_scene_protocols_gpio_esp32_channel_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.uart_esp_channel);
variable_item_set_current_value_text(
item,
momentum_settings.uart_esp_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
item = variable_item_list_add(
var_item_list,
"NMEA GPS UART",
2,
momentum_app_scene_protocols_gpio_nmea_channel_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.uart_nmea_channel);
variable_item_set_current_value_text(
item,
momentum_settings.uart_nmea_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
item = variable_item_list_add(
var_item_list,
"General UART",
2,
momentum_app_scene_protocols_gpio_general_channel_changed,
app);
variable_item_set_current_value_index(item, momentum_settings.uart_general_channel);
variable_item_set_current_value_text(
item,
momentum_settings.uart_general_channel == FuriHalSerialIdUsart ? UART_DEFAULT :
UART_EXTRA);
variable_item_list_set_enter_callback(
var_item_list, momentum_app_scene_protocols_gpio_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneProtocolsGpio));
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool momentum_app_scene_protocols_gpio_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, MomentumAppSceneProtocolsGpio, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void momentum_app_scene_protocols_gpio_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,4 +1,4 @@
#include "../xtreme_app.h"
#include "../momentum_app.h"
enum VarItemListIndex {
VarItemListIndexInterface,
@@ -6,13 +6,13 @@ enum VarItemListIndex {
VarItemListIndexMisc,
};
void xtreme_app_scene_start_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
void momentum_app_scene_start_var_item_list_callback(void* context, uint32_t index) {
MomentumApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
void xtreme_app_scene_start_on_enter(void* context) {
XtremeApp* app = context;
void momentum_app_scene_start_on_enter(void* context) {
MomentumApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
@@ -28,33 +28,33 @@ void xtreme_app_scene_start_on_enter(void* context) {
variable_item_list_set_header(var_item_list, furi_string_get_cstr(app->version_tag));
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_start_var_item_list_callback, app);
var_item_list, momentum_app_scene_start_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneStart));
var_item_list, scene_manager_get_scene_state(app->scene_manager, MomentumAppSceneStart));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewVarItemList);
}
bool xtreme_app_scene_start_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool momentum_app_scene_start_on_event(void* context, SceneManagerEvent event) {
MomentumApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneStart, event.event);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneStart, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexInterface:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterface, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterface);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneInterface, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneInterface);
break;
case VarItemListIndexProtocols:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneProtocols, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocols);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneProtocols, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneProtocols);
break;
case VarItemListIndexMisc:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMisc, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMisc);
scene_manager_set_scene_state(app->scene_manager, MomentumAppSceneMisc, 0);
scene_manager_next_scene(app->scene_manager, MomentumAppSceneMisc);
break;
default:
break;
@@ -64,7 +64,7 @@ bool xtreme_app_scene_start_on_event(void* context, SceneManagerEvent event) {
return consumed;
}
void xtreme_app_scene_start_on_exit(void* context) {
XtremeApp* app = context;
void momentum_app_scene_start_on_exit(void* context) {
MomentumApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -2,7 +2,7 @@
#include "nfc_app_i.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
FuriTimer* timer_auto_exit = NULL;
@@ -22,7 +22,8 @@ void nfc_scene_emulate_on_enter(void* context) {
timer_auto_exit =
furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
furi_timer_start(
timer_auto_exit, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
timer_auto_exit,
momentum_settings.favorite_timeout * furi_kernel_get_tick_frequency());
}
}

View File

@@ -1,8 +1,8 @@
#include <furi_hal.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <expansion/expansion.h>
#define UART_CH (xtreme_settings.uart_nmea_channel)
#define UART_CH (momentum_settings.uart_nmea_channel)
#define RX_BUF_SIZE 1024

View File

@@ -1,10 +1,10 @@
#Sub-Ghz Frequencies in Xtreme
#Sub-Ghz Frequencies in Momentum
Officially supported frequencies: 300-350 MHz, 387-467.75 MHz, and 779-928 MHz (from [CC1101 chip docs](https://www.ti.com/product/CC1101))<br>
Unofficially supported frequencies: 281-361 MHz, 378-481 MHz, and 749-962 MHz (from [YARD Stick One/CC1111 Docs](https://greatscottgadgets.com/yardstickone/))
Currently no other Flipper firmware allows anything outside of the officially supported CC1101 specs without editing files that get overwritten with every update.
Xtreme has these options easily togglable in the Xtreme Settings app.
Momentum has these options easily togglable in the Momentum Settings app.
**NOTE: Operating outside supported frequencies can damage your amp and may not provide the same results as supported frequencies.<br>
Please understand what you're doing if you transmit on unsupported frequencies as medical devices are licensed to operate there.**

View File

@@ -1,7 +1,7 @@
#include "../subghz_i.h"
#include "../views/transmitter.h"
#include <dolphin/dolphin.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <lib/subghz/blocks/custom_btn.h>
@@ -75,7 +75,7 @@ void subghz_scene_transmitter_on_enter(void* context) {
scene_manager_handle_custom_event(
subghz->scene_manager, SubGhzCustomEventViewTransmitterSendStart);
furi_timer_start(
subghz->timer, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
subghz->timer, momentum_settings.favorite_timeout * furi_kernel_get_tick_frequency());
}
}

View File

@@ -6,7 +6,7 @@
#include <float_tools.h>
#include "subghz_i.h"
#include <applications/main/archive/helpers/archive_helpers_ext.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "subghz_fap.h"
@@ -380,7 +380,7 @@ int32_t subghz_app(char* p) {
}
// Check argument and run corresponding scene
bool is_favorite = process_favorite_launch(&p) && xtreme_settings.favorite_timeout;
bool is_favorite = process_favorite_launch(&p) && momentum_settings.favorite_timeout;
if(p && strlen(p)) {
uint32_t rpc_ctx = 0;

View File

@@ -1,5 +1,5 @@
#include "../u2f_app_i.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
static void u2f_scene_error_event_callback(GuiButtonType result, InputType type, void* context) {
furi_assert(context);

View File

@@ -9,8 +9,6 @@ extern "C" {
#define U2F_DATA_FOLDER EXT_PATH("u2f/")
#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
#define U2F_CNT_OLD_FILE INT_PATH(".cnt.u2f")
#define U2F_KEY_OLD_FILE U2F_DATA_FOLDER "key.u2f"
#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f"
#define U2F_KEY_FILE INT_PATH(".key.u2f")

View File

@@ -1,7 +1,7 @@
#include "u2f_view.h"
#include <gui/elements.h>
#include <assets_icons.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
struct U2fView {
View* view;
@@ -21,56 +21,26 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) {
if(model->display_msg == U2fMsgNotConnected) {
canvas_draw_icon(canvas, 22, 15, &I_Connect_me_62x31);
if(xtreme_assets.is_nsfw) {
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Plug me in d-daddy");
} else {
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connect to a device");
}
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connect to a device");
} else if(model->display_msg == U2fMsgIdle) {
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connected!");
} else if(model->display_msg == U2fMsgRegister) {
if(xtreme_assets.is_nsfw) {
elements_button_center(canvas, "CUM");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press CUM to register");
} else {
elements_button_center(canvas, "OK");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to register");
}
elements_button_center(canvas, "OK");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to register");
} else if(model->display_msg == U2fMsgAuth) {
if(xtreme_assets.is_nsfw) {
elements_button_center(canvas, "CUM");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press CUM to authenticate");
} else {
elements_button_center(canvas, "OK");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to authenticate");
}
elements_button_center(canvas, "OK");
canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31);
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press OK to authenticate");
} else if(model->display_msg == U2fMsgSuccess) {
canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31);
if(xtreme_assets.is_nsfw) {
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Cum released~");
} else {
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Authentication successful!");
}
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Authentication successful!");
} else if(model->display_msg == U2fMsgError) {
canvas_draw_icon(canvas, 22, 15, &I_Error_62x31);
if(xtreme_assets.is_nsfw) {
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Unable to cum");
} else {
canvas_draw_str_aligned(
canvas, 128 / 2, 3, AlignCenter, AlignTop, "Certificate error");
}
canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Certificate error");
}
}

View File

@@ -1,30 +0,0 @@
#include "xtreme_app_scene.h"
// Generate scene on_enter handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
void (*const xtreme_app_on_enter_handlers[])(void*) = {
#include "xtreme_app_scene_config.h"
};
#undef ADD_SCENE
// Generate scene on_event handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
bool (*const xtreme_app_on_event_handlers[])(void* context, SceneManagerEvent event) = {
#include "xtreme_app_scene_config.h"
};
#undef ADD_SCENE
// Generate scene on_exit handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
void (*const xtreme_app_on_exit_handlers[])(void* context) = {
#include "xtreme_app_scene_config.h"
};
#undef ADD_SCENE
// Initialize scene handlers configuration structure
const SceneManagerHandlers xtreme_app_scene_handlers = {
.on_enter_handlers = xtreme_app_on_enter_handlers,
.on_event_handlers = xtreme_app_on_event_handlers,
.on_exit_handlers = xtreme_app_on_exit_handlers,
.scene_num = XtremeAppSceneNum,
};

View File

@@ -1,21 +0,0 @@
ADD_SCENE(xtreme_app, start, Start)
ADD_SCENE(xtreme_app, interface, Interface)
ADD_SCENE(xtreme_app, interface_graphics, InterfaceGraphics)
ADD_SCENE(xtreme_app, interface_mainmenu, InterfaceMainmenu)
ADD_SCENE(xtreme_app, interface_mainmenu_add, InterfaceMainmenuAdd)
ADD_SCENE(xtreme_app, interface_mainmenu_add_main, InterfaceMainmenuAddMain)
ADD_SCENE(xtreme_app, interface_mainmenu_reset, InterfaceMainmenuReset)
ADD_SCENE(xtreme_app, interface_lockscreen, InterfaceLockscreen)
ADD_SCENE(xtreme_app, interface_statusbar, InterfaceStatusbar)
ADD_SCENE(xtreme_app, interface_filebrowser, InterfaceFilebrowser)
ADD_SCENE(xtreme_app, protocols, Protocols)
ADD_SCENE(xtreme_app, protocols_freqs, ProtocolsFreqs)
ADD_SCENE(xtreme_app, protocols_freqs_static, ProtocolsFreqsStatic)
ADD_SCENE(xtreme_app, protocols_freqs_hopper, ProtocolsFreqsHopper)
ADD_SCENE(xtreme_app, protocols_freqs_add, ProtocolsFreqsAdd)
ADD_SCENE(xtreme_app, protocols_gpio, ProtocolsGpio)
ADD_SCENE(xtreme_app, misc, Misc)
ADD_SCENE(xtreme_app, misc_screen, MiscScreen)
ADD_SCENE(xtreme_app, misc_screen_color, MiscScreenColor)
ADD_SCENE(xtreme_app, misc_dolphin, MiscDolphin)
ADD_SCENE(xtreme_app, misc_rename, MiscRename)

View File

@@ -1,86 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexGraphics,
VarItemListIndexMainmenu,
VarItemListIndexLockscreen,
VarItemListIndexStatusbar,
VarItemListIndexFileBrowser,
};
void xtreme_app_scene_interface_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
void xtreme_app_scene_interface_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(var_item_list, "Graphics", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Mainmenu", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Lockscreen", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "Statusbar", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(var_item_list, "File Browser", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterface));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_interface_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterface, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexGraphics:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceGraphics, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceGraphics);
break;
case VarItemListIndexMainmenu:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceMainmenu, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenu);
break;
case VarItemListIndexLockscreen:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceLockscreen, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceLockscreen);
break;
case VarItemListIndexStatusbar:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceStatusbar, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceStatusbar);
break;
case VarItemListIndexFileBrowser:
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceFilebrowser, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceFilebrowser);
break;
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_interface_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,122 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexSortDirsFirst,
VarItemListIndexShowHiddenFiles,
VarItemListIndexShowInternalTab,
VarItemListIndexFavoriteTimeout,
};
void xtreme_app_scene_interface_filebrowser_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_interface_filebrowser_sort_dirs_first_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.sort_dirs_first = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_filebrowser_show_hidden_files_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.show_hidden_files = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_filebrowser_show_internal_tab_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.show_internal_tab = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_filebrowser_favorite_timeout_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
uint32_t value = variable_item_get_current_value_index(item);
char text[6];
snprintf(text, sizeof(text), "%lu S", value);
variable_item_set_current_value_text(item, value ? text : "OFF");
xtreme_settings.favorite_timeout = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_filebrowser_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Folders Above Files",
2,
xtreme_app_scene_interface_filebrowser_sort_dirs_first_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.sort_dirs_first);
variable_item_set_current_value_text(item, xtreme_settings.sort_dirs_first ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Hidden Files",
2,
xtreme_app_scene_interface_filebrowser_show_hidden_files_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.show_hidden_files);
variable_item_set_current_value_text(item, xtreme_settings.show_hidden_files ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Internal Tab",
2,
xtreme_app_scene_interface_filebrowser_show_internal_tab_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.show_internal_tab);
variable_item_set_current_value_text(item, xtreme_settings.show_internal_tab ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Favorite Timeout",
61,
xtreme_app_scene_interface_filebrowser_favorite_timeout_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.favorite_timeout);
char text[4];
snprintf(text, sizeof(text), "%lu S", xtreme_settings.favorite_timeout);
variable_item_set_current_value_text(item, xtreme_settings.favorite_timeout ? text : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_filebrowser_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceFilebrowser));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_interface_filebrowser_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceFilebrowser, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_interface_filebrowser_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,230 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexLockOnBoot,
VarItemListIndexFormatOn10BadPins,
VarItemListIndexPinUnlockFromApp,
VarItemListIndexShowTime,
VarItemListIndexShowSeconds,
VarItemListIndexShowDate,
VarItemListIndexShowStatusbar,
VarItemListIndexUnlockPrompt,
};
void xtreme_app_scene_interface_lockscreen_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_interface_lockscreen_lock_on_boot_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lock_on_boot = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_bad_pins_format_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.bad_pins_format = value;
app->save_settings = true;
}
static void
xtreme_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.allow_locked_rpc_commands = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_lockscreen_poweroff_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_poweroff = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_lockscreen_time_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_time = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_lockscreen_seconds_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_seconds = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_lockscreen_date_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_date = value;
app->save_settings = true;
}
static void
xtreme_app_scene_interface_lockscreen_lockscreen_statusbar_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_statusbar = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_lockscreen_lockscreen_prompt_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_prompt = value;
app->save_settings = true;
}
static void
xtreme_app_scene_interface_lockscreen_lockscreen_transparent_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.lockscreen_transparent = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Lock on Boot",
2,
xtreme_app_scene_interface_lockscreen_lock_on_boot_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lock_on_boot);
variable_item_set_current_value_text(item, xtreme_settings.lock_on_boot ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Format on 10 Bad PINs",
2,
xtreme_app_scene_interface_lockscreen_bad_pins_format_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.bad_pins_format);
variable_item_set_current_value_text(item, xtreme_settings.bad_pins_format ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Allow RPC While Locked",
2,
xtreme_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.allow_locked_rpc_commands);
variable_item_set_current_value_text(
item, xtreme_settings.allow_locked_rpc_commands ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Allow Poweroff",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_poweroff_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_poweroff);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_poweroff ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Time",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_time_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_time);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_time ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Seconds",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_seconds_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_seconds);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_seconds ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Date",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_date_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_date);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_date ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Show Statusbar",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_statusbar_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_statusbar);
variable_item_set_current_value_text(
item, xtreme_settings.lockscreen_statusbar ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Unlock Prompt",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_prompt_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_prompt);
variable_item_set_current_value_text(item, xtreme_settings.lockscreen_prompt ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Transparent (see animation)",
2,
xtreme_app_scene_interface_lockscreen_lockscreen_transparent_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.lockscreen_transparent);
variable_item_set_current_value_text(
item, xtreme_settings.lockscreen_transparent ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_lockscreen_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceLockscreen));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_interface_lockscreen_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceLockscreen, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_interface_lockscreen_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,147 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexBatteryIcon,
VarItemListIndexShowClock,
VarItemListIndexStatusIcons,
VarItemListIndexBarBorders,
VarItemListIndexBarBackground,
};
void xtreme_app_scene_interface_statusbar_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
const char* const battery_icon_names[BatteryIconCount] = {
"OFF",
"Bar",
"%",
"Inv. %",
"Retro 3",
"Retro 5",
"Bar %",
};
static void xtreme_app_scene_interface_statusbar_battery_icon_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, battery_icon_names[index]);
xtreme_settings.battery_icon = index;
app->save_settings = true;
power_set_battery_icon_enabled(furi_record_open(RECORD_POWER), index != BatteryIconOff);
furi_record_close(RECORD_POWER);
}
static void xtreme_app_scene_interface_statusbar_statusbar_clock_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.statusbar_clock = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_statusbar_status_icons_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.status_icons = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_statusbar_bar_borders_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.bar_borders = value;
app->save_settings = true;
}
static void xtreme_app_scene_interface_statusbar_bar_background_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.bar_background = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_statusbar_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list,
"Battery Icon",
BatteryIconCount,
xtreme_app_scene_interface_statusbar_battery_icon_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.battery_icon);
variable_item_set_current_value_text(item, battery_icon_names[xtreme_settings.battery_icon]);
item = variable_item_list_add(
var_item_list,
"Show Clock",
2,
xtreme_app_scene_interface_statusbar_statusbar_clock_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.statusbar_clock);
variable_item_set_current_value_text(item, xtreme_settings.statusbar_clock ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Status Icons",
2,
xtreme_app_scene_interface_statusbar_status_icons_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.status_icons);
variable_item_set_current_value_text(item, xtreme_settings.status_icons ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Bar Borders",
2,
xtreme_app_scene_interface_statusbar_bar_borders_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.bar_borders);
variable_item_set_current_value_text(item, xtreme_settings.bar_borders ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Bar Background",
2,
xtreme_app_scene_interface_statusbar_bar_background_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.bar_background);
variable_item_set_current_value_text(item, xtreme_settings.bar_background ? "ON" : "OFF");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_statusbar_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneInterfaceStatusbar));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_interface_statusbar_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneInterfaceStatusbar, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_interface_statusbar_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,123 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexBadkbMode,
VarItemListIndexBadbtRemember,
VarItemListIndexSubghzFreqs,
VarItemListIndexSubghzExtend,
VarItemListIndexGpioPins,
};
void xtreme_app_scene_protocols_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_protocols_bad_bt_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "BT" : "USB");
xtreme_settings.bad_bt = value;
app->save_settings = true;
}
static void xtreme_app_scene_protocols_bad_bt_remember_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.bad_bt_remember = value;
app->save_settings = true;
}
static void xtreme_app_scene_protocols_subghz_extend_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
app->subghz_extend = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
app->save_subghz = true;
}
static void xtreme_app_scene_protocols_file_naming_prefix_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "After" : "Before");
xtreme_settings.file_naming_prefix_after = value;
app->save_settings = true;
}
void xtreme_app_scene_protocols_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list, "BadKB Mode", 2, xtreme_app_scene_protocols_bad_bt_changed, app);
variable_item_set_current_value_index(item, xtreme_settings.bad_bt);
variable_item_set_current_value_text(item, xtreme_settings.bad_bt ? "BT" : "USB");
item = variable_item_list_add(
var_item_list,
"BadBT Remember",
2,
xtreme_app_scene_protocols_bad_bt_remember_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.bad_bt_remember);
variable_item_set_current_value_text(item, xtreme_settings.bad_bt_remember ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "SubGHz Freqs", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(
var_item_list, "SubGHz Extend", 2, xtreme_app_scene_protocols_subghz_extend_changed, app);
variable_item_set_current_value_index(item, app->subghz_extend);
variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF");
item = variable_item_list_add(var_item_list, "GPIO Pins", 0, NULL, app);
variable_item_set_current_value_text(item, ">");
item = variable_item_list_add(
var_item_list,
"File Naming Prefix",
2,
xtreme_app_scene_protocols_file_naming_prefix_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.file_naming_prefix_after);
variable_item_set_current_value_text(
item, xtreme_settings.file_naming_prefix_after ? "After" : "Before");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list, scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocols));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_protocols_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneProtocols, event.event);
consumed = true;
switch(event.event) {
case VarItemListIndexSubghzFreqs:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneProtocolsFreqs, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsFreqs);
break;
case VarItemListIndexGpioPins:
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneProtocolsGpio, 0);
scene_manager_next_scene(app->scene_manager, XtremeAppSceneProtocolsGpio);
break;
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_protocols_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -1,152 +0,0 @@
#include "../xtreme_app.h"
enum VarItemListIndex {
VarItemListIndexSpiCc1101Handle,
VarItemListIndexSpiNrf24Handle,
VarItemListIndexUartEspChannel,
VarItemListIndexUartNmeaChannel,
VarItemListIndexUartGeneralChannel,
};
#define SPI_DEFAULT "Default 4"
#define SPI_EXTRA "Extra 7"
#define UART_DEFAULT "Default 13,14"
#define UART_EXTRA "Extra 15,16"
void xtreme_app_scene_protocols_gpio_var_item_list_callback(void* context, uint32_t index) {
XtremeApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}
static void xtreme_app_scene_protocols_gpio_cc1101_handle_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
xtreme_settings.spi_cc1101_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, xtreme_settings.spi_cc1101_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_nrf24_handle_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
xtreme_settings.spi_nrf24_handle =
variable_item_get_current_value_index(item) == 0 ? SpiDefault : SpiExtra;
variable_item_set_current_value_text(
item, xtreme_settings.spi_nrf24_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_esp32_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
xtreme_settings.uart_esp_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
xtreme_settings.uart_esp_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_nmea_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
xtreme_settings.uart_nmea_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
xtreme_settings.uart_nmea_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
app->save_settings = true;
}
static void xtreme_app_scene_protocols_gpio_general_channel_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
xtreme_settings.uart_general_channel = variable_item_get_current_value_index(item) == 0 ?
FuriHalSerialIdUsart :
FuriHalSerialIdLpuart;
variable_item_set_current_value_text(
item,
xtreme_settings.uart_general_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
app->save_settings = true;
}
void xtreme_app_scene_protocols_gpio_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
VariableItem* item;
item = variable_item_list_add(
var_item_list, "CC1101 SPI", 2, xtreme_app_scene_protocols_gpio_cc1101_handle_changed, app);
variable_item_set_current_value_index(item, xtreme_settings.spi_cc1101_handle);
variable_item_set_current_value_text(
item, xtreme_settings.spi_cc1101_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
item = variable_item_list_add(
var_item_list, "NRF24 SPI", 2, xtreme_app_scene_protocols_gpio_nrf24_handle_changed, app);
variable_item_set_current_value_index(item, xtreme_settings.spi_nrf24_handle);
variable_item_set_current_value_text(
item, xtreme_settings.spi_nrf24_handle == SpiDefault ? SPI_DEFAULT : SPI_EXTRA);
item = variable_item_list_add(
var_item_list,
"ESP32/8266 UART",
2,
xtreme_app_scene_protocols_gpio_esp32_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.uart_esp_channel);
variable_item_set_current_value_text(
item,
xtreme_settings.uart_esp_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
item = variable_item_list_add(
var_item_list,
"NMEA GPS UART",
2,
xtreme_app_scene_protocols_gpio_nmea_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.uart_nmea_channel);
variable_item_set_current_value_text(
item,
xtreme_settings.uart_nmea_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
item = variable_item_list_add(
var_item_list,
"General UART",
2,
xtreme_app_scene_protocols_gpio_general_channel_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.uart_general_channel);
variable_item_set_current_value_text(
item,
xtreme_settings.uart_general_channel == FuriHalSerialIdUsart ? UART_DEFAULT : UART_EXTRA);
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_protocols_gpio_var_item_list_callback, app);
variable_item_list_set_selected_item(
var_item_list,
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneProtocolsGpio));
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
}
bool xtreme_app_scene_protocols_gpio_on_event(void* context, SceneManagerEvent event) {
XtremeApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
scene_manager_set_scene_state(
app->scene_manager, XtremeAppSceneProtocolsGpio, event.event);
consumed = true;
switch(event.event) {
default:
break;
}
}
return consumed;
}
void xtreme_app_scene_protocols_gpio_on_exit(void* context) {
XtremeApp* app = context;
variable_item_list_reset(app->var_item_list);
}

View File

@@ -86,17 +86,16 @@ void bt_keys_storage_set_default_path(Bt* bt);
bool bt_remote_rssi(Bt* bt, uint8_t* rssi);
/**
*
* (Probably bad) way of opening the RPC connection, everywhereTM
*/
/** Open a new RPC connection
*
* @param bt Bt instance
*/
void bt_open_rpc_connection(Bt* bt);
/**
*
* Closing the RPC connection, everywhereTM
*/
/** Close the active RPC connection
*
* @param bt Bt instance
*/
void bt_close_rpc_connection(Bt* bt);
#ifdef __cplusplus

View File

@@ -19,7 +19,6 @@
#include <bt/bt_settings.h>
#include <bt/bt_service/bt_keys_storage.h>
#define BT_KEYS_STORAGE_OLD_PATH INT_PATH(".bt.keys")
#define BT_KEYS_STORAGE_PATH CFG_PATH("bt.keys")
typedef enum {

View File

@@ -7,7 +7,6 @@
extern "C" {
#endif
#define BT_SETTINGS_OLD_PATH INT_PATH(".bt.settings")
#define BT_SETTINGS_PATH CFG_PATH("bt.settings")
typedef struct {

View File

@@ -103,18 +103,26 @@ void cli_print_usage(const char* cmd, const char* usage, const char* arg) {
}
void cli_motd() {
printf(
"\033[0m\r\n"
" ,-' \\_/ `\\\r\n"
"\033[1;31m__\033[0m \033[1;31m__\033[37m_\033[0m ___ ___ ___ ( , |\r\n"
"\033[1;31m\\\033[0m \033[1;31m\\/\033[0m \033[1;31m/\033[0m \033[1m|_ _ __ ___ _ __ ___ ___\033[0m / ___| | |_ _| `-.-'`-.-'/|_|\r\n"
" \033[1;31m\\\033[0m \033[1;31m/\033[37m| __| \'__/ _ \\ \'_ ` _ \\ / _ \\\033[0m | | | | | | \\ / | |\r\n"
" \033[1;31m/\033[0m \033[1;31m\\\033[37m| |_| | | __/ | | | | | __/\033[0m | |___| |___ | | |=[]=: / ,'\r\n"
"\033[1;31m/_/\\_\\\033[37m\\__|_| \\___|_| |_| |_|\\___|\033[0m \\____|_____|___| / `\\ '\r\n"
" : \\/ )\r\n"
"Welcome to the \033[1;31mX\033[37mtreme\033[0m Command Line Interface! | / ;\r\n"
"Visit \033[1;31mhttps://flipper-xtre.me/\033[0m for even more fun | / /"
"\r\n");
printf("\r\n"
" _.-------.._ -,\r\n"
" .-\"```\"--..,,_/ /`-, -, \\ \r\n"
" .:\" /:/ /'\\ \\ ,_..., `. | |\r\n"
" / ,----/:/ /`\\ _\\~`_-\"` _;\r\n"
" ' / /`\"\"\"'\\ \\ \\.~`_-' ,-\"'/ \r\n"
" | | | 0 | | .-' ,/` /\r\n"
" | ,..\\ \\ ,.-\"` ,/` /\r\n"
" ; : `/`\"\"\\` ,/--==,/-----,\r\n"
" | `-...| -.___-Z:_______J...---;\r\n"
" : ` _-'\r\n"
" _L_ _ ___ ___ ___ ___ ____--\"`___ _ ___\r\n"
"| __|| | |_ _|| _ \\| _ \\| __|| _ \\ / __|| | |_ _|\r\n"
"| _| | |__ | | | _/| _/| _| | / | (__ | |__ | |\r\n"
"|_| |____||___||_| |_| |___||_|_\\ \\___||____||___|\r\n"
"\r\n"
"Welcome to Flipper Zero Command Line Interface!\r\n"
"Read the manual: https://docs.flipper.net/development/cli\r\n"
"Run `help` or `?` to list available commands\r\n"
"\r\n");
const Version* firmware_version = furi_hal_version_get_firmware_version();
if(firmware_version) {

View File

@@ -174,7 +174,7 @@ void cli_command_src(Cli* cli, FuriString* args, void* context) {
UNUSED(args);
UNUSED(context);
printf("https://github.com/Flipper-XFW/Xtreme-Firmware");
printf("https://github.com/Next-Flip/Momentum-Firmware");
}
#define CLI_COMMAND_LOG_RING_SIZE 2048

View File

@@ -13,14 +13,13 @@
#include "animation_storage.h"
#include "animation_manager.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define TAG "AnimationManager"
#define HARDCODED_ANIMATION_NAME "L1_AnimationError_128x64"
#define NO_SD_ANIMATION_NAME "L1_NoSd_128x49"
#define BAD_BATTERY_ANIMATION_NAME "L1_BadBattery_128x47"
#define CREDITS_ANIMATION_NAME "Credits_128x64"
#define NO_DB_ANIMATION_NAME "L0_NoDb_128x51"
#define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51"
@@ -148,7 +147,7 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(animation_manager->current_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, xtreme_settings.unlock_anims);
manifest_info, &stats, momentum_settings.unlock_anims);
if(!valid) {
animation_manager_start_new_idle(animation_manager);
@@ -203,8 +202,8 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(animation_manager->current_animation);
animation_manager->state = AnimationManagerStateIdle;
int32_t duration = (xtreme_settings.cycle_anims == 0) ? (bubble_animation->duration) :
(xtreme_settings.cycle_anims);
int32_t duration = (momentum_settings.cycle_anims == 0) ? (bubble_animation->duration) :
(momentum_settings.cycle_anims);
furi_timer_start(
animation_manager->idle_animation_timer, (duration > 0) ? (duration * 1000) : 0);
}
@@ -389,8 +388,7 @@ static StorageAnimation*
uint32_t whole_weight = 0;
// Filter valid animations
bool skip_credits = !xtreme_settings.credits_anim && xtreme_settings.asset_pack[0] == '\0';
bool unlock = xtreme_settings.unlock_anims;
bool unlock = momentum_settings.unlock_anims;
StorageAnimationList_it_t it;
for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
@@ -401,9 +399,6 @@ static StorageAnimation*
if(strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME) == 0) {
// Dont pick error anim randomly
valid = false;
} else if(skip_credits && strcmp(manifest_info->name, CREDITS_ANIMATION_NAME) == 0) {
// Dont pick credits anim if disabled
valid = false;
}
if(valid) {
@@ -546,7 +541,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(restore_animation);
bool valid = animation_manager_is_valid_idle_animation(
manifest_info, &stats, xtreme_settings.unlock_anims);
manifest_info, &stats, momentum_settings.unlock_anims);
// Restore only if anim is valid and not the error anim
if(valid && strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME) != 0) {
animation_manager_replace_current_animation(
@@ -561,9 +556,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
const BubbleAnimation* bubble_animation =
animation_storage_get_bubble_animation(
animation_manager->current_animation);
int32_t duration = (xtreme_settings.cycle_anims == 0) ?
int32_t duration = (momentum_settings.cycle_anims == 0) ?
(bubble_animation->duration) :
(xtreme_settings.cycle_anims);
(momentum_settings.cycle_anims);
furi_timer_start(
animation_manager->idle_animation_timer,
(duration > 0) ? (duration * 1000) : 0);

View File

@@ -11,10 +11,10 @@
#include "animation_storage_i.h"
#include <assets_dolphin_internal.h>
#include <assets_dolphin_blocking.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define ANIMATION_META_FILE "meta.txt"
#define TAG "AnimationStorage"
char ANIMATION_DIR[23 /*"/ext/asset_packs//Anims"*/ + XTREME_ASSETS_PACK_NAME_LEN + 1];
char ANIMATION_DIR[23 /* /ext/asset_packs//Anims */ + ASSET_PACKS_NAME_LEN + 1];
char ANIMATION_MANIFEST_FILE[sizeof(ANIMATION_DIR) + 13 /*"/manifest.txt"*/];
static void animation_storage_free_bubbles(BubbleAnimation* animation);
@@ -25,10 +25,10 @@ static BubbleAnimation* animation_storage_load_animation(const char* name);
void animation_handler_select_manifest() {
FuriString* anim_dir = furi_string_alloc();
FuriString* manifest = furi_string_alloc();
bool use_asset_pack = xtreme_settings.asset_pack[0] != '\0';
bool use_asset_pack = momentum_settings.asset_pack[0] != '\0';
if(use_asset_pack) {
furi_string_printf(
anim_dir, "%s/%s/Anims", XTREME_ASSETS_PATH, xtreme_settings.asset_pack);
anim_dir, "%s/%s/Anims", ASSET_PACKS_PATH, momentum_settings.asset_pack);
furi_string_printf(manifest, "%s/manifest.txt", furi_string_get_cstr(anim_dir));
Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) {
@@ -513,7 +513,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break; //-V779
animation->active_cycles = u32value;
if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
uint32_t anim_speed = xtreme_settings.anim_speed;
uint32_t anim_speed = momentum_settings.anim_speed;
u32value = (u32value * anim_speed) / 100;
FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value < 1 ? 1 : u32value);
if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;

View File

@@ -11,7 +11,7 @@
#include <cli/cli_vcp.h>
#include <locale/locale.h>
#include <applications/main/archive/helpers/archive_helpers_ext.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "animations/animation_manager.h"
#include "desktop/scenes/desktop_scene.h"
@@ -66,13 +66,13 @@ static void desktop_clock_reconfigure(Desktop* desktop) {
desktop_clock_update(desktop);
if(xtreme_settings.statusbar_clock) {
if(momentum_settings.statusbar_clock) {
furi_timer_start(desktop->update_clock_timer, furi_ms_to_ticks(1000));
} else {
furi_timer_stop(desktop->update_clock_timer);
}
view_port_enabled_set(desktop->clock_viewport, xtreme_settings.statusbar_clock);
view_port_enabled_set(desktop->clock_viewport, momentum_settings.statusbar_clock);
}
static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
@@ -217,7 +217,7 @@ void desktop_lock(Desktop* desktop, bool pin_lock) {
Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
furi_record_close(RECORD_CLI);
if(!xtreme_settings.allow_locked_rpc_commands) {
if(!momentum_settings.allow_locked_rpc_commands) {
Bt* bt = furi_record_open(RECORD_BT);
bt_close_rpc_connection(bt);
furi_record_close(RECORD_BT);
@@ -491,7 +491,7 @@ int32_t desktop_srv(void* p) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
if(xtreme_settings.lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
if(momentum_settings.lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
desktop_lock(desktop, true);
} else {
if(!loader_is_locked(desktop->loader)) {

View File

@@ -6,12 +6,10 @@
#include <toolbox/saved_struct.h>
#include <storage/storage.h>
#define DESKTOP_SETTINGS_OLD_PATH CFG_PATH("desktop.settings")
#define DESKTOP_SETTINGS_PATH INT_PATH(".desktop.settings")
#define DESKTOP_SETTINGS_MAGIC (0x17)
#define DESKTOP_SETTINGS_VER (11)
#define DESKTOP_KEYBINDS_OLD_PATH CFG_PATH(".desktop.keybinds")
#define DESKTOP_KEYBINDS_PATH CFG_PATH("desktop.keybinds")
#define DESKTOP_KEYBINDS_MAGIC (0x14)
#define DESKTOP_KEYBINDS_VER (1)

View File

@@ -1,7 +1,7 @@
#include <furi_hal.h>
#include "../desktop_i.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define DesktopFaultEventExit 0x00FF00FF
@@ -15,23 +15,13 @@ void desktop_scene_fault_on_enter(void* context) {
Popup* popup = desktop->hw_mismatch_popup;
popup_set_context(popup, desktop);
if(xtreme_assets.is_nsfw) {
popup_set_header(
popup,
"Slut passed out\n but is now back",
60,
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
} else {
popup_set_header(
popup,
"Flipper crashed\n but has been rebooted",
60,
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
}
popup_set_header(
popup,
"Flipper crashed\n but has been rebooted",
60,
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
char* message = (char*)furi_hal_rtc_get_fault_data();
popup_set_text(popup, message, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);

View File

@@ -4,7 +4,7 @@
#include <toolbox/saved_struct.h>
#include <stdbool.h>
#include <loader/loader.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "../desktop_i.h"
#include <desktop/desktop_settings.h>
@@ -43,9 +43,9 @@ void desktop_scene_lock_menu_save_settings(Desktop* desktop) {
notification_message_save_settings(desktop->lock_menu->notification);
desktop->lock_menu->save_notification = false;
}
if(desktop->lock_menu->save_xtreme) {
xtreme_settings_save();
desktop->lock_menu->save_xtreme = false;
if(desktop->lock_menu->save_momentum) {
momentum_settings_save();
desktop->lock_menu->save_momentum = false;
}
if(desktop->lock_menu->save_bt) {
bt_settings_save(&desktop->lock_menu->bt->bt_settings);
@@ -120,9 +120,9 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
}
consumed = true;
break;
case DesktopLockMenuEventXtreme:
case DesktopLockMenuEventMomentum:
desktop_scene_lock_menu_save_settings(desktop);
loader_start_detached_with_gui_error(desktop->loader, "Xtreme", NULL);
loader_start_detached_with_gui_error(desktop->loader, "Momentum", NULL);
consumed = true;
break;
case DesktopLockMenuEventStealthModeOn:

View File

@@ -13,7 +13,7 @@
#include "../views/desktop_view_locked.h"
#include "desktop_scene.h"
#include "desktop_scene_i.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define TAG "DesktopSrv"
@@ -85,7 +85,7 @@ bool desktop_scene_locked_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DesktopLockedEventOpenPowerOff: {
if(xtreme_settings.lockscreen_poweroff) {
if(momentum_settings.lockscreen_poweroff) {
loader_start(desktop->loader, "Power", "off", NULL);
}
consumed = true;

View File

@@ -5,7 +5,7 @@
#include <stdint.h>
#include <notification/notification.h>
#include <notification/notification_messages.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "../desktop.h"
#include "../desktop_i.h"
@@ -57,7 +57,7 @@ static void desktop_scene_pin_input_done_callback(const PinCode* pin_code, void*
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopPinInputEventUnlocked);
} else {
uint32_t pin_fails = furi_hal_rtc_get_pin_fails() + 1;
if(pin_fails >= 10 && xtreme_settings.bad_pins_format) {
if(pin_fails >= 10 && momentum_settings.bad_pins_format) {
furi_hal_rtc_reset_registers();
furi_hal_rtc_set_flag(FuriHalRtcFlagStorageFormatInternal);
storage_sd_format(furi_record_open(RECORD_STORAGE));

View File

@@ -58,5 +58,5 @@ typedef enum {
DesktopLockMenuEventSettings,
DesktopLockMenuEventLockKeypad,
DesktopLockMenuEventLockPinOff,
DesktopLockMenuEventXtreme,
DesktopLockMenuEventMomentum,
} DesktopEvent;

View File

@@ -1,7 +1,7 @@
#include <furi.h>
#include <gui/elements.h>
#include <assets_icons.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <furi_hal_rtc.h>
#include "../desktop_i.h"
@@ -20,7 +20,7 @@ typedef enum {
DesktopLockMenuIndexDarkMode,
DesktopLockMenuIndexLock,
DesktopLockMenuIndexBluetooth,
DesktopLockMenuIndexXtreme,
DesktopLockMenuIndexMomentum,
DesktopLockMenuIndexBrightness,
DesktopLockMenuIndexVolume,
@@ -101,7 +101,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
break;
case DesktopLockMenuIndexDarkMode:
icon = &I_CC_DarkMode_16x16;
enabled = xtreme_settings.dark_mode;
enabled = momentum_settings.dark_mode;
break;
case DesktopLockMenuIndexLock:
icon = &I_CC_Lock_16x16;
@@ -110,8 +110,8 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
icon = &I_CC_Bluetooth_16x16;
enabled = m->lock_menu->bt->bt_settings.enabled;
break;
case DesktopLockMenuIndexXtreme:
icon = &I_CC_Xtreme_16x16;
case DesktopLockMenuIndexMomentum:
icon = &I_CC_Momentum_16x16;
break;
case DesktopLockMenuIndexBrightness:
icon = &I_Pin_star_7x7;
@@ -287,8 +287,8 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
desktop_event = DesktopLockMenuEventSettings;
break;
case DesktopLockMenuIndexDarkMode:
xtreme_settings.dark_mode = !xtreme_settings.dark_mode;
lock_menu->save_xtreme = true;
momentum_settings.dark_mode = !momentum_settings.dark_mode;
lock_menu->save_momentum = true;
break;
case DesktopLockMenuIndexBluetooth:
lock_menu->bt->bt_settings.enabled = !lock_menu->bt->bt_settings.enabled;
@@ -299,8 +299,8 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
}
lock_menu->save_bt = true;
break;
case DesktopLockMenuIndexXtreme:
desktop_event = DesktopLockMenuEventXtreme;
case DesktopLockMenuIndexMomentum:
desktop_event = DesktopLockMenuEventMomentum;
break;
case DesktopLockMenuIndexVolume:
desktop_event = stealth_mode ? DesktopLockMenuEventStealthModeOff :

View File

@@ -19,7 +19,7 @@ struct DesktopLockMenuView {
NotificationApp* notification;
Bt* bt;
bool save_notification;
bool save_xtreme;
bool save_momentum;
bool save_bt;
};

View File

@@ -6,7 +6,7 @@
#include <gui/view.h>
#include <assets_icons.h>
#include <locale/locale.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <desktop/desktop_settings.h>
#include "../desktop_i.h"
@@ -92,14 +92,14 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
snprintf(date_str, 14, "%.2d-%.2d-%.4d", datetime.day, datetime.month, datetime.year);
}
if(!xtreme_settings.lockscreen_transparent) {
if(!momentum_settings.lockscreen_transparent) {
canvas_draw_icon(canvas, 0, 0 + y, &I_Lockscreen);
}
if(xtreme_settings.lockscreen_time) {
if(momentum_settings.lockscreen_time) {
canvas_set_font(canvas, FontBigNumbers);
canvas_draw_str(canvas, 0, 64 + y, time_str);
int offset = canvas_string_width(canvas, time_str) + 2;
if(xtreme_settings.lockscreen_seconds) {
if(momentum_settings.lockscreen_seconds) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 0 + offset, 64 + y, second_str);
offset += canvas_string_width(canvas, ":00") + 2;
@@ -109,12 +109,12 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
canvas_draw_str(canvas, 0 + offset, 64 + y, meridian_str);
}
}
if(xtreme_settings.lockscreen_date) {
if(momentum_settings.lockscreen_date) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 0, 48 + y + 16 * !xtreme_settings.lockscreen_time, date_str);
canvas_draw_str(canvas, 0, 48 + y + 16 * !momentum_settings.lockscreen_time, date_str);
}
if(model->view_state == DesktopViewLockedStateLockedHintShown &&
xtreme_settings.lockscreen_prompt) {
momentum_settings.lockscreen_prompt) {
canvas_set_font(canvas, FontSecondary);
if(model->pin_locked) {
elements_bubble_str(

View File

@@ -5,7 +5,7 @@
#include <furi_hal.h>
#include <stdint.h>
#include <furi.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define DOLPHIN_LOCK_EVENT_FLAG (0x1)
#define TAG "Dolphin"
@@ -156,7 +156,7 @@ int32_t dolphin_srv(void* p) {
furi_record_create(RECORD_DOLPHIN, dolphin);
dolphin_state_load(dolphin->state);
uint32_t butthurt_interval = xtreme_settings.butthurt_timer * 1000;
uint32_t butthurt_interval = momentum_settings.butthurt_timer * 1000;
if(butthurt_interval) furi_timer_restart(dolphin->butthurt_timer, butthurt_interval);
dolphin_update_clear_limits_timer_period(dolphin);
furi_timer_restart(dolphin->clear_limits_timer, HOURS_IN_TICKS(24));

View File

@@ -9,7 +9,6 @@
extern "C" {
#endif
#define DOLPHIN_STATE_OLD_PATH INT_PATH(".dolphin.state")
#define DOLPHIN_STATE_PATH CFG_PATH("dolphin.state")
extern const uint32_t DOLPHIN_LEVELS[];

View File

@@ -6,5 +6,4 @@
/**
* @brief File name used for expansion settings.
*/
#define EXPANSION_SETTINGS_OLD_PATH INT_PATH(".expansion.settings")
#define EXPANSION_SETTINGS_PATH CFG_PATH("expansion.settings")

View File

@@ -5,7 +5,7 @@
#include <furi_hal.h>
#include <stdint.h>
#include <u8g2_glue.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
[FontPrimary] = {.leading_default = 12, .leading_min = 11, .height = 8, .descender = 2},
@@ -137,15 +137,15 @@ uint8_t canvas_current_font_width(const Canvas* canvas) {
const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font font) {
furi_assert(canvas);
furi_assert(font < FontTotalNumber);
if(xtreme_assets.font_params[font]) {
return xtreme_assets.font_params[font];
if(asset_packs.font_params[font]) {
return asset_packs.font_params[font];
}
return &canvas_font_params[font];
}
void canvas_clear(Canvas* canvas) {
furi_assert(canvas);
if(xtreme_settings.dark_mode) {
if(momentum_settings.dark_mode) {
u8g2_FillBuffer(&canvas->fb);
} else {
u8g2_ClearBuffer(&canvas->fb);
@@ -154,7 +154,7 @@ void canvas_clear(Canvas* canvas) {
void canvas_set_color(Canvas* canvas, Color color) {
furi_assert(canvas);
if(xtreme_settings.dark_mode) {
if(momentum_settings.dark_mode) {
if(color == ColorBlack) {
color = ColorWhite;
} else if(color == ColorWhite) {
@@ -176,8 +176,8 @@ void canvas_invert_color(Canvas* canvas) {
void canvas_set_font(Canvas* canvas, Font font) {
furi_assert(canvas);
u8g2_SetFontMode(&canvas->fb, 1);
if(xtreme_assets.fonts[font]) {
u8g2_SetFont(&canvas->fb, xtreme_assets.fonts[font]);
if(asset_packs.fonts[font]) {
u8g2_SetFont(&canvas->fb, asset_packs.fonts[font]);
return;
}
switch(font) {

View File

@@ -1,4 +1,4 @@
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "gui_i.h"
#include <assets_icons.h>
#include <storage/storage.h>
@@ -97,7 +97,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
/* for support black theme - paint white area and
* draw icon with transparent white color
*/
if(xtreme_settings.bar_background) {
if(momentum_settings.bar_background) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(gui->canvas, 1, 1, 9, 7);
canvas_draw_box(gui->canvas, 7, 3, 58, 6);
@@ -130,7 +130,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
// Hide battery background
if(xtreme_settings.bar_borders) {
if(momentum_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, -1, 0, canvas_width(gui->canvas) + 1, canvas_height(gui->canvas));
@@ -139,7 +139,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
// ViewPort draw
canvas_frame_set(
gui->canvas,
x - xtreme_settings.bar_borders,
x - momentum_settings.bar_borders,
GUI_STATUS_BAR_Y + 2,
width,
GUI_STATUS_BAR_WORKAREA_HEIGHT);
@@ -156,7 +156,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
right_used + 4,
GUI_STATUS_BAR_HEIGHT);
// Disable battery border
if(xtreme_settings.bar_borders) {
if(momentum_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorBlack);
canvas_draw_rframe(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
@@ -176,7 +176,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
}
// Left side
if(xtreme_settings.status_icons) {
if(momentum_settings.status_icons) {
x = 2;
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
while(!ViewPortArray_end_p(it) && (right_used + left_used) < GUI_STATUS_BAR_WIDTH) {
@@ -191,7 +191,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
GUI_STATUS_BAR_Y + 1,
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
if(xtreme_settings.bar_borders) {
if(momentum_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
@@ -217,7 +217,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
GUI_STATUS_BAR_Y + 1,
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
if(xtreme_settings.bar_borders) {
if(momentum_settings.bar_borders) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
@@ -234,7 +234,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
// Draw frame around icons on the left
if(left_used) {
canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
if(xtreme_settings.bar_borders) {
if(momentum_settings.bar_borders) {
canvas_draw_rframe(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
canvas_draw_line(
@@ -291,7 +291,7 @@ static void gui_redraw(Gui* gui) {
bool need_attention =
(gui_view_port_find_enabled(gui->layers[GuiLayerWindow]) != 0 ||
gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]) != 0);
if(xtreme_settings.lockscreen_statusbar) {
if(momentum_settings.lockscreen_statusbar) {
gui_redraw_status_bar(gui, need_attention);
}
} else {

View File

@@ -13,7 +13,7 @@
#include <core/log.h>
#include "m-algo.h"
#include <m-array.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define LIST_ITEMS 5u
#define MAX_LEN_PX 110
@@ -85,7 +85,7 @@ static int BrowserItem_t_cmp(const BrowserItem_t* a, const BrowserItem_t* b) {
if(b->type == BrowserItemTypeBack) {
return 1;
}
if(xtreme_settings.sort_dirs_first) {
if(momentum_settings.sort_dirs_first) {
if(a->type == BrowserItemTypeFolder && b->type != BrowserItemTypeFolder) {
return -1;
}

Some files were not shown because too many files have changed in this diff Show More