|
|
@@ -184,7 +184,11 @@ bool subghz_protocol_encoder_megacode_deserialize(void* context, FlipperFormat*
|
|
|
FURI_LOG_E(TAG, "Deserialize error");
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+ if(instance->generic.data_count_bit !=
|
|
|
+ subghz_protocol_megacode_const.min_count_bit_for_found) {
|
|
|
+ FURI_LOG_E(TAG, "Wrong number of bits in key");
|
|
|
+ break;
|
|
|
+ }
|
|
|
//optional parameter parameter
|
|
|
flipper_format_read_uint32(
|
|
|
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
|
|
@@ -270,7 +274,7 @@ void subghz_protocol_decoder_megacode_feed(void* context, bool level, uint32_t d
|
|
|
if(!level) { //save interval
|
|
|
if(duration >= (subghz_protocol_megacode_const.te_short * 10)) {
|
|
|
instance->decoder.parser_step = MegaCodeDecoderStepReset;
|
|
|
- if(instance->decoder.decode_count_bit >=
|
|
|
+ if(instance->decoder.decode_count_bit ==
|
|
|
subghz_protocol_megacode_const.min_count_bit_for_found) {
|
|
|
instance->generic.data = instance->decoder.decode_data;
|
|
|
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
|
|
|
@@ -389,7 +393,19 @@ bool subghz_protocol_decoder_megacode_serialize(
|
|
|
bool subghz_protocol_decoder_megacode_deserialize(void* context, FlipperFormat* flipper_format) {
|
|
|
furi_assert(context);
|
|
|
SubGhzProtocolDecoderMegaCode* instance = context;
|
|
|
- return subghz_block_generic_deserialize(&instance->generic, flipper_format);
|
|
|
+ bool ret = false;
|
|
|
+ do {
|
|
|
+ if(!subghz_block_generic_deserialize(&instance->generic, flipper_format)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(instance->generic.data_count_bit !=
|
|
|
+ subghz_protocol_megacode_const.min_count_bit_for_found) {
|
|
|
+ FURI_LOG_E(TAG, "Wrong number of bits in key");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ ret = true;
|
|
|
+ } while(false);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
void subghz_protocol_decoder_megacode_get_string(void* context, string_t output) {
|