# HG changeset patch # User ethanzonca@CL-ENS241-08.cedarville.edu # Date 2013-03-18 18:17:47 # Node ID 903c905fbe0bc2fa216cbd909045e4e82d8b622d # Parent 065c4b037614be58cbbb6c60fec8c5039692fada Watchdog fix, interleaved APRS messaging tweaks 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 @@ -58,17 +58,21 @@ int32_t sensordata_get(uint8_t nodeID, u } } -bool isEven = false; +bool isEven = true; // Generate APRS comment // TODO: Can we move this buffer to a local scope of this function? char* slavesensors_getAPRScomment(char* commentBuffer, uint16_t bufferSize) { - snprintf(commentBuffer,bufferSize, "t9%d~s%s~v%s~h%s~_%s~|%s", sensors_getBoardTemp(), get_sv(), get_speedKnots(), get_hdop(), get_latitudeLSBs(), get_longitudeLSBs()); + snprintf(commentBuffer,bufferSize, "~v%s~_%s~|%s", get_speedKnots(), get_latitudeLSBs(), get_longitudeLSBs()); if(isEven) { + // Master details + uint16_t len = strlen(commentBuffer); + snprintf(commentBuffer + len, bufferSize-len, "~t9%d~s%s~h%s", sensors_getBoardTemp(), get_sv(), get_hdop()); + // Find slave sensors to include in this log for(int i=0; i TIMEOUT_SLAVEREQUEST) { + if(requesting && ( (time_millis() - beginRequest) > TIMEOUT_SLAVEREQUEST)) { // 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); + char msg[128]; snprintf(msg, 128, "Slave %u (%s) timeout",currentSlave,slaveNames[currentSlave]); error_log_msg(ERROR_SLAVETIMEOUT, false, msg); // log error, don't blink LED + + gotoNextSlaveOrSensor(true); } } diff --git a/master/master/master.c b/master/master/master.c --- a/master/master/master.c +++ b/master/master/master.c @@ -38,12 +38,13 @@ int main(void) { + // Initialize libraries + time_setup(); + watchdog_setup(); // enables interrupts + // Power debounce _delay_ms(1000); - // Initialize libraries - time_setup(); - watchdog_setup(); // enables interrupts led_setup(); gps_setup(); serial0_setup(); @@ -70,9 +71,6 @@ int main(void) // Result of last parser run int parseResult = PARSERESULT_NODATA; - // FIXME: Probably don't need this. - serial1_ioff(); - while(1) { // Periodic: LED execution indicator @@ -136,7 +134,7 @@ int main(void) // Start getting values for next transmission if(slavesensors_isrequesting()) { - // TODO: something is terribly wrong. Timeout? + error_log_msg(ERROR_FATAL, false, "Still requesting on following loop"); } else {