display.get_pixel unexpected output on microbit
hi there,
The display.get_pixel method with a full bright pixel on the a microbit returns a "255" instead of a "9".
This is not conform the docs on internet. The method should have returned a "9" for a full pixel.
It seems the display.get_pixel method returns a value between 0-255 instead of 0-9.
from microbit import *
display.set_pixel(0, 0, 9)
display.scroll(str(display.get_pixel(0, 0)))
pixel() in extmod/modframebuf.c returning unexpected result
framebuf.pixel() is returning results different to what is being set.
Given a simple 16x16 buffer.
>>> import framebuf
>>> width = 16
>>> height = 16
>>> pages = height // 8
>>> buffer = bytearray(pages * width)
>>> framebuf = framebuf.FrameBuffer1(buffer, width, height)
Set 3 pixels to black:
>>> framebuf.pixel(0,0,0)
>>> framebuf.pixel(0,1,1)
>>> framebuf.pixel(0,2,1)
>>> framebuf.pixel(0,3,1)
Then retrieve them:
>>> framebuf.pixel(0,0)
14
>>> framebuf.pixel(0,1)
7
>>> framebuf.pixel(0,2)
3
>>> framebuf.pixel(0,3)
1
Expected to see:
>>> framebuf.pixel(0,0)
0
>>> framebuf.pixel(0,1)
1
>>> framebuf.pixel(0,2)
1
>>> framebuf.pixel(0,3)
1
I can get the expected result if I AND them with 1:
>>> framebuf.pixel(0,0) & 1
0
>>> framebuf.pixel(0,1) & 1
1
>>> framebuf.pixel(0,2) & 1
1
>>> framebuf.pixel(0,3) & 1
1
Am I wrong in my expectation that col in pixel(0,1,col) and col = pixel(0,1) should match?
Is it useful for pixel() to return its adjacent bits?