mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-19 06:23:44 +02:00
PoC wired mode over UVC, add logs over websockets, needs cleanup
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "esp_log.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_camera.h"
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_psram.h"
|
||||
|
||||
@@ -16,12 +15,40 @@
|
||||
#include <LEDManager.hpp>
|
||||
#include <MDNSManager.hpp>
|
||||
#include <CameraManager.hpp>
|
||||
#include <WebSocketLogger.hpp>
|
||||
#include <StreamServer.hpp>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef CONFIG_WIRED_MODE
|
||||
#include <UVCStream.hpp>
|
||||
#endif
|
||||
|
||||
#define BLINK_GPIO (gpio_num_t) CONFIG_BLINK_GPIO
|
||||
|
||||
static const char *TAG = "[MAIN]";
|
||||
|
||||
WebSocketLogger webSocketLogger;
|
||||
|
||||
// TODO add this option
|
||||
// ProjectConfig deviceConfig("openiris", MDNS_HOSTNAME);
|
||||
ProjectConfig deviceConfig("openiris", "openiristracker");
|
||||
WiFiManager wifiManager;
|
||||
MDNSManager mdnsManager(deviceConfig);
|
||||
CameraManager cameraHandler(deviceConfig);
|
||||
StreamServer streamServer(80);
|
||||
|
||||
#ifdef CONFIG_WIRED_MODE
|
||||
UVCStreamManager uvcStream;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_ILLUMNATIOR_PIN
|
||||
// LEDManager ledManager(BLINK_GPIO, ILLUMINATOR_PIN);
|
||||
LEDManager ledManager(BLINK_GPIO, 1);
|
||||
#else
|
||||
LEDManager ledManager(BLINK_GPIO);
|
||||
#endif
|
||||
|
||||
static void initNVSStorage()
|
||||
{
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
@@ -33,8 +60,22 @@ static void initNVSStorage()
|
||||
ESP_ERROR_CHECK(ret);
|
||||
}
|
||||
|
||||
int test_log(const char *format, va_list args)
|
||||
{
|
||||
webSocketLogger.log_message(format, args);
|
||||
return vprintf(format, args);
|
||||
}
|
||||
|
||||
void mylog(const char *format, ...);
|
||||
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
// uvc plan
|
||||
|
||||
// cleanup the logs - done
|
||||
// prepare the camera to be initialized with UVC
|
||||
// debug uvc performance - done
|
||||
|
||||
// porting plan:
|
||||
// port the wifi manager first. - worky!!!
|
||||
// get it connect to the network and setup an AP with hardcoded creds first -- connects. AP will be next
|
||||
@@ -52,35 +93,24 @@ extern "C" void app_main(void)
|
||||
// then port the Elegant OTA stuff
|
||||
// then port the serial manager
|
||||
|
||||
// TODO add this option
|
||||
// ProjectConfig deviceConfig("openiris", MDNS_HOSTNAME);
|
||||
ProjectConfig deviceConfig("openiris", "openiristracker");
|
||||
WiFiManager wifiManager;
|
||||
MDNSManager mdnsManager(deviceConfig);
|
||||
CameraManager cameraHandler(deviceConfig);
|
||||
StreamServer streamServer;
|
||||
|
||||
#ifdef CONFIG_USE_ILLUMNATIOR_PIN
|
||||
// LEDManager ledManager(BLINK_GPIO, ILLUMINATOR_PIN);
|
||||
LEDManager ledManager(BLINK_GPIO, 1);
|
||||
#else
|
||||
LEDManager ledManager(BLINK_GPIO);
|
||||
#endif
|
||||
|
||||
Logo::printASCII();
|
||||
initNVSStorage();
|
||||
|
||||
esp_log_set_vprintf(&test_log);
|
||||
ledManager.setup();
|
||||
deviceConfig.load();
|
||||
wifiManager.Begin();
|
||||
mdnsManager.start();
|
||||
cameraHandler.setupCamera();
|
||||
// cameraHandler.setupCamera();
|
||||
streamServer.startStreamServer();
|
||||
|
||||
#ifdef CONFIG_WIRED_MODE
|
||||
uvcStream.setup();
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
ledManager.handleLED();
|
||||
|
||||
vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user