diff --git a/applications/main/nfc/scenes/nfc_scene_start.c b/applications/main/nfc/scenes/nfc_scene_start.c index f8b9f52c6..2a116fe09 100644 --- a/applications/main/nfc/scenes/nfc_scene_start.c +++ b/applications/main/nfc/scenes/nfc_scene_start.c @@ -7,7 +7,7 @@ enum SubmenuIndex { SubmenuIndexDetectReader, SubmenuIndexSaved, SubmenuIndexExtraAction, - SubmenuIndexAddManualy, + SubmenuIndexAddManually, SubmenuIndexDebug, }; @@ -28,7 +28,7 @@ void nfc_scene_start_on_enter(void* context) { submenu_add_item( submenu, "Extra Actions", SubmenuIndexExtraAction, nfc_scene_start_submenu_callback, nfc); submenu_add_item( - submenu, "Add Manually", SubmenuIndexAddManualy, nfc_scene_start_submenu_callback, nfc); + submenu, "Add Manually", SubmenuIndexAddManually, nfc_scene_start_submenu_callback, nfc); if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { submenu_add_item( @@ -68,7 +68,7 @@ bool nfc_scene_start_on_event(void* context, SceneManagerEvent event) { } else if(event.event == SubmenuIndexExtraAction) { scene_manager_next_scene(nfc->scene_manager, NfcSceneExtraActions); consumed = true; - } else if(event.event == SubmenuIndexAddManualy) { + } else if(event.event == SubmenuIndexAddManually) { scene_manager_next_scene(nfc->scene_manager, NfcSceneSetType); consumed = true; } else if(event.event == SubmenuIndexDebug) { diff --git a/applications/main/subghz/scenes/subghz_scene_config.h b/applications/main/subghz/scenes/subghz_scene_config.h index fd1271c8c..86a307317 100644 --- a/applications/main/subghz/scenes/subghz_scene_config.h +++ b/applications/main/subghz/scenes/subghz_scene_config.h @@ -23,3 +23,4 @@ ADD_SCENE(subghz, more_raw, MoreRAW) ADD_SCENE(subghz, delete_raw, DeleteRAW) ADD_SCENE(subghz, need_saving, NeedSaving) ADD_SCENE(subghz, rpc, Rpc) +ADD_SCENE(subghz, region_info, RegionInfo) diff --git a/applications/main/subghz/scenes/subghz_scene_region_info.c b/applications/main/subghz/scenes/subghz_scene_region_info.c new file mode 100644 index 000000000..82486314d --- /dev/null +++ b/applications/main/subghz/scenes/subghz_scene_region_info.c @@ -0,0 +1,39 @@ +#include "../subghz_i.h" + +#include + +void subghz_scene_region_info_on_enter(void* context) { + SubGhz* subghz = context; + const FuriHalRegion* const region = furi_hal_region_get(); + FuriString* buffer; + buffer = furi_string_alloc(); + if(region) { + furi_string_cat_printf(buffer, "Region: %s, bands:\n", region->country_code); + for(uint16_t i = 0; i < region->bands_count; ++i) { + furi_string_cat_printf( + buffer, + " %lu-%lu kHz\n", + region->bands[i].start / 1000, + region->bands[i].end / 1000); + } + } else { + furi_string_cat_printf(buffer, "Region: N/A\n"); + } + + widget_add_string_multiline_element( + subghz->widget, 0, 0, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(buffer)); + + furi_string_free(buffer); + view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdWidget); +} + +bool subghz_scene_region_info_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + return false; +} + +void subghz_scene_region_info_on_exit(void* context) { + SubGhz* subghz = context; + widget_reset(subghz->widget); +} diff --git a/applications/main/subghz/scenes/subghz_scene_start.c b/applications/main/subghz/scenes/subghz_scene_start.c index 0b1c3c159..a50f73a81 100644 --- a/applications/main/subghz/scenes/subghz_scene_start.c +++ b/applications/main/subghz/scenes/subghz_scene_start.c @@ -5,9 +5,10 @@ enum SubmenuIndex { SubmenuIndexRead = 10, SubmenuIndexSaved, SubmenuIndexTest, - SubmenuIndexAddManualy, + SubmenuIndexAddManually, SubmenuIndexFrequencyAnalyzer, SubmenuIndexReadRAW, + SubmenuIndexShowRegionInfo }; void subghz_scene_start_submenu_callback(void* context, uint32_t index) { @@ -33,7 +34,7 @@ void subghz_scene_start_on_enter(void* context) { submenu_add_item( subghz->submenu, "Add Manually", - SubmenuIndexAddManualy, + SubmenuIndexAddManually, subghz_scene_start_submenu_callback, subghz); submenu_add_item( @@ -42,6 +43,12 @@ void subghz_scene_start_on_enter(void* context) { SubmenuIndexFrequencyAnalyzer, subghz_scene_start_submenu_callback, subghz); + submenu_add_item( + subghz->submenu, + "Region Information", + SubmenuIndexShowRegionInfo, + subghz_scene_start_submenu_callback, + subghz); if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { submenu_add_item( subghz->submenu, "Test", SubmenuIndexTest, subghz_scene_start_submenu_callback, subghz); @@ -76,9 +83,9 @@ bool subghz_scene_start_on_event(void* context, SceneManagerEvent event) { subghz->scene_manager, SubGhzSceneStart, SubmenuIndexSaved); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaved); return true; - } else if(event.event == SubmenuIndexAddManualy) { + } else if(event.event == SubmenuIndexAddManually) { scene_manager_set_scene_state( - subghz->scene_manager, SubGhzSceneStart, SubmenuIndexAddManualy); + subghz->scene_manager, SubGhzSceneStart, SubmenuIndexAddManually); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSetType); return true; } else if(event.event == SubmenuIndexFrequencyAnalyzer) { @@ -92,6 +99,11 @@ bool subghz_scene_start_on_event(void* context, SceneManagerEvent event) { subghz->scene_manager, SubGhzSceneStart, SubmenuIndexTest); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTest); return true; + } else if(event.event == SubmenuIndexShowRegionInfo) { + scene_manager_set_scene_state( + subghz->scene_manager, SubGhzSceneStart, SubmenuIndexShowRegionInfo); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneRegionInfo); + return true; } } return false; diff --git a/applications/plugins/picopass/scenes/picopass_scene_start.c b/applications/plugins/picopass/scenes/picopass_scene_start.c index 76c18a22a..6d1aeedcd 100644 --- a/applications/plugins/picopass/scenes/picopass_scene_start.c +++ b/applications/plugins/picopass/scenes/picopass_scene_start.c @@ -3,7 +3,7 @@ enum SubmenuIndex { SubmenuIndexRead, SubmenuIndexRunScript, SubmenuIndexSaved, - SubmenuIndexAddManualy, + SubmenuIndexAddManually, SubmenuIndexDebug, };