3rd Repo, trying to figure this out.

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

Revision:
81:996c0a3319b4
Parent:
80:959151952153
Child:
82:668b51a39148
--- a/CircularArray/CircularArray.cpp	Wed May 10 10:02:22 2017 +0000
+++ b/CircularArray/CircularArray.cpp	Thu May 11 14:34:53 2017 +0000
@@ -4,13 +4,14 @@
 /*
     Constructor
 */
-CircularArray::CircularArray(int limit)
+CircularArray::CircularArray(int limit, MessageLogger *newLogger)
 {
     maxSize = limit;
     array = new Measure[maxSize];
     firstValue = 0;
     currentSize = 0;
-}
+    logger = newLogger;
+}        
 void CircularArray::pushValue(Measure _measure)
 {
     if(currentSize >= maxSize)
@@ -27,13 +28,13 @@
 {
     return array[firstValue];
 }
-
+char temp2[256];
 void CircularArray::readX(int x)
 {
     if(x > currentSize)
     {
         x = currentSize;
-        printf("Changed print amount to currentSize");
+        logger->SendMessage("Changed print amount to currentSize\n\r");
     }
     int currentElement = nextSpace() - x;
     if(currentElement < 0)
@@ -45,7 +46,8 @@
     for(int i = 0; i < x; i++)
     {
         ptr = array[currentElement].date.ToString();
-        printf("\n\r%i. %s T: %f | H: %f | P: %f |",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; 
     }