Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Velocikey: Match RGB animation speed to typing speed #3754

Merged
merged 60 commits into from
Feb 21, 2019
Merged

Velocikey: Match RGB animation speed to typing speed #3754

merged 60 commits into from
Feb 21, 2019

Conversation

chrislewisdev
Copy link
Contributor

Hey all, I've been working on this feature for a little while and think it's just about ready for integration! I haven't really discussed it with the wider QMK community, so I realise that more revisions may be required to make it suitable for merging. That's OK!

Description

Simply put, this feature makes it so that the faster you type, the faster your RGB animations play. You enable it via the VLK_TOG key that toggles it on and off, and then it will control the animation speed regardless of what speed settings you currently are on.

I'd like to add support for the LED Breathing effect, but currently I can't test this myself because my keyboard doesn't have LEDs.

Remarks

Enabled by default

This might be contentious, but I've left the code for this feature on without requiring a compile-time activator such as VLK_ENABLE. This is due to the small memory footprint it has and also that its usage can overlap with other configurable settings like RGB Lights and/or LEDs, which adds more complexity to the configuration.

If you disagree with this decision, I'm more than happy to discuss revisions :)

Coding style

I've followed some of the general conventions evident in the code, but haven't exactly followed the guidelines to a T. I'm happy to make updates for coding style if this is an issue.

chrislewisdev and others added 30 commits July 25, 2018 11:59
* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!
* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all
* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!
* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all
@chrislewisdev
Copy link
Contributor Author

Second time's the charm? 👀

@mechmerlin
Copy link
Contributor

@chrislewisdev I want tooo soo bad, but as of this writing there are still unresolved conversations and Drashna hasn't approved!

@drashna
Copy link
Member

drashna commented Jan 24, 2019

Before it gets merged, I'd like to see @jackhumbert or @skullydazed check off on this.

@chrislewisdev
Copy link
Contributor Author

More merge conflicts fixed, more firmware size issues!

The tetris:default keymap seems to only be sitting about 16 bytes under its limit without my changes, so even just the new eeconfig.c changes push it over, and there's no escaping that.

I think the tetris:default keymap could sit well under the size limit if it didn't include AUDIO_ENABLE in the default config. @YCF could you please consider this?

Unless anyone has other ideas, the only solution I can see is changing tetris:default so it doesn't rest so close to its size limit.

@YCF
Copy link
Contributor

YCF commented Feb 18, 2019

I will update the tetris:default keymap (maybe this weekend),remove the millions of lines of rgblight_setrgb_at().

code:

