Skip to content

Commit 4833a52

Browse files
committed
proper fix
by WillyJL
1 parent 38f783d commit 4833a52

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/subghz/protocols/linear.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#define DIP_PATTERN "%c%c%c%c%c%c%c%c%c%c"
1212
#define DATA_TO_DIP(dip) \
13-
(dip & 0x0200 ? '0' : '1'), (dip & 0x0100 ? '0' : '1'), (dip & 0x0080 ? '0' : '1'), \
14-
(dip & 0x0040 ? '0' : '1'), (dip & 0x0020 ? '0' : '1'), (dip & 0x0010 ? '0' : '1'), \
15-
(dip & 0x0008 ? '0' : '1'), (dip & 0x0004 ? '0' : '1'), (dip & 0x0002 ? '0' : '1'), \
16-
(dip & 0x0001 ? '0' : '1')
13+
(dip & 0x0200 ? '1' : '0'), (dip & 0x0100 ? '1' : '0'), (dip & 0x0080 ? '1' : '0'), \
14+
(dip & 0x0040 ? '1' : '0'), (dip & 0x0020 ? '1' : '0'), (dip & 0x0010 ? '1' : '0'), \
15+
(dip & 0x0008 ? '1' : '0'), (dip & 0x0004 ? '1' : '0'), (dip & 0x0002 ? '1' : '0'), \
16+
(dip & 0x0001 ? '1' : '0')
1717

1818
static const SubGhzBlockConst subghz_protocol_linear_const = {
1919
.te_short = 500,
@@ -323,13 +323,13 @@ void subghz_protocol_decoder_linear_get_string(void* context, FuriString* output
323323

324324
// Protocol is actually implemented wrong way around, bits are inverted.
325325
// Instead of fixing it and breaking old saved remotes,
326-
// only the display here is inverted to show correct values.
327-
uint32_t code_found_reverse_lo = instance->generic.data & 0x00000000ffffffff;
326+
// only the display here is inverted (~) to show correct values.
327+
uint32_t code_found_lo = ~instance->generic.data & 0x00000000000003ff;
328328

329-
uint64_t code_found = subghz_protocol_blocks_reverse_key(
330-
instance->generic.data, instance->generic.data_count_bit);
329+
uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key(
330+
~instance->generic.data, instance->generic.data_count_bit);
331331

332-
uint32_t code_found_lo = code_found & 0x00000000ffffffff;
332+
uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000000003ff;
333333

334334
furi_string_cat_printf(
335335
output,
@@ -341,5 +341,5 @@ void subghz_protocol_decoder_linear_get_string(void* context, FuriString* output
341341
instance->generic.data_count_bit,
342342
code_found_lo,
343343
code_found_reverse_lo,
344-
DATA_TO_DIP(code_found_reverse_lo));
344+
DATA_TO_DIP(code_found_lo));
345345
}

0 commit comments

Comments
 (0)