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

Slim down default RGB_ANIMATIONS #7680

Closed

Conversation

Maxr1998
Copy link
Contributor

@Maxr1998 Maxr1998 commented Dec 19, 2019

Description

As it was already discussed in #7669, this PR moves some of the more specific animations into an extra define block, and slims down the default animations. To not break compatibility, I used the following simple script to find keymaps using those animations, and updated their defines to use the extended "import" where necessary. This is however in no way complete yet, and still needs some more testing on my end to verify it's complete, that's why I only marked it as draft for now.

#!/bin/bash
KEYMAP_DIR=$(realpath $1)
KEYMAP_NAME=$(basename $KEYMAP_DIR)
KEYBOARD_DIR=$(realpath $KEYMAP_DIR/../..)

cd $KEYMAP_DIR

if [[ $KEYMAP_NAME = "via" ]] || grep -qr \
    -e "RGB_M_X" -e "RGB_MODE_XMAS" \
    -e "RGB_M_T" -e "RGB_MODE_RGBTEST" *; then
    echo "Patching $KEYMAP_DIR"

    KEYMAP_CONFIG=$KEYMAP_DIR/config.h
    KEYBOARD_CONFIG=$KEYBOARD_DIR/config.h

    if [[ -f $KEYMAP_CONFIG ]] && grep -q RGBLIGHT_ANIMATIONS $KEYMAP_CONFIG; then
        sed -i 's/^\(\s*#\s*define\s*RGBLIGHT_ANIMATIONS\)\s*$/\1_ALL/g' $KEYMAP_CONFIG
    elif [[ -f $KEYBOARD_CONFIG ]] && grep -q RGBLIGHT_ANIMATIONS $KEYBOARD_CONFIG; then
        sed -i 's/^\(\s*#\s*define\s*RGBLIGHT_ANIMATIONS\)\s*$/\1_ALL/g' $KEYBOARD_CONFIG
    fi
fi

find . -type d -wholename "./keyboards/*/keymaps/*" -exec ./rgblight_fix_script.sh {} \;

Types of Changes

  • Core
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My change requires a change to the documentation.

@drashna drashna requested a review from a team December 19, 2019 20:12
Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm not a fan of changing all of the keyboards, like this. Especially as the test animations aren't needed by most of these keyboards.

What may be better is just leaving the define as is.
Though .... we should ABSOLUTELY enable the christmas light one for this: https://github.com/qmk/qmk_firmware/tree/master/keyboards/christmas_tree

quantum/rgblight_reconfig.h Outdated Show resolved Hide resolved
@Maxr1998
Copy link
Contributor Author

@drashna wouldn't implicitly removing these effects from the keyboards/keymaps break the build? If not, I can of course revert the changes, if that's preferred.

@drashna
Copy link
Member

drashna commented Dec 20, 2019

Ah, yeah, you're right.

@mtei mtei mentioned this pull request Jan 5, 2020
13 tasks
@Maxr1998 Maxr1998 marked this pull request as ready for review January 8, 2020 21:04
@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Jan 8, 2020

@drashna just remembered this PR and applied your suggestions. Think it can be reviewed (and then merged) now.

@drashna drashna requested a review from a team January 9, 2020 20:39
@Maxr1998 Maxr1998 force-pushed the 7669-rgblight_default_animations branch from 930d83c to cd8e319 Compare January 21, 2020 11:20
@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Jan 21, 2020

@drashna @fauxpark I just rebased and updated this commit to the latest master, could you have another look at it and possibly merge it then?

@drashna drashna requested a review from a team January 22, 2020 03:20
@zvecr zvecr added the breaking_change Changes that need to wait for a version increment label Jan 22, 2020
Copy link
Member

@zvecr zvecr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the PR touches user keymaps, which we either need sign off from the affected users, or it needs to run through https://docs.qmk.fm/#/breaking_changes?id=breaking-changes.

However outside those keymaps, it also silently breaks the behaviour of users who do something similar to:
keyboards/lets_split/keymaps/pitty/keymap.c: rgblight_mode(29);

Its in no way ideal that those keymaps use raw indexes, however I think that is also another case for this requiring breaking changes.

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Jan 22, 2020

Oh my, that's of course a valid concern. Are these modes only used inside rgblight_mode() or are there any other functions where there would be a potential hard-coding? If not, one could first fix all the hard-coded values by replacing them with the matching constants, and afterwards come back to this.

I agree that we should first get confirmation from the affected keyboard and keymap owners, but I think that'd get a bit complicated. Using the standard breaking-changes process is probably the better idea.

@drashna
Copy link
Member

drashna commented Feb 5, 2020

Unfortunately, the issue with the hard coded numbers is that at one point we didn't have the granular selection, and that stuff wasn't changed at that time.

For the keyboards, I don't think that we need the sign off on those. But for the user keymaps, we definitely want their signoff or to go via the breaking changes process

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Feb 5, 2020

