コード例 #1
0
ファイル: FlightLogger.cpp プロジェクト: MaxPower-No1/XCSoar
void
FlightLogger::Tick(const MoreData &basic, const DerivedInfo &calculated)
{
  assert(!path.IsNull());

  if (basic.gps.replay || basic.gps.simulator)
    return;

  if (!basic.time_available || !basic.date_time_utc.IsDatePlausible())
    /* can't work without these */
    return;

  if (last_time > 0) {
    auto time_delta = basic.time - last_time;
    if (time_delta < 0 || time_delta > 300)
      /* reset on time warp (positive or negative) */
      Reset();
    else if (time_delta < 0.5)
      /* not enough time has passed since the last call: ignore this
         GPS fix, don't update last_time, just return */
      return;
    else
      TickInternal(basic, calculated);
  }

  last_time = basic.time;
}
コード例 #2
0
void
FlightLogger::Tick(const MoreData &basic, const DerivedInfo &calculated)
{
  assert(!path.empty());

  if (!basic.time_available || !basic.date_available)
    /* can't work without these */
    return;

  if (positive(last_time)) {
    fixed time_delta = basic.time - last_time;
    if (negative(time_delta) || time_delta > fixed(300))
      /* reset on time warp (positive or negative) */
      Reset();
    else if (time_delta < fixed_half)
      /* not enough time has passed since the last call: ignore this
         GPS fix, don't update last_time, just return */
      return;
    else
      TickInternal(basic, calculated);
  }

  last_time = basic.time;
}