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

Unexpected Spindle Linearization Treatment of PWM/rpm Min Values #555

Open
engigeer opened this issue Jul 25, 2024 · 1 comment
Open

Unexpected Spindle Linearization Treatment of PWM/rpm Min Values #555

engigeer opened this issue Jul 25, 2024 · 1 comment

Comments

@engigeer
Copy link

engigeer commented Jul 25, 2024

It seems that when spindle linearization is enabled, the values of $31 (Setting_RpmMin) and $35 (Setting_PWMMinValue), are not used for computing the conversion from pwm_data to pwm_value.

pwm_value = floorf((pwm_data->piece[idx].start * rpm - pwm_data->piece[idx].end) * pwm_data->pwm_gradient);

This could potentially lead to unexpected results (if these settings are non-zero), since the values are still used when computing the gradient.

pwm_data->pwm_gradient = (float)(pwm_data->max_value - pwm_data->min_value) / (spindle->rpm_max - spindle->rpm_min);

I’m wondering if there is any reason not to compute the pwm_data the same as without spindle linearization, i.e.,:

pwm_value = floorf((pwm_data->piece[idx].start * rpm - pwm_data->rpm_min - pwm_data->piece[idx].end) * pwm_data->pwm_gradient) + pwm_data->min_value;

I think this should still work with the spindle linearization python code so long as the values remain unchanged from those used to generate the input data.

@engigeer
Copy link
Author

engigeer commented Aug 28, 2024

Feel free to advise if this is not relevant feedback and I will close out the issue.

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

No branches or pull requests

1 participant