summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Didron <fdidron@users.noreply.github.com>2019-04-23 08:46:25 +0900
committerGitHub <noreply@github.com>2019-04-23 08:46:25 +0900
commit7ca465911dda885b0ecba11c0757134f36085de6 (patch)
treef6b0142e8eb195418110dd86e7622c679d3766e9
parentff2838d2dd288537a8bf48d02872e8223b3ff7a3 (diff)
parentd22fda3ca4e2c6fd82f1275ee2f59882371a1794 (diff)
Merge pull request #22 from zsa/mouse_keys
Improvements to Mousekey's Constant speed mode
-rw-r--r--changelog.md1
-rw-r--r--tmk_core/common/mousekey.c29
-rw-r--r--tmk_core/common/mousekey.h60
3 files changed, 53 insertions, 37 deletions
diff --git a/changelog.md b/changelog.md
index 3b930a04b1..e10ef915d7 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,7 @@
04-16-2019 - Fix info.json for Ergodox EZ
04-16-2019 - Add support for WS2812 based RGB Matrix
04-18-2019 - Fix Eager Per Row Debouncing bug
+04-22-2019 - Improve Mousekey constant speed mode
04-22-2019 - Add new reactive modes (wide, cross, nexus) for RGB Matrix
04-22-2019 - OLED Driver Features
04-22-2019 - Add Split RGB support
diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c
index 87239fbb76..8c91843063 100644
--- a/tmk_core/common/mousekey.c
+++ b/tmk_core/common/mousekey.c
@@ -171,28 +171,31 @@ void mousekey_off(uint8_t code) {
enum {
- mkspd_slow,
- mkspd_med,
- mkspd_fast,
+ mkspd_unmod,
+ mkspd_0,
+ mkspd_1,
+ mkspd_2,
mkspd_COUNT
};
-static uint8_t mk_speed = mkspd_med;
-#ifdef MK_MOMENTARY_ACCEL
-static uint8_t mkspd_DEFAULT = mkspd_med;
+#ifndef MK_MOMENTARY_ACCEL
+static uint8_t mk_speed = mkspd_1;
+#else
+static uint8_t mk_speed = mkspd_unmod;
+static uint8_t mkspd_DEFAULT = mkspd_unmod;
#endif
static uint16_t last_timer_c = 0;
static uint16_t last_timer_w = 0;
uint16_t c_offsets[mkspd_COUNT] = {
- MK_C_OFFSET_SLOW, MK_C_OFFSET_MED, MK_C_OFFSET_FAST
+ MK_C_OFFSET_UNMOD, MK_C_OFFSET_0, MK_C_OFFSET_1, MK_C_OFFSET_2
};
uint16_t c_intervals[mkspd_COUNT] = {
- MK_C_INTERVAL_SLOW, MK_C_INTERVAL_MED, MK_C_INTERVAL_FAST
+ MK_C_INTERVAL_UNMOD, MK_C_INTERVAL_0, MK_C_INTERVAL_1, MK_C_INTERVAL_2
};
uint16_t w_offsets[mkspd_COUNT] = {
- MK_W_OFFSET_SLOW, MK_W_OFFSET_MED, MK_W_OFFSET_FAST
+ MK_W_OFFSET_UNMOD, MK_W_OFFSET_0, MK_W_OFFSET_1, MK_W_OFFSET_2
};
uint16_t w_intervals[mkspd_COUNT] = {
- MK_W_INTERVAL_SLOW, MK_W_INTERVAL_MED, MK_W_INTERVAL_FAST
+ MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0, MK_W_INTERVAL_1, MK_W_INTERVAL_2
};
@@ -254,9 +257,9 @@ void mousekey_on(uint8_t code) {
else if (code == KC_MS_BTN3) mouse_report.buttons |= MOUSE_BTN3;
else if (code == KC_MS_BTN4) mouse_report.buttons |= MOUSE_BTN4;
else if (code == KC_MS_BTN5) mouse_report.buttons |= MOUSE_BTN5;
- else if (code == KC_MS_ACCEL0) mk_speed = mkspd_slow;
- else if (code == KC_MS_ACCEL1) mk_speed = mkspd_med;
- else if (code == KC_MS_ACCEL2) mk_speed = mkspd_fast;
+ else if (code == KC_MS_ACCEL0) mk_speed = mkspd_0;
+ else if (code == KC_MS_ACCEL1) mk_speed = mkspd_1;
+ else if (code == KC_MS_ACCEL2) mk_speed = mkspd_2;
if (mk_speed != old_speed) adjust_speed();
}
diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h
index ce3501b232..89c1eaf11a 100644
--- a/tmk_core/common/mousekey.h
+++ b/tmk_core/common/mousekey.h
@@ -64,42 +64,54 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#else /* #ifndef MK_3_SPEED */
-#ifndef MK_C_OFFSET_SLOW
-#define MK_C_OFFSET_SLOW 1
+#ifndef MK_C_OFFSET_UNMOD
+#define MK_C_OFFSET_UNMOD 16
#endif
-#ifndef MK_C_INTERVAL_SLOW
-#define MK_C_INTERVAL_SLOW 100
+#ifndef MK_C_INTERVAL_UNMOD
+#define MK_C_INTERVAL_UNMOD 16
#endif
-#ifndef MK_C_OFFSET_MED
-#define MK_C_OFFSET_MED 4
+#ifndef MK_C_OFFSET_0
+#define MK_C_OFFSET_0 1
#endif
-#ifndef MK_C_INTERVAL_MED
-#define MK_C_INTERVAL_MED 16
+#ifndef MK_C_INTERVAL_0
+#define MK_C_INTERVAL_0 32
#endif
-#ifndef MK_C_OFFSET_FAST
-#define MK_C_OFFSET_FAST 12
+#ifndef MK_C_OFFSET_1
+#define MK_C_OFFSET_1 4
#endif
-#ifndef MK_C_INTERVAL_FAST
-#define MK_C_INTERVAL_FAST 16
+#ifndef MK_C_INTERVAL_1
+#define MK_C_INTERVAL_1 16
+#endif
+#ifndef MK_C_OFFSET_2
+#define MK_C_OFFSET_2 32
+#endif
+#ifndef MK_C_INTERVAL_2
+#define MK_C_INTERVAL_2 16
#endif
-#ifndef MK_W_OFFSET_SLOW
-#define MK_W_OFFSET_SLOW 1
+#ifndef MK_W_OFFSET_UNMOD
+#define MK_W_OFFSET_UNMOD 1
+#endif
+#ifndef MK_W_INTERVAL_UNMOD
+#define MK_W_INTERVAL_UNMOD 40
+#endif
+#ifndef MK_W_OFFSET_0
+#define MK_W_OFFSET_0 1
#endif
-#ifndef MK_W_INTERVAL_SLOW
-#define MK_W_INTERVAL_SLOW 400
+#ifndef MK_W_INTERVAL_0
+#define MK_W_INTERVAL_0 360
#endif
-#ifndef MK_W_OFFSET_MED
-#define MK_W_OFFSET_MED 1
+#ifndef MK_W_OFFSET_1
+#define MK_W_OFFSET_1 1
#endif
-#ifndef MK_W_INTERVAL_MED
-#define MK_W_INTERVAL_MED 200
+#ifndef MK_W_INTERVAL_1
+#define MK_W_INTERVAL_1 120
#endif
-#ifndef MK_W_OFFSET_FAST
-#define MK_W_OFFSET_FAST 1
+#ifndef MK_W_OFFSET_2
+#define MK_W_OFFSET_2 1
#endif
-#ifndef MK_W_INTERVAL_FAST
-#define MK_W_INTERVAL_FAST 100
+#ifndef MK_W_INTERVAL_2
+#define MK_W_INTERVAL_2 20
#endif
#endif /* #ifndef MK_3_SPEED */