Pages: 1 2 [3]   Go Down
Author Topic: Passing I/O functions to a class.  (Read 1425 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink

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:
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);
}
Logged

Pages: 1 2 [3]   Go Up
Jump to: