Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: lcdup.py does not work upon source selection
#1
Hi,
I have a problem with lcdup.py script on moOde 6.7.1 + RPI4 + audiophonics I-SABRE 9038Q2M

I intend to use lcdup.py to drive two leds on GPIO 23 and 24 indicating the selected input source, S/PDIF or IIS.
When input source is changed from WebUI, it only works when I change the source from S/PDIF to IIS. 
Changing source from IIS to S/PDIF does not work. It seems that lcdup.py is not launched in this case.

As a work around I launch another script from /etc/rc.local at boot time where the input source is checked every 4 seconds.
This aproach works well but it oblies to run the script forever (putting the intructions in a while infinite loop):

Code:
import sys
import RPi.GPIO as GPIO
import time
import os
import subprocess

# Use SoC pin numbering
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)

GPIO.output(25,GPIO.LOW)

option= "-q"
sqlSelect="select value from cfg_system where id='93'"

while True:
 SPDIF=subprocess.check_output(['/usr/local/bin/moodeutl',option,sqlSelect])
 #print (SPDIF)

 if SPDIF==b'Local\n':
  #print ("IIS")
  GPIO.output(23,GPIO.LOW)   # SPDIF Red Led OFF
  GPIO.output(24,GPIO.HIGH)  # IIS Green Led ON
 else:
  #print ("S/PDIF")
  GPIO.output(23,GPIO.HIGH)  # S/PDIF. Red Led ON
  GPIO.output(24,GPIO.LOW)   # IIS Green Led OFF
 time.sleep(4)

The script (without the while loop) has been tested stand alone and it works well too, of course

in theory lcdup.py wakes up upon WebUI changes but this is not the case when it shows the S/PDIF screen
It would be nice this issue to be solved in future releases.

Best regards
Juan
Reply
#2
The code that runs the lcdup.py script is at the link below.
https://github.com/moode-player/moode/bl...d/lcdup.sh

It looks for changes in the file /var/local/www/currentsong.txt. This file is populated with information mainly from the Playback screen and it is enabled via System Config setting "Metadata file ON/OFF"
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(01-30-2021, 10:10 PM)Tim Curtis Wrote: The code that runs the lcdup.py script is at the link below.
https://github.com/moode-player/moode/bl...d/lcdup.sh

It looks for changes in the file /var/local/www/currentsong.txt. This file is populated with information mainly from the Playback screen and it is enabled via System Config setting "Metadata file ON/OFF"

Hi Tim,
OK, understood. I thougth that lcdup was launched upon every change in the WebUI, but I was wrong. The "Metadata file" is set to ON in my case, so it is normal that lcdup.py starts to run when the change is from S/PDIF to IIS only.
I will use my work around then.

Thank you for the quick reply.
Best regards
Juan
Reply


Forum Jump: