瀏覽代碼

🐛 Fix Maple / STM32 serial buffer (#22292)

ldursw 3 年之前
父節點
當前提交
0595b87d9a
No account linked to committer's email address

+ 0
- 12
buildroot/share/PlatformIO/scripts/fix_framework_weakness.py 查看文件

@@ -30,15 +30,3 @@ if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
30 30
         print("Done patching exception handler")
31 31
 
32 32
     print("Libmaple modified and ready for post mortem debugging")
33
-
34
-mf = env["MARLIN_FEATURES"]
35
-rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"
36
-txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0"
37
-if int(rxBuf) < 64:
38
-	rxBuf = "64"
39
-if int(txBuf) < 64:
40
-	txBuf = "64"
41
-
42
-build_flags = env.get('BUILD_FLAGS')
43
-build_flags.append("-DUSART_RX_BUF_SIZE=" + rxBuf + " -DUSART_TX_BUF_SIZE=" + txBuf)
44
-env.Replace(BUILD_FLAGS=build_flags)

+ 6
- 1
buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py 查看文件

@@ -13,11 +13,16 @@ Import("env")
13 13
 #
14 14
 # The script will set the value as the default one (64 bytes)
15 15
 # or the user-configured one, whichever is higher.
16
+#
17
+# Marlin has 128 and 32 as default values for RX_BUFFER_SIZE and
18
+# TX_BUFFER_SIZE respectively. We use the highest value.
16 19
 mf = env["MARLIN_FEATURES"]
17
-rxBuf = str(max(64, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
20
+rxBuf = str(max(128, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
18 21
 txBuf = str(max(64, int(mf["TX_BUFFER_SIZE"]) if "TX_BUFFER_SIZE" in mf else 0))
19 22
 
20 23
 build_flags = env.get('BUILD_FLAGS')
21 24
 build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
22 25
 build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf)
26
+build_flags.append("-DUSART_RX_BUF_SIZE=" + rxBuf)
27
+build_flags.append("-DUSART_TX_BUF_SIZE=" + txBuf)
23 28
 env.Replace(BUILD_FLAGS=build_flags)

+ 3
- 1
ini/stm32f1-maple.ini 查看文件

@@ -36,6 +36,7 @@ lib_deps          = ${common.lib_deps}
36 36
 platform_packages = tool-stm32duino
37 37
 extra_scripts     = ${common.extra_scripts}
38 38
   pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
39
+  pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
39 40
 
40 41
 #
41 42
 # STM32F103RC
@@ -325,7 +326,8 @@ lib_ignore    = ${common_stm32f1.lib_ignore}
325 326
 platform      = ${common_stm32f1.platform}
326 327
 extends       = common_stm32f1
327 328
 board         = marlin_CHITU_F103
328
-extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
329
+extra_scripts = ${common_stm32f1.extra_scripts}
330
+  pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
329 331
   pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
330 332
   buildroot/share/PlatformIO/scripts/chitu_crypt.py
331 333
 build_flags   = ${common_stm32f1.build_flags}

+ 2
- 2
ini/stm32f1.ini 查看文件

@@ -150,7 +150,7 @@ board_build.variant  = MARLIN_F103Rx
150 150
 board_build.offset   = 0x7000
151 151
 board_upload.offset_address = 0x08007000
152 152
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
153
-extra_scripts        = ${common.extra_scripts}
153
+extra_scripts        = ${common_stm32.extra_scripts}
154 154
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
155 155
   pre:buildroot/share/PlatformIO/scripts/random-bin.py
156 156
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
@@ -174,7 +174,7 @@ board_build.variant  = MARLIN_F103Rx
174 174
 board_build.offset   = 0x7000
175 175
 board_upload.offset_address = 0x08007000
176 176
 build_unflags        = ${common_stm32.build_unflags}
177
-extra_scripts        = ${common.extra_scripts}
177
+extra_scripts        = ${common_stm32.extra_scripts}
178 178
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
179 179
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
180 180
 debug_tool           = jlink

Loading…
取消
儲存