IS-Matrix-Forge 1.0.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- is_matrix_forge/__init__.py +8 -0
- is_matrix_forge/assets/__init__.py +8 -0
- is_matrix_forge/assets/audio/__init__.py +36 -0
- is_matrix_forge/assets/audio/files/__init__.py +53 -0
- is_matrix_forge/assets/audio/files/plugged.wav +0 -0
- is_matrix_forge/assets/audio/files/unplugged.wav +0 -0
- is_matrix_forge/assets/char_map.json +2150 -0
- is_matrix_forge/assets/font_map.py +119 -0
- is_matrix_forge/common/__init__.py +0 -0
- is_matrix_forge/common/decorators/__init__.py +152 -0
- is_matrix_forge/common/dirs.py +20 -0
- is_matrix_forge/common/helpers/__init__.py +132 -0
- is_matrix_forge/common/helpers/github_api.py +67 -0
- is_matrix_forge/designer_gui/__init__.py +8 -0
- is_matrix_forge/designer_gui/main_window/__init__.py +252 -0
- is_matrix_forge/designer_gui/main_window/layout.py +117 -0
- is_matrix_forge/dev_tools/__init__.py +8 -0
- is_matrix_forge/dev_tools/debug.py +82 -0
- is_matrix_forge/dev_tools/presets.py +47 -0
- is_matrix_forge/inputmodule/__init__.py +164 -0
- is_matrix_forge/inputmodule/b1display.py +160 -0
- is_matrix_forge/inputmodule/c1minimal.py +35 -0
- is_matrix_forge/inputmodule/font.py +2166 -0
- is_matrix_forge/inputmodule/helpers/__init__.py +16 -0
- is_matrix_forge/inputmodule/ledmatrix.py +516 -0
- is_matrix_forge/led_matrix/Scripts/__init__.py +4 -0
- is_matrix_forge/led_matrix/Scripts/battery_monitor.py +152 -0
- is_matrix_forge/led_matrix/Scripts/install_presets/__init__.py +2 -0
- is_matrix_forge/led_matrix/Scripts/install_presets/arguments.py +84 -0
- is_matrix_forge/led_matrix/Scripts/install_presets/main.py +192 -0
- is_matrix_forge/led_matrix/__init__.py +7 -0
- is_matrix_forge/led_matrix/commands/__init__.py +84 -0
- is_matrix_forge/led_matrix/commands/map.py +46 -0
- is_matrix_forge/led_matrix/constants.py +82 -0
- is_matrix_forge/led_matrix/controller/__init__.py +26 -0
- is_matrix_forge/led_matrix/controller/controller.py +635 -0
- is_matrix_forge/led_matrix/controller/helpers/__init__.py +7 -0
- is_matrix_forge/led_matrix/controller/helpers/threading.py +41 -0
- is_matrix_forge/led_matrix/controller/multiton.py +32 -0
- is_matrix_forge/led_matrix/controller/threaded.py +72 -0
- is_matrix_forge/led_matrix/display/__init__.py +13 -0
- is_matrix_forge/led_matrix/display/animations/__init__.py +29 -0
- is_matrix_forge/led_matrix/display/animations/animation.py +593 -0
- is_matrix_forge/led_matrix/display/animations/effects/__init__.py +17 -0
- is_matrix_forge/led_matrix/display/animations/errors.py +23 -0
- is_matrix_forge/led_matrix/display/animations/font/__init__.py +17 -0
- is_matrix_forge/led_matrix/display/animations/font/font.py +4 -0
- is_matrix_forge/led_matrix/display/animations/font/map_builder.py +123 -0
- is_matrix_forge/led_matrix/display/animations/frame/__init__.py +47 -0
- is_matrix_forge/led_matrix/display/animations/frame/base.py +245 -0
- is_matrix_forge/led_matrix/display/animations/frame/helpers.py +67 -0
- is_matrix_forge/led_matrix/display/animations/keep_awake.py +1 -0
- is_matrix_forge/led_matrix/display/animations/plugged.py +0 -0
- is_matrix_forge/led_matrix/display/animations/text_scroller.py +104 -0
- is_matrix_forge/led_matrix/display/effects/__init__.py +17 -0
- is_matrix_forge/led_matrix/display/effects/breather.py +206 -0
- is_matrix_forge/led_matrix/display/effects/fade.py +0 -0
- is_matrix_forge/led_matrix/display/effects/scroller/__init__.py +92 -0
- is_matrix_forge/led_matrix/display/effects/scroller/base.py +76 -0
- is_matrix_forge/led_matrix/display/effects/scroller/helpers.py +62 -0
- is_matrix_forge/led_matrix/display/grid/__init__.py +9 -0
- is_matrix_forge/led_matrix/display/grid/grid.py +208 -0
- is_matrix_forge/led_matrix/display/grid/helpers.py +130 -0
- is_matrix_forge/led_matrix/display/grid/presets/__init__.py +64 -0
- is_matrix_forge/led_matrix/display/grid/presets/manifest.py +172 -0
- is_matrix_forge/led_matrix/display/helpers/__init__.py +110 -0
- is_matrix_forge/led_matrix/display/helpers/columns.py +33 -0
- is_matrix_forge/led_matrix/display/media.py +199 -0
- is_matrix_forge/led_matrix/display/patterns/__init__.py +59 -0
- is_matrix_forge/led_matrix/display/patterns/built_in/__init__.py +91 -0
- is_matrix_forge/led_matrix/display/patterns/built_in/commands.py +3 -0
- is_matrix_forge/led_matrix/display/patterns/built_in/constants.py +29 -0
- is_matrix_forge/led_matrix/display/patterns/built_in/stencils.py +70 -0
- is_matrix_forge/led_matrix/display/patterns/utils.py +2 -0
- is_matrix_forge/led_matrix/display/text/__init__.py +66 -0
- is_matrix_forge/led_matrix/display/text/scroller.py +136 -0
- is_matrix_forge/led_matrix/errors/__init__.py +4 -0
- is_matrix_forge/led_matrix/errors/base.py +14 -0
- is_matrix_forge/led_matrix/errors/grid.py +37 -0
- is_matrix_forge/led_matrix/errors/matrix.py +68 -0
- is_matrix_forge/led_matrix/errors/misc.py +36 -0
- is_matrix_forge/led_matrix/fonts.py +20 -0
- is_matrix_forge/led_matrix/hardware.py +172 -0
- is_matrix_forge/led_matrix/helpers/__init__.py +165 -0
- is_matrix_forge/led_matrix/helpers/core/__init__.py +17 -0
- is_matrix_forge/led_matrix/helpers/core/lazy_mod_load.py +84 -0
- is_matrix_forge/led_matrix/helpers/device.py +118 -0
- is_matrix_forge/led_matrix/helpers/status_handler.py +14 -0
- is_matrix_forge/led_matrix/helpers/stream/__init__.py +70 -0
- is_matrix_forge/led_matrix/helpers/stream/errors.py +17 -0
- is_matrix_forge/led_matrix/led_matrix.py +25 -0
- is_matrix_forge/led_matrix/status.py +8 -0
- is_matrix_forge/led_matrix/tools/__init__.py +8 -0
- is_matrix_forge/led_matrix/tools/identify.py +27 -0
- is_matrix_forge/led_matrix/utils/__init__.py +41 -0
- is_matrix_forge/log_engine.py +25 -0
- is_matrix_forge/monitor/__init__.py +68 -0
- is_matrix_forge/monitor/errors.py +35 -0
- is_matrix_forge/monitor/events.py +78 -0
- is_matrix_forge/monitor/gui/__init__.py +0 -0
- is_matrix_forge/monitor/gui/errors.py +35 -0
- is_matrix_forge/monitor/gui/event/__init__.py +8 -0
- is_matrix_forge/monitor/gui/event/collection.py +153 -0
- is_matrix_forge/monitor/gui/event/errors.py +58 -0
- is_matrix_forge/monitor/gui/event/event.py +226 -0
- is_matrix_forge/monitor/gui/layout/__init__.py +8 -0
- is_matrix_forge/monitor/gui/layout/base.py +147 -0
- is_matrix_forge/monitor/gui/metaclasses/__init__.py +20 -0
- is_matrix_forge/monitor/gui/windows/__init__.py +0 -0
- is_matrix_forge/monitor/gui/windows/base.py +325 -0
- is_matrix_forge/monitor/gui/windows/main/__init__.py +77 -0
- is_matrix_forge/monitor/gui/windows/main/layout.py +21 -0
- is_matrix_forge/monitor/helpers.py +55 -0
- is_matrix_forge/monitor/monitor.py +431 -0
- is_matrix_forge/notify/__init__.py +0 -0
- is_matrix_forge/notify/sounds/__init__.py +6 -0
- is_matrix_forge/notify/sounds/base.py +106 -0
- is_matrix_forge/progress.py +99 -0
- is_matrix_forge-1.0.0.dev1.dist-info/LICENSE.md +19 -0
- is_matrix_forge-1.0.0.dev1.dist-info/METADATA +190 -0
- is_matrix_forge-1.0.0.dev1.dist-info/RECORD +123 -0
- is_matrix_forge-1.0.0.dev1.dist-info/WHEEL +4 -0
- is_matrix_forge-1.0.0.dev1.dist-info/entry_points.txt +5 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from inputmodule.inputmodule import send_command, CommandVals, FWK_MAGIC
|
|
4
|
+
|
|
5
|
+
B1_WIDTH = 300
|
|
6
|
+
B1_HEIGHT = 400
|
|
7
|
+
GREYSCALE_DEPTH = 32
|
|
8
|
+
|
|
9
|
+
SCREEN_FPS = ["quarter", "half", "one", "two",
|
|
10
|
+
"four", "eight", "sixteen", "thirtytwo"]
|
|
11
|
+
HIGH_FPS_MASK = 0b00010000
|
|
12
|
+
LOW_FPS_MASK = 0b00000111
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def b1image_bl(dev, image_file):
|
|
16
|
+
"""Display an image in black and white
|
|
17
|
+
Confirmed working with PNG and GIF.
|
|
18
|
+
Must be 300x400 in size.
|
|
19
|
+
Sends one 400px column in a single commands and a flush at the end
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from PIL import Image
|
|
23
|
+
|
|
24
|
+
im = Image.open(image_file).convert("RGB")
|
|
25
|
+
width, height = im.size
|
|
26
|
+
assert width == B1_WIDTH
|
|
27
|
+
assert height == B1_HEIGHT
|
|
28
|
+
pixel_values = list(im.getdata())
|
|
29
|
+
|
|
30
|
+
for x in range(B1_WIDTH):
|
|
31
|
+
vals = [0 for _ in range(50)]
|
|
32
|
+
|
|
33
|
+
byte = None
|
|
34
|
+
for y in range(B1_HEIGHT):
|
|
35
|
+
pixel = pixel_values[y * B1_WIDTH + x]
|
|
36
|
+
brightness = sum(pixel) / 3
|
|
37
|
+
black = brightness < 0xFF / 2
|
|
38
|
+
|
|
39
|
+
bit = y % 8
|
|
40
|
+
|
|
41
|
+
if bit == 0:
|
|
42
|
+
byte = 0
|
|
43
|
+
if black:
|
|
44
|
+
byte |= 1 << bit
|
|
45
|
+
|
|
46
|
+
if bit == 7:
|
|
47
|
+
vals[int(y / 8)] = byte
|
|
48
|
+
|
|
49
|
+
column_le = list((x).to_bytes(2, "little"))
|
|
50
|
+
command = FWK_MAGIC + [0x16] + column_le + vals
|
|
51
|
+
send_command(dev, command)
|
|
52
|
+
|
|
53
|
+
# Flush
|
|
54
|
+
command = FWK_MAGIC + [0x17]
|
|
55
|
+
send_command(dev, command)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def display_string(dev, disp_str):
|
|
59
|
+
b = [ord(x) for x in disp_str]
|
|
60
|
+
send_command(dev, CommandVals.SetText, [len(disp_str)] + b)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def display_on_cmd(dev, on):
|
|
64
|
+
send_command(dev, CommandVals.DisplayOn, [on])
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def invert_screen_cmd(dev, invert):
|
|
68
|
+
send_command(dev, CommandVals.InvertScreen, [invert])
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def screen_saver_cmd(dev, on):
|
|
72
|
+
send_command(dev, CommandVals.ScreenSaver, [on])
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def set_fps_cmd(dev, mode):
|
|
76
|
+
res = send_command(dev, CommandVals.SetFps, with_response=True)
|
|
77
|
+
current_fps = res[0]
|
|
78
|
+
|
|
79
|
+
if mode == "quarter":
|
|
80
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
81
|
+
fps |= 0b000
|
|
82
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
83
|
+
set_power_mode_cmd("low")
|
|
84
|
+
elif mode == "half":
|
|
85
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
86
|
+
fps |= 0b001
|
|
87
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
88
|
+
set_power_mode_cmd("low")
|
|
89
|
+
elif mode == "one":
|
|
90
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
91
|
+
fps |= 0b010
|
|
92
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
93
|
+
set_power_mode_cmd("low")
|
|
94
|
+
elif mode == "two":
|
|
95
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
96
|
+
fps |= 0b011
|
|
97
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
98
|
+
set_power_mode_cmd("low")
|
|
99
|
+
elif mode == "four":
|
|
100
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
101
|
+
fps |= 0b100
|
|
102
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
103
|
+
set_power_mode_cmd("low")
|
|
104
|
+
elif mode == "eight":
|
|
105
|
+
fps = current_fps & ~LOW_FPS_MASK
|
|
106
|
+
fps |= 0b101
|
|
107
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
108
|
+
set_power_mode_cmd("low")
|
|
109
|
+
elif mode == "sixteen":
|
|
110
|
+
fps = current_fps & ~HIGH_FPS_MASK
|
|
111
|
+
fps |= 0b00000000
|
|
112
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
113
|
+
set_power_mode_cmd("high")
|
|
114
|
+
elif mode == "thirtytwo":
|
|
115
|
+
fps = current_fps & ~HIGH_FPS_MASK
|
|
116
|
+
fps |= 0b00010000
|
|
117
|
+
send_command(dev, CommandVals.SetFps, [fps])
|
|
118
|
+
set_power_mode_cmd("high")
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def set_power_mode_cmd(dev, mode):
|
|
122
|
+
if mode == "low":
|
|
123
|
+
send_command(dev, CommandVals.SetPowerMode, [0])
|
|
124
|
+
elif mode == "high":
|
|
125
|
+
send_command(dev, CommandVals.SetPowerMode, [1])
|
|
126
|
+
else:
|
|
127
|
+
print("Unsupported power mode")
|
|
128
|
+
sys.exit(1)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def get_power_mode_cmd(dev):
|
|
132
|
+
res = send_command(dev, CommandVals.SetPowerMode, with_response=True)
|
|
133
|
+
current_mode = int(res[0])
|
|
134
|
+
if current_mode == 0:
|
|
135
|
+
print("Current Power Mode: Low Power")
|
|
136
|
+
elif current_mode == 1:
|
|
137
|
+
print("Current Power Mode: High Power")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_fps_cmd(dev):
|
|
141
|
+
res = send_command(dev, CommandVals.SetFps, with_response=True)
|
|
142
|
+
current_fps = res[0]
|
|
143
|
+
res = send_command(dev, CommandVals.SetPowerMode, with_response=True)
|
|
144
|
+
current_mode = int(res[0])
|
|
145
|
+
|
|
146
|
+
if current_mode == 0:
|
|
147
|
+
current_fps &= LOW_FPS_MASK
|
|
148
|
+
if current_fps == 0:
|
|
149
|
+
fps = 0.25
|
|
150
|
+
elif current_fps == 1:
|
|
151
|
+
fps = 0.5
|
|
152
|
+
else:
|
|
153
|
+
fps = 2 ** (current_fps - 2)
|
|
154
|
+
elif current_mode == 1:
|
|
155
|
+
if current_fps & HIGH_FPS_MASK:
|
|
156
|
+
fps = 32
|
|
157
|
+
else:
|
|
158
|
+
fps = 16
|
|
159
|
+
|
|
160
|
+
print(f"Current FPS: {fps}")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from inputmodule.inputmodule import send_command, CommandVals
|
|
2
|
+
|
|
3
|
+
RGB_COLORS = ["white", "black", "red", "green",
|
|
4
|
+
"blue", "cyan", "yellow", "purple"]
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_color(dev):
|
|
8
|
+
res = send_command(dev, CommandVals.SetColor, with_response=True)
|
|
9
|
+
return (int(res[0]), int(res[1]), int(res[2]))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def set_color(dev, color):
|
|
13
|
+
rgb = None
|
|
14
|
+
if color == "white":
|
|
15
|
+
rgb = [0xFF, 0xFF, 0xFF]
|
|
16
|
+
elif color == "black":
|
|
17
|
+
rgb = [0x00, 0x00, 0x00]
|
|
18
|
+
elif color == "red":
|
|
19
|
+
rgb = [0xFF, 0x00, 0x00]
|
|
20
|
+
elif color == "green":
|
|
21
|
+
rgb = [0x00, 0xFF, 0x00]
|
|
22
|
+
elif color == "blue":
|
|
23
|
+
rgb = [0x00, 0x00, 0xFF]
|
|
24
|
+
elif color == "yellow":
|
|
25
|
+
rgb = [0xFF, 0xFF, 0x00]
|
|
26
|
+
elif color == "cyan":
|
|
27
|
+
rgb = [0x00, 0xFF, 0xFF]
|
|
28
|
+
elif color == "purple":
|
|
29
|
+
rgb = [0xFF, 0x00, 0xFF]
|
|
30
|
+
else:
|
|
31
|
+
print(f"Unknown color: {color}")
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
if rgb:
|
|
35
|
+
send_command(dev, CommandVals.SetColor, rgb)
|