My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

lerdge.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # buildroot/share/PlatformIO/scripts/lerdge.py
  3. # Customizations for Lerdge build environments:
  4. # env:LERDGEX env:LERDGEX_usb_flash_drive
  5. # env:LERDGES env:LERDGES_usb_flash_drive
  6. # env:LERDGEK env:LERDGEK_usb_flash_drive
  7. #
  8. import os,marlin
  9. Import("env")
  10. from SCons.Script import DefaultEnvironment
  11. board = DefaultEnvironment().BoardConfig()
  12. def encryptByte(byte):
  13. byte = 0xFF & ((byte << 6) | (byte >> 2))
  14. i = 0x58 + byte
  15. j = 0x05 + byte + (i >> 8)
  16. byte = (0xF8 & i) | (0x07 & j)
  17. return byte
  18. def encrypt_file(input, output_file, file_length):
  19. input_file = bytearray(input.read())
  20. for i in range(len(input_file)):
  21. result = encryptByte(input_file[i])
  22. input_file[i] = result
  23. output_file.write(input_file)
  24. return
  25. # Encrypt ${PROGNAME}.bin and save it as build.firmware
  26. def encrypt(source, target, env):
  27. print("Encrypting to:", board.get("build.firmware"))
  28. firmware = open(target[0].path, "rb")
  29. renamed = open(target[0].dir.path + "/" + board.get("build.firmware"), "wb")
  30. length = os.path.getsize(target[0].path)
  31. encrypt_file(firmware, renamed, length)
  32. firmware.close()
  33. renamed.close()
  34. if 'firmware' in board.get("build").keys():
  35. marlin.add_post_action(encrypt);
  36. else:
  37. print("You need to define output file via board_build.firmware = 'filename' parameter")
  38. exit(1);