From 4fa66b4f0def7c87ce7daa183c3486199ece1566 Mon Sep 17 00:00:00 2001 From: Danny August Ramaputra Date: Fri, 26 Jul 2024 20:53:28 +0900 Subject: [PATCH] add: events debug log --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2535077..da2d616 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,7 +53,7 @@ mod kb { use crate::{ heartbeat::HeartbeatLED, - key::{Action, Key}, + key::{Action, Edge, Key}, keyboard::{Keyboard, KeyboardConfiguration}, matrix::{BasicVerticalSwitchMatrix, Scanner}, processor::{ @@ -84,6 +84,7 @@ mod kb { const DEBUG_LOG_INPUT_SCANNER_INTERVAL: u64 = 50; const DEBUG_LOG_PROCESSOR_ENABLE_TIMING: bool = false; const DEBUG_LOG_PROCESSOR_INTERVAL: u64 = 50; + const DEBUG_LOG_EVENTS: bool = true; const DEBUG_LOG_SENT_KEYS: bool = false; #[shared] @@ -338,6 +339,13 @@ mod kb { Vec::::Layer>>::with_capacity(10); mapper.map(&input, &mut events); + if DEBUG_LOG_EVENTS { + events + .iter() + .filter(|e| e.edge != Edge::None) + .for_each(|e| debug!("[{}] event: action: {} edge: {}", n, e.action, e.edge)); + } + if events_processors .iter_mut() .try_for_each(|p| p.process(&mut events))