mathiasvr / bluejay

:bird: Digital ESC firmware for controlling brushless motors in multirotors
GNU General Public License v3.0
478 stars 48 forks source link

Updated temperature check function. #52

Closed damosvil closed 2 years ago

damosvil commented 2 years ago

Motivation: This function is called during run6 stage. The old one changed pwm limit abruptly when temperature level was reached and it's counter reached 8, iotherwise it increased pwm limit by 16, even if counter was different to 8, which was a problem because in the worst case pwm limit was reduced to 128 to be again increased by 16 in the next counter values different to 8. Improvement: Function counter now works in reverse from 8 to 0, only when counter is 0 function executes. Moreover when a temperature level is reached a pwm level checkpoint is set, and then pwm level is moved one unit at a time towards this setpoint. This means that pwm limit is not made abruptly. This is good because when pwm limit changes abruptly it causes motor stuttering forcing it to change speed in small intervals and a result more heat is produced both in the motor and the mosfets, causing the oposite effect the function should cause (lowering temperature). You can see this feature working here: https://www.youtube.com/watch?v=wwUJM5_AF7A