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
Binary file modified .DS_Store
Binary file not shown.
39 changes: 39 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "monkeyc",
"request": "launch",
"name": "Run App",
"stopAtLaunch": false,
"device": "${command:GetTargetDevice}"
},
{
"type": "monkeyc",
"request": "launch",
"name": "Run Tests",
"runTests": true,
"device": "${command:GetTargetDevice}"
},
{
"type": "monkeyc",
"request": "launch",
"name": "Run Complication Apps",
"stopAtLaunch": false,
"complicationSubscriberFolder": "${command:GetComplicationSubscriberFolder}",
"complicationPublisherFolder": "${command:GetComplicationPublisherFolder}",
"device": "${command:GetTargetDevice}"
},
{
"type": "monkeyc",
"request": "launch",
"name": "Run Native Pairing",
"runNativePairing": true,
"stopAtLaunch": false,
"device": "${command:GetTargetDevice}"
}
]
}
Binary file added connectiq-sdk-manager.dmg
Binary file not shown.
Binary file added developer_key.der
Binary file not shown.
Binary file added resources/drawables/cadence_step_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions resources/drawables/drawables.xml

This file was deleted.

7 changes: 7 additions & 0 deletions resources/drawables/drawables.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<drawables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://developer.garmin.com/downloads/connect-iq/resources.xsd">
<bitmap id="LauncherIcon" filename="launcher_icon.svg" dithering="none" />
<bitmap id="ICON_DISTANCE" filename="/Users/jawaharsr/garmin-smartwatch/resources/drawables/running_icon.png" />
<bitmap id="ICON_CADENCE" filename="/Users/jawaharsr/garmin-smartwatch/resources/drawables/cadence_step_icon.png" />
<bitmap id="ICON_STRIDE" filename="/Users/jawaharsr/garmin-smartwatch/resources/drawables/stridelength_icon.png" />
<bitmap id="ICON_HR" filename="/Users/jawaharsr/garmin-smartwatch/resources/drawables/heartrate_icon_red_40.png" />
</drawables>
Binary file modified resources/drawables/heartrate_icon_red_40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/drawables/running_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/drawables/stridelength_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/drawables_small/cadence_step_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/drawables_small/running_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/drawables_small/stridelength_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions resources/resources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<bitmap id="LauncherIcon" filename="drawables/launcher_icon.svg" dithering="none" />

<!-- Your icons (PNG) inside: resources/drawables/ -->
<bitmap id="ICON_DISTANCE" filename="drawables/running_icon.png" />
<bitmap id="ICON_CADENCE" filename="drawables/cadence_step_icon.png" />
<bitmap id="ICON_STRIDE" filename="drawables/stridelength_icon.png" />
<bitmap id="ICON_HR" filename="drawables/heartrate_icon_red_40.png" />


</resources>
40 changes: 6 additions & 34 deletions source/GarminApp.mc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ class GarminApp extends Application.AppBase {

function initialize() {
AppBase.initialize();
System.println("[INFO] App initialized");
}

function getInitialView() {
return [ new HomeScreenView() ];
}


function onStart(state as Dictionary?) as Void {
System.println("[INFO] App starting");

Expand Down Expand Up @@ -152,35 +156,6 @@ class GarminApp extends Application.AppBase {
}
}

function idealCadenceCalculator() as Void {
var referenceCadence = 0;
var finalCadence = 0;
var userLegLength = _userHeight * 0.53;

//reference cadence
switch (_userGender) {
case Male:
referenceCadence = (-1.268 * userLegLength) + (3.471 * _userSpeed) + 261.378;
break;
case Female:
referenceCadence = (-1.190 * userLegLength) + (3.705 * _userSpeed) + 249.688;
break;
default:
referenceCadence = (-1.251 * userLegLength) + (3.665 * _userSpeed) + 254.858;
break;
}

//experience adjustment
referenceCadence = referenceCadence * _experienceLvl;

//apply threshold
referenceCadence = Math.round(referenceCadence);
finalCadence = max(BASELINE_AVG_CADENCE,min(referenceCadence,MAX_CADENCE)).toNumber();

//set new min max ideal cadence
_idealMaxCadence = finalCadence + 5;
_idealMinCadence = finalCadence - 5;
}

function idealCadenceCalculator() as Void {
var referenceCadence = 0;
Expand Down Expand Up @@ -284,10 +259,7 @@ class GarminApp extends Application.AppBase {
}


// Return the initial view of your application here
function getInitialView() as [Views] or [Views, InputDelegates] {
return [ new SimpleView(), new SimpleViewDelegate() ];
}

}

function getApp() as GarminApp {
Expand Down
74 changes: 74 additions & 0 deletions source/SimpleHomescreenUI.mc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Toybox.WatchUi as WatchUi;
using Toybox.Graphics as Gfx;

class HomeScreenView extends WatchUi.View {

// Demo values (replace later)
var timeStr = "05:06.77";
var distStr = "12.02 KM";
var spmStr = "166 spm";
var elevStr = "1.35 M";
var hrStr = "143 HRM";

const ICON_SIZE = 32;
const ICON_GAP = 10;

// Icons (keep INSIDE the class)
var iconDistance as WatchUi.BitmapResource;
var iconCadence as WatchUi.BitmapResource;
var iconStride as WatchUi.BitmapResource;
var iconHr as WatchUi.BitmapResource;

function initialize() {
View.initialize();

// NOTE: because icons are in resources/drawables/
iconDistance = WatchUi.loadResource(Rez.Drawables.ICON_DISTANCE);
iconCadence = WatchUi.loadResource(Rez.Drawables.ICON_CADENCE);
iconStride = WatchUi.loadResource(Rez.Drawables.ICON_STRIDE);
iconHr = WatchUi.loadResource(Rez.Drawables.ICON_HR);
}

function onUpdate(dc as Gfx.Dc) {
var w = dc.getWidth();
var h = dc.getHeight();

// Background
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
dc.clear();

// Time
dc.setColor(Gfx.COLOR_YELLOW, Gfx.COLOR_BLACK);
dc.drawText(w/2, h*0.17, Gfx.FONT_LARGE, timeStr, Gfx.TEXT_JUSTIFY_CENTER);

// Values
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_BLACK);
var valueFont = Gfx.FONT_TINY;

var iconX = w * 0.30;
var textX = w * 0.45;

var startY = h * 0.34;
var gapY = h * 0.12;

drawRow(dc, iconDistance, distStr, iconX, textX, startY + gapY*0, valueFont);
drawRow(dc, iconCadence, spmStr, iconX, textX, startY + gapY*1, valueFont);
drawRow(dc, iconStride, elevStr, iconX, textX, startY + gapY*2, valueFont);
drawRow(dc, iconHr, hrStr, iconX, textX, startY + gapY*3, valueFont);
}

function drawRow(dc as Gfx.Dc,
icon as WatchUi.BitmapResource,
value ,
iconX ,
textX ,
y ,
font ) {

var iconY = y - (ICON_SIZE / 2)+20;
if (iconY < 0) { iconY = 0; }

dc.drawBitmap(iconX, iconY, icon);
dc.drawText(textX, y, font, value, Gfx.TEXT_JUSTIFY_LEFT);
}
}