From 91ada353419e39ed8852399fc3cb46e62180ad82 Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Sat, 22 Jun 2024 13:16:03 -0400 Subject: [PATCH 1/5] Update Babble Board Pinout and Enable Emitters --- ESP/ini/pinouts.ini | 11 ++++++----- ESP/src/main.cpp | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ESP/ini/pinouts.ini b/ESP/ini/pinouts.ini index 88267a1..82b58b5 100644 --- a/ESP/ini/pinouts.ini +++ b/ESP/ini/pinouts.ini @@ -263,9 +263,9 @@ build_flags = pwdn_gpio_num = -1 reset_gpio_num = -1 xclk_gpio_num = 4 -siod_gpio_num = 14 -sioc_gpio_num = 13 -y9_gpio_num = 39 +siod_gpio_num = 48 +sioc_gpio_num = 47 +y9_gpio_num = 13 y8_gpio_num = 5 y7_gpio_num = 6 y6_gpio_num = 15 @@ -273,11 +273,12 @@ y5_gpio_num = 17 y4_gpio_num = 8 y3_gpio_num = 18 y2_gpio_num = 16 -vsync_gpio_num = 9 -href_gpio_num = 10 +vsync_gpio_num = 21 +href_gpio_num = 14 pclk_gpio_num = 7 build_flags = '-DCAMERA_MODULE_NAME="SWROOM_BABBLE_S3"' + -DCONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3=1 -DPWDN_GPIO_NUM=${pinoutSWROOMBABBLES3.PWDN_GPIO_NUM} -DRESET_GPIO_NUM=${pinoutSWROOMBABBLES3.RESET_GPIO_NUM} -DXCLK_GPIO_NUM=${pinoutSWROOMBABBLES3.XCLK_GPIO_NUM} diff --git a/ESP/src/main.cpp b/ESP/src/main.cpp index 881539b..db05ca3 100644 --- a/ESP/src/main.cpp +++ b/ESP/src/main.cpp @@ -11,6 +11,10 @@ SerialManager serialManager(&commandManager); #ifdef CONFIG_CAMERA_MODULE_ESP32S3_XIAO_SENSE LEDManager ledManager(LED_BUILTIN); + +#elif CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 +LEDManager ledManager(38); + #else LEDManager ledManager(33); #endif // ESP32S3_XIAO_SENSE @@ -82,6 +86,17 @@ void setup() { Logo::printASCII(); ledManager.begin(); + #ifdef CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 // Set IR emitter strength to 100%. + const int ledPin = 1; // Replace this with a command endpoint eventually. + const int freq = 5000; + const int ledChannel = 0; + const int resolution = 8; + const int dutyCycle = 255; + ledcSetup(ledChannel, freq, resolution); + ledcAttachPin(1, ledChannel); + ledcWrite(ledChannel, dutyCycle); + #endif + #ifndef SIM_ENABLED deviceConfig.attach(cameraHandler); #endif // SIM_ENABLED From 173dd1e6bada36452776fbdced452b2f543ae5d8 Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Mon, 25 Nov 2024 11:26:05 -0500 Subject: [PATCH 2/5] Update Babble Board Conf --- ESP/ini/boards.ini | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/ESP/ini/boards.ini b/ESP/ini/boards.ini index 8115cbf..aa8cfa3 100644 --- a/ESP/ini/boards.ini +++ b/ESP/ini/boards.ini @@ -190,6 +190,9 @@ upload_flags = --no-stub [env:Babble-wrooms-s3] board = esp32-s3-devkitc-1 +board_upload.flashsize = "4MB" +board_upload.flash_size=4MB +board_upload.maximum_size = 4194304 board_build.flash_mode = qio ; qio_qspi board_build.arduino.memory_type = qio_qspi build_type = debug @@ -200,8 +203,26 @@ build_flags = ${env.build_flags} ${pinoutSWROOMBABBLES3.build_flags} upload_flags = --no-stub -[env:Babble_USB-wrooms-s3] +[env:Babble-wrooms-s3_release] board = esp32-s3-devkitc-1 +board_upload.flashsize = "4MB" +board_upload.flash_size=4MB +board_upload.maximum_size = 4194304 +board_build.flash_mode = qio ; qio_qspi +board_build.arduino.memory_type = qio_qspi +build_type = debug +build_flags = ${env.build_flags} + -DCORE_DEBUG_LEVEL=1 + -DDEBUG_MODE=0 + -DSERIAL_MANAGER_USE_HIGHER_FREQUENCY + ${pinoutSWROOMBABBLES3.build_flags} +upload_flags = --no-stub + +[env:Babble_USB-wrooms-s3] ; Good conf +board = esp32-s3-devkitc-1 +board_upload.flashsize = "4MB" +board_upload.flash_size=4MB +board_upload.maximum_size = 4194304 board_build.flash_mode = qio ; qio_qspi board_build.arduino.memory_type = qio_qspi build_type = debug @@ -211,6 +232,25 @@ build_flags = ${env.build_flags} -DETVR_EYE_TRACKER_USB_API -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 + -DARDUINO_FLASH + -DSERIAL_MANAGER_USE_HIGHER_FREQUENCY + ${pinoutSWROOMBABBLES3.build_flags} +upload_flags = --no-stub + +[env:Babble_USB-wrooms-s3_release] +board = esp32-s3-devkitc-1 +board_upload.flashsize = "4MB" +board_upload.flash_size=4MB +board_upload.maximum_size = 4194304 +board_build.flash_mode = qio ; qio_qspi +board_build.arduino.memory_type = qio_qspi +build_type = debug +build_flags = ${env.build_flags} + -DCORE_DEBUG_LEVEL=1 + -DDEBUG_MODE=0 + -DETVR_EYE_TRACKER_USB_API + -DARDUINO_USB_MODE=1 + -DARDUINO_USB_CDC_ON_BOOT=1 -DSERIAL_MANAGER_USE_HIGHER_FREQUENCY ${pinoutSWROOMBABBLES3.build_flags} upload_flags = --no-stub From 04275fddb6de04ea7a009c0ab8bf367e493f73cf Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Thu, 19 Dec 2024 12:19:36 -0500 Subject: [PATCH 3/5] Lower AEC value for Babble boards --- ESP/lib/src/io/camera/cameraHandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ESP/lib/src/io/camera/cameraHandler.cpp b/ESP/lib/src/io/camera/cameraHandler.cpp index 7b51bdb..353c83d 100644 --- a/ESP/lib/src/io/camera/cameraHandler.cpp +++ b/ESP/lib/src/io/camera/cameraHandler.cpp @@ -108,6 +108,10 @@ void CameraHandler::setupCameraSensor() { camera_sensor->set_aec2(camera_sensor, 0); // 0 = disable , 1 = enable camera_sensor->set_ae_level(camera_sensor, 0); // -2 to 2 camera_sensor->set_aec_value(camera_sensor, 300); // 0 to 1200 + // Use a lower aec value for babble to better isolate the face with illuminators + #ifdef CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 + camera_sensor->set_aec_value(camera_sensor, 100); // 0 to 1200 + #endif // controls the gain camera_sensor->set_gain_ctrl(camera_sensor, 0); // 0 = disable , 1 = enable From 41410e4150bbfa57e15961032b0c7838bd7c65ad Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Sat, 21 Dec 2024 13:51:57 -0500 Subject: [PATCH 4/5] Remove Comments --- ESP/ini/boards.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ESP/ini/boards.ini b/ESP/ini/boards.ini index aa8cfa3..868b7fc 100644 --- a/ESP/ini/boards.ini +++ b/ESP/ini/boards.ini @@ -193,7 +193,7 @@ board = esp32-s3-devkitc-1 board_upload.flashsize = "4MB" board_upload.flash_size=4MB board_upload.maximum_size = 4194304 -board_build.flash_mode = qio ; qio_qspi +board_build.flash_mode = qio board_build.arduino.memory_type = qio_qspi build_type = debug build_flags = ${env.build_flags} @@ -208,7 +208,7 @@ board = esp32-s3-devkitc-1 board_upload.flashsize = "4MB" board_upload.flash_size=4MB board_upload.maximum_size = 4194304 -board_build.flash_mode = qio ; qio_qspi +board_build.flash_mode = qio board_build.arduino.memory_type = qio_qspi build_type = debug build_flags = ${env.build_flags} @@ -218,12 +218,12 @@ build_flags = ${env.build_flags} ${pinoutSWROOMBABBLES3.build_flags} upload_flags = --no-stub -[env:Babble_USB-wrooms-s3] ; Good conf +[env:Babble_USB-wrooms-s3] board = esp32-s3-devkitc-1 board_upload.flashsize = "4MB" board_upload.flash_size=4MB board_upload.maximum_size = 4194304 -board_build.flash_mode = qio ; qio_qspi +board_build.flash_mode = qio board_build.arduino.memory_type = qio_qspi build_type = debug build_flags = ${env.build_flags} @@ -242,7 +242,7 @@ board = esp32-s3-devkitc-1 board_upload.flashsize = "4MB" board_upload.flash_size=4MB board_upload.maximum_size = 4194304 -board_build.flash_mode = qio ; qio_qspi +board_build.flash_mode = qio board_build.arduino.memory_type = qio_qspi build_type = debug build_flags = ${env.build_flags} From 25f01a05720677449dbfdeb49f114710c0e99472 Mon Sep 17 00:00:00 2001 From: Rames The Generic Date: Mon, 23 Dec 2024 22:16:43 -0500 Subject: [PATCH 5/5] Add Firmware cropping to for the Babble Board --- ESP/lib/src/io/camera/cameraHandler.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ESP/lib/src/io/camera/cameraHandler.cpp b/ESP/lib/src/io/camera/cameraHandler.cpp index 353c83d..aa9c2b3 100644 --- a/ESP/lib/src/io/camera/cameraHandler.cpp +++ b/ESP/lib/src/io/camera/cameraHandler.cpp @@ -199,7 +199,29 @@ void CameraHandler::loadConfigData() { log_d("Loading camera config data done"); } -int CameraHandler::setCameraResolution(framesize_t frameSize) { +#ifdef CONFIG_CAMERA_MODULE_SWROOM_BABBLE_S3 +int CameraHandler::setCameraResolution(framesize_t frameSize) { // For Babble, use a firmware crop as shown by Physdude + if (camera_sensor->pixformat == PIXFORMAT_JPEG) { + try { + int outputSize = 240; + + int baseRes = 2; //CIF + int ROIsize = 240; + int startPointX = 80; + int startPointY = 28; + + return camera_sensor->set_res_raw(camera_sensor, baseRes, 0, 0, 0, startPointX, startPointY, ROIsize, ROIsize, outputSize, outputSize, 0, 0); + + } catch (...) { + // they sent us a malformed or unsupported frameSize - rather than crash - + // tell them about it + return -1; + } + } + return -1; +} +#else +int CameraHandler::setCameraResolution(framesize_t frameSize) { // By default, use the standard method. if (camera_sensor->pixformat == PIXFORMAT_JPEG) { try { return camera_sensor->set_framesize(camera_sensor, frameSize); @@ -211,6 +233,7 @@ int CameraHandler::setCameraResolution(framesize_t frameSize) { } return -1; } +#endif int CameraHandler::setVFlip(int direction) { return camera_sensor->set_vflip(camera_sensor, direction);