Skip to content

Commit f5e62e6

Browse files
Update - README.md
1 parent 029e4f2 commit f5e62e6

File tree

2 files changed

+82
-31
lines changed

2 files changed

+82
-31
lines changed

README.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,7 @@ Other changes and updates are [addressed here](https://github.com/classicrocker8
9595

9696
There is a _MarlinSimulator_ file provided to test out for yourself. It simulates a pre-built configuration of this firmware.
9797

98-
The _MarlinSimulator_ can compile for Manual Mesh Bed Leveling or Auto Bed Leveling w/`BLTOUCH` enabled.
99-
Start in **Configuration.h** and change `MOTHERBOARD` to `BOARD_SIMULATED`, then disable `ENDSTOP_INTERRUPTS_FEATURE` and `PROUI_EX`:
100-
101-
```y
102-
#ifndef MOTHERBOARD
103-
#define MOTHERBOARD BOARD_SIMULATED
104-
#endif
105-
---
106-
//#define ENDSTOP_INTERRUPTS_FEATURE
107-
---
108-
//#define PROUI_EX 1
109-
```
110-
111-
<br>
112-
113-
Then in **platformio.ini** for `default_envs =` change to `simulator_windows` (for Windows) | `simulator_linux_release` (for Linux):
114-
115-
```ini
116-
default_envs = simulator_windows
117-
---
118-
default_envs = simulator_linux_release
119-
```
98+
The _MarlinSimulator_ can compile for Manual Mesh Bed Leveling or Auto Bed Leveling w/`BLTOUCH` enabled.
12099

121100
For MacOS you're on your own...sorry.
122101

@@ -175,11 +154,27 @@ sudo apt install libsdl2 libsdl2-dev libsdl2-net-dev libsdl2-2.0-0 libglm-dev
175154

176155
#### Using MarlinSimulator
177156

178-
Before building, open a terminal and run `./buildroot/share/scripts/simulator_error.sh`, or change the following manually:
157+
Before building, open a terminal and run `./buildroot/share/scripts/simulator_error.sh [linux|windows]`, or change the following manually:
158+
159+
1. In **Configuration.h**:
160+
161+
- Add `BOARD_SIMULATED` to `MOTHERBOARD`, then disable `ENDSTOP_INTERRUPTS_FEATURE` and `PROUI_EX 1`.
162+
163+
2. In **platformio.ini**:
164+
165+
- For `default_envs =` add `simulator_windows` (for Windows) | `simulator_linux_release` (for Linux).
166+
167+
3. In **lcd/e3v2/proui/dwin_defines.h**:
168+
169+
- Replace `#define INVERT_E0_DIR HMI_data.Invert_E0` with `#define INVERT_E0_DIR false` (or comment it and `#undef INVERT_E0_DIR` out).
170+
171+
4. In **inc/Conditionals-5-post.h**:
172+
173+
- Comment out `#undef Z_MIN_ENDSTOP_HIT_STATE`.
174+
175+
5. In **native.ini**:
179176

180-
- Replace `#define INVERT_E0_DIR HMI_data.Invert_E0` with `#define INVERT_E0_DIR false` (or comment it and `#undef INVERT_E0_DIR` out) in **proui/dwin_defines.h**.
181-
- Comment out `#undef Z_MIN_ENDSTOP_HIT_STATE` in **inc/Conditionals-5-post.h**.
182-
- Replace `-flto` with `-fno-lto` at `release_flags =` under `[simulator_common]` in **native.ini**.
177+
- Replace `-flto` with `-fno-lto` at `release_flags =` under `[simulator_common]`.
183178
<sup>Only if you get an error message about it.</sup>
184179

185180
How to use:

buildroot/share/scripts/simulator_error.sh

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# simulator_error.sh
3+
# simulator_error.sh [linux|windows]
44
#
55
# Run if you encounter an error in the building MarlinSimulator.
66
# Errors may be different for using a probe/auto bed leveling and manual mesh.
@@ -10,11 +10,26 @@
1010
FILE1="Marlin/src/lcd/e3v2/proui/dwin_defines.h"
1111
FILE2="Marlin/src/inc/Conditionals-5-post.h"
1212
FILE3="ini/native.ini"
13+
FILE4="Marlin/Configuration.h"
14+
FILE5="platformio.ini"
1315

1416
# Define patterns to search for (from strings)
1517
PATTERN1='#define INVERT_E0_DIR HMI_data.Invert_E0'
1618
PATTERN2='#undef Z_MIN_ENDSTOP_HIT_STATE'
17-
GENERIC_PATTERN3='release_flags.*-flto' # Matches lines with 'release_flags' then anything, then '-flto'
19+
PATTERN3='release_flags.*-flto'
20+
PATTERN4_BOARD='#define MOTHERBOARD'
21+
PATTERN4_ENDSTOP='#define ENDSTOP_INTERRUPTS_FEATURE'
22+
PATTERN4_PROUI='#define PROUI_EX 1'
23+
PATTERN5_WINDOWS='simulator_windows'
24+
PATTERN5_LINUX='simulator_linux_release'
25+
26+
# Check for command line argument for platform
27+
PLATFORM_ENV=""
28+
if [ "$1" == "windows" ]; then
29+
PLATFORM_ENV='simulator_windows'
30+
elif [ "$1" == "linux" ]; then
31+
PLATFORM_ENV='simulator_linux_release'
32+
fi
1833

1934
echo "Starting script..."
2035

@@ -33,7 +48,7 @@ fi
3348
# --- Change 2: Marlin/src/inc/Conditionals-5-post.h ---
3449
if [ -f "$FILE2" ]; then
3550
if grep -qF "$PATTERN2" "$FILE2"; then
36-
sed -i "s|^.*$PATTERN2| //#undef Z_MIN_ENDSTOP_HIT_STATE|" "$FILE2"
51+
sed -i "s|$PATTERN2|//#undef Z_MIN_ENDSTOP_HIT_STATE|" "$FILE2"
3752
echo "Updated $FILE2: Replaced '$PATTERN2'"
3853
else
3954
echo "Warning: Line '$PATTERN2' not found in $FILE2. No change made."
@@ -42,9 +57,9 @@ else
4257
echo "Error: $FILE2 not found. Skipping changes for this file."
4358
fi
4459

45-
# --- Change 3: ini/native.ini (using the more generic approach) ---
60+
# --- Change 3: ini/native.ini ---
4661
if [ -f "$FILE3" ]; then
47-
if grep -qE "$GENERIC_PATTERN3" "$FILE3"; then
62+
if grep -qE "$PATTERN3" "$FILE3"; then
4863
sed -i "/release_flags/ s/-flto/-fno-lto/" "$FILE3"
4964
echo "Updated $FILE3: Changed '-flto' to '-fno-lto' on a line containing 'release_flags'."
5065
else
@@ -54,4 +69,45 @@ else
5469
echo "Error: $FILE3 not found. Skipping changes for this file."
5570
fi
5671

72+
# --- Change 4: Marlin/Configuration.h ---
73+
if [ -f "$FILE4" ]; then
74+
# Change MOTHERBOARD
75+
if grep -qE "$PATTERN4_BOARD" "$FILE4"; then
76+
sed -i "s|$PATTERN4_BOARD.*$|$PATTERN4_BOARD BOARD_SIMULATED|" "$FILE4"
77+
echo "Updated $FILE4: Added 'BOARD_SIMULATED' to '#define MOTHERBOARD'."
78+
else
79+
echo "Warning: Line containing '$PATTERN4_BOARD' not found in $FILE4. No change made."
80+
fi
81+
82+
# Comment out ENDSTOP_INTERRUPTS_FEATURE
83+
if grep -qF "$PATTERN4_ENDSTOP" "$FILE4"; then
84+
sed -i "s|$PATTERN4_ENDSTOP|//$PATTERN4_ENDSTOP|" "$FILE4"
85+
echo "Updated $FILE4: Commented out '$PATTERN4_ENDSTOP'."
86+
else
87+
echo "Warning: Line '$PATTERN4_ENDSTOP' not found in $FILE4. No change made."
88+
fi
89+
90+
# Comment out PROUI_EX 1
91+
if grep -qF "$PATTERN4_PROUI" "$FILE4"; then
92+
sed -i "s|$PATTERN4_PROUI|//$PATTERN4_PROUI|" "$FILE4"
93+
echo "Updated $FILE4: Commented out '$PATTERN4_PROUI'."
94+
else
95+
echo "Warning: Line '$PATTERN4_PROUI' not found in $FILE4. No change made."
96+
fi
97+
else
98+
echo "Error: $FILE4 not found. Skipping changes for this file."
99+
fi
100+
101+
# --- Change 5: platformio.ini ---
102+
if [ -f "$FILE5" ] && [ ! -z "$PLATFORM_ENV" ]; then
103+
if grep -qE '^default_envs' "$FILE5"; then
104+
sed -i "s|^default_envs.*$|default_envs = $PLATFORM_ENV|" "$FILE5"
105+
echo "Updated $FILE5: Set 'default_envs' to '$PLATFORM_ENV'."
106+
else
107+
echo "Warning: Line containing 'default_envs' not found in $FILE5. No change made."
108+
fi
109+
else
110+
echo "Error: $FILE5 not found or no platform specified. Skipping changes for this file."
111+
fi
112+
57113
echo -e "\nScript complete."

0 commit comments

Comments
 (0)