Permalink
Browse files

Fixed icons. Added keymap widget

  • Loading branch information...
ndbroadbent committed Nov 21, 2010
1 parent 0a4327a commit b9d6c1822e0ed327252e382f8345b25917578060
Showing with 23 additions and 16 deletions.
  1. +1 −1 lcd_icons/next.chr
  2. +1 −1 lcd_icons/pause.chr
  3. +7 −7 lcd_icons/play.chr
  4. +2 −2 rubyX2040.rb
  5. +5 −5 shell-fm_lcd_console.rb
  6. +7 −0 widget.rb
View
@@ -1,9 +1,9 @@
-.....
#...#
##..#
###.#
#####
###.#
##..#
#...#
+.....
View
@@ -1,4 +1,4 @@
-.....
+##.##
##.##
##.##
##.##
View
@@ -1,9 +1,9 @@
+.#...
+.##..
+.###.
+.####
+.###.
+.##..
+.#...
.....
-#....
-##...
-###..
-####.
-###..
-##...
-#....
View
@@ -9,7 +9,7 @@ class Pertelian
def initialize(tty='/dev/ttyUSB0')
@sp = SerialPort.new tty
- @write_delay = 0.002 # Number of seconds to wait between character bytes.
+ @write_delay = 0.001 # Number of seconds to wait between character bytes.
@instruction_delay = 0.01 # Number of seconds to wait between instruction bytes.
@row_width = 20 # Number of characters that will fit on a line.
@row_offsets = [0x00, 0x40, 0x14, 0x54] # Offsets for ordering rows correctly.
@@ -24,7 +24,7 @@ def setup
# Entry mode set; increment cursor direction; do not automatically shift.
# Cursor/display shift; cursor move.
# Display On; cursor off; do not blink.
- "\x38\x06\x10\x0c\x01".split.each do |byte|
+ "\x38\x06\x10\x0C\x01".split('').each do |byte|
send_instruction(byte)
end
end
View
@@ -5,8 +5,6 @@
# If a string is scrolled, it is padded with 2 spaces to the beginning and end.
# (easier to read)
-
-
require 'rubygems'
require 'socket'
require File.join(File.dirname(__FILE__), 'rubyX2040')
@@ -71,7 +69,9 @@ def splash_screen
@artist = Widget.new(artist, [1,3], 18)
@album = Widget.new(album, [2,3], 18)
@title = Widget.new(title, [3,3], 18)
-@remain = Widget.new(remain, [4,3], 7, :time)
+@remain = Widget.new(remain, [4,3], 6, :time)
+
+@key_info = Widget.new(" <next>:n <pause><play>:p <love>:l <stop>:s ", [4,10], 10, :icons)
# Display icons
$p.write_char($p.icons["guitar"][:loc], [1,1])
@@ -103,7 +103,7 @@ def splash_screen
# Thread to scroll track and artist.
scroll_thread = Thread.new {
while true
- [@artist, @title, @album, @remain].each do |widget|
+ [@artist, @title, @album, @remain, @key_info].each do |widget|
widget.increment_scroll
end
sleep Scroll_delay
@@ -112,7 +112,7 @@ def splash_screen
# Loop to refresh widgets when needed.
while true
- [@artist, @title, @album, @remain].each do |widget|
+ [@artist, @title, @album, @remain, @key_info].each do |widget|
display_widget(widget) if widget.needs_refresh
end
sleep 0.05
View
@@ -45,6 +45,13 @@ def render
string = case @format
when :time
format_as_time(@value)
+ when :icons
+ tmp_str = @value
+ $p.icons.each do |name, data|
+ # Replace each '<icon>' tag with the character value for the memory location.
+ tmp_str.gsub!("<#{name}>", (data[:loc] - 1).chr)
+ end
+ tmp_str
else
@value
end

0 comments on commit b9d6c18

Please sign in to comment.