mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-10-22 08:52:29 +02:00
Renamed feature to velocikey
This commit is contained in:
@@ -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
|
||||
+4
-4
@@ -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,
|
||||
|
||||
+11
-11
@@ -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
|
||||
Reference in New Issue
Block a user