mirror of
https://github.com/pkali/piradio-mini.git
synced 2026-05-20 22:34:22 +02:00
Added 5s. wait for network on start (for slow PI and WiFi)
This commit is contained in:
@@ -125,16 +125,25 @@ class MyDaemon(Daemon):
|
|||||||
lcd.line1("Radio version " + radio.getVersion())
|
lcd.line1("Radio version " + radio.getVersion())
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
ipaddr = exec_cmd('hostname -I')
|
|
||||||
hostname = exec_cmd('hostname -s')
|
|
||||||
log.message("IP " + ipaddr, log.INFO)
|
|
||||||
|
|
||||||
# Display daemon pid on the LCD
|
# Display daemon pid on the LCD
|
||||||
message = "Radio pid " + str(os.getpid())
|
message = "Radio pid " + str(os.getpid())
|
||||||
lcd.line2(message)
|
lcd.line2(message)
|
||||||
|
|
||||||
lcd.line3("Starting MPD")
|
lcd.line3("Waiting for network")
|
||||||
|
IPwait = 5 # Wait max 5s. for network
|
||||||
|
while IPwait > 0:
|
||||||
|
IPwait = IPwait - 1
|
||||||
|
ipaddr = exec_cmd('hostname -I')
|
||||||
|
if ipaddr is "":
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
IPwait = 0
|
||||||
|
|
||||||
lcd.line4("IP " + ipaddr)
|
lcd.line4("IP " + ipaddr)
|
||||||
|
hostname = exec_cmd('hostname -s')
|
||||||
|
log.message("IP " + ipaddr, log.INFO)
|
||||||
|
|
||||||
|
lcd.line3("Starting MPD")
|
||||||
radio.start()
|
radio.start()
|
||||||
log.message("MPD started", log.INFO)
|
log.message("MPD started", log.INFO)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|||||||
Reference in New Issue
Block a user