Skip to content

Commit

Permalink
indicate scroll snap mode in OLED
Browse files Browse the repository at this point in the history
"SCR" in OLED will be changed to "VT", or "HO" depending on scroll snap mode.
  • Loading branch information
koron committed Apr 16, 2024
1 parent 9fd0fb0 commit b9c499a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion qmk_firmware/keyboards/keyball/lib/keyball/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ please make pull requests to share it us.
* 水平方向にスナップ
* スナップしない自由スクロール

以上を `SSNP_VER`, `SSNP_HOR`, `SSNP_FRE` の独自キーコードを用いて手動で切り替える。
以上を `SSNP_VRT`, `SSNP_HOR`, `SSNP_FRE` の独自キーコードを用いて手動で切り替える。

### up to 1.3.2

Expand Down
24 changes: 19 additions & 5 deletions qmk_firmware/keyboards/keyball/lib/keyball/keyball.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ __attribute__((weak)) void keyball_on_apply_motion_to_mouse_scroll(keyball_motio
}
#elif KEYBALL_SCROLLSNAP_ENABLE == 2
// New behavior
switch (keyball.scrollsnap_mode) {
switch (keyball_get_scrollsnap_mode()) {
case KEYBALL_SCROLLSNAP_MODE_VERTICAL:
r->h = 0;
break;
case KEYBALL_SCROLLSNAP_MODE_HORIZONTAL:
r->v = 0;
break;
case KEYBALL_SCROLLSNAP_MODE_FREE:
default:
// pass by without doing anything
break;
}
Expand Down Expand Up @@ -411,8 +411,23 @@ void keyball_oled_render_ballinfo(void) {
oled_write(format_4d(keyball_get_cpi()) + 1, false);
oled_write_P(PSTR("00 "), false);

// indicate scroll mode: on/off
// indicate scroll snap mode: "VT" (vertical), "HN" (horiozntal), and "SCR" (free)
#if 1 && KEYBALL_SCROLLSNAP_ENABLE == 2
switch (keyball_get_scrollsnap_mode()) {
case KEYBALL_SCROLLSNAP_MODE_VERTICAL:
oled_write_P(PSTR("VT"), false);
break;
case KEYBALL_SCROLLSNAP_MODE_HORIZONTAL:
oled_write_P(PSTR("HO"), false);
break;
default:
oled_write_P(PSTR("\xBE\xBF"), false);
break;
}
#else
oled_write_P(PSTR("\xBE\xBF"), false);
#endif
// indicate scroll mode: on/off
if (keyball.scroll_mode) {
oled_write_P(LFSTR_ON, false);
} else {
Expand Down Expand Up @@ -570,7 +585,6 @@ void keyboard_post_init_kb(void) {
set_auto_mouse_timeout(c.amlto == 0 ? AUTO_MOUSE_TIME : (c.amlto + 1) * AML_TIMEOUT_QU);
#endif
#if KEYBALL_SCROLLSNAP_ENABLE == 2
keyball.scrollsnap_mode = c.ssnap;
keyball_set_scrollsnap_mode(c.ssnap);
#endif
}
Expand Down Expand Up @@ -709,7 +723,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
case SSNP_HOR:
keyball_set_scrollsnap_mode(KEYBALL_SCROLLSNAP_MODE_HORIZONTAL);
break;
case SSNP_VER:
case SSNP_VRT:
keyball_set_scrollsnap_mode(KEYBALL_SCROLLSNAP_MODE_VERTICAL);
break;
case SSNP_FRE:
Expand Down
2 changes: 1 addition & 1 deletion qmk_firmware/keyboards/keyball/lib/keyball/keyball.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ enum keyball_keycodes {
SCRL_DVI = QK_KB_8, // Increment scroll divider
SCRL_DVD = QK_KB_9, // Decrement scroll divider

SSNP_VER = QK_KB_13, // Set scroll snap mode as vertical
SSNP_VRT = QK_KB_13, // Set scroll snap mode as vertical
SSNP_HOR = QK_KB_14, // Set scroll snap mode as horizontal
SSNP_FRE = QK_KB_15, // Set scroll snap mode as disable (free scroll)

Expand Down
4 changes: 2 additions & 2 deletions qmk_firmware/keyboards/keyball/lib/keyball/keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
| `AML_TO` | `Kb 10` | `0x7e0a` | Toggle automatic mouse layer |
| `AML_I50` | `Kb 11` | `0x7e0b` | Increase 50ms automatic mouse layer timeout (max 1000ms) |
| `AML_D50` | `Kb 12` | `0x7e0c` | Decrease 50ms automatic mouse layer timeout (min 100ms) |
| `SSNP_VER` | `Kb 13` | `0x7e0d` | Set scroll snap mode as vertical |
| `SSNP_VRT` | `Kb 13` | `0x7e0d` | Set scroll snap mode as vertical |
| `SSNP_HOR` | `Kb 14` | `0x7e0e` | Set scroll snap mode as horizontal |
| `SSNP_FRE` | `Kb 15` | `0x7e0f` | Set scroll snap mode as disable (free scroll) |

Expand All @@ -45,7 +45,7 @@
| `AML_TO` | `Kb 10` | `0x7e0a` | 自動マウスレイヤーをトグルします。 |
| `AML_I50` | `Kb 11` | `0x7e0b` | 自動マウスレイヤーのタイムアウトを50msec増やします (max 1000ms) |
| `AML_D50` | `Kb 12` | `0x7e0c` | 自動マウスレイヤーのタイムアウトを50msec減らします (min 100ms) |
| `SSNP_VER` | `Kb 13` | `0x7e0d` | スクロールスナップモードを垂直にする |
| `SSNP_VRT` | `Kb 13` | `0x7e0d` | スクロールスナップモードを垂直にする |
| `SSNP_HOR` | `Kb 14` | `0x7e0e` | スクロールスナップモードを水平にする |
| `SSNP_FRE` | `Kb 15` | `0x7e0f` | スクロールスナップモードを無効にする(自由スクロール) |

Expand Down
3 changes: 1 addition & 2 deletions qmk_firmware/keyboards/keyball/lib/logofont/logofont.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ const unsigned char font[] PROGMEM = {
// 0xC0
0x3F, 0x21, 0x1E, 0x00, 0x21, 0x3F, // C0, C1:
0x21, 0x00, 0x0F, 0x30, 0x0F, 0x00, // "DIV" in 2 chars indicate "divider"
0x3E, 0x09, 0x3E, 0x00, 0x3F, 0x06, // C2, D3:
0x3E, 0x09, 0x3E, 0x00, 0x3F, 0x06, // C2, C3:
0x3F, 0x00, 0x3F, 0x20, 0x20, 0x00, // "AML" in 2 chars

};
// clang-format on

0 comments on commit b9c499a

Please sign in to comment.