Skip to content

Instantly share code, notes, and snippets.

@IT-Delinquent
Created October 12, 2022 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IT-Delinquent/e1642c0fa08af1769ad0a6bb206f3f15 to your computer and use it in GitHub Desktop.
Save IT-Delinquent/e1642c0fa08af1769ad0a6bb206f3f15 to your computer and use it in GitHub Desktop.
garminBatteryIndicatorOnUpdate.mc
// Update the view
function onUpdate(dc as Dc) as Void {
//Get and show the current battery percentage
var pwr = System.getSystemStats().battery;
var batStr = Lang.format( "$1$%", [ pwr.format( "%2d" ) ] );
updateDisplayObject("BatteryLabel", batStr);
//Update battery text color
updateBatteryTextColor(pwr);
// Call the parent onUpdate function to redraw the layout
View.onUpdate(dc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment