Files @ 290b43cea415
Branch filter:

Location: seniordesign-firmware/master/master/lib/aprs.c

ethanzonca@CL-ENS241-08.cedarville.edu
Sensor reading storage system now fully functional
/*
 * Master Firmware: APRS
 *
 * Wireless Observational Modular Aerial Network
 * 
 * Ethan Zonca
 * Matthew Kanning
 * Kyle Ripperger
 * Matthew Kroening
 *
 */

#include "../config.h"
#include "aprs.h"
#include "ax25.h"
#include "gps.h"
#include <stdio.h>

const char *gps_aprs_lat = "39.74744N";
const char *gps_aprs_lon = "-83.81249W";
const char *gps_time = "081533/";
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(get_dayofmonth()); ///! Needs to be day hour minute        // 170915 = 17h:09m:15s zulu (not allowed in Status Reports)
  ax25_send_string(get_timestamp()); 
  ax25_send_byte('z'); // zulu time. h for nonzulu
  ax25_send_string(get_latitude());     // Lat: 38deg and 22.20 min (.20 are NOT seconds, but 1/100th of minutes)
  ax25_send_byte('N');
  ax25_send_byte('/');                // Symbol table
  ax25_send_string(get_longitude());     // Lon: 000deg and 25.80 min
  ax25_send_byte('W');
  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(get_speedKnots());             // 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("SV:");
  ax25_send_string(getNumSatelites());
  ax25_send_byte(' ');
  ax25_send_string(APRS_COMMENT);     // Comment
  ax25_send_footer();

  ax25_flush_frame();                 // Tell the modem to go
}