Skip to content

Commit

Permalink
Fixed a bug that stopped the display exiting "Off" mode when it was a…
Browse files Browse the repository at this point in the history
…ctually paused. Changed the handling of the messages on reboot/shut down.
  • Loading branch information
thomaswwp committed Nov 18, 2013
1 parent eff7913 commit a3ab414
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 11 deletions.
138 changes: 138 additions & 0 deletions RPizeBox.log
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,141 @@
11/17/2013 08:57:12 PM Success: Logged in to LMS.
11/17/2013 08:57:12 PM Success: In contact with SqueezeLite.
11/17/2013 08:57:12 PM Track changed, now: BBC Radio 4
11/17/2013 09:03:00 PM Success: Logged in to LMS.
11/17/2013 09:03:00 PM Success: In contact with SqueezeLite.
11/17/2013 09:03:00 PM Track changed, now: BBC Radio 4
11/18/2013 07:36:44 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:36:49 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:37:38 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:37:43 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:37:48 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:37:53 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:37:59 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:38:04 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:38:09 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:38:14 AM LMS not there. Trying again in 5 seconds.
11/18/2013 07:38:23 AM Success: Logged in to LMS.
11/18/2013 07:38:23 AM Success: In contact with SqueezeLite.
11/18/2013 07:38:23 AM Track changed, now: BBC Radio 4
11/18/2013 04:06:51 PM Play
11/18/2013 04:06:57 PM Power OFF
11/18/2013 04:07:03 PM Power ON
11/18/2013 04:07:06 PM Power ON
11/18/2013 04:07:07 PM Power ON
11/18/2013 04:07:09 PM Power ON
11/18/2013 04:07:11 PM Play
11/18/2013 04:07:20 PM Play
11/18/2013 04:08:23 PM Track changed, now: Royals
11/18/2013 04:11:36 PM Track changed, now: You're Nobody 'Til Somebody Loves You
11/18/2013 04:12:29 PM Vol-
11/18/2013 04:12:29 PM Volume is: 46
11/18/2013 04:12:31 PM Vol-
11/18/2013 04:12:31 PM Volume is: 41
11/18/2013 04:12:32 PM Vol-
11/18/2013 04:12:32 PM Volume is: 36
11/18/2013 04:12:34 PM Vol-
11/18/2013 04:12:34 PM Volume is: 31
11/18/2013 04:12:35 PM Vol-
11/18/2013 04:12:35 PM Volume is: 26
11/18/2013 04:12:37 PM Vol-
11/18/2013 04:12:37 PM Volume is: 21
11/18/2013 04:12:38 PM Vol-
11/18/2013 04:12:38 PM Volume is: 16
11/18/2013 04:12:52 PM Vol+
11/18/2013 04:12:52 PM Volume is: 21
11/18/2013 04:13:12 PM Vol+
11/18/2013 04:13:12 PM Volume is: 26
11/18/2013 04:13:14 PM Vol+
11/18/2013 04:13:14 PM Volume is: 31
11/18/2013 04:13:16 PM Vol+
11/18/2013 04:13:16 PM Volume is: 36
11/18/2013 04:14:57 PM Track changed, now: Counting Stars
11/18/2013 04:19:15 PM Track changed, now: Roar
11/18/2013 04:20:17 PM SkipForward
11/18/2013 04:20:17 PM Track changed, now: Booyah - Original Mix
11/18/2013 04:25:31 PM Track changed, now: Wrecking Ball
11/18/2013 04:25:41 PM SkipForward
11/18/2013 04:25:42 PM Track changed, now: Bonfire Heart
11/18/2013 04:29:42 PM Track changed, now: Beautiful Life
11/18/2013 04:33:46 PM Track changed, now: Afterglow
11/18/2013 04:37:32 PM Track changed, now: Hold On, We're Going Home
11/18/2013 04:41:21 PM Track changed, now: R U Crazy
11/18/2013 04:45:35 PM Track changed, now: What I Might Do - Radio Edit
11/18/2013 04:48:51 PM Track changed, now: Juliet
11/18/2013 04:52:06 PM Track changed, now: Can We Dance - Radio Edit
11/18/2013 04:55:18 PM Track changed, now: Give It 2 U
11/18/2013 04:59:08 PM Track changed, now: Talk Dirty - feat. 2 Chainz
11/18/2013 05:02:06 PM Track changed, now: The Fox (What Does The Fox Say?)
11/18/2013 05:05:41 PM Track changed, now: Rap God
11/18/2013 05:06:09 PM Track changed, now: You Make Me
11/18/2013 05:10:05 PM Track changed, now: Wake Me Up - Radio Edit
11/18/2013 05:14:15 PM Track changed, now: Berzerk
11/18/2013 05:14:24 PM SkipForward
11/18/2013 05:14:24 PM Track changed, now: Survival
11/18/2013 05:15:04 PM Track changed, now: Burn
11/18/2013 05:16:30 PM Track changed, now: 70s
11/18/2013 05:16:35 PM Track changed, now: Daniel
11/18/2013 05:20:29 PM Track changed, now: Wig Wam Bam
11/18/2013 05:23:30 PM Track changed, now: Saturday Night's Alright (For Fighting)
11/18/2013 05:28:25 PM Track changed, now: Second Hand News
11/18/2013 05:31:19 PM Track changed, now: Heroes - 1999 Digital Remaster
11/18/2013 05:37:28 PM Track changed, now: Don't Stop
11/18/2013 05:40:40 PM Track changed, now: Papa Was A Rollin' Stone - Single Version
11/18/2013 05:45:49 PM Track changed, now: I Know What I Like (In Your Wardrobe) - 2008 Digital Remaster
11/18/2013 05:50:00 PM Track changed, now: Fire And Rain
11/18/2013 05:53:23 PM Track changed, now: Dreams
11/18/2013 05:57:37 PM Track changed, now: Walk On The Wild Side
11/18/2013 06:01:51 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:04:56 PM Power OFF
11/18/2013 06:05:06 PM Power ON
11/18/2013 06:05:12 PM Power ON
11/18/2013 06:05:40 PM Power ON
11/18/2013 06:10:40 PM Success: Logged in to LMS.
11/18/2013 06:10:40 PM Success: In contact with SqueezeLite.
11/18/2013 06:10:40 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:10:45 PM Power ON
11/18/2013 06:10:49 PM Power OFF
11/18/2013 06:13:30 PM Success: Logged in to LMS.
11/18/2013 06:13:30 PM Success: In contact with SqueezeLite.
11/18/2013 06:13:30 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:15:16 PM Success: Logged in to LMS.
11/18/2013 06:15:17 PM Success: In contact with SqueezeLite.
11/18/2013 06:15:17 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:15:44 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:15:49 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:22 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:27 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:33 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:38 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:43 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:49 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:16:54 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:17:08 PM Success: Logged in to LMS.
11/18/2013 06:17:08 PM Success: In contact with SqueezeLite.
11/18/2013 06:17:08 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:17:14 PM Power ON
11/18/2013 06:17:46 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:17:51 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:22 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:27 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:33 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:38 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:43 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:49 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:54 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:18:56 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:19:01 PM LMS not there. Trying again in 5 seconds.
11/18/2013 06:19:12 PM Success: Logged in to LMS.
11/18/2013 06:19:12 PM Success: In contact with SqueezeLite.
11/18/2013 06:19:13 PM Track changed, now: Escape (The Pina Colada Song) - Single Version
11/18/2013 06:31:20 PM Track changed, now: Classical
11/18/2013 06:31:21 PM Track changed, now: Johann Sebastian Bach: Suite for Cello Solo No.1 in G, BWV 1007 - 1. PrAlude
11/18/2013 06:33:51 PM Track changed, now: The Planets, Op. 32: 1. Mars, the Bringer of War (Allegro)
11/18/2013 06:41:08 PM Track changed, now: Fanfare for the Common Man
11/18/2013 06:44:25 PM Track changed, now: The Heart Asks Pleasure First/The Promise - Edit
11/18/2013 06:47:38 PM Track changed, now: Marianelli: Dawn
11/18/2013 06:50:17 PM Track changed, now: Danse Macabre In G Minor, Op. 40
11/18/2013 06:57:30 PM Track changed, now: Cello Suite Bwv1007: Prelude
11/18/2013 06:59:59 PM Track changed, now: Vivaldi: Gloria - Gloria Inexcelsis
11/18/2013 07:02:11 PM Track changed, now: Clarinet Concerto K.622: Adagio
11/18/2013 07:04:46 PM Power OFF
14 changes: 7 additions & 7 deletions RPizeBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class RPizeBox:
blocking = 0; # no idea what this does, but in the demo code!
configFile = "/remoteCodes.conf" # has the codes we'll respond to

