Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![CI/CD - Build and Release](https://github.com/apopovsky/WPrimeKarooExtension/actions/workflows/ci.yml/badge.svg)](https://github.com/apopovsky/WPrimeKarooExtension/actions/workflows/ci.yml)
[![Code Quality](https://github.com/apopovsky/WPrimeKarooExtension/actions/workflows/code-quality.yml/badge.svg)](https://github.com/apopovsky/WPrimeKarooExtension/actions/workflows/code-quality.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/Platform-Karoo%203-orange.svg)](https://www.hammerhead.io/)
[![Platform](https://img.shields.io/badge/Platform-Karoo%202%20%26%203-orange.svg)](https://www.hammerhead.io/)

> **Track your anaerobic capacity in real-time and never blow up on climbs or sprints again.**

Expand Down Expand Up @@ -31,7 +31,7 @@

## What is This Extension?

This extension brings **W Prime (W') balance tracking** to your Karoo 3 cycling computer. W Prime represents your finite anaerobic energy reserve - think of it as a battery that depletes when you push hard above your threshold and recharges when you ease off.
This extension brings **W Prime (W') balance tracking** to your Karoo 2 & 3 cycling computers. W Prime represents your finite anaerobic energy reserve - think of it as a battery that depletes when you push hard above your threshold and recharges when you ease off.

### Why Should You Care?

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
// datastore
implementation(libs.androidx.datastore.preferences)

implementation(libs.nordic.ble.client)


// Hilt
ksp("org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.0")
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />


<application
android:name="com.itl.wprimeext.WPrimeApplication"
Expand Down
18 changes: 18 additions & 0 deletions docker-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# docker-build.ps1
# Runs the Android build inside a Docker container with caching enabled.

Write-Output "Starting Docker build..."
Write-Output "This uses volume 'wprime_gradle_cache' to cache downloads."

docker run --rm `
-v "${PWD}:/home/circleci/project" `
-v "wprime_gradle_cache:/home/circleci/.gradle" `
-w "/home/circleci/project" `
cimg/android:2025.01 `
/bin/bash -c "sed -i 's/\r$//' gradlew && ./gradlew assembleDebug"

if ($LASTEXITCODE -eq 0) {
Write-Output "Build Successful! APK is in app/build/outputs/apk/debug/"
} else {
Write-Output "Build Failed!"
}
19 changes: 19 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# docker-build.sh
# Runs the Android build inside a Docker container with caching enabled.

echo "Starting Docker build..."
echo "This uses volume 'wprime_gradle_cache' to cache downloads."

docker run --rm \
-v "$(pwd):/home/circleci/project" \
-v "wprime_gradle_cache:/home/circleci/.gradle" \
-w "/home/circleci/project" \
cimg/android:2025.01 \
/bin/bash -c "sed -i 's/\r$//' gradlew && ./gradlew assembleDebug"

if [ $? -eq 0 ]; then
echo "Build Successful! APK is in app/build/outputs/apk/debug/"
else
echo "Build Failed!"
fi
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ glance = "1.1.1"
hilt = "2.57.2"
datastore = "1.2.0"
ksp = "2.3.4"
nordicBleClient = "2.0.0-alpha12"


[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity" }
Expand Down Expand Up @@ -56,7 +56,7 @@ kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx
# datastore
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastore" }

nordic-ble-client = { module = "no.nordicsemi.kotlin.ble:client-android", version.ref = "nordicBleClient" }

kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.9.0" }
mapbox-sdk-turf = { module = "com.mapbox.mapboxsdk:mapbox-sdk-turf", version = "7.3.1" }
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }
Expand Down
33 changes: 33 additions & 0 deletions skills/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Karoo Extension Development
description: Best practices and guidelines for developing the W Prime Karoo Extension.
---

# Karoo Extension Development

## Project Overview
This project implements a W Prime (W') Extension for Hammerhead Karoo cycling computers.
It uses the `karoo-ext` library.

## Architecture
- **Pattern**: MVVM (Model-View-ViewModel)
- **UI**: Jetpack Compose
- **DI**: Hilt
- **Persistence**: Android DataStore

## Key Components
- **Extension Service**: `WPrimeExtension.kt` (integrates with Karoo system)
- **Data Types**: `WPrimeDataType.kt` (%) and `WPrimeKjDataType.kt` (Joules)
- **Logic**: `WPrimeCalculator.kt` (implements the 6 scientific algorithms)
- **Configuration**: `ConfigurationScreen.kt` (Settings UI)

## Development Workflow
1. **Build**: `./gradlew clean assembleDebug`
2. **Install**: `./gradlew installDebug` (requires ADB)
3. **Test**: `./gradlew test` (Unit tests)
4. **Logs**: `adb logcat | grep WPrime`

## Coding Standards
- Follow Kotlin coding conventions.
- Use `WPrimeLogger` for logging.
- Ensure new algorithms implement `IWPrimeModel`.