mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-18 14:03:45 +02:00
WIP port of camera manager
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
/* Blink Example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -13,16 +5,17 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "usb_device_uvc.h"
|
||||
#include "esp_camera.h"
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_psram.h"
|
||||
|
||||
#include <openiris_logo.hpp>
|
||||
#include <wifiManager.hpp>
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <LEDManager.hpp>
|
||||
#include <MDNSManager.hpp>
|
||||
#include <CameraManager.hpp>
|
||||
|
||||
#define BLINK_GPIO (gpio_num_t) CONFIG_BLINK_GPIO
|
||||
|
||||
@@ -50,9 +43,10 @@ extern "C" void app_main(void)
|
||||
// State Management - done
|
||||
// then port the led manager as this will be fairly easy - done
|
||||
// then port the mdns stuff - done
|
||||
// then port the camera manager - in progress
|
||||
// then port the streaming stuff (web and uvc) - in progress
|
||||
|
||||
// then add ADHOC and support for more networks in wifi manager
|
||||
// then port the camera manager
|
||||
// then port the streaming stuff (web and uvc)
|
||||
// then port the async web server
|
||||
// then port the Elegant OTA stuff
|
||||
// then port the serial manager
|
||||
@@ -62,8 +56,9 @@ extern "C" void app_main(void)
|
||||
ProjectConfig deviceConfig("openiris", "openiristracker");
|
||||
WiFiManager wifiManager;
|
||||
MDNSManager mdnsManager(deviceConfig);
|
||||
CameraManager cameraHandler(deviceConfig);
|
||||
|
||||
#ifdef USE_ILLUMNATIOR_PIN
|
||||
#ifdef CONFIG_USE_ILLUMNATIOR_PIN
|
||||
// LEDManager ledManager(BLINK_GPIO, ILLUMINATOR_PIN);
|
||||
LEDManager ledManager(BLINK_GPIO, 1);
|
||||
#else
|
||||
@@ -77,10 +72,30 @@ extern "C" void app_main(void)
|
||||
deviceConfig.load();
|
||||
wifiManager.Begin();
|
||||
mdnsManager.start();
|
||||
cameraHandler.setupCamera();
|
||||
|
||||
while (1)
|
||||
{
|
||||
ledManager.handleLED();
|
||||
|
||||
ESP_LOGI(TAG, "Free heap: %u, free PSRAM: %u", esp_get_free_heap_size(), esp_get_free_internal_heap_size());
|
||||
heap_caps_print_heap_info(MALLOC_CAP_SPIRAM);
|
||||
|
||||
if (cameraStateManager.getCurrentState() != CameraState_e::Camera_Success)
|
||||
return;
|
||||
|
||||
ESP_LOGI(TAG, "Taking picture...");
|
||||
camera_fb_t *pic = esp_camera_fb_get();
|
||||
|
||||
// use pic->buf to access the image
|
||||
if (pic == NULL)
|
||||
{
|
||||
ESP_LOGE(TAG, "Camera capture failed");
|
||||
continue;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Picture taken! Its size was: %zu bytes", pic->len);
|
||||
esp_camera_fb_return(pic);
|
||||
vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user