Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST]: Screen Drawing #197

Open
MontyMole98 opened this issue Mar 8, 2024 · 1 comment
Open

[FEATURE REQUEST]: Screen Drawing #197

MontyMole98 opened this issue Mar 8, 2024 · 1 comment

Comments

@MontyMole98
Copy link

This project is cool, but I wish there was support for the LCD screen. This breaks down to these functions:

  • Line drawing, using the first two arguments as the points.
  • Printing RGF image files to the screen.
  • Printing raw pixel data to the screen at any X and Y coordinates, using any aspect ratio, all passed as arguments.
  • Printing text to the screen.
  • Clearing the screen.

Obviously this is just a request that suits my project's needs, especially because the base NXT programming software had support for these functions in some capacity. It would be much appreciated if this was added.

@schodet
Copy link
Owner

schodet commented Mar 8, 2024

From the firmware, you have access to system command and direct command. There is no command for the LCD screen.

However, you have access to the “IOMAPs”, have a look at the nxt-screen example to see how it reads from the LCD, you can use the same technique to write to it.

def NXT_get_display_data(b):
# each "module" has it's own memory region, id, ...
# for t in b.find_modules():
# print(t, hex(t[1]))
mod_display = 0xA0001
# display is WxH = 100x64 pixels
# their memory layout is in eight lines of 100 bytes, with each byte encoding
# a strip of eight vertical pixels
data = b""
pixels = [""] * 64
DisplayOffsetNormal = 119
for i in range(20):
data += b.read_io_map(mod_display, DisplayOffsetNormal + i * 40, 40)[1]
for line in range(8):
for x in range(100):
b = data[line * 100 + x]
for y in range(8):
bitsels = format(
b, "08b"
) # abuse the stringification to get 8 1's and 0's
pixels[line * 8 + y] += bitsels[7 - y]
return pixels

You can use your computer power to do anything, just avoid writing one pixel at a time.

Another option is to have a program running on the brick and use messages to communicate with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants