Added supercool new startup animation

This commit is contained in:
Kenneth van Ewijk
2014-10-20 14:22:35 +02:00
parent bdf9370934
commit 9270ace560
3 changed files with 46 additions and 30 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ public class LangsteZomerPeriode extends Grootheid{
private Periode zomerPeriode; private Periode zomerPeriode;
//constructor //constructor
public LangsteZomerPeriode(Measurement measurement1, ArrayList<Measurement> measurement2, Periode totalePeriode){ public LangsteZomerPeriode(Measurement measurement1, ArrayList<Measurement> measurement2){
list = new ArrayList<Double>(); list = new ArrayList<Double>();
zomerPeriode = new Periode(); zomerPeriode = new Periode();
updateRecent(measurement1); updateRecent(measurement1);
+1 -1
View File
@@ -20,7 +20,7 @@ public class MaximaleRegenPeriode extends Grootheid{
} }
public void display(){ public void display(){
GUIboard.writePageToMatrix("Periode met meeste regen", StatisticsCalculator.maximaleRegenPeriode(list) + "", ""); GUIboard.writePageToMatrix("Totale regenval", StatisticsCalculator.maximaleRegenPeriode(list) + "", "");
} }
public void displayGraph() public void displayGraph()
+44 -28
View File
@@ -1,5 +1,3 @@
package weerstation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -19,12 +17,18 @@ public class Weerstation {
boolean wait; boolean wait;
boolean graph; boolean graph;
boolean startup; boolean startup;
boolean startupState;
public Weerstation(){ public Weerstation(){
now = Calendar.getInstance(); now = Calendar.getInstance();
calPeriod = Calendar.getInstance(); calPeriod = Calendar.getInstance();
ArrayList<Periode> periods = new ArrayList<Periode>(); ArrayList<Periode> periods = new ArrayList<Periode>();
GUIboard.init();
startupState = true;
starter = new Timer();
startAnimatie();
calPeriod.add(Calendar.DATE, -1); calPeriod.add(Calendar.DATE, -1);
periods.add(new Periode(now, calPeriod)); periods.add(new Periode(now, calPeriod));
@@ -48,27 +52,11 @@ public class Weerstation {
System.out.println(periods.get(0)); System.out.println(periods.get(0));
GUIboard.init();
starter = new Timer();
startAnimatie();
weerstation1 = new WeerstationConnector(); weerstation1 = new WeerstationConnector();
meting1 = weerstation1.getMostRecentMeasurement(); meting1 = weerstation1.getMostRecentMeasurement();
meting2 = weerstation1.getAllMeasurementsBetween(periods.get(0).getBeginPeriode(), periods.get(0).getEindePeriode()); meting2 = weerstation1.getAllMeasurementsBetween(periods.get(0).getBeginPeriode(), periods.get(0).getEindePeriode());
startupState = false;
stopAnimatie();
while(startup)
{
try
{
Thread.sleep(1);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
currentScreen = 0; currentScreen = 0;
wait = true; wait = true;
@@ -78,7 +66,7 @@ public class Weerstation {
//All the different screen classes //All the different screen classes
final List<Grootheid> lstScreens = new ArrayList<Grootheid>(); final List<Grootheid> lstScreens = new ArrayList<Grootheid>();
// lstScreens.add(new LangsteZomerPeriode(meting1, meting2, periodeDag)); //lstScreens.add(new LangsteZomerPeriode(meting1, meting2));
lstScreens.add(new MaximaleRegenPeriode(meting1, meting2)); lstScreens.add(new MaximaleRegenPeriode(meting1, meting2));
lstScreens.add(new WindDirection(meting1, meting2)); lstScreens.add(new WindDirection(meting1, meting2));
lstScreens.add(new OutsideTemp(meting1, meting2)); lstScreens.add(new OutsideTemp(meting1, meting2));
@@ -95,6 +83,19 @@ public class Weerstation {
lstScreens.add(new DewPoint(meting1, meting2)); lstScreens.add(new DewPoint(meting1, meting2));
lstScreens.add(new Sun(meting1)); lstScreens.add(new Sun(meting1));
stopAnimatie();
while(startup)
{
try
{
Thread.sleep(1);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
//Screen switcher //Screen switcher
@@ -192,20 +193,35 @@ public class Weerstation {
startup = true; startup = true;
GUIboard.clearBottom(); GUIboard.clearBottom();
char[] charray;
for(int i=1; i<128;i+=2) if(startupState)
{ {
for(int n=0; n<32;n++) charray = new char[] {' ', ' ', ' ', ' ', ' ', 'C', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'n', 'g'};
{ }
IO.writeShort(0x42, 1 << 12 | i-1 << 5 | n); else
IO.writeShort(0x42, 1 << 12 | i << 5 | n); {
IO.delay(1); 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; startup = false;
} }
}, 0, 128*32); }, 0, 128*8 + 2);
} }
public void stopAnimatie() public void stopAnimatie()