From af67a99da9c741a283c0491b4c8645fb92d99258 Mon Sep 17 00:00:00 2001 From: WillyJL Date: Sat, 6 Sep 2025 04:41:15 +0200 Subject: [PATCH] Sub-GHz: Actually fix Linear display for real now --- lib/subghz/protocols/linear.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/subghz/protocols/linear.c b/lib/subghz/protocols/linear.c index 0bbfa4e0e..5ecff4f5a 100644 --- a/lib/subghz/protocols/linear.c +++ b/lib/subghz/protocols/linear.c @@ -10,10 +10,10 @@ #define DIP_PATTERN "%c%c%c%c%c%c%c%c%c%c" #define DATA_TO_DIP(dip) \ - (dip & 0x0200 ? '0' : '1'), (dip & 0x0100 ? '0' : '1'), (dip & 0x0080 ? '0' : '1'), \ - (dip & 0x0040 ? '0' : '1'), (dip & 0x0020 ? '0' : '1'), (dip & 0x0010 ? '0' : '1'), \ - (dip & 0x0008 ? '0' : '1'), (dip & 0x0004 ? '0' : '1'), (dip & 0x0002 ? '0' : '1'), \ - (dip & 0x0001 ? '0' : '1') + (dip & 0x0200 ? '1' : '0'), (dip & 0x0100 ? '1' : '0'), (dip & 0x0080 ? '1' : '0'), \ + (dip & 0x0040 ? '1' : '0'), (dip & 0x0020 ? '1' : '0'), (dip & 0x0010 ? '1' : '0'), \ + (dip & 0x0008 ? '1' : '0'), (dip & 0x0004 ? '1' : '0'), (dip & 0x0002 ? '1' : '0'), \ + (dip & 0x0001 ? '1' : '0') static const SubGhzBlockConst subghz_protocol_linear_const = { .te_short = 500, @@ -325,13 +325,13 @@ void subghz_protocol_decoder_linear_get_string(void* context, FuriString* output // Protocol is actually implemented wrong way around, bits are inverted. // Instead of fixing it and breaking old saved remotes, - // only the display here is inverted to show correct values. - uint32_t code_found_reverse_lo = instance->generic.data & 0x00000000ffffffff; + // only the display here is inverted (~) to show correct values. + uint32_t code_found_lo = ~instance->generic.data & 0x00000000000003ff; - uint64_t code_found = subghz_protocol_blocks_reverse_key( - instance->generic.data, instance->generic.data_count_bit); + uint64_t code_found_reverse = subghz_protocol_blocks_reverse_key( + ~instance->generic.data, instance->generic.data_count_bit); - uint32_t code_found_lo = code_found & 0x00000000ffffffff; + uint32_t code_found_reverse_lo = code_found_reverse & 0x00000000000003ff; furi_string_cat_printf( output, @@ -343,5 +343,5 @@ void subghz_protocol_decoder_linear_get_string(void* context, FuriString* output instance->generic.data_count_bit, code_found_lo, code_found_reverse_lo, - DATA_TO_DIP(code_found_reverse_lo)); + DATA_TO_DIP(code_found_lo)); }