I see, then it makes sense to wait until next breaking changes.

@drashna
Copy link
Member

drashna commented Feb 5, 2020

I see, then it makes sense to wait until next breaking changes.

You can tag the contributors in question, and if they all consent, then don't need to wait for breaking changes.

@Maxr1998 Maxr1998 force-pushed the 7669-rgblight_default_animations branch from cd8e319 to 9a98326 Compare February 6, 2020 00:19
@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Feb 6, 2020

Ok, thank you. Paging @issmirnov, @khord, @coryshaw1, @finex, and @AnthonyWharton then. Please let me know if you're fine with the changes in this PR, and maybe even check out the branch and give it a test, if everything still works.

Also, I rebased my changes onto the latest master, and also re-ran the script another time.

@AnthonyWharton
Copy link
Contributor

AnthonyWharton commented Feb 6, 2020

I’m not in a position to test on my build, but it looks fine to me, thanks 👍

@issmirnov
Copy link
Contributor

issmirnov commented Feb 6, 2020

Thanks for the ping. I checked my keymap it works fine. TBH I should remove the unused test animations entirely, but I can handle that myself. Thanks for the reminder though!

Posting steps for other authors:

git clone https://github.com/qmk/qmk_firmware.git && cd qmk_firmware
git fetch origin +refs/pull/7680/merge && git checkout FETCH_HEAD
make git-submodule
make keebio/levinson/rev2:issmirnov

@khord
Copy link
Contributor

khord commented Feb 6, 2020

LGTM

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Feb 6, 2020

@Wilba6582 thanks for the heads-up, how would you suggest to fix that problem? Does this have to happen inside the VIA source code? Or would the change be for all keyboards in the repo here, that are compatible with VIA?

@wilba
Copy link
Contributor

wilba commented Feb 6, 2020

@Maxr1998 If a keyboard currently in QMK has RGBLIGHT enabled and has a via keymap then update the base config.h to maintain the original default list of animations. IMHO that's consistent with your original intention of not breaking compatibility.

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Feb 7, 2020

@Wilba6582 Done. I also updated my helper script in the OP. Let me know if you spot any issues.

@drashna drashna requested a review from a team February 8, 2020 03:35
@Maxr1998
Copy link
Contributor Author

So, any update on this? We'd still need feedback from @coryshaw1 and @finex, should we instead pull this one into the breaking changes process?

@Maxr1998 Maxr1998 requested review from zvecr and removed request for a team February 28, 2020 11:42
@drashna drashna requested a review from a team March 1, 2020 01:27
@finex
Copy link
Contributor

finex commented Mar 2, 2020

So, any update on this? We'd still need feedback from @coryshaw1 and @finex, should we instead pull this one into the breaking changes process?

Ok for me.

@drashna
Copy link
Member

drashna commented Mar 3, 2020

@coryshaw1 any issues with the change to your code?

@coryshaw1
Copy link
Contributor

Sorry for the late reply. I just built everything fine for my keymaps that use RGB. No issues here 👍

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Mar 3, 2020

Thanks, and no worries.

That should be everyone then! @drashna: so, final review I'd say?

@zvecr
Copy link
Member

zvecr commented Mar 3, 2020

Personally i think this still needs breaking changes with what i mention in #7680 (review)

@noroadsleft
Copy link
Member

Whether we go through master or future branch, this has merge conflicts which must be fixed.

@Maxr1998
Copy link
Contributor Author

Maxr1998 commented Apr 28, 2020

@noroadsleft thanks for the heads up, I'll rebase this once I find the time.

@Maxr1998
Copy link
Contributor Author

@noroadsleft thanks for the heads up, I'll rebase this once I find the time.

Well, that didn't really work out.
Since there's now a docs section on how to selectively enable effects [1], this PR is likely not needed anymore and can be closed. Thoughts?

@drashna
Copy link
Member

drashna commented Jan 14, 2021

I think this is still useful, to be honest.

Having the option to have fewer animations by default is a good idea, IMO.

@tzarc
Copy link
Member

tzarc commented Nov 5, 2021

No longer required.

@tzarc tzarc closed this Nov 5, 2021
@Maxr1998 Maxr1998 deleted the 7669-rgblight_default_animations branch November 5, 2021 13:42
@Maxr1998 Maxr1998 restored the 7669-rgblight_default_animations branch November 5, 2021 13:42
@Maxr1998 Maxr1998 deleted the 7669-rgblight_default_animations branch November 5, 2021 13:42
@Maxr1998 Maxr1998 restored the 7669-rgblight_default_animations branch November 5, 2021 13:42
@Maxr1998 Maxr1998 deleted the 7669-rgblight_default_animations branch November 5, 2021 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking_change Changes that need to wait for a version increment enhancement optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RGBLIGHT default effect list