Latest

Dependencies:   serial_terminal sample_hardware PLL_Config SDCard BMP280 Networkbits TextLCD SDBlockDevice

Revision:
21:2c438eeaab14
Parent:
20:cdde0663c481
Child:
22:d9cbbbf3cf69
--- a/main.cpp	Mon Dec 17 17:51:14 2018 +0000
+++ b/main.cpp	Tue Dec 18 14:27:19 2018 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
 #include "sample_hardware.hpp"
-#include "Networkbits.hpp"
+#include "Networking.hpp"
 #include "serial_terminal.hpp"
 #include "SDCard.hpp"
 #include "rtos.h"
@@ -8,7 +8,7 @@
 #include "LCDdisplay.hpp"
 
 //Defines
-#define BUFFERSIZE 120
+//moved
 
 //Signals
 #define TAKE_SAMPLE 1
@@ -16,53 +16,6 @@
 
 //Global variables
 
-class sensorData
-{
-    private:
-        double temperature;
-        double pressure;
-        float lightlevel;
-        //time
-    public:
-        sensorData(void)
-        {
-            this->temperature = 0;
-            this->pressure = 0;
-            this->lightlevel = 0;
-        }
-        
-        void updatetemp(double t)
-        {
-            this->temperature = t;  
-        };
-        
-        void updatepress(double p)
-        {
-            this->pressure = p;
-        };
-        
-        void updatelight(float l)
-        {
-            this->lightlevel = l;
-        };
-        
-        double gettemp(void)
-        {
-           return this->temperature; 
-        };
-        
-        double getpress(void)
-        {
-          return this->pressure;  
-        };
-        
-        float getlight(void)
-        {
-          return this->lightlevel;  
-        };
-};
-
-
 unsigned int newestIndex = BUFFERSIZE-1;    //First time it is incremented, it will be 0
 unsigned int oldestIndex = BUFFERSIZE-1;
 FILE* fp;
@@ -117,7 +70,7 @@
     SDqueue_thread.start(callback(&SDqueue, &EventQueue::dispatch_forever));
     LCDqueue_thread.start(callback(&LCDqueue, &EventQueue::dispatch_forever));
     serial_thread.start(callback(&serialqueue, &EventQueue::dispatch_forever));
-    Network_thread.start(networktest);
+    Network_thread.start(network);
     producer_thread.start(sampleProducer);
     consumer_thread.start(sampleConsumer);
     
@@ -179,6 +132,8 @@
         buffer[newestIndex].updatetemp(sensor.getTemperature());
         buffer[newestIndex].updatepress(sensor.getPressure());
         buffer[newestIndex].updatelight(adcIn.read());
+        buffer[newestIndex].updateTime();
+        
         //bufferLock.unlock(); //normally here, moved due to updating queues.
         samplesInBuffer.release();