File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,14 @@ class XminiC3Board : public WifiBoard {
7373 },
7474 };
7575 ESP_ERROR_CHECK (i2c_new_master_bus (&i2c_bus_cfg, &codec_i2c_bus_));
76+
77+ // Print I2C bus info
78+ if (i2c_master_probe (codec_i2c_bus_, 0x18 , 1000 ) != ESP_OK) {
79+ while (true ) {
80+ ESP_LOGE (TAG, " Failed to probe I2C bus, please check if you have installed the correct firmware" );
81+ vTaskDelay (1000 / portTICK_PERIOD_MS);
82+ }
83+ }
7684 }
7785
7886 void InitializeSsd1306Display () {
@@ -177,15 +185,16 @@ class XminiC3Board : public WifiBoard {
177185 }
178186
179187public:
180- XminiC3Board () : boot_button_(BOOT_BUTTON_GPIO) {
181- // 把 ESP32C3 的 VDD SPI 引脚作为普通 GPIO 口使用
182- esp_efuse_write_field_bit (ESP_EFUSE_VDD_SPI_AS_GPIO);
183-
188+ XminiC3Board () : boot_button_(BOOT_BUTTON_GPIO) {
184189 InitializeCodecI2c ();
185190 InitializeSsd1306Display ();
186191 InitializeButtons ();
187192 InitializePowerSaveTimer ();
188193 InitializeTools ();
194+
195+ // 避免使用错误的固件,把 EFUSE 操作放在最后
196+ // 把 ESP32C3 的 VDD SPI 引脚作为普通 GPIO 口使用
197+ esp_efuse_write_field_bit (ESP_EFUSE_VDD_SPI_AS_GPIO);
189198 }
190199
191200 virtual Led* GetLed () override {
You can’t perform that action at this time.
0 commit comments