Changeset - 920a71bf7d87
[Not reviewed]
default
0 5 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-02-12 16:02:54
ethanzonca@CL-ENS241-08.cedarville.edu
GPS latitude is now handled in a more robust manner, least 3 significant digits of current position are included in the comment field.
5 files changed with 35 insertions and 15 deletions:
0 comments (0 inline, 0 general)
master/master/lib/aprs.c
Show inline comments
 
@@ -43,10 +43,10 @@ void aprs_send()
 
  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_string(get_latitudeTrimmed());     // 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_string(get_longitudeTrimmed());     // Lon: 000deg and 25.80 min
 
  ax25_send_byte('W');
 
  ax25_send_byte('O');                // Symbol: O=balloon, -=QTH
 
  
master/master/lib/gps.c
Show inline comments
 
@@ -52,17 +52,35 @@ char* get_timestamp()
 
}
 
	
 
char latitude[14];	//lllll.lla
 
char* get_latitude() 
 
char latitudeTmp[8];
 
char* get_latitudeTrimmed() 
 
{
 
	return latitude;
 
	strncpy(latitudeTmp, &latitude[0], 7);
 
	latitudeTmp[7] = 0x00;
 
	return latitudeTmp;
 
}
 
char* get_latitudeLSBs()
 
{
 
	strncpy(latitudeTmp, &latitude[7], 3);
 
	latitudeTmp[3] = 0x00;
 
	return latitudeTmp;
 
}
 

	
 
char longitude[14];	//yyyyy.yyb
 
char* get_longitude() 
 
char longitudeTmp[9];
 

	
 
char* get_longitudeTrimmed() 
 
{
 
	return longitude;
 
	strncpy(longitudeTmp, &longitude[0], 8);
 
	longitudeTmp[8] = 0x00;
 
	return longitudeTmp;
 
}
 

	
 
char* get_longitudeLSBs()
 
{
 
	strncpy(longitudeTmp, &longitude[8], 3);
 
	longitudeTmp[3] = 0x00;
 
	return longitudeTmp;
 
}
 

	
 
char quality;		//quality for GGA and validity for RMC
 
char numSatellites[4];
 
@@ -290,7 +308,7 @@ void parse_gps_transmission(void){
 
			else if (byte == ',') //end of this data type
 
			{
 
				
 
				latitude[7] = 0x00; // null terminate
 
				latitude[numBytes] = 0x00; // null terminate
 
				
 
				setParserState(GGA_LONGITUDE);
 
				skipBytes = 0; //prep for next phase of parse
 
@@ -322,7 +340,7 @@ void parse_gps_transmission(void){
 
			}
 
			else if (byte == ',') //end of this data type
 
			{
 
				longitude[8] = 0x00;
 
				longitude[numBytes] = 0x00;
 
				setParserState(GGA_QUALITY);
 
				numBytes = 0; //prep for next phase of parse
 
				skipBytes = 0;
master/master/lib/gps.h
Show inline comments
 
@@ -21,8 +21,10 @@
 
#define UKN_MESSAGE
 
 
void gps_setup();
 
char* get_longitude();
 
char* get_latitude();
 
char* get_longitudeTrimmed();
 
char* get_longitudeLSBs();
 
char* get_latitudeTrimmed();
 
char* get_latitudeLSBs();
 
char* get_timestamp();
 
char* get_speedKnots();
 
char* get_course();
master/master/lib/sensordata.c
Show inline comments
 
@@ -64,7 +64,7 @@ int32_t sensordata_get(uint8_t nodeID, u
 
char commentBuffer[128];
 
char* slavesensors_getAPRScomment() 
 
{
 
	snprintf(commentBuffer,128, "T%d S%s V%s H%s", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop());
 
	snprintf(commentBuffer,128, "T%d S%s V%s H%s _%s |%s", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop(), get_latitudeLSBs(), get_longitudeLSBs());
 
	return commentBuffer;
 
}
 
 
@@ -113,7 +113,7 @@ void sensordata_logvalues()
 
		logbuf[0] = 0x00;
 
		
 
		// Write master sensor values
 
		snprintf(logbuf, 256, "%lu,%d,%s,%s,%s,%s,%s,%s,%s,", time_millis(), sensors_getBoardTemp(),get_timestamp(),get_latitude(),get_longitude(),get_speedKnots(),get_hdop(), get_course(), get_sv());
 
		snprintf(logbuf, 256, "%lu,%d,%s,%s,%s,%s,%s,%s,%s,", time_millis(), sensors_getBoardTemp(),get_timestamp(),get_latitudeTrimmed(),get_longitudeTrimmed(),get_speedKnots(),get_hdop(), get_course(), get_sv());
 
		
 
		// Write slave sensor values
 
		for(int i=0; i<MAX_NUM_SLAVES; i++) 
master/master/lib/slavesensors.c
Show inline comments
 
@@ -487,14 +487,14 @@ void slavesensors_process(uint8_t parseR
 
		// we got a command when we didn't request anything. probably skip it.
 
		return;
 
	}
 
	
 
	// TODO: timeout. If we're at NODATA for a long time and we are requesting, that's an issue.
 
	
 
	// TODO: If we time out, WE NEED TO RESET THE PARSER. It could be in a bad state.
 
	else if(parseResult == PARSERESULT_NODATA) 
 
	{
 
		// Wait for data
 
		if(requesting && time_millis() - beginRequest > 1000) {
 
			// if we're requesting, we have no data, and we're over the timeout, this is bad!
 
			// setParserState(STATE_RESET); - meh, can't do this because it freaking increments the cirbufptr
 
			gotoNextSlaveOrSensor(true);
 
		}
 
	}
0 comments (0 inline, 0 general)