void UpdateInfoBoxSpeed(InfoBoxData &data) { const NMEAInfo &basic = CommonInterface::Basic(); if (!basic.airspeed_available) { data.SetInvalid(); return; } data.SetValueFromSpeed(basic.true_airspeed, false); }
void UpdateInfoBoxFinalGR(InfoBoxData &data) { const TaskStats &task_stats = CommonInterface::Calculated().task_stats; if (!task_stats.task_valid) { data.SetInvalid(); return; } auto gradient = task_stats.total.gradient; if (gradient <= 0) { data.SetValue(_T("+++")); return; } if (::GradientValid(gradient)) data.SetValueFromGlideRatio(gradient); else data.SetInvalid(); }
void InfoBoxContentSpeedGround::Update(InfoBoxData &data) { const NMEAInfo &basic = CommonInterface::Basic(); if (!basic.ground_speed_available) { data.SetInvalid(); return; } data.SetValueFromSpeed(basic.ground_speed); }
void UpdateInfoBoxGLoad(InfoBoxData &data) { if (!CommonInterface::Basic().acceleration.available) { data.SetInvalid(); return; } // Set Value data.SetValue(_T("%2.2f"), CommonInterface::Basic().acceleration.g_load); }
void InfoBoxContentGLoad::Update(InfoBoxData &data) { if (!XCSoarInterface::Basic().acceleration.available) { data.SetInvalid(); return; } // Set Value data.SetValue(_T("%2.2f"), XCSoarInterface::Basic().acceleration.g_load); }
void InfoBoxContentHorizon::Update(InfoBoxData &data) { if (!CommonInterface::Basic().attitude.IsBankAngleUseable() && !CommonInterface::Basic().attitude.IsPitchAngleUseable()) { data.SetInvalid(); return; } data.SetCustom(); }
void InfoBoxContentThermalLastGain::Update(InfoBoxData &data) { const OneClimbInfo &thermal = CommonInterface::Calculated().last_thermal; if (!thermal.IsDefined()) { data.SetInvalid(); return; } data.SetValueFromAltitude(thermal.gain); }
void InfoBoxContentThermalLastAvg::Update(InfoBoxData &data) { const OneClimbInfo &thermal = CommonInterface::Calculated().last_thermal; if (!thermal.IsDefined()) { data.SetInvalid(); return; } SetVSpeed(data, thermal.lift_rate); }
void InfoBoxContentNextLegEqThermal::Update(InfoBoxData &data) { const fixed next_leg_eq_thermal = CommonInterface::Calculated().next_leg_eq_thermal; if (negative(next_leg_eq_thermal)) { data.SetInvalid(); return; } SetVSpeed(data, next_leg_eq_thermal); }
void InfoBoxContentThermalAllAvg::Update(InfoBoxData &data) { if (!positive(XCSoarInterface::Calculated().time_climb)) { data.SetInvalid(); return; } SetVSpeed(data, XCSoarInterface::Calculated().total_height_gain / XCSoarInterface::Calculated().time_climb); }
void InfoBoxContentFinalGR::Update(InfoBoxData &data) { const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats; if (!task_stats.task_valid) { data.SetInvalid(); return; } fixed gradient = task_stats.total.gradient; if (!positive(gradient)) { data.SetValue(_T("+++")); return; } if (::GradientValid(gradient)) { data.UnsafeFormatValue(_T("%d"), (int)gradient); } else { data.SetInvalid(); } }
void UpdateInfoBoxFinalAltitudeRequire(InfoBoxData &data) { const TaskStats &task_stats = CommonInterface::Calculated().task_stats; if (!task_stats.task_valid || !task_stats.total.solution_remaining.IsOk()) { data.SetInvalid(); return; } data.SetValueFromAltitude(task_stats.total.solution_remaining.GetRequiredAltitude()); }
void InfoBoxContentNextMC0AltitudeDiff::Update(InfoBoxData &data) { const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats; const GlideResult &next_solution = task_stats.current_leg.solution_mc0; if (!task_stats.task_valid || !next_solution.IsDefined()) { data.SetInvalid(); return; } data.SetValueFromArrival(next_solution.altitude_difference); }
void InfoBoxContentNearestAirspaceVertical::Update(InfoBoxData &data) { NearestAirspace nearest = FindNearestVerticalAirspace(); if (!nearest.IsDefined()) { data.SetInvalid(); return; } data.SetValueFromArrival(nearest.distance); data.SetComment(nearest.airspace->GetName()); }
void UpdateInfoBoxCruiseEfficiency(InfoBoxData &data) { const TaskStats &task_stats = CommonInterface::Calculated().task_stats; if (!task_stats.task_valid || !task_stats.start.task_started) { data.SetInvalid(); return; } data.UnsafeFormatValue(_T("%d"), (int) (task_stats.cruise_efficiency * 100)); data.SetCommentFromVerticalSpeed(task_stats.effective_mc, false); }
void UpdateInfoBoxTerrainHeight(InfoBoxData &data) { const TerrainInfo &calculated = CommonInterface::Calculated(); if (!calculated.terrain_valid){ data.SetInvalid(); return; } data.SetValueFromAltitude(calculated.terrain_altitude); data.SetCommentFromAlternateAltitude(calculated.terrain_altitude); }
void InfoBoxContentFinalAltitudeDiff::Update(InfoBoxData &data) { const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats; if (!task_stats.task_valid || !task_stats.total.solution_remaining.IsOk()) { data.SetInvalid(); return; } data.SetValueFromArrival(task_stats.total.solution_remaining.altitude_difference); }
void UpdateInfoBoxHumidity(InfoBoxData &data) { const NMEAInfo &basic = CommonInterface::Basic(); if (!basic.humidity_available) { data.SetInvalid(); return; } // Set Value data.UnsafeFormatValue( _T("%d"), (int)basic.humidity); }
void InfoBoxContentHumidity::Update(InfoBoxData &data) { const NMEAInfo &basic = XCSoarInterface::Basic(); if (!basic.humidity_available) { data.SetInvalid(); return; } // Set Value data.UnsafeFormatValue( _T("%d"), (int)basic.humidity); }
void InfoBoxContentAltitudeGPS::Update(InfoBoxData &data) { const NMEAInfo &basic = CommonInterface::Basic(); if (!basic.gps_altitude_available) { data.SetInvalid(); return; } data.SetValueFromAltitude(basic.gps_altitude); data.SetCommentFromAlternateAltitude(basic.gps_altitude); }
void InfoBoxContentAlternateName::Update(InfoBoxData &data) { if (protected_task_manager == NULL) { data.SetInvalid(); return; } ProtectedTaskManager::Lease lease(*protected_task_manager); const AlternateList &alternates = lease->GetAlternates(); const AlternatePoint *alternate; if (!alternates.empty()) { if (index >= alternates.size()) index = alternates.size() - 1; alternate = &alternates[index]; } else { alternate = NULL; } data.FormatTitle(_("Altn %d"), index + 1); if (alternate == NULL || !CommonInterface::Basic().track_available) { data.SetInvalid(); return; } data.SetComment(alternate->waypoint.name.c_str()); // Set Value Angle Value = alternate->solution.vector.bearing - CommonInterface::Basic().track; data.SetValueFromBearingDifference(Value); // Set Color (blue/black) data.SetValueColor(alternate->solution.IsFinalGlide() ? 2 : 0); }
void UpdateInfoBoxGRInstant(InfoBoxData &data) { const auto gr = CommonInterface::Calculated().gr; if (!::GradientValid(gr)) { data.SetInvalid(); return; } // Set Value data.SetValueFromGlideRatio(gr); }
void InfoBoxContentThermalAssistant::Update(InfoBoxData &data) { if (!CommonInterface::Calculated().circling) { data.SetInvalid(); return; } data.SetCustom(); renderer.Update(CommonInterface::Basic().attitude, CommonInterface::Calculated()); }
void InfoBoxContentOLC::Update(InfoBoxData &data) { if (!XCSoarInterface::GetComputerSettings().task.enable_olc || !protected_task_manager) { data.SetInvalid(); return; } const ContestResult& result_olc = XCSoarInterface::Calculated().contest_stats.GetResult(); if (result_olc.score < fixed_one) { data.SetInvalid(); return; } // Set Value data.SetValueFromDistance(result_olc.distance); data.UnsafeFormatComment(_T("%.1f pts"), (double)result_olc.score); }
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); }
void UpdateInfoBoxCircleDiameter(InfoBoxData &data) { if (!CommonInterface::Basic().airspeed_available.IsValid()) { data.SetInvalid(); return; } const Angle turn_rate = CommonInterface::Calculated().turn_rate_heading_smoothed.Absolute(); // deal with div zero and small turn rates if (turn_rate < Angle::Degrees(1)) { data.SetInvalid(); return; } const fixed circle_diameter = CommonInterface::Basic().true_airspeed / turn_rate.Radians() * fixed(2); // convert turn rate to radians/s and double it to get estimated circle diameter if (circle_diameter > fixed (2000)){ // arbitrary estimated that any diameter bigger than 2km will not be interesting data.SetInvalid(); return; } TCHAR buffer[32]; Unit unit = FormatSmallUserDistance(buffer, circle_diameter, false, 0); data.SetValue (buffer); data.SetValueUnit(unit); const fixed circle_duration = Angle::FullCircle().Native() / turn_rate.Native(); StaticString<16> duration_buffer; duration_buffer.Format(_T("%u s"), int(circle_duration)); _tcscpy (buffer, duration_buffer); data.SetComment (buffer); }
void UpdateInfoBoxTaskSpeedHour(InfoBoxData &data) { const WindowStats &window = CommonInterface::Calculated().task_stats.last_hour; if (negative(window.duration)) { data.SetInvalid(); return; } data.SetValue(_T("%2.0f"), Units::ToUserTaskSpeed(window.speed)); data.SetValueUnit(Units::current.task_speed_unit); }
void UpdateInfoBoxNextAltitudeRequire(InfoBoxData &data) { // pilots want this to be assuming terminal flight to this wp const TaskStats &task_stats = CommonInterface::Calculated().task_stats; const GlideResult &next_solution = task_stats.current_leg.solution_remaining; if (!task_stats.task_valid || !next_solution.IsAchievable()) { data.SetInvalid(); return; } data.SetValueFromAltitude(next_solution.GetRequiredAltitude()); }
void UpdateInfoBoxTaskAADistanceMin(InfoBoxData &data) { const auto &calculated = CommonInterface::Calculated(); const TaskStats &task_stats = calculated.ordered_task_stats; if (!task_stats.has_targets) { data.SetInvalid(); return; } // Set Value data.SetValueFromDistance(task_stats.distance_min); }
void UpdateInfoBoxNextGR(InfoBoxData &data) { // pilots want this to be assuming terminal flight to this wp, and this // is what current_leg gradient does. if (!CommonInterface::Calculated().task_stats.task_valid) { data.SetInvalid(); return; } fixed gradient = CommonInterface::Calculated().task_stats.current_leg.gradient; if (!positive(gradient)) { data.SetValue(_T("+++")); return; } if (::GradientValid(gradient)) { data.SetValueFromGlideRatio(gradient); } else { data.SetInvalid(); } }