Exemple #1
0
void
InfoBoxContentTeamDistance::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  TCHAR tmp[32];
  Units::FormatUserDistance(XCSoarInterface::Calculated().TeammateRange,
                            tmp, 32, false);
  infobox.SetValue(tmp);

  // Set Unit
  infobox.SetValueUnit(Units::DistanceUnit);

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetComment(_T("---"));
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
Exemple #2
0
void
InfoBoxContentTeamBearing::Update(InfoBoxWindow &infobox)
{
  if (XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined() ||
      XCSoarInterface::SettingsComputer().TeammateCodeValid == true){
    // Set Value
    infobox.SetValue(XCSoarInterface::Calculated().TeammateBearing,
                     _T("T"));
  }
  else
    infobox.SetValueInvalid();

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetCommentInvalid();
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
Exemple #3
0
void
InfoBoxContentAltitudeBaro::Update(InfoBoxWindow &infobox)
{
  const NMEA_INFO &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  if (!basic.BaroAltitudeAvailable) {
    infobox.SetInvalid();

    if (basic.PressureAltitudeAvailable)
      infobox.SetComment(_("no QNH"));

    return;
  }

  // Set Value
  Units::FormatUserAltitude(basic.BaroAltitude, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(basic.BaroAltitude, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
Exemple #4
0
void
InfoBoxContentAltitudeBaro::Update(InfoBoxWindow &infobox)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  if (!basic.baro_altitude_available) {
    infobox.SetInvalid();

    if (basic.pressure_altitude_available)
      infobox.SetComment(_("no QNH"));

    return;
  }

  // Set Value
  Units::FormatUserAltitude(basic.baro_altitude, sTmp,
                            ARRAY_SIZE(sTmp), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(basic.baro_altitude, sTmp,
                                     ARRAY_SIZE(sTmp));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
Exemple #5
0
void
InfoBoxContentFinalETE::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;

  if (!task_stats.task_valid || !task_stats.total.achievable() ||
      !positive(task_stats.total.TimeRemaining)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = abs((int)task_stats.total.TimeRemaining) % (3600 * 24);
  int hours = (dd / 3600);
  int mins = (dd / 60 - hours * 60);
  int seconds = (dd - mins * 60 - hours * 3600);
  hours = hours % 24;

  if (hours > 0) { // hh:mm, ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), hours, mins);
    infobox.SetValue(tmp);

    // Set Comment
    _stprintf(tmp, _T("%02d"), seconds);
    infobox.SetComment(tmp);
  } else { // mm:ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), mins, seconds);
    infobox.SetValue(tmp);

    // Set Comment
    infobox.SetComment(_T(""));
  }
}
Exemple #6
0
void
InfoBoxContentTeamBearingDiff::Update(InfoBoxWindow &infobox)
{
#ifndef OLD_TASK
  infobox.SetInvalid();
  return;
#else
  if (!way_points.verify_index(XCSoarInterface::SettingsComputer().
      TeamCodeRefWaypoint)
      || !XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Angle Value = XCSoarInterface::Calculated().TeammateBearing -
                 XCSoarInterface::Basic().TrackBearing;

  SetValueBearingDifference(infobox, Value);
#endif

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetCommentInvalid();
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
Exemple #7
0
void
InfoBoxContentTeamBearingDiff::Update(InfoBoxWindow &infobox)
{
#ifndef OLD_TASK
  infobox.SetInvalid();
  return;
#else
  if (!way_points.verify_index(XCSoarInterface::SettingsComputer().
      TeamCodeRefWaypoint)
      || !XCSoarInterface::SettingsComputer().TeammateCodeValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  TCHAR tmp[32];
  double Value = XCSoarInterface::Calculated().TeammateBearing -
                 XCSoarInterface::Basic().TrackBearing;

  if (Value < -180.0)
    Value += 360.0;
  else if (Value > 180.0)
    Value -= 360.0;

#ifndef __MINGW32__
  if (Value > 1)
    _stprintf(tmp, TEXT("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, TEXT("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, TEXT("«»"));
#else
  if (Value > 1)
    _stprintf(tmp, TEXT("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, TEXT("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, TEXT("«»"));
#endif
  infobox.SetValue(tmp);
#endif

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetComment(_T("---"));
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
Exemple #8
0
void
InfoBoxContentTaskAATimeDelta::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;

  if (!task_stats.task_valid || !task_stats.total.achievable() ||
      !positive(task_stats.total.TimeRemaining) ||
      !positive(common_stats.aat_time_remaining)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  fixed diff = task_stats.total.TimeRemaining -
    common_stats.aat_time_remaining;
  int dd = abs((int)diff) % (3600 * 24);
  int hours = (dd / 3600);
  int mins = (dd / 60 - hours * 60);
  int seconds = (dd - mins * 60 - hours * 3600);
  hours = hours % 24;

  if (hours > 0) { // hh:mm, ss
    // Set Value
    _stprintf(tmp, negative(diff) ? _T("-%02d:%02d") : _T("%02d:%02d"),
              hours, mins);
    infobox.SetValue(tmp);

    // Set Comment
    _stprintf(tmp, _T("%02d"), seconds);
    infobox.SetComment(tmp);
  } else { // mm:ss
    // Set Value
    _stprintf(tmp, negative(diff) ? _T("-%02d:%02d") : _T("%02d:%02d"),
              mins, seconds);
    infobox.SetValue(tmp);

    // Set Comment
    infobox.SetComment(_T(""));
  }

  // Set Color
  if (negative(diff))
    // Red
    infobox.SetColor(1);
  else if (task_stats.total.TimeRemaining <
           common_stats.aat_time_remaining + fixed(5))
    // Blue
    infobox.SetColor(2);
  else
    // Black
    infobox.SetColor(0);
}
void
InfoBoxContentMacCready::Update(InfoBoxWindow &infobox)
{
  const SETTINGS_COMPUTER &settings_computer =
    CommonInterface::SettingsComputer();

  SetVSpeed(infobox, settings_computer.glide_polar_task.GetMC());

  // Set Comment
  if (XCSoarInterface::SettingsComputer().auto_mc)
    infobox.SetComment(_("AUTO"));
  else
    infobox.SetComment(_("MANUAL"));
}
void
InfoBoxContentTaskTimeUnderMaxHeight::Update(InfoBoxWindow &infobox)
{
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  const fixed maxheight = fixed(protected_task_manager->
                                get_ordered_task_behaviour().start_max_height);

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

  const int dd = (int)(XCSoarInterface::Basic().Time -
      common_stats.TimeUnderStartMaxHeight);

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  infobox.SetValue(HHMMSSsmart);
  infobox.SetComment(_("Time Below"));
}
Exemple #11
0
void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  const DerivedInfo &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.altitude_agl_valid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.altitude_agl, sTmp,
                            ARRAY_SIZE(sTmp), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.altitude_agl, sTmp,
                                     ARRAY_SIZE(sTmp));
  infobox.SetComment(sTmp);

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

  // Set Color (red/black)
  infobox.SetColor(calculated.altitude_agl <
      XCSoarInterface::SettingsComputer().task.route_planner.safety_height_terrain ? 1 : 0);
}
Exemple #12
0
void
InfoBoxContentAltitudeQFE::Update(InfoBoxWindow &infobox)
{
  const NMEA_INFO &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  if (!basic.GPSAltitudeAvailable) {
    infobox.SetInvalid();
    return;
  }

  fixed Value = basic.GPSAltitude;

  const Waypoint* home_waypoint = way_points.find_home();
  if (home_waypoint)
    Value -= home_waypoint->Altitude;

  // Set Value
  Units::FormatUserAltitude(Value, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(Value, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
Exemple #13
0
void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  const DERIVED_INFO &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.AltitudeAGLValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.AltitudeAGL, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.AltitudeAGL, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

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

  // Set Color (red/black)
  infobox.SetColor(calculated.AltitudeAGL <
      XCSoarInterface::SettingsComputer().route_planner.safety_height_terrain ? 1 : 0);
}
void
InfoBoxContentNextETA::Update(InfoBoxWindow &infobox)
{
  // use proper non-terminal next task stats

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      !XCSoarInterface::Calculated().task_stats.current_leg.achievable()) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = (int)(XCSoarInterface::Calculated().task_stats.current_leg.
                 solution_remaining.TimeElapsed) +
    DetectCurrentTime(XCSoarInterface::Basic());
  const BrokenTime t = BrokenTime::FromSecondOfDayChecked(abs(dd));

  // Set Value
  _stprintf(tmp, _T("%02u:%02u"), t.hour, t.minute);
  infobox.SetValue(tmp);

  // Set Comment
  _stprintf(tmp, _T("%02u"), t.second);
  infobox.SetComment(tmp);
}
void
InfoBoxContentFinalETEVMG::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::Basic().GroundSpeedAvailable) {
    infobox.SetInvalid();
    return;
  }

  const fixed d = XCSoarInterface::Calculated().task_stats.
    total.remaining.get_distance();
  const fixed &v = XCSoarInterface::Basic().GroundSpeed;

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      !positive(d) ||
      !positive(v)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  const int dd = (int)(d/v);
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  infobox.SetValue(HHMMSSsmart);
  infobox.SetComment(SSsmart);
}
Exemple #16
0
void
InfoBoxContentAltitudeAGL::Update(InfoBoxWindow &infobox)
{
  TCHAR sTmp[32];

  if (!XCSoarInterface::Calculated().TerrainValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(XCSoarInterface::Basic().AltitudeAGL, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(XCSoarInterface::Basic().AltitudeAGL, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::AltitudeUnit);

  if (XCSoarInterface::Basic().AltitudeAGL <
      XCSoarInterface::SettingsComputer().safety_height_terrain)
    // red
    infobox.SetColor(1);
  else
    infobox.SetColor(0);
}
void
InfoBoxContentTaskAATimeDelta::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;

  if (!task_stats.task_valid || !task_stats.total.achievable() ||
      !positive(task_stats.total.TimeRemaining) ||
      !positive(common_stats.aat_time_remaining)) {
    infobox.SetInvalid();
    return;
  }

  fixed diff = task_stats.total.TimeRemaining -
    common_stats.aat_time_remaining;

  TCHAR HHMMSSsmart[32];
  TCHAR SSsmart[32];
  const int dd = abs((int)diff);
  Units::TimeToTextSmart(HHMMSSsmart, SSsmart, dd);

  TCHAR tmp[32];
  _stprintf(tmp, negative(diff) ? _T("-%s") : _T("%s"), HHMMSSsmart);
  infobox.SetValue(tmp);

  infobox.SetComment(SSsmart);

  // Set Color (red/blue/black)
  infobox.SetColor(negative(diff) ? 1 :
                   task_stats.total.TimeRemaining <
                       common_stats.aat_time_remaining + fixed(5) ? 2 : 0);
}
Exemple #18
0
void
InfoBoxContentFinalETA::Update(InfoBoxWindow &infobox)
{
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
  if (!task_stats.task_valid || !task_stats.total.achievable()) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = abs((int)(task_stats.total.solution_remaining.TimeElapsed +
      fixed(DetectCurrentTime(&XCSoarInterface::Basic())))) % (3600 * 24);
  int hours = (dd / 3600);
  int mins = (dd / 60 - hours * 60);
  int seconds = (dd - mins * 60 - hours * 3600);
  hours = hours % 24;

  // Set Value
  _stprintf(tmp, _T("%02d:%02d"), hours, mins);
  infobox.SetValue(tmp);

  // Set Comment
  _stprintf(tmp, _T("%02d"), seconds);
  infobox.SetComment(tmp);
}
Exemple #19
0
void
InfoBoxContentTeamCode::Update(InfoBoxWindow &infobox)
{
  if (!XCSoarInterface::SettingsComputer().TeamCodeRefWaypoint) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  infobox.SetValue(XCSoarInterface::Calculated().OwnTeamCode.GetCode());

  // Set Comment
  if (XCSoarInterface::SettingsComputer().TeammateCodeValid == true){
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeammateCode.GetCode());
    if (!XCSoarInterface::SettingsComputer().TeamFlarmTracking)
      infobox.SetColorBottom(0);
    else if (XCSoarInterface::Basic().flarm.FindTraffic(
        XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
      infobox.SetColorBottom(2);
    else
      infobox.SetColorBottom(1);
  }
  else
    infobox.SetCommentInvalid();
}
Exemple #20
0
void
InfoBoxContentThermalBand::Update(InfoBoxWindow &infobox)
{
  infobox.SetComment(_T(""));
  infobox.SetValue(_T(""));
  infobox.invalidate();
}
Exemple #21
0
void
InfoBoxContentAltitudeQFE::Update(InfoBoxWindow &infobox)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  if (!basic.gps_altitude_available) {
    infobox.SetInvalid();
    return;
  }

  fixed Value = basic.gps_altitude;

  const Waypoint *home_waypoint = way_points.GetHome();
  if (home_waypoint)
    Value -= home_waypoint->altitude;

  // Set Value
  Units::FormatUserAltitude(Value, sTmp,
                            ARRAY_SIZE(sTmp), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(Value, sTmp,
                                     ARRAY_SIZE(sTmp));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
Exemple #22
0
void
InfoBoxContentTaskProgress::Update(InfoBoxWindow &infobox)
{
  infobox.SetComment(_T(""));
  infobox.SetValue(_T(""));
  infobox.invalidate();
}
Exemple #23
0
void
InfoBoxContentFlightLevel::Update(InfoBoxWindow &infobox)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  const SETTINGS_COMPUTER &settings_computer =
    CommonInterface::SettingsComputer();
  TCHAR sTmp[32];

  if (basic.pressure_altitude_available) {
    fixed Altitude = Units::ToUserUnit(basic.pressure_altitude, unFeet);

    // Title color black
    infobox.SetColorTop(0);

    // Set Value
    _stprintf(sTmp, _T("%03d"), iround(Altitude/100));
    infobox.SetValue(sTmp);

    // Set Comment
    _stprintf(sTmp, _T("%dft"), iround(Altitude));
    infobox.SetComment(sTmp);

  } else if (basic.gps_altitude_available &&
             settings_computer.pressure_available) {
    // Take gps altitude as baro altitude. This is inaccurate but still fits our needs.
    const AtmosphericPressure &qnh = settings_computer.pressure;
    fixed Altitude = Units::ToUserUnit(qnh.QNHAltitudeToPressureAltitude(basic.gps_altitude), unFeet);

    // Title color red
    infobox.SetColorTop(1);

    // Set Value
    _stprintf(sTmp, _T("%03d"), iround(Altitude/100));
    infobox.SetValue(sTmp);

    // Set Comment
    _stprintf(sTmp, _T("%dft"), iround(Altitude));
    infobox.SetComment(sTmp);

  } else if ((basic.baro_altitude_available || basic.gps_altitude_available) &&
             !settings_computer.pressure_available) {
    infobox.SetInvalid();
    infobox.SetComment(_("no QNH"));
  } else {
    infobox.SetInvalid();
  }
}
void
InfoBoxContentNextWaypoint::Update(InfoBoxWindow &infobox)
{
  // use proper non-terminal next task stats

  const Waypoint* way_point = protected_task_manager != NULL
    ? protected_task_manager->getActiveWaypoint()
    : NULL;

  if (!way_point) {
    infobox.SetTitle(_("Next"));
    infobox.SetInvalid();
    return;
  }
  SetTitleFromWaypointName(infobox, way_point);

  // Set Comment
  if (way_point->radio_frequency.IsDefined()) {
    StaticString<128> comment;
    const unsigned freq = way_point->radio_frequency.GetKiloHertz();
    _sntprintf(comment.buffer(), comment.MAX_SIZE, _T("%u.%03u %s"),
               freq / 1000, freq % 1000, way_point->Comment.c_str());
    infobox.SetComment(comment);
  }
  else
    infobox.SetComment(way_point->Comment.c_str());

  const GlideResult &solution_remaining =
    XCSoarInterface::Calculated().task_stats.current_leg.solution_remaining;
  if (!XCSoarInterface::Basic().track_available ||
      !XCSoarInterface::Calculated().task_stats.task_valid ||
      !solution_remaining.defined() ||
      solution_remaining.Vector.Distance <= fixed(10)) {
    infobox.SetValueInvalid();
    return;
  }

  // Set Value
  Angle Value =
    solution_remaining.Vector.Bearing - XCSoarInterface::Basic().track;

  SetValueBearingDifference(infobox, Value);

  // Set Color (blue/black)
  infobox.SetColor(solution_remaining.is_final_glide() ? 2 : 0);
}
Exemple #25
0
void
InfoBoxContentHorizon::Update(InfoBoxWindow &infobox)
{
  infobox.SetComment(_T(""));
  if (!CommonInterface::Basic().acceleration.available) {
    infobox.SetInvalid();
    return;
  }
  infobox.SetValue(_T(""));
  infobox.invalidate();
}
Exemple #26
0
void
InfoBoxContentBarogram::Update(InfoBoxWindow &infobox)
{
  const NMEA_INFO &basic = CommonInterface::Basic();
  TCHAR sTmp[32];

  Units::FormatUserAltitude(basic.NavAltitude, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  infobox.SetValue(_T(""));
  infobox.invalidate();
}
Exemple #27
0
void
InfoBoxContentNextETE::Update(InfoBoxWindow &infobox)
{
  // use proper non-terminal next task stats

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      !XCSoarInterface::Calculated().task_stats.current_leg.achievable() ||
      !positive(XCSoarInterface::Calculated().task_stats.
                current_leg.TimeRemaining)) {
    infobox.SetInvalid();
    return;
  }

  TCHAR tmp[32];
  int dd = abs((int)XCSoarInterface::Calculated().
               task_stats.current_leg.TimeRemaining) % (3600 * 24);
  int hours = (dd / 3600);
  int mins = (dd / 60 - hours * 60);
  int seconds = (dd - mins * 60 - hours * 3600);
  hours = hours % 24;

  if (hours > 0) { // hh:mm, ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), hours, mins);
    infobox.SetValue(tmp);

    // Set Comment
    _stprintf(tmp, _T("%02d"), seconds);
    infobox.SetComment(tmp);
  } else { // mm:ss
    // Set Value
    _stprintf(tmp, _T("%02d:%02d"), mins, seconds);
    infobox.SetValue(tmp);

    // Set Comment
    infobox.SetComment(_T(""));
  }
}
Exemple #28
0
void
InfoBoxContentTeamBearing::Update(InfoBoxWindow &infobox)
{
  // Set Value
  TCHAR tmp[32];
  _stprintf(tmp, _T("%2.0f")_T(DEG)_T("T"), (double)
            XCSoarInterface::Calculated().TeammateBearing.value_degrees());
  infobox.SetValue(tmp);

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetComment(_T("---"));
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
Exemple #29
0
void
InfoBoxContentHomeDistance::Update(InfoBoxWindow &infobox)
{
  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;

  // Set Value
  TCHAR tmp[32];
  Units::FormatUserDistance(common_stats.vector_home.Distance, tmp, 32, false);
  infobox.SetValue(tmp);

  // Set Unit
  infobox.SetValueUnit(Units::DistanceUnit);

  infobox.SetComment(common_stats.vector_home.Bearing);
}
Exemple #30
0
void
InfoBoxContentSpark::label_vspeed(InfoBoxWindow &infobox,
                                  const TraceVariableHistory& var)
{
  if (var.empty())
    return;

  TCHAR sTmp[32];
  Units::FormatUserVSpeed(var.last(), sTmp,
                          sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  infobox.SetValue(_T(""));
  infobox.invalidate();
}