Compare commits

..

4 Commits

Author SHA1 Message Date
Florian Didron
91d29fe418 fix: trackball cpi boundaries, restore user set default cpi at boot
Some checks failed
Build firmware / build-firmware (default) (push) Has been cancelled
Build firmware / build-firmware (oryx) (push) Has been cancelled
2025-09-02 16:51:28 +07:00
Florian Didron
2ec6a09d59 Merge branch 'firmware25' into feat/trackball_default_cpi 2025-09-02 16:38:14 +07:00
Florian Didron
88ce385794 fix: prevent automouse layer reset if it was locked
Some checks failed
Build firmware / build-firmware (default) (push) Has been cancelled
Build firmware / build-firmware (oryx) (push) Has been cancelled
Unit Tests / test (push) Has been cancelled
2025-09-02 16:21:38 +07:00
Florian Didron
16f203e2fb Feat/navigators (#415)
Some checks failed
Build firmware / build-firmware (default) (push) Has been cancelled
Build firmware / build-firmware (oryx) (push) Has been cancelled
Unit Tests / test (push) Has been cancelled
* chore: move zsa/oryx module to a git submodule

* feat: port navigators to qmk25

* feat: adds a transmit and receive i2c method

* fix: navigator trackpad compile issue

* feat: improved trackpad scrolling, maybe?

* experiment: slight acceleration curve, more aggressive tap debounce

* fix: a better way to debounce taps

* feat: adds aim/turbo mode

* chore: tweak turbo/aim for the trackpad

* chore: remove navigator keys

* fix: #pragma once

* fix: address the i2c transmit and receive length on u16

* fix: change the packet size from 53 to 17

* chore: add more comments

* fix: remove the navigator_cpi from the eeprom config

* fix: remove the navigator_cpi from the eeprom config (ergodox)
2025-09-01 20:21:15 +07:00
8 changed files with 15 additions and 39 deletions

View File

@@ -192,6 +192,7 @@ void navigator_trackball_device_init(void) {
}
trackball_init = 1;
restore_cpi(current_cpi);
if (!callback_token) {
// Register the callback to read the trackball motion
callback_token = defer_exec(NAVIGATOR_TRACKBALL_READ, sci18is606_read_callback, NULL);
@@ -217,20 +218,17 @@ uint16_t navigator_trackball_get_cpi(void) {
void restore_cpi(uint8_t cpi) {
current_cpi = cpi;
paw3805ek_set_cpi();
printf("restored cpi: %d\n", current_cpi);
}
void navigator_trackball_set_cpi(uint16_t cpi) {
if (cpi == 0) { // Decrease one tick
if (current_cpi > NAVIGATOR_TRACKBALL_CPI_TICK) {
current_cpi -= NAVIGATOR_TRACKBALL_CPI_TICK;
printf("decreased cpi: %d\n", current_cpi);
paw3805ek_set_cpi();
}
} else {
if (current_cpi < 255 - NAVIGATOR_TRACKBALL_CPI_TICK) {
if (current_cpi <= NAVIGATOR_TRACKBALL_CPI_MAX - NAVIGATOR_TRACKBALL_CPI_TICK) {
current_cpi += NAVIGATOR_TRACKBALL_CPI_TICK;
printf("increased cpi: %d\n", current_cpi);
paw3805ek_set_cpi();
}
}

View File

@@ -18,6 +18,8 @@
# define NAVIGATOR_TRACKBALL_CPI_TICK 5
#endif
#define NAVIGATOR_TRACKBALL_CPI_MAX 125
#ifndef NAVIGATOR_TRACKBALL_TIMEOUT
# define NAVIGATOR_TRACKBALL_TIMEOUT 100
#endif
@@ -36,33 +38,6 @@
#define SCI18IS606_GET_ID 0xFE
#define WRITE_REG_BIT 0x80
/*
The PAW3805EK datasheet suggests the following CPI values for the X and Y axes:
CPI X-axis Y-axis
800 0x1F 0x22
1000 0x26 0x2A
1200 0x2E 0x32
1600 0x3C 0x43
2000 0x4C 0x54
2400 0x5B 0x64
3000 0x70 0x7B
*/
#define CPI_TICKS 7
#define DEFAULT_CPI_TICK 1
#define CPI_X_800 0x1F
#define CPI_Y_800 0x22
#define CPI_X_1000 0x26
#define CPI_Y_1000 0x2A
#define CPI_X_1200 0x2E
#define CPI_Y_1200 0x32
#define CPI_X_1600 0x3C
#define CPI_Y_1600 0x43
#define CPI_X_2000 0x4C
#define CPI_Y_2000 0x54
#define CPI_X_2400 0x5B
#define CPI_Y_2400 0x64
#define CPI_X_3000 0x70
#define CPI_Y_3000 0x7B
typedef struct {
uint8_t reg;

View File

@@ -304,8 +304,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.raw = 0;
keyboard_config.led_level = 4;
keyboard_config.navigator_cpi = 3;
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}

View File

@@ -68,7 +68,6 @@ typedef union {
struct {
uint8_t led_level : 3;
bool disable_layer_led : 1;
uint8_t navigator_cpi : 3;
bool placeholder : 1;
};
} keyboard_config_t;

View File

@@ -470,7 +470,6 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.rgb_matrix_enable = true;
keyboard_config.led_level = true;
keyboard_config.led_level_res = 0b11;
keyboard_config.navigator_cpi = 3;
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}

View File

@@ -43,8 +43,6 @@ typedef union {
bool rgb_matrix_enable :1;
bool led_level :1;
uint8_t led_level_res :2; // DO NOT REMOVE
uint8_t navigator_cpi :3;
};
} keyboard_config_t;

View File

@@ -301,7 +301,6 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.raw = 0;
keyboard_config.led_level = true;
keyboard_config.led_level_res = 0b11;
keyboard_config.navigator_cpi = 3;
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}

View File

@@ -23,6 +23,9 @@
# include "debug.h"
# include "action_util.h"
# include "quantum_keycodes.h"
#ifdef LAYER_LOCK_ENABLE
# include "layer_lock.h"
#endif
/* local data structure for tracking auto mouse */
static auto_mouse_context_t auto_mouse_context = {
@@ -265,6 +268,9 @@ void pointing_device_task_auto_mouse(report_mouse_t mouse_report) {
layer_on((AUTO_MOUSE_TARGET_LAYER));
}
} else if (layer_state_is((AUTO_MOUSE_TARGET_LAYER)) && timer_elapsed(auto_mouse_context.timer.active) > auto_mouse_context.config.timeout) {
#ifdef LAYER_LOCK_ENABLE
if(is_layer_locked(AUTO_MOUSE_DEFAULT_LAYER)) return;
#endif
layer_off((AUTO_MOUSE_TARGET_LAYER));
auto_mouse_context.timer.active = 0;
auto_mouse_context.total_mouse_movement = (total_mouse_movement_t){.x = 0, .y = 0, .h = 0, .v = 0};
@@ -299,6 +305,9 @@ void auto_mouse_keyevent(bool pressed) {
*/
void auto_mouse_reset_trigger(bool pressed) {
if (pressed) {
#ifdef LAYER_LOCK_ENABLE
if(is_layer_locked(AUTO_MOUSE_DEFAULT_LAYER)) return;
#endif
if (layer_state_is((AUTO_MOUSE_TARGET_LAYER))) {
layer_off((AUTO_MOUSE_TARGET_LAYER));
};
@@ -334,9 +343,10 @@ bool process_auto_mouse(uint16_t keycode, keyrecord_t* record) {
if (!(AUTO_MOUSE_ENABLED)) return true;
switch (keycode) {
// Skip Mod keys to avoid layer reset
// Skip Mod keys and layer lock to avoid layer reset
case KC_LEFT_CTRL ... KC_RIGHT_GUI:
case QK_MODS ... QK_MODS_MAX:
case QK_LLCK:
break;
// TO((AUTO_MOUSE_TARGET_LAYER))-------------------------------------------------------------------------------
case QK_TO ... QK_TO_MAX: