My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

createSpeedLookupTable.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. from __future__ import division
  4. """ Generate the stepper delay lookup table for Marlin firmware. """
  5. import argparse
  6. __author__ = "Ben Gamari <bgamari@gmail.com>"
  7. __copyright__ = "Copyright 2012, Ben Gamari"
  8. __license__ = "GPL"
  9. parser = argparse.ArgumentParser(description=__doc__)
  10. parser.add_argument('-f', '--cpu-freq', type=int, default=16, help='CPU clockrate in MHz (default=16)')
  11. parser.add_argument('-d', '--divider', type=int, default=8, help='Timer/counter pre-scale divider (default=8)')
  12. args = parser.parse_args()
  13. cpu_freq = args.cpu_freq * 1000000
  14. timer_freq = cpu_freq / args.divider
  15. print("#ifndef SPEED_LOOKUPTABLE_H")
  16. print("#define SPEED_LOOKUPTABLE_H")
  17. print()
  18. print('#include "MarlinCore.h"')
  19. print()
  20. print("const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {")
  21. a = [ timer_freq / ((i*256)+(args.cpu_freq*2)) for i in range(256) ]
  22. b = [ a[i] - a[i+1] for i in range(255) ]
  23. b.append(b[-1])
  24. for i in range(32):
  25. print(" ", end=' ')
  26. for j in range(8):
  27. print("{%d, %d}," % (a[8*i+j], b[8*i+j]), end=' ')
  28. print()
  29. print("};")
  30. print()
  31. print("const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {")
  32. a = [ timer_freq / ((i*8)+(args.cpu_freq*2)) for i in range(256) ]
  33. b = [ a[i] - a[i+1] for i in range(255) ]
  34. b.append(b[-1])
  35. for i in range(32):
  36. print(" ", end=' ')
  37. for j in range(8):
  38. print("{%d, %d}," % (a[8*i+j], b[8*i+j]), end=' ')
  39. print()
  40. print("};")
  41. print()
  42. print("#endif")