Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:05
    aguaviva commented #4655
  • 08:59
    me-no-dev commented #6421
  • 08:57
    VojtechBartoska unlabeled #6764
  • 08:57
    VojtechBartoska labeled #6764
  • 08:57
    VojtechBartoska labeled #6766
  • 08:57
    VojtechBartoska labeled #6766
  • 08:56
    VojtechBartoska labeled #6765
  • 08:56
    VojtechBartoska labeled #6765
  • 08:56
    VojtechBartoska unlabeled #4655
  • 08:56
    VojtechBartoska commented #4655
  • 08:56
    VojtechBartoska labeled #4655
  • 08:56
    VojtechBartoska labeled #4655
  • 08:55
    VojtechBartoska unlabeled #6715
  • 08:53
    VojtechBartoska labeled #6209
  • 08:47
    aguaviva commented #4655
  • 08:45
    aguaviva commented #4655
  • 08:43
    Droidbane starred espressif/arduino-esp32
  • 08:35
    Maxime66410 closed #6715
  • 08:35
    Maxime66410 commented #6715
  • 08:33
    VojtechBartoska commented #4782
lbernstone
@lbernstone
How often are those going to be used?
chegewara
@chegewara
Probably more often than 100 ms, if the delay is too long
GUEST.it
@guestisp
only on the first configuration , but it wasn't the only things blocked by delay. I think even the espasyncwebserver suffers with a big delay in the loop
chegewara
@chegewara
How it can be blocked by delay in loop, if loop is empty?
lbernstone
@lbernstone
uh, no. espasyncwebserver is, as it says, async. It runs in a separate task from the main loop. It does depend on getting some cycles tho
chegewara
@chegewara
All other tasks will be slower if you have empty loop without delay
GUEST.it
@guestisp
so, i could try to rise the loop delay, because as i'm spawning tasks from espwebserver, each task should not be affected by the main loop.
and a delay should give the controller time to start the garbage collector
chegewara
@chegewara
Again, why not delete looper task if it is empty?
This way you will recover memory from task stack
GUEST.it
@guestisp

Again, why not delete looper task if it is empty?

how ? and its not empty, there is the dnsserver.process() inside

chegewara
@chegewara
Ok, I'm done
You said few times it is empty
GUEST.it
@guestisp
because the dnsserve.process is not run always, onyl when I need the captive portal. 99% of the time, it doesn't run so the loop is empty. But I can't delete the task totally
chegewara
@chegewara
No, it is not empty, because you have the code in it
You also can say that setup() is empty, because it's running only one time
GUEST.it
@guestisp
even with delay, the heap for rtos is depleted, it works much longer, but is never freed
chegewara
@chegewara
And you still don't know how to confirm is it freertos problem or your code in that task?
GUEST.it
@guestisp

And you still don't know how to confirm is it freertos problem or your code in that task?

only "strange" think in that task is ArduinoJson, i'm trying to forcing deletion and calling .clear on each json document, but didn't change anything. So I think it's the task not freed

chegewara
@chegewara
How about removing all code from task and leaving only memory print?
I will repeat myself, arduinoJSON library is having memory handling problems, especially when you don't know how to use it (I don't know)
GUEST.it
@guestisp

I will repeat myself, arduinoJSON library is having memory handling problems, especially when you don't know how to use it (I don't know)

honestyl I hate that library. But I think is the most feature complete one. But I really hate it

chegewara
@chegewara
Then learn how to use it
For example moving all json objects to global scope may help you
GUEST.it
@guestisp
with almpst empty task, same leak "outside" but no memory usage inside:
executor.cpp: creating a new instance
executor.cpp: free rtos heap before task: 169776
executor.cpp: free rtos heap after task: 166316
webserver.cpp: triggering exec instance deletion
ph.read: done running taskProcessor on core #1, start: 2576, stop: 2576

executor.cpp: creating a new instance
executor.cpp: free rtos heap before task: 169640
executor.cpp: free rtos heap after task: 166180
webserver.cpp: triggering exec instance deletion
ph.read: done running taskProcessor on core #1, start: 2576, stop: 2576
chegewara
@chegewara
Because you will have only 1-2 objects in memory and avoid memory leak in case you didn't delete objects properly
lbernstone
@lbernstone
or malloc the objects in the task, free them at the end before you delete the task. That way you can't hide the memory leak. It will be very clear that you have a problem :)
Is there no rev number on the S3 currently? Would it say beta in esptool chip_id if this were an engineering sample?
GUEST.it
@guestisp
memory leak is here:
        String jsonResponse;
        serializeJson(docResponse, jsonResponse);
lbernstone
@lbernstone
So, there is either a way to delete the DOM from the json memory that you are missing, or else clear the String when you are done.
GUEST.it
@guestisp
is what i'm trying, but there is always a leak, every time i call serializeJson. tried to "clear" or "garbageCollect" the docResponse object, tried to set the jsonResponse string as "" when done ecc but there is always a leak. As soon as I comment out the serializejson, the leak ends
lbernstone
@lbernstone
Maybe something is locking the String. Try malloc'ing a char* buffer instead and free it before the end of the task. I honestly don't know if you can free a String. They usually destruct cleanly, but...
or just use cJson and know that you have to manage the memory yourself :)
boarchuz
@boarchuz
Yeah you're relying on cpp destructors to clean everything up, but their scope is never exited so the destructors are never called - vTaskDelete doesn't return so whatever was living in that scope is never cleaned up.
Might even be able to simply wrap everything except the vTaskDelete in { }
chegewara
@chegewara
@lbernstone S3 beta is very old sample and was for short time in esp-idf, but abandoned few months ago
lbernstone
@lbernstone
Well, it works- both IDF and Arduino, so I guess it must be release version. Doesn't much like using the full flash yet, but it does show 8MB octal psram.
GUEST.it
@guestisp

Might even be able to simply wrap everything except the vTaskDelete in { }

seems to work! spawning 1 task every second (in a loop) i can see the memory decrease then 1 or 2 seconds after, it grow back to the initial state, saying that garbage collector is triggering as expected, this time

Robin Rosiers
@RobinRosiers_gitlab
image.png
huh, anyone an idea why I get all of a sudden (after a stable connection) this?
And then the device is unreacable
GUEST.it
@guestisp
guys, can I use a ph board running at 5v? I've read somewhere that analog pins are 3v3 teollerant, but not 5v so if the board is running at 5v, i'll fry the esp32 ?
Mike Dunston
@atanisoft
5v to any esp32 pin runs a risk of destroying the esp32. Use a level shifter or similar to ensure the voltage is in the supported range
GUEST.it
@guestisp
so I have to stick to 3v3 without the analog isolator (the dfrobot isolator works only at 5v, is powered with 3v3, it doesn't power the ph board connected to it)
then another question: to get the raw millivolt value usable for the ph conversion, is analogReadMilliVolts enought or should I convert the analogRead value like this: (analogRead(PH_PIN) * 3300) / 4096.0 ?
(returned values are not the same, they differ "a lot", more than 100-150mv)
Mike Dunston
@atanisoft
you should use an average of a few reads for the calculation and also use the ADC calibration to further dial in the readings
I don't know if the arduino APIs are taking that into account or not.
GUEST.it
@guestisp
i've already implemented the average reading, but the question is which one to trust, the analog read plus the convertion based on the ADC (found on the net) or the analogreadmillivolts ? Because readings are different
the probe is not calibrated, so i don't know which one to trust. Now I test with a 7.00ph certified solution, i'll use the one with the reading near 1500mv, but i'm unsure honestly