Push button (ON/OFF) script problems?
-
@supernature2k yes, this could be a good idea. Would it be useful to have a time.sleep in the while loop? So it checks the temp only every 2 seconds for example.
-
Yes I think so, at the end of the while.
1 or 0.5 seconds would be ok too I guess.
-
@lackyluuk said in Push button (ON/OFF) script problems?:
The only scripts I use are two selfmade scripts for changing the system volume via gpio and a fan control. But I do not think this has an impact.
How do you do this? The gpio volume control? Could you post this script?
Also, I have OP's problem with crashing after installing the gpio on/off button with usb controller unpluging, as well as sometimes random.
@supernature2k said in Push button (ON/OFF) script problems?:
Some switches are very sensitive (especially old ones) and it can trigger some events when slightly moved.
I have the same problem with my NES power switch.You can easily edit the script and change the function so that the button must be pressed x seconds to trigger the shutdown. it should solve this kind of problem.
D**n, THAT IS a useful comment
How do I change the time to be longer? I think my gpio momentary switch might be picking up some signal from my speakers, wifi, light system, something....
-
@dh04000 Here is a wiki article that I wrote. This should help you. I used the Hifiberry Shield to access the ALSA controls.
https://github.com/recalbox/recalbox-os/wiki/Audio-HiFiBerry-(EN)
-
Hello, I'm completley new to this stuff so just to make shure I don't damage my Raspberry can someone confirm that following these steps will make the fan-control script work?
- On my Linux Desktop I create an empty textfile in which I paste the fan-script posted here.
- I rename the file into fancontrol.py and move it into /recalbox/share/system/ on the sd-card.
- On Recalbox i quit emulationstation, open the terminal and navigate to the share/system directory and make my script executable with chmod +x fancontrol.py so it is ran at boot
And last question (for now:) - where in the script should i paste the time.sleep(1) so it only checks every second for the temp?
Thanks in advance! -
Where the hell do I paste the fan script ????
-
calm down @miserytom
I suggest you to put it into
/recalbox/scripts
and then in/etc/init.d
(where all startup scripts are located) you could place another script which is starting your fan script in a background process -
I'm having a similar problem, I noticed two situations that happened with version 4.0 final the first was that in recalbox.conf the
system.power.switch=PIN56ONOFF
command duplicated several times, and the second that if I do screenscrapper of a very large romset example GBA simply out of nothing Rpi is turned off.There is a third option, the wifi in the recalbox shows that it is not connected, however I get access with your ip (this for me is very strange)
-
@azvarel i would say the things that you mention aren't related to this topic. Please, create your own threads if you consider appropriate and there aren't already existing ones.
Pd. The duplicates are a known bug
-
Sorry for my ignorance, but I did not mention that this was after I put the power button on the gpio if it is not related to this topic, I really will do.
-
It isn't.
-
Lo tengo montado en mi bartop, me pasa algo parecido cuando enciendo/apago la luz de la marquesina o enciendo/apago los altavoces, se me apaga el sistema, e probado de todo, incluso desconectando todo los gpio de control, y solo dejando los cables 5 6 conectados sin interruptor ni pulsador sigue pasando igual, solo soluciono el problema desactivando la opción del interruptor. No es problema de corto ni nada de eso ya que aunque los conecte a diferentes enchufes la luz y los altavoces sigue pasando, también e probado diferentes cables gpio, diferentes rasp, y demás y nada sigue pasando. Tal vez sea un problema del script si alguien le pasa, o puede revisar o algo, aria un gran favor.
-
Añadir que como dicen arriba, cuando activas la opción de on/off pin 5 6 , duplica el código como 5 o 6 veces, desconozco si pasaba antes de la 4.0 final, ya que la primera vez que lo e activado a sido en 4.0 final.
-
@Fran-Rdg-Gnd since this is an english thread, please use english
-
paradadf will translate it when I connect, Has more correct English
-
A fast translation from what @Fran-Rdg-Gnd wrote:
He uses the script on his bartop. Something similar happens to him when he turns of/off the lights on the marquee or the speakers. His recalbox gets shut down, even disconnecting every other cable attached to the gpio and leaving the bare two cables on pins 5/6 without switch. The only way to "solve" the problem is by deactivating the script. He also says that it isn't a short circuit problem because this even happens when the lights/speakers are plug into a separate adaptor power adaptor. He has tested it on different cables, different RPis and every time he gets the same behaviour.
-
@paradadf I had the problem too just connecting a controller or the ethernet cable even with an off switch so I'm not using it nor the script anymore...
I understand why this coul happen wuth a momentary script but I don't get why this is a case with on off switch, isn't it possible to detect in that case if the switch is circuit closed or not before shutting down ?
-
@voljega there is definitely something weird happening with the scripts. I'm not saying the script itself is wrong, but the coexistence with with something else must be faulty. It happens even without anything pluged in, just by activating it. It is like any movement, interference or signal in general is being captured by the gpio.
One possible solution could be what @supernature2k said at the beginning... Implement some kind of delay (or whatever it is called), so you can adjust the miliseconds for the script to be triggered. Currently, there is no option for that.
-
@paradadf : Thanks for your help, as I experience some weird things myself (lol, meaning the recalbox).
Could you give an example how to implement such a delay, i.e. having to press the momentary button for let's say 1/2 second to turn the recalbox on/off?
Greetings from Germany
René
-
@hanker I can't, no idea about python. 1/2 a second would be too much imo.