diff --git a/src/web/RestApi.h b/src/web/RestApi.h index f3ca6bc9..eaa18a0f 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -103,8 +103,10 @@ class RestApi { else if(path == "setup/getip") getIp(root); #endif /* !defined(ETHERNET) */ else if(path == "live") getLive(request,root); + #if defined(ENABLE_HISTORY) else if (path == "powerHistory") getPowerHistory(request, root, HistoryStorageType::POWER); else if (path == "powerHistoryDay") getPowerHistory(request, root, HistoryStorageType::POWER_DAY); + #endif /*ENABLE_HISTORY*/ else { if(path.substring(0, 12) == "inverter/id/") getInverter(root, request->url().substring(17).toInt()); @@ -927,9 +929,9 @@ class RestApi { } } + #if defined(ENABLE_HISTORY) void getPowerHistory(AsyncWebServerRequest *request, JsonObject obj, HistoryStorageType type) { getGeneric(request, obj.createNestedObject(F("generic"))); - #if defined(ENABLE_HISTORY) obj[F("refresh")] = mApp->getHistoryPeriod(static_cast(type)); uint16_t max = 0; @@ -954,12 +956,12 @@ class RestApi { } obj[F("lastValueTs")] = mApp->getHistoryLastValueTs(static_cast(type)); - #endif /*ENABLE_HISTORY*/ } + #endif /*ENABLE_HISTORY*/ - /*void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { - //getGeneric(request, obj.createNestedObject(F("generic"))); - #if defined(ENABLE_HISTORY) && defined(ENABLE_HISTORY_YIELD_PER_DAY) + + #if defined(ENABLE_HISTORY_YIELD_PER_DAY) + void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { obj[F("refresh")] = mApp->getHistoryPeriod((uint8_t)HistoryStorageType::YIELD); uint16_t max = 0; for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) { @@ -969,8 +971,8 @@ class RestApi { max = value; } obj[F("max")] = max; - #endif - }*/ + } + #endif /*ENABLE_HISTORY_YIELD_PER_DAY*/ bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) { if(jsonIn.containsKey(F("auth"))) {