Add messages to BLE queue without a waiting interval
This commit is contained in:
parent
96660dce4f
commit
0bcd44af61
3 changed files with 5 additions and 8 deletions
|
@ -309,14 +309,12 @@ void send_mouse_report_callback(struct k_work *work) {
|
|||
K_WORK_DEFINE(hog_mouse_work, send_mouse_report_callback);
|
||||
|
||||
int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *report) {
|
||||
int err = k_msgq_put(&zmk_hog_mouse_msgq, report, K_MSEC(100));
|
||||
int err = k_msgq_put(&zmk_hog_mouse_msgq, report, K_NO_WAIT);
|
||||
if (err) {
|
||||
switch (err) {
|
||||
case -EAGAIN: {
|
||||
LOG_WRN("Mouse message queue full, popping first message and queueing again");
|
||||
struct zmk_hid_mouse_report_body discarded_report;
|
||||
k_msgq_get(&zmk_hog_mouse_msgq, &discarded_report, K_NO_WAIT);
|
||||
return zmk_hog_send_mouse_report(report);
|
||||
LOG_WRN("Mouse message queue full, dropping report");
|
||||
return err;
|
||||
}
|
||||
default:
|
||||
LOG_WRN("Failed to queue mouse report to send (%d)", err);
|
||||
|
|
|
@ -41,7 +41,7 @@ void mouse_timer_cb(struct k_timer *dummy) {
|
|||
k_work_submit_to_queue(zmk_mouse_work_q(), &mouse_tick);
|
||||
}
|
||||
|
||||
K_TIMER_DEFINE(mouse_timer, mouse_timer_cb, mouse_timer_cb);
|
||||
K_TIMER_DEFINE(mouse_timer, mouse_timer_cb, NULL);
|
||||
|
||||
static int mouse_timer_ref_count = 0;
|
||||
|
||||
|
@ -50,8 +50,6 @@ void mouse_timer_ref() {
|
|||
k_timer_start(&mouse_timer, K_NO_WAIT, K_MSEC(CONFIG_ZMK_MOUSE_TICK_DURATION));
|
||||
}
|
||||
mouse_timer_ref_count += 1;
|
||||
// trigger the first mouse tick event immediately
|
||||
mouse_tick_timer_handler(NULL);
|
||||
}
|
||||
|
||||
void mouse_timer_unref() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <zmk/mouse.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_MOUSE_WORK_QUEUE_DEDICATED)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue