add delay adjust protect

modify main loop demo: up, down, close.