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

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