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.

stm32_serialbuffer.py 943B

1234567891011121314151617181920212223
  1. #
  2. # stm32_serialbuffer.py
  3. #
  4. Import("env")
  5. # Marlin has `RX_BUFFER_SIZE` and `TX_BUFFER_SIZE` to configure the
  6. # buffer size for receiving and transmitting data respectively.
  7. # Stm32duino uses another set of defines for the same purpose,
  8. # so we get the values from the Marlin configuration and set
  9. # them in `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE`.
  10. # It is not possible to change the values at runtime, they must
  11. # be set with build flags.
  12. #
  13. # The script will set the value as the default one (64 bytes)
  14. # or the user-configured one, whichever is higher.
  15. mf = env["MARLIN_FEATURES"]
  16. rxBuf = str(max(64, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
  17. txBuf = str(max(64, int(mf["TX_BUFFER_SIZE"]) if "TX_BUFFER_SIZE" in mf else 0))
  18. build_flags = env.get('BUILD_FLAGS')
  19. build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
  20. build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf)
  21. env.Replace(BUILD_FLAGS=build_flags)