Skip to content

Commit 03c84a1

Browse files
caco3haverlandCaCO3jomjolSlider0007
authored
Release 15.1.1 (#2232)
* Testcase for #2145 and debug-log (#2151) * new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0 * Testcase for #2145 Added debug log, if allowNegativeRates is handeled * Fix timezone config parser (#2169) * make sure to parse the whole config line * fix crash on empty timezone parameter --------- Co-authored-by: CaCO3 <[email protected]> * Enhance ROI pages (#2161) * Check if the ROIs are equidistant. Only if not, untick the checkbox * renaming * Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox * only allow editing space when box is checked * fix sync check * show inner frame on all ROIs * cleanup * Check if the ROIs have same dy and dx. If so, tick the sync checkbox * checkbox position * renaming * renaming * show inner frame and cross hairs on all ROIs * update ROIs on ticking checkboxes * show timezone hint * fix deleting last ROI * cleanup --------- Co-authored-by: CaCO3 <[email protected]> * restart timeout on progress, catch error (#2170) * restart timeout on progress, catch error * . --------- Co-authored-by: CaCO3 <[email protected]> * BugFix #2167 * Release 15.1 preparations (#2171) * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update changelog * Fix links to PR * Formating * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md * Update Changelog.md --------- Co-authored-by: Slider0007 <[email protected]> Co-authored-by: Slider0007 <[email protected]> * fix typo * Replace relative documentation links with absolute ones pointing to the external documentation (#2180) Co-authored-by: CaCO3 <[email protected]> * Sort model files in configuration combobox (#2189) * new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0 * Testcase for #2145 Added debug log, if allowNegativeRates is handeled * Sort model files in combobox * reboot task - increase stack size (#2201) Avoid stack overflow * Update interface_influxdb.cpp * Update Changelog.md * 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 <[email protected]> * Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM! * log MQTT connection refused reasons (#2216) * Revert PSRAM usage as it lead to memory fragmentation. (#2224) See #2200 for details Co-authored-by: CaCO3 <[email protected]> * Fix missing value data in graph (#2230) * fix missing value data --------- Co-authored-by: CaCO3 <[email protected]> * Update Changelog.md (#2231) --------- Co-authored-by: Frank Haverland <[email protected]> Co-authored-by: CaCO3 <[email protected]> Co-authored-by: jomjol <[email protected]> Co-authored-by: Slider0007 <[email protected]> Co-authored-by: Slider0007 <[email protected]>
1 parent b5e0d6e commit 03c84a1

File tree

23 files changed

+194
-113
lines changed

23 files changed

+194
-113
lines changed

Changelog.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
## [unreleased]
1+
## [15.1.1] - 2023-03-23
22

33
### Update Procedure
44

55
Update Procedure see [online documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#update-ota-over-the-air)
66

7-
:bangbang: Afterwards you should force-reload the Web Interface (usually Ctrl-F5 will do it)!
8-
9-
:bangbang: Afterwards you should check your configuration for errors!
10-
117
### Changes
128

13-
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.0.3...v15.1.0)
9+
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.1.0...v15.1.1)
1410

1511
#### Added
1612

