Changeset - a675e30661bd
[Not reviewed]
default
0 1 0
Ethan Zonca (ethanzonca) - 9 years ago 2017-01-03 14:53:00
e@ethanzonca.com
Actual GPS now correctly passed though
1 file changed with 20 insertions and 23 deletions:
0 comments (0 inline, 0 general)
Libraries/aprs/aprs.c
Show inline comments
 
@@ -16,85 +16,82 @@
 
 * You should have received a copy of the GNU Affero General Public License
 
 * along with FeatherHAB. If not, see <http://www.gnu.org/licenses/>.
 
 * 
 
 * Ethan Zonca
 
 *
 
 */
 

	
 
#include <string.h>
 
#include <stdlib.h>
 

	
 
#include "config.h"
 
#include "aprs.h"
 
#include "gps.h"
 
//#include "gps.h"
 
//#include "adc.h"
 
#include "ax25.h"
 

	
 

	
 
int32_t meters_to_feet(int32_t m)
 
{
 
  // 10000 ft = 3048 m
 
  return (float)m / 0.3048;
 
}
 

	
 
void aprs_send(void)
 
{
 
  struct s_address addresses[] = { 
 
    {D_CALLSIGN, D_CALLSIGN_ID},  // Destination callsign
 
    {"", S_CALLSIGN_ID},  // Source callsign (-11 = balloon, -9 = car)
 
		//{S_CALLSIGN, S_CALLSIGN_ID},
 
#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
 
  };
 

	
 
  strncpy(addresses[1].callsign, S_CALLSIGN, 7);
 
  
 
  // 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(',');
 

	
 
  char tmpBuffer[128];
 
  tmpBuffer[0] = ',';
 
  tmpBuffer[1] = '\0';
 

	
 
  //ax25_send_string(get_latitude());
 
  snprintf(tmpBuffer, 128, "%g,", gps_getdata()->latitude / 10000000.0);
 
  //ax25_send_string("42.153749");
 
  // Latitude
 
  snprintf(tmpBuffer, 128, "%ld,", gps_getdata()->latitude);
 
  ax25_send_string(tmpBuffer);
 
  ax25_send_byte(',');
 
  //ax25_send_string(get_longitude());
 
  ax25_send_string("53.234823");
 
  ax25_send_byte(',');
 
  
 
  //ax25_send_string(get_speedKnots());
 
  ax25_send_string("33");
 
  ax25_send_byte(','); 
 
  
 
  //ax25_send_string(get_gpsaltitude());
 
  ax25_send_string("3847");
 
  ax25_send_byte(','); 
 
  // Longitude
 
  snprintf(tmpBuffer, 128, "%ld,", gps_getdata()->longitude);
 
  ax25_send_string(tmpBuffer);
 

	
 
  // Speed
 
  snprintf(tmpBuffer, 128, "%d,", gps_getdata()->speed);
 
  ax25_send_string(tmpBuffer);
 

	
 
  //ax25_send_string(get_pressure());
 
  ax25_send_string("8383.00");
 
  ax25_send_byte(','); 
 
  // Altitude
 
  snprintf(tmpBuffer, 128, "%d,", gps_getdata()->altitude);
 
  ax25_send_string(tmpBuffer);
 

	
 
  //ax25_send_string(get_temperature());
 
  ax25_send_string("25.3");
 
  ax25_send_byte(','); 
 
  // Pressure
 
  snprintf(tmpBuffer, 128, "%d,", 23);
 
  ax25_send_string(tmpBuffer);
 
  
 
  //ax25_send_string(get_temperature());
 
  // Temperature
 
  snprintf(tmpBuffer, 128, "%d,", 77);
 
  ax25_send_string(tmpBuffer);
 

	
 
  // HDOP
 
  snprintf(tmpBuffer, 128, "%u,", gps_getdata()->pdop);
 
  ax25_send_string(tmpBuffer);
 
	//ax25_send_string(get_hdop());
 
	//ax25_send_byte(',');
 

	
 

	
 
  ax25_send_footer();
 
  ax25_flush_frame();
 
}
 

	
 
// vim:softtabstop=4 shiftwidth=4 expandtab 
0 comments (0 inline, 0 general)