Добавлено энергосбережение для увеличения работы от аккума:
- через 60 сек экран выключается и есп уходит в сон - слейв в ожидании мастера прослушивает не постоянно 20мс/100мс
This commit is contained in:
@@ -24,11 +24,19 @@ bool Display::begin() {
|
||||
oled_.setRotation(OLED_ROTATION);
|
||||
oled_.setTextColor(SSD1306_WHITE);
|
||||
oled_.setTextSize(1);
|
||||
powered_ = true;
|
||||
}
|
||||
Log::printf("OLED", "initialization %s, I2C address=0x%02X", ok_ ? "OK" : "FAILED", OLED_ADDRESS);
|
||||
return ok_;
|
||||
}
|
||||
|
||||
void Display::setPower(bool enabled) {
|
||||
if (!ok_ || powered_ == enabled) return;
|
||||
oled_.ssd1306_command(enabled ? SSD1306_DISPLAYON : SSD1306_DISPLAYOFF);
|
||||
powered_ = enabled;
|
||||
Log::printf("OLED", "display power %s", enabled ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
void Display::fit(char *s) {
|
||||
int16_t x, y; uint16_t w, h;
|
||||
while (*s) {
|
||||
@@ -44,6 +52,7 @@ void Display::show(const char *a, const char *b, uint32_t progress, uint32_t pro
|
||||
// Serial is the primary UI mirror and remains available when OLED is absent.
|
||||
Log::printf("UI", "%s | %s", one, two);
|
||||
if (!ok_) return;
|
||||
setPower(true);
|
||||
fit(one); fit(two);
|
||||
oled_.clearDisplay(); oled_.setCursor(0, 3); oled_.print(one);
|
||||
oled_.setCursor(0, 19); oled_.print(two);
|
||||
|
||||
Reference in New Issue
Block a user