sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.94k stars 662 forks source link

How the ISR function handle the filtering out first high pulse in SYNC bit #487

Open HuynhKhuong opened 1 year ago

HuynhKhuong commented 1 year ago

Hello, I have one concern when analyzing source code, In function handling the reception side.

Specifically, in source code RCSwitch.cpp - function receiveProtocol() line 639:

*  ______________
     * |              |____________|XXXXXXXXXXXXX|
     *
     * |-filtered out-|--1st dur--|--Start data--|
     *
     * The 2nd saved duration starts the data
     */

The author mentioned that the first high pulse in SYNC phase is filtered out and not stored in timing[] array. I assumed that this point is done in the ISR function, which would be invoked anytime there's a change in signal level in a configured Input pin. (check RCSwitch.cpp - function handleInterrupt - 671). However, I didn't find any LOC that do the filtering logic.

Can someone clarify this point for me? Where the filtering stuff is done?

Thanks in advance!