Skip to content

maxrugen/karoo-nutrition

Repository files navigation

Karoo Nutrition Timer

A Karoo 3 extension that provides adaptive nutrition reminders during rides. The timer adjusts intervals based on your power zones — harder riding triggers more frequent nutrition alerts.

Features

  • Adaptive nutrition timing — intervals shorten automatically in higher power zones (Z3+ = more frequent)
  • Custom data field — large MM:SS countdown displayed on any Karoo data page
  • Color-coded urgency — white (>5min), yellow (<5min), red (<2min)
  • In-ride alerts — native Karoo notifications with vibration
  • Nutrition plan management — create plans with gels, drinks, bars on customizable intervals
  • Power zone integration — uses Coggan's 7-zone model based on your FTP
  • Post-ride summary — review consumption history and export CSV
  • Fully offline — works without connectivity during rides

Installation

Prerequisites

  1. GitHub Personal Access Token with read:packages scope

  2. Android SDK with API 34

Setup

  1. Clone this repository:

    git clone <repo-url>
    cd karoo-nutrition
  2. Add GitHub Packages credentials to ~/.gradle/gradle.properties (global, not committed):

    gpr.user=your-github-username
    gpr.key=your-github-personal-access-token

    Or set environment variables instead:

    export GITHUB_USERNAME=your-username
    export GITHUB_TOKEN=your-token
  3. Create local.properties in the project root (if not present):

    sdk.dir=/path/to/your/Android/sdk
  4. Build the debug APK:

    ./gradlew assembleDebug

Sideload to Karoo 3

  1. Enable Developer Mode on Karoo:

    • Settings > About > Tap build number 7 times
    • Settings > Developer Options > Enable USB Debugging
  2. Connect via USB and install:

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

Usage

Pre-Ride Setup

  1. Open Nutrition Timer from the Karoo app menu
  2. Create a nutrition plan:
    • Set your FTP (watts)
    • Add items (gel every 45min, drink every 20min, etc.)
  3. Activate the plan

During Ride

  1. Add the Nutrition Countdown data field to any data page
  2. The countdown shows time until next nutrition item
  3. When the timer reaches zero, you'll get an alert with vibration
  4. Intervals adjust based on your current power zone:
    • Z1-Z2: Base interval (no change)
    • Z3-Z4: -10 minutes
    • Z5-Z6: -15 minutes
    • Z7: -20 minutes (minimum 5 minutes)

Post-Ride

  1. Open the app to view ride history
  2. Export consumption logs as CSV

Architecture

NutritionTimerExtension (KarooExtension service)
├── NutritionCountdownDataType (DataTypeImpl)
│   ├── startStream() → emits countdown seconds
│   └── startView() → renders RemoteViews with countdown
├── TimerManager (core countdown logic)
│   ├── Observes elapsed time + power via KarooSystemService
│   ├── Computes power zones and adjusts intervals
│   └── Dispatches InRideAlert when nutrition is due
└── NutritionDatabase (Room)
    ├── NutritionPlan → NutritionItem (1:many)
    └── RideLog (consumption events as JSON)

Tech Stack

  • Kotlin with Coroutines + Flow
  • karoo-ext SDK 1.1.8
  • Room Database for persistence
  • kotlinx-serialization for JSON
  • Min SDK 23 / Target SDK 34

License

MIT

About

A Karoo 3 extension that provides adaptive nutrition reminders during rides. The timer adjusts intervals based on your power zones — harder riding triggers more frequent nutrition alerts.

Topics

Resources

License

Stars

Watchers

Forks

Contributors