-
Notifications
You must be signed in to change notification settings - Fork 3
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
Minor carry timeout, formula letters, fixes and doc nitpicks #10
base: maccel-dev
Are you sure you want to change the base?
Conversation
as shown by the notebook @ 4d9235b.
hook the eye on +0s, use & capitalize formula letters.
doc: minor explain-docs in main func.
cluster configurable/curve params.
My thoughts commmit by commit:
|
```c | ||
#define MACCEL_DEBUG | ||
/* | ||
* Requires enabling float support for printf! | ||
/** | ||
* To view mouse's distance/velocity and curve parameters while configuring maccel, | ||
* set `CONSOLE_ENABLE = yes` in `rules.mk`, uncomment the lines below, | ||
* and run `qmk console` in the shell. | ||
* Note: requires enabling float support for printf! | ||
*/ | ||
#define MACCEL_DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote @Wimads:
Explain debug: accept with change. I agree that the little extra explanation is useful. Would add that explanation outside the code block though.
Agreed, it's a good change, but for legibility, please place the text before the code block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean not to be included in the user's config file?
My purpose was exactly that. for the user to view in his/her file the instructions to enable logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point! Placing it in the code block encourages the user to place these instructions in their config, for easy context later down the road.
I'm convinced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I guess that makes some kind of sense. But it also feels weird to have the readme explain one part in the text, and then have the rest of the explanation in the code block :P But do as you see fit, no strong opinion from my side.
Finally, linearity for low CPI settings works better when pointer task throttling enforces a lower frequency from the default 1ms, to have more time to gather "dots", ie. add something like this in your `config.h`: | ||
|
||
```c | ||
// Reduce pointer-task frequency (1ms --> 5ms) for consistent acceleration on lower CPIs. | ||
#undef POINTING_DEVICE_TASK_THROTTLE_MS | ||
#define POINTING_DEVICE_TASK_THROTTLE_MS 5 | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote @Wimads:
Explain Low DPI need throttling: don't accept. This has become irrelevant with the scale down curve; no one will still set a DPI of 100 or 200, so no need to elaborate on this in the readme imho (the more concise the readme the better).
Agreed, this is not neccessary at realistic DPI ranges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will drop it.
maccel/maccel.c
Outdated
printf("MACCEL: DPI:%4i Tko: %.3f Grw: %.3f Ofs: %.3f Lmt: %.3f | Fct: %.3f v.in: %.3f v.out: %.3f d.in: %3i d.out: %3i\n", device_cpi, g_maccel_config.takeoff, g_maccel_config.growth_rate, g_maccel_config.offset, g_maccel_config.limit, maccel_factor, velocity, velocity_out, CONSTRAIN_REPORT(distance), CONSTRAIN_REPORT(distance_out)); | ||
printf("MACCEL: DPI:%5i Tko:%6.3f Grw:%6.3f Ofs:%6.3f Lmt:%6.3f | Fct:%7.3f v.in:%7.3f v.out:%7.3f d.in:%3i d.out:%3i\n", device_cpi, g_maccel_config.takeoff, g_maccel_config.growth_rate, g_maccel_config.offset, g_maccel_config.limit, maccel_factor, velocity, velocity_out, CONSTRAIN_REPORT(distance), CONSTRAIN_REPORT(distance_out)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote @Wimads:
stabilize debug float prints: accept. I will pull my "not a coder" card here :P I'm not sure how this works, but I'll trust your coding knowledge over mine.
Very good; I had done the same, but that must have gotten lost somewhere along the way.
Would you change the prints in the keycodes and in via to match? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do it.
@@ -125,7 +132,7 @@ report_mouse_t pointing_device_task_maccel(report_mouse_t mouse_report) { | |||
device_cpi = pointing_device_get_cpi(); | |||
} | |||
// calculate dpi correction factor (for normalizing velocity range across different user dpi settings) | |||
const float dpi_correction = (float)1000.0f / device_cpi; | |||
const float dpi_correction = (float)MACCEL_MAGNIFICATION_DPI / device_cpi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote @Wimads:
explain x1000 factor: don't accept I don't think this should be turned into a variable, and thus also doesn't require any extra explanation. It scales the v.in range to equivalent of DPI 1000, but that is a fairly arbitrary number - might as well have set it to 20000, and the curve would still work the same. The only thing it would affect is the usable range of the main variables, which is enough to discourage people from playing around with it imho.
I approve of turning a magic number into a preprocessor constant. However, it should have a more meaningful name, for example MACCEL_CPI_EQUIVALENT_SCALE
. Something that implies this is the dpi-equivalence we're scaling to.
Further comments should not be placed to discourage modification, as it's not intended as a user-tunable parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will rename it into MACCEL_MAGNIFICATION_CPI_EQUIVALENT
and add the trimmed-down description proposed in discord along with a discouragement admonition:
Scale acceleration curve's V-input @ 1000 CPI so that its parameters
are not uncannily small and/or formula floats overflow.
Any modified value will invalidate curve parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why magnification? I don't understand that wording in this context. Its normalizing (or scaling if you prefer) v-in to an equivalent of 1000 CPI. So MACCEL_CPI_EQUIVALENT_SCALE
as burkfers suggested makes more sense to me. Or MACCEL_NORMALIZING_CPI_EQUIVALENT
perhaps.
As for the comment, something like this covers my intention better I think:
// Normalizing input velocity to an equivalent of CPI=1000, for consistent accel behavior across different CPI settings.
// Modifying CPI_EQUIVALENT will invalidate the curve parameters.
^^ which should then replace this existing comment:
// calculate dpi correction factor (for normalizing velocity range across different user dpi settings)
@@ -161,7 +161,7 @@ report_mouse_t pointing_device_task_maccel(report_mouse_t mouse_report) { | |||
#ifdef MACCEL_DEBUG | |||
const float distance_out = sqrtf(x * x + y * y); | |||
const float velocity_out = velocity * maccel_factor; | |||
printf("MACCEL: DPI:%5i Tko:%6.3f Grw:%6.3f Ofs:%6.3f Lmt:%6.3f | Acc:%7.3f V.in:%7.3f V.out:%+8.3f D.in:%3i D.out:%3i\n", device_cpi, g_maccel_config.takeoff, g_maccel_config.growth_rate, g_maccel_config.offset, g_maccel_config.limit, maccel_factor, velocity, velocity_out - velocity, CONSTRAIN_REPORT(distance), CONSTRAIN_REPORT(distance_out)); | |||
printf("MACCEL: DPI:%5i Tko:%6.3f Grw:%6.3f Ofs:%6.3f Lmt:%6.3f | Acc:%7.3f V.in:%7.3f V.out:%+8.3f D.in:%3i D.out:%+8.3f\n", device_cpi, g_maccel_config.takeoff, g_maccel_config.growth_rate, g_maccel_config.offset, g_maccel_config.limit, maccel_factor, velocity, velocity_out - velocity, CONSTRAIN_REPORT(distance), distance_out - CONSTRAIN_REPORT(distance)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote @Wimads:
debug-dump D-diffs: don't accept. Same as V-diffs.
I do not have a strong opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will separate it in x2 commits, one capitalizing letters, another one showing the outputs as ± diffs.
You really have to run the code to judge the change, by watching the debug-print as you slowly move the mouse to see wether you like the results.
In the end, whether the label precisely describes the value or not is less of importance that helping us tune the curve parameterss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps make it V.diff instead of V.out? That would seem more intuitive to me.
I guess the only vetted commit would be ec76f8b -
feat(maccel) debug-dump V as diffs ...
and e164bc3 -feat(maccel) debug-dump D as diffs ...
, that i used to introspect the algo when i came up with the need for the carry, to me it still seems easier to spot when a 1 is actually emitted, or how much curry is added :-DAs always, review first commit-by-commit where reason is given, and then in total.