MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / getStats

Method getStats

src/DisplayManager.cpp:1636–1672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1634}
1635
1636String DisplayManager_::getStats()
1637{
1638 StaticJsonDocument<1024> doc;
1639 char buffer[20];
1640
1641#ifdef awtrix2_upgrade
1642 doc[F("type")] = 1;
1643#else
1644 doc[BatKey] = BATTERY_PERCENT;
1645 doc[BatRawKey] = BATTERY_RAW;
1646 doc[F("type")] = 0;
1647#endif
1648 doc[LuxKey] = static_cast<int>(CURRENT_LUX);
1649 doc[LDRRawKey] = LDR_RAW;
1650 doc[RamKey] = ESP.getFreeHeap() + ESP.getFreePsram();
1651 doc[BrightnessKey] = BRIGHTNESS;
1652 if (SENSOR_READING)
1653 {
1654 double formattedTemp = roundToDecimalPlaces(CURRENT_TEMP, TEMP_DECIMAL_PLACES);
1655 doc[TempKey] = formattedTemp;
1656 doc[HumKey] = static_cast<uint8_t>(CURRENT_HUM);
1657 }
1658 doc[UpTimeKey] = PeripheryManager.readUptime();
1659 doc[SignalStrengthKey] = WiFi.RSSI();
1660 doc[MessagesKey] = RECEIVED_MESSAGES;
1661 doc[VersionKey] = VERSION;
1662 doc[F("indicator1")] = ui->indicator1State;
1663 doc[F("indicator2")] = ui->indicator2State;
1664 doc[F("indicator3")] = ui->indicator3State;
1665 doc[F("app")] = CURRENT_APP;
1666 doc[F("uid")] = uniqueID;
1667 doc[F("matrix")] = !MATRIX_OFF;
1668 doc[IpAddrKey] = WiFi.localIP();
1669 String jsonString;
1670 serializeJson(doc, jsonString);
1671 return jsonString;
1672}
1673
1674void DisplayManager_::setMatrixLayout(int layout)
1675{

Callers 2

sendStatsMethod · 0.80
addHandlerFunction · 0.80

Calls 2

roundToDecimalPlacesFunction · 0.85
readUptimeMethod · 0.80

Tested by

no test coverage detected