Skip to content

Commit

Permalink
Fixed bug 210
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainGa committed Mar 27, 2022
1 parent ade7252 commit 1c77cf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/CrystalView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ function drawBatteryMeter(dc, x, y, width, height) {

// Fill.
// #8: battery returned as float. Use floor() to match native. Must match getValueForFieldType().
var batteryLevel = Math.floor(Sys.getSystemStats().battery);
// #210 Changed from floor to round
var batteryLevel = Math.round(Sys.getSystemStats().battery);

// Fill colour based on battery level.
var fillColour;
Expand Down
3 changes: 2 additions & 1 deletion source/DataFields.mc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ class DataFields extends Ui.Drawable {

case FIELD_TYPE_BATTERY:
// #8: battery returned as float. Use floor() to match native. Must match drawBatteryMeter().
value = Math.floor(Sys.getSystemStats().battery);
// #210 Changed from floor to round
value = Math.round(Sys.getSystemStats().battery);
value = value.format(INTEGER_FORMAT) + "%";
break;

Expand Down

0 comments on commit 1c77cf8

Please sign in to comment.