Go Down

Topic: Passing I/O functions to a class. (Read 1 time) previous topic - next topic

OutOfLine


Proof?


https://github.com/reppr/pulses

Comment/uncomment  '#define USE_F_MACRO' in Menu.h
to switch between using Arduino F() macro or a noop replacement.

I told the menu to display free RAM for these tests, btw.

For testing PROGMEM support you would need the latest version with PROGMEM storage support.
Log message says "Switching PROGMEM for tests.".

(Yes I *do* know that this version reads progmem strings as char instead of unsigned char, breaking string display.
  I don't care, should not influence the test.)

The numbers you get will differ by a few bytes, as the versions are not absolutely identical.
The "Testing using Arduino F() macro only. " commit has some additional functionality even.

RAM usage increases by 6 bytes when using the menu the very first time. I don't even know why.
I gave startup values for RAM usage.

Nick Gammon

Quote

Binary sketch size: 7,206 bytes             Binary sketch size: 7,534 bytes
  RAM: 465                                              RAM: 1525


OK, so that is free RAM? The higher the better?
http://www.gammon.com.au/electronics

OutOfLine


Quote

Binary sketch size: 7,206 bytes             Binary sketch size: 7,534 bytes
  RAM: 465                                              RAM: 1525


OK, so that is free RAM? The higher the better?


Yes, I hope so ;)

The code in  Menu::get_free_RAM()  is code I once copied (probably from the Arduino page) and have used for several years. I did not do real testing about the exact meaning of the result. Would be interested to learn more about that, btw.

Code: [Select]

int Menu::get_free_RAM() const {
  int free;
  extern int __bss_end;
  extern void *__brkval;

  if ((int) __brkval == 0)
    return ((int) &free) - ((int) &__bss_end);
  else
    return ((int) &free) - ((int) __brkval);
}


Go Up