]> jspc29.x-matter.uni-frankfurt.de Git - coral.git/commitdiff
added ascii output option for current scan
authorMichael Wiebusch <m.wiebusch@gsi.de>
Wed, 18 Feb 2015 12:37:37 +0000 (13:37 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Wed, 18 Feb 2015 12:37:37 +0000 (13:37 +0100)
user_interface/coral_scanner.pm
user_interface/regio.pm

index d66e5230cece8b3c0a121454f172b4770feb3296..e8d4c03a57d5b65ec371d17057547181defaa8b3 100644 (file)
@@ -432,6 +432,39 @@ sub stop_scan {
   return " ";
 }
 
+sub scan_to_ascii {
+  my $self = shift;
+  my %options = @_;
+  my $scan = $self->{scan_shm}->readShm();
+  my $tc = $self->{table_control};
+  
+  my $sample_rect_x1 = $tc->{settings}->{sample_rect_x1};
+  my $sample_rect_x2 = $tc->{settings}->{sample_rect_x2};
+  my $sample_rect_y1 = $tc->{settings}->{sample_rect_y1};
+  my $sample_rect_y2 = $tc->{settings}->{sample_rect_y2};
+  
+  my $sample_rect_size_x = $sample_rect_x2 - $sample_rect_x1;
+  my $sample_rect_size_y = $sample_rect_y2 - $sample_rect_y1;
+  
+  my $aperture_dia = $tc->{settings}->{sample_aperture_dia};
+  
+  my $step_size = $scan->{meta}->{step_size};
+  my $cols = $scan->{meta}->{cols};
+  my $rows = $scan->{meta}->{rows};
+  
+  my @rows = ();
+  for (my $i=0; $i < $rows; $i++) {
+    my @cols = ();
+    for (my $j=0; $j < $cols; $j++) {
+      my $counts = $scan->{data}->[$i]->[$j];
+      push(@cols,$counts);
+    }
+    push(@rows,join("\t",@cols));
+  }
+  print join("\n",@rows);
+  return " ";
+}
+
 sub scan_to_svg {
   my $self = shift;
   my %options = @_;
index 2f2eb733145909c5e728600b28e55da3dba650ea..6016d515ebc4db08ce6d4073dc267f72fdc9d03c 100644 (file)
@@ -74,6 +74,9 @@ sub new {
   $self->{port}->databits(8); 
   $self->{port}->stopbits(1); 
   $self->{port}->handshake("none"); 
+  $self->{port}->are_match("");
+  $self->{port}->read_char_time(1);  # avg time between read char
+  $self->{port}->read_const_time(40); # const time for read (milliseconds)
   $self->{port}->write_settings;
   
   return $self;
@@ -110,12 +113,9 @@ sub communicate {
   my $self = shift;
   my $command = shift;
   
-  my $ack_timeout=0.5;
   my $rstring;
 
-  $self->{port}->are_match("");
-  $self->{port}->read_char_time(1);  # avg time between read char
-  $self->{port}->read_const_time(2); # const time for read (milliseconds)
+
   $self->{port}->lookclear; 
   $self->{port}->write("$command\n");