Home of the Squeezebox™ & Transporter® network music players.
Page 23 of 26 FirstFirst ... 132122232425 ... LastLast
Results 221 to 230 of 254
  1. #221
    @LiFePO4

    with the deskpi Pro I routed a channel then slotted the 128x32 into it, had I been careful that should have been all I needed but ended up using some damping material to hold it secure and reduce the light bleed too

    easiest thing I've found for screw mounts is to solder the unit to perf-board large enough such that it can contain any circuitry but also with enough meat to drill fixing holes etc

    you can also get fancy with 3D printing and/or CNC
    As of 26-Feb-2021 my digitized collection is (25608 hours 20 minutes) + (15 seconds) or
    2.921 years in duration
    random continuous play would really annoy the neighbors...

    Digitized thus far:

    Total Tracks: 165,586
    Total Albums: 15,155
    Total Artists: 21,734
    Total Genres: 765
    Total Playing Time: 25608:20:15


    With another ~2400 yet to be ripped... a moving target such that it is ...

  2. #222
    Lot of confusion :-)

    I offered the code, when there is any interest. You are interested, so here is the code with the lmsmonitor handling:

    Code:
    #!/bin/sh
    # --------------------------------------------------------------------------------------------------------------------------
    # Script polls "pcp mode" every 500 ms (1 second on Pi Zero) and sets a GPIO/lmsmonitor according to squeezelite play state.
    # Aki 9/2020 - Home: https://forums.slimdevices.com/showthread.php?110277-Feature-request-picoreplayer-Play-state-to-GPIO 
    # --------------------------------------------------------------------------------------------------------------------------
    # Vers 0.2: Cleanup of GPIO on exit. Reentrance cleared. -k kills running instance. Clear reaction on 'pcp mode' outages.
    # Vers 0.3: When no GPIO is given, green onboard LED led0 will be used.
    # Vers 0.4: Cosmetics.
    # Vers 0.5: 1/2021 LMSmonitor integration. Tested on pi 3b w. lmsmonitor (0.4.65 Dec 27 2020 19:33:28)
    
    BASE_GPIO_PATH=/sys/class/gpio
    BASE_LED0_PATH=/sys/class/leds/led0
    ScriptName=$(basename -- "$0")
    
    function UpTm () { # Returns UpTime sss.ms
      set `cat -- /proc/uptime`
      echo "$1"
    } # function UpTm
    
    function mySudo () { # Aufruf aus functions oder wg. background?
      echo $@ | sudo sh
    } # function mySudo
    
    function msg () {
      if [ $foreground ] || [ $verbose ]; then
        echo "$(UpTm) $ScriptName: $@"; #echo "$(date +"%T") $ScriptName: $@";
      fi # foreground
    } # function msg
    
    function err () {
      echo "$(UpTm) $ScriptName: Error: $1" >&2; exit 1 
    } # function err, not called from loop -therefore no need to cleanup?
    
    function KillMonitor () {
      while pid=$(pidof lmsmonitor); do     
        msg "LMSmonitor stopping pid $pid"  
        sudo killall -15 lmsmonitor #" #> /dev/null 2>&1"    
        sleep 1       
        msg "LMSmonitor stopped pid $pid"     
      done # Wait for end of kill
      oldMonitorState=0  
    } # function KillMonitor
    
    function StartMonitor () { 
      if pid=$(pidof lmsmonitor); then    
        KillMonitor      
      fi
      msg "LMSmonitor starting"             
      sudo /mnt/mmcblk0p2/tce/lmsmonitor -n $PNAME -z -s -c -f7 & # -c -f7
      #> /dev/null 2>&1 & # -z
      sleep 3
      msg "LMSmonitor started, pid $(pidof lmsmonitor)"
    } # function StartMonitor
    
    function cleanup () { 
      if [ $PlayGPIO = "0" ]; then # green onboard led0
        mySudo "echo mmc0 >$BASE_LED0_PATH/trigger" 
      else 
        if [ -e $BASE_GPIO_PATH/gpio$PlayGPIO ]; then # GPIO initialized    
          mySudo "echo $((!$PlayVal)) > $BASE_GPIO_PATH/gpio$PlayGPIO/value" # Set to off state
          mySudo "echo $PlayGPIO > $BASE_GPIO_PATH/unexport"
        fi # GPIO de-initialized
      fi # led0 or GPIO
      if $monitor; then    
        #StartMonitor 
        KillMonitor # Will not do a complete clean screen on reboot, but reboot is no normal operation
      fi 
      
      exit 0 
    } # on Exit
    
    function Usage () {
      echo ""
      echo "PlayMode to GPIO ($ScriptName) sets a GPIO when squeezelite is playing."
      echo "--------------------------------------------------------------------"
      echo "Usage: $0 [-g GPIO] [-s n] [-f] [-v] [-b] [-k] [-h]"
      echo ""
      echo "-g : GPIO-number play mode, if not given, green onboard (led0) will be used"
      echo "-s : GPIO-value for play mode [0,1], if not given [1] will be used"
      echo "-f : run in foreground with verbose output"
      echo "-v : verbose output from background"
      echo "-b : blink mode, GPIO is blinking when playing, on on pause"    
      echo "-m : lmsmonitor, handles lmsmonitor"
      echo "-k : Kill running $ScriptName" 
      echo "-h : Shows this help"
      echo ""
      echo "Examples:"
      echo "---------"
      echo "  $0             : Green onboard LED (led0) on when playing"
      echo "  $0 -b          : Green onboard LED (led0) blinking when playing, on when paused"
      echo "  $0 -g27        : Sets GPIO27 to 3V when playing"  
      echo "  $0 -g27 -b     : Sets GPIO27 to 3V, blinking when playing, on when pause"
      echo "  $0 -g4  -s0 -f : Sets GPIO4  to 0V when playing, running in foreground with output (debug)"
      echo "  $0 -g4  -s1 -v : Sets GPIO4  to 3V when playing, running in background with output (debug)"
      echo "  $0 -k          : Kills running $ScriptName"  
      echo ""
    exit 1
    } # function Usage
    
    function Loop () { 
      trap cleanup INT TERM # cleanup GPIO and Monitor on exit
      while true; do  
        MODE=`pcp mode 2> /dev/null`    
        if [ ! "$MODE" = "$OldMode" ]; then # MODE change
          if [ ! "$MODE" ]; then MODE="not available"; fi # no result, wget error
          msg "pcp mode is \"$MODE\"."
          if [ "$MODE" = "play" ] || [ "$MODE" = "pause" ] || [ "$MODE" = "stop" ] || [ "$MODE" = "not available" ]; then # valid or empty MODE
    
            # GPIO
            if [ "$MODE" = "play" ]; then 
              GPIOval=$PlayVal; # on
            elif $blink && [ "$MODE" = "pause" ]; then 
              GPIOval=$PlayVal # on
            else
              GPIOval=$((!$PlayVal)) # off
            fi # Set static GPIOval
    
            # LMSmonitor
            if $monitor; then
              if [ "$MODE" = "play" ] || [ "$MODE" = "pause" ]; then #
                MonitorState=1
                msg "MonitorState=1"
              else  
                MonitorState=0
                msg "MonitorState=0"
              fi
            fi
          else # unknown MODE
            msg "\"pcp mode\" results to unknown mode \"$MODE\", should be play, pause, stop"                 
          fi # valid/invalid MODE
          
          OldMode=$MODE
        fi # MODE change       
        
        # blink on play when -b
        if $blink && [ "$MODE" = "play" ]; then GPIOval="$((!$GPIOval))"; fi # invert, blinking                       
                
        if [ ! "$GPIOval" = "$oldGPIOval" ]; then # GPIO val change
          if ! $blink; then msg "Set GPIO$PlayGPIO to $GPIOval."; fi # Debug output only when no GPIO change for blinking
          if [ $PlayGPIO = "0" ]; then # led0
            mySudo "echo $GPIOval > $BASE_LED0_PATH/brightness"
          else # GPIO
            mySudo "echo $GPIOval > $BASE_GPIO_PATH/gpio$PlayGPIO/value"
          fi
          oldGPIOval=$GPIOval
        fi # GPIO val change 
        
        if [ ! "$MonitorState" = "$oldMonitorState" ]; then # Change Monitorstate, don't ask!
           if [ "$MonitorState" = "1" ]; then # needs some help :-)
             StartMonitor 
             if [ "$oldMonitorState" = "0" ]; then 
               StartMonitor
               StartMonitor
             fi # Kommt aus vorher gestopptem off-Status, braucht dann Nachhilfe
           else
             StartMonitor
             KillMonitor
           fi # dont ask :-)    
           oldMonitorState=$MonitorState
        fi # Change Monitorstate
        sleep 0.5 # Loop interval
      done # while true
    } # function Loop
    
    ############
    ### Main ###
    ############
    
    # Parameter
    # ---------
    # Defaults
    PlayGPIO=0 # Default: Green onboard led0
    PlayVal=1 # default active high
    foreground=false # no more need to foreground
    verbose=false # no output from loop when daemonized
    blink=false # stay active
    monitor=false # LMSmonitor nicht starten
    oldGPIOval=0
    oldMonitorState=-1 # LMSmonitor: 0=off 1=running -1=unknown/after start
    
    while getopts g:s:fvbmkh opt 
    do 
      case $opt in
        g ) # Check for valid Play GPIO
            if [ "$OPTARG" -ge 2 ] && [ "$OPTARG" -le 27 ] 
              then PlayGPIO=$OPTARG
              else err "Play GPIO \"$OPTARG\" is not a valid GPIO, please use 2 .. 27"; fi # Check for valid GPIO
          ;;
        s ) # Check parameter for setting GPIO to 0 or 1 when playing
            if [ $OPTARG ]; then # Set GPIO to 0 or 1 when playing
              if [ "$OPTARG" -eq 0 ] || [ "$OPTARG" -eq 1 ] 
                then PlayVal=$OPTARG 
                else err "Play-value \"$OPTARG\" is not a valid GPIO state, please use 0 or 1"; fi
            fi # Check parameter for setting GPIO to 0 or 1 when playing
          ;;
        f ) foreground=true;;
        v ) verbose=true;;
        b ) blink=true;;
        m ) monitor=true;;
        k ) msg "Killing running instance."; sudo killall -15 $ScriptName;;        
        h ) Usage;;
        [?]) Usage;;
      esac
    done
    
    # Kill old instance, if exists
    for pid in $(pidof $ScriptName); do    
      if [ ! $pid = $$ ]; then
        msg "Killing old instance (pid $pid) of $ScriptName"
        mySudo "kill -15 $pid"
        sleep 0.3 # Give the exit routine some time. on pi 3b+ 0.1s is enough
      fi # old instance found     
    done # Kill old instance
    
    # Init
    # ----
    # Wait for squeezelite to come online
    wt=0
    until pids=$(pidof squeezelite squeezelite-dsd); do
      sleep 1; wt=$(($wt+1))
      msg "Waited $wt seconds for for squeezelite ..." 
      if [ "$wt" -ge 60 ]; then err "Waited too long for squeezelite"; fi
    done
    
    # Init GPIO
    if [ $PlayGPIO = "0" ]; then # led0
      msg "Disable mmc0 trigger on led0"
      mySudo "echo none >$BASE_LED0_PATH/trigger"
    else # GPIO
      if [ ! -e $BASE_GPIO_PATH/gpio$PlayGPIO ]; then # Init GPIO
        msg "Export GPIO$PlayGPIO to userspace"
        mySudo "echo $PlayGPIO > $BASE_GPIO_PATH/export"
      fi # Init GPIO
      msg "Set GPIO$PlayGPIO as an output"
      mySudo "echo out > $BASE_GPIO_PATH/gpio$PlayGPIO/direction"
    fi # led0 or GPIO
    
    # This player Name (for LMSmonitor) 
    if $monitor; then
        PNAME=`cat /usr/local/sbin/config.cfg | grep "^NAME=" | cut -d'"' -f2` 
    fi
    
    # Call Loop
    # ----------
    if $foreground; then # foreground:
      msg "Foreground loop polling, with output. Stop with \"ctrl-c\"."
      Loop
    else # daemonize
      if $verbose; then # Background loop polling with output
        msg "Background loop polling with output. Stop with \"$0 -k\" or restart of script." 
        Loop &
      else # Background loop polling 
        msg "Background loop polling. Stop with \"sudo $0 -k\" or restart of script." 
        Loop > /dev/null 2>&1 &
      fi # Background loop polling
    fi # Start fore- or background loop polling
    exit
    # End of Program
    The lmsmontor part is a little crazy, slow and fragil, but found no other way. Beta but working. Don't do power on - off too fast :-)
    Last edited by Aki7; 2021-01-15 at 16:24.

  3. #223
    Junior Member
    Join Date
    Jan 2021
    Posts
    18
    Quote Originally Posted by shunte88 View Post
    @LiFePO4

    with the deskpi Pro I routed a channel then slotted the 128x32 into it, had I been careful that should have been all I needed but ended up using some damping material to hold it secure and reduce the light bleed too

    easiest thing I've found for screw mounts is to solder the unit to perf-board large enough such that it can contain any circuitry but also with enough meat to drill fixing holes etc

    you can also get fancy with 3D printing and/or CNC
    Nothing fancy for my use case. I was always planning on a headless setup, but noticed the Pirate Audio thread and thought that was pretty cool. But it's a bit heavy and I just want something a bit more simple. Sort of like running a Linux GUI desktop versus a minimalist Linux build. I rather just focus on a iPeng solution if I want that much functionality. Of course preference for OLED. So this is just icing, not really planned.

    Thanks for the suggestion, but this will be 100% custom build. I'm running power sensitive desktop RPi HATs and don't want wires sticking out and short circuiting so only certain non-standard cases work for my situation. Since these are desktop HATs not meant for portable, I have to abstract as much as possible. I'm also running a custom LiFePO4 battery since they provide the best audio performance, not a regular battery.
    Last edited by LiFePO4; 2021-02-24 at 17:28.

  4. #224
    Member seekasoul's Avatar
    Join Date
    Jan 2020
    Location
    Italy
    Posts
    31

    Time on display get stuck

    Why the time get stuck so easily on the display?

  5. #225
    how long is a piece of string?

    not sure what you mean by stuck
    is the monitor freezing?
    are you referring to the colon flash not being bang on the second?

    a bit more detail...
    As of 26-Feb-2021 my digitized collection is (25608 hours 20 minutes) + (15 seconds) or
    2.921 years in duration
    random continuous play would really annoy the neighbors...

    Digitized thus far:

    Total Tracks: 165,586
    Total Albums: 15,155
    Total Artists: 21,734
    Total Genres: 765
    Total Playing Time: 25608:20:15


    With another ~2400 yet to be ripped... a moving target such that it is ...

  6. #226
    Member seekasoul's Avatar
    Join Date
    Jan 2020
    Location
    Italy
    Posts
    31

    Re:

    Quote Originally Posted by shunte88 View Post
    how long is a piece of string?

    not sure what you mean by stuck
    is the monitor freezing?
    are you referring to the colon flash not being bang on the second?

    a bit more detail...
    The monitor freezes with the time/clock stuck at random hour:min displayed, with ":" not blinking. Then only a reboot will resync it with actual time.
    NTP is synced every 10 mins with the cron script but still it freezes.
    Last edited by seekasoul; 2021-01-29 at 00:19.

  7. #227
    sounds like its hitting a resource issue - memory allocation or something else that's causing an abend
    on exit it should be clearing the screen so maybe it is literally getting stuck
    I've seen that type of behavior with the JSON scrape of weather and LMS status/details
    hits an invalid linked list or has a realloc error
    i added additional safety code for the realloc and those changes are in the current available build
    the linked list issue I've seen 2-3 times only - i'll beef up the code around the JSON scrape to see if that helps

    10 minute NTP is a bit of an overkill, if your pi is drifting that rapidly there's something very much amiss - once a week should be more than sufficient

    i can add checks to the astral routines to review and correct for drift if that would help
    As of 26-Feb-2021 my digitized collection is (25608 hours 20 minutes) + (15 seconds) or
    2.921 years in duration
    random continuous play would really annoy the neighbors...

    Digitized thus far:

    Total Tracks: 165,586
    Total Albums: 15,155
    Total Artists: 21,734
    Total Genres: 765
    Total Playing Time: 25608:20:15


    With another ~2400 yet to be ripped... a moving target such that it is ...

  8. #228
    Member seekasoul's Avatar
    Join Date
    Jan 2020
    Location
    Italy
    Posts
    31

    Re:

    Quote Originally Posted by shunte88 View Post
    i added additional safety code for the realloc and those changes are in the current available build
    Just installed latest build, but after playing about 10 mins with airplay the clock display is already frozen!
    No blinking ":" beetween hour and min...
    A reboot gets back the display showing the right time but then issue returns.
    It's very annoying. Please review code or suggest me what else to check.
    The:

    tc@piCorePlayer:~$ date

    gives me correct time but LMS Monitor 2000 display clock is locked at an old min time.
    Last edited by seekasoul; 2021-01-28 at 14:19.

  9. #229
    i have two devices running 24/7 with no ugliness, one runs with weather and the other is pretty much default setting; there's another 3 setups but they're in other parts of the house and not monitored - no observable issues there though

    a freeze after 10 minutes I've never seen

    have you run with -V - what does the monitor "think" its doing?

    I must admit i don't use airplay and I've definitely not put the monitor through any stress testing with that setup

    I'll beat on one of the the setups with airplay to see if that takes us down any rabbit holes

    note that its not that the system time is in error - the display has frozen - don't confuse system date/time with that shown by an application
    some apps fake the time; I remember scoring 10000's of points in a single game in Windows solitaire one time as I was compiling code on the crusty laptop I had 25+ years ago - the timer was application driven and slowing the Windows 3.1 system slowed the timer - yes I am indeed an old fart

    if you don't specify -c no clock will be displayed, just track details and/or visualization, audio or easter eggs

    i'll get back to you as soon as I have some debug collected and hopefully a solution

    going to be a long evening running valgrind, a memory sniffer, on pCP is a chore and a half
    As of 26-Feb-2021 my digitized collection is (25608 hours 20 minutes) + (15 seconds) or
    2.921 years in duration
    random continuous play would really annoy the neighbors...

    Digitized thus far:

    Total Tracks: 165,586
    Total Albums: 15,155
    Total Artists: 21,734
    Total Genres: 765
    Total Playing Time: 25608:20:15


    With another ~2400 yet to be ripped... a moving target such that it is ...

  10. #230
    Member seekasoul's Avatar
    Join Date
    Jan 2020
    Location
    Italy
    Posts
    31

    Re:

    Quote Originally Posted by shunte88 View Post
    have you run with -V - what does the monitor "think" its doing?
    What do you mean?
    Putting: -V in Squeezelite Settings -> Various Options?
    I have it.

    This morning the display has freezed just playing first track of the day via LMS Material interface (so, no matter Airplay...).
    Sure, there must be something wrong in my setup but... how to find it out?

    Some infos on my setup:
    - Rpi 4 with 1 GB of RAM
    - DacBerry One+ DAC HAT
    - piCorePlayer v7.0.0 (32-bit)

    SqueezeLite Process is:
    /usr/local/bin/squeezelite -n piCorePlayer -o hw:CARD=sndrpihifiberry -a 80 4 1 -b 20000 60000 -c pcm,flac,mp3 -p 45 -m dc a6 32 00 5f 86 -s 192.168.22.100 -C 2 -i /home/tc/.lircrc -V -W -i /home/tc/.lircrc

    Under Tweaks
    User command #1 is:
    sudo /mnt/mmcblk0p2/tce/lmsmonitor --name "piCorePlayer" -c -rixv --meter "rn" -x 0x3d -c -f 7 -z -w0 -db
    Last edited by seekasoul; 2021-01-29 at 00:21.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •