forked from hire-marat/msband-py
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathset_me_tile.py
35 lines (26 loc) · 957 Bytes
/
set_me_tile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from PIL import Image
from msband.static.command import *
from msband.static import MeTileAdapter
from msband.protocol import ProtocolInterface
# Connect using your preferred interface
iband: ProtocolInterface = ...
# Get and show current MeTile image
image = iband.command(
FireballUIReadMeTileImage,
DataLength=iband.constants.MeTileWidth * iband.constants.MeTileHeight * 2,
Response=MeTileAdapter(GreedyBytes, iband.constants.MeTileWidth, iband.constants.MeTileHeight),
)
image.show()
# Set an image to open, must be sized correctly (see constants above)
image_path = ...
image = Image.open(image_path)
iband.command(InstalledAppListStartStripSyncStart)
iband.command(
FireballUIWriteMeTileImageWithID,
ImageId=(1 << 32) - 1,
ImageBytes=MeTileAdapter(
GreedyBytes, iband.constants.MeTileWidth, iband.constants.MeTileHeight
).build(image),
Response=Pass,
)
iband.command(InstalledAppListStartStripSyncEnd)