My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_speed_lookuptable.py 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python
  2. """ Generate the stepper delay lookup table for Marlin firmware. """
  3. import argparse
  4. __author__ = "Ben Gamari <bgamari@gmail.com>"
  5. __copyright__ = "Copyright 2012, Ben Gamari"
  6. __license__ = "GPL"
  7. parser = argparse.ArgumentParser(description=__doc__)
  8. parser.add_argument('-f', '--cpu-freq', type=int, default=16, help='CPU clockrate in MHz (default=16)')
  9. parser.add_argument('-d', '--divider', type=int, default=8, help='Timer/counter pre-scale divider (default=8)')
  10. args = parser.parse_args()
  11. cpu_freq = args.cpu_freq * 1000000
  12. timer_freq = cpu_freq / args.divider
  13. print "#ifndef SPEED_LOOKUPTABLE_H"
  14. print "#define SPEED_LOOKUPTABLE_H"
  15. print
  16. print '#include "Marlin.h"'
  17. print
  18. # Based on timer calculations of 'RepRap cartesian firmware' by Zack
  19. # Smith and Philip Tiefenbacher.
  20. print "const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {"
  21. a = [ timer_freq / ((i*256)+32) 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 " ",
  26. for j in range(8):
  27. print "{%d, %d}," % (a[8*i+j], b[8*i+j]),
  28. print
  29. print "};"
  30. print
  31. print "const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {"
  32. a = [ timer_freq / ((i*8)+32) 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 " ",
  37. for j in range(8):
  38. print "{%d, %d}," % (a[8*i+j], b[8*i+j]),
  39. print
  40. print "};"
  41. print
  42. print "#endif"