17-
- n.a.
18-
13+
- [#2206](https://github.com/jomjol/AI-on-the-edge-device/pull/2206) Log PSRAM usage
14+
- [#2216](https://github.com/jomjol/AI-on-the-edge-device/pull/2216) Log MQTT connection refused reasons
1915

2016
#### Changed
2117

2218
- n.a.
2319

2420
#### Fixed
2521

22+
- [#2224](https://github.com/jomjol/AI-on-the-edge-device/pull/2224), [#2213](https://github.com/jomjol/AI-on-the-edge-device/pull/2213) Reverted some of the PSRAM usage changes due to negative sideffects
2623
- [#2203](https://github.com/jomjol/AI-on-the-edge-device/issues/2203) Correct API for pure InfluxDB v1
24+
- [#2180](https://github.com/jomjol/AI-on-the-edge-device/pull/2180) Fixed links in Parameter Documentation
25+
- Various minor fixes
2726

2827
#### Removed
2928

@@ -934,6 +933,7 @@ External Illumination
934933
- Initial Version
935934

936935

936+
[15.1.1]: https://github.com/jomjol/AI-on-the-edge-device/compare/v15.1.0...v15.1.1
937937
[15.1.0]: https://github.com/jomjol/AI-on-the-edge-device/compare/v15.0.3...v15.1.0
938938
[15.0.3]: https://github.com/jomjol/AI-on-the-edge-device/compare/v14.0.3...v15.0.3
939939
[14.0.3]: https://github.com/jomjol/AI-on-the-edge-device/compare/v13.0.8...v14.0.3

code/components/jomjol_controlcamera/ClassControllCamera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
311311
loadNextDemoImage(fb);
312312
}
313313

314-
CImageBasis* _zwImage = new CImageBasis();
314+
CImageBasis* _zwImage = new CImageBasis("zwImage");
315315
if (_zwImage) {
316316
_zwImage->LoadFromMemory(fb->buf, fb->len);
317317
}

code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
#include "ClassLogFile.h"
11+
#include "psram.h"
1112
#include "../../include/defines.h"
1213

1314

@@ -31,7 +32,7 @@ void ClassFlowAlignment::SetInitialParameter(void)
3132
ImageBasis = NULL;
3233
ImageTMP = NULL;
3334
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
34-
AlgROI = (ImageData*)heap_caps_malloc(sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
35+
AlgROI = (ImageData*)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
3536
#endif
3637
previousElement = NULL;
3738
disabled = false;
@@ -55,7 +56,7 @@ ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
5556
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
5657
{
5758
ESP_LOGD(TAG, "CImageBasis had to be created");
58-
ImageBasis = new CImageBasis(namerawimage);
59+
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
5960
}
6061
}
6162

@@ -189,7 +190,7 @@ bool ClassFlowAlignment::doFlow(string time)
189190

190191
if (!ImageTMP)
191192
{
192-
ImageTMP = new CImageBasis(ImageBasis);
193+
ImageTMP = new CImageBasis("ImageTMP", ImageBasis);
193194
if (!ImageTMP)
194195
{
195196
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate ImageTMP -> Exec this round aborted!");
@@ -199,15 +200,15 @@ bool ClassFlowAlignment::doFlow(string time)
199200
}
200201

201202
delete AlignAndCutImage;
202-
AlignAndCutImage = new CAlignAndCutImage(ImageBasis, ImageTMP);
203+
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
203204
if (!AlignAndCutImage)
204205
{
205206
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
206207
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
207208
return false;
208209
}
209210

210-
CRotateImage rt(AlignAndCutImage, ImageTMP, initialflip);
211+
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
211212
if (initialflip)
212213
{
213214
int _zw = ImageBasis->height;

code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,10 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph)
381381
for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
382382
for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
383383
{
384-
GENERAL[_ana]->ROI[i]->image = new CImageBasis(modelxsize, modelysize, modelchannel);
385-
GENERAL[_ana]->ROI[i]->image_org = new CImageBasis(GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, 3);
384+
GENERAL[_ana]->ROI[i]->image = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name,
385+
modelxsize, modelysize, modelchannel);
386+
GENERAL[_ana]->ROI[i]->image_org = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name + " original",
387+
GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, 3);
386388
}
387389

388390
return true;

code/components/jomjol_flowcontroll/ClassFlowControll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
826826
return ESP_FAIL;
827827
}
828828

829-
_send = new CImageBasis(flowalignment->ImageBasis);
829+
_send = new CImageBasis("alg_roi", flowalignment->ImageBasis);
830830

831831
if (_send->ImageOkay()) {
832832
if (flowalignment) flowalignment->DrawRef(_send);

code/components/jomjol_flowcontroll/ClassFlowTakeImage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
154154

155155
image_width = Camera.image_width;
156156
image_height = Camera.image_height;
157-
rawImage = new CImageBasis();
157+
rawImage = new CImageBasis("rawImage");
158158
rawImage->CreateEmptyImage(image_width, image_height, 3);
159159

160160
waitbeforepicture_store = waitbeforepicture;
@@ -231,7 +231,7 @@ esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
231231

232232
ImageData* ClassFlowTakeImage::SendRawImage()
233233
{
234-
CImageBasis *zw = new CImageBasis(rawImage);
234+
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
235235
ImageData *id;
236236
int flash_duration = (int) (waitbeforepicture * 1000);
237237
Camera.CaptureToBasisImage(zw, flash_duration);

code/components/jomjol_helper/Helper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ string getESPHeapInfo(){
6464

6565
sprintf(aMsgBuf," | SPI Free: %ld", (long) aFreeSPIHeapSize);
6666
espInfoResultStr += string(aMsgBuf);
67-
sprintf(aMsgBuf," | SPI Larg Block: %ld", (long) aHeapLargestFreeBlockSize);
67+
sprintf(aMsgBuf," | SPI Large Block: %ld", (long) aHeapLargestFreeBlockSize);
6868
espInfoResultStr += string(aMsgBuf);
6969
sprintf(aMsgBuf," | SPI Min Free: %ld", (long) aMinFreeHeapSize);
7070
espInfoResultStr += string(aMsgBuf);
7171

7272
sprintf(aMsgBuf," | Int Free: %ld", (long) (aFreeInternalHeapSize));
7373
espInfoResultStr += string(aMsgBuf);
74-
sprintf(aMsgBuf," | Int Larg Block: %ld", (long) aHeapIntLargestFreeBlockSize);
74+
sprintf(aMsgBuf," | Int Large Block: %ld", (long) aHeapIntLargestFreeBlockSize);
7575
espInfoResultStr += string(aMsgBuf);
7676
sprintf(aMsgBuf," | Int Min Free: %ld", (long) (aMinFreeInternalHeapSize));
7777
espInfoResultStr += string(aMsgBuf);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include "ClassLogFile.h"
2+
#include "esp_heap_caps.h"
3+
4+
static const char* TAG = "PSRAM";
5+
6+
using namespace std;
7+
8+
9+
void *malloc_psram_heap(std::string name, size_t size, uint32_t caps) {
10+
void *ptr;
11+
12+
ptr = heap_caps_malloc(size, caps);
13+
if (ptr != NULL) {
14+
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
15+
}
16+
else {
17+
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
18+
}
19+
20+
return ptr;
21+
}
22+
23+
24+
void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps) {
25+
void *ptr;
26+
27+
ptr = heap_caps_calloc(n, size, caps);
28+
if (ptr != NULL) {
29+
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
30+
}
31+
else {
32+
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
33+
}
34+
35+
return ptr;
36+
}
37+
38+
39+
void free_psram_heap(std::string name, void *ptr) {
40+
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Freeing memory in PSRAM used for '" + name + "'...");
41+
heap_caps_free(ptr);
42+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
#include "esp_heap_caps.h"
3+
4+
void *malloc_psram_heap(std::string name, size_t size, uint32_t caps);
5+
void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps);
6+
7+
void free_psram_heap(std::string name, void *ptr);

code/components/jomjol_image_proc/CAlignAndCutImage.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
#include <math.h>
66
#include <algorithm>
77
#include <esp_log.h>
8+
#include "psram.h"
89
#include "../../include/defines.h"
910

1011
static const char* TAG = "c_align_and_cut_image";
1112

12-
CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp)
13+
CAlignAndCutImage::CAlignAndCutImage(std::string _name, CImageBasis *_org, CImageBasis *_temp) : CImageBasis(_name)
1314
{
15+
name = _name;
1416
rgb_image = _org->rgb_image;
1517
channels = _org->channels;
1618
width = _org->width;
@@ -37,7 +39,7 @@ bool CAlignAndCutImage::Align(RefInfo *_temp1, RefInfo *_temp2)
3739
int r0_x, r0_y, r1_x, r1_y;
3840
bool isSimilar1, isSimilar2;
3941

40-
CFindTemplate* ft = new CFindTemplate(rgb_image, channels, width, height, bpp);
42+
CFindTemplate* ft = new CFindTemplate("align", rgb_image, channels, width, height, bpp);
4143

4244
r0_x = _temp1->target_x;
4345
r0_y = _temp1->target_y;
@@ -81,7 +83,7 @@ bool CAlignAndCutImage::Align(RefInfo *_temp1, RefInfo *_temp2)
8183
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", zw);
8284
#endif*/
8385

84-
CRotateImage rt(this, ImageTMP);
86+
CRotateImage rt("Align", this, ImageTMP);
8587
rt.Translate(dx, dy);
8688
rt.Rotate(d_winkel, _temp1->target_x, _temp1->target_y);
8789
ESP_LOGD(TAG, "Alignment: dx %d - dy %d - rot %f", dx, dy, d_winkel);
@@ -107,7 +109,7 @@ void CAlignAndCutImage::CutAndSave(std::string _template1, int x1, int y1, int d
107109
dy = y2 - y1;
108110

109111
int memsize = dx * dy * channels;
110-
uint8_t* odata = (unsigned char*) GET_MEMORY(memsize);
112+
uint8_t* odata = (unsigned char*) malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
111113

112114
stbi_uc* p_target;
113115
stbi_uc* p_source;
@@ -186,7 +188,7 @@ CImageBasis* CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy)
186188
dy = y2 - y1;
187189

188190
int memsize = dx * dy * channels;
189-
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
191+
uint8_t* odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
190192

191193
stbi_uc* p_target;
192194
stbi_uc* p_source;
@@ -202,7 +204,7 @@ CImageBasis* CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy)
202204
p_target[_channels] = p_source[_channels];
203205
}
204206

205-
CImageBasis* rs = new CImageBasis(odata, channels, dx, dy, bpp);
207+
CImageBasis* rs = new CImageBasis("CutAndSave", odata, channels, dx, dy, bpp);
206208
RGBImageRelease();
207209
rs->SetIndepended();
208210
return rs;

0 commit comments

Comments
 (0)