Safeguarded C++ begin function to not potentially corrupt system state when called with U8G2_USE_DYNAMIC_ALLOC macro defined
This commit is contained in:
parent
92d1b7797d
commit
fdc21f8eaf
|
@ -132,7 +132,15 @@ class U8G2 : public Print
|
|||
|
||||
bool begin(void) {
|
||||
/* note: call to u8x8_utf8_init is not required here, this is done in the setup procedures before */
|
||||
initDisplay(); clearDisplay(); setPowerSave(0); return 1;}
|
||||
#ifndef U8G2_USE_DYNAMIC_ALLOC
|
||||
initDisplay();
|
||||
clearDisplay();
|
||||
setPowerSave(0);
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void beginSimple(void) {
|
||||
/* does not clear the display and does not wake up the display */
|
||||
|
|
|
@ -1142,7 +1142,7 @@ void u8g2_FirstPage(u8g2_t *u8g2);
|
|||
uint8_t u8g2_NextPage(u8g2_t *u8g2);
|
||||
|
||||
#ifdef U8G2_USE_DYNAMIC_ALLOC
|
||||
#define u8g2_SetBufferPtr(u8g2, buf) ((u8g2)->tile_buf_ptr = buf);
|
||||
#define u8g2_SetBufferPtr(u8g2, buf) ((u8g2)->tile_buf_ptr = (buf));
|
||||
#define u8g2_GetBufferSize(u8g2) ((u8g2)->u8x8.display_info->tile_width * 8 * (u8g2)->tile_buf_height)
|
||||
#endif
|
||||
#define u8g2_GetBufferPtr(u8g2) ((u8g2)->tile_buf_ptr)
|
||||
|
|
Loading…
Reference in New Issue