Posts by kw12157

    I ran a couple of Pi 3 B+ for a couple of years with no issues.

    I upgraded these to the latest LibreELEC version a few months ago and started getting mp3 and mp4 playback pausing. What happens is the mp3 or mp4 file starts playing. Then it pauses for a second or two then resumes playing. It happens every 15 to 60 seconds or so.

    I noticed that my living room Pi was on 2 GHz WiFi. I looked at changing to 5 GHz and found that it did not see my 5 GHz SSID.

    I installed the latest version of LibreELEC on a Pi 4 4GB a couple of days ago. I was able to connect it to my 5 GHz WiFi during install. I still had the pausing issue with both mp3 and mp4 playback.

    I found this article on modifying the cache.

    HOW-TO:Modify the video cache - Official Kodi Wiki

    Here is my advancedsettings.xml file that I created.

    <advancedsettings>

    <cache>

    <buffermode>1</buffermode>

    <memorysize>204857600</memorysize

    <readfactor>100</readfactor>

    </cache>

    </advancedsettings>

    These settings resolved the mp4 playback issue. But mp3 playback still pauses. I have read that the cache settings should work for both video and audio.

    How do I fix the mp3 playback pausing?

    Thanks in advance,

    Kevin

    Now that that is working, on to the next piece of the puzzle. Juice4halt supplied a script to be used to reboot the pi instead of using the reboot command to keep the juice4halt hat and pi in synch.

    Options:

    1. Backup the reboot file in /sbin and rename the reboot4h script to reboot and copy it to the /sbin directory. The trouble I am having with this option is that I haven't been able to write to that directory.

    2. Change the reboot button to point to the reboot4h script instead of the reboot command. Is this possible?

    Any other suggestions would be welcome!

    Thanks in advance!

    I am trying to get a juice4halt hat working with my Pi 3+ running LibreELEC. A script makes the hat work. It is suppose to safely shutdown the OS after power is lost, then power off the Pi. It works correctly with the original script running under Raspbian. I modified the script to move the directory structure to storage which is writable under LibreELEC. The modified script works as if it does not see the juice4halt hat and shuts down the OS at the completion of booting, which is what is suppose to happen when the juice4halt hat is not detected.

    Below are the original script and the modified script

    ORIGINAL

    Original

    #!/bin/bash

    #title :shutdown_script

    #description :This script runs on Raspberry Pi equipped with the Juice4Halt module.

    #author :Nelectra s.r.o.

    #date :20190415

    #version :1.2 (bug fixed: collision with the rebootj4h script solved by reading the GPIO25 pin 2x)

    #usage :copy this file to /home/pi/juice4halt/bin/

    # and make it executable: sudo chmod 755 shutdown_script

    #notes :Juice4halt – Supercapacitor UPS for RPi

    #copyright :GNU GPL v3.0

    #==============================================================================

    #create directory for working with GPIO and wait

    echo "25" > /sys/class/gpio/export

    sleep 0.2s

    # use the pin as an open-drain output, send a short LOW pulse (= Booting finished, shutdown_script runs, automatic shutdown enabled)

    # then change to input and listen

    # if a LOW is sent from the J4H then start with the shutdown

    # set GPIO25 as output and set output to LOW

    echo "out" > /sys/class/gpio/gpio25/direction

    echo "0" > /sys/class/gpio/gpio25/value

    sleep 0.1s

    echo "in" > /sys/class/gpio/gpio25/direction

    #wait until pin rises to HI

    sleep 0.1s

    pinval1="1" # 1st reading

    pinval2="1" # 2nd reading

    #to be resistant to short pulses (e.g. 100ms pulse generated by the rebootj4h script) two readings 200ms apart from each other are required

    while [ "$pinval1" != "0" -o "$pinval2" != "0" ]

    do

    #reading the value of the input pin

    pinval1=$(cat /sys/class/gpio/gpio25/value)

    #wait

    sleep 0.2s

    #reading the value of the input pin again 0.2s later

    pinval2=$(cat /sys/class/gpio/gpio25/value)

    done

    # set GPIO25 as output and set output to LOW

    echo "out" > /sys/class/gpio/gpio25/direction

    echo "0" > /sys/class/gpio/gpio25/value

    # wait for system halt

    # after system halted the pin will be automatically switched to input and the level will be pulled up to HI

    # a LOW to HI transition signals to the J4H to turn the power off

    echo ""

    echo "Juice4halt: Power failure, RPi will now shut down."

    sudo halt

    --------------------------------------------

    MODIFIED

    Modified

    #!/bin/bash

    #title :shutdown_script

    #description :This script runs on Raspberry Pi equipped with the Juice4Halt module.

    #author :Nelectra s.r.o.

    #date :20190415

    #version :1.2 (bug fixed: collision with the rebootj4h script solved by reading the GPIO25 pin 2x)

    #usage :copy this file to /home/pi/juice4halt/bin/

    # and make it executable: sudo chmod 755 shutdown_script

    #notes :Juice4halt – Supercapacitor UPS for RPi

    #copyright :GNU GPL v3.0

    #==============================================================================

    #create directory for working with GPIO and wait

    echo "25" > /sys/class/gpio/export

    sleep 0.2s

    # use the pin as an open-drain output, send a short LOW pulse (= Booting finished, shutdown_script runs, automatic shutdown enabled)

    # then change to input and listen

    # if a LOW is sent from the J4H then start with the shutdown

    # set GPIO25 as output and set output to LOW

    # echo "out" > /sys/class/gpio/gpio25/direction

    echo "out" > /storage/home/pi/juice4halt/gpio/gpio25/direction

    # echo "0" > /sys/class/gpio/gpio25/value

    echo "0" > /storage/home/pi/juice4halt/gpio/gpio25/value

    sleep 0.1s

    # echo "in" > /sys/class/gpio/gpio25/direction

    echo "in" > /storage/home/pi/juice4halt/gpio/gpio25/direction

    #wait until pin rises to HI

    sleep 0.1s

    pinval1="1" # 1st reading

    pinval2="1" # 2nd reading

    #to be resistant to short pulses (e.g. 100ms pulse generated by the rebootj4h script) two readings 200ms apart from each other are required

    while [ "$pinval1" != "0" -o "$pinval2" != "0" ]

    do

    #reading the value of the input pin

    pinval1=$(cat /storage/home/pi/juice4halt/gpio/gpio25/value)

    #wait

    sleep 0.2s

    #reading the value of the input pin again 0.2s later

    pinval2=$(cat /storage/home/pi/juice4halt/gpio/gpio25/value)

    done

    # set GPIO25 as output and set output to LOW

    # echo "out" > /sys/class/gpio/gpio25/direction

    echo "out" > /storage/home/pi/juice4halt/gpio/gpio25/direction

    # echo "0" > /sys/class/gpio/gpio25/value

    echo "0" > /storage/home/pi/juice4halt/gpio/gpio25/value

    # wait for system halt

    # after system halted the pin will be automatically switched to input and the level will be pulled up to HI

    # a LOW to HI transition signals to the J4H to turn the power off

    echo ""

    echo "Juice4halt: Power failure, RPi will now shut down."

    halt


    Modified

    ----------------------

    I can # out the last line and let LibreELEC boot and start Kodi. Then SSH into the device and see that the script is running. It is creating the files (value and direction) in the correct location.

    I am a novice, but it acts to me like it is not sensing the voltage on gpio25.

    Can someone give me some help on getting this to work?

    Thanks in advance!