Changeset - b22a378398b3
[Not reviewed]
default
0 5 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-04-16 15:14:27
ethanzonca@CL-ENS241-08.cedarville.edu
fixed configuration issues
5 files changed with 21 insertions and 23 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -190,7 +190,7 @@ typedef struct
 
	uint32_t buzzer_trigger_minduration;
 
	uint32_t buzzer_trigger_maxaltitude;
 
	uint32_t datarequest_rate;
 
	char s_callsign[10];
 
	char s_callsign[7];
 
	uint8_t s_callsign_id;
 
	uint32_t aprs_transmit_period;
 
} configuration;
master/master/lib/aprs.c
Show inline comments
 
@@ -16,18 +16,21 @@
 
#include "gps.h"
 
#include "sensordata.h"
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <string.h>
 

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

	
 
void aprs_send()
 
{
 
  const struct s_address addresses[] = { 
 
    {D_CALLSIGN, D_CALLSIGN_ID},  // Destination callsign
 
    {sysconfig->s_callsign, sysconfig->s_callsign_id},  // Source callsign (-11 = balloon, -9 = car)
 
    {"", sysconfig->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
 
@@ -36,6 +39,8 @@ void aprs_send()
 
#endif
 
  };
 

	
 
  strncpy(addresses[1].callsign, sysconfig->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('/');                // Report w/ timestamp, no APRS messaging. $ = NMEA raw data
 
@@ -56,25 +61,14 @@ void aprs_send()
 
  
 
  ax25_send_byte('/');                // and
 
  
 
  // !!!TODO: Check the speed!
 
  //snprintf(temp, 4, "%03d", (int)(gps_speed + 0.5));
 
  ax25_send_string(get_speedKnots());             // speed (knots)
 
  
 
  /*
 
  int32_t alt = meters_to_feet(strtol(get_gpsaltitude(), NULL, 10));
 
  
 
  char temp[7];
 
  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
 
  snprintf(temp, 7, "%ld", alt);
 
  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(' ');
 
  
 
  #define COMMENTBUFFER_SIZE 128
master/master/lib/gps.c
Show inline comments
 
@@ -435,6 +435,7 @@ void parse_gps_transmission(void){
 
		{
 
			if (byte == ',' && skipBytes == 0) //discard this byte
 
			{
 
				altitude[numBytes] = 0x00;
 
				skipBytes = 1;
 
				setParserState(GGA_ALTITUDE);
 
			}
master/master/lib/iniparse.c
Show inline comments
 
@@ -52,7 +52,7 @@ static int handler(void* user, const cha
 
		pconfig->buzzer_trigger_maxaltitude = strtol(value, NULL, 10);
 
		
 
	} else if (MATCH("aprs", "call")) {
 
		strncpy(pconfig->s_callsign, value, 10);
 
		snprintf(pconfig->s_callsign, 7, "%s", &value[1], 6);
 
		//pconfig->s_callsign = strdup(value);
 
		
 
		
 
@@ -85,7 +85,7 @@ configuration config = {
 
	.buzzer_trigger_minduration = BUZZER_TRIGGER_MINDURATION,
 
	.buzzer_trigger_maxaltitude = BUZZER_TRIGGER_MAXALTITUDE,
 
	.datarequest_rate = DATAREQUEST_RATE,
 
	.s_callsign = S_CALLSIGN,
 
	
 
	.s_callsign_id = S_CALLSIGN_ID,
 
	.aprs_transmit_period = APRS_TRANSMIT_PERIOD
 
};
 
@@ -93,7 +93,10 @@ configuration config = {
 
void iniparse_getconfig()
 
{
 
	// Init configuration with default values from config.h
 
 
	snprintf(config.s_callsign, 10, "KD8TDF");
 
	config.s_callsign[6] = NULL;
 
	
 
	
 
	if (ini_parse(handler, &config) < 0) {
 
		// ERROR: Make new error code here!
 
		error_log(ERROR_CONFIGPARSE, false);
master/master/lib/iniparse.h
Show inline comments
 
@@ -14,7 +14,7 @@
 
#ifndef INIPARSE_H_
 
#define INIPARSE_H_
 
 
 
void iniparse_getconfig();
 
 
 
#endif /* INIPARSE_H_ */
 
\ No newline at end of file
0 comments (0 inline, 0 general)