longer capture and pulse end detection now working