Добавлено энергосбережение для увеличения работы от аккума:

- через 60 сек экран выключается и есп уходит в сон
- слейв в ожидании мастера прослушивает не постоянно 20мс/100мс
This commit is contained in:
2026-08-08 10:42:59 +03:00
parent 21f8fe8e13
commit c952c165f8
10 changed files with 173 additions and 7 deletions

View File

@@ -7,8 +7,21 @@ void Button::begin() {
changedAt_ = millis();
}
void Button::suppressUntilRelease() {
suppressed_ = true;
raw_ = stable_ = (digitalRead(pin_) == BUTTON_ACTIVE_LEVEL);
changedAt_ = millis();
longSent_ = true;
}
ButtonEvent Button::update(uint32_t now) {
const bool sample = (digitalRead(pin_) == BUTTON_ACTIVE_LEVEL);
if (suppressed_) {
raw_ = stable_ = sample;
changedAt_ = now;
if (!sample) { suppressed_ = false; longSent_ = false; }
return ButtonEvent::NONE;
}
if (sample != raw_) { raw_ = sample; changedAt_ = now; }
if (raw_ != stable_ && now - changedAt_ >= BUTTON_DEBOUNCE_MS) {
stable_ = raw_;