Go to advanced search

by paddyg
Sat Dec 07, 2019 7:37 pm
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1032

Re: Threading problems

Hi, Yes I just tested the idea of not putting the functions in Threads (pi3d_demos has an example using PyQt4 so I could add a time-wasting function very easily). The result is that the functions started by QTimer do block the execution of the main thread so that means that if you don't put the func...
by paddyg
Sat Dec 07, 2019 4:44 pm
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1032

Re: Threading problems

That's lots of code to look at - well I did ask for it ;) However I am more confused than ever. You still don't have any loops in your threaded functions so there seems very little benefit putting them in threads at all. Have you tried: def prozenje(): digitalna_ura() aktivnosti_po_uri() watch_dog_p...
by paddyg
Sat Dec 07, 2019 9:15 am
Forum: General discussion
Topic: RPI 4B 1GB Xinit keeps stopping; running out of options...
Replies: 7
Views: 563

Re: RPI 4B 1GB Xinit keeps stopping; running out of options...

@basm does it only crash when running pi3d? Also what form does the crash take? You say X stops which sounds like you drop back to command line. PS what happens if you take out the hdmi_cvt out or only specify w,h,fps and not aspect ratio or set aspect ratio to 3 for 16:9. Don't know if screens can ...
by paddyg
Sat Dec 07, 2019 8:38 am
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1032

Re: Threading problems

Some modules have functionality that has to run in the main thread of the process that started the program. For instance in pi3d the calls to external OpenGL DLLs can't be offloaded into spawned threads. So when it needs to be run at the same time as Qt or Flask etc it either has to be run as a diff...
by paddyg
Fri Dec 06, 2019 11:34 am
Forum: Python
Topic: Python script started on boot, how to show console output
Replies: 1
Views: 207

Re: Python script started on boot, how to show console output

Simplest might be to convert the print()s to writing to a file. You would need a mechanism to prevent it getting too big. On seeing the stdio of another session there is some info that may help here https://unix.stackexchange.com/questions/58550/how-to-view-the-output-of-a-running-process-in-another...
by paddyg
Fri Dec 06, 2019 11:09 am
Forum: Graphics programming
Topic: Open GL 2.1 on RPi 4
Replies: 8
Views: 1539

Re: Open GL 2.1 on RPi 4

Looks like you haven't changed that first line of your fragment shader (you have to fix the vertex and fragment shaders. i.e. two edits) as per @Gavinmc42's suggestion. Try that and see what you get.
by paddyg
Fri Dec 06, 2019 12:00 am
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1032

Re: Threading problems

Hi, this is a stripped back threading with while loops. Fairly ugly code with globals and copy pasted stuff that needs DRYing, but hopefully clear what's going on. You could use the QT timer to run a function to set the boolean trigger variables rather than a threaded loop. That wouldn't need to be ...
by paddyg
Thu Dec 05, 2019 9:24 pm
Forum: Python
Topic: Porting a C Python module to Python 3
Replies: 9
Views: 2130

Re: Porting a C Python module to Python 3

As a reference for anyone thinking of writing their own python module I though I would add some more comparisons: https://github.com/paddywwoof/atkinson 1. the un-accelerated python just reading and writing pixels using PIL.Image (much slower than 10x so maybe it would be better converting into pyth...
by paddyg
Thu Dec 05, 2019 6:10 pm
Forum: Python
Topic: Threading problems
Replies: 18
Views: 1032

Re: Threading problems

As Paeryn says none of those threaded functions have while loops so they will just run then stop. Is that what you intend? Normally the threaded functions would be started then loop in the background doing something.
by paddyg
Thu Dec 05, 2019 4:52 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 728

Re: lancer un programme avec un interrupteur

ou utilisez le diviseur de tension pour fournir 3V3 à VCC de MM74c922 alors vous n'avez besoin de rien entre cela et le GPIO
by paddyg
Thu Dec 05, 2019 12:24 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 728

Re: lancer un programme avec un interrupteur

Oui, beaucoup de façons plus simples de dépouiller le chat :D ... mais l'affiche originale a commencé sur le fil de discussion en python. (Cela dépend aussi de ce qu’on entend par "...programme qu'on a fait sur nano...".)
by paddyg
Thu Dec 05, 2019 9:05 am
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 728

Re: lancer un programme avec un interrupteur

