Skip to content

Commit 722b618

Browse files
authored
Add IP information to 'About' screen and console (#138)
1 parent cc2c701 commit 722b618

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

esp8266-weather-station-color.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ void connectWifi() {
147147
}
148148
drawProgress(100, "Connected to WiFi '" + String(WIFI_SSID.c_str()) + "'");
149149
Serial.println("connected.");
150+
Serial.printf("Connected, IP address: %s/%s\n", WiFi.localIP().toString().c_str(), WiFi.subnetMask().toString().c_str()); //Get ip and subnet mask
151+
Serial.printf("Connected, MAC address: %s\n", WiFi.macAddress().c_str()); //Get the local mac address
150152
}
151153

152154
void initTime() {
@@ -633,11 +635,12 @@ void drawAbout() {
633635
uint8_t minutes = (millis() - (days * millis_in_day) - (hours * millis_in_hour)) / millis_in_minute;
634636
sprintf(time_str, "%2dd%2dh%2dm", days, hours, minutes);
635637
drawLabelValue(13, "Uptime: ", time_str);
638+
drawLabelValue(14, "IP Address: ", WiFi.localIP().toString());
636639
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
637640
gfx.setColor(MINI_YELLOW);
638-
gfx.drawString(15, 250, "Last Reset: ");
641+
gfx.drawString(15, 280, "Last Reset: ");
639642
gfx.setColor(MINI_WHITE);
640-
gfx.drawStringMaxWidth(15, 265, 240 - 2 * 15, ESP.getResetInfo());
643+
gfx.drawStringMaxWidth(15, 295, 240 - 2 * 15, ESP.getResetInfo());
641644
}
642645

643646
void calibrationCallback(int16_t x, int16_t y) {

0 commit comments

Comments
 (0)