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

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;
}

View File

@@ -9,7 +9,7 @@
#include <dolphin/helpers/dolphin_state.h>
#include <furi.h>
#include <m-array.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <m-string.h>
struct Menu {
@@ -90,7 +90,7 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
MenuItem* item;
size_t shift_position;
FuriString* name = furi_string_alloc();
switch(xtreme_settings.menu_style) {
switch(momentum_settings.menu_style) {
case MenuStyleList: {
for(uint8_t i = 0; i < 3; i++) {
canvas_set_font(canvas, i == 1 ? FontPrimary : FontSecondary);
@@ -403,7 +403,7 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
static bool menu_input_callback(InputEvent* event, void* context) {
Menu* menu = context;
bool consumed = true;
if(xtreme_settings.menu_style == MenuStyleVertical &&
if(momentum_settings.menu_style == MenuStyleVertical &&
furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient)) {
if(event->key == InputKeyLeft) {
event->key = InputKeyRight;
@@ -612,7 +612,7 @@ static void menu_process_up(Menu* menu) {
size_t count = MenuItemArray_size(model->items);
size_t vertical_offset = model->vertical_offset;
switch(xtreme_settings.menu_style) {
switch(momentum_settings.menu_style) {
case MenuStyleList:
case MenuStyleTerminal:
if(position > 0) {
@@ -663,7 +663,7 @@ static void menu_process_down(Menu* menu) {
size_t count = MenuItemArray_size(model->items);
size_t vertical_offset = model->vertical_offset;
switch(xtreme_settings.menu_style) {
switch(momentum_settings.menu_style) {
case MenuStyleList:
case MenuStyleTerminal:
if(position < count - 1) {
@@ -714,7 +714,7 @@ static void menu_process_left(Menu* menu) {
size_t count = MenuItemArray_size(model->items);
size_t vertical_offset = model->vertical_offset;
switch(xtreme_settings.menu_style) {
switch(momentum_settings.menu_style) {
case MenuStyleWii:
if(position < 2) {
if(count % 2) {
@@ -777,7 +777,7 @@ static void menu_process_right(Menu* menu) {
size_t count = MenuItemArray_size(model->items);
size_t vertical_offset = model->vertical_offset;
switch(xtreme_settings.menu_style) {
switch(momentum_settings.menu_style) {
case MenuStyleWii:
if(count % 2) {
if(position == count - 1) {

View File

@@ -3,7 +3,7 @@
#include <applications.h>
#include <storage/storage.h>
#include <furi_hal.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <dialogs/dialogs.h>
#include <toolbox/path.h>
@@ -206,8 +206,8 @@ bool loader_menu_load_fap_meta(
static void loader_make_menu_file(Storage* storage) {
Stream* new = file_stream_alloc(storage);
if(!storage_file_exists(storage, XTREME_MENU_PATH)) {
if(file_stream_open(new, XTREME_MENU_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
if(!storage_file_exists(storage, MAINMENU_APPS_PATH)) {
if(file_stream_open(new, MAINMENU_APPS_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
stream_write_format(new, "MenuAppList Version %u\n", 0);
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
stream_write_format(new, "%s\n", FLIPPER_APPS[i].name);
@@ -215,13 +215,14 @@ static void loader_make_menu_file(Storage* storage) {
for(size_t i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT - 1; i++) {
stream_write_format(new, "%s\n", FLIPPER_EXTERNAL_APPS[i].name);
}
// Old additional external apps
Stream* old = file_stream_alloc(storage);
if(file_stream_open(old, XTREME_MENU_OLD_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
if(file_stream_open(old, CFG_PATH("xtreme_apps.txt"), FSAM_READ, FSOM_OPEN_EXISTING)) {
stream_copy(old, new, stream_size(old));
}
file_stream_close(old);
stream_free(old);
storage_common_remove(storage, XTREME_MENU_OLD_PATH);
storage_common_remove(storage, CFG_PATH("xtreme_apps.txt"));
}
file_stream_close(new);
}
@@ -247,10 +248,10 @@ static Loader* loader_alloc() {
FuriString* line = furi_string_alloc();
FuriString* name = furi_string_alloc();
do {
if(!file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING)) {
if(!file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING)) {
file_stream_close(stream);
loader_make_menu_file(storage);
if(!file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING))
if(!file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING))
break;
}
@@ -259,9 +260,9 @@ static Loader* loader_alloc() {
sscanf(furi_string_get_cstr(line), "MenuAppList Version %lu", &version) != 1 ||
version > 0) {
file_stream_close(stream);
storage_common_remove(storage, XTREME_MENU_PATH);
storage_common_remove(storage, MAINMENU_APPS_PATH);
loader_make_menu_file(storage);
if(!file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING))
if(!file_stream_open(stream, MAINMENU_APPS_PATH, FSAM_READ_WRITE, FSOM_OPEN_EXISTING))
break;
if(!stream_read_line(stream, line) ||
sscanf(furi_string_get_cstr(line), "MenuAppList Version %lu", &version) != 1 ||

View File

@@ -33,7 +33,6 @@ typedef struct {
#define NOTIFICATION_SETTINGS_VERSION 0x02
#define NOTIFICATION_SETTINGS_MAGIC 0x16
#define NOTIFICATION_SETTINGS_OLD_PATH INT_PATH(".notification.settings")
#define NOTIFICATION_SETTINGS_PATH CFG_PATH("notification.settings")
typedef struct {

View File

@@ -2,7 +2,7 @@
#include <furi.h>
#include <furi_hal.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#define POWER_OFF_TIMEOUT 90
#define TAG "Power"
@@ -16,7 +16,7 @@ void power_set_battery_icon_enabled(Power* power, bool is_enabled) {
void power_draw_battery_callback(Canvas* canvas, void* context) {
furi_assert(context);
Power* power = context;
BatteryIcon battery_icon = xtreme_settings.battery_icon;
BatteryIcon battery_icon = momentum_settings.battery_icon;
if(battery_icon == BatteryIconOff) return;
canvas_draw_icon(canvas, 0, 0, &I_Battery_25x8);
@@ -367,7 +367,7 @@ Power* power_alloc() {
// Battery view port
power->battery_view_port = power_battery_view_port_alloc(power);
power_set_battery_icon_enabled(power, xtreme_settings.battery_icon != BatteryIconOff);
power_set_battery_icon_enabled(power, momentum_settings.battery_icon != BatteryIconOff);
power->show_low_bat_level_message = true;
//Auto shutdown timer
@@ -486,7 +486,7 @@ static void power_check_battery_level_change(Power* power) {
}
static void power_check_charge_cap(Power* power) {
uint32_t cap = xtreme_settings.charge_cap;
uint32_t cap = momentum_settings.charge_cap;
if(power->info.charge >= cap && cap < 100) {
if(!power->info.is_charge_capped) { // Suppress charging if charge reaches custom cap
power->info.is_charge_capped = true;

View File

@@ -3,7 +3,6 @@
#define POWER_SETTINGS_VER (1)
#define POWER_SETTINGS_OLD_PATH INT_PATH(".power.settings")
#define POWER_SETTINGS_PATH CFG_PATH("power.settings")
#define POWER_SETTINGS_MAGIC (0x21)

View File

@@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdio.h>
#include <m-dict.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include <bt/bt_service/bt.h>
@@ -386,7 +386,8 @@ static void rpc_session_thread_state_callback(FuriThreadState thread_state, void
}
RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) {
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock) && !xtreme_settings.allow_locked_rpc_commands)
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock) &&
!momentum_settings.allow_locked_rpc_commands)
return NULL;
furi_assert(rpc);

View File

@@ -173,7 +173,7 @@ static DialogMessageButton about_screen_fw_version(DialogsApp* dialogs, DialogMe
furi_hal_info_get_api_version(&api_major, &api_minor);
furi_string_cat_printf(
buffer,
"%s %s\n%s F%d:%d.%d %s\nhttps://flipper-xtre.me/",
"%s %s\n%s F%d:%d.%d %s\nhttps://momentum-fw.dev/",
version_get_version(ver),
version_get_builddate(ver),
version_get_githash(ver),

View File

@@ -4,7 +4,7 @@
#include <storage/storage.h>
#include <dialogs/dialogs.h>
#include <flipper_application/flipper_application.h>
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
static bool keybinds_fap_selector_item_callback(
FuriString* file_path,
@@ -47,7 +47,7 @@ static void
const DialogsFileBrowserOptions browser_options = {
.extension = extension,
.icon = &I_unknown_10px,
.hide_dot_files = !xtreme_settings.show_hidden_files,
.hide_dot_files = !momentum_settings.show_hidden_files,
.skip_assets = true,
.hide_ext = hide_ext,
.item_loader_callback = keybinds_fap_selector_item_callback,

View File

@@ -6,7 +6,7 @@
#include <gui/gui.h>
#include <furi_hal_version.h>
#include "dolphin/dolphin.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
#include "math.h"
typedef struct {
@@ -38,28 +38,15 @@ static void render_callback(Canvas* canvas, void* _ctx) {
const char* mood_str = NULL;
const Icon* portrait = NULL;
if(xtreme_assets.is_nsfw) {
if(stats->butthurt <= 4) {
portrait = &I_passport_happy_46x49;
mood_str = "Status: Wet";
} else if(stats->butthurt <= 9) {
portrait = &I_passport_okay_46x49;
mood_str = "Status: Horny";
} else {
portrait = &I_passport_bad_46x49;
mood_str = "Status: Desperate";
}
if(stats->butthurt <= 4) {
portrait = &I_passport_happy_46x49;
mood_str = "Mood: Happy";
} else if(stats->butthurt <= 9) {
portrait = &I_passport_okay_46x49;
mood_str = "Mood: Okay";
} else {
if(stats->butthurt <= 4) {
portrait = &I_passport_happy_46x49;
mood_str = "Mood: Happy";
} else if(stats->butthurt <= 9) {
portrait = &I_passport_okay_46x49;
mood_str = "Mood: Okay";
} else {
portrait = &I_passport_bad_46x49;
mood_str = "Mood: Angry";
}
portrait = &I_passport_bad_46x49;
mood_str = "Mood: Angry";
}
uint32_t xp_progress = 0;
uint32_t xp_need = dolphin_state_xp_to_levelup(stats->icounter);

View File

@@ -1,5 +1,5 @@
#include "../power_settings_app.h"
#include <xtreme/xtreme.h>
#include <momentum/momentum.h>
void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) {
furi_assert(context);
@@ -12,13 +12,8 @@ void power_settings_scene_power_off_on_enter(void* context) {
DialogEx* dialog = app->dialog;
dialog_ex_set_header(dialog, "Turn Off Device?", 64, 2, AlignCenter, AlignTop);
if(xtreme_assets.is_nsfw) {
dialog_ex_set_text(
dialog, " I will be\nwaiting for\n you master", 78, 16, AlignLeft, AlignTop);
} else {
dialog_ex_set_text(
dialog, " I will be\nwaiting for\n you here", 78, 16, AlignLeft, AlignTop);
}
dialog_ex_set_text(
dialog, " I will be\nwaiting for\n you here", 78, 16, AlignLeft, AlignTop);
dialog_ex_set_icon(dialog, 21, 13, &I_Cry_dolph_55x52);
dialog_ex_set_left_button_text(dialog, "Battery");
dialog_ex_set_right_button_text(dialog, "OFF");

View File

@@ -13,7 +13,7 @@
#include <toolbox/tar/tar_archive.h>
#include <toolbox/crc32_calc.h>
#define XFWFIRSTBOOT_FLAG_PATH CFG_PATH("xfwfirstboot.flag")
#define FIRSTBOOT_FLAG_PATH CFG_PATH("firstboot.flag")
#define TAG "UpdWorkerBackup"
@@ -205,15 +205,14 @@ static bool update_task_post_update(UpdateTask* update_task) {
update_task_set_progress(update_task, UpdateTaskStageSplashscreenInstall, 0);
FuriString* tmp_path;
tmp_path = furi_string_alloc_set(update_task->update_path);
if(storage_common_stat(update_task->storage, XFWFIRSTBOOT_FLAG_PATH, NULL) ==
if(storage_common_stat(update_task->storage, FIRSTBOOT_FLAG_PATH, NULL) ==
FSE_NOT_EXIST) {
File* file = storage_file_alloc(update_task->storage);
if(storage_file_open(
file, XFWFIRSTBOOT_FLAG_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
if(storage_file_open(file, FIRSTBOOT_FLAG_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
storage_file_close(file);
}
storage_file_free(file);
path_append(tmp_path, "xfwfirstboot.bin");
path_append(tmp_path, "firstboot.bin");
if(storage_common_stat(
update_task->storage, furi_string_get_cstr(tmp_path), NULL) != FSE_OK) {
furi_string_set(tmp_path, update_task->update_path);

View File

@@ -93,13 +93,13 @@ static void updater_main_draw_callback(Canvas* canvas, void* _model) {
canvas_draw_icon(canvas, 7, 54, &I_Ok_btn_9x9);
canvas_draw_icon(canvas, 75, 55, &I_Pin_back_arrow_10x8);
} else {
canvas_draw_str_aligned(canvas, 82, 16, AlignCenter, AlignTop, "Xtreme FW");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, 82, 6, AlignCenter, AlignTop, "Installing");
canvas_draw_str_aligned(canvas, 82, 5, AlignCenter, AlignTop, "Installing");
canvas_draw_str_aligned(
canvas, 64, 51, AlignCenter, AlignTop, furi_string_get_cstr(model->status));
canvas_draw_icon(canvas, 4, 5, &I_Updating_32x40);
elements_progress_bar(canvas, 42, 29, 80, (float)model->progress / 100);
canvas_draw_icon(canvas, 50, 16, &I_Updating_Logo_62x15);
elements_progress_bar(canvas, 42, 36, 80, (float)model->progress / 100);
}
}