Kaynağa Gözat

🔧 Add date, version to Config Export

Scott Lahteine 2 yıl önce
ebeveyn
işleme
b7fd046d59

+ 3
- 3
Marlin/Configuration_adv.h Dosyayı Görüntüle

@@ -35,9 +35,9 @@
35 35
 // @section develop
36 36
 
37 37
 /**
38
- * Configuration Dump
38
+ * Configuration Export
39 39
  *
40
- * Dump the configuration as part of the build. (See signature.py)
40
+ * Export the configuration as part of the build. (See signature.py)
41 41
  * Output files are saved with the build (e.g., .pio/build/mega2560).
42 42
  *
43 43
  * See `build_all_examples --ini` as an example of config.ini archiving.
@@ -48,7 +48,7 @@
48 48
  *  3 = schema.json - The entire configuration schema. (13 = pattern groups)
49 49
  *  4 = schema.yml - The entire configuration schema.
50 50
  */
51
-//#define CONFIG_DUMP   // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml']
51
+//#define CONFIG_EXPORT   // :[1:'JSON', 2:'config.ini', 3:'schema.json', 4:'schema.yml']
52 52
 
53 53
 //===========================================================================
54 54
 //============================= Thermal Settings ============================

+ 0
- 107
Marlin/base.ini Dosyayı Görüntüle

@@ -1,107 +0,0 @@
1
-#
2
-# Marlin Firmware
3
-# base.ini - A base ini to include for testing
4
-#
5
-[config:base]
6
-motherboard                              = BOARD_RAMPS_14_EFB
7
-serial_port                              = 0
8
-baudrate                                 = 250000
9
-
10
-use_watchdog                             = on
11
-thermal_protection_hotends               = on
12
-thermal_protection_hysteresis            = 4
13
-thermal_protection_period                = 40
14
-
15
-bufsize                                  = 4
16
-block_buffer_size                        = 16
17
-max_cmd_size                             = 96
18
-
19
-extruders                                = 1
20
-temp_sensor_0                            = 1
21
-
22
-temp_hysteresis                          = 3
23
-heater_0_mintemp                         = 5
24
-heater_0_maxtemp                         = 275
25
-preheat_1_temp_hotend                    = 180
26
-
27
-bang_max                                 = 255
28
-pidtemp                                  = on
29
-pid_k1                                   = 0.95
30
-pid_max                                  = BANG_MAX
31
-pid_functional_range                     = 10
32
-
33
-default_kp                               = 22.20
34
-default_ki                               = 1.08
35
-default_kd                               = 114.00
36
-
37
-x_driver_type                            = A4988
38
-y_driver_type                            = A4988
39
-z_driver_type                            = A4988
40
-e0_driver_type                           = A4988
41
-
42
-x_bed_size                               = 200
43
-x_min_pos                                = 0
44
-x_max_pos                                = X_BED_SIZE
45
-
46
-y_bed_size                               = 200
47
-y_min_pos                                = 0
48
-y_max_pos                                = Y_BED_SIZE
49
-
50
-z_min_pos                                = 0
51
-z_max_pos                                = 200
52
-
53
-x_home_dir                               = -1
54
-y_home_dir                               = -1
55
-z_home_dir                               = -1
56
-
57
-use_xmin_plug                            = on
58
-use_ymin_plug                            = on
59
-use_zmin_plug                            = on
60
-
61
-x_min_endstop_inverting                  = false
62
-y_min_endstop_inverting                  = false
63
-z_min_endstop_inverting                  = false
64
-
65
-default_axis_steps_per_unit              = { 80, 80, 400, 500 }
66
-axis_relative_modes                      = { false, false, false, false }
67
-default_max_feedrate                     = { 300, 300, 5, 25 }
68
-default_max_acceleration                 = { 3000, 3000, 100, 10000 }
69
-
70
-homing_feedrate_mm_m                     = { (50*60), (50*60), (4*60) }
71
-homing_bump_divisor                      = { 2, 2, 4 }
72
-
73
-x_enable_on                              = 0
74
-y_enable_on                              = 0
75
-z_enable_on                              = 0
76
-e_enable_on                              = 0
77
-
78
-invert_x_dir                             = false
79
-invert_y_dir                             = true
80
-invert_z_dir                             = false
81
-invert_e0_dir                            = false
82
-
83
-invert_e_step_pin                        = false
84
-invert_x_step_pin                        = false
85
-invert_y_step_pin                        = false
86
-invert_z_step_pin                        = false
87
-
88
-disable_x                                = false
89
-disable_y                                = false
90
-disable_z                                = false
91
-disable_e                                = false
92
-
93
-proportional_font_ratio                  = 1.0
94
-default_nominal_filament_dia             = 1.75
95
-
96
-junction_deviation_mm                    = 0.013
97
-
98
-default_acceleration                     = 3000
99
-default_travel_acceleration              = 3000
100
-default_retract_acceleration             = 3000
101
-
102
-default_minimumfeedrate                  = 0.0
103
-default_mintravelfeedrate                = 0.0
104
-
105
-minimum_planner_speed                    = 0.05
106
-min_steps_per_segment                    = 6
107
-default_minsegmenttime                   = 20000

