[FL-2771] SubGhz: add protocol Prastel #1674
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
e7a5d19f9c
commit
311b60f815
@ -13,6 +13,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define TAG "SubGhzProtocolCAME"
|
#define TAG "SubGhzProtocolCAME"
|
||||||
|
#define CAME_24_COUNT_BIT 24
|
||||||
|
#define PRASTEL_COUNT_BIT 25
|
||||||
|
#define PRASTEL_NAME "Prastel"
|
||||||
|
|
||||||
static const SubGhzBlockConst subghz_protocol_came_const = {
|
static const SubGhzBlockConst subghz_protocol_came_const = {
|
||||||
.te_short = 320,
|
.te_short = 320,
|
||||||
@ -114,9 +117,9 @@ static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* i
|
|||||||
//Send header
|
//Send header
|
||||||
instance->encoder.upload[index++] = level_duration_make(
|
instance->encoder.upload[index++] = level_duration_make(
|
||||||
false,
|
false,
|
||||||
((instance->generic.data_count_bit == subghz_protocol_came_const.min_count_bit_for_found) ?
|
((instance->generic.data_count_bit == CAME_24_COUNT_BIT) ?
|
||||||
(uint32_t)subghz_protocol_came_const.te_short * 39 :
|
(uint32_t)subghz_protocol_came_const.te_short * 76 :
|
||||||
(uint32_t)subghz_protocol_came_const.te_short * 76));
|
(uint32_t)subghz_protocol_came_const.te_short * 39));
|
||||||
//Send start bit
|
//Send start bit
|
||||||
instance->encoder.upload[index++] =
|
instance->encoder.upload[index++] =
|
||||||
level_duration_make(true, (uint32_t)subghz_protocol_came_const.te_short);
|
level_duration_make(true, (uint32_t)subghz_protocol_came_const.te_short);
|
||||||
@ -150,8 +153,8 @@ bool subghz_protocol_encoder_came_deserialize(void* context, FlipperFormat* flip
|
|||||||
}
|
}
|
||||||
if((instance->generic.data_count_bit !=
|
if((instance->generic.data_count_bit !=
|
||||||
subghz_protocol_came_const.min_count_bit_for_found) &&
|
subghz_protocol_came_const.min_count_bit_for_found) &&
|
||||||
(instance->generic.data_count_bit !=
|
(instance->generic.data_count_bit != CAME_24_COUNT_BIT) &&
|
||||||
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
|
(instance->generic.data_count_bit != PRASTEL_COUNT_BIT)) {
|
||||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -309,8 +312,8 @@ bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flip
|
|||||||
}
|
}
|
||||||
if((instance->generic.data_count_bit !=
|
if((instance->generic.data_count_bit !=
|
||||||
subghz_protocol_came_const.min_count_bit_for_found) &&
|
subghz_protocol_came_const.min_count_bit_for_found) &&
|
||||||
(instance->generic.data_count_bit !=
|
(instance->generic.data_count_bit != CAME_24_COUNT_BIT) &&
|
||||||
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
|
(instance->generic.data_count_bit != PRASTEL_COUNT_BIT)) {
|
||||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -335,7 +338,8 @@ void subghz_protocol_decoder_came_get_string(void* context, string_t output) {
|
|||||||
"%s %dbit\r\n"
|
"%s %dbit\r\n"
|
||||||
"Key:0x%08lX\r\n"
|
"Key:0x%08lX\r\n"
|
||||||
"Yek:0x%08lX\r\n",
|
"Yek:0x%08lX\r\n",
|
||||||
instance->generic.protocol_name,
|
(instance->generic.data_count_bit == PRASTEL_COUNT_BIT ? PRASTEL_NAME :
|
||||||
|
instance->generic.protocol_name),
|
||||||
instance->generic.data_count_bit,
|
instance->generic.data_count_bit,
|
||||||
code_found_lo,
|
code_found_lo,
|
||||||
code_found_reverse_lo);
|
code_found_reverse_lo);
|
||||||
|
Loading…
Reference in New Issue
Block a user