Skip to content

Commit d79d925

Browse files
obonestmk
authored andcommitted
Removed duplicate debug message code and surrounded it with IFDEF as needed
1 parent ee8c5ba commit d79d925

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

protocol/ps2_mouse.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,19 @@ void ps2_mouse_task(void)
8585
if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
8686
return;
8787
}
88-
xprintf("%ud ", timer_read());
89-
print("ps2_mouse raw: [");
90-
phex(mouse_report.buttons); print("|");
91-
print_hex8((uint8_t)mouse_report.x); print(" ");
92-
print_hex8((uint8_t)mouse_report.y); print("]\n");
88+
89+
#ifdef PS2_MOUSE_DEBUG
90+
xprintf("%ud ", timer_read());
91+
print("ps2_mouse raw: [");
92+
phex(mouse_report.buttons); print("|");
93+
print_hex8((uint8_t)mouse_report.x); print(" ");
94+
print_hex8((uint8_t)mouse_report.y); print("]\n");
95+
#endif
9396

9497
/* if mouse moves or buttons state changes */
9598
if (mouse_report.x || mouse_report.y ||
9699
((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) {
97100

98-
#ifdef PS2_MOUSE_DEBUG
99-
print("ps2_mouse raw: [");
100-
phex(mouse_report.buttons); print("|");
101-
print_hex8((uint8_t)mouse_report.x); print(" ");
102-
print_hex8((uint8_t)mouse_report.y); print("]\n");
103-
#endif
104-
105101
buttons_prev = mouse_report.buttons;
106102

107103
// PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value.

0 commit comments

Comments
 (0)