Coder Social home page Coder Social logo

Comments (3)

khoih-prog avatar khoih-prog commented on May 20, 2024

Thanks for your interest in the library.

I'm sorry I don't have time to recreate the settings / scenario to duplicate your issue. You have to somehow post the full code so that anybody can verify easily, without spending much time.

Can you try your code on ESP32 using ESP32 WebServer or ESP8266 using ESP8266WebServer to see if the issue still exists.

Also try either

  1. to use PROGMEM like this
static const unsigned char pizza_jpg[] PROGMEM = {255,216,255,224,0,16,74,70,  ... ... ... .. 134,181,110,149,29,70,222,162};
  1. not to use PROGMEM command at all, to see if it's better on STM32.
server.on("/pizza.jpg", []() 
{
  server.send(200, "image/jpeg", pizza_jpg, sizeof(pizza_jpg));
});

I'm closing the issue now, and will reopen whenever you test the recommendation and still having issue, then post the full MRE code or prove this is a bug of the library.

Good Luck,

from ethernetwebserver_stm32.

tothtechnika avatar tothtechnika commented on May 20, 2024

Unfortunately, your solution doesn't work. Sending a const progmem variable does not work with the server.send() function.
The following link allows you to download a small test program. After about 3-4 attempts, the program crashes.
This link: testwebserverfault.zip

from ethernetwebserver_stm32.

khoih-prog avatar khoih-prog commented on May 20, 2024

Try to have a look at ESP32_FSWebServer_DRD example and and use some way to save / load your binary image file from Flash.

It's so terrible to have all jpg file (in txt), in .ino => difficult to load / edit the too-large file.

I'm surprised that you can even compile and run the code, especially for MPU with limited power / memory, etc.

Anyway, try the code with this addition

...

void heartBeatPrint(void)
{
  static int num = 1;

  Serial.print(F("."));

  if (num == 80)
  {
    Serial.println();
    num = 1;
  }
  else if (num++ % 10 == 0)
  {
    Serial.print(F(" "));
  }
}

void check_status()
{
  static unsigned long checkstatus_timeout = 0;

#define STATUS_CHECK_INTERVAL     10000L

  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
  {
    heartBeatPrint();
    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }
}

void loop(void)
{
  server.handleClient();
  delay(1000);
  check_status();
}

and I could run many Clients many times repeatedly, with Nucleo-144 F767ZI

Selection_086

That's some food for thought, and you're on your own.

I'm sorry I won't spend more time here. You'd better ask for help after you do the test with better ESP32/ESP8266, then verify if your code is working there. If not, ask for help in ESP32/ESP8266 forum.

Good Luck,

from ethernetwebserver_stm32.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.