tick method

void tick()

Updates the progress state based on the latest accelerometer event.

Implementation

void tick() {
  if (_lastAccY == null) return;
  final double yCorrected = _lastAccY! * ySign;

  if (_phase == StsPhase.sitting && yCorrected > yThreshold) {
    // Stand-up impulse
    _phase = StsPhase.standing;
    _progress = 1.0;
    progressNotifier.value = _progress;
    return;
  }
  if (_phase == StsPhase.standing && yCorrected < -yThreshold) {
    // Sit-down impulse
    _phase = StsPhase.sitting;
    _progress = 0.0;
    progressNotifier.value = _progress;
    return;
  }

  // Idle phase
  progressNotifier.value = _progress;
}