The last update to my Timestyle for Fitbit watchface was six months ago in it I addressed memory issues when launching the watchface

Active Zone Minutes

The main reason for the update was to add support for Fitbit’s new Active Zone Minutes. This required updating the SDK to version 4.2 and then rebuilding the watchface.

Adding support for Active Zone Minutes was pretty straightforward

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function getAzm() {
  let val = (today.adjusted.activeZoneMinutes.total || 0);
  return {
    pretty: convertNumberToK(val)
  }
}

function convertNumberToK(num) {
  if (num > 999) {
    if (num > 100000) {
      return (num/1000).toFixed(0) + 'k' 
    } else {
      return (num/1000).toFixed(1) + 'k' 
    }
  }
  return num;
}

However I was a little worried as I needed to add this code and an icon for the display and as I noted six months ago memory is tight.

Memory

The release notes for the new SDK did say that more memory was available for the newer watches. This was great for those watches but I still had to support the older watches as well.

I had measured the memory footprint as I optimised six months ago. During that optimisation I reordered the way the code was executed on launch, step 3.

Memory used on launch

I was pleasantly surprised to note that after upgrading the SDK and building v1.5 of the clockface that the memory footprint of the clockface had improved by about 5K, or almost 10%.

Memory used with SDK 4.2

I celebrated by adding some extra colours to match shirts that I have.