Fix variable name to `bps` and remove unused `unistd.h` include
Improve timming algorithm on faster speeds
Split to new function `set_speed`