From: Maps Date: Mon, 8 Dec 2014 18:14:02 +0000 (+0100) Subject: can now consistently set tty, introduced status output (beta) X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ed87f984294cd2bc75c9a7805aaa3683356170f7;p=labtools.git can now consistently set tty, introduced status output (beta) --- diff --git a/peltier_controller/webGUI/index.pl b/peltier_controller/webGUI/index.pl index 8d248e7..64ae604 100755 --- a/peltier_controller/webGUI/index.pl +++ b/peltier_controller/webGUI/index.pl @@ -38,7 +38,7 @@ sub new { my $self = { appName => "peltierControl", - tty => "/dev/ttyACM1", + tty => "/dev/ttyACM0", baudrate => 115200, columnNames => ["temp","pid","setpoint"] }; # put tons of default values here (if you wish); @@ -63,6 +63,10 @@ sub main { # receive CGI query $self->{query} = CGI->new(); my $action = $self->{query}->param('action') || "print_html"; + + if(defined($self->{query}->param('tty'))){ + $self->{tty} = $self->{query}->param('tty'); + } # go only to methods that are in the following dispatch table: # if associated value is one, sub can be called via CGI @@ -166,9 +170,20 @@ sub print_html{ my %options = @_; my $shm_manager = $self->create_shm_manager(); my $webpage = webpage->new(shm_manager => $shm_manager); + $webpage->{shared}->{tty} = $self->{tty}; $webpage->page_body(); - } + +# sub print_status{ +# my $self = shift; +# my %options = @_; +# my $shm_manager = $self->create_shm_manager(); +# my $webpage = webpage->new(shm_manager => $shm_manager); +# $webpage->{shared}->{tty} = $self->{tty}; +# $webpage->status(); +# } + + sub plot { my $self = shift; my %options = @_; diff --git a/peltier_controller/webGUI/peltierControl.css b/peltier_controller/webGUI/peltierControl.css index 7187f6d..07550d1 100644 --- a/peltier_controller/webGUI/peltierControl.css +++ b/peltier_controller/webGUI/peltierControl.css @@ -18,6 +18,21 @@ } +#status { + float:right; + position:absolute; + position:fixed; + top: 200px; + left: 680px; + width:280px; + padding:10px; + margin-top:30px; + margin-left:30px; + +} + + + .plotArea { /* float:left; */ position:absolute; diff --git a/peltier_controller/webGUI/peltierControl.js b/peltier_controller/webGUI/peltierControl.js index b859462..64c5934 100644 --- a/peltier_controller/webGUI/peltierControl.js +++ b/peltier_controller/webGUI/peltierControl.js @@ -9,6 +9,7 @@ $(document).ready(function(){ timer = $.timer(function() { plot(); + status(); }); @@ -25,6 +26,7 @@ function plot(){ dataType: "text", data: { action : "plot", + tty : shared.tty, clientId : clientId }, success: function(result) { @@ -33,6 +35,22 @@ function plot(){ }); } +function status(){ + $.ajax({ + url: "index.pl", + cache: false, + async: false, + dataType: "text", + data: { + action : "dump_shm", + tty : shared.tty + }, + success: function(result) { + $("#statusContainer").html(result); + } + }); +} + function start_logging_tool(){ $.ajax({ url: "index.pl", @@ -41,6 +59,7 @@ function start_logging_tool(){ dataType: "text", data: { action : "start_logging_tool", + tty : shared.tty, daemonize : 1 } }); @@ -53,6 +72,7 @@ function terminate_logging_tool(){ async: false, dataType: "text", data: { + tty : shared.tty, action : "terminate_logging_tool" } }); @@ -65,6 +85,7 @@ function clear_records(){ async: false, dataType: "text", data: { + tty : shared.tty, action : "clear_records" } }); @@ -78,6 +99,7 @@ function set_setpoint(){ async: false, dataType: "text", data: { + tty : shared.tty, action : "set_setpoint", setpoint : setpoint } diff --git a/peltier_controller/webGUI/webpage.pm b/peltier_controller/webGUI/webpage.pm index 6454d47..57e5b8c 100644 --- a/peltier_controller/webGUI/webpage.pm +++ b/peltier_controller/webGUI/webpage.pm @@ -47,6 +47,12 @@ sub page_body { print "
Options
"; $self->print_device_controls(); print ''; + + print '
'; + print "
Status
"; + print '
'; + print '
'; + print '
'; print '
'; print "
Plots
"; @@ -60,11 +66,13 @@ sub page_body { } else { passHashToJs({},"shm"); } + passHashToJs($self->{shared},"shared"); return; } + sub print_device_controls { my $self = shift; print ""; @@ -96,19 +104,6 @@ sub print_device_controls { } -# sub passHashToJs { -# -# my $hashref = shift(); -# my $objname = shift(); -# $objname = 'fromPerl' unless (defined($objname)); -# print ""; -# -# } sub passHashToJs {