🔨 Offset/encrypt/rename for Maple STM32F1 (#22477)

This commit is contained in:
Tanguy Pruvot
2021-08-01 21:43:31 +02:00
committed by Scott Lahteine
parent 0bbe85d3e7
commit eeac85642f
3 changed files with 3 additions and 24 deletions

View File

@ -1,22 +0,0 @@
#
# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
# Customizations for env:STM32F103VE_longer
#
import os,marlin
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
def encrypt(source, target, env):
firmware = open(target[0].path, "rb")
renamed = open(target[0].dir.path + '/project.bin', "wb")
length = os.path.getsize(target[0].path)
position = 0
try:
while position < length:
byte = firmware.read(1)
renamed.write(byte)
position += 1
finally:
firmware.close()
renamed.close()
marlin.add_post_action(encrypt);