Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Format --nobuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Jan 13, 2024
1 parent aab879b commit 50bb422
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
28 changes: 14 additions & 14 deletions lib/subghz/protocols/acurite_986.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ void ws_protocol_decoder_acurite_986_reset(void* context) {
static bool ws_protocol_acurite_986_check(WSProtocolDecoderAcurite_986* instance) {
if(!instance->decoder.decode_data) return false;
uint8_t msg[] = {
instance->decoder.decode_data >> 32,
instance->decoder.decode_data >> 24,
instance->decoder.decode_data >> 16,
instance->decoder.decode_data >> 8 };
instance->decoder.decode_data >> 32,
instance->decoder.decode_data >> 24,
instance->decoder.decode_data >> 16,
instance->decoder.decode_data >> 8};

uint8_t crc = subghz_protocol_blocks_crc8(msg, 4, 0x07, 0x00);
return (crc == (instance->decoder.decode_data & 0xFF));
Expand All @@ -125,7 +125,8 @@ static void ws_protocol_acurite_986_remote_controller(WSBlockGeneric* instance)
int temp;

instance->id = subghz_protocol_blocks_reverse_key(instance->data >> 24, 8);
instance->id = (instance->id << 8) | subghz_protocol_blocks_reverse_key(instance->data >> 16, 8);
instance->id = (instance->id << 8) |
subghz_protocol_blocks_reverse_key(instance->data >> 16, 8);
instance->battery_low = (instance->data >> 14) & 1;
instance->channel = ((instance->data >> 15) & 1) + 1;

Expand Down Expand Up @@ -155,7 +156,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync1:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSync2;
}
Expand All @@ -166,7 +167,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync2:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSync3;
}
Expand All @@ -177,7 +178,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync3:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSaveDuration;
}
Expand All @@ -198,7 +199,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du
case Acurite_986DecoderStepCheckDuration:
if(!level) {
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_short) <
ws_protocol_acurite_986_const.te_delta * 10) {
ws_protocol_acurite_986_const.te_delta * 10) {
if(duration < ws_protocol_acurite_986_const.te_short) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
instance->decoder.parser_step = Acurite_986DecoderStepSaveDuration;
Expand All @@ -209,8 +210,9 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du
} else {
//Found syncPostfix
instance->decoder.parser_step = Acurite_986DecoderStepReset;
if((instance->decoder.decode_count_bit == ws_protocol_acurite_986_const.min_count_bit_for_found) &&
ws_protocol_acurite_986_check(instance)) {
if((instance->decoder.decode_count_bit ==
ws_protocol_acurite_986_const.min_count_bit_for_found) &&
ws_protocol_acurite_986_check(instance)) {
instance->generic.data = instance->decoder.decode_data;
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
ws_protocol_acurite_986_remote_controller(&instance->generic);
Expand Down Expand Up @@ -248,9 +250,7 @@ SubGhzProtocolStatus
furi_assert(context);
WSProtocolDecoderAcurite_986* instance = context;
return ws_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
ws_protocol_acurite_986_const.min_count_bit_for_found);
&instance->generic, flipper_format, ws_protocol_acurite_986_const.min_count_bit_for_found);
}

void ws_protocol_decoder_acurite_986_get_string(void* context, FuriString* output) {
Expand Down
3 changes: 2 additions & 1 deletion lib/subghz/protocols/lacrosse_tx141thbv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ SubGhzProtocolStatus ws_protocol_decoder_lacrosse_tx141thbv2_deserialize(
if(ret != SubGhzProtocolStatusOk) {
break;
}
if(instance->generic.data_count_bit != ws_protocol_lacrosse_tx141thbv2_const.min_count_bit_for_found &&
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;
Expand Down

0 comments on commit 50bb422

Please sign in to comment.