From 9270ace5601bfad8f0e690bd4347efb2f38687da Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Mon, 20 Oct 2014 14:22:35 +0200 Subject: [PATCH] Added supercool new startup animation --- LangsteZomerPeriode.java | 2 +- MaximaleRegenPeriode.java | 2 +- Weerstation.java | 72 ++++++++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/LangsteZomerPeriode.java b/LangsteZomerPeriode.java index ab8ed26..79cd8c2 100644 --- a/LangsteZomerPeriode.java +++ b/LangsteZomerPeriode.java @@ -5,7 +5,7 @@ public class LangsteZomerPeriode extends Grootheid{ private Periode zomerPeriode; //constructor - public LangsteZomerPeriode(Measurement measurement1, ArrayList measurement2, Periode totalePeriode){ + public LangsteZomerPeriode(Measurement measurement1, ArrayList measurement2){ list = new ArrayList(); zomerPeriode = new Periode(); updateRecent(measurement1); diff --git a/MaximaleRegenPeriode.java b/MaximaleRegenPeriode.java index 3a3d226..73295e4 100644 --- a/MaximaleRegenPeriode.java +++ b/MaximaleRegenPeriode.java @@ -20,7 +20,7 @@ public class MaximaleRegenPeriode extends Grootheid{ } public void display(){ - GUIboard.writePageToMatrix("Periode met meeste regen", StatisticsCalculator.maximaleRegenPeriode(list) + "", ""); + GUIboard.writePageToMatrix("Totale regenval", StatisticsCalculator.maximaleRegenPeriode(list) + "", ""); } public void displayGraph() diff --git a/Weerstation.java b/Weerstation.java index a0f9f04..909386b 100644 --- a/Weerstation.java +++ b/Weerstation.java @@ -1,5 +1,3 @@ -package weerstation; - import java.util.ArrayList; import java.util.List; @@ -19,12 +17,18 @@ public class Weerstation { boolean wait; boolean graph; boolean startup; + boolean startupState; public Weerstation(){ now = Calendar.getInstance(); calPeriod = Calendar.getInstance(); ArrayList periods = new ArrayList(); + GUIboard.init(); + startupState = true; + starter = new Timer(); + startAnimatie(); + calPeriod.add(Calendar.DATE, -1); periods.add(new Periode(now, calPeriod)); @@ -48,27 +52,11 @@ public class Weerstation { System.out.println(periods.get(0)); - GUIboard.init(); - starter = new Timer(); - startAnimatie(); - weerstation1 = new WeerstationConnector(); meting1 = weerstation1.getMostRecentMeasurement(); meting2 = weerstation1.getAllMeasurementsBetween(periods.get(0).getBeginPeriode(), periods.get(0).getEindePeriode()); - - stopAnimatie(); - while(startup) - { - try - { - Thread.sleep(1); - } - catch(InterruptedException e) - { - e.printStackTrace(); - } - } + startupState = false; currentScreen = 0; wait = true; @@ -78,7 +66,7 @@ public class Weerstation { //All the different screen classes final List lstScreens = new ArrayList(); - // lstScreens.add(new LangsteZomerPeriode(meting1, meting2, periodeDag)); + //lstScreens.add(new LangsteZomerPeriode(meting1, meting2)); lstScreens.add(new MaximaleRegenPeriode(meting1, meting2)); lstScreens.add(new WindDirection(meting1, meting2)); lstScreens.add(new OutsideTemp(meting1, meting2)); @@ -95,6 +83,19 @@ public class Weerstation { lstScreens.add(new DewPoint(meting1, meting2)); lstScreens.add(new Sun(meting1)); + stopAnimatie(); + while(startup) + { + try + { + Thread.sleep(1); + } + catch(InterruptedException e) + { + e.printStackTrace(); + } + } + //Screen switcher @@ -192,20 +193,35 @@ public class Weerstation { startup = true; GUIboard.clearBottom(); + char[] charray; - for(int i=1; i<128;i+=2) + if(startupState) { - for(int n=0; n<32;n++) - { - IO.writeShort(0x42, 1 << 12 | i-1 << 5 | n); - IO.writeShort(0x42, 1 << 12 | i << 5 | n); - IO.delay(1); - } + charray = new char[] {' ', ' ', ' ', ' ', ' ', 'C', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'n', 'g'}; + } + else + { + charray = new char[]{' ', ' ', ' ', ' ', ' ', 'C', 'a', 'l', 'c', 'u', 'l', 'a', 't', 'i', 'n', 'g'}; + } + + for(char ch : charray) + { + IO.writeShort(0x40, ch); + } + + for(int i=1; i<128;i++) + { + //for(int n=0; n<32;n++) + //{ + //IO.writeShort(0x42, 1 << 12 | i-1 << 5 | n); + IO.writeShort(0x42, 1 << 12 | i << 5 | 20); + IO.delay(8); + //} } startup = false; } - }, 0, 128*32); + }, 0, 128*8 + 2); } public void stopAnimatie()