Просмотр исходного кода

SubGhz: bug fixes (#1192)

* Subghz: fix simultaneous detection of Princeton and GateTx
* SubGhz: fix phantom frequencies in the Frequency Analyzer
Skorpionm 3 лет назад
Родитель
Сommit
f4a205142d

+ 1 - 0
applications/subghz/helpers/subghz_frequency_analyzer_worker.c

@@ -71,6 +71,7 @@ static int32_t subghz_frequency_analyzer_worker_thread(void* context) {
     furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
     furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
     furi_hal_subghz_set_frequency(433920000);
     furi_hal_subghz_set_frequency(433920000);
     furi_hal_subghz_flush_rx();
     furi_hal_subghz_flush_rx();
+    furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate);
     furi_hal_subghz_rx();
     furi_hal_subghz_rx();
 
 
     while(instance->worker_running) {
     while(instance->worker_running) {

+ 0 - 6
lib/subghz/protocols/firefly.c

@@ -6,12 +6,6 @@
 #include "../blocks/generic.h"
 #include "../blocks/generic.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
 
 
-/*
- * Help
- * https://phreakerclub.com/447
- *
- */
-
 #define TAG "SubGhzProtocolFirefly"
 #define TAG "SubGhzProtocolFirefly"
 
 
 #define DIP_PATTERN "%c%c%c%c%c%c%c%c%c%c"
 #define DIP_PATTERN "%c%c%c%c%c%c%c%c%c%c"

+ 1 - 1
lib/subghz/protocols/keeloq.c

@@ -11,7 +11,7 @@
 #include "../blocks/generic.h"
 #include "../blocks/generic.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
 
 
-#define TAG "SubGhzProtocolkeeloq"
+#define TAG "SubGhzProtocolKeeloq"
 
 
 static const SubGhzBlockConst subghz_protocol_keeloq_const = {
 static const SubGhzBlockConst subghz_protocol_keeloq_const = {
     .te_short = 400,
     .te_short = 400,

+ 0 - 6
lib/subghz/protocols/nero_sketch.c

@@ -6,12 +6,6 @@
 #include "../blocks/generic.h"
 #include "../blocks/generic.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
 
 
-/*
- * Help
- * https://phreakerclub.com/447
- *
- */
-
 #define TAG "SubGhzProtocolNeroSketch"
 #define TAG "SubGhzProtocolNeroSketch"
 
 
 static const SubGhzBlockConst subghz_protocol_nero_sketch_const = {
 static const SubGhzBlockConst subghz_protocol_nero_sketch_const = {

+ 0 - 6
lib/subghz/protocols/nice_flo.c

@@ -5,12 +5,6 @@
 #include "../blocks/generic.h"
 #include "../blocks/generic.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
 
 
-/*
- * Help
- * https://phreakerclub.com/447
- *
- */
-
 #define TAG "SubGhzProtocolNiceFLO"
 #define TAG "SubGhzProtocolNiceFLO"
 
 
 static const SubGhzBlockConst subghz_protocol_nice_flo_const = {
 static const SubGhzBlockConst subghz_protocol_nice_flo_const = {

+ 1 - 0
lib/subghz/protocols/nice_flor_s.c

@@ -5,6 +5,7 @@
 #include "../blocks/encoder.h"
 #include "../blocks/encoder.h"
 #include "../blocks/generic.h"
 #include "../blocks/generic.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
+
 /*
 /*
  * https://phreakerclub.com/1615
  * https://phreakerclub.com/1615
  * https://phreakerclub.com/forum/showthread.php?t=2360
  * https://phreakerclub.com/forum/showthread.php?t=2360

+ 14 - 10
lib/subghz/protocols/princeton.c

@@ -12,7 +12,7 @@
  *
  *
  */
  */
 
 
-#define TAG "SubGhzProtocolCAME"
+#define TAG "SubGhzProtocolPrinceton"
 
 
 static const SubGhzBlockConst subghz_protocol_princeton_const = {
 static const SubGhzBlockConst subghz_protocol_princeton_const = {
     .te_short = 400,
     .te_short = 400,
@@ -28,6 +28,7 @@ struct SubGhzProtocolDecoderPrinceton {
     SubGhzBlockGeneric generic;
     SubGhzBlockGeneric generic;
 
 
     uint32_t te;
     uint32_t te;
+    uint32_t last_data;
 };
 };
 
 
 struct SubGhzProtocolEncoderPrinceton {
 struct SubGhzProtocolEncoderPrinceton {
@@ -241,15 +242,18 @@ void subghz_protocol_decoder_princeton_feed(void* context, bool level, uint32_t
                 instance->decoder.parser_step = PrincetonDecoderStepSaveDuration;
                 instance->decoder.parser_step = PrincetonDecoderStepSaveDuration;
                 if(instance->decoder.decode_count_bit ==
                 if(instance->decoder.decode_count_bit ==
                    subghz_protocol_princeton_const.min_count_bit_for_found) {
                    subghz_protocol_princeton_const.min_count_bit_for_found) {
-                    instance->te /= (instance->decoder.decode_count_bit * 4 + 1);
-
-                    instance->generic.data = instance->decoder.decode_data;
-                    instance->generic.data_count_bit = instance->decoder.decode_count_bit;
-                    instance->generic.serial = instance->decoder.decode_data >> 4;
-                    instance->generic.btn = (uint8_t)instance->decoder.decode_data & 0x00000F;
-
-                    if(instance->base.callback)
-                        instance->base.callback(&instance->base, instance->base.context);
+                    if(instance->last_data == instance->decoder.decode_data) {
+                        instance->te /= (instance->decoder.decode_count_bit * 4 + 1);
+
+                        instance->generic.data = instance->decoder.decode_data;
+                        instance->generic.data_count_bit = instance->decoder.decode_count_bit;
+                        instance->generic.serial = instance->decoder.decode_data >> 4;
+                        instance->generic.btn = (uint8_t)instance->decoder.decode_data & 0x00000F;
+
+                        if(instance->base.callback)
+                            instance->base.callback(&instance->base, instance->base.context);
+                    }
+                    instance->last_data = instance->decoder.decode_data;
                 }
                 }
                 instance->decoder.decode_data = 0;
                 instance->decoder.decode_data = 0;
                 instance->decoder.decode_count_bit = 0;
                 instance->decoder.decode_count_bit = 0;

+ 1 - 0
lib/subghz/protocols/princeton_for_testing.c

@@ -2,6 +2,7 @@
 
 
 #include "furi_hal.h"
 #include "furi_hal.h"
 #include "../blocks/math.h"
 #include "../blocks/math.h"
+
 /*
 /*
  * Help
  * Help
  * https://phreakerclub.com/447
  * https://phreakerclub.com/447