Skip to content

Instantly share code, notes, and snippets.

@jepler
Created February 10, 2025 21:29
Show Gist options
  • Save jepler/7ae5df5c3877b4c97edbf5f6681c430d to your computer and use it in GitHub Desktop.
Save jepler/7ae5df5c3877b4c97edbf5f6681c430d to your computer and use it in GitHub Desktop.
--- fbmirror_scaled_tmp.py.orig 2025-02-10 09:27:49.407999983 -0600
+++ fbmirror_scaled_tmp.py 2025-02-10 15:21:41.577745068 -0600
@@ -47,11 +47,12 @@
@click.option("--x-offset", "xoffset", type=int, help="The x offset of top left corner of the region to mirror", default=0)
@click.option("--y-offset", "yoffset", type=int, help="The y offset of top left corner of the region to mirror", default=0)
@click.option("--scale", "scale", type=int, help="The scale factor to reduce the display down by.", default=3)
-@piomatter_click.standard_options
-def main(xoffset, yoffset, scale, width, height, serpentine, rotation, colorspace, pinout, n_planes, n_addr_lines):
+@piomatter_click.standard_options(colorspace=None)
+def main(xoffset, yoffset, scale, width, height, serpentine, rotation, pinout, n_planes, n_addr_lines):
+ print(f"{width=} {height=} {width*height=}")
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_addr_lines=n_addr_lines, rotation=rotation)
- matrix_framebuffer = np.zeros(shape=(geometry.height, geometry.width, 3), dtype=dtype)
- matrix = piomatter.PioMatter(colorspace=colorspace, pinout=pinout, framebuffer=matrix_framebuffer, geometry=geometry)
+ matrix_framebuffer = np.zeros(shape=(geometry.height, geometry.width, 3), dtype=np.uint8)
+ matrix = piomatter.PioMatter(colorspace=piomatter.Colorspace.RGB888Packed, pinout=pinout, framebuffer=matrix_framebuffer, geometry=geometry)
while True:
tmp = linux_framebuffer[yoffset:yoffset + height * scale, xoffset:xoffset + width * scale]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment