AmboVent: Low memory available, stability problems may occur

When I build the project for the Arduino Nano I see the following output in the Arduino IDE:

Sketch uses 18280 bytes (59%) of program storage space. Maximum is 30720 bytes.
Global variables use 1882 bytes (91%) of dynamic memory, leaving 166 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

This is a problem, as it means the stack is nearly completely used up by global variables, so local variables in any scope or code section could potentially overflow the stack really easily. I think I can do some code cleanup to fix this, perhaps by moving strings to progmem with the F() macro, or using other coding techniques. I’ll have a look at the code.

Read more on the F() macro here:

  1. https://www.arduino.cc/reference/tr/language/variables/utilities/progmem/
  2. https://www.baldengineer.com/arduino-f-macro.html

UPDATE 20 APR 2020:

The bulk of this issue is resolved now that the two big lookup tables in the code are in progmem, but let’s still not close this issue until at least all strings have been surrounded by the F() macro and all large const arrays or structs (if any) have been moved to progmem.

  • all string literals are inside an F() macro
  • all large arrays or large data types (> ~16 bytes or so) are in PROGMEM)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 20 (1 by maintainers)

Most upvoted comments

just released a new ver. that returned the lost functionality (accepted a PR that suggested readability improvements without noticing it was based on old ver.) in this version -

  • improved the code structure, memory use (75% now… still warns… but it is much better)
  • added some new functions - press test once during standby to run one cycle - ability to calibrate the env. pressure from the maint menu - option to set the breath cycle movement time