astro-pi / python-sense-hat

Source code for Sense HAT Python library
https://sense-hat.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
510 stars 255 forks source link

Error with sense.low_light and sense.gamma #145

Open Gaetanb76 opened 1 month ago

Gaetanb76 commented 1 month ago

Hi,

I wanted to test to reduce the light of the matrix led then I use the site https://pythonhosted.org/sense-hat/api/ and go to the "low_light" section.

I tried this code :

import time
from sense_hat import SenseHat

sense = SenseHat()
sense.clear(255, 255, 255)
sense.low_light = True
time.sleep(2)
sense.low_light = False

The leds light in white but after this message appears fcntl.ioctl(f, self.SENSE_HAT_FB_FBIORESET_GAMMA, cmd) OSError: [Errno 25] Inappropriate ioctl for device

then, I tried this one :

import time
from sense_hat import SenseHat

sense = SenseHat()
sense.clear(255, 127, 0)

print(sense.gamma)
time.sleep(2)

sense.gamma = reversed(sense.gamma)
print(sense.gamma)
time.sleep(2)

sense.low_light = True
print(sense.gamma)
time.sleep(2)

sense.low_light = False

and the result was : fcntl.ioctl(f, self.SENSE_HAT_FB_FBIOGET_GAMMA, buffer) OSError: [Errno 25] Inappropriate ioctl for device

I use a Raspberyy pi 4 8GB with a Sense Hat v2 module I use Thonny Python The OS is Raspbian bookworm python --version Python 3.11.2

pip freeze RTIMULib==7.2.1 sense-hat==2.6.0 thonny==4.1.4

Thanks for your help