Skip to content

Commit

Permalink
Merge pull request #1871 from 4r3/add-pin2dmd-hd-support
Browse files Browse the repository at this point in the history
add pin2dmd HD support
  • Loading branch information
avanwinkle authored Feb 6, 2025
2 parents ac9e468 + 2985647 commit 9c6e122
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":
target_idx = 4
idx = 4
temp_buffer = output_buffer.copy()

for _ in range(0, elements * 3):
temp_buffer[target_idx] = output_buffer[idx + 128]
temp_buffer[target_idx + 1] = output_buffer[idx] << 1
target_idx += 2
idx += 1
if (target_idx - 4) % 256 == 0:
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 9c6e122

Please sign in to comment.