Skip to content

Commit

Permalink
adopt to asyncserver 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
vortigont committed Aug 5, 2024
1 parent da79f03 commit 372aad0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions espem/espem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ void DataStorage::wsamples(AsyncWebServerRequest *request) {
uint8_t id = 1; // default ts id

if (request->hasParam("tsid")) {
AsyncWebParameter* p = request->getParam("tsid");
const AsyncWebParameter* p = request->getParam("tsid");
id = p->value().toInt();
}

// check if there is any sampled data
if ( !getTSsize(id) ) {
request->send_P(503, PGmimejson, "[]");
request->send(503, PGmimejson, "[]");
return;
}

Expand All @@ -172,15 +172,15 @@ void DataStorage::wsamples(AsyncWebServerRequest *request) {
size_t cnt = 0; // cnt - return last 'cnt' samples, 0 - all samples

if (request->hasParam(C_scnt)){
AsyncWebParameter* p = request->getParam(C_scnt);
const AsyncWebParameter* p = request->getParam(C_scnt);
if (!p->value().isEmpty())
cnt = p->value().toInt();
}


const auto ts = getTS(id);
if (!ts)
request->send_P(503, PGmimejson, "[]");
request->send(503, PGmimejson, "[]");

auto iter = ts->cbegin(); // get const iterator

Expand Down

0 comments on commit 372aad0

Please sign in to comment.