+ 13
- 5
Marlin/config.ini Dosyayı Görüntüle

@@ -4,12 +4,20 @@
4 4
 #
5 5
 [config:base]
6 6
 ini_use_config                           = none
7
-#ini_use_config                          = base.ini, another.ini
8
-#ini_use_config                          = example/Creality/Ender-5 Plus
9
-#ini_use_config                          = https://me.myserver.com/path/to/configs
10
-#ini_use_config                          = base
11
-#config_dump                             = 2
12 7
 
8
+# Load all config: sections in this file
9
+;ini_use_config                          = all
10
+# Load config file relative to Marlin/
11
+;ini_use_config                          = another.ini
12
+# Download configurations from GitHub
13
+;ini_use_config                          = example/Creality/Ender-5 Plus @ bugfix-2.1.x
14
+# Download configurations from your server
15
+;ini_use_config                          = https://me.myserver.com/path/to/configs
16
+# Evaluate config:base and do a config dump
17
+;ini_use_config                          = base
18
+;config_export                           = 2
19
+
20
+[config:minimal]
13 21
 motherboard                              = BOARD_RAMPS_14_EFB
14 22
 serial_port                              = 0
15 23
 baudrate                                 = 250000

+ 4
- 1
buildroot/share/PlatformIO/scripts/configuration.py Dosyayı Görüntüle

@@ -18,7 +18,7 @@ def apply_opt(name, val, conf=None):
18 18
 	if name == "lcd": name, val = val, "on"
19 19
 
20 20
 	# Create a regex to match the option and capture parts of the line
