press detected logic