Changeset - 3824e42662b1
[Not reviewed]
default
0 7 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-01-22 15:36:10
ethanzonca@CL-ENS241-08.cedarville.edu
Added APRS comment with some sensor values for testing, added method to procedurally create APRS comment, other various changes
7 files changed with 36 insertions and 8 deletions:
0 comments (0 inline, 0 general)
master/master/lib/aprs.c
Show inline comments
 
@@ -14,6 +14,7 @@
 
#include "aprs.h"
 
#include "ax25.h"
 
#include "gps.h"
 
#include "sensordata.h"
 
#include <stdio.h>
 

	
 
const char *gps_aprs_lat = "39.74744N";
 
@@ -78,10 +79,8 @@ void aprs_send()
 
  */
 
  
 
  ax25_send_byte(' ');
 
  ax25_send_string("SV:");
 
  ax25_send_string(getNumSatelites());
 
  ax25_send_byte(' ');
 
  ax25_send_string(APRS_COMMENT);     // Comment
 
  //ax25_send_string(APRS_COMMENT);     // Comment
 
  ax25_send_string(slavesensors_getAPRScomment());
 
  ax25_send_footer();
 

	
 
  ax25_flush_frame();                 // Tell the modem to go
master/master/lib/gps.c
Show inline comments
 
@@ -56,7 +56,7 @@ char* get_longitude() {
 

	
 
char quality;		//quality for GGA and validity for RMC
 
char numSatellites[4];
 
char* getNumSatelites() {
 
char* get_sv() {
 
	return numSatellites;
 
}
 

	
 
@@ -126,6 +126,18 @@ ISR(USART1_RX_vect)
 
	nmeaBufferDataPosition = (nmeaBufferDataPosition + 1) % NMEABUFFER_SIZE;
 
}
 

	
 
void gps_setup() 
 
{
 
	sprintf(timestamp, "0");
 
	sprintf(latitude, "0");
 
	sprintf(longitude, "0");
 
	sprintf(numSatellites, "0");
 
	sprintf(hdop, "0");
 
	sprintf(knots, "0");
 
	sprintf(course, "0");
 
	sprintf(dayofmonth, "0");
 
}
 

	
 

	
 
// Could inline if program space available
 
static void setParserState(uint8_t state)
master/master/lib/gps.h
Show inline comments
 
@@ -12,13 +12,14 @@
 
#define RMC_MESSAGE
 
#define UKN_MESSAGE
 
 
void gps_setup();
 
char* get_longitude();
 
char* get_latitude();
 
char* get_timestamp();
 
char* get_speedKnots();
 
char* get_course();
 
char* get_hdop();
 
char* getNumSatelites();
 
char* get_sv();
 
char* get_dayofmonth();
 
 
#endif /* GPSMKA_H_ */
 
\ No newline at end of file
master/master/lib/sensordata.c
Show inline comments
 
@@ -12,6 +12,8 @@
 

	
 
#include "../config.h"
 
#include "sensordata.h"
 
#include "boardtemp.h"
 
#include "gps.h"
 

	
 
int16_t slaves[MAX_NUM_SLAVES][MAX_NUM_SENSORS];
 

	
 
@@ -41,3 +43,13 @@ int16_t sensordata_get(uint8_t nodeID, u
 
		return 0;
 
	}
 
}
 
 
 
char commentBuffer[128];
 
 
 
// [A-30.5 B45.64 C99542]"
 
char* slavesensors_getAPRScomment() {
 
	snprintf(commentBuffer,128, "T%d S%s V%s H%s", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop());
 
	return commentBuffer;
 
}
 
\ No newline at end of file
master/master/lib/sensordata.h
Show inline comments
 
@@ -21,5 +21,6 @@ void sensordata_set(uint8_t nodeID, uint
 
int16_t sensordata_get(uint8_t nodeID, uint8_t type);
 
void sensordata_setBoardTemp(uint8_t slaveID, int16_t value);
 
int16_t sensordata_getBoardTemp(uint8_t slaveID);
 
char* slavesensors_getAPRScomment();
 
 
#endif /* SENSORDATA_H_ */
 
\ No newline at end of file
master/master/lib/slavesensors.c
Show inline comments
 
@@ -243,7 +243,6 @@ int xbeeIsOk()
 
}
 
 
 
 
bool slavesensors_isrequesting() 
 
{
 
	return requesting;	
master/master/master.c
Show inline comments
 
@@ -45,6 +45,7 @@ int main(void)
 
	time_setup();
 
	watchdog_setup(); // enables interrupts
 
	led_setup();	
 
	gps_setup();
 
	serial0_setup();
 
	serial1_setup();
 
	i2c_init();
 
@@ -116,18 +117,21 @@ int main(void)
 
			
 
			sensors_readBoardTemp(); // i2c read, 400k
 
		
 
			logbuf[0] = 0x00;
 
			//snprintf(logbuf, 128, "%lu,%d,%u,%s,%s,%s,%s,%s\r\n", time_millis(), sensors_getBoardTemp(),get_timestamp(),get_latitude(),get_longitude(),get_speedKnots(),get_hdop(), get_course());
 
			for(int i=0; i<MAX_NUM_SLAVES; i++) {
 
				for(int j=0; j<MAX_NUM_SENSORS; j++) {
 
					int16_t tmp = sensordata_get(i, j);
 
					if(tmp != -32768) {
 
						//serial0_sendString("OH GOSH DATUM\r\n");
 
						snprintf(logbuf,128,"Found value %d...\r\n", tmp);
 
						snprintf(logbuf + strlen(logbuf),128," %d,", tmp);
 
						serial0_sendString(logbuf);
 
					}
 
					
 
				}
 
			}
 
			snprintf(logbuf + strlen(logbuf),128,"\r\n");
 
			
 
			logger_log(logbuf);
 
			
 
			// Print out logger debug
0 comments (0 inline, 0 general)