Out of memory in pressureSensor example
-
Hello,
I've tried to use a pressureSensor example but Arduino nano clone didn't send any data. During compilation i have seen:Sketch uses 23,540 bytes (76%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,677 bytes (81%) of dynamic memory, leaving 371 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.Serial was looped:
send:sensor started, id 1
send:sensor started, id 1
send:sensor started, id 1
send:sensor started, id 1I solved this problem by disable weather forecast. I suppose device run out of memory with enabled weather forecast.
-
@portals I had same issue - see this thread.
Download latest library, disable debug and follow @BulldogLowell advice. I managed to get dynamic memory to 75% and that seems sufficient - it has been running for a week now without issues.
-
For now i found this solution:
I changed a pressureAvg and pressureSamples to unsigned int. Next changed int forecast = sample(pressure) to int forecast = sample(pressure * 10) to avoid big precision lost. Sample function still may need correction but probably it is a good and easy way to fix this problem.Result:
Sketch uses 18,636 bytes (60%) of program storage space. Maximum is 30,720 bytes.
Global variables use 1,268 bytes (61%) of dynamic memory, leaving 780 bytes for local variables. Maximum is 2,048 bytes.
Suggested Topics
-
Code for beta-testing?
Controllers • 24 Mar 2014, 20:48 • andriej 9 Aug 2014, 10:44 -
NRF51-52 PA not support ???
Bug Reports • 23 Feb 2019, 16:40 • berkseo 8 Jul 2021, 11:42 -
Boards esp8266 v3.1.0 or Newer Doesn't Work with MySensors
Bug Reports • 21 Feb 2023, 01:55 • d-smes 25 Feb 2023, 19:37 -
ESP32 + Signing fails after xxx msg as result of memory leak
Bug Reports • 6 Apr 2020, 18:43 • Technovation 7 Mar 2022, 10:37 -
some differences between serial- and tcp-gateways.
Bug Reports • 15 Mar 2023, 09:26 • Branther 30 Mar 2023, 15:40 -
Sensor presentation failure
Bug Reports • 31 Jul 2016, 19:23 • Sergio Rius 3 Mar 2021, 18:48