Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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