diff --git a/esp8266-weather-station-color.ino b/esp8266-weather-station-color.ino index 917e083..a998846 100644 --- a/esp8266-weather-station-color.ino +++ b/esp8266-weather-station-color.ino @@ -508,7 +508,15 @@ void drawAbout() { drawLabelValue(10, "Chip ID:", String(ESP.getChipId())); drawLabelValue(11, "VCC: ", String(ESP.getVcc() / 1024.0) +"V"); drawLabelValue(12, "CPU Freq.: ", String(ESP.getCpuFreqMHz()) + "MHz"); - drawLabelValue(13, "Uptime: ", String(millis() / 1000) + "s"); + char time_str[15]; + const uint32_t millis_in_day = 1000 * 60 * 60 * 24; + const uint32_t millis_in_hour = 1000 * 60 * 60; + const uint32_t millis_in_minute = 1000 * 60; + uint8_t days = millis() / (millis_in_day); + uint8_t hours = (millis() - (days * millis_in_day)) / millis_in_hour; + uint8_t minutes = (millis() - (days * millis_in_day) - (hours * millis_in_hour)) / millis_in_minute; + sprintf(time_str, "%2dd%2dh%2dm", days, hours, minutes); + drawLabelValue(13, "Uptime: ", time_str); gfx.setTextAlignment(TEXT_ALIGN_LEFT); gfx.setColor(MINI_YELLOW); gfx.drawString(15, 250, "Last Reset: ");