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
19 changes: 10 additions & 9 deletions source/GarminApp.mc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class GarminApp extends Application.AppBase {
Logger.logMemoryStats("Startup");

// Load saved settings from persistent storage
loadSettings();
//loadSettings();

globalTimer = new Timer.Timer();
globalTimer.start(method(:updateCadenceBarAvg),1000,true);
Expand Down Expand Up @@ -468,7 +468,7 @@ class GarminApp extends Application.AppBase {
_idealMinCadence = finalCadence - 5;

// Save the calculated cadence zones
saveSettings();
//saveSettings();

System.println("[CADENCE] Calculated ideal range: " + _idealMinCadence.toString() + "-" + _idealMaxCadence.toString() + " spm");
}
Expand Down Expand Up @@ -613,12 +613,12 @@ class GarminApp extends Application.AppBase {

function setMinCadence(value as Number) as Void {
_idealMinCadence = value;
saveSettings();
//saveSettings();
}

function setMaxCadence(value as Number) as Void {
_idealMaxCadence = value;
saveSettings();
//saveSettings();
}

function getCadenceHistory() as Array<Float?> {
Expand Down Expand Up @@ -648,7 +648,7 @@ class GarminApp extends Application.AppBase {

function setUserGender(value as Number) as Void {
_userGender = value;
saveSettings();
//saveSettings();
}

function getUserLegLength() as Float {
Expand All @@ -657,7 +657,7 @@ class GarminApp extends Application.AppBase {

function setUserHeight(value as Number) as Void {
_userHeight = value;
saveSettings();
//saveSettings();
}

function getUserHeight() as Number {
Expand All @@ -670,7 +670,7 @@ class GarminApp extends Application.AppBase {

function setUserSpeed(value as Float) as Void {
_userSpeed = value;
saveSettings();
//saveSettings();
}

function getExperienceLvl() as Number {
Expand All @@ -679,7 +679,7 @@ class GarminApp extends Application.AppBase {

function setExperienceLvl(value as Float) as Void {
_experienceLvl = value;
saveSettings();
//saveSettings();
}

function min(a,b){
Expand Down Expand Up @@ -791,9 +791,10 @@ class GarminApp extends Application.AppBase {
}

// Activity metrics getters
/*
function getSessionDuration() {
return _sessionDuration;
}
}*/

function getSessionDistance() {
return _sessionDistance;
Expand Down
44 changes: 13 additions & 31 deletions source/Views/AdvancedView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,29 @@ class AdvancedView extends WatchUi.View {
var idealMaxCadence = app.getMaxCadence();

var cadenceY = height * 0.37;
var cadenceRangeY = height * 0.43;
var chartDurationY = height * 0.85;

if (info != null && info.currentCadence != null) {
// Draw cadence value in green (RGB: 0,255,0 = 0x00FF00)
correctColor(info.currentCadence, idealMinCadence, idealMaxCadence, dc);
dc.drawText(width / 2, cadenceY + 20, Graphics.FONT_XTINY, info.currentCadence.toString() + " spm", Graphics.TEXT_JUSTIFY_CENTER);
dc.drawText(width / 2, cadenceY, Graphics.FONT_XTINY, info.currentCadence.toString() + " spm", Graphics.TEXT_JUSTIFY_CENTER);
}

drawChart(dc);

// Display cadence zone range instead of time duration
// Display cadence zone range
var minZone = app.getMinCadence();
var maxZone = app.getMaxCadence();
var zoneText = "Zone: " + minZone.toString() + "-" + maxZone.toString() + " spm";
var zoneText = "Target: " + minZone.toString() + "-" + maxZone.toString() + " spm";

dc.setColor(0x969696, Graphics.COLOR_TRANSPARENT);
dc.drawText(width / 2, chartDurationY, Graphics.FONT_XTINY, zoneText, Graphics.TEXT_JUSTIFY_CENTER);
dc.drawText(width / 2, cadenceRangeY, Graphics.FONT_XTINY, zoneText, Graphics.TEXT_JUSTIFY_CENTER);

drawChart(dc);

var string = app.getChartDuration();

dc.setColor(0x969696, Graphics.COLOR_TRANSPARENT);
dc.drawText(width / 2, chartDurationY, Graphics.FONT_XTINY, "Last " + string, Graphics.TEXT_JUSTIFY_CENTER);
}


Expand Down Expand Up @@ -300,8 +305,6 @@ class AdvancedView extends WatchUi.View {
var barWidth = (barZoneWidth / MAX_BARS).toNumber();
var startIndex = (cadenceIndex - numBars + MAX_BARS) % MAX_BARS;

var colorThreshold = 20;

// FIXED SCALE - bars have fixed height based on absolute cadence
// Colors change dynamically based on your zone
for (var i = 0; i < numBars; i++) {
Expand All @@ -313,29 +316,8 @@ class AdvancedView extends WatchUi.View {
var barHeight = ((cadence / MAX_CADENCE_DISPLAY) * chartHeight).toNumber();
var x = barZoneLeft + i * barWidth;
var y = barZoneBottom - barHeight;

// Dynamic color based on YOUR current zone
//FML
if (cadence < idealMinCadence - colorThreshold) {
// Way below zone - Grey
dc.setColor(0x969696, Graphics.COLOR_TRANSPARENT);
}
else if (cadence >= idealMinCadence - colorThreshold && cadence < idealMinCadence) {
// Below zone - Blue
dc.setColor(0x0cc0df, Graphics.COLOR_TRANSPARENT);
}
else if (cadence >= idealMinCadence && cadence <= idealMaxCadence) {
// In zone - Green (YOUR ZONE!)
dc.setColor(0x00bf63, Graphics.COLOR_TRANSPARENT);
}
else if (cadence > idealMaxCadence && cadence <= idealMaxCadence + colorThreshold) {
// Above zone - Orange
dc.setColor(0xff751f, Graphics.COLOR_TRANSPARENT);
}
else if (cadence > idealMaxCadence + colorThreshold) {
// Way above zone - Red
dc.setColor(0xFF0000, Graphics.COLOR_TRANSPARENT);
}

correctColor(cadence, idealMinCadence, idealMaxCadence, dc);

dc.fillRectangle(x, y, barWidth, barHeight);
}
Expand Down