Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions main/boards/lilygo-t-cameraplus-s3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@
#define DISPLAY_BACKLIGHT_PIN DISPLAY_BL
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false

#define AP1511B_GPIO static_cast<gpio_num_t>(AP1511B_FBC)

#endif // _BOARD_CONFIG_H_
44 changes: 44 additions & 0 deletions main/boards/lilygo-t-cameraplus-s3/ir_filter_controller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef __IR_FILTER_CONTROLLER_H__
#define __IR_FILTER_CONTROLLER_H__

#include "mcp_server.h"


class IrFilterController {
private:
bool enable_ = false;
gpio_num_t gpio_num_;

public:
IrFilterController(gpio_num_t gpio_num) : gpio_num_(gpio_num) {
gpio_config_t config = {
.pin_bit_mask = (1ULL << gpio_num_),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE,
};
ESP_ERROR_CHECK(gpio_config(&config));
gpio_set_level(gpio_num_, 0);

auto& mcp_server = McpServer::GetInstance();
mcp_server.AddTool("self.camera.get_ir_filter_state", "Get the state of the camera's infrared filter", PropertyList(), [this](const PropertyList& properties) -> ReturnValue {
return enable_ ? "{\"enable\": true}" : "{\"enable\": false}";
});

mcp_server.AddTool("self.camera.enable_ir_filter", "Enable the camera's infrared filter", PropertyList(), [this](const PropertyList& properties) -> ReturnValue {
enable_ = true;
gpio_set_level(gpio_num_, 1);
return true;
});

mcp_server.AddTool("self.camera.disable_ir_filter", "Disable the camera's infrared filter", PropertyList(), [this](const PropertyList& properties) -> ReturnValue {
enable_ = false;
gpio_set_level(gpio_num_, 0);
return true;
});
}
};


#endif // __IR_FILTER_CONTROLLER_H__
3 changes: 3 additions & 0 deletions main/boards/lilygo-t-cameraplus-s3/lilygo-t-cameraplus-s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "sy6970.h"
#include "pin_config.h"
#include "esp32_camera.h"
#include "ir_filter_controller.h"

#include <esp_log.h>
#include <esp_lcd_panel_vendor.h>
Expand Down Expand Up @@ -292,6 +293,8 @@ class LilygoTCameraPlusS3Board : public WifiBoard {
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
thing_manager.AddThing(iot::CreateThing("Battery"));
#elif CONFIG_IOT_PROTOCOL_MCP
static IrFilterController irFilter(AP1511B_GPIO);
#endif
GetBacklight()->RestoreBrightness();
}
Expand Down
13 changes: 5 additions & 8 deletions main/boards/lilygo-t-circle-s3/lilygo-t-circle-s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ class LilygoTCircleS3Board : public WifiBoard {
});
}

// 物联网初始化,添加对 AI 可见设备
void InitializeIot() {
auto &thing_manager = iot::ThingManager::GetInstance();
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
}

public:
LilygoTCircleS3Board() : boot_button_(BOOT_BUTTON_GPIO) {
InitializePowerSaveTimer();
Expand All @@ -238,7 +231,11 @@ class LilygoTCircleS3Board : public WifiBoard {
InitSpi();
InitGc9d01nDisplay();
InitializeButtons();
InitializeIot();
#if CONFIG_IOT_PROTOCOL_XIAOZHI
auto &thing_manager = iot::ThingManager::GetInstance();
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
#endif
GetBacklight()->RestoreBrightness();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,6 @@ class LilygoTDisplays3ProMVSRLoraBoard : public WifiBoard {
});
}

// 物联网初始化,添加对 AI 可见设备
void InitializeIot() {
auto &thing_manager = iot::ThingManager::GetInstance();
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
}

public:
LilygoTDisplays3ProMVSRLoraBoard() : boot_button_(BOOT_BUTTON_GPIO) {
InitializePowerSaveTimer();
Expand All @@ -263,7 +256,11 @@ class LilygoTDisplays3ProMVSRLoraBoard : public WifiBoard {
InitSpi();
InitSt7796Display();
InitializeButtons();
InitializeIot();
#if CONFIG_IOT_PROTOCOL_XIAOZHI
auto &thing_manager = iot::ThingManager::GetInstance();
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
#endif
GetBacklight()->RestoreBrightness();
}

Expand Down