Renamed feature to velocikey

pull/3754/head
Chris Lewis 7 years ago
parent 2caa8ad4ff
commit e81aa387fa

@ -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)

@ -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

@ -1,13 +0,0 @@
#ifndef MOMENTUM_H
#define MOMENTUM_H
#include <stdint.h>
#include <stdbool.h>
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

@ -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

@ -426,7 +426,7 @@ enum quantum_keycodes {
RGB_MODE_RGBTEST,
//Momentum matching toggle
MOM_TOG,
VLK_TOG,
// Left shift, open paren
KC_LSPO,

@ -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) {

@ -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));
}

@ -0,0 +1,13 @@
#ifndef VELOCIKEY_H
#define VELOCIKEY_H
#include <stdint.h>
#include <stdbool.h>
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

@ -54,7 +54,7 @@
#include "quantum.h"
#include <util/atomic.h>
#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();

Loading…
Cancel
Save