BIP battery icon behavior, differs between watch and editor
Posted: 12 Mar 2019, 10:09
INTRODUCTION
This difference in behavior can lead to unexpected results, especially when battery icons are used to represent precise battery levels. With the information below, differences can be accounted for and precise behavior can be achieved when being aware of the actual calculation methods.
INPUTS:
ImageIndex (defined in JSON file)
ImagesCount (defined in JSON file)
BatteryLevel [0 .. 100] (given by Watch OR WatchFaceEditor)
CALCULATION
offset = BatteryLevel * (ImageCount - 1)/100 + 0.5 // WatchFaceEditor
offset = BatteryLevel * (ImageCount - 1)/100 + 1 // Watch
OUTPUT
ImageNumber = ImageIndex + INTEGER(offset)
NOTES
For Watch:
- the needed change in BatteryLevel to get the next ImageNumber, is equal for the whole BatteryLevel range. In other words: equal battery step size over the whole range.
- The image with IndexNumber equal to ImageIndex, will never be selected! The calculation shows that offset is 1 for a BatteryLevel of 0
- the calculation presented above, is derived from extensive measurements
For WatchFaceEditor:
- The first battery stepsize (starting a BatterryLevel 0) and the last battery stepsize (ending at BatteryLevel 100) have half the size of the other battery steps
- The image with IndexNumber equal ti ImageIndex, will be selected at the lowest BatteryLevel close tot 0
This difference in behavior can lead to unexpected results, especially when battery icons are used to represent precise battery levels. With the information below, differences can be accounted for and precise behavior can be achieved when being aware of the actual calculation methods.
INPUTS:
ImageIndex (defined in JSON file)
ImagesCount (defined in JSON file)
BatteryLevel [0 .. 100] (given by Watch OR WatchFaceEditor)
CALCULATION
offset = BatteryLevel * (ImageCount - 1)/100 + 0.5 // WatchFaceEditor
offset = BatteryLevel * (ImageCount - 1)/100 + 1 // Watch
OUTPUT
ImageNumber = ImageIndex + INTEGER(offset)
NOTES
For Watch:
- the needed change in BatteryLevel to get the next ImageNumber, is equal for the whole BatteryLevel range. In other words: equal battery step size over the whole range.
- The image with IndexNumber equal to ImageIndex, will never be selected! The calculation shows that offset is 1 for a BatteryLevel of 0
- the calculation presented above, is derived from extensive measurements
For WatchFaceEditor:
- The first battery stepsize (starting a BatterryLevel 0) and the last battery stepsize (ending at BatteryLevel 100) have half the size of the other battery steps
- The image with IndexNumber equal ti ImageIndex, will be selected at the lowest BatteryLevel close tot 0