Closed nefelim4ag closed 3 weeks ago
Hi. For what it is worth, I don't understand what this Pull Request does. That is, I'm not sure what functionality it provides nor the tasks that users will accomplish with it.
If you have questions on how the existing mcu_phase_offset
and phase_offset_position
work (or you think there is a defect) then I'd recommend opening up a new thread on Klipper Discourse. I'll try to answer the questions (and/or look into the defect) there.
Cheers, -Kevin
That would be very kind of you, thanks JFYI: https://klipper.discourse.group/t/motion-analysis-stepper-phase-what-is-it/16789
What I'm trying to do: While working on phase stepping and messing around with accelerometer data against stepper driver phase, I assumed phase is equal to driver
mscnt
or1023 - mscnt
, to try to map accelerometer data specific micro steps or analyze the log instead of gluing together adxl csv files.TLDR, I went in, and checked, and they do not match. Debug some things, and got that this is caused by mcu_phase_offset, which is subtracted in tmc.py.
Found that it is subtracted again in readlog.py, and should do the trick, but looks like it is not.
I don't know the initial intentions for the stepper phase code or how it works with the end-stop phase, angle sensor, so I can not claim inequality to driver mscnt as a bug (and not sure I'm able to fix it properly :D).
*I used code for stallguard tracking, to sample mscnt from driver
Some graphs: Machine enabled, phase is +1 from mscnt, okay:
Machine homed, do not match at all:
![broken_stepper_phase](https://github.com/Klipper3d/klipper/assets/3943460/c7ac3e4c-c199-4695-8fad-5b96f719244d)
So, I tried to export mscnt from the same code and compute it. So, the last mscnt line is dumped from the driver, and the second from the bottom is computed by the stepper position.
![fixed_phase_256](https://github.com/Klipper3d/klipper/assets/3943460/b4fdd6ae-f056-466d-91bf-bbd735f2374b)
So, for now, this is mostly RFC, I can successfully extract needed data now, but it looks strange that the stepper phase, which is based on TMC mscnt, does not match the actual mscnt.
Thanks