File: telem-balloon.pl

package info (click to toggle)
direwolf 1.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,152 kB
  • sloc: ansic: 59,041; perl: 170; cpp: 124; sh: 113; makefile: 42; python: 11
file content (43 lines) | stat: -rw-r--r-- 1,379 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

# Part of Dire Wolf APRS Telemetry Toolkit, WB2OSZ, 2015

# In a real situation this would obtain data from sensors.
# For demonstration purposes we use historical data supplied on the command line.

if ($#ARGV+1 != 5) { 
	print STDERR "5 command line arguments must be provided.\n";
	usage(); 
}

($seq,$vbat,$vsolar,$temp,$sat) = @ARGV;

# Scale to integer in range of 0 to 8280.
# This must be the inverse of the mapping in the EQNS message.

$vbat = int(($vbat * 1000) + 0.5);
$vsolar = int(($vsolar * 1000) + 0.5);
$temp = int((($temp + 273.2) * 10) + 0.5);

exit system("telem-data91.pl $seq $vbat $vsolar $temp $sat");


sub usage () 
{
	print STDERR "\n";
	print STDERR "balloon.pl - Format data into Compressed telemetry format.\n";
	print STDERR "\n";
	print STDERR "In a real situation this would obtain data from sensors.\n";
	print STDERR "For demonstration purposes we use historical data supplied on the command line.\n";
	print STDERR "\n";
	print STDERR "Usage:  balloon.pl  seq vbat vsolar temp sat\n";
	print STDERR "\n";
	print STDERR "Where,\n";
	print STDERR "    seq     is a sequence number.\n";
	print STDERR "    vbat    is battery voltage.\n";
	print STDERR "    vsolar  is solar cell voltage.\n";
	print STDERR "    temp    is temperature, degrees C.\n";
	print STDERR "    sat     is number of GPS satellites visible.\n";

	exit 1;
}