Skip to content

Commit

Permalink
Release 15.1.1 (#2232)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
6 people authored Mar 23, 2023
1 parent b5e0d6e commit 03c84a1
Show file tree
Hide file tree
Showing 23 changed files with 194 additions and 113 deletions.
16 changes: 8 additions & 8 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
## [unreleased]
## [15.1.1] - 2023-03-23

### Update Procedure

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

:bangbang: Afterwards you should force-reload the Web Interface (usually Ctrl-F5 will do it)!

:bangbang: Afterwards you should check your configuration for errors!

### Changes

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)
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)

#### Added

- n.a.

- [#2206](https://github.com/jomjol/AI-on-the-edge-device/pull/2206) Log PSRAM usage
- [#2216](https://github.com/jomjol/AI-on-the-edge-device/pull/2216) Log MQTT connection refused reasons

#### Changed

- n.a.

#### Fixed

- [#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
- [#2203](https://github.com/jomjol/AI-on-the-edge-device/issues/2203) Correct API for pure InfluxDB v1
- [#2180](https://github.com/jomjol/AI-on-the-edge-device/pull/2180) Fixed links in Parameter Documentation
- Various minor fixes

#### Removed

Expand Down Expand Up @@ -934,6 +933,7 @@ External Illumination
- Initial Version


[15.1.1]: https://github.com/jomjol/AI-on-the-edge-device/compare/v15.1.0...v15.1.1
[15.1.0]: https://github.com/jomjol/AI-on-the-edge-device/compare/v15.0.3...v15.1.0
[15.0.3]: https://github.com/jomjol/AI-on-the-edge-device/compare/v14.0.3...v15.0.3
[14.0.3]: https://github.com/jomjol/AI-on-the-edge-device/compare/v13.0.8...v14.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
loadNextDemoImage(fb);
}

CImageBasis* _zwImage = new CImageBasis();
CImageBasis* _zwImage = new CImageBasis("zwImage");
if (_zwImage) {
_zwImage->LoadFromMemory(fb->buf, fb->len);
}
Expand Down
11 changes: 6 additions & 5 deletions code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


#include "ClassLogFile.h"
#include "psram.h"
#include "../../include/defines.h"


Expand All @@ -31,7 +32,7 @@ void ClassFlowAlignment::SetInitialParameter(void)
ImageBasis = NULL;
ImageTMP = NULL;
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
AlgROI = (ImageData*)heap_caps_malloc(sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
AlgROI = (ImageData*)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
#endif
previousElement = NULL;
disabled = false;
Expand All @@ -55,7 +56,7 @@ ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
{
ESP_LOGD(TAG, "CImageBasis had to be created");
ImageBasis = new CImageBasis(namerawimage);
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
}
}

Expand Down Expand Up @@ -189,7 +190,7 @@ bool ClassFlowAlignment::doFlow(string time)

if (!ImageTMP)
{
ImageTMP = new CImageBasis(ImageBasis);
ImageTMP = new CImageBasis("ImageTMP", ImageBasis);
if (!ImageTMP)
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate ImageTMP -> Exec this round aborted!");
Expand All @@ -199,15 +200,15 @@ bool ClassFlowAlignment::doFlow(string time)
}

delete AlignAndCutImage;
AlignAndCutImage = new CAlignAndCutImage(ImageBasis, ImageTMP);
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
if (!AlignAndCutImage)
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
return false;
}

CRotateImage rt(AlignAndCutImage, ImageTMP, initialflip);
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
if (initialflip)
{
int _zw = ImageBasis->height;
Expand Down
6 changes: 4 additions & 2 deletions code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph)
for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
{
GENERAL[_ana]->ROI[i]->image = new CImageBasis(modelxsize, modelysize, modelchannel);
GENERAL[_ana]->ROI[i]->image_org = new CImageBasis(GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, 3);
GENERAL[_ana]->ROI[i]->image = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name,
modelxsize, modelysize, modelchannel);
GENERAL[_ana]->ROI[i]->image_org = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name + " original",
GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, 3);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_flowcontroll/ClassFlowControll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
return ESP_FAIL;
}

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

if (_send->ImageOkay()) {
if (flowalignment) flowalignment->DrawRef(_send);
Expand Down
4 changes: 2 additions & 2 deletions code/components/jomjol_flowcontroll/ClassFlowTakeImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)

image_width = Camera.image_width;
image_height = Camera.image_height;
rawImage = new CImageBasis();
rawImage = new CImageBasis("rawImage");
rawImage->CreateEmptyImage(image_width, image_height, 3);

waitbeforepicture_store = waitbeforepicture;
Expand Down Expand Up @@ -231,7 +231,7 @@ esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)

