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

Rework on calc_next_comm_period #71

Closed

Conversation

damosvil
Copy link
Contributor

calc_next_comm_period routine has been improved.

Now, when motor is started it uses the same code path for all speeds (and the same 1/16 weighted average for all) making commutation timing more stable. Performance is just the same, because optimized code paths were executed after many if then if checks. Also code is way simpler to understand, and to maintain, because it uses two main paths: one for when motor is starting (1/4 weighted average) and a second one for when motor is started (1/16 weighted average).

Fixed calc_next_comm_period_fast.
Optimized calc_next_comm_period.

Fixed a bug

Fixed a bug
@damosvil damosvil requested a review from stylesuxx February 22, 2023 18:15
@damosvil damosvil self-assigned this Feb 22, 2023
@damosvil damosvil changed the base branch from main to develop February 22, 2023 18:15
@damosvil damosvil linked an issue Feb 22, 2023 that may be closed by this pull request
@stylesuxx stylesuxx changed the base branch from develop to cleaning/reestructuring February 22, 2023 18:27
@stylesuxx
Copy link
Contributor

I set your other branch as base, so we only have the fix here to review ;-)

@stylesuxx
Copy link
Contributor

Interesting. Does this change low RPM performance in any way or has it any other implications for #39? Or is it purely cosmetic and readability?

Also I liked the analysis you did in the related issue, you think you could add this in the code too? Minus the divisor of 8 part obviously.

subb A, #0
mov Temp4, A

; Note: Temp2 is assumed to be zero (approx. Comm_Period4x_H / 4)
Copy link
Contributor Author

@damosvil damosvil Feb 22, 2023

Choose a reason for hiding this comment

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

@stylesuxx This assumption was not correct. New commutation time H can be different to zero. In the reported bug on Blheli_S calculations were not correct, but in Bluejay this assumption was also not correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect, thank you.

@damosvil
Copy link
Contributor Author

Also I liked the analysis you did in the related issue, you think you could add this in the code too? Minus the divisor of 8 part obviously.

I added this to the restructuring branch

@damosvil
Copy link
Contributor Author

Interesting. Does this change low RPM performance in any way or has it any other implications for #39? Or is it purely cosmetic and readability?

This pr may improve that situation because it uses a single weighted mean instead of 3, depending on the situation, but until benchmarks are done I am not sure.

@stylesuxx
Copy link
Contributor

This pr may improve that situation because it uses a single weighted mean instead of 3, depending on the situation, but until benchmarks are done I am not sure.

Alright, so this is something we could maybe ask @ChrisRosser to benchmark for us on his setup, no?

@stylesuxx
Copy link
Contributor

Superseeded by #73 - closed.

@stylesuxx stylesuxx closed this Mar 4, 2023
@stylesuxx stylesuxx deleted the rework/calc_next_comm_period branch July 23, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug found on Blheli_S calc_next_comm_timing_fast function
2 participants