SubGhz: add protocol Prastel - OFW PR 1674

by Skorpionm
This commit is contained in:
MX 2022-08-30 21:25:08 +03:00
parent 0c0fb57410
commit 079cadaeda
No known key found for this signature in database
GPG Key ID: F1863A37E20BEF27

View File

@ -13,6 +13,9 @@
*/
#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 = {
.te_short = 320,
@ -114,9 +117,9 @@ static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* i
//Send header
instance->encoder.upload[index++] = level_duration_make(
false,
((instance->generic.data_count_bit == subghz_protocol_came_const.min_count_bit_for_found) ?
(uint32_t)subghz_protocol_came_const.te_short * 39 :
(uint32_t)subghz_protocol_came_const.te_short * 76));
((instance->generic.data_count_bit == CAME_24_COUNT_BIT) ?
(uint32_t)subghz_protocol_came_const.te_short * 76 :
(uint32_t)subghz_protocol_came_const.te_short * 39));
//Send start bit
instance->encoder.upload[index++] =
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 !=
subghz_protocol_came_const.min_count_bit_for_found) &&
(instance->generic.data_count_bit !=
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
(instance->generic.data_count_bit != CAME_24_COUNT_BIT) &&
(instance->generic.data_count_bit != PRASTEL_COUNT_BIT)) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
break;
}
@ -309,8 +312,8 @@ bool subghz_protocol_decoder_came_deserialize(void* context, FlipperFormat* flip
}
if((instance->generic.data_count_bit !=
subghz_protocol_came_const.min_count_bit_for_found) &&
(instance->generic.data_count_bit !=
2 * subghz_protocol_came_const.min_count_bit_for_found)) {
(instance->generic.data_count_bit != CAME_24_COUNT_BIT) &&
(instance->generic.data_count_bit != PRASTEL_COUNT_BIT)) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
break;
}
@ -335,7 +338,8 @@ void subghz_protocol_decoder_came_get_string(void* context, string_t output) {
"%s %dbit\r\n"
"Key: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,
code_found_lo,
code_found_reverse_lo);