Skip to content

Repository files navigation

Lap Timer (计圈计时)

Android lap timer for Mini 4WD / slot tracks. Uses CameraX ImageAnalysis to detect START-line crossings, then records lap times. Optional crossing stills come from an analysis-frame ring buffer (not ImageCapture).

Current release: v4.0.0 · versionCode 26 · minSdk 29

Download a prebuilt debug APK from the Releases page (LapTimer-*-debug.apk), or build from source below.

中文说明 · Changelog · Contributing · Security

Features

  • Brightness-band crossing detection (default); optional HSV color multi-car mode
  • First crossing starts the clock; later crossings record lap times
  • Pre-start digital zoom (up to 4× soft cap) and torch; locked after Start
  • Optional crossing photos via analysis-frame ring + short post-roll
  • False-trigger guard (settings): narrower band, reject uniform shade, min lap gap
  • Session history, CSV export, ZH/EN UI

Requirements

Item Value
Android Studio Hedgehog / Iguana+ recommended (JDK 17)
JDK 17
minSdk 29
compileSdk / targetSdk 34
Device Back camera required

Build

./gradlew :app:assembleDebug
# Windows: gradlew.bat :app:assembleDebug

APK output:

app/build/outputs/apk/debug/app-debug.apk

Install:

adb install -r -t -g app/build/outputs/apk/debug/app-debug.apk

Unit tests:

./gradlew :app:testDebugUnitTest

Dependency resolution may use Aliyun Maven mirrors configured in settings.gradle.kts (helpful in CN networks). You can switch back to Google/Maven Central if preferred.

Usage (short)

  1. Grant camera permission; pick or create a track.
  2. On the pre-start screen, adjust zoom / torch if needed.
  3. Tap Start → place phone on the track → first crossing starts timing.
  4. Subsequent crossings add laps; Finish saves the session.

Detection tip: keep the sample band on the lane surface; raise zoom so the car fills more of the band. Use torch + shade for stable lighting if ambient shadows cause false triggers.

Architecture (high level)

CameraX Preview + ImageAnalysis
        │
        ▼
 AnalysisFacade ──► BrightnessCrossingDetector / ColorCrossingDetector
        │                    │
        │                    └── Fire → TimingSession / MultiCarTimingBoard
        │
        └── BurstPhotoPipeline (ring buffer → async JPEG → attach to lap)

Entry activity: MainActivityV3.

Project layout

app/src/main/java/com/timming/laptimer/
  analysis/     detectors + frame ring photo pipeline
  camera/       CameraX preview, zoom/torch, JPEG helpers
  timing/       pure lap timing boards
  data/         Room + DataStore
  ui/v3/        current Compose screens

Contributing

See CONTRIBUTING.md. Please open an issue before large design changes.

License

MIT © 2026 kynasln

Disclaimer

Hobby / DIY timing aid. Not a certified race timing system. Results depend on mounting, lighting, and settings.

About

Mini 4WD lap timer Android app (CameraX crossing detection) v4.0.0

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages