A macOS menu bar application for Bluetooth treadmill control and workout tracking.
- Bluetooth Connection: Automatic discovery and connection to RZ_TreadMill devices
- Speed Control: Precise speed adjustment from 1.0-6.0 km/h with 0.5 increments
- Real-time Monitoring: Live tracking of speed, distance, and step count
- Comprehensive Metrics: Track time, distance, speed, steps, calories, pace, and cadence
- Pause/Resume: Full workout session control with accurate time tracking
- Workout Plans: Pre-defined workout routines with automatic speed transitions and progress tracking
- History: Complete workout history with lazy loading, monthly heatmap, and detailed session analytics
- Real-time Charts: Live speed visualization during workouts
- Grace Period: Smart metric calculation prevents incorrect values during workout startup
- Menu Bar Integration: Clean, always-accessible interface with live workout metrics display
- Visual Feedback: Real-time speed charts and highlighted primary metrics
- Auto-reconnection: Persistent Bluetooth connection with automatic recovery
- Demo Mode: Full functionality simulator for testing without physical hardware
- Data Export: JSON export, FIT file generation, and direct Strava upload
- OAuth Authentication: Secure connection to your Strava account
- Automatic Upload: Direct FIT file upload after workout completion
- Activity Linking: Seamless integration with your Strava activity feed
- Standards Compliance: Garmin FIT SDK ensures compatibility across platforms
Menu bar interface showing current workout metrics and controls
- macOS: 13.0 or later
- Bluetooth: Compatible RZ_TreadMill device
- Swift: 5.9+ (for development)
- Download the latest
.dmgfile from Releases - Mount the disk image and drag BTreadmill to Applications
- Launch BTreadmill from Applications or Spotlight
# Clone the repository
git clone https://github.com/ldomaradzki/BTreadmill.git
cd BTreadmill
# Generate Xcode project
make generate
# Build the application
make build
# Run the application
make run- Connect: BTreadmill automatically discovers and connects to your treadmill (or enable Demo Mode)
- Start: Click "Start Workout" from the menu bar popover
- Control: Use the speed slider to adjust treadmill speed (1-6 km/h)
- Monitor: View real-time metrics with live speed charts and highlighted primary metrics
- Menu Bar: See live workout time and distance in the menu bar during active sessions
- Finish: Pause or end your workout when complete
- Select a predefined workout plan from the dropdown
- Click "Start Plan" to begin automated workout routine
- The app automatically adjusts speed according to plan segments with progress tracking
- Skip segments manually if needed during execution
- View remaining time and current segment information
- Browse chronological workout history with lazy loading
- View monthly workout heatmap for activity patterns
- Export individual workouts or complete history
- Upload workouts directly to Strava
- Configure user profile (weight, stride length, preferred units)
- Enable/disable auto-connect and demo mode functionality
- Connect to Strava for automatic workout uploads
- Set default workout speed and preferences
- Access comprehensive workout history and export options
BTreadmill follows a clean service-layer architecture:
- BluetoothService: Handles CoreBluetooth communication with RZ_TreadMill devices
- TreadmillService: Interprets Bluetooth data into structured state
- TreadmillSimulatorService: Demo mode service for testing without physical hardware
- WorkoutManager: Manages workout sessions, metrics calculation, and plan execution
- WorkoutPlanExecutor: Handles automated workout plan execution with speed transitions
- DataManager: Handles data persistence, workout history, and export functionality
- SettingsManager: Manages user preferences and configuration
- StravaService: Handles OAuth authentication and workout upload integration
- FITWorkoutEncoder: Generates standards-compliant FIT files for data export
The project uses XcodeGen for project file management:
# Available commands
make generate # Generate Xcode project from project.yml
make build # Build with formatted output
make clean # Clean build artifacts
make run # Build and launch
make stop # Terminate running processes
make archive # Create distribution archiveBTreadmill/
βββ App/ # Application entry point
βββ Core/
β βββ Services/ # Business logic services
β βββ Models/ # Data models
β βββ Extensions/ # Swift extensions
β βββ Utilities/ # Helper utilities
βββ Presentation/
β βββ Views/ # SwiftUI views
β βββ Components/ # Reusable UI components
βββ Resources/ # Assets and resources
βββ project.yml # XcodeGen configuration
βββ Makefile # Build automation
- SwiftUI: Modern declarative UI framework
- CoreBluetooth: Bluetooth Low Energy communication
- Combine: Reactive programming for data flow
- JSON: Data persistence and export format
- FIT SDK: Garmin FIT file generation for cross-platform compatibility
- OAuth2: Secure Strava authentication and token management
- RZ_TreadMill devices with Bluetooth Low Energy
- Custom protocol for speed control and data reading
Workout sessions support multiple export formats:
JSON Format (for analysis and backup):
{
"id": "uuid",
"startTime": "2023-...",
"totalDistance": 2.5,
"totalTime": 1800,
"averageSpeed": 5.0,
"averagePace": 720,
"totalSteps": 3200,
"estimatedCalories": 180,
"speedHistory": [1.0, 2.5, 3.0, ...],
"stravaActivityId": "12345678",
"fitFilePath": "/path/to/workout.fit"
}FIT Format (for Strava and fitness platforms):
- Standards-compliant Garmin FIT files
- Real-time generation during workouts
- Automatic upload to Strava
- Compatible with all major fitness platforms
BTreadmill stores all data locally on your device. Workout history and user preferences are saved in local JSON files.
Strava Integration: When you choose to connect to Strava, workout data (FIT files) is transmitted directly to Strava's servers using their official API. This is entirely optional and controlled by you. Authentication tokens are stored securely in your system keychain.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have feature requests:
- Check the Issues page
- Create a new issue with detailed description
- Include system information and steps to reproduce
BTreadmill - Making treadmill workouts smarter, one step at a time. πββοΈπ¨