File tree Expand file tree Collapse file tree 4 files changed +10
-14
lines changed
Expand file tree Collapse file tree 4 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,6 @@ Generic keyboard (no PCINT) - configurable for digital or analog keyboards
5151
5252ClickEncoder https://github.com/0xPIT/encoder
5353
54- ## Saving memory
55- Some menu data can be stored on avr programming memory (flash) to save ram for your project.
56-
57- to activate memory saving put
58- ``` c++
59- #define USEPGM
60- ```
61- on top of your code before any menu includes.
62-
63- this is conditional because some non-avr devices might not supoprt it.
64-
6554## Menu definition example
6655example of menu definition (c++ macros)
6756
Original file line number Diff line number Diff line change 1-
21#ifdef USEPGM
32 // storing some values into avr flash memory (saving ram space)
43 #include < avr/pgmspace.h>
54 #define MEMMODE PROGMEM
65 #define pgmPtrNear (addr ) pgm_read_ptr_near(addr)
7- #define pgmByteNear (addr ) pgm_read_byte_near(addr)
6+ #define pgmByteNear (addr ) (pgm_read_byte_near(addr))
7+ // #error USEPGM (just checking)
88#else
99 // use ram for non-avr devices
1010 #define MEMMODE
1111 #define pgmPtrNear (addr ) (addr)
12- #define pgmByteNear (addr ) (*((byte*)addr))
12+ #define pgmByteNear (addr ) (*(uint8_t *)addr)
13+ #error NO USEPGM (this mem mode is under development)
1314#endif
1415
1516class prompt ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ prompt menu::exitOption(menu::exit);
2727bool menu::wrapMenus=false ;
2828menuNode* menuNode::activeNode=NULL ;
2929
30+ // PROGMEM AUX PRINT
3031void print_P (menuOut& s,const char * at) {
3132 int len=strlen_P (at);
3233 for (;len;len--,at++)
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ v2.1 - Add full support of SetPosition(x,y) to move the menu inside the screen (
2525#ifndef RSITE_ARDUINO_MENU_SYSTEM
2626 #define RSITE_ARDUINO_MENU_SYSTEM
2727
28+ // PGM activated by default, non pgm mode is not working ok
29+ #define USEPGM
30+
2831 #include < Stream.h>
2932 #include < HardwareSerial.h>
3033
@@ -188,4 +191,6 @@ v2.1 - Add full support of SetPosition(x,y) to move the menu inside the screen (
188191 virtual bool isMenu () const {return true ;}
189192 };
190193
194+ // PROGMEM AUX PRINT
195+ void print_P (menuOut& s,const char * at);
191196#endif
You can’t perform that action at this time.
0 commit comments