Permalink
Browse files

Add a signboard mode.

  • Loading branch information...
1 parent 775f543 commit a1d26be63f960a02cf1fb6594c511667eb3f8b7e @jwhite66 committed Apr 4, 2012
Showing with 85 additions and 15 deletions.
  1. +1 −3 ledscroll.c
  2. +2 −2 web/common.php
  3. +33 −1 web/led.css
  4. +30 −0 web/signboard.php
  5. +19 −9 web/webhelper.php
View
@@ -148,9 +148,7 @@ int main(int argc, char *argv[])
if ( error )
continue; /* ignore errors */
- if (rows > 0)
- assert(rows >= face->glyph->bitmap.rows);
- else
+ if (rows <= 0)
rows = face->glyph->bitmap.rows;
assert(x + face->glyph->bitmap.width < MAX_COLS);
View
@@ -4,8 +4,8 @@
$g_title = "BlockLight Control";
$g_menus = array("Status" => "status.php", "Control" => "control.php",
- "Lights" => "lights.php", "SpaceWar" => "spacewar.php",
- "Tetris" => "tetris.php");
+ "Signboard" => "signboard.php", "Lights" => "lights.php",
+ "SpaceWar" => "spacewar.php", "Tetris" => "tetris.php");
function menu_html($selected_menu)
{
View
@@ -111,6 +111,38 @@
width: 600px;
}
+#signboard_message_title
+{
+ float: left;
+ margin-left: 50px;
+ margin-top: 25px;
+ font-size: 25px;
+}
+
+#signboard_message_body
+{
+ display: block;
+ margin-left: 50px;
+ margin-right: 150px;
+ margin-top: 25px;
+ margin-bottom: 25px;
+ float: left;
+ clear: both;
+}
+
+#signboard_message_text
+{
+ font-size: 20px;
+ width: 600px;
+}
+
+#signboard_message_control
+{
+ display: block;
+ margin-left: 50px;
+ margin-top: 100px;
+}
+
#mstatus
{
position: absolute;
@@ -243,7 +275,7 @@
.tabwidth
{
- width: 15%;
+ width: 12%;
}
.iconrow
View
@@ -0,0 +1,30 @@
+<div id="signboard" class="insetcontent">
+ <script src="jquery-1.6.4.js"></script>
+ <script type="text/javascript">
+ function change_message()
+ {
+ $.ajax({
+ url: 'webhelper.php?cmd=runmessage&message=' +
+ encodeURIComponent($('#signboard_message_text').val()),
+ async : false,
+ success: function( data )
+ {
+ /*alert('Message changed');*/
+ },
+ error: function( data, textStatus, errorThrown )
+ {
+ alert("Error setting message: " + errorThrown);
+ }
+ });
+ }
+ </script>
+
+ <div id="signboard_message_body">
+ <textarea id="signboard_message_text" title="Enter the message here. A special square bracked syntax can be used to start a color change. For example, [red]TEXT, will make red TEXT. Advanced colors can be done with 4 hex digits like this: [bb|rr|gg|bb] where bb is bright in hex, rr is red in hex, gg green, and bb blue. For example, [CC|0F|00|00] is bright red." value="Your message here">Your message here</textarea>
+ <input id="signboard_message_button" value="Start signboard with message" type="submit" onclick="change_message(); return false;"></input>
+ </div>
+ <div id="signboard_message_control">
+ <div title="Stop Signboard" onclick="run_command('stopmessage');" class="button red">Stop Signboard</div>
+ </div>
+
+</div>
View
@@ -15,6 +15,15 @@ function run_cmd($c)
return $rc;
}
+/*
+ $fp = popen("ps -C ledscrollsim -o pid=,args=", "r");
+ while ($fp && !feof($fp))
+ {
+ $l = fgets($fp);
+ $msgpids .= $l;
+ }
+ pclose($fp);
+*/
function parse_message($line_array, &$on)
{
$skip = true;
@@ -108,6 +117,16 @@ function handle_fifo()
run_cmd("MESSAGE='{$message}' ../makehelper 2>&1");
}
+ else if ($cmd == "runmessage")
+ {
+ system("pkill ledscrollsim");
+ run_cmd("DISPLAY=:0 ../ledscrollsim ../elegante_pixel.ttf '{$message}' > /dev/null 2>&1 &");
+ }
+
+ else if ($cmd == "stopmessage")
+ {
+ system("pkill ledscrollsim");
+ }
else if ($cmd == "init")
{
$rc = run_cmd("../drive sync 2>&1");
@@ -153,13 +172,4 @@ function handle_fifo()
}
-/*
- $fp = popen("ps -C ledscrollsim -o pid=,args=", "r");
- while ($fp && !feof($fp))
- {
- $l = fgets($fp);
- $msgpids .= $l;
- }
- pclose($fp);
-*/
?>

0 comments on commit a1d26be

Please sign in to comment.