21
-	regex = re.compile(r'^(\s*)(//\s*)?(#define\s+)(' + name + r'\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
21
+	regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
22 22
 
23 23
 	# Find and enable and/or update all matches
24 24
 	for file in ("Configuration.h", "Configuration_adv.h"):
@@ -87,6 +87,9 @@ def fetch_example(path):
87 87
 	if path.endswith("/"):
88 88
 		path = path[:-1]
89 89
 
90
+	if '@' in path:
91
+		path, brch = map(strip, path.split('@'))
92
+
90 93
 	url = path.replace("%", "%25").replace(" ", "%20")
91 94
 	if not path.startswith('http'):
92 95
 		url = "https://raw.githubusercontent.com/MarlinFirmware/Configurations/bugfix-2.1.x/config/%s" % url

+ 1
- 1
buildroot/share/PlatformIO/scripts/schema.py Dosyayı Görüntüle

@@ -95,7 +95,7 @@ def extract():
95 95
 	# Regex for #define NAME [VALUE] [COMMENT] with sanitized line
96 96
 	defgrep = re.compile(r'^(//)?\s*(#define)\s+([A-Za-z0-9_]+)\s*(.*?)\s*(//.+)?$')
97 97
 	# Defines to ignore
98
-	ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_DUMP')
98
+	ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXPORT')
99 99
 	# Start with unknown state
100 100
 	state = Parse.NORMAL
101 101
 	# Serial ID

+ 29
- 13
buildroot/share/PlatformIO/scripts/signature.py Dosyayı Görüntüle

@@ -1,8 +1,10 @@
1 1
 #
2 2
 # signature.py
3 3
 #
4
-import subprocess,re,json,hashlib
5 4
 import schema
5
+
6
+import subprocess,re,json,hashlib
7
+from datetime import datetime
6 8
 from pathlib import Path
7 9
 
8 10
 #
@@ -112,9 +114,9 @@ def compute_build_signature(env):
112 114
 		defines[key] = value if len(value) else ""
113 115
 
114 116
 	#
115
-	# Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_DUMP
117
+	# Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_EXPORT
116 118
 	#
117
-	if not ('CONFIGURATION_EMBEDDING' in defines or 'CONFIG_DUMP' in defines):
119
+	if not ('CONFIGURATION_EMBEDDING' in defines or 'CONFIG_EXPORT' in defines):
118 120
 		return
119 121
 
120 122
 	# Second step is to filter useless macro
@@ -157,18 +159,32 @@ def compute_build_signature(env):
157 159
 		except:
158 160
 			return 0
159 161
 
160
-	config_dump = tryint('CONFIG_DUMP')
162
+	config_dump = tryint('CONFIG_EXPORT')
161 163
 
162 164
 	#
163
-	# Produce an INI file if CONFIG_DUMP == 2
165
+	# Produce an INI file if CONFIG_EXPORT == 2
164 166
 	#
165 167
 	if config_dump == 2:
166 168
 		print("Generating config.ini ...")
167
-		ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_DUMP')
168
-		filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' }
169 169
 		config_ini = build_path / 'config.ini'
170 170
 		with config_ini.open('w') as outfile:
171
-			outfile.write('#\n# Marlin Firmware\n# config.ini - Options to apply before the build\n#\n')
171
+			ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXPORT')
172
+			filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' }
173
+			vers = defines["CONFIGURATION_H_VERSION"]
174
+			dt_string = datetime.now().strftime("%Y-%m-%d at %H:%M:%S")
175
+			ini_fmt = '{0:40}{1}\n'
176
+			outfile.write(
177
+				'#\n'
178
+				+ '# Marlin Firmware\n'
179
+				+ '# config.ini - Options to apply before the build\n'
180
+				+ '#\n'
181
+				+ f'# Generated by Marlin build on {dt_string}\n'
182
+				+ '#\n'
183
+				+ '\n'
184
+				+ '[config:base]\n'
185
+				+ ini_fmt.format('ini_use_config', ' = all')
186
+				+ ini_fmt.format('ini_config_vers', f' = {vers}')
187
+			)
172 188
 			# Loop through the data array of arrays
173 189
 			for header in data:
174 190
 				if header.startswith('__'):
@@ -177,10 +193,10 @@ def compute_build_signature(env):
177 193
 				for key in sorted(data[header]):
178 194
 					if key not in ignore:
179 195
 						val = 'on' if data[header][key] == '' else data[header][key]
180
-						outfile.write('{0:40}{1}'.format(key.lower(), ' = ' + val) + '\n')
196
+						outfile.write(ini_fmt.format(key.lower(), ' = ' + val))
181 197
 
182 198
 	#
183
-	# Produce a schema.json file if CONFIG_DUMP == 3
199
+	# Produce a schema.json file if CONFIG_EXPORT == 3
184 200
 	#
185 201
 	if config_dump >= 3:
186 202
 		try:
@@ -191,7 +207,7 @@ def compute_build_signature(env):
191 207
 
192 208
 		if conf_schema:
193 209
 			#
194
-			# Produce a schema.json file if CONFIG_DUMP == 3
210
+			# Produce a schema.json file if CONFIG_EXPORT == 3
195 211
 			#
196 212
 			if config_dump in (3, 13):
197 213
 				print("Generating schema.json ...")
@@ -201,7 +217,7 @@ def compute_build_signature(env):
201 217
 					schema.dump_json(conf_schema, build_path / 'schema_grouped.json')
202 218
 
203 219
 			#
204
-			# Produce a schema.yml file if CONFIG_DUMP == 4
220
+			# Produce a schema.yml file if CONFIG_EXPORT == 4
205 221
 			#
206 222
 			elif config_dump == 4:
207 223
 				print("Generating schema.yml ...")
@@ -226,7 +242,7 @@ def compute_build_signature(env):
226 242
 		pass
227 243
 
228 244
 	#
229
-	# Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_DUMP == 1
245
+	# Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_EXPORT == 1
230 246
 	#
231 247
 	if config_dump == 1 or 'CONFIGURATION_EMBEDDING' in defines:
232 248
 		with marlin_json.open('w') as outfile:

Loading…
İptal
Kaydet