From b86a400a82d0703e464a29bc5e3dd25ae46140fa Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Thu, 17 Mar 2022 13:55:53 +0400 Subject: [PATCH] SubGhz: add frequencies and add DoorHan 315.00 (#1028) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * SubGhz: add frequencies and add DoorHan 315.00 * SubGhz: fix syntax Co-authored-by: あく --- .../subghz/scenes/subghz_scene_set_type.c | 37 +++++++++++++++++-- applications/subghz/subghz.c | 31 ++++++++++++++-- applications/subghz/subghz_i.h | 1 + 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/applications/subghz/scenes/subghz_scene_set_type.c b/applications/subghz/scenes/subghz_scene_set_type.c index 79d6bcf6..32aecc14 100644 --- a/applications/subghz/scenes/subghz_scene_set_type.c +++ b/applications/subghz/scenes/subghz_scene_set_type.c @@ -17,7 +17,8 @@ enum SubmenuIndex { SubmenuIndexNeroSketch, SubmenuIndexNeroRadio, SubmenuIndexGateTX, - SubmenuIndexDoorHan, + SubmenuIndexDoorHan_315_00, + SubmenuIndexDoorHan_433_92, }; bool subghz_scene_set_type_submenu_gen_data_protocol( @@ -122,10 +123,16 @@ void subghz_scene_set_type_on_enter(void* context) { SubmenuIndexGateTX, subghz_scene_set_type_submenu_callback, subghz); + submenu_add_item( + subghz->submenu, + "DoorHan_315", + SubmenuIndexDoorHan_315_00, + subghz_scene_set_type_submenu_callback, + subghz); submenu_add_item( subghz->submenu, "DoorHan_433", - SubmenuIndexDoorHan, + SubmenuIndexDoorHan_433_92, subghz_scene_set_type_submenu_callback, subghz); @@ -195,7 +202,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { generated_protocol = true; } break; - case SubmenuIndexDoorHan: + case SubmenuIndexDoorHan_433_92: subghz->txrx->transmitter = subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq"); if(subghz->txrx->transmitter) { @@ -219,6 +226,30 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); } break; + case SubmenuIndexDoorHan_315_00: + subghz->txrx->transmitter = + subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq"); + if(subghz->txrx->transmitter) { + subghz_protocol_keeloq_create_data( + subghz->txrx->transmitter->protocol_instance, + subghz->txrx->fff_data, + key & 0x0FFFFFFF, + 0x2, + 0x0003, + "DoorHan", + subghz_frequencies[subghz_frequencies_315_00], + FuriHalSubGhzPresetOok650Async); + generated_protocol = true; + } else { + generated_protocol = false; + } + subghz_transmitter_free(subghz->txrx->transmitter); + if(!generated_protocol) { + string_set( + subghz->error_str, "Function requires\nan SD card with\nfresh databases."); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError); + } + break; default: return false; break; diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c index 7a140685..0fb2f6d9 100644 --- a/applications/subghz/subghz.c +++ b/applications/subghz/subghz.c @@ -4,33 +4,57 @@ #include const char* const subghz_frequencies_text[] = { + + "300.00", + "303.88", + "304.25", "315.00", + "318.00", + + "390.00", + "418.00", "433.08", "433.42", "433.92", "434.42", + "434.78", + "438.90", + "868.35", "915.00", + "925.00", }; const uint32_t subghz_frequencies[] = { + /* 300 - 348 */ + 300000000, + 303875000, + 304250000, 315000000, + 318000000, /* 387 - 464 */ - + 390000000, + 418000000, 433075000, /* LPD433 first */ 433420000, 433920000, /* LPD433 mid */ 434420000, - /* 779 - 928 */ + 434775000, /* LPD433 last channels */ + 438900000, + /* 779 - 928 */ 868350000, 915000000, + 925000000, + }; const uint32_t subghz_hopper_frequencies[] = { 315000000, + 318000000, + 390000000, 433920000, 868350000, }; @@ -38,7 +62,8 @@ const uint32_t subghz_hopper_frequencies[] = { const uint32_t subghz_frequencies_count = sizeof(subghz_frequencies) / sizeof(uint32_t); const uint32_t subghz_hopper_frequencies_count = sizeof(subghz_hopper_frequencies) / sizeof(uint32_t); -const uint32_t subghz_frequencies_433_92 = 3; +const uint32_t subghz_frequencies_433_92 = 9; +const uint32_t subghz_frequencies_315_00 = 3; bool subghz_custom_event_callback(void* context, uint32_t event) { furi_assert(context); diff --git a/applications/subghz/subghz_i.h b/applications/subghz/subghz_i.h index 98dced1c..efb3eafa 100644 --- a/applications/subghz/subghz_i.h +++ b/applications/subghz/subghz_i.h @@ -41,6 +41,7 @@ extern const uint32_t subghz_hopper_frequencies[]; extern const uint32_t subghz_frequencies_count; extern const uint32_t subghz_hopper_frequencies_count; extern const uint32_t subghz_frequencies_433_92; +extern const uint32_t subghz_frequencies_315_00; /** SubGhzNotification state */ typedef enum {