diff --git a/components/UVCStream/UVCStream/UVCStream.cpp b/components/UVCStream/UVCStream/UVCStream.cpp index f97db5f..d5667d0 100644 --- a/components/UVCStream/UVCStream/UVCStream.cpp +++ b/components/UVCStream/UVCStream/UVCStream.cpp @@ -108,6 +108,12 @@ static void UVCStreamHelpers::camera_fb_return_cb(uvc_fb_t *fb, void *cb_ctx) esp_err_t UVCStreamManager::setup() { + +#ifndef CONFIG_WIRED_MODE + ESP_LOGE(UVC_STREAM_TAG, "The board does not support UVC, please, setup WiFi connection."); + return; +#endif + ESP_LOGI(UVC_STREAM_TAG, "Setting up UVC Stream"); uvc_buffer = static_cast(malloc(UVC_MAX_FRAMESIZE_SIZE)); diff --git a/components/usb_device_uvc/idf_component.yml b/components/usb_device_uvc/idf_component.yml index 4456f24..b0276a2 100644 --- a/components/usb_device_uvc/idf_component.yml +++ b/components/usb_device_uvc/idf_component.yml @@ -1,10 +1,10 @@ dependencies: cmake_utilities: - version: '*' + version: "*" espressif/tinyusb: - version: '>=0.15.0~10' + version: "=0.15.0~10" idf: - version: '>=5.0' + version: ">=5.0" description: USB Device UVC, Streaming Video to Host documentation: https://docs.espressif.com/projects/esp-iot-solution/en/latest/usb/usb_device/usb_device_uvc.html issues: https://github.com/espressif/esp-iot-solution/issues @@ -13,8 +13,8 @@ repository_info: commit_sha: e2529ce3b0aa6362663b4c53d7e9ba21ff307f49 path: components/usb/usb_device_uvc targets: -- esp32s2 -- esp32s3 -- esp32p4 + - esp32s2 + - esp32s3 + - esp32p4 url: https://github.com/espressif/esp-iot-solution/tree/master/components/usb/usb_device_uvc version: 1.1.0 diff --git a/dependencies.lock b/dependencies.lock index 2d73027..c56cb65 100644 --- a/dependencies.lock +++ b/dependencies.lock @@ -10,12 +10,12 @@ dependencies: type: service version: 1.1.1 espressif/esp32-camera: - component_hash: a82de4ee0b383bd34695935385c6a6c720129084580c2bbb55dce76eb2a3788f + component_hash: c3eb05fbeeae884a23bed9b17d48d5f0da8872beadae0c0e747d2fbea6094f06 dependencies: [] source: registry_url: https://components.espressif.com/ type: service - version: 2.0.13 + version: 2.0.15 espressif/led_strip: component_hash: 28c6509a727ef74925b372ed404772aeedf11cce10b78c3f69b3c66799095e2d dependencies: @@ -27,7 +27,7 @@ dependencies: type: service version: 2.5.5 espressif/mdns: - component_hash: af6306fe65d637a3683d1cf671508fcedd6b05f9ca029a8815abeab64001fb8d + component_hash: 3ec0af5f6bce310512e90f482388d21cc7c0e99668172d2f895356165fc6f7c5 dependencies: - name: idf require: private @@ -35,9 +35,9 @@ dependencies: source: registry_url: https://components.espressif.com/ type: service - version: 1.4.0 + version: 1.8.2 espressif/tinyusb: - component_hash: 10703da2c3cd39a944711ee3d320c6dda54debabf13b4b933a7c90daf102372b + component_hash: 214989d502fc168241a4a4f83b097d8ac44a93cd6f1787b4ac10069a8b3bebd3 dependencies: - name: idf require: private @@ -49,7 +49,7 @@ dependencies: - esp32s2 - esp32s3 - esp32p4 - version: 0.18.0~2 + version: 0.15.0~10 idf: source: type: idf @@ -61,6 +61,6 @@ direct_dependencies: - espressif/mdns - espressif/tinyusb - idf -manifest_hash: 1f812e7723bfe7dc357c54a3f01b77580502ba368553b7d186d3a0fbc2a82bab +manifest_hash: b8a462b847225cdc561c820962ae0cb021d5ff7d688964bd6786f78b99dfa205 target: esp32s3 version: 2.0.0 diff --git a/main/openiris_main.cpp b/main/openiris_main.cpp index 688e2c3..e5e9744 100644 --- a/main/openiris_main.cpp +++ b/main/openiris_main.cpp @@ -64,7 +64,7 @@ static void initNVSStorage() { ESP_ERROR_CHECK(ret); } -int test_log(const char *format, va_list args) { +int websocket_logger(const char *format, va_list args) { webSocketLogger.log_message(format, args); return vprintf(format, args); } @@ -77,24 +77,31 @@ void disable_serial_manager_task(TaskHandle_t serialManagerHandle) { // After setting everything up, we start a 30s timer with this as a callback // if we get anything on the serial, we stop the timer and reset it after the commands are done // this is done to ensure the user has enough time to configure the board if need be -// -// todo: check the initial PR by Summer and port the device mode from that, should be useful -// but we'll have to rethink it void start_video_streaming(void *arg) { - if (!deviceConfig->getWifiConfigs().empty() || strcmp(CONFIG_WIFI_SSID, "") != 0) { - // make sure the server runs on a separate core - ESP_LOGI("[MAIN]", "WiFi setup detected, starting WiFi streaming."); - streamServer.startStreamServer(); - } else { -#ifdef CONFIG_WIRED_MODE - ESP_LOGI("[MAIN]", "UVC setup detected, starting UVC streaming."); - uvcStream.setup(); -#else - ESP_LOGE("[MAIN]", "The board does not support UVC, please, setup WiFi connection."); -#endif + // if we're in auto-mode, we can decide which streaming helper to start based on the + // presence of Wi-Fi credentials + ESP_LOGI("[MAIN]", "Setup window expired, starting streaming services, quitting serial manager."); + switch (deviceConfig->getDeviceMode().mode) { + case StreamingMode::AUTO: + if (!deviceConfig->getWifiConfigs().empty() || strcmp(CONFIG_WIFI_SSID, "") != 0) { + // todo make sure the server runs on a separate core + ESP_LOGI("[MAIN]", "WiFi setup detected, starting WiFi streaming."); + streamServer.startStreamServer(); + } else { + ESP_LOGI("[MAIN]", "UVC setup detected, starting UVC streaming."); + uvcStream.setup(); + } + break; + case StreamingMode::UVC: + ESP_LOGI("[MAIN]", "Device set to UVC Mode, starting UVC streaming."); + uvcStream.setup(); + break; + case StreamingMode::WIFI: + ESP_LOGI("[MAIN]", "Device set to Wi-Fi mode, starting WiFi streaming."); + streamServer.startStreamServer(); + break; } - ESP_LOGI("[MAIN]", "Setup window expired, started streaming services, quitting serial manager."); const auto serialTaskHandle = static_cast(arg); disable_serial_manager_task(serialTaskHandle); } @@ -151,13 +158,13 @@ extern "C" void app_main(void) { // rethink led manager - we need to move the state change sending into a queue and rethink the state lighting logic - DONE // also, the entire led manager needs to be moved to a task - DONE - // with that, I couuld use vtaskdelayuntil to advance and display states - // and with that, I should rethink how state management works + // with that, I couuld use vtaskdelayuntil to advance and display states - DONE + // and with that, I should rethink how state management works - DONE // rethink state management - DONE - // port serial manager - DONE - needs rewrite - // instead of the UVCCDC thing - give the board 30s for serial commands and then determine if we should reboot into UVC + // port serial manager - DONE + // instead of the UVCCDC thing - give the board 30s for serial commands and then determine if we should reboot into UVC - DONE // add endpoint to check firmware version // add firmware version somewhere @@ -167,7 +174,7 @@ extern "C" void app_main(void) { Logo::printASCII(); initNVSStorage(); - // esp_log_set_vprintf(&test_log); + // esp_log_set_vprintf(&websocket_logger); ledManager->setup(); xTaskCreate(