# HG changeset patch # User ethanzonca@CL-ENS241-08.cedarville.edu # Date 2013-02-22 15:05:21 # Node ID 74f10f4bb48e33517fc1e238499b52b3c46fd83a # Parent 0e02d91dac048c0961771b04c043dd8a2b05a003 Slave sensor data now transmitted via APRS along with robust error logging/transmitting support diff --git a/master/master/lib/gps.c b/master/master/lib/gps.c --- a/master/master/lib/gps.c +++ b/master/master/lib/gps.c @@ -180,14 +180,14 @@ ISR(USART1_RX_vect) void gps_setup() { - snprintf(timestamp,2, "0"); - snprintf(latitude,2, "0"); - snprintf(longitude,2, "0"); - snprintf(numSatellites,2, "0"); - snprintf(hdop,2, "0"); - snprintf(knots,2, "0"); - snprintf(course,2, "0"); - snprintf(dayofmonth,2, "0"); + timestamp[0] = 0x00; + latitude[0] = 0x00; + longitude[0] = 0x00; + numSatellites[0] = 0x00; + hdop[0] = 0x00; + knots[0] = 0x00; + course[0] = 0x00; + dayofmonth[0] = 0x00; } diff --git a/master/master/lib/logger.c b/master/master/lib/logger.c --- a/master/master/lib/logger.c +++ b/master/master/lib/logger.c @@ -215,6 +215,24 @@ void error_log(uint8_t errNo, bool flash } } + +char aprsInfoText[64]; +bool aprsInfoTextAvailable = false; +char* logger_getAprsInfoText() +{ + return aprsInfoText; +} + +bool logger_aprsInfoTextAvailable() +{ + return aprsInfoTextAvailable; +} + +void logger_aprsInfoTextConsumed() +{ + aprsInfoTextAvailable = false; +} + void error_log_msg(uint8_t errNo, bool flashLED, char* infoText) { char labelBuffer[32]; @@ -226,6 +244,10 @@ void error_log_msg(uint8_t errNo, bool f } char errorLine[256]; snprintf(errorLine, 256, "%lu,%u,%s,%s,\r\n", time_millis(), errNo, labelBuffer, infoText); + + snprintf(aprsInfoText, 64, "e[%u,%s,%s]", errNo, labelBuffer, infoText); + + aprsInfoTextAvailable = true; error_log_rawwrite(errorLine); led_on(LED_ERROR); @@ -239,6 +261,8 @@ void info_log_msg(char* infoText) { char errorLine[256]; snprintf(errorLine, 256, "%lu,8,infotext,%s,\r\n", time_millis(), infoText); + snprintf(aprsInfoText, 64, "i[%s]", infoText); + aprsInfoTextAvailable = true; error_log_rawwrite(errorLine); } diff --git a/master/master/lib/logger.h b/master/master/lib/logger.h --- a/master/master/lib/logger.h +++ b/master/master/lib/logger.h @@ -21,6 +21,9 @@ uint8_t logger_writeLine(char* dateLine, struct fat_file_struct* open_file_in_dir(struct fat_fs_struct* fs, struct fat_dir_struct* dd, const char* name); uint8_t find_file_in_dir(struct fat_fs_struct* fs, struct fat_dir_struct* dd, const char* name, struct fat_dir_entry_struct* dir_entry); void error_log(uint8_t errNo, bool flashLED); +char* logger_getAprsInfoText(); +bool logger_aprsInfoTextAvailable(); +void logger_aprsInfoTextConsumed(); void error_log_msg(uint8_t errNo, bool flashLED, char* infoText); void info_log_msg(char* infoText); void error_log_rawwrite(char *buffer); diff --git a/master/master/lib/sensordata.c b/master/master/lib/sensordata.c --- a/master/master/lib/sensordata.c +++ b/master/master/lib/sensordata.c @@ -61,10 +61,42 @@ int32_t sensordata_get(uint8_t nodeID, u // Generate APRS comment // TODO: Can we move this buffer to a local scope of this function? -char commentBuffer[128]; +#define COMMENTBUFFER_SIZE 128 +char commentBuffer[COMMENTBUFFER_SIZE]; char* slavesensors_getAPRScomment() { - snprintf(commentBuffer,128, "t9%d s%s v%s h%s _%s |%s", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop(), get_latitudeLSBs(), get_longitudeLSBs()); + snprintf(commentBuffer,COMMENTBUFFER_SIZE, "t9%d s%s v%s h%s _%s |%s ", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop(), get_latitudeLSBs(), get_longitudeLSBs()); + + // Find slave sensors to include in this log + for(int i=0; i