mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2026-01-04 11:53:39 +01:00
Remove not required F() macro. Frees ~20kb flash.
This commit is contained in:
@@ -28,29 +28,29 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
|
||||
try {
|
||||
auto stream = request->beginResponseStream("text/plain; charset=utf-8", 40960);
|
||||
|
||||
stream->print(F("# HELP opendtu_build Build info\n"));
|
||||
stream->print(F("# TYPE opendtu_build gauge\n"));
|
||||
stream->print("# HELP opendtu_build Build info\n");
|
||||
stream->print("# TYPE opendtu_build gauge\n");
|
||||
stream->printf("opendtu_build{name=\"%s\",id=\"%s\",version=\"%d.%d.%d\"} 1\n",
|
||||
NetworkSettings.getHostname().c_str(), AUTO_GIT_HASH, CONFIG_VERSION >> 24 & 0xff, CONFIG_VERSION >> 16 & 0xff, CONFIG_VERSION >> 8 & 0xff);
|
||||
|
||||
stream->print(F("# HELP opendtu_platform Platform info\n"));
|
||||
stream->print(F("# TYPE opendtu_platform gauge\n"));
|
||||
stream->print("# HELP opendtu_platform Platform info\n");
|
||||
stream->print("# TYPE opendtu_platform gauge\n");
|
||||
stream->printf("opendtu_platform{arch=\"%s\",mac=\"%s\"} 1\n", ESP.getChipModel(), NetworkSettings.macAddress().c_str());
|
||||
|
||||
stream->print(F("# HELP opendtu_uptime Uptime in seconds\n"));
|
||||
stream->print(F("# TYPE opendtu_uptime counter\n"));
|
||||
stream->print("# HELP opendtu_uptime Uptime in seconds\n");
|
||||
stream->print("# TYPE opendtu_uptime counter\n");
|
||||
stream->printf("opendtu_uptime %lld\n", esp_timer_get_time() / 1000000);
|
||||
|
||||
stream->print(F("# HELP opendtu_heap_size System memory size\n"));
|
||||
stream->print(F("# TYPE opendtu_heap_size gauge\n"));
|
||||
stream->print("# HELP opendtu_heap_size System memory size\n");
|
||||
stream->print("# TYPE opendtu_heap_size gauge\n");
|
||||
stream->printf("opendtu_heap_size %zu\n", ESP.getHeapSize());
|
||||
|
||||
stream->print(F("# HELP opendtu_free_heap_size System free memory\n"));
|
||||
stream->print(F("# TYPE opendtu_free_heap_size gauge\n"));
|
||||
stream->print("# HELP opendtu_free_heap_size System free memory\n");
|
||||
stream->print("# TYPE opendtu_free_heap_size gauge\n");
|
||||
stream->printf("opendtu_free_heap_size %zu\n", ESP.getFreeHeap());
|
||||
|
||||
stream->print(F("# HELP wifi_rssi WiFi RSSI\n"));
|
||||
stream->print(F("# TYPE wifi_rssi gauge\n"));
|
||||
stream->print("# HELP wifi_rssi WiFi RSSI\n");
|
||||
stream->print("# TYPE wifi_rssi gauge\n");
|
||||
stream->printf("wifi_rssi %d\n", WiFi.RSSI());
|
||||
|
||||
for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) {
|
||||
@@ -59,8 +59,8 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
|
||||
String serial = inv->serialString();
|
||||
const char* name = inv->name();
|
||||
if (i == 0) {
|
||||
stream->print(F("# HELP opendtu_last_update last update from inverter in s\n"));
|
||||
stream->print(F("# TYPE opendtu_last_update gauge\n"));
|
||||
stream->print("# HELP opendtu_last_update last update from inverter in s\n");
|
||||
stream->print("# TYPE opendtu_last_update gauge\n");
|
||||
}
|
||||
stream->printf("opendtu_last_update{serial=\"%s\",unit=\"%d\",name=\"%s\"} %d\n",
|
||||
serial.c_str(), i, name, inv->Statistics()->getLastUpdate() / 1000);
|
||||
@@ -92,7 +92,7 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
|
||||
}
|
||||
}
|
||||
}
|
||||
stream->addHeader(F("Cache-Control"), F("no-cache"));
|
||||
stream->addHeader("Cache-Control", "no-cache");
|
||||
request->send(stream);
|
||||
|
||||
} catch (std::bad_alloc& bad_alloc) {
|
||||
@@ -131,8 +131,8 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
|
||||
|
||||
const bool printHelp = (idx == 0 && channel == 0);
|
||||
if (printHelp) {
|
||||
stream->print(F("# HELP opendtu_PanelInfo panel information\n"));
|
||||
stream->print(F("# TYPE opendtu_PanelInfo gauge\n"));
|
||||
stream->print("# HELP opendtu_PanelInfo panel information\n");
|
||||
stream->print("# TYPE opendtu_PanelInfo gauge\n");
|
||||
}
|
||||
stream->printf("opendtu_PanelInfo{serial=\"%s\",unit=\"%d\",name=\"%s\",channel=\"%d\",panelname=\"%s\"} 1\n",
|
||||
serial.c_str(),
|
||||
@@ -143,8 +143,8 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
|
||||
);
|
||||
|
||||
if (printHelp) {
|
||||
stream->print(F("# HELP opendtu_MaxPower panel maximum output power\n"));
|
||||
stream->print(F("# TYPE opendtu_MaxPower gauge\n"));
|
||||
stream->print("# HELP opendtu_MaxPower panel maximum output power\n");
|
||||
stream->print("# TYPE opendtu_MaxPower gauge\n");
|
||||
}
|
||||
stream->printf("opendtu_MaxPower{serial=\"%s\",unit=\"%d\",name=\"%s\",channel=\"%d\"} %d\n",
|
||||
serial.c_str(),
|
||||
@@ -155,8 +155,8 @@ void WebApiPrometheusClass::addPanelInfo(AsyncResponseStream* stream, String& se
|
||||
);
|
||||
|
||||
if (printHelp) {
|
||||
stream->print(F("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n"));
|
||||
stream->print(F("# TYPE opendtu_YieldTotalOffset gauge\n"));
|
||||
stream->print("# HELP opendtu_YieldTotalOffset panel yield offset (for used inverters)\n");
|
||||
stream->print("# TYPE opendtu_YieldTotalOffset gauge\n");
|
||||
}
|
||||
stream->printf("opendtu_YieldTotalOffset{serial=\"%s\",unit=\"%d\",name=\"%s\",channel=\"%d\"} %f\n",
|
||||
serial.c_str(),
|
||||
|
||||
Reference in New Issue
Block a user