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_custom_upload_command_DFU.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Builds custom upload command
  3. # 1) Run platformio as a subprocess to find a COM port
  4. # 2) Build the upload command
  5. # 3) Exit and let upload tool do the work
  6. #
  7. # This script runs between completion of the library/dependencies installation and compilation.
  8. #
  9. # Will continue on if a COM port isn't found so that the compilation can be done.
  10. #
  11. import os
  12. from SCons.Script import DefaultEnvironment
  13. import platform
  14. current_OS = platform.system()
  15. env = DefaultEnvironment()
  16. build_type = os.environ.get("BUILD_TYPE", 'Not Set')
  17. if not(build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set') :
  18. env.Replace(UPLOAD_PROTOCOL = 'teensy-gui') # run normal Teensy2 scripts
  19. else:
  20. if current_OS == 'Windows':
  21. avrdude_conf_path = env.get("PIOHOME_DIR") + '\\packages\\toolchain-atmelavr\\etc\\avrdude.conf'
  22. source_path = env.get("PROJECTBUILD_DIR") + '\\' + env.get("PIOENV") + '\\firmware.hex'
  23. upload_string = 'avrdude -p usb1286 -c flip1 -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
  24. else:
  25. source_path = env.get("PROJECTBUILD_DIR") + '/' + env.get("PIOENV") + '/firmware.hex'
  26. upload_string = 'avrdude -p usb1286 -c flip1 -U flash:w:' + source_path + ':i'
  27. env.Replace(
  28. UPLOADCMD = upload_string,
  29. MAXIMUM_RAM_SIZE = 8192,
  30. MAXIMUM_SIZE = 130048
  31. )