cargo run --release --no-default-features --features mockOr use the helper script:
./run-mock.shcargo run --releaseMock mode simulates a Kettler elliptical bike without requiring Bluetooth hardware. It's perfect for:
- 🖥 Developing on macOS
- 🎨 Working on the web interface
- 🧪 Testing API endpoints
- 🚀 Fast iteration without hardware
✅ Realistic simulation:
- RPM varies between 40-80 (sinusoidal pattern)
- Speed calculated from RPM (~0.18 km/h per RPM)
- Power control fully functional (25-400W)
- Training programs work identically
✅ Full API support:
- All endpoints work (
/status,/power,/programs, etc.) - Same behavior as real hardware
- No Bluetooth errors or connection issues
✅ Always connected:
- No device scanning or pairing needed
- No reconnection logic triggered
- Instant startup
-
Start mock server:
cargo run --release --no-default-features --features mock
-
Open browser:
http://localhost:8080 -
Edit frontend:
- Modify files in
static/directory - Refresh browser to see changes
- Test with simulated data
- Modify files in
-
Test on Raspberry Pi:
- Deploy code to Pi
- Build with default features (real Bluetooth)
- Test with actual hardware
# Get current status (data changes in real-time)
curl http://localhost:8080/status
# Set power to 150W
curl -X POST http://localhost:8080/power/150
# Get current power
curl http://localhost:8080/power
# List training programs
curl http://localhost:8080/programssrc/mock_bike_controller.rs- Mock implementationMOCK_MODE.md- Detailed documentationrun-mock.sh- Helper script- Updated
Cargo.tomlwith feature flags - Updated
src/main.rsfor conditional compilation
| Mode | Command | Use Case |
|---|---|---|
| Mock | cargo run --no-default-features --features mock |
Development on macOS |
| Real | cargo run |
Production on Raspberry Pi |
- Mock mode details:
MOCK_MODE.md - Project architecture:
CLAUDE.md - General info:
README.md
Happy coding! 🚀