optimize memory usage

This commit is contained in:
technyon
2022-06-14 22:12:43 +02:00
parent 28025596bf
commit 2c0b9dcdfc
2 changed files with 10 additions and 8 deletions

View File

@@ -30,7 +30,9 @@ void networkTask(void *pvParameters)
network->update(); network->update();
networkOpener->update(); networkOpener->update();
webCfgServer->update(); webCfgServer->update();
vTaskDelay(200 / portTICK_PERIOD_MS); delay(200);
// Serial.print(F("#### ")); Serial.println(uxTaskGetStackHighWaterMark(NULL));
} }
} }
@@ -39,13 +41,13 @@ void nukiTask(void *pvParameters)
while(true) while(true)
{ {
bleScanner->update(); bleScanner->update();
vTaskDelay( 20 / portTICK_PERIOD_MS); delay(20);
bool needsPairing = (lockEnabled && !nuki->isPaired()) || (openerEnabled && !nukiOpener->isPaired()); bool needsPairing = (lockEnabled && !nuki->isPaired()) || (openerEnabled && !nukiOpener->isPaired());
if (needsPairing) if (needsPairing)
{ {
vTaskDelay( 5000 / portTICK_PERIOD_MS); delay(5000);
} }
if(lockEnabled) if(lockEnabled)
@@ -71,7 +73,7 @@ void checkMillisTask(void *pvParameters)
{ {
while(true) while(true)
{ {
vTaskDelay( 60000 / portTICK_PERIOD_MS); delay(60000);
// millis() is about to overflow. Restart device to prevent problems with overflow // millis() is about to overflow. Restart device to prevent problems with overflow
if(millis() > (2^32) - 5 * 60000) if(millis() > (2^32) - 5 * 60000)
{ {
@@ -87,9 +89,9 @@ void setupTasks()
{ {
// configMAX_PRIORITIES is 25 // configMAX_PRIORITIES is 25
xTaskCreate(networkTask, "ntw", 65536, NULL, 3, NULL); xTaskCreate(networkTask, "ntw", 8192, NULL, 3, NULL);
xTaskCreate(nukiTask, "nuki", 8192, NULL, 2, NULL); xTaskCreate(nukiTask, "nuki", 4096, NULL, 2, NULL);
xTaskCreate(presenceDetectionTask, "prdet", 1024, NULL, 5, NULL); xTaskCreate(presenceDetectionTask, "prdet", 768, NULL, 5, NULL);
xTaskCreate(checkMillisTask, "mlchk", 512, NULL, 1, NULL); xTaskCreate(checkMillisTask, "mlchk", 512, NULL, 1, NULL);
} }

View File

@@ -20,6 +20,6 @@ public:
virtual bool isConnected() = 0; virtual bool isConnected() = 0;
protected: protected:
const uint16_t _mqttMaxBufferSize = 16384; const uint16_t _mqttMaxBufferSize = 6144;
const String _hostname; const String _hostname;
}; };