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

Clean up #182's code #321

Closed
wants to merge 1 commit into from
Closed

Clean up #182's code #321

wants to merge 1 commit into from

Conversation

eltang
Copy link
Contributor

@eltang eltang commented May 12, 2016

@vifon has approved the changes.

@jackhumbert @ezuk Could this feature be enabled by default sometime? It would have allowed #308's code to be much simpler, for example.

@jackhumbert
Copy link
Member

Looks fine to me!

@eltang
Copy link
Contributor Author

eltang commented May 12, 2016

So what about enabling it by default?

@ezuk
Copy link
Contributor

ezuk commented May 12, 2016

Hi Eric,

Where do we stand on this?

78bd31f#commitcomment-17390915

@eltang
Copy link
Contributor Author

eltang commented May 12, 2016

@ezuk I haven't gotten around to that yet. I plan to redo some of my features, and that's going to take some time. Don't worry, I tested if this code compiled and @vifon tested if it worked.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

@jackhumbert It seems that some conflicts have arisen. Would you like me to resolve them?

@jackhumbert
Copy link
Member

Sure! I share @ezuk's sentiments though, and would appreciate it if you could test it yourself in addition.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

@jackhumbert I'm now able to compile QMK with my own keymap thanks to @ezuk's urging, for which I'm very grateful (I don't know how long I would have put things off without him). I've tested these changes before for compilation. How would you like me to test them now?

@jackhumbert
Copy link
Member

Describing what to test would take about as long as it would for me to test things ;) do what you see fit (using things on at least one board) for now, and we'll take it from there.

In the end, I'm not too worried about this particular PR, as it just adjusts code that @vifon committed earlier, but it's a good habit to get into!

Re enabling by default - probably not right now. We haven't had too many complaints about things this feature addresses, have we?

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

Sounds good. I guessing that a simple test of the basic functionality should suffice.

I know. You can expect many more PRs from me in the future, all tested (well, except for maybe one—you'll see why).

I know there haven't been complaints from normal users, but it will make development a lot easier in some cases.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

@jackhumbert I've run into a bit of a problem. Is there a reason you're using keycodes rather than action codes in quantum.c?

@jackhumbert
Copy link
Member

Yeah, it's very much done on purpose - can you describe the problem?

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

Sorry for the delay. I took out layer_switch_get_layer and it's impossible to get back a uint16_t variable from calling keymap_key_to_keycode like you're doing now. I'm pretty sure that the code member of the action_t variable that layer_switch_get_action returns will behave exactly the same, though. Would using that be okay?

@jackhumbert
Copy link
Member

Ah, I didn't notice that - yeah, that's not going to get merged, sorry.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

The code can be made to work the same without it. Do you absolutely need it? I'll push an update and let you take a look.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

How's that? This compiles, but I still need to test it on my board.

@jackhumbert
Copy link
Member

I must admit that I didn't look at things too closely before commenting the first time - I assumed you were simply cleaning up things that were limited to @vifon's changes, and a glance at the code reflected that. I wouldn't classify modifying core layer behavior as "clean up."

I'm not really seeing a benefit to merging things like this. @vifon mentioned that it was a subjective change. Can you explain more exactly how this would improve usability?

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

Where are you seeing that I am changing the behavior? I'm not doing that; this is really only a cleanup that makes the code more readable. @vifon was talking about separating find_layer and layer_switch_get_action.

@vifon
Copy link
Contributor

vifon commented May 16, 2016

@vifon was talking about separating find_layer and layer_switch_get_action.

No, I meant it in general too. The thing is, I don't know qmk's core layer well enough to review it thoroughly, that's why I suggested you ask @jackhumbert.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

@vifon Whoops, I misunderstood that then. Which changes were you unsure about?

/* scan from the highest layer to the lowest layer */
for (int8_t layer = 31; layer >= 0; --layer) {
if (master_layer_state & 1UL << layer) {
action_t action = action_for_key(layer, key);
Copy link
Member

Choose a reason for hiding this comment

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

This should be checking the keymap for KC_TRNS with keymap_key_to_keycode (which needs to be prototyped for overriding), rather than checking the action via action_for_key. That allows us to use keycodes rather than actions here.

Copy link
Contributor Author

@eltang eltang May 16, 2016

Choose a reason for hiding this comment

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

That's going to skip the keymap configuration stuff in keymap_common.c, though. Are you sure you want to do that? This was what the original code looked like.

Copy link
Member

Choose a reason for hiding this comment

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

There's nothing in action_for_key that modifies KC_TRNS keys - it's mostly for the (boot)magic stuff.

Copy link
Contributor Author

@eltang eltang May 16, 2016

Choose a reason for hiding this comment

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

Yes, but other stuff is processed in keymap_common.c, too. For example, the keycodes for the mouse keys will not be processed properly if their bare keycodes are piped to process_record. Actually, it's a lot more than that. keycode_to_action absolutely must be called, or else none of the aliases are going to work.

@jackhumbert
Copy link
Member

I'm gonna go back to the basics here - why is this needed? What does it help clarify? I'm much more interested in new features at this point, rather than code clean-up. Tbh, I would rather do all the clean-up by myself.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

It makes the code that handles the cache much clearer, and it also improves the API with the additions to action_util.c. I felt responsible for cleaning up at least this code because I was the one who sent the original code, which was quite messy, to @vifon. I know you might be more interested in new features, but I think some code cleanup might also be beneficial—QMK's gotten a lot more features recently, and I've seen that you've had to disable some lesser-used ones so that the firmware wouldn't be too big to flash.

@jackhumbert
Copy link
Member

Firmware size has been and will always be an issue - we're looking at bigger chips to handle this, but there are obvious concerns for current boards.

If you'd like to just stick to cleaning-up #182 in this PR, we can look at your changes to the layer stuff in another.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

My new matrix.c should shave a good bit of the size of the firmware. :)

Could you please explain what you mean by "layer stuff"? I simply restored layer_switch_get_action to the way it was before #182—I'm not changing anything. I understood the problem, I would gladly fix it.

@jackhumbert
Copy link
Member

I hadn't realised that was changed then. To be fair, you are still changing things now. I'm gonna put this on hold until I have time to clean the layer handling up myself.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

All right. I haven't changed anything for a few hours, but I'll leave this branch up for reference. I was about to open a few other PRs. Does this mean that I should wait on those too?

@jackhumbert
Copy link
Member

Feel free to open them - they'll at least be up here, then.

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

Nice. :)

@eltang
Copy link
Contributor Author

eltang commented May 16, 2016

I could try to fix this PR if you told me what you didn't like about it. I'm still not too sure about that.

@eltang eltang deleted the source_layers_cache_fix branch June 21, 2016 02:19
BlueTufa pushed a commit to BlueTufa/qmk_firmware that referenced this pull request Aug 6, 2021
New entries:

- claw44 (defaults to claw44/rev1)
- treadstone48 (defaults to treadstone48/rev1)
Jpe230 pushed a commit to Jpe230/qmk_firmware that referenced this pull request Jul 12, 2023
* add ozone tactical

* Remove trash

* Update copyright header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants