From 65e5bc8c7047ed3e967fa267499a77df18841a3f Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sat, 13 Jan 2024 00:25:32 +0000 Subject: [PATCH] SubGhz fix TX141THBv2 decode from file (#513) --- lib/subghz/protocols/lacrosse_tx141thbv2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/subghz/protocols/lacrosse_tx141thbv2.c b/lib/subghz/protocols/lacrosse_tx141thbv2.c index b6bdde914..6a091723e 100644 --- a/lib/subghz/protocols/lacrosse_tx141thbv2.c +++ b/lib/subghz/protocols/lacrosse_tx141thbv2.c @@ -270,10 +270,20 @@ SubGhzProtocolStatus ws_protocol_decoder_lacrosse_tx141thbv2_deserialize( FlipperFormat* flipper_format) { furi_assert(context); WSProtocolDecoderLaCrosse_TX141THBv2* instance = context; - return ws_block_generic_deserialize_check_count_bit( - &instance->generic, - flipper_format, - ws_protocol_lacrosse_tx141thbv2_const.min_count_bit_for_found); + SubGhzProtocolStatus ret = SubGhzProtocolStatusError; + do { + ret = ws_block_generic_deserialize(&instance->generic, flipper_format); + if(ret != SubGhzProtocolStatusOk) { + break; + } + if(instance->generic.data_count_bit != ws_protocol_lacrosse_tx141thbv2_const.min_count_bit_for_found && + instance->generic.data_count_bit != LACROSSE_TX141TH_BV2_BIT_COUNT) { + FURI_LOG_E(TAG, "Wrong number of bits in key"); + ret = SubGhzProtocolStatusErrorValueBitCount; + break; + } + } while(false); + return ret; } void ws_protocol_decoder_lacrosse_tx141thbv2_get_string(void* context, FuriString* output) {