Skip to content

Commit 7e2118f

Browse files
committed
deactivated non pgm modes due to bugs...
1 parent e556fdd commit 7e2118f

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ Generic keyboard (no PCINT) - configurable for digital or analog keyboards
5151

5252
ClickEncoder 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
6655
example of menu definition (c++ macros)
6756

src/macros.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
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

1516
class prompt;

src/menu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ prompt menu::exitOption(menu::exit);
2727
bool menu::wrapMenus=false;
2828
menuNode* menuNode::activeNode=NULL;
2929

30+
//PROGMEM AUX PRINT
3031
void print_P(menuOut& s,const char* at) {
3132
int len=strlen_P(at);
3233
for(;len;len--,at++)

src/menu.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)