-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·182 lines (161 loc) · 4.91 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/sh
#
# configure, Marlon Mark I - 3D Printer
#
# Description:
# Automatic configuration script.
#
# Author: Márcio Pessoa <[email protected]>
# Contributors: none
#
# Change log:
# 2019-12-05
# Tested on: Marlin 2.0.0.
#
# 2018-12-28
# Tested on: Marlin 1.1.9.
# Set: UUID.
#
# 2018-11-15
# Tested on: Marlin 1.1.9.
# Enable: All endstop sensors.
#
# 2018-05-11
# Tested on: Marlin 1.1.8.
#
# 2017-11-15
# Tested on: Marlin 1.1.6.
# Set: Motherboard to RAMPS v1.4 EFB (Extruder, Fan, Bed)
# Enable: Memory Monitoring
# Enable: Print Counter
# Enable: EEPROM
# Enable: Speaker
#
# 2017-11-11
# Tested on: Marlin 1.1.6.
# Set: Printer name.
# Set: Who made the changes.
#
# 2017-10-27
# Tested on: Marlin 1.1.5.
# Enable: CoreXY
#
# 2017-10-12
# Tested on: Marlin 1.1.5.
# Improvement: Verbose output messages.
#
# 2017-09-08
# Tested on: Marlin 1.1.5.
# Improvement: Invoke xc inside configure.sh.
#
# 2017-09-07
# Tested on: Marlin 1.1.x.
# New feature: Added version information to configure.sh output.
#
# 2017-09-04
# Tested on: Marlin 1.1.x.
# New feature: Get firmware updates on start up.
#
# 2017-08-22
# Tested on: Marlin 1.1.0-RC8.
# Improvement: Verbose messages.
# Improvement: Added check_return() function.
#
# 2017-02-24
# Set: Thermistor minimum temperature to 0.
#
# 2017-02-22
# Enable: Full Graphic Smart Controller.
# Enable: SD Card support.
# Set: Printer name.
#
# 2016-01-16
# Project definition.
#
# Variables
readonly WORKDIR="Marlin"
check_return() {
return=$1
if [ "$return" -eq 0 ]; then
echo "Done."
else
echo "Fail."
exit 1
fi
}
get_updates() {
file=$1
echo "Restoring original state to:"
echo " $file... \\c"
git checkout -- "$file" # Restore original file
check_return $?
echo "Getting firmware updates to $WORKDIR $(git show-branch)... \\c"
#git pull # Get updates from Github
git submodule sync
check_return $?
git submodule update --init --recursive --remote
check_return $?
}
echo "$0"
date +'Started at: %Y-%m-%d %H:%M:%S'
cd $WORKDIR || exit
FILE="Marlin/Configuration.h"
get_updates $FILE
echo "Applying customization to:"
echo " $FILE..."
# Enable: Memory Monitoring
echo " Enabling all endstop sensors... \\c"
sed -i -e 's/\/\/\#define USE_XMAX_PLUG/\#define USE_XMAX_PLUG/' "$FILE"
sed -i -e 's/\/\/\#define USE_YMAX_PLUG/\#define USE_YMAX_PLUG/' "$FILE"
sed -i -e 's/\/\/\#define USE_ZMAX_PLUG/\#define USE_ZMAX_PLUG/' "$FILE"
check_return $?
# Enable: Memory Monitoring
echo " Enabling Memory Monitoring... \\c"
sed -i -e 's/\/\/\#define M100_FREE_MEMORY_WATCHER/\#define M100_FREE_MEMORY_WATCHER/' "$FILE"
check_return $?
# Enable: Print Counter
echo " Enabling Print Counter... \\c"
sed -i -e 's/\/\/\#define PRINTCOUNTER/\#define PRINTCOUNTER/' "$FILE"
check_return $?
# Enable: EEPROM
echo " Enabling EEPROM... \\c"
sed -i -e 's/\/\/\#define EEPROM_SETTINGS/\#define EEPROM_SETTINGS/' "$FILE"
check_return $?
# Enable: Speaker
echo " Enabling Speaker... \\c"
sed -i -e 's/\/\/\#define SPEAKER/\#define SPEAKER/' "$FILE"
check_return $?
# Enable: CoreXY
echo " Enabling CoreXY... \\c"
sed -i -e 's/\/\/\#define COREXY/\#define COREXY/' "$FILE"
check_return $?
# Enable: Full Graphic Smart Controller
echo " Enabling Full Graphic Smart Controller... \\c"
sed -i -e 's/\/\/\#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/\#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/' "$FILE"
check_return $?
# Enable: SD Card support
echo " Enabling SD Card support... \\c"
sed -i -e 's/\/\/\#define SDSUPPORT/\#define SDSUPPORT/' "$FILE"
check_return $?
# Set: Motherboard to RAMPS v1.4 EFB (Extruder, Fan, Bed)
echo " Setting Motherboard to RAMPS v1.4 EFB (Extruder, Fan, Bed)... \\c"
sed -i -e 's/ \#define MOTHERBOARD BOARD_RAMPS_14_EFB/ \#define MOTHERBOARD BOARD_RAMPS_14_EFB/' "$FILE"
check_return $?
# Set: Thermistor minimum temperature to 0
echo " Setting Thermistor minimum temperature to 0... \\c"
sed -i -e 's/\#define HEATER_0_MINTEMP 5/\#define HEATER_0_MINTEMP 0/' "$FILE"
check_return $?
# Set: UUID
echo " Setting UUID... \\c"
sed -i -e 's/\/\/\#define MACHINE_UUID \"00000000-0000-0000-0000-000000000000\"/\#define MACHINE_UUID \"ac0e4435-fb22-47ba-81c3-e455b2deea40\"/' "$FILE"
check_return $?
# Set: Printer name
echo " Setting Printer name... \\c"
sed -i -e 's/\/\/#define CUSTOM_MACHINE_NAME \"3D Printer\"/\#define CUSTOM_MACHINE_NAME \"Marlon\"/' "$FILE"
check_return $?
# Set: Who made the changes
echo " Setting Who made the changes... \\c"
sed -i -e 's/#define STRING_CONFIG_H_AUTHOR \"(none, default config)\"/\#define STRING_CONFIG_H_AUTHOR \"Marcio Pessoa\"/' "$FILE"
check_return $?
echo "Done."
echo