diff --git a/master/master/config.h b/master/master/config.h --- a/master/master/config.h +++ b/master/master/config.h @@ -22,6 +22,36 @@ // Maximum packet delay #define MAX_PACKET_LEN 512 // bytes + +// -------------------------------------------------------------------------- +// APRS config (aprs.c) +// -------------------------------------------------------------------------- + +// Set your callsign and SSID here. Common values for the SSID are +// (from http://zlhams.wikidot.com/aprs-ssidguide): +// +// - Balloons: 11 +// - Cars: 9 +// - Home: 0 +// - IGate: 5 +#define S_CALLSIGN "MYCALL" +#define S_CALLSIGN_ID 11 + +// Destination callsign: APRS (with SSID=0) is usually okay. +#define D_CALLSIGN "APRS" +#define D_CALLSIGN_ID 0 + +// Digipeating paths: +// (read more about digipeating paths here: http://wa8lmf.net/DigiPaths/ ) +// The recommended digi path for a balloon is WIDE2-1 or pathless. The default +// is pathless. Uncomment the following two lines for WIDE2-1 path: +#define DIGI_PATH1 "WIDE2" +#define DIGI_PATH1_TTL 1 + +// APRS comment: this goes in the comment portion of the APRS message. You +// might want to keep this short. The longer the packet, the more vulnerable +// it is to noise. +#define APRS_COMMENT "Trackuino reminder: replace callsign with your own" #endif /* CONFIG_H_ */ \ No newline at end of file diff --git a/master/master/lib/aprs.c b/master/master/lib/aprs.c new file mode 100644 --- /dev/null +++ b/master/master/lib/aprs.c @@ -0,0 +1,72 @@ +/* + * aprs.c + * + * Created: 11/8/2012 3:40:57 PM + * Author: ethanzonca + */ + +#include "../config.h" +#include "aprs.h" +#include "ax25.h" +#include + +const char *gps_aprs_lat = "somelatitudesomelatitudesomelatitudesomelatitudesomelatitudesomelatitude"; +const char *gps_aprs_lon = "somelongitudesomelongitudesomelongitudesomelongitudesomelongitudesomelongitude"; +const char *gps_time = "sometimedatasometimedatasometimedatasometimedatasometimedatasometimedata"; +float gps_altitude = 123.5; +int gps_course = 5; +int gps_speed = 13; + +float meters_to_feet(float m) +{ + // 10000 ft = 3048 m + return m / 0.3048; +} + +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 + }; + + // emz: modified this to get the size of the first address rather than the size of the struct itself, which fails + ax25_send_header(addresses, sizeof(addresses)/sizeof(addresses[0])); + 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('O'); // 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="); + snprintf(temp, 6, "%d", 122);//sensors_int_lm60()); -- PUT SENSOR DATA HERE + ax25_send_string(temp); + ax25_send_string("/Te="); + snprintf(temp, 6, "%d", 123);//sensors_ext_lm60()); + ax25_send_string(temp); + ax25_send_string("/V="); + snprintf(temp, 6, "%d", 123);//sensors_vin()); + ax25_send_string(temp); + ax25_send_byte(' '); + ax25_send_string(APRS_COMMENT); // Comment + ax25_send_footer(); + + ax25_flush_frame(); // Tell the modem to go +} diff --git a/master/master/lib/aprs.h b/master/master/lib/aprs.h new file mode 100644 --- /dev/null +++ b/master/master/lib/aprs.h @@ -0,0 +1,14 @@ +/* + * aprs.h + * + * Created: 11/8/2012 3:41:04 PM + * Author: ethanzonca + */ + + +#ifndef APRS_H_ +#define APRS_H_ + +void aprs_send(); + +#endif /* APRS_H_ */ \ No newline at end of file diff --git a/master/master/lib/ax25.c b/master/master/lib/ax25.c --- a/master/master/lib/ax25.c +++ b/master/master/lib/ax25.c @@ -5,7 +5,7 @@ * Author: ethanzonca */ - +//Licensing: Library from the Trackuino project #include #include "../config.h" #include "ax25.h" diff --git a/master/master/lib/ax25.h b/master/master/lib/ax25.h --- a/master/master/lib/ax25.h +++ b/master/master/lib/ax25.h @@ -9,6 +9,8 @@ #ifndef AX25_H_ #define AX25_H_ +#include + struct s_address { char callsign[7]; unsigned char ssid; diff --git a/master/master/master.c b/master/master/master.c --- a/master/master/master.c +++ b/master/master/master.c @@ -17,7 +17,7 @@ #include #include "lib/serial.h" -#include "lib/afsk.h" +#include "lib/aprs.h" #include "lib/led.h" void micro_setup() { @@ -35,7 +35,14 @@ int main(void) while(1) { - afsk_test(); + //afsk_test(); + aprs_send(); + _delay_ms(400); + _delay_ms(400); + _delay_ms(400); + _delay_ms(400); + _delay_ms(400); + _delay_ms(400); serial_SendCommand('0','A',0,0); } } \ No newline at end of file diff --git a/master/master/master.cproj b/master/master/master.cproj --- a/master/master/master.cproj +++ b/master/master/master.cproj @@ -120,6 +120,12 @@ compile + + compile + + + compile + compile