Added uptime information

This commit is contained in:
Daniel Eichhorn
2017-07-09 21:50:53 +02:00
parent 4e177252c9
commit 7cc71bd49f

View File

@@ -508,7 +508,15 @@ void drawAbout() {
drawLabelValue(10, "Chip ID:", String(ESP.getChipId())); drawLabelValue(10, "Chip ID:", String(ESP.getChipId()));
drawLabelValue(11, "VCC: ", String(ESP.getVcc() / 1024.0) +"V"); drawLabelValue(11, "VCC: ", String(ESP.getVcc() / 1024.0) +"V");
drawLabelValue(12, "CPU Freq.: ", String(ESP.getCpuFreqMHz()) + "MHz"); 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.setTextAlignment(TEXT_ALIGN_LEFT);
gfx.setColor(MINI_YELLOW); gfx.setColor(MINI_YELLOW);
gfx.drawString(15, 250, "Last Reset: "); gfx.drawString(15, 250, "Last Reset: ");