for (i=0;i<47;i++){
       (i>45)?(j=i-1):(j=i);
	   uint16_t kc =keymap_key_to_keycode(layer, (keypos_t){ .row = 0, .col = i });
	   if (kc == KC_TRNS) {
	     setrgb(64, 64, 64,(LED_TYPE *)&led[j]);/* TRNS
	   }else if (kc == KC_NO) {
		 setrgb(0, 0, 0,(LED_TYPE *)&led[j]);   /* NO
	   }else {
		 setrgb(1, 2, 3,(LED_TYPE *)&led[j]);   /*  KEYS
	   }

Please help me disable the AUDIO of the tetris.

Thanks.

@chrislewisdev

@chrislewisdev
Copy link
Contributor Author

Thanks so much for the prompt reply @YCF, I really appreciate it!

If you change keyboards\tetris\rules.mk line 56 to AUDIO_ENABLE = no, it frees up a few thousand bytes of firmware space which should prevent any size issues from new functionality like this for the foreseeable future, and would help me get this PR over the line.

From what I see in keyboards\tetris\keymaps\default\keymap.c, it looks like audio is set up as an optional feature, so I assume that disabling it in the default keymap would prevent my current issue while also allowing anyone who wants to use it to easily configure it :)

I'll be back online tomorrow if you'd like any further input.

@drashna
Copy link
Member

drashna commented Feb 20, 2019

@chrislewisdev Actually, I'd rather see the changes to the Tetris keyboard in a separate PR. that way, it can get merged sooner rather than later.

Also, we generally don't want PRs that affect both keyboards and core code (as a guideline).
And there are other PRs that that this affects too.

@chrislewisdev
Copy link
Contributor Author

Sure thing @drashna, new PR is #5197

@mechmerlin
Copy link
Contributor

Woohoo thanks!

@drashna
Copy link
Member

drashna commented Mar 2, 2019

@chrislewisdev any chance you'd be willing to adapt this to the rgb matrix code?

@chrislewisdev
Copy link
Contributor Author

@drashna I'm not terribly familiar with how RGB matrix works nor do I have anything to test it with, however I'm happy to help advise in adapting it and provide reviews for any changes!

From a quick glance at rgb_matrix.c, it looks like the speed of change in matrix effects is largely driven by the g_tick global which is incremented by one every tick. One method to make it go faster using Velocikey could be to use g_tick += velocikey_match_speed(1, 5) instead of g_tick++, but I'm not sure how that would look in practice.

With a little experimentation and tweaking, I'm sure it can work, so keep me in the loop if anyone picks it up and feel free to hit me up for more discussion!

zer09 pushed a commit to zer09/qmk_firmware that referenced this pull request Mar 2, 2019
* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Experimental LED support (untested)

* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Added documentation

* Renamed feature to velocikey

* Reverted readme to original state

* Correct the readme title

* Updated feature name in the docs

* Update EECONFIG name

* Add compile-time toggles for velocikey

* Update feature documentation

* Revert "Merge branch 'led-support' into master"

This reverts commit e123ff5, reversing
changes made to df111a5.

* Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE

* Rename decay_task function to decelerate

* Apply suggestions from code review

Co-Authored-By: chrislewisdev <[email protected]>

* Re-order eeconfig definitions

* Apply coding conventions

* Apply #ifdef check in lufa.c

* Refactored interval time checks into one functionc

* Small rename

* Fix unused function error for layouts not using all rgb effects

* Only update EEPROM if Velocikey is enabled

* Incorporate code review feedback

* Small adjustment to top-end decay rate

* Add Velocikey documentation to table of contents

* Bring tetris:default keymap size down by disabling audio
slugger7 pushed a commit to slugger7/qmk_firmware that referenced this pull request Mar 7, 2019
* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Experimental LED support (untested)

* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Added documentation

* Renamed feature to velocikey

* Reverted readme to original state

* Correct the readme title

* Updated feature name in the docs

* Update EECONFIG name

* Add compile-time toggles for velocikey

* Update feature documentation

* Revert "Merge branch 'led-support' into master"

This reverts commit e123ff5, reversing
changes made to df111a5.

* Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE

* Rename decay_task function to decelerate

* Apply suggestions from code review

Co-Authored-By: chrislewisdev <[email protected]>

* Re-order eeconfig definitions

* Apply coding conventions

* Apply #ifdef check in lufa.c

* Refactored interval time checks into one functionc

* Small rename

* Fix unused function error for layouts not using all rgb effects

* Only update EEPROM if Velocikey is enabled

* Incorporate code review feedback

* Small adjustment to top-end decay rate

* Add Velocikey documentation to table of contents

* Bring tetris:default keymap size down by disabling audio
slugger7 pushed a commit to slugger7/qmk_firmware that referenced this pull request Apr 3, 2019
* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Experimental LED support (untested)

* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Added documentation

* Renamed feature to velocikey

* Reverted readme to original state

* Correct the readme title

* Updated feature name in the docs

* Update EECONFIG name

* Add compile-time toggles for velocikey

* Update feature documentation

* Revert "Merge branch 'led-support' into master"

This reverts commit e123ff5, reversing
changes made to df111a5.

* Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE

* Rename decay_task function to decelerate

* Apply suggestions from code review

Co-Authored-By: chrislewisdev <[email protected]>

* Re-order eeconfig definitions

* Apply coding conventions

* Apply #ifdef check in lufa.c

* Refactored interval time checks into one functionc

* Small rename

* Fix unused function error for layouts not using all rgb effects

* Only update EEPROM if Velocikey is enabled

* Incorporate code review feedback

* Small adjustment to top-end decay rate

* Add Velocikey documentation to table of contents

* Bring tetris:default keymap size down by disabling audio
dlhextall pushed a commit to dlhextall/qmk_firmware that referenced this pull request May 24, 2019
* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Experimental LED support (untested)

* Draft commit of typing speed RGB control

* More information in the readme

* Support all RGB animation modes (Fixes qmk#1)

* Added support for all RGB light modes to use typing speed

Except christmas lights because that is seizure-inducing at high speeds!

* Introduced a value range specific to each RGB mode

Because some modes are a little too much when running at full speed!

* Update readme.md

* Update readme.md

* Re-arrange typing_speed definitions (Fixes qmk#5) (qmk#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all

* Tweaks to the typing speed decay rate

* Renamed to momentum; moved implementation into dedicated files

* Groundwork for toggling momentum on/off (currently always on)

* Add EEPROM toggle for momentum-matching

* Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic

* Move momentum decay task out of rgblight_task()

* Fix missing momentum.h in lufa.c

* Added documentation

* Renamed feature to velocikey

* Reverted readme to original state

* Correct the readme title

* Updated feature name in the docs

* Update EECONFIG name

* Add compile-time toggles for velocikey

* Update feature documentation

* Revert "Merge branch 'led-support' into master"

This reverts commit e123ff5, reversing
changes made to df111a5.

* Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE

* Rename decay_task function to decelerate

* Apply suggestions from code review

Co-Authored-By: chrislewisdev <[email protected]>

* Re-order eeconfig definitions

* Apply coding conventions

* Apply #ifdef check in lufa.c

* Refactored interval time checks into one functionc

* Small rename

* Fix unused function error for layouts not using all rgb effects

* Only update EEPROM if Velocikey is enabled

* Incorporate code review feedback

* Small adjustment to top-end decay rate

* Add Velocikey documentation to table of contents

* Bring tetris:default keymap size down by disabling audio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants