From e81aa387fa433055fd4993f7092daf78dd89ad82 Mon Sep 17 00:00:00 2001 From: Chris Lewis Date: Thu, 23 Aug 2018 21:59:08 +1000 Subject: [PATCH] Renamed feature to velocikey --- common_features.mk | 2 +- ...ature_momentum.md => feature_velocikey.md} | 2 +- quantum/momentum.h | 13 ----------- quantum/quantum.c | 8 +++---- quantum/quantum_keycodes.h | 2 +- quantum/rgblight.c | 22 +++++++++---------- quantum/{momentum.c => velocikey.c} | 14 ++++++------ quantum/velocikey.h | 13 +++++++++++ tmk_core/protocol/lufa/lufa.c | 4 ++-- 9 files changed, 40 insertions(+), 40 deletions(-) rename docs/{feature_momentum.md => feature_velocikey.md} (92%) delete mode 100644 quantum/momentum.h rename quantum/{momentum.c => velocikey.c} (81%) create mode 100644 quantum/velocikey.h diff --git a/common_features.mk b/common_features.mk index 261d4fc25f..250cf61cf5 100644 --- a/common_features.mk +++ b/common_features.mk @@ -208,7 +208,7 @@ QUANTUM_SRC:= \ $(QUANTUM_DIR)/keymap_common.c \ $(QUANTUM_DIR)/keycode_config.c \ $(QUANTUM_DIR)/process_keycode/process_leader.c \ - $(QUANTUM_DIR)/momentum.c + $(QUANTUM_DIR)/velocikey.c ifndef CUSTOM_MATRIX ifeq ($(strip $(SPLIT_KEYBOARD)), yes) diff --git a/docs/feature_momentum.md b/docs/feature_velocikey.md similarity index 92% rename from docs/feature_momentum.md rename to docs/feature_velocikey.md index 00ce4bb70f..31c0b85cf7 100644 --- a/docs/feature_momentum.md +++ b/docs/feature_velocikey.md @@ -3,7 +3,7 @@ Momentum is a feature that lets you control the speed of lighting effects (like the Rainbow Swirl effect) with the speed of your typing. The faster you type, the faster the lights will go! ## Usage -For Momentum to take effect, you need to enable it with the MOM_TOG keycode, which toggles it on and off. +For Momentum to take effect, you need to enable it with the VLK_TOG keycode, which toggles it on and off. The following light effects will all be controlled by Momentum when it is enabled: - RGB Breathing diff --git a/quantum/momentum.h b/quantum/momentum.h deleted file mode 100644 index 1fe4c58aea..0000000000 --- a/quantum/momentum.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MOMENTUM_H -#define MOMENTUM_H - -#include -#include - -bool momentum_enabled(void); -void momentum_toggle(void); -void momentum_accelerate(void); -void momentum_decay_task(void); -uint8_t match_momentum(uint8_t minValue, uint8_t maxValue); - -#endif \ No newline at end of file diff --git a/quantum/quantum.c b/quantum/quantum.c index 586221fcbd..32f5f29267 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -42,7 +42,7 @@ extern backlight_config_t backlight_config; #include "process_midi.h" #endif -#include "momentum.h" +#include "velocikey.h" #ifdef AUDIO_ENABLE #ifndef GOODBYE_SONG @@ -198,7 +198,7 @@ bool process_record_quantum(keyrecord_t *record) { keypos_t key = record->event.key; uint16_t keycode; - if (momentum_enabled()) momentum_accelerate(); + if (velocikey_enabled()) velocikey_accelerate(); #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) /* TODO: Use store_or_get_action() or a similar function. */ @@ -520,9 +520,9 @@ bool process_record_quantum(keyrecord_t *record) { } return false; #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - case MOM_TOG: + case VLK_TOG: if (record->event.pressed) { - momentum_toggle(); + velocikey_toggle(); } return false; #ifdef PROTOCOL_LUFA diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 2391122d9d..f63367f306 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -426,7 +426,7 @@ enum quantum_keycodes { RGB_MODE_RGBTEST, //Momentum matching toggle - MOM_TOG, + VLK_TOG, // Left shift, open paren KC_LSPO, diff --git a/quantum/rgblight.c b/quantum/rgblight.c index ccb3110a1e..d3eb283f80 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -24,7 +24,7 @@ #include "rgblight.h" #include "debug.h" #include "led_tables.h" -#include "momentum.h" +#include "velocikey.h" #ifndef RGBLIGHT_LIMIT_VAL #define RGBLIGHT_LIMIT_VAL 255 @@ -606,8 +606,8 @@ void rgblight_effect_breathing(uint8_t interval) { static uint16_t last_timer = 0; float val; - uint8_t interval_time = momentum_enabled() - ? match_momentum(1, 100) + uint8_t interval_time = velocikey_enabled() + ? velocikey_match_speed(1, 100) : pgm_read_byte(&RGBLED_RAINBOW_SWIRL_INTERVALS[interval / 2]); if (timer_elapsed(last_timer) < interval_time) { @@ -625,8 +625,8 @@ void rgblight_effect_rainbow_mood(uint8_t interval) { static uint16_t current_hue = 0; static uint16_t last_timer = 0; - uint8_t interval_time = momentum_enabled() - ? match_momentum(5, 100) + uint8_t interval_time = velocikey_enabled() + ? velocikey_match_speed(5, 100) : pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval]); if (timer_elapsed(last_timer) < interval_time) { @@ -642,8 +642,8 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) { uint16_t hue; uint8_t i; - uint8_t interval_time = momentum_enabled() - ? match_momentum(1, 100) + uint8_t interval_time = velocikey_enabled() + ? velocikey_match_speed(1, 100) : pgm_read_byte(&RGBLED_RAINBOW_SWIRL_INTERVALS[interval / 2]); if (timer_elapsed(last_timer) < interval_time) { @@ -676,8 +676,8 @@ void rgblight_effect_snake(uint8_t interval) { increment = -1; } - uint8_t interval_time = momentum_enabled() - ? match_momentum(1, 200) + uint8_t interval_time = velocikey_enabled() + ? velocikey_match_speed(1, 200) : pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval / 2]); if (timer_elapsed(last_timer) < interval_time) { @@ -712,8 +712,8 @@ void rgblight_effect_snake(uint8_t interval) { void rgblight_effect_knight(uint8_t interval) { static uint16_t last_timer = 0; - uint8_t interval_time = momentum_enabled() - ? match_momentum(5, 100) + uint8_t interval_time = velocikey_enabled() + ? velocikey_match_speed(5, 100) : pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval]); if (timer_elapsed(last_timer) < interval_time) { diff --git a/quantum/momentum.c b/quantum/velocikey.c similarity index 81% rename from quantum/momentum.c rename to quantum/velocikey.c index 662f71d51c..4b81ca95a8 100644 --- a/quantum/momentum.c +++ b/quantum/velocikey.c @@ -1,4 +1,4 @@ -#include "momentum.h" +#include "velocikey.h" #include "timer.h" #include "eeconfig.h" #include "eeprom.h" @@ -13,22 +13,22 @@ #define TYPING_SPEED_MAX_VALUE 200 uint8_t typing_speed = 0; -bool momentum_enabled() { +bool velocikey_enabled() { return eeprom_read_byte(EECONFIG_MOMENTUM) == 1; } -void momentum_toggle() { - if (momentum_enabled()) +void velocikey_toggle() { + if (velocikey_enabled()) eeprom_update_byte(EECONFIG_MOMENTUM, 0); else eeprom_update_byte(EECONFIG_MOMENTUM, 1); } -void momentum_accelerate() { +void velocikey_accelerate() { if (typing_speed < TYPING_SPEED_MAX_VALUE) typing_speed += (TYPING_SPEED_MAX_VALUE / 100); } -void momentum_decay_task() { +void velocikey_decay_task() { static uint16_t decay_timer = 0; if (timer_elapsed(decay_timer) > 500 || decay_timer == 0) { @@ -41,6 +41,6 @@ void momentum_decay_task() { } } -uint8_t match_momentum(uint8_t minValue, uint8_t maxValue) { +uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); } \ No newline at end of file diff --git a/quantum/velocikey.h b/quantum/velocikey.h new file mode 100644 index 0000000000..c6186d83b3 --- /dev/null +++ b/quantum/velocikey.h @@ -0,0 +1,13 @@ +#ifndef VELOCIKEY_H +#define VELOCIKEY_H + +#include +#include + +bool velocikey_enabled(void); +void velocikey_toggle(void); +void velocikey_accelerate(void); +void velocikey_decay_task(void); +uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue); + +#endif \ No newline at end of file diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 3bfcc40dd6..fd9595c447 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -54,7 +54,7 @@ #include "quantum.h" #include #include "outputselect.h" -#include "momentum.h" +#include "velocikey.h" #ifdef NKRO_ENABLE #include "keycode_config.h" @@ -1075,7 +1075,7 @@ int main(void) MIDI_Device_USBTask(&USB_MIDI_Interface); #endif - if (momentum_enabled()) momentum_decay_task(); + if (velocikey_enabled()) velocikey_decay_task(); #if defined(RGBLIGHT_ANIMATIONS) & defined(RGBLIGHT_ENABLE) rgblight_task();