Tandem checkin for ploopyco overhaul

- Added build option for new ploopy nano build
- Added ploopy nano userspace keymap
- Removed old drag scroll detection. OLED graphic tied to scroll lock
- REmoved old scroll lock and dpi custom keycodes used for Lkbm keymap
- overrode num/scroll lock. It is now a hold instead of a toggle
- Added custom keycode to turn on all locks to tell ploopy nano to
enter bootloader
- refactored variables based on learnings from ploopy rebase
- minor tweaks to keymap
- pressing numlock cycles through dpi settings
- pressing scroll lock enters momentary drag scroll
This commit is contained in:
Victor 2024-06-18 19:25:24 -05:00
parent c1803bf38e
commit c2008065ae
Failed to generate hash of commit
10 changed files with 104 additions and 74 deletions

View file

@ -0,0 +1,9 @@
#pragma once
#define PLOOPY_HOST_LED_CONTROL
#define PLOOPY_DRAGSCROLL_INVERT
#define PLOOPY_DRAGSCROLL_DIVISOR_H 25.0
#define PLOOPY_DRAGSCROLL_DIVISOR_V 20.0
#define PLOOPY_DPI_OPTIONS { 300, 550, 800, 1200 }
#define PLOOPY_DPI_DEFAULT 2

View file

@ -0,0 +1,3 @@
#include "t4corun.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {{{ KC_NO }}};

View file

@ -0,0 +1,14 @@
# override userspace defaults
LTO_ENABLE = yes
DYNAMIC_MACRO_ENABLE = no
WPM_ENABLE = no
EXTRAKEY_ENABLE = no
CAPS_WORD_ENABLE = no
MOUSEKEY_ENABLE = no
COMBO_ENABLE = no
KEY_OVERRIDE_ENABLE = no
# override keyboard defaults
# keyboards\ploopyco\trackball_nano\info.json
# keyboards\ploopyco\trackball_nano\rules.mk
# keyboards\ploopyco\postrules.mk

View file

@ -7,7 +7,8 @@
["planck/rev6", "t4corun"],
["bluebell/swoop", "t4corun"],
["barbellboards/rollow", "t4corun"],
["klor/2040", "t4corun"]
["klor/2040", "t4corun"],
["ploopyco/trackball_nano", "t4corun"]
]
}

View file

@ -36,7 +36,7 @@ bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode
// case MOUSE_BUTTON5:
case MOUSE_DRGTOG:
if ( get_highest_layer(layer_state | default_layer_state) > _DEFAULT_LAYER_1 ) return false;
if ( get_highest_layer(layer_state | default_layer_state) > FIRST_DEFAULT_LAYER ) return false;
default:
return true;

View file

