static void CalculatePirker(DistanceStat &pirker, const DistanceStat &planned, const DistanceStat &remaining_effective) { if (planned.IsDefined() && remaining_effective.IsDefined()) pirker.SetDistance(planned.GetDistance() - remaining_effective.GetDistance()); else pirker.Reset(); }
void DistanceStatComputer::CalcSpeed(DistanceStat &data, fixed time) { if (positive(time) && data.IsDefined()) data.speed = data.GetDistance() / time; else data.speed = fixed_zero; }
void DistanceStatComputer::ResetIncrementalSpeed(DistanceStat &data) { fixed distance = data.IsDefined() ? data.GetDistance() : fixed_zero; fixed speed = data.IsDefined() ? data.GetSpeed() : fixed_zero; df.Reset(distance, (is_positive ? -1 : 1) * speed); v_lpf.Reset((is_positive ? -1 : 1) * speed); data.speed_incremental = fixed_zero; // data.speed; av_dist.Reset(); }
void IncrementalSpeedComputer::Reset(DistanceStat &data) { fixed distance = data.IsDefined() ? data.GetDistance() : fixed(0); fixed speed = data.IsDefined() ? data.GetSpeed() : fixed(0); df.Reset(distance, (is_positive ? -1 : 1) * speed); v_lpf.Reset((is_positive ? -1 : 1) * speed); data.speed_incremental = fixed(0); // data.speed; av_dist.Reset(); last_time = fixed(-1); }