diff --git a/.DS_Store b/.DS_Store index 4ab3da3..2033963 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..948a2f0 --- /dev/null +++ b/.vscode/launch.json @@ -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}" + } + ] +} \ No newline at end of file diff --git a/connectiq-sdk-manager.dmg b/connectiq-sdk-manager.dmg new file mode 100644 index 0000000..c94d02f Binary files /dev/null and b/connectiq-sdk-manager.dmg differ diff --git a/developer_key.der b/developer_key.der new file mode 100644 index 0000000..562006c Binary files /dev/null and b/developer_key.der differ diff --git a/resources/drawables/cadence_step_icon.png b/resources/drawables/cadence_step_icon.png new file mode 100644 index 0000000..284b6a5 Binary files /dev/null and b/resources/drawables/cadence_step_icon.png differ diff --git a/resources/drawables/drawables.xml b/resources/drawables/drawables.xml deleted file mode 100644 index 6302154..0000000 --- a/resources/drawables/drawables.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/resources/drawables/drawables.xml.bak b/resources/drawables/drawables.xml.bak new file mode 100644 index 0000000..a69ea6c --- /dev/null +++ b/resources/drawables/drawables.xml.bak @@ -0,0 +1,7 @@ + + + + + + + diff --git a/resources/drawables/heartrate_icon_red_40.png b/resources/drawables/heartrate_icon_red_40.png index ee71460..b9fe3da 100644 Binary files a/resources/drawables/heartrate_icon_red_40.png and b/resources/drawables/heartrate_icon_red_40.png differ diff --git a/resources/drawables/running_icon.png b/resources/drawables/running_icon.png new file mode 100644 index 0000000..a77cba8 Binary files /dev/null and b/resources/drawables/running_icon.png differ diff --git a/resources/drawables/stridelength_icon.png b/resources/drawables/stridelength_icon.png new file mode 100644 index 0000000..4858438 Binary files /dev/null and b/resources/drawables/stridelength_icon.png differ diff --git a/resources/drawables_small/cadence_step_icon.png b/resources/drawables_small/cadence_step_icon.png new file mode 100644 index 0000000..087f9ee Binary files /dev/null and b/resources/drawables_small/cadence_step_icon.png differ diff --git a/resources/drawables_small/heartrate_icon_red_40.png b/resources/drawables_small/heartrate_icon_red_40.png new file mode 100644 index 0000000..ab09400 Binary files /dev/null and b/resources/drawables_small/heartrate_icon_red_40.png differ diff --git a/resources/drawables_small/running_icon.png b/resources/drawables_small/running_icon.png new file mode 100644 index 0000000..e3a8339 Binary files /dev/null and b/resources/drawables_small/running_icon.png differ diff --git a/resources/drawables_small/stridelength_icon.png b/resources/drawables_small/stridelength_icon.png new file mode 100644 index 0000000..c16ee61 Binary files /dev/null and b/resources/drawables_small/stridelength_icon.png differ diff --git a/resources/resources.xml b/resources/resources.xml new file mode 100644 index 0000000..c128e2f --- /dev/null +++ b/resources/resources.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/source/GarminApp.mc b/source/GarminApp.mc index c030c3c..13fe8d6 100644 --- a/source/GarminApp.mc +++ b/source/GarminApp.mc @@ -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"); @@ -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; @@ -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 { diff --git a/source/SimpleHomescreenUI.mc b/source/SimpleHomescreenUI.mc new file mode 100644 index 0000000..b6d9489 --- /dev/null +++ b/source/SimpleHomescreenUI.mc @@ -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); + } +}