arduino nano? What is the program doing (do you have a public repo where we can view it)? I would probably translate it into a python function and use gpiozero (on the basis that you originally posted on the python board) from gpiozero import Button from signal import pause def say_hello(): print("H...
by paddyg
Wed Dec 04, 2019 11:54 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 728

Re: lancer un programme avec un interrupteur

You can run Vcc at 3V3 according to the datasheet. aka Vous pouvez exécuter Vcc à 3V3 selon la fiche technique.
by paddyg
Wed Dec 04, 2019 10:48 pm
Forum: Français
Topic: lancer un programme avec un interrupteur
Replies: 17
Views: 728

Re: lancer un programme avec un interrupteur

DON'T connect your GPIO to 5V. Make the switch connect to ground and set the pin to use an internal pull up. Look at the gpiozero library for how to run processes when a switch is pressed. explicitly: Ne pas appliquer 5V à la GPIO . Faites votre commutateur court à la terre et avoir un pull-up inter...
by paddyg
Fri Nov 29, 2019 12:07 pm
Forum: Python
Topic: Difficulties with first python script (user input yes/no)
Replies: 19
Views: 877

Re: Difficulties with first python script (user input yes/no)

@CatDadJynx, if you are just starting down the road of programming with python then now is the time to stop using python2 and start using python3. In only a few weeks python2 reaches end of life. It won't drop off the end of a cliff and stop working but pretty much all major package developers (and ...
by paddyg
Fri Nov 29, 2019 8:23 am
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 1110

Re: Multitasking in Python

@Wangmaster, glad you got it sorted (though that does look quite complicated!) I notice that you are adding the interval for the next task time which will lead to a slight drift over millions of iterations. Adding (count * interval) to the start time won't.
by paddyg
Thu Nov 28, 2019 5:20 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 1110

Re: Multitasking in Python

Paul, As well as @thagrol's comment on using threads to run things in functions, which IMHO simplifies things a lot (unless you are doing one basic thing), the trouble with sleeping the way you show is that the time.sleep() function isn't terribly accurate. So, as the OP asked for minimal drift over...
by paddyg
Thu Nov 28, 2019 1:24 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 1110

Re: Multitasking in Python

Yes, you are absolutely right in a literal sense but the OP doesn't need the sub micro second accuracy for starting each function but they don't want the cumulative drift which is inevitable if you calculate the next call time by 'simply' adding a fixed amount onto 'now'. To fix the problem using Ti...
by paddyg
Thu Nov 28, 2019 12:31 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 1150

Re: OpenGLES and Raspberry PI 3

Val, I'm curious to know what caused those compile errors. Are you using stable as opposed to nightly, and latest version? What do you get with [email protected]:~/rust/rust_pi3d/pi3d $ rustup show Default host: armv7-unknown-linux-gnueabihf rustup home: /home/pi/.rustup stable-armv7-unknown-linux-gnue...
by paddyg
Thu Nov 28, 2019 12:11 pm
Forum: Graphics programming
Topic: Pi3D transparent background on Pi4
Replies: 88
Views: 10565

Re: Pi3D transparent background on Pi4

Yes (and no, it's X11 window related rather than OpenGL). With the compositor running (it's turned off by default in raspbian buster but you can start it with ``xcompmgr``, already on in ubuntu or gentoo64) you can adjust the opacity of the X11 window. See the discussion on the first page of this th...
by paddyg
Thu Nov 28, 2019 8:49 am
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 1110

Re: Multitasking in Python

You shouldn't get drift as the run time is set by the internal clock (which is verified against the internet if connected) The timer module probably does something very like my code snippet i.e. puts the timing in a different thread then, to avoid checking the time every execution cycle, sleeps for ...
by paddyg
Wed Nov 27, 2019 8:16 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 1150

Re: OpenGLES and Raspberry PI 3

Yes it is a bit odd. Just read your other thread and seen the eglSwapInterval(0) tip. The SDL2 route doesn't use EGL (unless SDL2 does something behind the scenes) but there is an SDL function (also exposed in the rust crate) to set SwapInterval. I tried it on one of the rust_pi3d demos and the fps ...
by paddyg
Wed Nov 27, 2019 6:25 pm
Forum: OpenGLES
Topic: OpenGLES and Raspberry PI 3
Replies: 8
Views: 1150

Re: OpenGLES and Raspberry PI 3

The fakeKMS driver will run GLES code and seems to run GL and GLES2 or GLES3 code at the same speed, and pretty much at the same speed as on the RPi3. See some comparisons I did here . Not sure what language you are interested in. Is that error from running the code on github.com/skillman/raspberryp...
by paddyg
Wed Nov 27, 2019 3:10 pm
Forum: Python
Topic: Multitasking in Python
Replies: 17
Views: 1110

Re: Multitasking in Python

Yes, but the timing of sleep is a bit approximate (see previous threads on this forum). That only matters if timing is important, if it is I sometimes sleep for a bit less than needed, a bit like this: import time import threading def job1(): print("job1 {}".format(time.time())) def timer(params=[1....

Go to advanced search