#some messages = "123456789ABCDEF0"
welcomeMessage1 = " Welcome to "
welcomeMessage2 = "TWW-P's RPizeBox"
#some messages = "123456789ABCDEF0", "123456789ABCDEF0"
welcomeMessage = [" Welcome to ", "TWW-P's RPizeBox"]



#######################################################################
Expand Down Expand Up @@ -160,9 +160,9 @@ def getExternalIP(ifname):
except:
logging.debug('LMS not there. Trying again in %i seconds.' % RPizeBox.logInWait)
wp.lcdPosition(lcd, 0, 0)
wp.lcdPuts(lcd,welcomeMessage1[:16])
wp.lcdPuts(lcd,welcomeMessage[0][:16])
wp.lcdPosition(lcd, 0, 1)
wp.lcdPuts(lcd,welcomeMessage2[:16])
wp.lcdPuts(lcd,welcomeMessage[1][:16])
time.sleep(RPizeBox.logInWait)


Expand Down Expand Up @@ -259,7 +259,7 @@ def getExternalIP(ifname):
# title scrolling

# deal with pause/stop
elif (sl.get_mode() == 'pause' or (sl.get_mode() == 'stop' and sl.get_power_state())):
elif (sl.get_mode() == 'pause' or (sl.get_mode() == 'stop' and sl.get_power_state())):
wp.lcdPosition(lcd, 0, 0)
wp.lcdPuts(lcd,(sl.get_track_artist() + " "*16)[:16])
wp.lcdPosition(lcd, 0, 1)
Expand All @@ -269,7 +269,7 @@ def getExternalIP(ifname):
# send "OFF" message to player
sl.set_power_state(False)

