diff --git a/main/application.cc b/main/application.cc index 981a675..1095710 100644 --- a/main/application.cc +++ b/main/application.cc @@ -682,6 +682,10 @@ void Application::ToggleChatStateWithVision() { xEventGroupSetBits(event_group_, MAIN_EVENT_TOGGLE_CHAT); } +bool Application::IsVisionTextModeEnabled() const { + return vision_text_mode_enabled_.load(); +} + void Application::StartListening() { vision_text_mode_enabled_.store(false); xEventGroupSetBits(event_group_, MAIN_EVENT_START_LISTENING); @@ -968,7 +972,7 @@ void Application::SendCurrentVisionFrame() { } std::string jpeg_data; - if (!camera->CaptureToJpeg(jpeg_data, false)) { + if (!camera->CaptureToJpeg(jpeg_data, true)) { ESP_LOGW(TAG, "Failed to capture vision frame"); return; } diff --git a/main/application.h b/main/application.h index 8aae2c5..a4fb7a5 100644 --- a/main/application.h +++ b/main/application.h @@ -93,6 +93,7 @@ public: */ void ToggleChatState(); void ToggleChatStateWithVision(); + bool IsVisionTextModeEnabled() const; /** * Start listening (event-based, thread-safe) diff --git a/main/boards/m5stack-core-s3/m5stack_core_s3.cc b/main/boards/m5stack-core-s3/m5stack_core_s3.cc index 0513491..33c8cd4 100644 --- a/main/boards/m5stack-core-s3/m5stack_core_s3.cc +++ b/main/boards/m5stack-core-s3/m5stack_core_s3.cc @@ -349,7 +349,10 @@ private: continue; } - if (board->camera_->CaptureBackground()) { + bool capture_ok = Application::GetInstance().IsVisionTextModeEnabled() + ? board->camera_->Capture() + : board->camera_->CaptureBackground(); + if (capture_ok) { if (!has_logged_success) { ESP_LOGI(TAG, "Background vision sampler started"); has_logged_success = true;