Skip to content

Commit e41dc27

Browse files
committed
🔧 Update config.ini and script
1 parent e7de3b9 commit e41dc27

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

Marlin/config.ini

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ preheat_1_temp_hotend = 180
4242
bang_max = 255
4343
pidtemp = on
4444
pid_k1 = 0.95
45-
pid_max = BANG_MAX
45+
pid_max = 255
4646
pid_functional_range = 10
4747

4848
default_kp = 22.20
@@ -96,10 +96,10 @@ step_state_x = HIGH
9696
step_state_y = HIGH
9797
step_state_z = HIGH
9898

99-
disable_x = false
100-
disable_y = false
101-
disable_z = false
102-
disable_e = false
99+
disable_x = off
100+
disable_y = off
101+
disable_z = off
102+
disable_e = off
103103

104104
proportional_font_ratio = 1.0
105105
default_nominal_filament_dia = 1.75

buildroot/share/PlatformIO/scripts/configuration.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ def apply_opt(name, val, conf=None):
1818
if name == "lcd": name, val = val, "on"
1919

2020
# Create a regex to match the option and capture parts of the line
21-
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
21+
# 1: Indentation
22+
# 2: Comment
23+
# 3: #define and whitespace
24+
# 4: Option name
25+
# 5: First space after name
26+
# 6: Remaining spaces between name and value
27+
# 7: Option value
28+
# 8: Whitespace after value
29+
# 9: End comment
30+
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
2231

2332
# Find and enable and/or update all matches
2433
for file in ("Configuration.h", "Configuration_adv.h"):
@@ -37,10 +46,11 @@ def apply_opt(name, val, conf=None):
3746
newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line)
3847
else:
3948
# For options with values, enable and set the value
40-
newline = match[1] + match[3] + match[4] + match[5] + val
41-
if match[8]:
42-
sp = match[7] if match[7] else ' '
43-
newline += sp + match[8]
49+
addsp = '' if match[5] else ' '
50+
newline = match[1] + match[3] + match[4] + match[5] + addsp + val + match[6]
51+
if match[9]:
52+
sp = match[8] if match[8] else ' '
53+
newline += sp + match[9]
4454
lines[i] = newline
4555
blab(f"Set {name} to {val}")
4656

0 commit comments

Comments
 (0)