3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
Diff: CircularArray/CircularArray.cpp
- Revision:
- 82:668b51a39148
- Parent:
- 81:996c0a3319b4
- Child:
- 83:0d3572a8a851
diff -r 996c0a3319b4 -r 668b51a39148 CircularArray/CircularArray.cpp --- a/CircularArray/CircularArray.cpp Thu May 11 14:34:53 2017 +0000 +++ b/CircularArray/CircularArray.cpp Thu May 11 15:53:15 2017 +0000 @@ -34,8 +34,15 @@ if(x > currentSize) { x = currentSize; - logger->SendMessage("Changed print amount to currentSize\n\r"); + snprintf(temp2, 256, "Not enough measurements taken. Printing all %i measurement(s): \r\n", x); } + else + { + snprintf(temp2, 256, "Printing %i measurement(s): \r\n", x); + } + + logger->SendMessage(temp2); + int currentElement = nextSpace() - x; if(currentElement < 0) { @@ -46,7 +53,7 @@ for(int i = 0; i < x; i++) { ptr = array[currentElement].date.ToString(); - snprintf(temp2, 256, "%i. %s T: %f | H: %f | P: %f |\n\r",i + 1,ptr , array[currentElement].temperature, array[currentElement].humidity, array[currentElement].pressure); + snprintf(temp2, 256, "%i. %s, T: %f, H: %f, P: %f\n\r",i + 1,ptr , array[currentElement].temperature, array[currentElement].humidity, array[currentElement].pressure); logger->SendMessage(temp2); currentElement++; currentElement = currentElement % maxSize; @@ -54,6 +61,8 @@ } void CircularArray::readAll() { + logger->SendMessage("Printing all measurementss performed so far: \r\n"); + readX(currentSize); } void CircularArray::deleteX(int x) @@ -71,7 +80,10 @@ } void CircularArray::deleteAll() { + snprintf(temp2, 256, "Deleted %i records.", currentSize); + logger->SendMessage(temp2); currentSize = 0; + } int CircularArray::getSize() {