Modify stack sizes + max open files (SD) , add REST handler for heap/(stack) infos (#1751)

* Modify stack sizes+max open files,add rest handler

* Update
This commit is contained in:
Slider0007
2023-01-03 08:10:08 +01:00
committed by GitHub
parent 3a3e1dde90
commit 62a2f127b4
7 changed files with 70 additions and 12 deletions

View File

@@ -250,7 +250,7 @@ void GpioHandler::init()
if (xHandleTaskGpio == NULL) {
gpio_queue_handle = xQueueCreate(10,sizeof(GpioResult));
BaseType_t xReturned = xTaskCreate(&gpioHandlerTask, "gpio_int", configMINIMAL_STACK_SIZE * 8, (void *)this, tskIDLE_PRIORITY + 2, &xHandleTaskGpio);
BaseType_t xReturned = xTaskCreate(&gpioHandlerTask, "gpio_int", 3 * 1024, (void *)this, tskIDLE_PRIORITY + 4, &xHandleTaskGpio);
if(xReturned == pdPASS ) {
ESP_LOGD(TAG, "xHandletaskGpioHandler started");
} else {

View File

@@ -134,6 +134,45 @@ bool doflow(void)
}
esp_err_t handler_get_heap(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_get_heap - Start");
ESP_LOGD(TAG, "handler_get_heap uri: %s", req->uri);
#endif
std::string zw = "Heap info:<br>" + getESPHeapInfo();
#ifdef TASK_ANALYSIS_ON
char* pcTaskList = (char*) heap_caps_calloc(1, sizeof(char) * 768, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
if (pcTaskList) {
vTaskList(pcTaskList);
zw = zw + "<br><br>Task info:<br><pre>Name | State | Prio | Lowest stacksize | Creation order | CPU (-1=NoAffinity)<br>"
+ std::string(pcTaskList) + "</pre>";
heap_caps_free(pcTaskList);
}
else {
zw = zw + "<br><br>Task info:<br>ERROR - Allocation of TaskList buffer in PSRAM failed";
}
#endif
if (zw.length() > 0)
{
httpd_resp_send(req, zw.c_str(), zw.length());
}
else
{
httpd_resp_send(req, NULL, 0);
}
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_get_heap - Done");
#endif
return ESP_OK;
}
esp_err_t handler_init(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
@@ -875,15 +914,12 @@ void TFliteDoAutoStart()
{
BaseType_t xReturned;
int _i = configMINIMAL_STACK_SIZE;
ESP_LOGD(TAG, "task_autodoFlow configMINIMAL_STACK_SIZE: %d", _i);
ESP_LOGD(TAG, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
xReturned = xTaskCreate(&task_autodoFlow, "task_autodoFlow", configMINIMAL_STACK_SIZE * 35, NULL, tskIDLE_PRIORITY+1, &xHandletask_autodoFlow);
xReturned = xTaskCreatePinnedToCore(&task_autodoFlow, "task_autodoFlow", 16 * 1024, NULL, tskIDLE_PRIORITY+2, &xHandletask_autodoFlow, 0);
//xReturned = xTaskCreate(&task_autodoFlow, "task_autodoFlow", 16 * 1024, NULL, tskIDLE_PRIORITY+2, &xHandletask_autodoFlow);
if( xReturned != pdPASS )
{
//Memory: 64 --> 48 --> 35 --> 25
ESP_LOGD(TAG, "ERROR task_autodoFlow konnte nicht erzeugt werden!");
}
ESP_LOGD(TAG, "getESPHeapInfo: %s", getESPHeapInfo().c_str());
@@ -989,4 +1025,9 @@ void register_server_tflite_uri(httpd_handle_t server)
camuri.handler = handler_json;
camuri.user_ctx = (void*) "JSON";
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/heap";
camuri.handler = handler_get_heap;
camuri.user_ctx = (void*) "Heap";
httpd_register_uri_handler(server, &camuri);
}

View File

@@ -354,7 +354,7 @@ void LEDBlinkTask(int _dauer, int _anz, bool _off)
BlinkAnzahl = _anz;
BlinkOff = _off;
xTaskCreate(&task_doBlink, "task_doBlink", configMINIMAL_STACK_SIZE * 8, NULL, tskIDLE_PRIORITY+1, NULL);
xTaskCreate(&task_doBlink, "task_doBlink", 4 * 1024, NULL, tskIDLE_PRIORITY+1, NULL);
}
/////////////////////////////////////////////////////////