Skip to content

Commit

Permalink
7.1.0 - New attempt to fix HRV detection in app startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dliedke committed Apr 2, 2024
1 parent 508acfa commit d91a642
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion HrvAlgorithms/sources/activity/HeartbeatIntervalsSensor.mc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module HrvAlgorithms {
me.enableHrSensor();
}

private function enableHrSensor() {
function enableHrSensor() {
Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]);
}

Expand Down
2 changes: 1 addition & 1 deletion Meditate/manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. -->
<iq:manifest xmlns:iq="http://www.garmin.com/xml/connectiq" version="3">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="7.0.0">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="7.1.0">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="approachs7042mm"/>
Expand Down
2 changes: 1 addition & 1 deletion Meditate/resources-deu/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<string id="HRVready">HRV Bereit</string>
<string id="HRVoff">HRV aus</string>

<string id="about_AppVersion">Meditate 7.0.0</string>
<string id="about_AppVersion">Meditate 7.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
2 changes: 1 addition & 1 deletion Meditate/resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<string id="HRVready">VFC Pronto</string>
<string id="HRVoff">VFC Deslig.</string>

<string id="about_AppVersion">Meditate 7.0.0</string>
<string id="about_AppVersion">Meditate 7.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
2 changes: 1 addition & 1 deletion Meditate/resources-spa/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<string id="HRVready">HRV Listo</string>
<string id="HRVoff">HRV apagado</string>

<string id="about_AppVersion">Meditate 7.0.0</string>
<string id="about_AppVersion">Meditate 7.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
2 changes: 1 addition & 1 deletion Meditate/resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<string id="HRVready">HRV Ready</string>
<string id="HRVoff">HRV off</string>

<string id="about_AppVersion">Meditate 7.0.0</string>
<string id="about_AppVersion">Meditate 7.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
19 changes: 15 additions & 4 deletions Meditate/source/MeditateApp.mc
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,40 @@ using Toybox.System;

class MeditateApp extends App.AppBase {

var heartbeatIntervalsSensor;

function initialize() {
AppBase.initialize();
}

// onStart() is called on application start up
function onStart(state) {
}

if (heartbeatIntervalsSensor==null) {
heartbeatIntervalsSensor = new HrvAlgorithms.HeartbeatIntervalsSensor();
}

// Ensure the heartbeat sensor is enabled and listening when app starts
if (heartbeatIntervalsSensor != null) {
heartbeatIntervalsSensor.enableHrSensor();
heartbeatIntervalsSensor.start();
}
}
// onStop() is called when your application is exiting
function onStop(state) {
// Disable and remove listeners for heatbeat sensor
if (heartbeatIntervalsSensor!=null) {
heartbeatIntervalsSensor.disableHrSensor();
heartbeatIntervalsSensor.stop();
heartbeatIntervalsSensor.disableHrSensor();
}
}

var heartbeatIntervalsSensor;


// Return the initial view of your application here
function getInitialView() {
var sessionStorage = new SessionStorage();
heartbeatIntervalsSensor = new HrvAlgorithms.HeartbeatIntervalsSensor();

var sessionPickerDelegate = new SessionPickerDelegate(sessionStorage, heartbeatIntervalsSensor);

return [ sessionPickerDelegate.createScreenPickerView(), sessionPickerDelegate ];
Expand Down

0 comments on commit d91a642

Please sign in to comment.