fix time calculation bug. change unsigned 16 int to a signed integer. use map function to interpolate level value.