-
-
Save Katharine/af69eff12b7ccff6990d25ba8b299d2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from libpebble2.protocol.system import SystemMessage | |
from libpebble2.services.putbytes import PutBytes, PutBytesType | |
from libpebble2.util.bundle import PebbleBundle | |
def _install_firmware(pebble, pbz_path): | |
pebble.send_and_read(SystemMessage(message_type=SystemMessage.Type.FirmwareUpdateStart), SystemMessage) | |
bundle = PebbleBundle(pbz_path) | |
firmware_bytes = bundle.zip.read(bundle.get_firmware_info()["name"]) | |
pb = PutBytes(pebble, PutBytesType.Firmware, firmware_bytes, bank=0) | |
pb.send() | |
resource_bytes = bundle.zip.read(bundle.get_resource_path()) | |
pb = PutBytes(pebble, PutBytesType.SystemResources, resource_bytes, bank=0) | |
pb.send() | |
pebble.send_packet(SystemMessage(message_type=SystemMessage.Type.FirmwareUpdateComplete)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment