**************** Sleep Management **************** The sensor host follows a periodic sleep routine as described below. .. figure:: imgs/sh_sleep_timeline.png :scale: 50% The following actions are described below: 1. **Start**: At the start of this periodic routine, the sensor host must determine how long it needs to sleep for, this period denoted *Processing* is reserved for this calculation. The routine responsible for this calculation is ``calc_time_sleep``, returning the value :math:`T_{AVR,sleep}` 2. **Periodic Sleep**: The device then sleeps for the prescribed time. 3. **Timer Wake**: An interrupt generated by ``Timer2`` wakes the device. As this wake state requires a period of time to re-initialise the system, the time returned from ``calc_time_sleep`` is reduced by an overhead time 4. **Pre-Sample Wait**: With the device ready to sample, the device makes a final calculation to ensure the sample is received at the correct time