start up messages
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user