kopia lustrzana https://github.com/bristol-seds/pico-tracker
Aprs working on 144.888, tested on aprs.fi with pymutlimonaprs
rodzic
0e14825de9
commit
920a6cc077
|
@ -25,7 +25,25 @@
|
|||
#ifndef APRS_H
|
||||
#define APRS_H
|
||||
|
||||
/**
|
||||
* Reference APRS Protocol Spec http://www.aprs.org/doc/APRS101.PDF
|
||||
*/
|
||||
|
||||
/**
|
||||
* This should be a full licensed callsign you own. Not mine plz k thx bai
|
||||
*
|
||||
* Max. 6 characters
|
||||
*/
|
||||
#define APRS_CALLSIGN "M0SBU"
|
||||
#define APRS_SSID 11
|
||||
|
||||
/**
|
||||
* APRS Map Symbol. See Appendix 2: APRS Symbol Tables
|
||||
*/
|
||||
#define APRS_SYMBOL "/O" /* Balloon */
|
||||
|
||||
void aprs_init(void);
|
||||
void aprs_start(float lat, float lon, float altitude);
|
||||
uint8_t aprs_tick(void);
|
||||
|
||||
#endif /* APRS_H */
|
||||
|
|
|
@ -24,8 +24,10 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "samd20.h"
|
||||
#include "aprs.h"
|
||||
#include "ax25.h"
|
||||
|
||||
/**
|
||||
|
@ -36,16 +38,64 @@
|
|||
* http://k9dci.home.comcast.net/~k9dci/APRS%20Beginner%20Guide%20-%20K9DCI%20Ver%205-1.pdf
|
||||
*/
|
||||
|
||||
char addresses[50];
|
||||
|
||||
void aprs_start(void)
|
||||
/**
|
||||
* Encodes a base-91 representation of `value` in `str`
|
||||
*
|
||||
* `str` should have length `n` + 1 and should be big enough to hold `value`
|
||||
*/
|
||||
void base91_encode(char *str, uint8_t n, uint32_t value)
|
||||
{
|
||||
sprintf(addresses, "%-6s%c%-6s%c%-6s%c",
|
||||
"APRS", 0,
|
||||
"M0SBU", 0,
|
||||
"WIDE1", 1);
|
||||
/* Start at the end of the string, adding the null terminator */
|
||||
for(str += n, *str = '\0'; n; n--) {
|
||||
|
||||
ax25_start(addresses, 21, "testtest", 8);
|
||||
*(--str) = (value % 91) + 33;
|
||||
value /= 91;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start the transmission of an aprs frame
|
||||
*/
|
||||
void aprs_start(float lat, float lon, float altitude)
|
||||
{
|
||||
char addresses[50];
|
||||
char information[50];
|
||||
char compressed_lat[5];
|
||||
char compressed_lon[5];
|
||||
|
||||
/* Encode the destination / source / path addresses */
|
||||
uint32_t addresses_len = sprintf(addresses, "%-6s%c%-6s%c%-6s%c",
|
||||
"APRS", 0,
|
||||
APRS_CALLSIGN, APRS_SSID,
|
||||
"WIDE2", 1);
|
||||
|
||||
/* Prepare the aprs position report */
|
||||
uint32_t compressed_lat_value = (uint32_t)round(380926 * ( 90 - lat));
|
||||
uint32_t compressed_lon_value = (uint32_t)round(190463 * (180 + lon));
|
||||
base91_encode(compressed_lat, 4, compressed_lat_value);
|
||||
base91_encode(compressed_lon, 4, compressed_lon_value);
|
||||
uint32_t altitude_feet = altitude * 3.2808; /* Oh yeah feet! Everyone loves feet */
|
||||
|
||||
/* Encode the information field */
|
||||
/* Compressed Lat/Long position report, no timestamp */
|
||||
uint32_t information_len = sprintf(information,
|
||||
"!%c%s%s%c%s%c/A=%06ld RTTY/434.6U8N2",
|
||||
APRS_SYMBOL[0], /* Symbol Table ID */
|
||||
compressed_lat,
|
||||
compressed_lon,
|
||||
APRS_SYMBOL[1], /* Symbol Code */
|
||||
" ", /* Compressed Altitude */
|
||||
' ', /* Compression Type */
|
||||
altitude_feet /* Altitude */
|
||||
);
|
||||
|
||||
/* Let's actually try that out.. We can add comment etc. later */
|
||||
|
||||
|
||||
/* Transmit the frame */
|
||||
ax25_start(addresses, addresses_len,
|
||||
information, information_len);
|
||||
}
|
||||
|
||||
uint8_t aprs_tick(void)
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include "si_trx_defs.h"
|
||||
#include "hw_config.h"
|
||||
|
||||
#define RADIO_FREQUENCY 434600000
|
||||
//#define RADIO_FREQUENCY 434600000
|
||||
#define RADIO_FREQUENCY 144888000
|
||||
|
||||
#define RADIO_POWER 0x3f
|
||||
#define VCXO_FREQUENCY SI406X_TCXO_FREQUENCY
|
||||
#define RF_DEVIATION 200
|
||||
|
|
|
@ -308,7 +308,7 @@ void telemetry_tick(void) {
|
|||
|
||||
if (!radio_on) {
|
||||
/* APRS: We use pwm to control gpio1 */
|
||||
aprs_start();
|
||||
aprs_start(51.47, -2.58, 10);
|
||||
|
||||
si_trx_on(SI_MODEM_MOD_TYPE_2GFSK, 400);
|
||||
radio_on = 1;
|
||||
|
|
Ładowanie…
Reference in New Issue