add code for presence detection

This commit is contained in:
technyon
2022-04-05 21:35:21 +02:00
parent 286ac0effe
commit 4616b5e020
7 changed files with 162 additions and 8 deletions

View File

@@ -4,12 +4,14 @@
#include "WebCfgServer.h"
#include <FreeRTOS.h>
#include "PreferencesKeys.h"
#include "PresenceDetection.h"
#define ESP32
Network* network;
WebCfgServer* webCfgServer;
NukiWrapper* nuki;
PresenceDetection* presenceDetection;
Preferences* preferences;
void networkTask(void *pvParameters)
@@ -29,10 +31,19 @@ void nukiTask(void *pvParameters)
}
}
void presenceDetectionTask(void *pvParameters)
{
while(true)
{
presenceDetection->update();
}
}
void setupTasks()
{
xTaskCreate(networkTask, "ntw", 16384, NULL, 1, NULL);
xTaskCreate(nukiTask, "nuki", 8192, NULL, 1, NULL);
xTaskCreate(presenceDetectionTask, "prdet", 1024, NULL, 1, NULL);
}
uint32_t getRandomId()
@@ -66,8 +77,11 @@ void setup()
nuki = new NukiWrapper("ESP", deviceId, network, preferences);
webCfgServer = new WebCfgServer(nuki, network, preferences);
webCfgServer->initialize();
nuki->initialize();
presenceDetection = new PresenceDetection(nuki->bleScanner());
presenceDetection->initialize();
setupTasks();
}