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

Error when adding to config (no attribute TMCtstepHelper) #207

Open
Physicsly opened this issue Oct 17, 2024 · 5 comments
Open

Error when adding to config (no attribute TMCtstepHelper) #207

Physicsly opened this issue Oct 17, 2024 · 5 comments

Comments

@Physicsly
Copy link

When I add the line #[autotune_tmc stepper_x] to my printer.cfg file, I get this error

Internal error during connect: module 'extras.tmc' has no attribute 'TMCtstepHelper'

My printer is a Creality CR-10 SE

printer.cfg:
https://pastebin.com/pU8nMJFg

from klippy.log (it was too big to put in a pastebin)
[INFO] 2024-10-17 00:23:53,979 [root] [gcode_move:init:26] self.variable_safe_z = 3.0
[ERROR] 2024-10-17 00:23:56,827 [root] [klippy:_connect:248] Unhandled exception during connect
Traceback (most recent call last):
File "/usr/share/klipper/klippy/klippy.py", line 193, in _connect
self._read_config()
File "/usr/share/klipper/klippy/klippy.py", line 159, in _read_config
self.load_object(config, section_config.get_name(), None)
File "/usr/share/klipper/klippy/klippy.py", line 126, in load_object
self.objects[section] = init_func(config.getsection(section))
File "/usr/share/klipper/klippy/extras/autotune_tmc.py", line 393, in load_config_prefix
return AutotuneTMC(config)
File "/usr/share/klipper/klippy/extras/autotune_tmc.py", line 99, in init
if 'pstepper' in signature(tmc.TMCtstepHelper).parameters:
AttributeError: module 'extras.tmc' has no attribute 'TMCtstepHelper'

@Physicsly Physicsly changed the title Error when Error when adding to config Oct 17, 2024
@jjiill888
Copy link

jjiill888 commented Nov 27, 2024

Hi my printer is k1se, and I have same problem.

The reason that I can't find 'TMCtstepHelper' in my printer's klippy/extras/tmc.py, but I can find that in newest version klipper/extras/tmc.py.

So I think creatily klipper's version are too old to support klipper_tmc_autotune and am going to fix that

maybe you can try copy it in you tmc.py, and it fromhttps://github.com/K1-Klipper/klipper/blob/3423dc0896c4dc12c9173d86c493dac8c640462b/klippy/extras/tmc.py#L586,and it work very well in my printers

def TMCtstepHelper(step_dist, mres, tmc_freq, velocity):

    if velocity > 0.:
        step_dist_256 = step_dist / (1 << mres)
        threshold = int(tmc_freq * step_dist_256 / velocity + .5)
        return max(0, min(0xfffff, threshold))
    else:
        return 0xfffff

@Physicsly
Copy link
Author

Yep, I tried updating the python file but it bricked my printer and disabled ssh. I had to use the k1 exploit to send a factory reset packet to it.

@jjiill888
Copy link

It's listening to a bad experience. I hope adding new configurations to tmc.py can help you solve these problems. But I found a new issue: Creality printers always use lower torque motors (400 Nm) for the A/B/Z axes, and step loss occurs in the default configuration when tmc_autotune is applied, and It seems that the default configuration of the project may have a negative effect on motors with low holding torque. I have already forked this project and am adapting it for the Creality K1SE. This may be helpful for other Creality machines using this script This is my brench

@jjiill888
Copy link

I’ve figured out why the issue occurs. The reason is that Creality's Klipper has been heavily trimmed, and 'TMCtstepHelper' has been removed from tmc.py. You must place the TMCtstepHelper implementation right before the TMCStealthchopHelper in tmc.py. For more details, check out my branch. I sincerely hope this helps resolve your issue. my_brench

@Physicsly Physicsly changed the title Error when adding to config Error when adding to config (no attribute TMCtstepHelper) Dec 3, 2024
@Physicsly
Copy link
Author

I will test this once I get to it

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

No branches or pull requests

2 participants