Пример #1
0
void
GlideComputerStats::ProcessClimbEvents()
{
  if (time_retreated())
    return;

  const DerivedInfo &calculated = Calculated();
  const DerivedInfo &last_calculated = LastCalculated();

  switch (calculated.turn_mode) {
  case CLIMB:
    if (calculated.climb_start_time > last_calculated.climb_start_time)
      // set altitude for start of circling (as base of climb)
      OnClimbBase(calculated.turn_start_altitude);
    break;

  case CRUISE:
    if (calculated.cruise_start_time > last_calculated.cruise_start_time)
      OnClimbCeiling();
    break;

  default:
    break;
  }

  if (calculated.last_thermal.IsDefined() &&
      (!last_calculated.last_thermal.IsDefined() ||
       calculated.last_thermal.end_time > last_calculated.last_thermal.end_time))
    OnDepartedThermal();
}
Пример #2
0
void
StatsComputer::ProcessClimbEvents(const DerivedInfo &calculated)
{
    switch (calculated.turn_mode) {
    case CirclingMode::CLIMB:
        if (calculated.climb_start_time > last_climb_start_time)
            // set altitude for start of circling (as base of climb)
            OnClimbBase(calculated, calculated.climb_start_altitude);
        break;

    case CirclingMode::CRUISE:
        if (calculated.cruise_start_time > last_cruise_start_time)
            OnClimbCeiling(calculated);
        break;

    default:
        break;
    }

    if (calculated.last_thermal.IsDefined() &&
            (last_thermal_end_time < 0 ||
             calculated.last_thermal.end_time > last_thermal_end_time))
        OnDepartedThermal(calculated);

    last_climb_start_time = calculated.climb_start_time;
    last_cruise_start_time = calculated.cruise_start_time;
    last_thermal_end_time = calculated.last_thermal.IsDefined()
                            ? calculated.last_thermal.end_time
                            : -1.;
}