Activity.WorkoutStep targetValueHigh and Low for Heart rate workout

I've written some code to take various workout targets (speed, cadence, distance and heart rate) and calculate the %age completion of each.

For example, if max is 10 and min is 5 and you're current is 7 then the %age is 40%  (7 is 40% of the way through the target zone)

For speed and cadence it seems to work fine, but for heart rate I've got a couple of issues: 

1) if I setup a workout with heart rate zone 2, it just puts the zone into the max / min not the actual heart rate values...

2) It also put the in backwards (min is the greater value, max is the lower value)

3) If I create a workout to use a custom heart rate (60 to 90 bpm for example) then I get targetValueHigh of 160 and targetValueLow of 190

Is there anywhere this is documented?  I couldn't find any mention of these high and low targets...

  • Similar problem for these two values in target type = speed. 

    Is there anywhere this is documented?  I couldn't find any mention of these high and low targets...

    step: Obj: 143
    durationType: 0
    durationValue: 10.000000
    targetType: 0
    targetValueLow: 0.447000
    targetValueHigh: 4.470000