Changeset - 290b43cea415
[Not reviewed]
default
0 5 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-01-21 22:13:28
ethanzonca@CL-ENS241-08.cedarville.edu
Sensor reading storage system now fully functional
5 files changed with 21 insertions and 7 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -17,7 +17,7 @@
 
// Module config (master.c)
 
// --------------------------------------------------------------------------
 
 
//#define DEBUG_OUTPUT
 
#define DEBUG_OUTPUT
 
 
#define F_CPU 11059200
 
#define MODULE_ID '1'
master/master/lib/sensordata.c
Show inline comments
 
@@ -18,7 +18,7 @@ int16_t slaves[MAX_NUM_SLAVES][MAX_NUM_S
 
void sensordata_setup() 
 
{
 
	for(int i=0; i<MAX_NUM_SLAVES; i++) {
 
		for(int j=0; j<MAX_NUM_SLAVES; j++) {
 
		for(int j=0; j<MAX_NUM_SENSORS; j++) {
 
			slaves[i][j] = -32768; // minimum value of 16 bit integer
 
		}
 
	}
 
@@ -31,7 +31,7 @@ void sensordata_set(uint8_t nodeID, uint
 
	}	
 
}
 
 
uint16_t sensordata_get(uint8_t nodeID, uint8_t type) 
 
int16_t sensordata_get(uint8_t nodeID, uint8_t type) 
 
{
 
	// Avoid reading out of bad places!
 
	if(nodeID < MAX_NUM_SLAVES) {
master/master/lib/sensordata.h
Show inline comments
 
@@ -18,7 +18,7 @@
 
 
void sensordata_setup();
 
void sensordata_set(uint8_t nodeID, uint8_t type, uint16_t value);
 
uint16_t sensordata_get(uint8_t nodeID, uint8_t type);
 
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);
 
master/master/lib/slavesensors.c
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "serial.h"
 
#include "serparser.h"
 
#include "slavesensors.h"
 
#include "sensordata.h"
 
#include "led.h"
 
#include "looptime.h"
 
#include <util/delay.h>
 
@@ -302,6 +303,7 @@ void slavesensors_process(uint8_t parseR
 
		
 
			// Store data in structure
 
			sensordata_set(currentSlave,type,parsedVal);
 
			
 
			serial0_sendString("Stored some sexy data!\r\n");
 
		
 
			// If we finished all sensors for all slaves
master/master/master.c
Show inline comments
 
@@ -115,13 +115,25 @@ int main(void)
 
			}
 
			
 
			sensors_readBoardTemp(); // i2c read, 400k
 
			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());
 
		
 
			//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);
 
						serial0_sendString(logbuf);
 
					}
 
					
 
				}
 
			}
 
			logger_log(logbuf);
 
			
 
			// Print out logger debug
 
			#ifdef DEBUG_OUTPUT
 
			serial0_sendString("LOG> ");
 
			serial0_sendString(logbuf);
 
			//serial0_sendString("LOG> ");
 
			//serial0_sendString(logbuf);
 
			#endif
 
			
 
			led_off(LED_CYCLE);
0 comments (0 inline, 0 general)