@ -115,7 +115,7 @@ void render_feature_status(bool vertical) {
#endif //RGB_MATRIX_ENABLED
// only works on master side
drag_scroll_is_enabled() ? oled_write_P(dragscr_on, false) : oled_write_P(dragscr_off, false);
host_keyboard_led_state().scroll_lock ? oled_write_P(dragscr_on, false) : oled_write_P(dragscr_off, false);
if (vertical) {
oled_write_P(PSTR(" "), false);

View file

@ -1,6 +1,11 @@
#pragma once
#include "t4corun.h"
// Tells the process_tap_hold_key what kind of hold action is wanted
#define HOLD_SINGLETP 0
#define HOLD_DOUBLETP 1
#define HOLD_BRACKETS 2
void single_tap(uint16_t key);
void double_tap(uint16_t key, uint32_t ms);
void insert_brackets(uint16_t left, uint16_t right, uint32_t ms);

View file

@ -2,21 +2,12 @@
// Keeps track of base layer so we can make one key to cycle through them
// instead of making a key for each one */
static uint8_t current_base_layer = _DEFAULT_LAYER_1;
// Should keep track of the Ploopy Nano drag scroll mode
// There is a possibility of this being out of sync
static bool drag_scroll_enabled = false;
static uint8_t current_base_layer = FIRST_DEFAULT_LAYER;
// Luna Pet Variables
static bool isJumping = false;
static bool showedJump = true;
// Allows the OLED code to get the drag scroll mode
bool drag_scroll_is_enabled(void) { return drag_scroll_enabled; }
// Allows the OLED code to see when space bar is pressed
bool isLunaJumping(void) { return isJumping; }
bool isJumpShown(void) { return showedJump; }
@ -24,14 +15,51 @@ bool isJumpShown(void) { return showedJump; }
// Allows the OLED code to clear the space bar status when render is complete
void setLunaJumped(void) { showedJump = true;}
// Hold Navigation and Number to get Symbol
layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _NAVIGATION, _NUMBER, _SYMBOL); }
// Customize behavior for existing keycodes or create new ones
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// use the host state status to boot the Ploopy Nano
// will effectively turn on num lock/caps lock/scroll lock then back off
case PN_BOOT:
if (record->event.pressed) {
if(!host_keyboard_led_state().num_lock) { tap_code(KC_NUM); }
if(!host_keyboard_led_state().caps_lock) { tap_code(KC_CAPS); }
if(!host_keyboard_led_state().scroll_lock) { tap_code(KC_SCRL); }
} else {
if(host_keyboard_led_state().num_lock) { tap_code(KC_NUM); }
if(host_keyboard_led_state().caps_lock) { tap_code(KC_CAPS); }
if(host_keyboard_led_state().scroll_lock) { tap_code(KC_SCRL); }
}
return false;
// makes scroll lock a hold instead of toggle
// enables momentary drag scroll on ploopy nano
case KC_SCRL:
if (record->event.pressed) {
tap_code(KC_SCRL);
} else {
tap_code(KC_SCRL);
}
return false;
// makes num lock a hold instead of toggle
// prevents accidental ploopy nano going into bootloader
case KC_NUM:
if (record->event.pressed) {
tap_code(KC_NUM);
} else {
tap_code(KC_NUM);
}
return false;
case KC_SPC:
if (record->event.pressed) {
isJumping = true;
@ -45,7 +73,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case BASELYR:
if (record->event.pressed) {
current_base_layer = (current_base_layer + 1) % NUM_BASE_LAYER;
current_base_layer = (current_base_layer + 1) % NUM_DEFAULT_LAYERS;
set_single_persistent_default_layer(current_base_layer);
}
@ -54,34 +82,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case RBSELYR:
if (record->event.pressed) {
current_base_layer = (current_base_layer - 1) % NUM_BASE_LAYER;
current_base_layer = (current_base_layer - 1) % NUM_DEFAULT_LAYERS;
set_single_persistent_default_layer(current_base_layer);
}
return false;
case PN_DRGS:
if (record->event.pressed) {
//tap numlock twice to toggle ploopy nano drag scroll
// double_tap(KC_NUM, KC_NUM, WAIT_DELAY);
double_tap(KC_NUM, WAIT_DELAY);
//I realize this may not work for the Charybdis nano
drag_scroll_enabled = !drag_scroll_enabled;
}
return false;
case PN_PDPI:
if (record->event.pressed) {
//tap capslock twice to cycle ploopy nano pointer DPI
//double_tap(KC_CAPS, KC_CAPS, WAIT_DELAY);
double_tap(KC_CAPS, WAIT_DELAY);
}
return false;
//https://docs.qmk.fm/#/mod_tap?id=changing-both-tasp-and-hold
//https://getreuer.info/posts/keyboards/triggers/index.html#tap-vs.-long-press

View file

@ -2,11 +2,11 @@
#include QMK_KEYBOARD_H
#include "features/taphold.h"
bool drag_scroll_is_enabled(void);
bool isLunaJumping(void);
bool isJumpShown(void);
void setLunaJumped(void);
// put the default base layers first
enum layers {
_QWERTY = 0,
FIRST_DEFAULT_LAYER = 0,
@ -18,6 +18,11 @@ enum layers {
_CONFIG
};
// start at the second layer
#define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
#define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
#define NUM_DEFAULT_LAYERS 3
enum keycodes {
//These are only here to make the taphold/defines unique
TH_LCBR = QK_USER,
@ -41,8 +46,7 @@ enum keycodes {
TH_SCLN,
TH_QUOT,
PN_DRGS,
PN_PDPI,
PN_BOOT,
BASELYR,
RBSELYR
@ -84,34 +88,29 @@ enum keycodes {
// tap hoLd. These will be intercepted and overridden. The LT will be ignored
// Brackets: open and close brackets and put the cursor inside
#define TR_LCBR LT(_DEFAULT_LAYER_1, TH_LCBR)
#define TR_LABK LT(_DEFAULT_LAYER_1, TH_LABK)
#define TR_LBRC LT(_DEFAULT_LAYER_1, TH_LBRC)
#define TR_LPRN LT(_DEFAULT_LAYER_1, TH_LPRN)
#define TR_DQUO LT(_DEFAULT_LAYER_1, TH_DQUO)
#define TR_SQUO LT(_DEFAULT_LAYER_1, TH_SQUO)
#define TR_LCBR LT(FIRST_DEFAULT_LAYER, TH_LCBR)
#define TR_LABK LT(FIRST_DEFAULT_LAYER, TH_LABK)
#define TR_LBRC LT(FIRST_DEFAULT_LAYER, TH_LBRC)
#define TR_LPRN LT(FIRST_DEFAULT_LAYER, TH_LPRN)
#define TR_DQUO LT(FIRST_DEFAULT_LAYER, TH_DQUO)
#define TR_SQUO LT(FIRST_DEFAULT_LAYER, TH_SQUO)
// double tap
#define TR_BSLS LT(_DEFAULT_LAYER_1, TH_BSLS)
#define TR_SLSH LT(_DEFAULT_LAYER_1, TH_SLSH)
#define TR_PIPE LT(_DEFAULT_LAYER_1, TH_PIPE)
#define TR_BSLS LT(FIRST_DEFAULT_LAYER, TH_BSLS)
#define TR_SLSH LT(FIRST_DEFAULT_LAYER, TH_SLSH)
#define TR_PIPE LT(FIRST_DEFAULT_LAYER, TH_PIPE)
// Custom override without holding shift
#define TR_COMM LT(_DEFAULT_LAYER_1, TH_COMM)
#define TR_DOT LT(_DEFAULT_LAYER_1, TH_DOT)
#define TR_PERC LT(_DEFAULT_LAYER_1, TH_PERC)
#define TR_COMM LT(FIRST_DEFAULT_LAYER, TH_COMM)
#define TR_DOT LT(FIRST_DEFAULT_LAYER, TH_DOT)
#define TR_PERC LT(FIRST_DEFAULT_LAYER, TH_PERC)
// auto shift
#define TR_EQL LT(_DEFAULT_LAYER_1, TH_EQL)
#define TR_MINS LT(_DEFAULT_LAYER_1, TH_MINS)
#define TR_GRV LT(_DEFAULT_LAYER_1, TH_GRV)
#define TR_SCLN LT(_DEFAULT_LAYER_1, TH_SCLN)
#define TR_QUOT LT(_DEFAULT_LAYER_1, TH_QUOT)
// Tells the process_tap_hold_key what kind of hold action is wanted
#define HOLD_SINGLETP 0
#define HOLD_DOUBLETP 1
#define HOLD_BRACKETS 2
#define TR_EQL LT(FIRST_DEFAULT_LAYER, TH_EQL)
#define TR_MINS LT(FIRST_DEFAULT_LAYER, TH_MINS)
#define TR_GRV LT(FIRST_DEFAULT_LAYER, TH_GRV)
#define TR_SCLN LT(FIRST_DEFAULT_LAYER, TH_SCLN)
#define TR_QUOT LT(FIRST_DEFAULT_LAYER, TH_QUOT)
#if defined(KEYBOARD_bastardkb_charybdis_3x5)
@ -122,9 +121,9 @@ enum keycodes {
# define TR_PDPI DPI_MOD //pointer dpi
#else
# define TR_SNIP ___x___
# define TR_DRGS PN_DRGS //use host status for ploopy nano drag scroll
# define TR_DRGS KC_SCRL //use host status for ploopy nano drag scroll
# define TR_SDPI ___x___
# define TR_PDPI PN_PDPI //use host status for ploopy nano dpi switch
# define TR_PDPI KC_NUM //use host status for ploopy nano dpi switch
#endif //KEYBOARD_bastardkb_charybdis_3x5
@ -184,13 +183,6 @@ enum keycodes {
#endif //AUDIO_ENABLE
#define _DEFAULT_LAYER_1 FIRST_DEFAULT_LAYER
#define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
#define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
#define NUM_BASE_LAYER 3
#define _NONE_3__________________ ___x___, ___x___, ___x___
#define _NONE_5____________________________________ ___x___, ___x___, ___x___, ___x___, ___x___
#define _GACS_MODS________________________ TR_LGUI, TR_LALT, TR_LCTL, TR_LSFT
@ -227,7 +219,7 @@ enum keycodes {
#define LAYER_NAVIGATION \
KC_ESC, KC_HOME, KC_UP, KC_END, KC_PGUP, ___x___, ___x___, SC_FILE, SC_SNIP, CONFIG, \
___x___, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, ___x___, _SCAG_MODS________________________, \
KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, ___x___, _SCAG_MODS________________________, \
_UCCPR_L___________________________________, ___x___, KC_APP, TR_SNIP, TR_SDPI, TR_PDPI, \
ZOOMRST, NUM, KC_ENT, _LAYER_TRANS_____________
@ -241,13 +233,13 @@ enum keycodes {
#define LAYER_SYMBOL \
___x___, ___x___, KC_AT, KC_DLR, TR_GRV, TR_EQL, KC_HASH, KC_ASTR, ___x___, TR_DQUO, \
KC_CAPS, TR_LCBR, KC_RCBR, KC_EXLM, TR_SCLN, KC_AMPR, KC_QUES, TR_LBRC, KC_RBRC, TR_SQUO, \
___x___, TR_LCBR, KC_RCBR, KC_EXLM, TR_SCLN, KC_AMPR, KC_QUES, TR_LBRC, KC_RBRC, TR_SQUO, \
___x___, TR_LABK, KC_RABK, TR_BSLS, TR_PIPE, TR_PERC, TR_SLSH, TR_LPRN, KC_RPRN, TR_MINS, \
_LAYER_TRANS_____________, _LAYER_TRANS_____________
#define LAYER_CONFIG \
TR_HRST, TR_HCNU, TR_HNXT, TR_HFBK, TR_HTOG, ___x___, ___x___, EE_CLR, QK_BOOT, _______, \
TR_HRST, TR_HCNU, TR_HNXT, TR_HFBK, TR_HTOG, ___x___, PN_BOOT, EE_CLR, QK_BOOT, _______, \
TR_CRST, TR_CKUP, TR_CTOG, ___x___, TR_ATOG, ___x___, TR_LSFT, ___x___, ___x___, TR_RMOD, \
KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, TR_RTOG, TR_RHUI, TR_RSAI, TR_RVAI, TR_RSPI, \
BASELYR, TR_DMR1, TR_DMP1, ___x___, ___x___, TR_RTOG