ImageData* ClassFlowTakeImage::SendRawImage()
{
CImageBasis *zw = new CImageBasis(rawImage);
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
ImageData *id;
int flash_duration = (int) (waitbeforepicture * 1000);
Camera.CaptureToBasisImage(zw, flash_duration);
Expand Down
4 changes: 2 additions & 2 deletions code/components/jomjol_helper/Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ string getESPHeapInfo(){

sprintf(aMsgBuf," | SPI Free: %ld", (long) aFreeSPIHeapSize);
espInfoResultStr += string(aMsgBuf);
sprintf(aMsgBuf," | SPI Larg Block: %ld", (long) aHeapLargestFreeBlockSize);
sprintf(aMsgBuf," | SPI Large Block: %ld", (long) aHeapLargestFreeBlockSize);
espInfoResultStr += string(aMsgBuf);
sprintf(aMsgBuf," | SPI Min Free: %ld", (long) aMinFreeHeapSize);
espInfoResultStr += string(aMsgBuf);

sprintf(aMsgBuf," | Int Free: %ld", (long) (aFreeInternalHeapSize));
espInfoResultStr += string(aMsgBuf);
sprintf(aMsgBuf," | Int Larg Block: %ld", (long) aHeapIntLargestFreeBlockSize);
sprintf(aMsgBuf," | Int Large Block: %ld", (long) aHeapIntLargestFreeBlockSize);
espInfoResultStr += string(aMsgBuf);
sprintf(aMsgBuf," | Int Min Free: %ld", (long) (aMinFreeInternalHeapSize));
espInfoResultStr += string(aMsgBuf);
Expand Down
42 changes: 42 additions & 0 deletions code/components/jomjol_helper/psram.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "ClassLogFile.h"
#include "esp_heap_caps.h"

static const char* TAG = "PSRAM";

using namespace std;


void *malloc_psram_heap(std::string name, size_t size, uint32_t caps) {
void *ptr;

ptr = heap_caps_malloc(size, caps);
if (ptr != NULL) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
}

return ptr;
}


void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps) {
void *ptr;

ptr = heap_caps_calloc(n, size, caps);
if (ptr != NULL) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
}

return ptr;
}


void free_psram_heap(std::string name, void *ptr) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Freeing memory in PSRAM used for '" + name + "'...");
heap_caps_free(ptr);
}
7 changes: 7 additions & 0 deletions code/components/jomjol_helper/psram.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#include "esp_heap_caps.h"

void *malloc_psram_heap(std::string name, size_t size, uint32_t caps);
void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps);

void free_psram_heap(std::string name, void *ptr);
14 changes: 8 additions & 6 deletions code/components/jomjol_image_proc/CAlignAndCutImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#include <math.h>
#include <algorithm>
#include <esp_log.h>
#include "psram.h"
#include "../../include/defines.h"

static const char* TAG = "c_align_and_cut_image";

CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp)
CAlignAndCutImage::CAlignAndCutImage(std::string _name, CImageBasis *_org, CImageBasis *_temp) : CImageBasis(_name)
{
name = _name;
rgb_image = _org->rgb_image;
channels = _org->channels;
width = _org->width;
Expand All @@ -37,7 +39,7 @@ bool CAlignAndCutImage::Align(RefInfo *_temp1, RefInfo *_temp2)
int r0_x, r0_y, r1_x, r1_y;
bool isSimilar1, isSimilar2;

CFindTemplate* ft = new CFindTemplate(rgb_image, channels, width, height, bpp);
CFindTemplate* ft = new CFindTemplate("align", rgb_image, channels, width, height, bpp);

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

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

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

stbi_uc* p_target;
stbi_uc* p_source;
Expand Down Expand Up @@ -186,7 +188,7 @@ CImageBasis* CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy)
dy = y2 - y1;

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

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

CImageBasis* rs = new CImageBasis(odata, channels, dx, dy, bpp);
CImageBasis* rs = new CImageBasis("CutAndSave", odata, channels, dx, dy, bpp);
RGBImageRelease();
rs->SetIndepended();
return rs;
Expand Down
6 changes: 3 additions & 3 deletions code/components/jomjol_image_proc/CAlignAndCutImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class CAlignAndCutImage : public CImageBasis
public:
int t0_dx, t0_dy, t1_dx, t1_dy;
CImageBasis *ImageTMP;
CAlignAndCutImage(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CAlignAndCutImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp);
CAlignAndCutImage(std::string name, std::string _image) : CImageBasis(name, _image) {ImageTMP = NULL;};
CAlignAndCutImage(std::string name, uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(name, _rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CAlignAndCutImage(std::string name, CImageBasis *_org, CImageBasis *_temp);

bool Align(RefInfo *_temp1, RefInfo *_temp2);
// void Align(std::string _template1, int x1, int y1, std::string _template2, int x2, int y2, int deltax = 40, int deltay = 40, std::string imageROI = "");
Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_image_proc/CFindTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CFindTemplate : public CImageBasis
{
public:
int tpl_width, tpl_height, tpl_bpp;
CFindTemplate(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {};
CFindTemplate(std::string name, uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(name, _rgb_image, _channels, _width, _height, _bpp) {};

bool FindTemplate(RefInfo *_ref);

Expand Down
Loading

0 comments on commit 03c84a1

Please sign in to comment.