SubGhz: add frequencies and add DoorHan 315.00 (#1028)

* SubGhz: add frequencies and add DoorHan 315.00
* SubGhz: fix syntax

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm 2022-03-17 13:55:53 +04:00 committed by GitHub
parent c098292a53
commit b86a400a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 6 deletions

View File

@ -17,7 +17,8 @@ enum SubmenuIndex {
SubmenuIndexNeroSketch, SubmenuIndexNeroSketch,
SubmenuIndexNeroRadio, SubmenuIndexNeroRadio,
SubmenuIndexGateTX, SubmenuIndexGateTX,
SubmenuIndexDoorHan, SubmenuIndexDoorHan_315_00,
SubmenuIndexDoorHan_433_92,
}; };
bool subghz_scene_set_type_submenu_gen_data_protocol( bool subghz_scene_set_type_submenu_gen_data_protocol(
@ -122,10 +123,16 @@ void subghz_scene_set_type_on_enter(void* context) {
SubmenuIndexGateTX, SubmenuIndexGateTX,
subghz_scene_set_type_submenu_callback, subghz_scene_set_type_submenu_callback,
subghz); subghz);
submenu_add_item(
subghz->submenu,
"DoorHan_315",
SubmenuIndexDoorHan_315_00,
subghz_scene_set_type_submenu_callback,
subghz);
submenu_add_item( submenu_add_item(
subghz->submenu, subghz->submenu,
"DoorHan_433", "DoorHan_433",
SubmenuIndexDoorHan, SubmenuIndexDoorHan_433_92,
subghz_scene_set_type_submenu_callback, subghz_scene_set_type_submenu_callback,
subghz); subghz);
@ -195,7 +202,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
generated_protocol = true; generated_protocol = true;
} }
break; break;
case SubmenuIndexDoorHan: case SubmenuIndexDoorHan_433_92:
subghz->txrx->transmitter = subghz->txrx->transmitter =
subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq"); subghz_transmitter_alloc_init(subghz->txrx->environment, "KeeLoq");
if(subghz->txrx->transmitter) { 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); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
} }
break; 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: default:
return false; return false;
break; break;

View File

@ -4,33 +4,57 @@
#include <lib/toolbox/path.h> #include <lib/toolbox/path.h>
const char* const subghz_frequencies_text[] = { const char* const subghz_frequencies_text[] = {
"300.00",
"303.88",
"304.25",
"315.00", "315.00",
"318.00",
"390.00",
"418.00",
"433.08", "433.08",
"433.42", "433.42",
"433.92", "433.92",
"434.42", "434.42",
"434.78",
"438.90",
"868.35", "868.35",
"915.00", "915.00",
"925.00",
}; };
const uint32_t subghz_frequencies[] = { const uint32_t subghz_frequencies[] = {
/* 300 - 348 */ /* 300 - 348 */
300000000,
303875000,
304250000,
315000000, 315000000,
318000000,
/* 387 - 464 */ /* 387 - 464 */
390000000,
418000000,
433075000, /* LPD433 first */ 433075000, /* LPD433 first */
433420000, 433420000,
433920000, /* LPD433 mid */ 433920000, /* LPD433 mid */
434420000, 434420000,
/* 779 - 928 */ 434775000, /* LPD433 last channels */
438900000,
/* 779 - 928 */
868350000, 868350000,
915000000, 915000000,
925000000,
}; };
const uint32_t subghz_hopper_frequencies[] = { const uint32_t subghz_hopper_frequencies[] = {
315000000, 315000000,
318000000,
390000000,
433920000, 433920000,
868350000, 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_frequencies_count = sizeof(subghz_frequencies) / sizeof(uint32_t);
const uint32_t subghz_hopper_frequencies_count = const uint32_t subghz_hopper_frequencies_count =
sizeof(subghz_hopper_frequencies) / sizeof(uint32_t); 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) { bool subghz_custom_event_callback(void* context, uint32_t event) {
furi_assert(context); furi_assert(context);

View File

@ -41,6 +41,7 @@ extern const uint32_t subghz_hopper_frequencies[];
extern const uint32_t subghz_frequencies_count; extern const uint32_t subghz_frequencies_count;
extern const uint32_t subghz_hopper_frequencies_count; extern const uint32_t subghz_hopper_frequencies_count;
extern const uint32_t subghz_frequencies_433_92; extern const uint32_t subghz_frequencies_433_92;
extern const uint32_t subghz_frequencies_315_00;
/** SubGhzNotification state */ /** SubGhzNotification state */
typedef enum { typedef enum {