Chat freely about anything...

User avatar
By Sirquil
#84452 Using this code:

Code: Select allserverAsync.on("/Graphs", HTTP_GET, [](AsyncWebServerRequest * request) {
    Serial.println("");
    Serial.println("Graphs accessed");
    accessLog();
    AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", HTML3);
    response->addHeader("Server","ESP Async Web Server");
    request->send(response);
    flag = 0;
    });


Sends all four iframes; href does not get processed, since there is no processor3 referenced.

Adding processor3:

Code: Select allserverAsync.on("/Graphs", HTTP_GET, [](AsyncWebServerRequest * request) {
    Serial.println("");
    Serial.println("Graphs accessed");
    accessLog();
    AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", HTML3, processor3);
    response->addHeader("Server","ESP Async Web Server");
    request->send(response);
    flag = 0;
    });


Sends only one of the four iframes

HTML3:

Code: Select all//index2.h
const char HTML3[] PROGMEM = R"====(
<!DOCTYPE HTML>
<html>

<head>
    <title>Graphs</title>
</head>

<body>
  <br>
   <h2>Graphed Weather Observations</h2>
   <br>
  <div>
      <frameset rows="30%,70%" cols="33%,34%">
       <iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/290421/charts/1?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&timescale=15&title=Temperature&type=line&xaxis=Date+and+Time&yaxis=Temperature++++%C2%B0++F."></iframe>
      <iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/290421/charts/2?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&title=Relative+Humidity&type=line&xaxis=Date+and+Time&yaxis=Relative+Humidity++%25"></iframe>
       </frameset>
      <br><br>
       <frameset rows="30%,70%" cols="33%,34%">
       <iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/290421/charts/3?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&title=Barometric+Pressure&type=line&xaxis=Date+and+Time&yaxis=Pressure+++inHg"></iframe>
       <iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/290421/charts/4?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&title=Dew+Point&type=line&xaxis=Date+and+Time&yaxis=Dew+Point++++%C2%B0++F."></iframe>
       </frameset>
  </div>
   <br><br>
  <a href=http://%PUBLICIP%/Weather >Home</a>
  <br>
</body>

</html>
)====";


Async Web Server documentation shows:

Code: Select allconst char index_html[] PROGMEM = "..."; // large char array, tested with 14k
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", index_html, processor);
response->addHeader("Server","ESP Async Web Server");
request->send(response);


Would this work to send all four iframes? How would this be applied?

William
User avatar
By Sirquil
#84456 Good Morning Pablo2048,

processor3:

Code: Select allString processor3(const String& var)
{

    //index3.h

    flag++;

    if(flag < 2)
    {       
       
        Serial.println("");
        Serial.println("Graphs accessed");
   
        accessLog();
    }

    if(var == F("PUBLICIP"))
      return publicIP;

    if(flag == 1)
    {
        end();
    }

    return String();
 
}


Late Night/Early Morning; overlooked including processor3. Thank you for looking into code Pablo2048.

Willism
User avatar
By Pablo2048
#84459 Hi William,
hmm - I don't see any visible reason to not serve all, so here are my suggestions:
1. Use web development tools from your browser to take a look what happen in transfer (F12 in your browser)
2. temporarily disable your accessLog() (and all your Serial.xxx calls) and check if the problem persist
Pavel