This commit is contained in:
admin committed 2026-09-11 13:44:38 +07:00
1 parent 4c68deb6bb
commit 21168d8820
3 files changed
+43 -6

No files matched your search

+8 -2
View File
@@ -11,10 +11,16 @@ OLEDDisplay::OLEDDisplay(uint8_t sdaPin, uint8_t sclPin, uint8_t i2cAddr)
}
bool OLEDDisplay::begin() {
// Khởi tạo I2C với timeout
Wire.begin(_sdaPin, _sclPin);
Wire.setClock(100000); // Giảm tốc độ I2C xuống 100kHz để ổn định hơn
delay(100); // Đợi I2C ổn định
if (!_display.begin(SSD1306_SWITCHCAPVCC, _i2cAddr)) {
Serial.println(F("[OLED] Không thể khởi tạo màn hình!"));
Serial.println(F("[OLED] Khong the khoi tao man hinh!"));
Serial.print(F("[OLED] Da thu dia chi I2C: 0x"));
Serial.println(_i2cAddr, HEX);
return false;
}
@@ -22,7 +28,7 @@ bool OLEDDisplay::begin() {
_display.setTextColor(SSD1306_WHITE);
_display.display();
Serial.println(F("[OLED] Đã khởi tạo thành công"));
Serial.println(F("[OLED] Da khoi tao thanh cong"));
return true;
}