فهرست منبع

Added Animation

Kenneth van Ewijk 11 سال پیش
والد
کامیت
8e807b3660
1فایلهای تغییر یافته به همراه49 افزوده شده و 1 حذف شده
  1. 49 1
      Weerstation.java

+ 49 - 1
Weerstation.java

@@ -9,18 +9,39 @@ public class Weerstation {
     WeerstationConnector weerstation1;
     Measurement meting1;
     ArrayList<Measurement> meting2;
+    Timer starter;
     int currentScreen;
     boolean wait;
     boolean graph;
+    boolean startup;
     
     public Weerstation(){
         weerstation1 = new WeerstationConnector();
+        
+        GUIboard.init();
+        starter = new Timer();
+        startAnimatie();
+        
         meting1 = weerstation1.getMostRecentMeasurement();
         meting2 = weerstation1.getAllMeasurementsLast24h();
+        
+        stopAnimatie();
+        while(startup)
+        {
+            try
+            {
+                Thread.sleep(1);
+            }
+            catch(InterruptedException e)
+            {
+                e.printStackTrace();
+            }
+        }
+        
+        
         currentScreen = 0;
         wait = true;
         graph = false;
-        IO.init();
         Timer timer = new Timer();
 
         //All the different screen classes
@@ -129,4 +150,31 @@ public class Weerstation {
         }, 0, 100);
         
     }
+    
+    public void startAnimatie()
+    {
+        starter.scheduleAtFixedRate(new TimerTask() {
+            public void run() {
+                startup = true;
+                
+                GUIboard.clearBottom();
+                
+                for(int i=0; i<128;i++)
+                {
+                    for(int n=0; n<32;n++)
+                    {
+                        IO.writeShort(0x42, 1 << 12 | i << 5 | n);
+                        IO.delay(1);
+                    }
+                }
+                
+                startup = false;
+            }
+        }, 0, 64*2);
+    }
+    
+    public void stopAnimatie()
+    {
+        starter.cancel();
+    }
 }