Updated main app
This commit is contained in:
parent
94c550c4e0
commit
a73ea65328
@ -8,37 +8,45 @@ SAB sab;
|
|||||||
unsigned long currentMs = 0, batteryMs = 0, buttonMs = 0;
|
unsigned long currentMs = 0, batteryMs = 0, buttonMs = 0;
|
||||||
int mySize = 0;
|
int mySize = 0;
|
||||||
unsigned char curView = 0;
|
unsigned char curView = 0;
|
||||||
DateTimePacket dtp = {sab.getRtcManager().getDateTime(), sab.getSdCardManager().getSize(GBYTE), sab.getPowerInfo()};
|
View1Packet v1p = {sab.getRtcManager().getDateTime(), sab.getSdCardManager().getSize(GBYTE), sab.getPowerInfo()};
|
||||||
|
ViewAPPacket vap = {sab.getConnectivityManager().softAPmacAddress(), sab.getConnectivityManager().softAPSSID(), sab.getConnectivityManager().softAPIP(), sab.getConnectivityManager().softAPgetStationNum()};
|
||||||
|
|
||||||
void setup() {
|
void setup()
|
||||||
|
{
|
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
Serial.println("Starting setup");
|
Serial.println("Starting setup");
|
||||||
pinMode(GPIO_0, INPUT);
|
pinMode(GPIO_0, INPUT);
|
||||||
sab.getScreenManager().addView(&(view_1), &dtp, 0);
|
sab.getScreenManager().addView(&(view_1), &v1p, 0);
|
||||||
sab.getScreenManager().addView(&(view_2), NULL, 1);
|
sab.getScreenManager().addView(&(view_2), &vap, 1);
|
||||||
|
sab.getScreenManager().addView(&(view_3), NULL, 2);
|
||||||
/*Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(GBYTE));
|
|
||||||
Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(GBIT));
|
|
||||||
Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(MBYTE));
|
|
||||||
Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(MBIT));
|
|
||||||
Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(KBYTE));
|
|
||||||
Serial.print("SD size : ");Serial.println(sab.getSdCardManager().getSize(KBIT));*/
|
|
||||||
sab.getScreenManager().displayView(curView);
|
sab.getScreenManager().displayView(curView);
|
||||||
|
if(sab.getRtcManager().hasLostPower())
|
||||||
|
{
|
||||||
|
Serial.println("Clock lost power");
|
||||||
|
sab.getRtcManager().setDateTime(DateTime(F(__DATE__), F(__TIME__)));
|
||||||
|
}
|
||||||
|
|
||||||
Serial.println("End setup");
|
Serial.println("End setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
|
{
|
||||||
|
|
||||||
if(millis() - currentMs > 1000)
|
if(millis() - currentMs > 1000)
|
||||||
{
|
{
|
||||||
currentMs = millis();
|
currentMs = millis();
|
||||||
dtp.dateTime = sab.getRtcManager().getDateTime();
|
v1p.dateTime = sab.getRtcManager().getDateTime();
|
||||||
|
vap.ipAddr = sab.getConnectivityManager().softAPIP();
|
||||||
|
vap.macAddr = sab.getConnectivityManager().softAPmacAddress();
|
||||||
|
vap.nbOfCon = sab.getConnectivityManager().softAPgetStationNum();
|
||||||
|
|
||||||
sab.getScreenManager().displayView();
|
sab.getScreenManager().displayView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(millis() - batteryMs > 10000)
|
if(millis() - batteryMs > 10000)
|
||||||
{
|
{
|
||||||
batteryMs = millis();
|
batteryMs = millis();
|
||||||
dtp.powerInfo = sab.getPowerInfo();
|
v1p.powerInfo = sab.getPowerInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,9 +54,8 @@ void loop() {
|
|||||||
{
|
{
|
||||||
buttonMs = millis();
|
buttonMs = millis();
|
||||||
Serial.println("Changing view");
|
Serial.println("Changing view");
|
||||||
//sab.getRtcManager().setDateTime(DateTime(2019,3,9,19,34,0));
|
|
||||||
curView++;
|
curView++;
|
||||||
curView %= 2;
|
curView %= 3;
|
||||||
sab.getScreenManager().displayView(curView);
|
sab.getScreenManager().displayView(curView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user