コード例 #1
0
ファイル: Interface.cpp プロジェクト: scottp/xcsoar
bool XCSoarInterface::Debounce(void) {
  static PeriodClock fps_last;

  ResetDisplayTimeOut();
  InterfaceTimeoutReset();

  if (SettingsMap().ScreenBlanked) {
    // prevent key presses working if screen is blanked,
    // so a key press just triggers turning the display on again
    return false;
  }

  return fps_last.check_update(debounceTimeout);
}
コード例 #2
0
ファイル: Interface.cpp プロジェクト: galippi/xcsoar
// Debounce input buttons (does not matter which button is pressed)
bool
XCSoarInterface::Debounce(void)
{
#if defined(GNAV) || defined(PCGNAV)
  return true;
#else
  static PeriodClock fps_last;

  ResetDisplayTimeOut();

  if (SettingsMap().ScreenBlanked)
    // prevent key presses working if screen is blanked,
    // so a key press just triggers turning the display on again
    return false;

  return fps_last.check_update(debounceTimeout);
#endif
}
コード例 #3
0
ファイル: GlideComputer.cpp プロジェクト: galippi/xcsoar
/**
 * Calculates the own TeamCode and saves it to Calculated
 */
void
GlideComputer::CalculateOwnTeamCode()
{
  // No reference waypoint for teamcode calculation chosen -> cancel
  if (SettingsComputer().TeamCodeRefWaypoint < 0)
    return;

  // Only calculate every 10sec otherwise cancel calculation
  if (!last_team_code_update.check_update(10000))
    return;

  // Get bearing and distance to the reference waypoint
  const Waypoint *wp =
      way_points.lookup_id(SettingsComputer().TeamCodeRefWaypoint);

  if (!wp)
    return;

  Angle bearing = wp->Location.bearing(Basic().Location);
  fixed distance = wp->Location.distance(Basic().Location);

  // Save teamcode to Calculated
  SetCalculated().OwnTeamCode.Update(bearing, distance);
}