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
 
@@ -187,13 +187,13 @@ typedef struct
 
	uint32_t blackout_timeout;
 
	int8_t heater_threshold;
 
	uint32_t buzzer_failsafe_duration;
 
	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;
 
 
configuration* sysconfig;
 
master/master/lib/aprs.c
Show inline comments
 
@@ -13,32 +13,37 @@
 
#include "../config.h"
 
#include "aprs.h"
 
#include "ax25.h"
 
#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
 
#ifdef DIGI_PATH2
 
    {DIGI_PATH2, DIGI_PATH2_TTL}, // Digi2 (second digi in the chain)
 
#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
 
  // 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()); 
 
@@ -53,31 +58,20 @@ void aprs_send()
 
  //snprintf(temp, 4, "%03d", (int)(get_course() + 0.5));  
 
  // !!!TODO: ENSURE THAT THE COURSE IS FORMATTED CORRECTLY!
 
  ax25_send_string(get_course());             // Course (degrees)
 
  
 
  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
 
  char commentBuffer[COMMENTBUFFER_SIZE];
 
  ax25_send_string(slavesensors_getAPRScomment(commentBuffer, COMMENTBUFFER_SIZE));
 
  
master/master/lib/gps.c
Show inline comments
 
@@ -432,12 +432,13 @@ void parse_gps_transmission(void){
 
	
 
		//altitude
 
		else if (decodeState == GGA_ALTITUDE)
 
		{
 
			if (byte == ',' && skipBytes == 0) //discard this byte
 
			{
 
				altitude[numBytes] = 0x00;
 
				skipBytes = 1;
 
				setParserState(GGA_ALTITUDE);
 
			}
 
			else if(byte == ',') //end of this data type
 
			{
 
				altitude[numBytes] = 0x00;
master/master/lib/iniparse.c
Show inline comments
 
@@ -49,13 +49,13 @@ static int handler(void* user, const cha
 
		pconfig->buzzer_trigger_minduration = strtol(value, NULL, 10);
 
		
 
	} else if (MATCH("buzzer", "maxalt")) {
 
		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);
 
		
 
		
 
	} else if (MATCH("aprs", "call_id")) {
 
		pconfig->s_callsign_id = atoi(value);
 
		
 
@@ -82,21 +82,24 @@ configuration config = {
 
	.blackout_timeout = BLACKOUT_TIMEOUT,
 
	.heater_threshold = HEATER_THRESHOLD,
 
	.buzzer_failsafe_duration = BUZZER_FAILSAFE_DURATION,
 
	.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
 
};
 

	
 
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);
 
	}
 
 
	sysconfig = &config;
master/master/lib/iniparse.h
Show inline comments
 
@@ -11,10 +11,10 @@
 
 */
 
 
 
#ifndef INIPARSE_H_
 
#define INIPARSE_H_
 
 
 
void iniparse_getconfig();
 
 
 
#endif /* INIPARSE_H_ */
 
\ No newline at end of file
0 comments (0 inline, 0 general)