Browse Source

Bandmap: Use host/port/login from config file (if any). Flexible number of bandmap columns.

master
Fabian Kurz 4 years ago
parent
commit
11ec867d69
  1. 30
      yfk
  2. 62
      yfksubs.pl

30
yfk

@ -2048,7 +2048,10 @@ while ($status == 15) {
sprintf("qsldetails=%-15s - Show QSO details in QSL write mode?", $qsldetails),
sprintf("drem=%-15s - Default QSO remarks value", $drem),
sprintf("serial=%-15s - Sent Serial Nr. (0 = None)", $serial),
sprintf("lotwlocation=%-15s - LoTW station locations", $yfksubs::lotwlocation)
sprintf("lotwlocation=%-15s - LoTW station locations", $yfksubs::lotwlocation),
sprintf("dxchost=%-15s - DX cluster hostname", $yfksubs::dxchost),
sprintf("dxcport=%-15s - DX cluster port", $yfksubs::dxcport),
sprintf("dxccall=%-15s - DX cluster login call", $yfksubs::dxccall)
);
my $choice = &selectlist(\$wmain, 2, 1, $row-6, 78, \@setup);
@ -2386,6 +2389,31 @@ while ($status == 15) {
&changeconfig($original, "lotwlocation=$ret");
}
}
elsif ($choice == 35) {
$original = "dxchost=$yfksubs::dxchost";
my $ret = &askbox(10,5,4,70, '[A-Za-z0-9.-_]', "DX cluster host name?", $yfksubs::dxchost);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "dxchost=$ret");
}
}
elsif ($choice == 36) {
$original = "dxcport=$yfksubs::dxcport";
my $ret = &askbox(10,5,4,70, '[0-9]', "DX cluster port?", $yfksubs::dxcport);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "dxcport=$ret");
}
}
elsif ($choice == 37) {
$original = "dxccall=$yfksubs::dxccall";
my $ret = &askbox(10,5,4,70, '[A-Za-z0-9/-]', "DX cluster login callsign?", $yfksubs::dxccall);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "dxccall=$ret");
}
}
&readconfig;
&readsubconfig;
}

62
yfksubs.pl

@ -104,7 +104,9 @@ our $hamlibtcpport = 4532;
our $lotwlocation=""; # LoTW station locations in format: CALL:location,CALL:location
our $lotwuser=""; # Username for automatic LoTW download
our $lotwpass=""; # Password for automatic LoTW download
our $dxchost=""; # dx cluster host
our $dxcport=0; # dx cluster telnet port
our $dxccall=""; # dx cluster login callsign
sub redraw {
@ -121,9 +123,10 @@ sub create_windows {
my $row = $main::row;
my $col = $main::col;
# DX cluster window. only create this if we have enough space (width >= 160)
if ($col >= 180) {
$main::wdxc = &makewindow($row,100,0,80,5);
# DX cluster window. only create this if we have enough space
# (at least 80 + 25 columns for one bandmap column)
if ($col >= 105) {
$main::wdxc = &makewindow($row,$col-80,0,80,5);
}
# GENERAL WINDOWS, always visible
@ -159,11 +162,29 @@ sub rundxc {
my $win = $main::wdxc;
my $c = 0;
my $rows = $main::row;
# each column in the bandmap requires 25 characters. from the total number
# of available columns, 80 are already used by the logger, so we can
# calculate the number of bandmap columns as follows:
my $dxccols = int(($main::col - 80) / 25);
# DX cluster not configured? Exit thread.
unless ($dxchost =~ /\./ && $dxcport =~ /^\d+$/ && $dxccall ne "") {
return;
}
while (1) {
addstr($win, 1, 3, " Connecting to '$dxchost:$dxcport'");
addstr($win, 2, 3, " with callsign '$dxccall'. ");
# addstr($win, 3, 3, " ($dxccols columns)");
refresh($win);
my $t = new Net::Telnet (Timeout => 600, Port => 7300, Prompt => '/./');
$t->open("localhost");
$t->print("dj1yfk-9\n");
sleep(3);
my $t = new Net::Telnet (Timeout => 600, Port => $dxcport, Prompt => '/./');
$t->open($dxchost);
$t->print("$dxccall\n");
$t->print("set/raw\n");
my %bcfh = (); # band-call-> freq hash
@ -172,7 +193,7 @@ sub rundxc {
my $timeout = 300;
my $lastrefresh = 0;
sleep(2);
sleep(3);
while (1) {
my $line = $t->getline();
@ -186,8 +207,7 @@ sub rundxc {
$bcfh{$dxband}{$dxcall} = $freq;
$bcth{$dxband}{$dxcall} = time;
# remember cursor pos
addstr($win, 0, 0, " "x9999);
addstr($win, 0, 0, " "x($dxccols * 50 * $rows));
do {
$c = 0;
@ -199,8 +219,10 @@ sub rundxc {
# we split into columns with a width of 25
my $mrow = $c % $rows;
my $mcol = int($c / $rows);
next if ($mcol >= $dxccols); # don't swap into a non-existing column
addstr($win, $mrow , 1 + $mcol*25, $line);
# remove spots that are older than 5 minutes
if ((time - $bcth{$band}{$call}) > $timeout) {
delete($bcfh{$band}{$call});
delete($bcth{$band}{$call});
@ -208,19 +230,20 @@ sub rundxc {
}
}
# bandmap full? reduce timeout!
# bandmap full? reduce timeout gradually until we have resolved
# the overflow.
$timeout -= 1;
} while ($c >= (4 * $rows));
} while ($c >= ($dxccols * $rows));
$timeout = 300;
$timeout = 3000;
}
# limit screen refresh to 1/second
if ($lastrefresh != time) {
refresh($win);
$lastrefresh = time;
}
}
}
} # while 1 (when connected)
} # while(1) outter loop
}
# We read the configuration file .yfklog.
@ -347,6 +370,15 @@ while (defined (my $line = <CONFIG>)) { # Read line into $line
elsif ($line =~ /^lotwpass=(.+)/) {
$lotwpass = $1;
}
elsif ($line =~ /^dxchost=(.+)/) {
$dxchost = $1;
}
elsif ($line =~ /^dxcport=(.+)/) {
$dxcport = $1;
}
elsif ($line =~ /^dxccall=(.+)/) {
$dxccall = $1;
}
}
close CONFIG; # Configuration read.

Loading…
Cancel
Save