-
Notifications
You must be signed in to change notification settings - Fork 4
/
aprs.cpp
73 lines (69 loc) · 2.89 KB
/
aprs.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* trackuino copyright (C) 2010 EA5HAV Javi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "ax25.h"
#include "gps.h"
#include "aprs.h"
//#include "sensors.h"
#include <stdio.h>
#include <stdlib.h>
// Module functions
float meters_to_feet(float m)
{
// 10000 ft = 3048 m
return m / 0.3048;
}
// Exported functions
void aprs_send()
{
char temp[12]; // Temperature (int/ext)
const struct s_address addresses[] = {
{D_CALLSIGN, D_CALLSIGN_ID}, // Destination callsign
{S_CALLSIGN, S_CALLSIGN_ID}, // Source callsign (-11 = balloon, -9 = car)
#ifdef DIGI_PATH1
{DIGI_PATH1, DIGI_PATH1_TTL}, // Digi1 (first digi in the chain)
#endif
#ifdef DIGI_PATH2
{DIGI_PATH2, DIGI_PATH2_TTL}, // Digi2 (second digi in the chain)
#endif
};
ax25_send_header(addresses, sizeof(addresses)/sizeof(s_address));
ax25_send_byte('/'); // Report w/ timestamp, no APRS messaging. $ = NMEA raw data
// ax25_send_string("021709z"); // 021709z = 2nd day of the month, 17:09 zulu (UTC/GMT)
ax25_send_string(gps_time); // 170915 = 17h:09m:15s zulu (not allowed in Status Reports)
ax25_send_byte('h');
ax25_send_string(gps_aprs_lat); // Lat: 38deg and 22.20 min (.20 are NOT seconds, but 1/100th of minutes)
ax25_send_byte('/'); // Symbol table
ax25_send_string(gps_aprs_lon); // Lon: 000deg and 25.80 min
ax25_send_byte('X'); // Symbol: O=balloon, -=QTH
snprintf(temp, 4, "%03d", (int)(gps_course + 0.5));
ax25_send_string(temp); // Course (degrees)
ax25_send_byte('/'); // and
snprintf(temp, 4, "%03d", (int)(gps_speed + 0.5));
ax25_send_string(temp); // speed (knots)
ax25_send_string("/A="); // Altitude (feet). Goes anywhere in the comment area
snprintf(temp, 7, "%06ld", (long)(meters_to_feet(gps_altitude) + 0.5));
ax25_send_string(temp);
// ax25_send_string("/Ti=");
// ax25_send_string(itoa(sensors_int_lm60(), temp, 10));
// ax25_send_string("/Te=");
// ax25_send_string(itoa(sensors_ext_lm60(), temp, 10));
ax25_send_byte(' ');
ax25_send_string(APRS_COMMENT); // Comment
ax25_send_footer();
ax25_flush_frame(); // Tell the modem to go
}