Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adopt to asyncserver 3.x #47

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading