mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
MNTM: SubGHz freq add screen uses new NumberInput view
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
### Breaking Changes:
|
||||
- Desktop: Settings restructured due to LFS removal
|
||||
- Desktop: Settings restructured due to removal of LFS / LittleFS Internal Storage
|
||||
- You might need to reconfigure Desktop Settings (PIN code, auto lock, show clock)
|
||||
- Desktop Keybinds should transfer correctly automatically
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- Settings: Show free flash amount in internal storage info (by @Willy-JL)
|
||||
- Services:
|
||||
- OFW: On SD insert load BT, Desktop, Dolphin, Expansion, Notification, Region files (by @gsurkov)
|
||||
- On SD insert also load Momentum settings, Asset Packs, FindMy Flipper, NameSpoof, SubGHz options, and migrate files (by @Willy-JL)
|
||||
- On SD insert also load Momentum Settings, Asset Packs, FindMy Flipper, NameSpoof, SubGHz options, and migrate files (by @Willy-JL)
|
||||
- Furi: Re-enabled `FURI_TRACE` since LFS removal frees DFU, will get better crash messages with source code path (by @Willy-JL)
|
||||
- OFW: Sub-GHz: Add Dickert MAHS garage door protocol (by @OevreFlataeker)
|
||||
- OFW: RFID: Add GProxII support (by @BarTenderNZ)
|
||||
@@ -27,10 +27,11 @@
|
||||
- Sub-GHz Bruteforcer: Fix one/two byte text (by @Willy-JL)
|
||||
- Various app fixes for `-Wundef` option (by @Willy-JL)
|
||||
- BadKB: Lower BLE conn interval like base HID profile (by @Willy-JL)
|
||||
- Desktop: Refactor Keybinds, no more 63 character limit, keybinds only loaded when pressed to save RAM (by @Willy-JL)
|
||||
- Desktop: Refactor Keybinds, no more 63 character limit, only load when activated to save RAM (by @Willy-JL)
|
||||
- MNTM Settings: SubGHz frequency add screen uses new NumberInput view (by @Willy-JL)
|
||||
- Settings: Statusbar Clock and Left Handed options show in normal Settings app like OFW (by @Willy-JL)
|
||||
- Services:
|
||||
- Big cleanup of services and settings handling, refactor some old code (by @Willy-JL)
|
||||
- Big cleanup of all services and settings handling, refactor lots old code (by @Willy-JL)
|
||||
- Update all settings paths to use equivalents like OFW or UL for better compatibility (by @Willy-JL)
|
||||
- OFW: NFC: Refactor detected protocols list (by @Astrrra)
|
||||
- Furi:
|
||||
|
||||
@@ -223,6 +223,12 @@ MomentumApp* momentum_app_alloc() {
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, MomentumAppViewByteInput, byte_input_get_view(app->byte_input));
|
||||
|
||||
app->number_input = number_input_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher,
|
||||
MomentumAppViewNumberInput,
|
||||
number_input_get_view(app->number_input));
|
||||
|
||||
app->popup = popup_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, MomentumAppViewPopup, popup_get_view(app->popup));
|
||||
@@ -421,6 +427,8 @@ void momentum_app_free(MomentumApp* app) {
|
||||
text_input_free(app->text_input);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewByteInput);
|
||||
byte_input_free(app->byte_input);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewNumberInput);
|
||||
number_input_free(app->number_input);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewPopup);
|
||||
popup_free(app->popup);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, MomentumAppViewDialogEx);
|
||||
|
||||
@@ -1,39 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <desktop/desktop.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <expansion/expansion.h>
|
||||
#include <notification/notification_app.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/modules/text_input.h>
|
||||
#include <gui/modules/byte_input.h>
|
||||
#include <gui/modules/number_input.h>
|
||||
#include <gui/modules/popup.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
|
||||
#include <momentum/asset_packs.h>
|
||||
#include <loader/loader_menu.h>
|
||||
#include <lib/subghz/subghz_setting.h>
|
||||
#include <rgb_backlight.h>
|
||||
#include <momentum/namespoof.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <dolphin/dolphin_i.h>
|
||||
#include <dolphin/helpers/dolphin_state.h>
|
||||
#include <momentum/settings.h>
|
||||
|
||||
#include <applications.h>
|
||||
#include <assets_icons.h>
|
||||
#include <desktop/desktop.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <dolphin/dolphin_i.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <dolphin/helpers/dolphin_state.h>
|
||||
#include <expansion/expansion.h>
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <furi.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/modules/byte_input.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <gui/modules/popup.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/modules/text_input.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/view.h>
|
||||
#include <lib/flipper_format/flipper_format.h>
|
||||
#include <lib/subghz/subghz_setting.h>
|
||||
#include <lib/toolbox/value_index.h>
|
||||
#include <loader/loader_menu.h>
|
||||
#include <m-array.h>
|
||||
#include <momentum/asset_packs.h>
|
||||
#include <momentum/namespoof.h>
|
||||
#include <momentum/settings.h>
|
||||
#include <notification/notification_app.h>
|
||||
#include <power/power_service/power.h>
|
||||
#include <rgb_backlight.h>
|
||||
#include <scenes/momentum_app_scene.h>
|
||||
#include <toolbox/stream/file_stream.h>
|
||||
|
||||
#include "scenes/momentum_app_scene.h"
|
||||
|
||||
ARRAY_DEF(CharList, char*)
|
||||
|
||||
typedef struct {
|
||||
@@ -44,10 +49,12 @@ typedef struct {
|
||||
NotificationApp* notification;
|
||||
SceneManager* scene_manager;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
|
||||
VariableItemList* var_item_list;
|
||||
Submenu* submenu;
|
||||
TextInput* text_input;
|
||||
ByteInput* byte_input;
|
||||
NumberInput* number_input;
|
||||
Popup* popup;
|
||||
DialogEx* dialog_ex;
|
||||
|
||||
@@ -62,7 +69,6 @@ typedef struct {
|
||||
uint8_t subghz_static_index;
|
||||
FrequencyList_t subghz_hopper_freqs;
|
||||
uint8_t subghz_hopper_index;
|
||||
char subghz_freq_buffer[7];
|
||||
bool subghz_extend;
|
||||
bool subghz_bypass;
|
||||
RgbColor lcd_color;
|
||||
@@ -92,6 +98,7 @@ typedef enum {
|
||||
MomentumAppViewSubmenu,
|
||||
MomentumAppViewTextInput,
|
||||
MomentumAppViewByteInput,
|
||||
MomentumAppViewNumberInput,
|
||||
MomentumAppViewPopup,
|
||||
MomentumAppViewDialogEx,
|
||||
} MomentumAppView;
|
||||
|
||||
@@ -5,12 +5,12 @@ enum TextInputResult {
|
||||
TextInputResultError,
|
||||
};
|
||||
|
||||
static void momentum_app_scene_protocols_freqs_add_text_input_callback(void* context) {
|
||||
static void
|
||||
momentum_app_scene_protocols_freqs_add_number_input_callback(void* context, int32_t number) {
|
||||
MomentumApp* app = context;
|
||||
|
||||
char* end;
|
||||
uint32_t value = strtol(app->subghz_freq_buffer, &end, 0) * 1000;
|
||||
if(*end || !furi_hal_subghz_is_frequency_valid(value)) {
|
||||
uint32_t value = number * 1000;
|
||||
if(!furi_hal_subghz_is_frequency_valid(value)) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, TextInputResultError);
|
||||
return;
|
||||
}
|
||||
@@ -27,26 +27,24 @@ static void momentum_app_scene_protocols_freqs_add_text_input_callback(void* con
|
||||
|
||||
void momentum_app_scene_protocols_freqs_add_on_enter(void* context) {
|
||||
MomentumApp* app = context;
|
||||
TextInput* text_input = app->text_input;
|
||||
NumberInput* number_input = app->number_input;
|
||||
|
||||
text_input_set_header_text(text_input, "Ex: 123456 for 123.456 MHz");
|
||||
number_input_set_header_text(number_input, "Use kHz values, like 433920");
|
||||
|
||||
strlcpy(app->subghz_freq_buffer, "", sizeof(app->subghz_freq_buffer));
|
||||
|
||||
text_input_set_result_callback(
|
||||
text_input,
|
||||
momentum_app_scene_protocols_freqs_add_text_input_callback,
|
||||
number_input_set_result_callback(
|
||||
number_input,
|
||||
momentum_app_scene_protocols_freqs_add_number_input_callback,
|
||||
app,
|
||||
app->subghz_freq_buffer,
|
||||
sizeof(app->subghz_freq_buffer),
|
||||
true);
|
||||
0,
|
||||
0, // TODO: support leaving default value empty, change min to 100000
|
||||
999999);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewTextInput);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewNumberInput);
|
||||
}
|
||||
|
||||
void callback_return(void* context) {
|
||||
MomentumApp* app = context;
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, MomentumAppViewNumberInput);
|
||||
}
|
||||
|
||||
bool momentum_app_scene_protocols_freqs_add_on_event(void* context, SceneManagerEvent event) {
|
||||
@@ -60,9 +58,15 @@ bool momentum_app_scene_protocols_freqs_add_on_event(void* context, SceneManager
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
break;
|
||||
case TextInputResultError:
|
||||
popup_set_header(app->popup, "Invalid value!", 64, 26, AlignCenter, AlignCenter);
|
||||
popup_set_header(app->popup, "Invalid frequency!", 64, 18, AlignCenter, AlignCenter);
|
||||
popup_set_text(
|
||||
app->popup, "Frequency was not added...", 64, 40, AlignCenter, AlignCenter);
|
||||
app->popup,
|
||||
"Must be 281-361,\n"
|
||||
"378-481, 749-962 MHz",
|
||||
64,
|
||||
40,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
popup_set_callback(app->popup, callback_return);
|
||||
popup_set_context(app->popup, app);
|
||||
popup_set_timeout(app->popup, 1000);
|
||||
|
||||
Reference in New Issue
Block a user