コード例 #1
0
ファイル: wright.c プロジェクト: R1chChapp3rs/rosewright
void chrono_reset_button() {
  // Resets the chronometer to 0 time.
  PblTm time;

  get_time(&time);
  chrono_running = false;
  chrono_lap_paused = false;
  chrono_start_seconds = 0;
  chrono_hold_seconds = 0;
  vibes_double_pulse();
  update_hands(&time);
}
コード例 #2
0
ファイル: wright.c プロジェクト: R1chChapp3rs/rosewright
void chrono_lap_button() {
  PblTm time;
  int seconds;

  get_time(&time);

  if (chrono_lap_paused) {
    // If we were already paused, this resumes the motion, jumping
    // ahead to the currently elapsed time.
    chrono_lap_paused = false;
    vibes_enqueue_custom_pattern(tap);
    update_hands(&time);
  } else {
    // If we were not already paused, this pauses the hands here (but
    // does not stop the timer).
    seconds = get_time_seconds(&time);
    chrono_hold_seconds = seconds - chrono_start_seconds;
    chrono_lap_paused = true;
    vibes_enqueue_custom_pattern(tap);
    update_hands(&time);
  }
}
コード例 #3
0
ファイル: wright_chrono.c プロジェクト: Quikrobot/rosewright
void chrono_reset_button() {
  // Resets the chronometer to 0 time.
  time_t now;
  struct tm *this_time;

  now = time(NULL);
  this_time = localtime(&now);
  chrono_data.running = false;
  chrono_data.lap_paused = false;
  chrono_data.start_ms = 0;
  chrono_data.hold_ms = 0;
  memset(&chrono_data.laps[0], 0, sizeof(chrono_data.laps[0]) * CHRONO_MAX_LAPS);
  vibes_double_pulse();
  update_chrono_laps_time();
  update_hands(this_time);
  reset_tick_timer();
}
コード例 #4
0
ファイル: wright.c プロジェクト: R1chChapp3rs/rosewright
// Compute new hand positions once a minute (or once a second).
void handle_tick(AppContextRef ctx, PebbleTickEvent *t) {
  (void)ctx;

  update_hands(t->tick_time);
}