[FL-1940] SubGuz: fix te pricenton protocol #755
This commit is contained in:
parent
4418e73b26
commit
841e18dfec
@ -209,6 +209,7 @@ void subghz_decoder_princeton_parse(
|
|||||||
instance->common.parser_step = PrincetonDecoderStepSaveDuration;
|
instance->common.parser_step = PrincetonDecoderStepSaveDuration;
|
||||||
instance->common.code_found = 0;
|
instance->common.code_found = 0;
|
||||||
instance->common.code_count_bit = 0;
|
instance->common.code_count_bit = 0;
|
||||||
|
instance->te = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->common.parser_step = PrincetonDecoderStepReset;
|
instance->common.parser_step = PrincetonDecoderStepReset;
|
||||||
}
|
}
|
||||||
@ -217,6 +218,7 @@ void subghz_decoder_princeton_parse(
|
|||||||
//save duration
|
//save duration
|
||||||
if(level) {
|
if(level) {
|
||||||
instance->common.te_last = duration;
|
instance->common.te_last = duration;
|
||||||
|
instance->te += duration;
|
||||||
instance->common.parser_step = PrincetonDecoderStepCheckDuration;
|
instance->common.parser_step = PrincetonDecoderStepCheckDuration;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -226,13 +228,7 @@ void subghz_decoder_princeton_parse(
|
|||||||
instance->common.parser_step = PrincetonDecoderStepSaveDuration;
|
instance->common.parser_step = PrincetonDecoderStepSaveDuration;
|
||||||
if(instance->common.code_count_bit ==
|
if(instance->common.code_count_bit ==
|
||||||
instance->common.code_min_count_bit_for_found) {
|
instance->common.code_min_count_bit_for_found) {
|
||||||
if(instance->common.code_last_found == instance->common.code_found) {
|
instance->te /= (instance->common.code_count_bit * 4 + 1);
|
||||||
//instance->te = (instance->te+instance->common.te_last)/2; //Option 1 TE averaging
|
|
||||||
if(instance->te > instance->common.te_last)
|
|
||||||
instance->te = instance->common.te_last; //Option 2 TE averaging
|
|
||||||
} else {
|
|
||||||
instance->te = instance->common.te_last;
|
|
||||||
}
|
|
||||||
|
|
||||||
instance->common.code_last_found = instance->common.code_found;
|
instance->common.code_last_found = instance->common.code_found;
|
||||||
instance->common.code_last_count_bit = instance->common.code_count_bit;
|
instance->common.code_last_count_bit = instance->common.code_count_bit;
|
||||||
@ -245,9 +241,12 @@ void subghz_decoder_princeton_parse(
|
|||||||
}
|
}
|
||||||
instance->common.code_found = 0;
|
instance->common.code_found = 0;
|
||||||
instance->common.code_count_bit = 0;
|
instance->common.code_count_bit = 0;
|
||||||
|
instance->te = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance->te += duration;
|
||||||
|
|
||||||
if((DURATION_DIFF(instance->common.te_last, instance->common.te_short) <
|
if((DURATION_DIFF(instance->common.te_last, instance->common.te_short) <
|
||||||
instance->common.te_delta) &&
|
instance->common.te_delta) &&
|
||||||
(DURATION_DIFF(duration, instance->common.te_long) <
|
(DURATION_DIFF(duration, instance->common.te_long) <
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
struct SubGhzDecoderPrinceton {
|
struct SubGhzDecoderPrinceton {
|
||||||
SubGhzProtocolCommon common;
|
SubGhzProtocolCommon common;
|
||||||
uint16_t te;
|
uint32_t te;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SubGhzEncoderPrinceton anonymous type */
|
/** SubGhzEncoderPrinceton anonymous type */
|
||||||
|
Loading…
Reference in New Issue
Block a user