mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 00:18:35 -07:00
SubGHz: Manual region bypass (#47)
* Subghz: brought back manual region bypass * MNTM: change frequency check this allows to add "extended" frequencies to your custom added frequencies * MNTM: reboot when changing extended frequencies * Fix regio typo * Show bypass before extend * Consistency with OFW and UL api for region, version, otp * Fix API symbols * Restrict only on TX * Oops * Improve bypass/extend UI --------- Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
@@ -76,6 +76,8 @@ bool momentum_app_apply(MomentumApp* app) {
|
||||
if(!flipper_format_write_bool(
|
||||
file, "use_ext_range_at_own_risk", &app->subghz_extend, 1))
|
||||
break;
|
||||
if(!flipper_format_write_bool(file, "ignore_default_tx_region", &app->subghz_bypass, 1))
|
||||
break;
|
||||
} while(0);
|
||||
flipper_format_free(file);
|
||||
}
|
||||
@@ -307,6 +309,7 @@ MomentumApp* momentum_app_alloc() {
|
||||
file = flipper_format_file_alloc(storage);
|
||||
if(flipper_format_file_open_existing(file, "/ext/subghz/assets/extend_range.txt")) {
|
||||
flipper_format_read_bool(file, "use_ext_range_at_own_risk", &app->subghz_extend, 1);
|
||||
flipper_format_read_bool(file, "ignore_default_tx_region", &app->subghz_bypass, 1);
|
||||
}
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
@@ -59,6 +59,7 @@ typedef struct {
|
||||
uint8_t subghz_hopper_index;
|
||||
char subghz_freq_buffer[7];
|
||||
bool subghz_extend;
|
||||
bool subghz_bypass;
|
||||
RgbColor lcd_color;
|
||||
Rgb565Color vgm_color;
|
||||
char device_name[FURI_HAL_VERSION_ARRAY_NAME_LENGTH];
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexSubghzFreqs,
|
||||
VarItemListIndexSubghzBypass,
|
||||
VarItemListIndexSubghzExtend,
|
||||
VarItemListIndexGpioPins,
|
||||
VarItemListIndexFileNamingPrefix,
|
||||
};
|
||||
|
||||
void momentum_app_scene_protocols_var_item_list_callback(void* context, uint32_t index) {
|
||||
@@ -11,11 +13,24 @@ void momentum_app_scene_protocols_var_item_list_callback(void* context, uint32_t
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_protocols_subghz_bypass_changed(VariableItem* item) {
|
||||
MomentumApp* app = variable_item_get_context(item);
|
||||
app->subghz_bypass = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
|
||||
app->save_subghz = true;
|
||||
app->require_reboot = true;
|
||||
variable_item_set_locked(
|
||||
variable_item_list_get(app->var_item_list, VarItemListIndexSubghzExtend),
|
||||
!app->subghz_bypass,
|
||||
NULL);
|
||||
}
|
||||
|
||||
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;
|
||||
app->require_reboot = true;
|
||||
}
|
||||
|
||||
static void momentum_app_scene_protocols_file_naming_prefix_changed(VariableItem* item) {
|
||||
@@ -35,9 +50,23 @@ void momentum_app_scene_protocols_on_enter(void* context) {
|
||||
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);
|
||||
var_item_list,
|
||||
"SubGHz Bypass Region Lock",
|
||||
2,
|
||||
xtreme_app_scene_protocols_subghz_bypass_changed,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, app->subghz_bypass);
|
||||
variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"SubGHz Extend Freq Bands",
|
||||
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");
|
||||
variable_item_set_locked(item, !app->subghz_bypass, "Must bypass\nregion lock\nfirst!");
|
||||
|
||||
item = variable_item_list_add(var_item_list, "GPIO Pins", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
@@ -6,14 +6,17 @@
|
||||
|
||||
void subghz_extended_freq() {
|
||||
bool is_extended_i = false;
|
||||
bool is_bypassed = false;
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
if(flipper_format_file_open_existing(file, "/ext/subghz/assets/extend_range.txt")) {
|
||||
flipper_format_read_bool(file, "use_ext_range_at_own_risk", &is_extended_i, 1);
|
||||
flipper_format_read_bool(file, "ignore_default_tx_region", &is_bypassed, 1);
|
||||
}
|
||||
|
||||
furi_hal_subghz_set_extended_frequency(is_extended_i);
|
||||
furi_hal_subghz_set_bypass_region(is_bypassed);
|
||||
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
@@ -138,7 +138,7 @@ static DialogMessageButton about_screen_hw_version(DialogsApp* dialogs, DialogMe
|
||||
furi_hal_version_get_hw_target(),
|
||||
furi_hal_version_get_hw_body(),
|
||||
furi_hal_version_get_hw_connect(),
|
||||
furi_hal_version_get_hw_region_name_otp(),
|
||||
furi_hal_version_get_hw_region_name(),
|
||||
furi_hal_region_get_name(),
|
||||
my_name ? my_name : "Unknown");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user