Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noise filtering #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions RFControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool RFControl::existNewDuration(){
}

bool probablyFooter(unsigned int duration) {
return duration >= MIN_FOOTER_LENGTH;
return duration >= MIN_FOOTER_LENGTH && ((int)duration >0);
}

bool matchesFooter(unsigned int duration) {
Expand All @@ -117,6 +117,9 @@ void startRecording(unsigned int duration) {
printf(" => start recoding");
#endif
footer_length = duration;
#ifdef RF_CONTROL_SIMULATE_ARDUINO
printf(" footer = %u",duration);
#endif
data_end[0] = 0;
data_end[1] = 0;
data_end[2] = 0;
Expand Down Expand Up @@ -164,7 +167,14 @@ void recording(unsigned int duration, int package) {
else if (duration < 100000)
printf(" duration=%i", duration);
#endif
if (matchesFooter(duration)) //test for footer (+-25%).
if ((int)duration < 0){

#ifdef RF_CONTROL_SIMULATE_ARDUINO
printf("invalid duration=%i", duration);
#endif
RFControl::startReceiving(interruptPin);

}else if (matchesFooter(duration)) //test for footer (+-25%).
{
//Package is complete!!!!
timings[data_end[package]] = duration;
Expand Down