ayushsharma82 / ElegantOTA

OTA updates made slick and simple for everyone!
https://elegantota.pro
GNU Affero General Public License v3.0
643 stars 119 forks source link

ElegantOTA PlatformIO error #206

Closed Bredahl closed 4 months ago

Bredahl commented 4 months ago

I get these two error messages, with query parameters

a value of type "const AsyncWebParameter " cannot be used to initialize an entity of type "AsyncWebParameter " invalid conversion from 'const AsyncWebParameter' to 'AsyncWebParameter' [-fpermissive]

when I use this code in Platform IO

server.on("/itvl", HTTP_GET, [](AsyncWebServerRequest *request){ int paramsNr = request->params(); Serial.println(paramsNr);

for(int i=0;i<paramsNr;i++){

    AsyncWebParameter* p = request->getParam(i);
    Serial.print("Param name: ");
    Serial.println(p->name());
    Serial.print("Param value: ");
    Serial.println(p->value());
    Serial.println("------");
}

request->send(200, "text/plain", "message received");

});

ayushsharma82 commented 4 months ago

This is not related to ElegantOTA.

Bredahl commented 4 months ago

No, but it is related to those libraries you recommend AsyncTCP

Bredahl commented 4 months ago

for Esp32 (mathieucarbou) AsyncTCP @ v3.1.4 (mathieucarbou) ESPAsyncWebServer - v3.0.5

ayushsharma82 commented 4 months ago

Then please open the issue in repo of dependencies. Mathieu will help you, those forks are not maintained by me.

mathieucarbou commented 4 months ago

@Bredahl : the api was fixed. The object is not mutable so you need to use const. The api enforces that now

'const AsyncWebParameter* p = request->getParam(i);'

Bredahl commented 4 months ago

thank you very much. That's what made it work!!