Skip to content

Commit

Permalink
add: events debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
daystram committed Jul 26, 2024
1 parent 2e4d2d0 commit 4fa66b4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mod kb {

use crate::{
heartbeat::HeartbeatLED,
key::{Action, Key},
key::{Action, Edge, Key},
keyboard::{Keyboard, KeyboardConfiguration},
matrix::{BasicVerticalSwitchMatrix, Scanner},
processor::{
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -338,6 +339,13 @@ mod kb {
Vec::<Event<<Keyboard as KeyboardConfiguration>::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))
Expand Down

0 comments on commit 4fa66b4

Please sign in to comment.