|
@@ -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;
|