forked from xiaozhi/xiaozhi-esp32
iot增加屏幕背光亮度调节 (#150)
This commit is contained in:
@@ -23,6 +23,7 @@ public:
|
||||
virtual void SetEmotion(const std::string &emotion);
|
||||
virtual void SetChatMessage(const std::string &role, const std::string &content);
|
||||
virtual void SetIcon(const char* icon);
|
||||
virtual void SetBacklight(uint8_t brightness) = 0;
|
||||
|
||||
int width() const { return width_; }
|
||||
int height() const { return height_; }
|
||||
|
||||
@@ -132,7 +132,7 @@ void LcdDisplay::InitializeBacklight(gpio_num_t backlight_pin) {
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
.duty_resolution = LEDC_TIMER_10_BIT,
|
||||
.timer_num = LEDC_TIMER_0,
|
||||
.freq_hz = 5000,
|
||||
.freq_hz = 20000,//背光pwm频率需要高一点,防止电感啸叫
|
||||
.clk_cfg = LEDC_AUTO_CLK,
|
||||
.deconfigure = false
|
||||
};
|
||||
|
||||
@@ -31,7 +31,6 @@ protected:
|
||||
DisplayFonts fonts_;
|
||||
|
||||
void InitializeBacklight(gpio_num_t backlight_pin);
|
||||
void SetBacklight(uint8_t brightness);
|
||||
|
||||
virtual void SetupUI();
|
||||
virtual bool Lock(int timeout_ms = 0) override;
|
||||
@@ -47,6 +46,7 @@ public:
|
||||
void SetChatMessage(const std::string &role, const std::string &content) override;
|
||||
void SetEmotion(const std::string &emotion) override;
|
||||
void SetIcon(const char* icon) override;
|
||||
void SetBacklight(uint8_t brightness);
|
||||
};
|
||||
|
||||
#endif // LCD_DISPLAY_H
|
||||
|
||||
@@ -7,7 +7,9 @@ class NoDisplay : public Display {
|
||||
private:
|
||||
virtual bool Lock(int timeout_ms = 0) override;
|
||||
virtual void Unlock() override;
|
||||
|
||||
virtual void SetBacklight(uint8_t brightness) override {
|
||||
// 空实现,因为这是一个无显示设备
|
||||
}
|
||||
public:
|
||||
NoDisplay();
|
||||
~NoDisplay();
|
||||
|
||||
Reference in New Issue
Block a user