Skip to content

Commit

Permalink
add Pin2DMD HD support
Browse files Browse the repository at this point in the history
  • Loading branch information
4r3 committed Feb 4, 2025
1 parent 7aaf485 commit c3164f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mpf/config_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ pin2dmd:
debug: single|bool|false
console_log: single|enum(none,basic,full)|none
file_log: single|enum(none,basic,full)|basic
resolution: single|enum(128x32,192x64)|128x32
resolution: single|enum(128x32,192x64,256x64)|128x32
panel: single|enum(rgb,rbg)|rgb
pkone:
__valid_in__: machine
Expand Down
19 changes: 18 additions & 1 deletion mpf/platforms/pin2dmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def _send_brightness(self, brightness):
def _send_frame(self, buffer):
if self.resolution == "128x32":
elements = 2048
else:
elif self.resolution == "192x64":
elements = 6144
else:
elements = 8192

output_buffer = [0] * (elements * 6 + 4)

Expand Down Expand Up @@ -164,6 +166,21 @@ def _send_frame(self, buffer):
pixel_bl >>= 1
target_idx += elements

if self.resolution == "256x64":
dest_idx = 4
tmp_idx = 4
temp_buffer = output_buffer.copy()

for _ in range(0, elements * 3):
temp_buffer[dest_idx] = output_buffer[tmp_idx + 128]
temp_buffer[dest_idx + 1] = output_buffer[tmp_idx] << 1
dest_idx += 2
tmp_idx += 1
if (dest_idx - 4) % 256 == 0:
tmp_idx += 128

output_buffer = temp_buffer

if self.debug:
self.log.debug("Writing 0x01, %s, 1000", "".join(" 0x%02x" % b for b in output_buffer))

Expand Down

0 comments on commit c3164f2

Please sign in to comment.