Beispiel #1
0
void
InfoBoxContentThermalRatio::Update(InfoBoxWindow &infobox)
{
  // Set Value
  SetValueFromFixed(infobox, _T("%2.0f%%"),
                    XCSoarInterface::Calculated().circling_percentage);
}
Beispiel #2
0
void
InfoBoxContentLDCruise::Update(InfoBoxData &data)
{
  if (XCSoarInterface::Calculated().cruise_ld == fixed(999)) {
    data.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(data, _T("%2.0f"), XCSoarInterface::Calculated().cruise_ld);
}
Beispiel #3
0
void
InfoBoxContentGLoad::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::Basic().acceleration.available) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(infobox, _T("%2.2f"),
                    XCSoarInterface::Basic().acceleration.g_load);
}
Beispiel #4
0
void
InfoBoxContentLDVario::Update(InfoBoxData &data)
{
  if (XCSoarInterface::Calculated().ld_vario == fixed(999) ||
      !XCSoarInterface::Basic().total_energy_vario_available ||
      !XCSoarInterface::Basic().airspeed_available) {
    data.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(data, _T("%2.0f"), XCSoarInterface::Calculated().ld_vario);
}
Beispiel #5
0
void
InfoBoxContentTemperature::Update(InfoBoxWindow &infobox)
{
  const NMEAInfo &basic = XCSoarInterface::Basic();
  if (!basic.temperature_available) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(infobox, _T("%2.1f")_T(DEG),
                    Units::ToUserTemperature(basic.temperature));
}
void
InfoBoxContentTaskSpeedInstant::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  if (!task_stats.task_valid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(infobox, _T("%2.0f"),
                    Units::ToUserTaskSpeed(task_stats.get_pirker_speed()));

  // Set Unit
  infobox.SetValueUnit(Units::Current.TaskSpeedUnit);
}
Beispiel #7
0
void
InfoBoxContentTaskSpeedInstant::Update(InfoBoxData &data)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  if (!task_stats.task_valid || !task_stats.IsPirkerSpeedAvailable()) {
    data.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(data, _T("%2.0f"),
                    Units::ToUserTaskSpeed(task_stats.get_pirker_speed()));

  // Set Unit
  data.SetValueUnit(Units::current.task_speed_unit);
}
Beispiel #8
0
void
InfoBoxContentTaskSpeed::Update(InfoBoxData &data)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  if (!task_stats.task_valid || !task_stats.total.travelled.IsDefined()) {
    data.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(data, _T("%2.0f"),
                    Units::ToUserTaskSpeed(task_stats.total.travelled.get_speed()));

  // Set Unit
  data.SetValueUnit(Units::current.task_speed_unit);
}
Beispiel #9
0
void
InfoBoxContentLDAvg::Update(InfoBoxData &data)
{
  if (XCSoarInterface::Calculated().average_ld == 0) {
    data.SetInvalid();
    return;
  }

  // Set Value
  if (XCSoarInterface::Calculated().average_ld < 0)
    data.SetValue(_T("^^^"));
  else if (XCSoarInterface::Calculated().average_ld >= 999)
    data.SetValue(_T("+++"));
  else
    SetValueFromFixed(data, _T("%2.0f"),
                      fixed(XCSoarInterface::Calculated().average_ld));
}
Beispiel #10
0
void
InfoBoxContentTaskAASpeedMin::Update(InfoBoxWindow &infobox)
{
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;

  if (!task_stats.task_valid || !positive(common_stats.aat_speed_min)) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(infobox, _T("%2.0f"),
                    Units::ToUserTaskSpeed(common_stats.aat_speed_min));

  // Set Unit
  infobox.SetValueUnit(Units::Current.TaskSpeedUnit);
}
Beispiel #11
0
void
InfoBoxContentWindSpeed::Update(InfoBoxWindow &infobox)
{
  const DerivedInfo &info = CommonInterface::Calculated();
  if (!info.wind_available) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(infobox, _T("%2.0f"),
                    Units::ToUserWindSpeed(info.wind.norm));

  // Set Unit
  infobox.SetValueUnit(Units::Current.WindSpeedUnit);

  // Set Comment
  infobox.SetComment(info.wind.bearing, _T("T"));
}
Beispiel #12
0
void
InfoBoxContentTaskAASpeedMin::Update(InfoBoxData &data)
{
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;

  if (!common_stats.ordered_has_targets ||
      !task_stats.task_valid || !positive(common_stats.aat_speed_min)) {
    data.SetInvalid();
    return;
  }

  // Set Value
  SetValueFromFixed(data, _T("%2.0f"),
                    Units::ToUserTaskSpeed(common_stats.aat_speed_min));

  // Set Unit
  data.SetValueUnit(Units::current.task_speed_unit);
}
Beispiel #13
0
void
InfoBoxContentTemperatureForecast::Update(InfoBoxWindow &infobox)
{
  // Set Value
  SetValueFromFixed(infobox, _T("%2.1f")_T(DEG), CuSonde::maxGroundTemperature);
}
Beispiel #14
0
void
InfoBoxContentBattery::Update(InfoBoxWindow &infobox)
{
#ifdef HAVE_BATTERY
  TCHAR tmp[32];

  bool DisplaySupplyVoltageAsValue=false;
  switch (Power::External::Status) {
    case Power::External::OFF:
      infobox.SetComment(_("AC Off"));
      break;
    case Power::External::ON:
      if (!XCSoarInterface::Basic().voltage_available)
        infobox.SetComment(_("AC ON"));
      else{
        DisplaySupplyVoltageAsValue = true;
        SetValueFromFixed(infobox, _T("%2.1fV"),
                          XCSoarInterface::Basic().voltage);
      }
      break;
    case Power::External::UNKNOWN:
    default:
      infobox.SetCommentInvalid();
  }
#ifndef ANDROID
  switch (Power::Battery::Status){
    case Power::Battery::HIGH:
    case Power::Battery::LOW:
    case Power::Battery::CRITICAL:
    case Power::Battery::CHARGING:
      if (Power::Battery::RemainingPercentValid){
#endif
        _stprintf(tmp, _T("%d%%"), Power::Battery::RemainingPercent);
        if (!DisplaySupplyVoltageAsValue)
          infobox.SetValue(tmp);
        else
          infobox.SetComment(tmp);
#ifndef ANDROID
      }
      else
        if (!DisplaySupplyVoltageAsValue)
          infobox.SetValueInvalid();
        else
          infobox.SetCommentInvalid();
      break;
    case Power::Battery::NOBATTERY:
    case Power::Battery::UNKNOWN:
      if (!DisplaySupplyVoltageAsValue)
        infobox.SetValueInvalid();
      else
        infobox.SetCommentInvalid();
  }
#endif
  return;

#endif

  if (XCSoarInterface::Basic().voltage_available) {
    SetValueFromFixed(infobox, _T("%2.1fV"),
                      XCSoarInterface::Basic().voltage);
    return;
  }

  infobox.SetInvalid();
}