当前位置: 首页>>代码示例>>C++>>正文


C++ NMEAInfo::ProvideNoncompVario方法代码示例

本文整理汇总了C++中NMEAInfo::ProvideNoncompVario方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInfo::ProvideNoncompVario方法的具体用法?C++ NMEAInfo::ProvideNoncompVario怎么用?C++ NMEAInfo::ProvideNoncompVario使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NMEAInfo的用法示例。


在下文中一共展示了NMEAInfo::ProvideNoncompVario方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: strtol

bool
BlueFlyDevice::ParsePRS(const char *content, NMEAInfo &info)
{
  // e.g. PRS 17CBA

  char *endptr;
  long value = strtol(content, &endptr, 16);
  if (endptr != content) {
    AtmosphericPressure pressure = AtmosphericPressure::Pascal(fixed(value));

    kalman_filter.Update(pressure.GetHectoPascal(), fixed(0.25), fixed(0.02));

    info.ProvideNoncompVario(ComputeNoncompVario(kalman_filter.GetXAbs(),
                                                 kalman_filter.GetXVel()));
    info.ProvideStaticPressure(AtmosphericPressure::HectoPascal(kalman_filter.GetXAbs()));
  }

  return true;
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:19,代码来源:Parser.cpp

示例2: fixed

static bool
LK8EX1(NMEAInputLine &line, NMEAInfo &info)
{
  unsigned pressure;
  bool pressure_available = (line.ReadChecked(pressure) && pressure != 999999);

  if (pressure_available)
    info.ProvideStaticPressure(AtmosphericPressure::Pascal(fixed(pressure)));

  unsigned altitude;
  bool altitude_available = (line.ReadChecked(altitude) && altitude != 99999);

  if (altitude_available && !pressure_available)
    info.ProvidePressureAltitude(fixed(altitude));

  int vario;
  if (line.ReadChecked(vario) && vario != 9999)
    info.ProvideNoncompVario(fixed(vario) / 100);

  int temperature;
  if (line.ReadChecked(temperature) && temperature != 99) {
    info.temperature = fixed(temperature);
    info.temperature_available = true;
  }

  fixed battery_value;
  if (line.ReadChecked(battery_value) &&
      (unsigned)(battery_value + fixed(0.5)) != 999) {
    if (battery_value > fixed(1000)) {
      info.battery_level = battery_value - fixed(1000);
      info.battery_level_available.Update(info.clock);
    } else {
      info.voltage = battery_value;
      info.voltage_available.Update(info.clock);
    }
  }

  return true;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:39,代码来源:GTAltimeter.cpp

示例3: strtol

bool
FlyNetDevice::ParsePRS(const char *content, NMEAInfo &info)
{
  // e.g. _PRS 00017CBA

  // The frequency at which the device sends _PRS sentences
  static constexpr double frequency = 1 / 0.048;

  char *endptr;
  long value = strtol(content, &endptr, 16);
  if (endptr != content) {
    auto pressure = AtmosphericPressure::Pascal(value);

    if (info.static_pressure_available) {
      // Calculate non-compensated vario value

      auto last_pressure = info.static_pressure;

      auto alt = AtmosphericPressure::StaticPressureToPressureAltitude(pressure);
      auto last_alt = AtmosphericPressure::StaticPressureToPressureAltitude(last_pressure);

      auto vario = (alt - last_alt) * frequency;
      vario_filter.Update(vario);

      auto vario_filtered = vario_filter.Average();

      info.ProvideNoncompVario(vario_filtered);
    } else {
      // Reset filter when the first new pressure sentence is received
      vario_filter.Reset();
    }

    info.ProvideStaticPressure(pressure);
  }

  return true;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:37,代码来源:FlyNet.cpp


注:本文中的NMEAInfo::ProvideNoncompVario方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。