Skip to content

setTimeOffset

Stefan Armborst edited this page Jan 27, 2020 · 10 revisions

setTimeOffset

increase or decrease the estimated conversion times of the next measurements.


  void setTimeoffset(int offset);

Result void

no physically access to wire required.


Parameter int offset

Negative values decreases the the expected conversion time, positive values increases the expected conversion time.
The conversion time itself is not changed, so a repeated call will not change the value further.
To reset this value (to default= 0) call setTimeOffset(0);.


Explanation

If you calibrated your sensor, the timings should be fine.
Some things can influence the timing. Have a look here.
With this function, you can do a fine tuning to the timings.

If you need always the fastest response, you should lower this value to -1 or -2 ms.

If you do not want to minimize calls to the sensor over wire, you may add a offset of +1 or +2 ms.
However, in the most cases you can leave the value to the default of zero (0), as the average time saving is about 0.5 ms.

If you lower the time, the sensor will ask this time earlier than calculated. In the most cases, there is no valid result. At the next loop cycle, the sensor asks again and so on...

After you get your result, you can ask with getReads() for the number of physically calls to wire.

Useful tools, to study this behaviour are the functions getTime() and getReads().
You should run the Sketch TestSuit.ino, to see this and other functions in action.

Changes to the timeOffset doesn't influence the timeout value.
A change in this value, also does not affect a current running measurement.

Clone this wiki locally