From a1d0aae6c8739d6c40ebba5d57d6b609d14b0dfc Mon Sep 17 00:00:00 2001 From: puckoprutt Date: Mon, 13 Jul 2026 22:11:41 +0200 Subject: [PATCH] fixed bug where led state got wrong state. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1e57097..0c4da31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,16 +77,19 @@ impl LedButton { /// set the LED to "On"-state. pub fn on(&mut self) { let _ = self.led.on(); + self.led_state == LedState::On; } /// set the LED to "Off"-state. pub fn off(&mut self) { let _ = self.led.off(); + self.led_state == LedState::Off; } /// toggle the LED. pub fn toggle(&mut self) { let _ = self.led.toggle(); + self.led_state = !self.led_state; } /// the current counter value of the button.