ddc-oled icon indicating copy to clipboard operation
ddc-oled copied to clipboard

ValueError: too many values to unpack

Open Foxy6670 opened this issue 2 years ago • 5 comments

So I tried running the script on my Raspberry Pi 4 with the following command:

python3 oled.py /dev/i2c-1 1 1 0 0

And I got this error:

Traceback (most recent call last):
  File "/home/user/PyXCursor/oled.py", line 108, in <module>
    newbuffer = getFrameAsByteList()
  File "/home/user/PyXCursor/oled.py", line 82, in getFrameAsByteList
    iarray, xhot, yhot = cursor.getCursorImageArrayFast()
ValueError: too many values to unpack (expected 3)

Any way I can fix this? Thank you in advance.

Foxy6670 avatar Feb 09 '23 03:02 Foxy6670

Interesting. Are you sure you haven't modified the pyxcursor code at all? Is the raspberry pi running X11 (not headless and not wayland)?

ctypes on ARM / rasbperry pi could behave completely differently for all I know. You could try changing the line that's causing the error to just print whatever cursor.getCursorImageArrayFast() is returning, might shed some light on it.

mitxela avatar Feb 09 '23 12:02 mitxela

The Pi is running an X VNC server - with nothing connected to the HDMI ports. I was just running the Python script raw without the *.sh file with this repo. While on this topic, I actually was looking for a way to scale the output properly, as setting height to 32 only utilizes the bottom half of the 128x32 display, which I find odd. I plan on trying to play some video games with this strange setup. Edit: I meant top half. Sometimes the bottom half is noise, sometimes it's blank.

Foxy6670 avatar Feb 10 '23 17:02 Foxy6670

There may be some slight differences with how the 128x32 version is addressed, I've not looked into it.

I feel I should also mention that if you just want to use the screen with a raspberry pi, you can connect it to the GPIO pins and use one of the more official ways to drive it (adafruit libraries etc). I wouldn't be surprised if there's a dt_overlay that just works out of the box, I know there's drivers for the small TFT displays. Much less fun though!

Also if you just connect the display to one of the other i2c ports you can probably up the clock speed a fair bit.

mitxela avatar Feb 12 '23 12:02 mitxela

Yeah, I have it connected directly to the GPIO's i2c. I've tried using the official Adafruit libraries, I can't figure it out. I'd also prefer to use this script because it's optimized - at least, compared to the official driver. Not only that, the cursor is not required for what I intend to use this tiny OLED for - how would I go about removing the Xcursor stuff? Also, how would I up the i2c clock speed? Thanks in advance,

  • Foxy6670

Foxy6670 avatar Feb 13 '23 20:02 Foxy6670

To get rid of the cursor it should be enough to just delete lines 79 to 84.

There's more than one way to change i2c clock speed on raspberry pi, I think you can just put something in /boot/config.txt, if you google there should be tutorials on it.

mitxela avatar Feb 14 '23 17:02 mitxela