-
Notifications
You must be signed in to change notification settings - Fork 26
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
Flick large on Raspberry Pi 5 #69
Comments
Ok, I found the source code of flick-demo, so, I copied it to a py file and run it. It runs better, but at some point the exception: The python script continues running, but then nothing will be refreshed on the screen. I think it happens after doing the Air Wheel gesture |
Just for the records, now I understand a little bit the problem. From Raspberry Pi 5, they changed the way how the GPIOs are accessed; older Pis are using some library called RPI.GPIO, which is no longer compatible. The flick-demo is somehow working, but an error will be raised from the flicklib code. It seems that at some point, no data will be read from the memory and thus the returned object is "None". Here I'm using a python library called: "rpi-lgpio", but you can also use other alternatives:
Currently, I found this link useful: The author explains there how to install and use all those alternatives (only in german, so, you need to speak it or use the chromium based browsers translation). Coming back to the problem, this is the exception:
So, the error is after this line: Line 309 in bada72a
It doesn't read anything and returns "None", so, the next line: Fails because "data" is "None", so it doesn't have any "pop" attribute. Now, I will try to work with only one gesture and see if the problem comes. My second option is to subclass the flicklib classes and then add a quick an dirty fix, for example:
I know it is not a clean solution and it could break something else, but given the fact that I don't know exactly how the code works, it is my fastest way of solving my problem. |
By looking at the code, you will see this line: Line 308 in bada72a
It seems in deed that this small delay that is commented is really needed to avoid the "NoneType" exception. I added it and until now it hasn't crashed. It even detects the Wheel gesture, which without the pause doesn't. So, it seems to me that it is a latency problem with the Raspberry pi 5. Anyway, I also did a test and added logging to the flicklib.py module. I put this lines at the beginning:
Then I replaced the "_do_poll" function (Line 307) with this one:
Please note that I leave the "time.sleep(0.004)" line commented. Then I did: and discovered that "_read_msg" returned "None" several times and still the code continue working. So, I guess I will uncomment the "time.sleep(0.004)" line and leave my "if data != None:" in the code, just in case that no data is read again. It would be great if the developers of this library could solve the problem. Their product is still on the mark and just downgrading to Raspberry Pi 4 or lower isn't a solution. By the way, I think that somewhere on the code, you should do: Just to free the GPIO and avoid the message |
Remember flicklib was written when only Pi1 and Pi2 existed. |
Yes, in deed, it seems to be a problem with the latency, I guess that the device hasn't finished sending all the information, when the next read request takes place. |
Hi
I'm trying to run this on the Raspberry Pi 5, but as soon as I run the flick-demo, I get:
RuntimeError: Cannot determine SOC peripheral base address
I found that this pi is really different than its predecesors and the main reason is that it isn't compatible with RPi.GPIO (I don't know what this means exactly).
Anyway, I also found that you could solve this by installing lgpio, so, I did it as follows:
The command line demos still doesn't work, so, I tried this code:
https://news.sean.co.uk/2017/11/adding-gesture-control-to-raspberry-pi.html
It started to work, but at some point, an exception will be thrown:
The program will keep running, but the coordinates won't be updated. Exiting with CTRL+C and trying to run it again, just shows:
lgpio.error: 'GPIO busy'
I improve the code a little bit and that "busy" error disappeared, but the "AttributeError" exception still happens. In order to make the code work again, I need to exit from the python interpreter, come back and then run it again.
Is there anyway of getting this to be fixed for the Raspberry Pi 5?
Best regards
Josef
Here the improved version of the code:
The text was updated successfully, but these errors were encountered: