mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
kinggates stylo 4k add manually and button switch
This commit is contained in:
@@ -70,6 +70,7 @@ typedef enum {
|
||||
SetTypeFaacSLH_433,
|
||||
SetTypeBFTMitto,
|
||||
SetTypeSomfyTelis,
|
||||
SetTypeKingGatesStylo4k,
|
||||
SetTypeANMotorsAT4,
|
||||
SetTypeAlutechAT4N,
|
||||
SetTypePhoenix_V2_433,
|
||||
|
||||
@@ -523,6 +523,15 @@ void subghz_scene_set_type_fill_generation_infos(GenInfo* infos_dest, SetType ty
|
||||
.somfy_telis.btn = 0x02,
|
||||
.somfy_telis.cnt = 0x03};
|
||||
break;
|
||||
case SetTypeKingGatesStylo4k:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenKingGatesStylo4k,
|
||||
.mod = "AM650",
|
||||
.freq = 433920000,
|
||||
.kinggates_stylo_4k.serial = key & 0xFFFFFFFF,
|
||||
.kinggates_stylo_4k.btn = 0x0E,
|
||||
.kinggates_stylo_4k.cnt = 0x03};
|
||||
break;
|
||||
case SetTypeMotorline433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenKeeloq,
|
||||
|
||||
@@ -10,6 +10,7 @@ typedef enum {
|
||||
GenKeeloqBFT,
|
||||
GenAlutechAt4n,
|
||||
GenSomfyTelis,
|
||||
GenKingGatesStylo4k,
|
||||
GenNiceFlorS,
|
||||
GenSecPlus1,
|
||||
GenSecPlus2,
|
||||
@@ -61,6 +62,11 @@ typedef struct {
|
||||
uint8_t btn;
|
||||
uint16_t cnt;
|
||||
} somfy_telis;
|
||||
struct {
|
||||
uint32_t serial;
|
||||
uint8_t btn;
|
||||
uint16_t cnt;
|
||||
} kinggates_stylo_4k;
|
||||
struct {
|
||||
uint32_t serial;
|
||||
uint8_t btn;
|
||||
|
||||
@@ -335,6 +335,36 @@ bool subghz_txrx_gen_somfy_telis_protocol(
|
||||
return res;
|
||||
}
|
||||
|
||||
bool subghz_txrx_gen_kinggates_stylo_4k_protocol(
|
||||
void* context,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt) {
|
||||
SubGhzTxRx* txrx = context;
|
||||
|
||||
bool res = false;
|
||||
|
||||
txrx->transmitter =
|
||||
subghz_transmitter_alloc_init(txrx->environment, SUBGHZ_PROTOCOL_KINGGATES_STYLO_4K_NAME);
|
||||
subghz_txrx_set_preset(txrx, preset_name, frequency, NULL, 0);
|
||||
|
||||
if(txrx->transmitter && subghz_protocol_kinggates_stylo_4k_create_data(
|
||||
subghz_transmitter_get_protocol_instance(txrx->transmitter),
|
||||
txrx->fff_data,
|
||||
serial,
|
||||
btn,
|
||||
cnt,
|
||||
txrx->preset)) {
|
||||
res = true;
|
||||
}
|
||||
|
||||
subghz_transmitter_free(txrx->transmitter);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool subghz_txrx_gen_secplus_v2_protocol(
|
||||
SubGhzTxRx* instance,
|
||||
const char* name_preset,
|
||||
|
||||
@@ -108,6 +108,14 @@ bool subghz_txrx_gen_somfy_telis_protocol(
|
||||
uint8_t btn,
|
||||
uint16_t cnt);
|
||||
|
||||
bool subghz_txrx_gen_kinggates_stylo_4k_protocol(
|
||||
void* context,
|
||||
const char* preset_name,
|
||||
uint32_t frequency,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt);
|
||||
|
||||
bool subghz_txrx_gen_came_atomo_protocol(
|
||||
void* context,
|
||||
const char* preset_name,
|
||||
|
||||
@@ -36,6 +36,10 @@ void subghz_scene_set_button_on_enter(void* context) {
|
||||
byte_ptr = &subghz->gen_info->somfy_telis.btn;
|
||||
byte_count = sizeof(subghz->gen_info->somfy_telis.btn);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
byte_ptr = &subghz->gen_info->kinggates_stylo_4k.btn;
|
||||
byte_count = sizeof(subghz->gen_info->kinggates_stylo_4k.btn);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
byte_ptr = &subghz->gen_info->nice_flor_s.btn;
|
||||
byte_count = sizeof(subghz->gen_info->nice_flor_s.btn);
|
||||
@@ -82,6 +86,7 @@ bool subghz_scene_set_button_on_event(void* context, SceneManagerEvent event) {
|
||||
case GenKeeloqBFT:
|
||||
case GenAlutechAt4n:
|
||||
case GenSomfyTelis:
|
||||
case GenKingGatesStylo4k:
|
||||
case GenNiceFlorS:
|
||||
case GenSecPlus2:
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSetCounter);
|
||||
|
||||
@@ -42,6 +42,10 @@ void subghz_scene_set_counter_on_enter(void* context) {
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->somfy_telis.cnt;
|
||||
byte_count = sizeof(subghz->gen_info->somfy_telis.cnt);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->kinggates_stylo_4k.cnt;
|
||||
byte_count = sizeof(subghz->gen_info->kinggates_stylo_4k.cnt);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->nice_flor_s.cnt;
|
||||
byte_count = sizeof(subghz->gen_info->nice_flor_s.cnt);
|
||||
@@ -113,6 +117,10 @@ bool subghz_scene_set_counter_on_event(void* context, SceneManagerEvent event) {
|
||||
case GenSomfyTelis:
|
||||
subghz->gen_info->somfy_telis.cnt = __bswap16(subghz->gen_info->somfy_telis.cnt);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
subghz->gen_info->kinggates_stylo_4k.cnt =
|
||||
__bswap16(subghz->gen_info->kinggates_stylo_4k.cnt);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
subghz->gen_info->nice_flor_s.cnt = __bswap16(subghz->gen_info->nice_flor_s.cnt);
|
||||
break;
|
||||
@@ -171,6 +179,15 @@ bool subghz_scene_set_counter_on_event(void* context, SceneManagerEvent event) {
|
||||
subghz->gen_info->somfy_telis.btn,
|
||||
subghz->gen_info->somfy_telis.cnt);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
generated_protocol = subghz_txrx_gen_kinggates_stylo_4k_protocol(
|
||||
subghz->txrx,
|
||||
subghz->gen_info->mod,
|
||||
subghz->gen_info->freq,
|
||||
subghz->gen_info->kinggates_stylo_4k.serial,
|
||||
subghz->gen_info->kinggates_stylo_4k.btn,
|
||||
subghz->gen_info->kinggates_stylo_4k.cnt);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
generated_protocol = subghz_txrx_gen_nice_flor_s_protocol(
|
||||
subghz->txrx,
|
||||
|
||||
@@ -30,6 +30,7 @@ void subghz_scene_set_seed_on_enter(void* context) {
|
||||
case GenKeeloq:
|
||||
case GenAlutechAt4n:
|
||||
case GenSomfyTelis:
|
||||
case GenKingGatesStylo4k:
|
||||
case GenNiceFlorS:
|
||||
case GenSecPlus2:
|
||||
case GenPhoenixV2:
|
||||
@@ -89,6 +90,7 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
case GenKeeloq:
|
||||
case GenAlutechAt4n:
|
||||
case GenSomfyTelis:
|
||||
case GenKingGatesStylo4k:
|
||||
case GenNiceFlorS:
|
||||
case GenSecPlus2:
|
||||
case GenPhoenixV2:
|
||||
|
||||
@@ -42,6 +42,10 @@ void subghz_scene_set_serial_on_enter(void* context) {
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->somfy_telis.serial;
|
||||
byte_count = sizeof(subghz->gen_info->somfy_telis.serial);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->kinggates_stylo_4k.serial;
|
||||
byte_count = sizeof(subghz->gen_info->kinggates_stylo_4k.serial);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
byte_ptr = (uint8_t*)&subghz->gen_info->nice_flor_s.serial;
|
||||
byte_count = sizeof(subghz->gen_info->nice_flor_s.serial);
|
||||
@@ -110,6 +114,10 @@ bool subghz_scene_set_serial_on_event(void* context, SceneManagerEvent event) {
|
||||
subghz->gen_info->somfy_telis.serial =
|
||||
__bswap32(subghz->gen_info->somfy_telis.serial);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
subghz->gen_info->kinggates_stylo_4k.serial =
|
||||
__bswap32(subghz->gen_info->kinggates_stylo_4k.serial);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
subghz->gen_info->nice_flor_s.serial =
|
||||
__bswap32(subghz->gen_info->nice_flor_s.serial);
|
||||
@@ -136,6 +144,7 @@ bool subghz_scene_set_serial_on_event(void* context, SceneManagerEvent event) {
|
||||
case GenKeeloqBFT:
|
||||
case GenAlutechAt4n:
|
||||
case GenSomfyTelis:
|
||||
case GenKingGatesStylo4k:
|
||||
case GenNiceFlorS:
|
||||
case GenSecPlus2:
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSetButton);
|
||||
|
||||
@@ -20,6 +20,7 @@ static const char* submenu_names[SetTypeMAX] = {
|
||||
[SetTypeAlutechAT4N] = "Alutech AT4N 433MHz",
|
||||
[SetTypeRoger_433] = "Roger 433MHz",
|
||||
[SetTypePhoenix_V2_433] = "V2 Phoenix 433MHz",
|
||||
[SetTypeKingGatesStylo4k] = "KingGates Stylo4 433MHz",
|
||||
[SetTypeHCS101_433_92] = "KL: HCS101 433MHz",
|
||||
[SetTypeDoorHan_315_00] = "KL: DoorHan 315MHz",
|
||||
[SetTypeDoorHan_433_92] = "KL: DoorHan 433MHz",
|
||||
@@ -187,6 +188,15 @@ bool subghz_scene_set_type_generate_protocol_from_infos(SubGhz* subghz) {
|
||||
gen_info.somfy_telis.btn,
|
||||
gen_info.somfy_telis.cnt);
|
||||
break;
|
||||
case GenKingGatesStylo4k:
|
||||
generated_protocol = subghz_txrx_gen_kinggates_stylo_4k_protocol(
|
||||
subghz->txrx,
|
||||
gen_info.mod,
|
||||
gen_info.freq,
|
||||
gen_info.kinggates_stylo_4k.serial,
|
||||
gen_info.kinggates_stylo_4k.btn,
|
||||
gen_info.kinggates_stylo_4k.cnt);
|
||||
break;
|
||||
case GenNiceFlorS:
|
||||
generated_protocol = subghz_txrx_gen_nice_flor_s_protocol(
|
||||
subghz->txrx,
|
||||
@@ -266,6 +276,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
case GenKeeloqBFT: // Serial (u32), Button (u8), Counter (u16), Seed (u32)
|
||||
case GenAlutechAt4n: // Serial (u32), Button (u8), Counter (u16)
|
||||
case GenSomfyTelis: // Serial (u32), Button (u8), Counter (u16)
|
||||
case GenKingGatesStylo4k: // Serial (u32), Button (u8), Counter (u16)
|
||||
case GenNiceFlorS: // Serial (u32), Button (u8), Counter (u16)
|
||||
case GenSecPlus2: // Serial (u32), Button (u8), Counter (u32)
|
||||
case GenPhoenixV2: // Serial (u32), Counter (u16)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#include "../blocks/custom_btn_i.h"
|
||||
|
||||
#define TAG "SubGhzProtocoKingGatesStylo4k"
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_kinggates_stylo_4k_const = {
|
||||
@@ -84,6 +86,13 @@ static void subghz_protocol_kinggates_stylo_4k_remote_controller(
|
||||
SubGhzBlockGeneric* instance,
|
||||
SubGhzKeystore* keystore);
|
||||
|
||||
/**
|
||||
* Defines the button value for the current btn_id
|
||||
* Basic set | 0xE | 0xD | 0xB | 0x7 |
|
||||
* @return Button code
|
||||
*/
|
||||
static uint8_t subghz_protocol_kinggates_stylo_4k_get_btn_code(void);
|
||||
|
||||
void* subghz_protocol_encoder_kinggates_stylo_4k_alloc(SubGhzEnvironment* environment) {
|
||||
SubGhzProtocolEncoderKingGates_stylo_4k* instance =
|
||||
malloc(sizeof(SubGhzProtocolEncoderKingGates_stylo_4k));
|
||||
@@ -138,22 +147,12 @@ LevelDuration subghz_protocol_encoder_kinggates_stylo_4k_yield(void* context) {
|
||||
static bool subghz_protocol_kinggates_stylo_4k_gen_data(
|
||||
SubGhzProtocolEncoderKingGates_stylo_4k* instance,
|
||||
uint8_t btn) {
|
||||
UNUSED(btn);
|
||||
uint32_t hop = subghz_protocol_blocks_reverse_key(instance->generic.data_2 >> 4, 32);
|
||||
uint64_t fix = subghz_protocol_blocks_reverse_key(instance->generic.data, 53);
|
||||
int res = 0;
|
||||
uint32_t decrypt = 0;
|
||||
// Save original button for later use
|
||||
if(subghz_custom_btn_get_original() == 0) {
|
||||
subghz_custom_btn_set_original(btn);
|
||||
}
|
||||
|
||||
for
|
||||
M_EACH(manufacture_code, *subghz_keystore_get_data(instance->keystore), SubGhzKeyArray_t) {
|
||||
res = strcmp(furi_string_get_cstr(manufacture_code->name), "Kingates_Stylo4k");
|
||||
if(res == 0) {
|
||||
//Simple Learning
|
||||
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
instance->generic.cnt = decrypt & 0xFFFF;
|
||||
btn = subghz_protocol_kinggates_stylo_4k_get_btn_code();
|
||||
|
||||
// Check for OFEX (overflow experimental) mode
|
||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||
@@ -172,18 +171,21 @@ static bool subghz_protocol_kinggates_stylo_4k_gen_data(
|
||||
}
|
||||
}
|
||||
|
||||
instance->generic.btn = (fix >> 17) & 0x0F;
|
||||
instance->generic.serial = ((fix >> 5) & 0xFFFF0000) | (fix & 0xFFFF);
|
||||
// hop is encrypted part
|
||||
uint32_t hop = (uint64_t)btn << 28 | (((uint32_t)0x0C) << 24) |
|
||||
((instance->generic.serial & 0xFF) << 16) | (instance->generic.cnt & 0xFFFF);
|
||||
|
||||
uint32_t data = (decrypt & 0xFFFF0000) | instance->generic.cnt;
|
||||
uint64_t fix = ((uint64_t)((instance->generic.serial >> 16) & 0xFFFF) << 21) |
|
||||
(uint64_t)btn << 17 | 0b1 << 16 | (instance->generic.serial & 0xFFFF);
|
||||
|
||||
instance->generic.data = subghz_protocol_blocks_reverse_key(fix, 53);
|
||||
|
||||
uint64_t encrypt = 0;
|
||||
for
|
||||
M_EACH(manufacture_code, *subghz_keystore_get_data(instance->keystore), SubGhzKeyArray_t) {
|
||||
res = strcmp(furi_string_get_cstr(manufacture_code->name), "Kingates_Stylo4k");
|
||||
if(res == 0) {
|
||||
//Simple Learning
|
||||
encrypt = subghz_protocol_keeloq_common_encrypt(data, manufacture_code->key);
|
||||
if(strcmp(furi_string_get_cstr(manufacture_code->name), "Kingates_Stylo4k") == 0) {
|
||||
// Simple Learning
|
||||
encrypt = subghz_protocol_keeloq_common_encrypt(hop, manufacture_code->key);
|
||||
encrypt = subghz_protocol_blocks_reverse_key(encrypt, 32);
|
||||
instance->generic.data_2 = encrypt << 4;
|
||||
return true;
|
||||
@@ -193,6 +195,63 @@ static bool subghz_protocol_kinggates_stylo_4k_gen_data(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool subghz_protocol_kinggates_stylo_4k_create_data(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
SubGhzRadioPreset* preset) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderKingGates_stylo_4k* instance = context;
|
||||
instance->generic.serial = serial;
|
||||
instance->generic.cnt = cnt;
|
||||
instance->generic.btn = btn;
|
||||
instance->generic.data_count_bit = 89;
|
||||
|
||||
uint32_t decrypt = instance->generic.btn << 28 | (((uint32_t)0x0C) << 24) |
|
||||
((instance->generic.serial & 0xFF) << 16) |
|
||||
(instance->generic.cnt & 0xFFFF);
|
||||
|
||||
uint64_t encrypt = 0;
|
||||
for
|
||||
M_EACH(manufacture_code, *subghz_keystore_get_data(instance->keystore), SubGhzKeyArray_t) {
|
||||
if(strcmp(furi_string_get_cstr(manufacture_code->name), "Kingates_Stylo4k") == 0) {
|
||||
// Simple Learning
|
||||
encrypt = subghz_protocol_keeloq_common_encrypt(decrypt, manufacture_code->key);
|
||||
encrypt = subghz_protocol_blocks_reverse_key(encrypt, 32);
|
||||
instance->generic.data_2 = encrypt << 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t fix = ((uint64_t)((instance->generic.serial >> 16) & 0xFFFF) << 21) |
|
||||
instance->generic.btn << 17 | 0b1 << 16 | (instance->generic.serial & 0xFFFF);
|
||||
|
||||
instance->generic.data = subghz_protocol_blocks_reverse_key(fix, 53);
|
||||
|
||||
SubGhzProtocolStatus res =
|
||||
subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||
|
||||
uint8_t key_data[sizeof(uint64_t)] = {0};
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data_2 >> (i * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
if(!flipper_format_rewind(flipper_format)) {
|
||||
FURI_LOG_E(TAG, "Rewind error");
|
||||
res = SubGhzProtocolStatusErrorParserOthers;
|
||||
}
|
||||
|
||||
if((res == SubGhzProtocolStatusOk) &&
|
||||
!flipper_format_insert_or_update_hex(flipper_format, "Data", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to add Data2");
|
||||
res = SubGhzProtocolStatusErrorParserOthers;
|
||||
}
|
||||
|
||||
return res == SubGhzProtocolStatusOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generating an upload from data.
|
||||
* @param instance Pointer to a SubGhzProtocolEncoderKingGates_stylo_4k instance
|
||||
@@ -281,9 +340,6 @@ SubGhzProtocolStatus subghz_protocol_encoder_kinggates_stylo_4k_deserialize(
|
||||
break;
|
||||
}
|
||||
|
||||
subghz_protocol_kinggates_stylo_4k_remote_controller(
|
||||
&instance->generic, instance->keystore);
|
||||
|
||||
//optional parameter parameter
|
||||
flipper_format_read_uint32(
|
||||
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
||||
@@ -303,6 +359,9 @@ SubGhzProtocolStatus subghz_protocol_encoder_kinggates_stylo_4k_deserialize(
|
||||
instance->generic.data_2 = instance->generic.data_2 << 8 | key_data[i];
|
||||
}
|
||||
|
||||
subghz_protocol_kinggates_stylo_4k_remote_controller(
|
||||
&instance->generic, instance->keystore);
|
||||
|
||||
subghz_protocol_encoder_kinggates_stylo_4k_get_upload(instance, instance->generic.btn);
|
||||
|
||||
if(!flipper_format_rewind(flipper_format)) {
|
||||
@@ -310,6 +369,14 @@ SubGhzProtocolStatus subghz_protocol_encoder_kinggates_stylo_4k_deserialize(
|
||||
break;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data >> i * 8) & 0xFF;
|
||||
}
|
||||
if(!flipper_format_update_hex(flipper_format, "Key", key_data, sizeof(uint64_t))) {
|
||||
FURI_LOG_E(TAG, "Unable to update Key");
|
||||
break;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < sizeof(uint64_t); i++) {
|
||||
key_data[sizeof(uint64_t) - i - 1] = (instance->generic.data_2 >> i * 8) & 0xFF;
|
||||
}
|
||||
@@ -501,6 +568,11 @@ static void subghz_protocol_kinggates_stylo_4k_remote_controller(
|
||||
}
|
||||
if(ret) {
|
||||
instance->cnt = decrypt & 0xFFFF;
|
||||
// Save original button for later use
|
||||
if(subghz_custom_btn_get_original() == 0) {
|
||||
subghz_custom_btn_set_original(instance->btn);
|
||||
}
|
||||
subghz_custom_btn_set_max(3);
|
||||
} else {
|
||||
instance->btn = 0;
|
||||
instance->serial = 0;
|
||||
@@ -575,6 +647,74 @@ SubGhzProtocolStatus subghz_protocol_decoder_kinggates_stylo_4k_deserialize(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint8_t subghz_protocol_kinggates_stylo_4k_get_btn_code(void) {
|
||||
uint8_t custom_btn_id = subghz_custom_btn_get();
|
||||
uint8_t original_btn_code = subghz_custom_btn_get_original();
|
||||
uint8_t btn = original_btn_code;
|
||||
|
||||
// Set custom button
|
||||
if((custom_btn_id == SUBGHZ_CUSTOM_BTN_OK) && (original_btn_code != 0)) {
|
||||
// Restore original button code
|
||||
btn = original_btn_code;
|
||||
} else if(custom_btn_id == SUBGHZ_CUSTOM_BTN_UP) {
|
||||
switch(original_btn_code) {
|
||||
case 0xE:
|
||||
btn = 0xD;
|
||||
break;
|
||||
case 0xD:
|
||||
btn = 0xE;
|
||||
break;
|
||||
case 0xB:
|
||||
btn = 0xE;
|
||||
break;
|
||||
case 0x7:
|
||||
btn = 0xE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if(custom_btn_id == SUBGHZ_CUSTOM_BTN_DOWN) {
|
||||
switch(original_btn_code) {
|
||||
case 0xE:
|
||||
btn = 0xB;
|
||||
break;
|
||||
case 0xD:
|
||||
btn = 0xB;
|
||||
break;
|
||||
case 0xB:
|
||||
btn = 0xD;
|
||||
break;
|
||||
case 0x7:
|
||||
btn = 0xD;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if(custom_btn_id == SUBGHZ_CUSTOM_BTN_LEFT) {
|
||||
switch(original_btn_code) {
|
||||
case 0xE:
|
||||
btn = 0x7;
|
||||
break;
|
||||
case 0xD:
|
||||
btn = 0x7;
|
||||
break;
|
||||
case 0xB:
|
||||
btn = 0x7;
|
||||
break;
|
||||
case 0x7:
|
||||
btn = 0xB;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_kinggates_stylo_4k_get_string(void* context, FuriString* output) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderKingGates_stylo_4k* instance = context;
|
||||
|
||||
@@ -215,6 +215,24 @@ bool subghz_protocol_somfy_keytis_create_data(
|
||||
uint16_t cnt,
|
||||
SubGhzRadioPreset* preset);
|
||||
|
||||
/**
|
||||
* Key generation from simple data.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderKingGates_stylo_4k instance
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @param serial Serial number, 24 bit
|
||||
* @param btn Button number, 8 bit
|
||||
* @param cnt Counter value, 16 bit
|
||||
* @param preset Modulation, SubGhzRadioPreset
|
||||
* @return true On success
|
||||
*/
|
||||
bool subghz_protocol_kinggates_stylo_4k_create_data(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
SubGhzRadioPreset* preset);
|
||||
|
||||
typedef struct SubGhzProtocolDecoderBinRAW SubGhzProtocolDecoderBinRAW;
|
||||
|
||||
void subghz_protocol_decoder_bin_raw_data_input_rssi(
|
||||
|
||||
@@ -3674,6 +3674,7 @@ Function,+,subghz_protocol_encoder_raw_yield,LevelDuration,void*
|
||||
Function,+,subghz_protocol_faac_slh_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint32_t, uint32_t, const char*, SubGhzRadioPreset*"
|
||||
Function,+,subghz_protocol_keeloq_bft_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, uint32_t, const char*, SubGhzRadioPreset*"
|
||||
Function,+,subghz_protocol_keeloq_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, const char*, SubGhzRadioPreset*"
|
||||
Function,+,subghz_protocol_kinggates_stylo_4k_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*"
|
||||
Function,+,subghz_protocol_nice_flor_s_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*, _Bool"
|
||||
Function,+,subghz_protocol_phoenix_v2_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint16_t, SubGhzRadioPreset*"
|
||||
Function,+,subghz_protocol_raw_file_encoder_worker_set_callback_end,void,"SubGhzProtocolEncoderRAW*, SubGhzProtocolEncoderRAWCallbackEnd, void*"
|
||||
|
||||
|
Reference in New Issue
Block a user