fix interval

This commit is contained in:
takashicompany 2024-11-20 02:16:00 +09:00
parent b27f81c9b9
commit d856718821

View File

@ -358,9 +358,16 @@ void reset_joystick_key(void) {
void press_joystick_key(int8_t column) { void press_joystick_key(int8_t column) {
if (joystick_key_column != -1 || timer_elapsed(joystick_key_timer) < 200) { // if (joystick_key_column != -1 || timer_elapsed(joystick_key_timer) < 200) {
// return;
// }
if (joystick_key_column == column || timer_elapsed(joystick_key_timer) < 200) {
return; return;
} }
reset_joystick_key();
joystick_key_column = column; joystick_key_column = column;
joystick_key_timer = timer_read(); joystick_key_timer = timer_read();
action_exec(MAKE_KEYEVENT(6, column, true)); action_exec(MAKE_KEYEVENT(6, column, true));
@ -378,7 +385,7 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
#endif #endif
if ((current_x != 0 || current_y != 0) && if ((current_x != 0 || current_y != 0) &&
(joystick_raw_x > 100 || joystick_raw_y > 100) == false && (joystick_raw_x > 100 || joystick_raw_y > 100) == false &&
(my_abs_16(joystick_raw_x) + my_abs_16(joystick_raw_y) > 200)){ (my_abs_16(joystick_raw_x) + my_abs_16(joystick_raw_y) > 350)){
if (joystick_raw_y < joystick_raw_x * 4) { if (joystick_raw_y < joystick_raw_x * 4) {
// 上 // 上
@ -390,7 +397,9 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
} }
} }
else { else {
reset_joystick_key(); if (timer_elapsed(joystick_key_timer) > 50) {
reset_joystick_key();
}
} }
mouse_report.x = 0; mouse_report.x = 0;
@ -400,6 +409,9 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
return mouse_report; return mouse_report;
} }
else {
reset_joystick_key();
}
if (current_x != 0 || current_y != 0) { if (current_x != 0 || current_y != 0) {