reset afterOffset, toggle led and flip