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