mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2025-05-17 23:28:09 +08:00
fix no oled display error
This commit is contained in:
@ -8,7 +8,6 @@ set(SOURCES "audio_codecs/audio_codec.cc"
|
|||||||
"led/circular_strip.cc"
|
"led/circular_strip.cc"
|
||||||
"led/gpio_led.cc"
|
"led/gpio_led.cc"
|
||||||
"display/display.cc"
|
"display/display.cc"
|
||||||
"display/no_display.cc"
|
|
||||||
"display/lcd_display.cc"
|
"display/lcd_display.cc"
|
||||||
"display/oled_display.cc"
|
"display/oled_display.cc"
|
||||||
"protocols/protocol.cc"
|
"protocols/protocol.cc"
|
||||||
|
@ -29,7 +29,7 @@ private:
|
|||||||
i2c_master_bus_handle_t display_i2c_bus_;
|
i2c_master_bus_handle_t display_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
|
|
||||||
void InitializeDisplayI2c() {
|
void InitializeDisplayI2c() {
|
||||||
i2c_master_bus_config_t bus_config = {
|
i2c_master_bus_config_t bus_config = {
|
||||||
@ -83,6 +83,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ private:
|
|||||||
i2c_master_bus_handle_t display_i2c_bus_;
|
i2c_master_bus_handle_t display_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button touch_button_;
|
Button touch_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
@ -82,6 +82,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
i2c_master_bus_handle_t display_i2c_bus_;
|
i2c_master_bus_handle_t display_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button touch_button_;
|
Button touch_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
@ -83,6 +83,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "system_info.h"
|
#include "system_info.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "display/no_display.h"
|
#include "display/display.h"
|
||||||
#include "assets/lang_config.h"
|
#include "assets/lang_config.h"
|
||||||
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
@ -26,7 +26,7 @@ private:
|
|||||||
i2c_master_bus_handle_t codec_i2c_bus_;
|
i2c_master_bus_handle_t codec_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
Button volume_down_button_;
|
Button volume_down_button_;
|
||||||
@ -108,6 +108,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ private:
|
|||||||
i2c_master_bus_handle_t codec_i2c_bus_;
|
i2c_master_bus_handle_t codec_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Pmic* pmic_ = nullptr;
|
Pmic* pmic_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
@ -137,6 +137,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
i2c_master_bus_handle_t codec_i2c_bus_;
|
i2c_master_bus_handle_t codec_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Pmic* pmic_ = nullptr;
|
Pmic* pmic_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
@ -156,6 +156,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ private:
|
|||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
Button volume_down_button_;
|
Button volume_down_button_;
|
||||||
OledDisplay* display_;
|
Display* display_;
|
||||||
PowerSaveTimer* power_save_timer_;
|
PowerSaveTimer* power_save_timer_;
|
||||||
PowerManager* power_manager_;
|
PowerManager* power_manager_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
@ -127,6 +127,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ private:
|
|||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
Button volume_up_button_;
|
Button volume_up_button_;
|
||||||
Button volume_down_button_;
|
Button volume_down_button_;
|
||||||
OledDisplay* display_;
|
Display* display_;
|
||||||
PowerSaveTimer* power_save_timer_;
|
PowerSaveTimer* power_save_timer_;
|
||||||
PowerManager* power_manager_;
|
PowerManager* power_manager_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
@ -129,6 +129,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ private:
|
|||||||
i2c_master_bus_handle_t codec_i2c_bus_;
|
i2c_master_bus_handle_t codec_i2c_bus_;
|
||||||
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
esp_lcd_panel_io_handle_t panel_io_ = nullptr;
|
||||||
esp_lcd_panel_handle_t panel_ = nullptr;
|
esp_lcd_panel_handle_t panel_ = nullptr;
|
||||||
OledDisplay* display_ = nullptr;
|
Display* display_ = nullptr;
|
||||||
Button boot_button_;
|
Button boot_button_;
|
||||||
bool press_to_talk_enabled_ = false;
|
bool press_to_talk_enabled_ = false;
|
||||||
PowerSaveTimer* power_save_timer_;
|
PowerSaveTimer* power_save_timer_;
|
||||||
@ -107,6 +107,7 @@ private:
|
|||||||
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_));
|
||||||
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
if (esp_lcd_panel_init(panel_) != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize display");
|
ESP_LOGE(TAG, "Failed to initialize display");
|
||||||
|
display_ = new NoDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,12 @@ private:
|
|||||||
Display *display_;
|
Display *display_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NoDisplay : public Display {
|
||||||
|
private:
|
||||||
|
virtual bool Lock(int timeout_ms = 0) override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual void Unlock() override {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#include "no_display.h"
|
|
||||||
|
|
||||||
NoDisplay::NoDisplay() {}
|
|
||||||
|
|
||||||
NoDisplay::~NoDisplay() {}
|
|
||||||
|
|
||||||
bool NoDisplay::Lock(int timeout_ms) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoDisplay::Unlock() {}
|
|
@ -1,16 +0,0 @@
|
|||||||
#ifndef _NO_DISPLAY_H_
|
|
||||||
#define _NO_DISPLAY_H_
|
|
||||||
|
|
||||||
#include "display.h"
|
|
||||||
|
|
||||||
class NoDisplay : public Display {
|
|
||||||
private:
|
|
||||||
virtual bool Lock(int timeout_ms = 0) override;
|
|
||||||
virtual void Unlock() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
NoDisplay();
|
|
||||||
~NoDisplay();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
Reference in New Issue
Block a user