During inactivity and between successive steps, d
equals 1. A negative peak (a decrease below a threshold)
is considered a step. This threshold is different
for the left and right leg, depending on which is closer
to the phone. To increase the precision of the measurement
and to filter out noise, we use a weighted
moving average of the last 10 values of d (2).