Exemplo n.º 1
0
void
GlideComputer::TakeoffLanding()
{
  if (Calculated().flight.flying && !LastCalculated().flight.flying)
    OnTakeoff();
  else if (!Calculated().flight.flying && LastCalculated().flight.flying)
    OnLanding();
}
Exemplo n.º 2
0
/**
 * Is called by the CalculationThread and processes the received GPS data in Basic()
 */
bool
GlideComputer::ProcessGPS()
{
  const MoreData &basic = Basic();
  DerivedInfo &calculated = SetCalculated();

  calculated.date_time_local = basic.date_time_utc + GetUTCOffset();

  calculated.Expire(basic.clock);

  // Process basic information
  air_data_computer.ProcessBasic(Basic(), SetCalculated(),
                                 GetComputerSettings());

  // Process basic task information
  task_computer.ProcessBasicTask(basic, LastBasic(),
                                 calculated, LastCalculated(),
                                 GetComputerSettings());
  task_computer.ProcessMoreTask(basic, calculated, LastCalculated(),
                                GetComputerSettings());

  // Check if everything is okay with the gps time and process it
  if (!air_data_computer.FlightTimes(Basic(), LastBasic(), SetCalculated(),
                                     GetComputerSettings()))
    return false;

  TakeoffLanding();

  if (!time_retreated())
    task_computer.ProcessAutoTask(basic, calculated, LastCalculated());

  // Process extended information
  air_data_computer.ProcessVertical(Basic(), LastBasic(),
                                    SetCalculated(), LastCalculated(),
                                    GetComputerSettings());

  if (!time_retreated())
    stats_computer.ProcessClimbEvents(calculated, LastCalculated());

  // Calculate the team code
  CalculateOwnTeamCode();

  // Calculate the bearing and range of the teammate
  CalculateTeammateBearingRange();

  vegavoice.Update(basic, Calculated(), GetComputerSettings().voice);

  // update basic trace history
  if (time_advanced())
    calculated.trace_history.append(basic);

  // Update the ConditionMonitors
  ConditionMonitorsUpdate(*this);

  return idle_clock.CheckUpdate(500);
}
Exemplo n.º 3
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();
}