FINAL PROJECT isn't it

Fork of ELEC351 by Plymouth ELEC351 Group T

Revision:
35:26b0a9b55d82
Parent:
34:c0b8705f183d
Child:
36:a0098306fc58
--- a/main.cpp	Sun Jan 07 03:08:00 2018 +0000
+++ b/main.cpp	Sun Jan 07 13:32:54 2018 +0000
@@ -11,12 +11,18 @@
 */
 
 #include "SETUP.hpp"
+#include "NETWORK.hpp"
 
 Mutex Time_Lock_Main;
-
-void Network()                                                                  //Interrupt service routine for handling the timeout
+ 
+void Network()
 {
-
+    while(1)
+    {
+        Thread::wait(5000);//Waits 5 seconds
+        cout << "In Network Thread" << endl;
+        Networking();//Prints the network data   
+    }
 }
 void LCD_Write_Year()
 {
@@ -121,7 +127,7 @@
         { 
             if(Log_Value == 1){cout << "In mode 0 " << endl;}
             
-            Thread::wait(3000);
+            Thread::wait(Default_Mode_Toggle_Time);
     
             sprintf (LCD_buffer, "%1.1f %1.1f %1.1f",Data_Active.get_temperature(),Data_Active.get_pressure(),Data_Active.get_light());//Used for converting to a sting  
              
@@ -130,7 +136,7 @@
             LCD.DDRAM_Address(0x40);
             LCD.Write_String(LCD_buffer);
 
-            Thread::wait(3000);    
+            Thread::wait(Default_Mode_Toggle_Time);    
             
             Time_Lock_Main.lock();
             time_t Time = Data_Active.get_time();
@@ -314,7 +320,7 @@
         }
         else
         {
-            mode == 0;
+            mode = 0;
         }
     }
 }
@@ -341,12 +347,12 @@
         } 
         else if(Serial_Input == "DELETEALL")
         {   
-        Sampling_Timer.detach();
-        Console_Output_Timer.detach();
-        for (int x = 0; x < mailsize; x++)
-        {
-
-        }
+            Sampling_Timer.detach();
+            Console_Output_Timer.detach();
+            for (int x = 0; x < mailsize; x++)
+            {
+    
+            }
         Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);
         cout << "Sampling Restarted" << endl;
         } 
@@ -492,12 +498,12 @@
     }
     //Last message before sampling begins
     LCD.Display_Clear();
-    LCD.Write_String("Ready Player");
+    LCD.Write_String("READY     PLAYER");
     LCD.DDRAM_Address(0x40);
-    LCD.Write_String("One");
+    LCD.Write_String("      One     ");
     LCD.DDRAM_Address(0x00);
 
-
+    Network_Init();//Sets up the network
     Sample_Rate = TimerInterval;
     //Run interrupt
     Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);
@@ -505,7 +511,7 @@
     t1.start(Sample);
     t2.start(Serial_Comms);
     t3.start(LCD_Output);
-    //t4.start(Network);
+    t4.start(Network);
     t5.start(Serial_Commands);
 
     //Main thread ID