Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Report actual RPM and PWM instead of just target
The way `report_speed` was implemented, `M957` shows `target_rpm` as the "Current RPM" and then calculates the PWM "Analog value" from there. Because `turn_off` uses `update_pwm(0)` to turn off the output signal without clobbering the `target_rpm` set by `M3`, if you `turn_off` the spindle (via `M5`, a `HALT` state, etc), `M957` (`report_speed`) incorrectly continues to report the old "Current RPM" and calculated "Analog value" even thought the PWM signal has actually been cut off. I turned this around so `report_speed` reads the real PWM ("Analog value") being sent out `pwm_pin` and then calculates the real "Current RPM" from there. I also appended a new "Target RPM" field to the `report_speed` output containing `target_rpm`. Tested over USB serial with `M597`, `M3`, `M5`, `M112`, `M999`, `^X`, and `$X`.
- Loading branch information