start up messages
This commit is contained in:
parent
ae9331b5ae
commit
627656e7b6
@ -154,10 +154,10 @@ environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA
|
|||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.DTS/value=0
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.DTS/value=0
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/delimiter=\:
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/delimiter=\:
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/operation=replace
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/operation=replace
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/value=1457277262
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.LOCAL/value=1457279065
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/delimiter=\:
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/delimiter=\:
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/operation=replace
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/operation=replace
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/value=1457273662
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.UTC/value=1457275465
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/delimiter=\:
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/delimiter=\:
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/operation=replace
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/operation=replace
|
||||||
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/value=3600
|
environment/project/it.baeyens.arduino.core.toolChain.release.1898938335/A.EXTRA.TIME.ZONE/value=3600
|
||||||
|
@ -13,8 +13,12 @@ void setup() {
|
|||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
hmi.begin();
|
hmi.begin();
|
||||||
|
hmi.tft()->println("Starting up");
|
||||||
|
|
||||||
MqttClientNS::begin();
|
MqttClientNS::begin();
|
||||||
|
|
||||||
|
hmi.tft()->println("Running");
|
||||||
|
delay(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
1
hmi.cpp
1
hmi.cpp
@ -27,6 +27,7 @@ Hmi::Hmi() : m_tft(6, 9, 11, 13, -1, 12), // m_tft(LCD_CS, LCD_CD, LCD_WR, LCD_R
|
|||||||
void Hmi::begin() {
|
void Hmi::begin() {
|
||||||
m_tft.begin();
|
m_tft.begin();
|
||||||
m_tft.setRotation(1);
|
m_tft.setRotation(1);
|
||||||
|
m_tft.setTextSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hmi::updateMessage() {
|
void Hmi::updateMessage() {
|
||||||
|
1
hmi.h
1
hmi.h
@ -47,6 +47,7 @@ public:
|
|||||||
Hmi();
|
Hmi();
|
||||||
void begin();
|
void begin();
|
||||||
void exec();
|
void exec();
|
||||||
|
Print *tft() { return &m_tft; };
|
||||||
void updateMessage();
|
void updateMessage();
|
||||||
void updateMessage(uint8_t slot, char* header, char* body);
|
void updateMessage(uint8_t slot, char* header, char* body);
|
||||||
void toggleAlarmState(); // only for debug
|
void toggleAlarmState(); // only for debug
|
||||||
|
@ -84,20 +84,22 @@ void callback(char* topic, byte* payload, unsigned int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printWifiStatus() {
|
void printWifiStatus() {
|
||||||
|
char buffer[16];
|
||||||
|
|
||||||
// print the SSID of the network you're attached to:
|
// print the SSID of the network you're attached to:
|
||||||
Serial.print("SSID: ");
|
Serial << "SSID: " << WiFi.SSID() << endl;
|
||||||
Serial.println(WiFi.SSID());
|
*(hmi.tft()) << "SSID: " << WiFi.SSID() << endl;
|
||||||
|
|
||||||
|
|
||||||
// print your WiFi shield's IP address:
|
// print your WiFi shield's IP address:
|
||||||
IPAddress ip = WiFi.localIP();
|
IPAddress ip = WiFi.localIP();
|
||||||
Serial.print("IP Address: ");
|
Serial << "IP Address: " << ip << endl;
|
||||||
Serial.println(ip);
|
*(hmi.tft()) << "IP Address: " << ip << endl;
|
||||||
|
|
||||||
// print the received signal strength:
|
// print the received signal strength:
|
||||||
long rssi = WiFi.RSSI();
|
long rssi = WiFi.RSSI();
|
||||||
Serial.print("signal strength (RSSI):");
|
Serial << "signal strength (RSSI):" << rssi << " dBm" << endl;
|
||||||
Serial.print(rssi);
|
*(hmi.tft()) << "signal strength (RSSI):" << rssi << " dBm" << endl;
|
||||||
Serial.println(" dBm");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttClientNS::begin() {
|
void MqttClientNS::begin() {
|
||||||
@ -110,20 +112,22 @@ void MqttClientNS::begin() {
|
|||||||
if (wifiEnabled) {
|
if (wifiEnabled) {
|
||||||
// check for the presence of the shield:
|
// check for the presence of the shield:
|
||||||
if (WiFi.status() == WL_NO_SHIELD) {
|
if (WiFi.status() == WL_NO_SHIELD) {
|
||||||
Serial.println("WiFi shield not present");
|
Serial << "WiFi shield not present" << endl;
|
||||||
|
*(hmi.tft()) << "WiFi shield not present" << endl;
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int status = WL_IDLE_STATUS;
|
int status = WL_IDLE_STATUS;
|
||||||
while ( status != WL_CONNECTED) {
|
while ( status != WL_CONNECTED) {
|
||||||
Serial.print("Attempting to connect to SSID: ");
|
Serial << "Attempting to connect to SSID: " << ssid << endl;
|
||||||
Serial.println(ssid);
|
*(hmi.tft()) << "Attempting to connect to SSID: " << ssid << endl;
|
||||||
status = WiFi.begin(ssid, pass);
|
status = WiFi.begin(ssid, pass);
|
||||||
|
|
||||||
// wait 10 seconds for connection:
|
// wait 10 seconds for connection:
|
||||||
delay(10000);
|
delay(10000);
|
||||||
}
|
}
|
||||||
Serial.println("Connected.");
|
Serial << "Connected." << endl;
|
||||||
|
*(hmi.tft()) << "Connected." << endl;
|
||||||
|
|
||||||
printWifiStatus();
|
printWifiStatus();
|
||||||
|
|
||||||
@ -133,12 +137,12 @@ void MqttClientNS::begin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MqttClientNS::exec() {
|
void MqttClientNS::exec() {
|
||||||
// if (minute.check() == 1) {
|
// if (minute.check() == 1) {
|
||||||
// byte r = Ethernet.maintain();
|
// byte r = Ethernet.maintain();
|
||||||
// Serial << "Ethernet.maintain: " << r << endl;
|
// Serial << "Ethernet.maintain: " << r << endl;
|
||||||
// if ((r == DHCP_CHECK_REBIND_FAIL) || (r == DHCP_CHECK_RENEW_FAIL)) {
|
// if ((r == DHCP_CHECK_REBIND_FAIL) || (r == DHCP_CHECK_RENEW_FAIL)) {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if ((disconnectState == 0) && (! mqttClient.loop())) {
|
if ((disconnectState == 0) && (! mqttClient.loop())) {
|
||||||
disconnectState = 1;
|
disconnectState = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user