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

Release v2.3.1 #315

Merged
merged 79 commits into from
Sep 22, 2023
Merged

Release v2.3.1 #315

merged 79 commits into from
Sep 22, 2023

Conversation

runger1101001
Copy link
Member

PR for release version 2.3.1

Richard Unger and others added 30 commits March 21, 2023 19:11
Fix overflow in STM32 dead-time calculation
Overhaul of interrupt-based sensors to eliminate bad readings due to interrupts modifying variables in the middle of get functions.

All sensor classes are now required to use the base class state variables, and do their angle reading once per frame in the update() function rather than using the virtual get functions to return real-time updated readings. I have chosen to make an exception for getVelocity() and allow it to access volatile variables as well, although it may be better to merge it into update() instead. Interrupts should be disabled/enabled as necessary in the update() and getVelocity() functions, and preferably nowhere else. The Arduino library provides no mechanism to restore the previous state of interrupts, so use of the unconditional enable should be kept to as few locations as possible so we can be reasonably sure that it won't be called at a time when interrupts should remain disabled.

Additional changes to specific sensors:

HallSensor: Removed the max_velocity variable because it was a quick fix for bad velocity readings that were coming from this interrupt problem, which should no longer occur. Also changed the condition for "velocity too old" from (_micros() - pulse_timestamp) > pulse_diff to (_micros() - pulse_timestamp) > pulse_diff*2, because any deceleration would cause inappropriate reporting of zero velocity.

MagneticSensorPWM: Unrelated to the interrupt problem, timestamp is now saved from the rising edge of the PWM pulse because that's when the angle was sampled, and communicating it takes a significant and variable amount of time. This gives more accurate velocity calculations, and will allow extrapolating accurate angles using the new SmoothingSensor class.
Changed interrupt-based sensors to only copy volatile variables during interrupt-blocking sections, and do computations with them after re-enabling interrupts.
Small improvements and bug fixes
RP2040 PWM driver now supports pre-scaler
Bug-Fixes, including BLDCMotor KV init bug
runger1101001 and others added 28 commits July 11, 2023 12:48
Readme Update and AVR bugfix
Fix intialization of sensor direction
Fixing errors with new Arduino framework versions
fix errors and warnings on SIMPLEFOC_DISABLE_DEBUG
Add ESP32 Phasestate with sw-deadtime
Fixes before release 2.3.1
@runger1101001 runger1101001 self-assigned this Sep 22, 2023
@runger1101001 runger1101001 merged commit 717480b into master Sep 22, 2023
30 checks passed
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.

5 participants