MaslowCNC / Firmware

Maslow Firmware
GNU General Public License v3.0
261 stars 136 forks source link

Revise pwm motor control to avoid TimerOne #374

Closed blurfl closed 6 years ago

blurfl commented 6 years ago

On the Rev.1.1 boards the PWM for the left motor is controlled by pin12. This pin is controlled by timer1 which is also used by the TimerOne library for much of the important timing for the firmware. This PR avoids PWM on pin12 altogether by applying the PWM to a different motor control. This should make it easier to tune the PID settings, and allow changing the PWM frequencies for the three motors (right motor is on timer3, z motor timer4, left motor now on timer2) without affecting other parts of the software. This PR does not alter the frequencies however. I've bench tested it to see that the motors move in the expected manner, but haven't run any of the frame calibrations with it yet. I think I've preserved the proper workings of the speed and _lastspeed variables.

blurfl commented 6 years ago

I'll redo this and try to bring less 'old baggage' with it.

BarbourSmith commented 6 years ago

Woah, what a cool idea!