elif (sl.get_mode() == 'stop'):
elif (not sl.get_power_state()):
wp.lcdPosition(lcd, 0, 1)
wp.lcdPuts(lcd," " + time.strftime("%H:%M", time.gmtime())[:16])
wp.lcdPosition(lcd, 0, 0)
Expand Down
13 changes: 9 additions & 4 deletions buttonWatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#set up logging
logging.basicConfig(filename='/home/pi/scripts/buttonwatch.log',level=logging.DEBUG,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')

#some messages = "123456789ABCDEF0", "123456789ABCDEF0"
shutdownMessage = ["Shutting down...", " ...bye bye. "]
rebootMessage = ["Rebooting - ", " Back in a mo..."]


# set up the display - 4 bit to save pins - apparently slower but marginal
# https://projects.drogon.net/raspberry-pi/wiringpi/lcd-library/
wp.wiringPiSetup();
Expand Down Expand Up @@ -49,9 +54,9 @@
os.system("kill $(pgrep -f RPizeBox.py)")
wp.lcdClear(lcd)
wp.lcdPosition(lcd, 0, 0)
wp.lcdPuts(lcd,"Shutting down "[:16])
wp.lcdPuts(lcd,shutdownMessage[0][:16])
wp.lcdPosition(lcd, 0, 1)
wp.lcdPuts(lcd," right now..."[:16])
wp.lcdPuts(lcd,shutdownMessage[1][:16])
os.system("shutdown -h now +1")
break

Expand All @@ -61,9 +66,9 @@
os.system("kill $(pgrep -f RPizeBox.py)")
wp.lcdClear(lcd)
wp.lcdPosition(lcd, 0, 0)
wp.lcdPuts(lcd,"Rebooting "[:16])
wp.lcdPuts(lcd,rebootMessage[0][:16])
wp.lcdPosition(lcd, 0, 1)
wp.lcdPuts(lcd," right now."[:16])
wp.lcdPuts(lcd,rebootMessage[1][:16])
os.system("reboot")
#break
elif (elapsed_time > 0 and elapsed_time <= accidental):
Expand Down

0 comments on commit a3ab414

Please sign in to comment.