@@ -107,7 +107,7 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
107
107
{
108
108
109
109
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
110
- if ( psramFound () ) ptr8 = ( uint8_t *) ps_calloc (w * h + 1 , sizeof (uint16_t ));
110
+ if ( psramFound () && _usePsram ) ptr8 = ( uint8_t *) ps_calloc (w * h + 1 , sizeof (uint16_t ));
111
111
else
112
112
#endif
113
113
ptr8 = ( uint8_t *) calloc (w * h + 1 , sizeof (uint16_t ));
@@ -116,7 +116,7 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
116
116
else if (_bpp == 8 )
117
117
{
118
118
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
119
- if ( psramFound () ) ptr8 = ( uint8_t *) ps_calloc (w * h + 1 , sizeof (uint8_t ));
119
+ if ( psramFound () && _usePsram ) ptr8 = ( uint8_t *) ps_calloc (w * h + 1 , sizeof (uint8_t ));
120
120
else
121
121
#endif
122
122
ptr8 = ( uint8_t *) calloc (w * h + 1 , sizeof (uint8_t ));
@@ -135,7 +135,7 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
135
135
if (frames > 2 ) frames = 2 ; // Currently restricted to 2 frame buffers
136
136
if (frames < 1 ) frames = 1 ;
137
137
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
138
- if ( psramFound () ) ptr8 = ( uint8_t *) ps_calloc (frames * (w>>3 ) * h + frames, sizeof (uint8_t ));
138
+ if ( psramFound () && _usePsram ) ptr8 = ( uint8_t *) ps_calloc (frames * (w>>3 ) * h + frames, sizeof (uint8_t ));
139
139
else
140
140
#endif
141
141
ptr8 = ( uint8_t *) calloc (frames * (w>>3 ) * h + frames, sizeof (uint8_t ));
@@ -227,6 +227,17 @@ void TFT_eSprite::deleteSprite(void)
227
227
}
228
228
229
229
230
+
231
+ /* **************************************************************************************
232
+ ** Function name: setPsram
233
+ ** Description: Disable psRam (only if applicable)
234
+ *************************************************************************************x*/
235
+ void TFT_eSprite::setPsram ( bool enabled ) {
236
+ _usePsram = enabled;
237
+ }
238
+
239
+
240
+
230
241
/* **************************************************************************************
231
242
** Function name: setPivot
232
243
** Description: Set the pivot point in this Sprite
0 commit comments