From 4343de3ee2cfae6d885746716ca4f200794c474f Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Sun, 28 Feb 2021 05:41:16 +0100 Subject: [PATCH] [SAMD51] Respect serial buffer size (#21194) --- .../scripts/SAMD51_grandcentral_m4.py | 18 ++++++++++++++++++ platformio.ini | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py diff --git a/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py b/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py new file mode 100644 index 0000000000..05dc444bda --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py @@ -0,0 +1,18 @@ +# +# SAMD51_grandcentral_m4.py +# Customizations for env:SAMD51_grandcentral_m4 +# +from os.path import join, isfile +import shutil +from pprint import pprint + +Import("env") + +rxBuf = env["MARLIN_FEATURES"]["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in env["MARLIN_FEATURES"] else "0" +txBuf = env["MARLIN_FEATURES"]["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in env["MARLIN_FEATURES"] else "0" + +serialBuf = str(max(int(rxBuf), int(txBuf), 350)) + +build_flags = env.get('BUILD_FLAGS') +build_flags.append("-DSERIAL_BUFFER_SIZE=" + serialBuf) +env.Replace(BUILD_FLAGS=build_flags) diff --git a/platformio.ini b/platformio.ini index 7ddd832f8e..157b3d6201 100644 --- a/platformio.ini +++ b/platformio.ini @@ -681,6 +681,8 @@ src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} SoftwareSerialM Adafruit SPIFlash +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py custom_marlin.SDSUPPORT = SdFat - Adafruit Fork debug_tool = jlink