From f8de136019c9958e6c99007ca46b2e9cedd3837d Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Sat, 14 Oct 2023 11:37:00 +0200 Subject: [PATCH] Remove silly GPIO pins for buttons I'm finally giving in and will now connect stuff via a breadboard... Risky move though, I already fried one DHT22 by plugging the connector in the wrong way around -.- --- default.nix | 2 +- src/bin/draw/totp.rs | 6 +++--- src/bin/main_loop.rs | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/default.nix b/default.nix index 1f56d5e..fb16079 100644 --- a/default.nix +++ b/default.nix @@ -16,7 +16,7 @@ rustPlatform.buildRustPackage { nativeBuildInputs = [ pkg-config ]; - cargoBuildFlags = [ "--no-default-features" "--bin" "main_loop" ]; + cargoBuildFlags = [ "--no-default-features" "--bin" "take_measurement" ]; buildInputs = [ sqlite ]; diff --git a/src/bin/draw/totp.rs b/src/bin/draw/totp.rs index f41d8fd..0d8bdb2 100644 --- a/src/bin/draw/totp.rs +++ b/src/bin/draw/totp.rs @@ -33,9 +33,9 @@ impl Totp { pub fn next_page(&mut self) { self.page += 1; - if self.secrets.len() < self.page * 6 { - self.page = 0; - } + if self.secrets.len() < self.page * 6 { + self.page = 0; + } } } diff --git a/src/bin/main_loop.rs b/src/bin/main_loop.rs index 59397a5..2d5f7ad 100644 --- a/src/bin/main_loop.rs +++ b/src/bin/main_loop.rs @@ -326,13 +326,6 @@ fn main_loop(mut disp: Oled, mut ctx: ContextDefault) { let mut last_button = Instant::now(); let mut menu = vec![]; - // high pins for buttons - let _high_outputs = gpiocdev::Request::builder() - .on_chip("/dev/gpiochip0") - .with_lines(&[23, 24]) - .as_output(Value::Active) - .request() - .unwrap(); let lines = gpiocdev::Request::builder() .on_chip("/dev/gpiochip0") .with_line(19)