Added battery icon

This commit is contained in:
Kenneth van Ewijk
2014-10-27 17:45:39 +01:00
parent 9c4d62736c
commit bee6773ee7
7 changed files with 90 additions and 19 deletions
+77 -4
View File
@@ -157,10 +157,11 @@ public class GUIboard {
* @param regel2 De tekst die je op de tweede regel wilt weergeven.
* @param regel3 De tekst die je op de derde regel wilt weergeven. Wordt standaard gevolgd door de navigatie.
*/
public static boolean writePageToMatrix(String regel1, String regel2, String regel3, Boolean pPeriod, Boolean pScreen)
public static boolean writePageToMatrix(String regel1, String regel2, String regel3, boolean pPeriod, boolean pScreen, double batt)
{
clearBottom();
if(regel1.length() > 20 && regel2.length() > 20 && regel3.length() > 11) //check if the length is not to long
regel3 = " " + regel3;
if(regel1.length() > 20 && regel2.length() > 20 && regel3.length() > 12) //check if the length is not to long
{
return false;
}
@@ -203,7 +204,80 @@ public class GUIboard {
IO.writeShort(0x40, ch);
}
createNav(pPeriod, pScreen);
createBattery(batt);
return true;
}
private static void createBattery(double batt)
{
//Left
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 28);
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 27);
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 26);
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 25);
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 24);
IO.writeShort(0x42, 1 << 12 | 3 << 5 | 23);
//Right
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 28);
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 27);
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 26);
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 25);
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 24);
IO.writeShort(0x42, 1 << 12 | 7 << 5 | 23);
//Bottom
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 28);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 28);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 28);
//Top
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 22);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 22);
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 21);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 21);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 21);
if(batt > 1.0)
{
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 27);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 27);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 27);
}
if(batt > 2.0)
{
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 26);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 26);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 26);
}
if(batt > 3.0)
{
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 25);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 25);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 25);
}
if(batt > 4.0)
{
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 24);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 24);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 24);
}
if(batt > 4.8)
{
IO.writeShort(0x42, 1 << 12 | 4 << 5 | 23);
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 23);
IO.writeShort(0x42, 1 << 12 | 6 << 5 | 23);
}
if(batt > 5.0)
{
IO.writeShort(0x42, 1 << 12 | 5 << 5 | 22);
}
}
private static void createNav(boolean pPeriod, boolean pScreen)
{
//Draw the play/pause
if(pPeriod)
{
@@ -322,10 +396,9 @@ public class GUIboard {
IO.writeShort(0x42, 1 << 12 | 122 << 5 | 28);
IO.writeShort(0x42, 1 << 12 | 122 << 5 | 26);
return true;
}
/**
* Schrijft een grafiek naar het matrix display van het GUIBoard
*
+2 -2
View File
@@ -19,8 +19,8 @@ public class GraadDagen extends Grootheid{
graadDagen = StatisticsCalculator.graadDagen(list);
}
public void display(String periode, boolean knop1, boolean knop2){
GUIboard.writePageToMatrix("Aantal Graaddagen", graadDagen + "", periode, knop1, knop2);
public void display(String periode, boolean knop1, boolean knop2, short batt){
GUIboard.writePageToMatrix("Aantal Graaddagen", graadDagen + "", periode, knop1, knop2, batt);
}
public void displayGraph(){}
+4 -4
View File
@@ -124,7 +124,7 @@ public class Grootheid
}
public void display(String periodname, boolean p, boolean s){
public void display(String periodname, boolean p, boolean s, double batt){
GUIboard.clearLeft();
GUIboard.clearRight();
GUIboard.clearTop();
@@ -139,13 +139,13 @@ public class Grootheid
}
if(!(statics_name == "")){
GUIboard.writePageToMatrix(getName(), statics_name + getStatics(), periodname, p, s);
GUIboard.writePageToMatrix(getName(), statics_name + getStatics(), periodname, p, s, batt);
}else if(!(custom == "")){
GUIboard.writePageToMatrix(getName(), custom, periodname, p, s);
GUIboard.writePageToMatrix(getName(), custom, periodname, p, s, batt);
}
if(!(period == null)){
GUIboard.writePageToMatrix(getName(), period.toString(), periodname, p, s);
GUIboard.writePageToMatrix(getName(), period.toString(), periodname, p, s, batt);
}
}
+2 -2
View File
@@ -15,8 +15,8 @@ public class LangsteDroogstePeriode extends Grootheid{
langstePeriode = StatisticsCalculator.langsteDroogstePeriode(list);
}
public void display(String periode, boolean knop1, boolean knop2){
GUIboard.writePageToMatrix("Langste Droge Periode", langstePeriode + "", periode, knop1, knop2);
public void display(String periode, boolean knop1, boolean knop2, short batt){
GUIboard.writePageToMatrix("Langste Droge Periode", langstePeriode + "", periode, knop1, knop2, batt);
}
public void displayGraph(){}
+2 -2
View File
@@ -18,9 +18,9 @@ public class LangsteRegenPeriode extends Grootheid{
regenPeriode = Calculator.timeStampToPeriode( measurement2.get(index[0]).getDateStamp(), measurement2.get(index[1]).getDateStamp());
}
public void display(String periode, boolean knop1, boolean knop2)
public void display(String periode, boolean knop1, boolean knop2, short batt)
{
GUIboard.writePageToMatrix("Langste Regen Periode", regenPeriode.toString(), periode, knop1, knop2);
GUIboard.writePageToMatrix("Langste Regen Periode", regenPeriode.toString(), periode, knop1, knop2, batt);
}
public void displayGraph(){}
+2 -2
View File
@@ -22,9 +22,9 @@ public class LangsteTempStijgingPeriode extends Grootheid
StijgingPeriode= Calculator.timeStampToPeriode( measurement2.get(index[0]).getDateStamp(), measurement2.get(index[1]).getDateStamp());
}
public void display()
public void display(String periode, boolean button1, boolean button2, double batt)
{
GUIboard.writePageToMatrix("Langste temp.stijging", StijgingPeriode.toString(), "", true, true);
GUIboard.writePageToMatrix("Langste temp.stijging", StijgingPeriode.toString(), periode, button1, button2, batt);
}
public void displayGraph(){}
+1 -3
View File
@@ -1,6 +1,4 @@
package weerstation1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;