Search This Blog

Saturday, December 1, 2018

WeightLifts 2.2.2

****** WeightLifts 2.2 and 2.1 were experiencing a bug that caused the app to crash if you selected a workout. This seems to be a result of the Units update not getting installed properly, resulting in no units being added. Without a unit, the Do Exercise screen encounters an unexpected "null" value, which causes the app to crash. 

The quick fix is to go to the Settings, then Edit Units, and add a unit. 

This will result in another crash (because it turns out I didn't tell the table how to reload properly), but on reopening the app, the unit will be there and the app should work. 

I'm uploading version 2.2.2 as I type this which should resolve all these issues. 


********** WeightLifts 2.2 +

In this version, I added two big features: syncing workout data with Apple Health, and pairing with a Heart Rate Monitor to...monitor my heart rate....and calculate calories burned during the workout. 

This required a bit of learning on my part (thank you RayWenderlich!) about how to share and access data from Apple Health and how to communicate with bluetooth devices. 

How to sync with Apple Health
Upon launching the app after downloading/updating it, you should be presented with the system screen requesting permission to access apple health. In order to calculate your calories burned, the app needs access to your sex, weight, and age, but you can choose whether or not to let it write your workouts, heart rate and calories burned to Apple Health. 


How to Pair with a Heart Rate Monitor

**I have only been able to test this with a Polar H7 heart rate strap, which it seemed to work rather well with. I'm not sure if it will work with FitBits, wrist-monitors, or the Apple Watch (but I'm hoping to get one so I CAN make it work with it), but please, let me know if it does or doesn't! 

When you start the app, it should already be set to search for heart rate monitors that are already paired to your device. By this, I mean that you have already paired the HR device to your phone BEFORE trying to pair it with the app. Then, make sure the app is set to check for heart rate monitors by going to Settings>HR monitor in the app, and ensuring the MeasureHR item is checked. 

Next, put on your HR monitor and go to the summary screen. A box will appear beneath the "Start Workout" bar when the app has successfully begun communicating with your monitor. 

If it doesn't show up, you may have to shut down and reopen the app.

Once it's paired and the box appears, you'll see your heart rate in BPM in red text. When you start the workout (by pressing on the green Start button and selecting the workout start time), another box should appear that will show your calories burned.

The calories burned are calculated using the formulas below where:

Heart rate is in BPM (taken as the average between two consecutive readings, which are taken every second or so.) 
Weight is in Kg
Age is in Years


Males: Calories = ((-55.0969 + (0.6309 * Heart Rate) + (0.1988 * Weight) + (0.2017 * Age)) / 4.184) * minutes
Females: Calories = ((-20.4022 + (0.4472 * Heart Rate) - (0.1263 * Weight) + (0.074 * Age)) / 4.184) * minutes 

Sources:
http://www.triathloninspires.com/ti_fitness_and_health/calories-burned-by-heart-rate.html
http://fitnowtraining.com/2012/01/formula-for-calories-burned/

** if anyone can point me to a more accurate formula from some trusted resource, please do! I tested the formula for males and the results I'm getting at the end of my workouts seem to match what I was getting from the Polar app. Don't take these as 100% accurate though: no formula can be 100% accurate as everyone burns calories differently based on more factors than just heart rate. 

So every reading of the monitor the app calculates the calories burned using the average heart rate of the two readings, and adds it to the total. 

At the end of your workout, pressing the Stop button will bring up a date picker to let you confirm the time you stopped working, then it will present you with a small summary. At this point you can choose to discard the workout data (which means it won't save it to Apple Health, but you'll still have your WeightLifts record of exercises done), or save it to Apple Health. 

WeightLifts does not save your hr or calorie data within the app.