Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2023-03-19 23:28:06 +01:00
committed by GitHub
parent d93c5daf14
commit 58185a0569
20 changed files with 151 additions and 76 deletions

View File

@@ -30,6 +30,8 @@ class CImageBasis
protected:
bool externalImage;
std::string filename;
std::string name; // Just used for diagnostics
int memsize = 0;
void memCopy(uint8_t* _source, uint8_t* _target, int _size);
bool isInImage(int x, int y);
@@ -37,7 +39,7 @@ class CImageBasis
bool islocked;
public:
uint8_t* rgb_image;
uint8_t* rgb_image = NULL;
int channels;
int width, height, bpp;
@@ -64,11 +66,11 @@ class CImageBasis
void EmptyImage();
CImageBasis();
CImageBasis(std::string _image);
CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp);
CImageBasis(int _width, int _height, int _channels);
CImageBasis(CImageBasis *_copyfrom);
CImageBasis(std::string name);
CImageBasis(std::string name, std::string _image);
CImageBasis(std::string name, uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp);
CImageBasis(std::string name, int _width, int _height, int _channels);
CImageBasis(std::string name, CImageBasis *_copyfrom);
void Resize(int _new_dx, int _new_dy);
void Resize(int _new_dx, int _new_dy, CImageBasis *_target);