Skip to content

Commit 669814d

Browse files
authored
✨ MARLIN_SMALL_BUILD option (MarlinFirmware#26775)
1 parent 4aa48be commit 669814d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+179
-55
lines changed

Marlin/Configuration_adv.h

+3
Original file line numberDiff line numberDiff line change
@@ -4527,3 +4527,6 @@
45274527

45284528
// Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR.
45294529
//#define OPTIBOOT_RESET_REASON
4530+
4531+
// Shrink the build for smaller boards by sacrificing some serial feedback
4532+
//#define MARLIN_SMALL_BUILD

Marlin/src/feature/fwretract.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ void FWRetract::M207() {
212212
}
213213

214214
void FWRetract::M207_report() {
215+
TERN_(MARLIN_SMALL_BUILD, return);
216+
215217
SERIAL_ECHOLNPGM_P(
216218
PSTR(" M207 S"), LINEAR_UNIT(settings.retract_length)
217219
, PSTR(" W"), LINEAR_UNIT(settings.swap_retract_length)
@@ -237,6 +239,8 @@ void FWRetract::M208() {
237239
}
238240

239241
void FWRetract::M208_report() {
242+
TERN_(MARLIN_SMALL_BUILD, return);
243+
240244
SERIAL_ECHOLNPGM(
241245
" M208 S", LINEAR_UNIT(settings.retract_recover_extra)
242246
, " W", LINEAR_UNIT(settings.swap_retract_recover_extra)
@@ -258,6 +262,8 @@ void FWRetract::M208_report() {
258262
}
259263

260264
void FWRetract::M209_report() {
265+
TERN_(MARLIN_SMALL_BUILD, return);
266+
261267
SERIAL_ECHOLNPGM(" M209 S", AS_DIGIT(autoretract_enabled));
262268
}
263269

Marlin/src/gcode/bedlevel/G26.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ void GcodeSuite::G26() {
532532

533533
if (bedtemp) {
534534
if (!WITHIN(bedtemp, 40, BED_MAX_TARGET)) {
535-
SERIAL_ECHOLNPGM("?Specified bed temperature not plausible (40-", BED_MAX_TARGET, "C).");
535+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified bed temperature not plausible (40-", BED_MAX_TARGET, "C)."));
536536
return;
537537
}
538538
g26.bed_temp = bedtemp;
@@ -543,7 +543,7 @@ void GcodeSuite::G26() {
543543
if (parser.seenval('L')) {
544544
g26.layer_height = parser.value_linear_units();
545545
if (!WITHIN(g26.layer_height, 0.0, 2.0)) {
546-
SERIAL_ECHOLNPGM("?Specified layer height not plausible.");
546+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified layer height not plausible."));
547547
return;
548548
}
549549
}
@@ -552,20 +552,20 @@ void GcodeSuite::G26() {
552552
if (parser.has_value()) {
553553
g26.retraction_multiplier = parser.value_float();
554554
if (!WITHIN(g26.retraction_multiplier, 0.05, 15.0)) {
555-
SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible.");
555+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified Retraction Multiplier not plausible."));
556556
return;
557557
}
558558
}
559559
else {
560-
SERIAL_ECHOLNPGM("?Retraction Multiplier must be specified.");
560+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Retraction Multiplier must be specified."));
561561
return;
562562
}
563563
}
564564

565565
if (parser.seenval('S')) {
566566
g26.nozzle = parser.value_float();
567567
if (!WITHIN(g26.nozzle, 0.1, 2.0)) {
568-
SERIAL_ECHOLNPGM("?Specified nozzle size not plausible.");
568+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified nozzle size not plausible."));
569569
return;
570570
}
571571
}
@@ -575,15 +575,15 @@ void GcodeSuite::G26() {
575575
#if HAS_MARLINUI_MENU
576576
g26.prime_flag = -1;
577577
#else
578-
SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD.");
578+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Prime length must be specified when not using an LCD."));
579579
return;
580580
#endif
581581
}
582582
else {
583583
g26.prime_flag++;
584584
g26.prime_length = parser.value_linear_units();
585585
if (!WITHIN(g26.prime_length, 0.0, 25.0)) {
586-
SERIAL_ECHOLNPGM("?Specified prime length not plausible.");
586+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified prime length not plausible."));
587587
return;
588588
}
589589
}
@@ -592,7 +592,7 @@ void GcodeSuite::G26() {
592592
if (parser.seenval('F')) {
593593
g26.filament_diameter = parser.value_linear_units();
594594
if (!WITHIN(g26.filament_diameter, 1.0, 4.0)) {
595-
SERIAL_ECHOLNPGM("?Specified filament size not plausible.");
595+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified filament size not plausible."));
596596
return;
597597
}
598598
}
@@ -616,7 +616,7 @@ void GcodeSuite::G26() {
616616
// If any preset or temperature was specified
617617
if (noztemp) {
618618
if (!WITHIN(noztemp, 165, thermalManager.hotend_max_target(active_extruder))) {
619-
SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible.");
619+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified nozzle temperature not plausible."));
620620
return;
621621
}
622622
g26.hotend_temp = noztemp;
@@ -637,20 +637,20 @@ void GcodeSuite::G26() {
637637
if (parser.seen('R'))
638638
g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
639639
else {
640-
SERIAL_ECHOLNPGM("?(R)epeat must be specified when not using an LCD.");
640+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(R)epeat must be specified when not using an LCD."));
641641
return;
642642
}
643643
#endif
644644
if (g26_repeats < 1) {
645-
SERIAL_ECHOLNPGM("?(R)epeat value not plausible; must be at least 1.");
645+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(R)epeat value not plausible; must be at least 1."));
646646
return;
647647
}
648648

649649
// Set a position with 'X' and/or 'Y'. Default: current_position
650650
g26.xy_pos.set(parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position.x,
651651
parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position.y);
652652
if (!position_is_reachable(g26.xy_pos)) {
653-
SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds.");
653+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Specified X,Y coordinate out of bounds."));
654654
return;
655655
}
656656

Marlin/src/gcode/bedlevel/G35.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void GcodeSuite::G35() {
6464

6565
const uint8_t screw_thread = parser.byteval('S', TRAMMING_SCREW_THREAD);
6666
if (!WITHIN(screw_thread, 30, 51) || screw_thread % 10 > 1) {
67-
SERIAL_ECHOLNPGM("?(S)crew thread must be 30, 31, 40, 41, 50, or 51.");
67+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(S)crew thread must be 30, 31, 40, 41, 50, or 51."));
6868
return;
6969
}
7070

Marlin/src/gcode/bedlevel/M420.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ void GcodeSuite::M420() {
105105
const int16_t a = settings.calc_num_meshes();
106106

107107
if (!a) {
108-
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
108+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("EEPROM storage not available."));
109109
return;
110110
}
111111

112112
if (!WITHIN(storage_slot, 0, a - 1)) {
113-
SERIAL_ECHOLNPGM("?Invalid storage slot.");
114-
SERIAL_ECHOLNPGM("?Use 0 to ", a - 1);
113+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Invalid storage slot. Use 0 to ", a - 1));
115114
return;
116115
}
117116

@@ -120,7 +119,7 @@ void GcodeSuite::M420() {
120119

121120
#else
122121

123-
SERIAL_ECHOLNPGM("?EEPROM storage not available.");
122+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("EEPROM storage not available."));
124123
return;
125124

126125
#endif
@@ -245,6 +244,8 @@ void GcodeSuite::M420() {
245244
}
246245

247246
void GcodeSuite::M420_report(const bool forReplay/*=true*/) {
247+
TERN_(MARLIN_SMALL_BUILD, return);
248+
248249
report_heading_etc(forReplay, F(
249250
TERN(MESH_BED_LEVELING, "Mesh Bed Leveling", TERN(AUTO_BED_LEVELING_UBL, "Unified Bed Leveling", "Auto Bed Leveling"))
250251
));

Marlin/src/gcode/bedlevel/abl/G29.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ G29_TYPE GcodeSuite::G29() {
344344

345345
abl.verbose_level = parser.intval('V');
346346
if (!WITHIN(abl.verbose_level, 0, 4)) {
347-
SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-4).");
347+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(V)erbose level implausible (0-4)."));
348348
G29_RETURN(false, false);
349349
}
350350

@@ -365,11 +365,11 @@ G29_TYPE GcodeSuite::G29() {
365365
if (parser.seenval('P')) abl.grid_points.x = abl.grid_points.y = parser.value_int();
366366

367367
if (!WITHIN(abl.grid_points.x, 2, GRID_MAX_POINTS_X)) {
368-
SERIAL_ECHOLNPGM("?Probe points (X) implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ").");
368+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Probe points (X) implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ")."));
369369
G29_RETURN(false, false);
370370
}
371371
if (!WITHIN(abl.grid_points.y, 2, GRID_MAX_POINTS_Y)) {
372-
SERIAL_ECHOLNPGM("?Probe points (Y) implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ").");
372+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Probe points (Y) implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ")."));
373373
G29_RETURN(false, false);
374374
}
375375

@@ -404,7 +404,7 @@ G29_TYPE GcodeSuite::G29() {
404404
DEBUG_ECHOLNPGM("G29 L", abl.probe_position_lf.x, " R", abl.probe_position_rb.x,
405405
" F", abl.probe_position_lf.y, " B", abl.probe_position_rb.y);
406406
}
407-
SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
407+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG(" (L,R,F,B) out of bounds."));
408408
G29_RETURN(false, false);
409409
}
410410

Marlin/src/gcode/calibrate/G33.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void GcodeSuite::G33() {
390390

391391
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
392392
if (!WITHIN(probe_points, 0, 10)) {
393-
SERIAL_ECHOLNPGM("?(P)oints implausible (0-10).");
393+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(P)oints implausible (0-10)."));
394394
return;
395395
}
396396

@@ -409,19 +409,19 @@ void GcodeSuite::G33() {
409409

410410
const float calibration_precision = parser.floatval('C', 0.0f);
411411
if (calibration_precision < 0) {
412-
SERIAL_ECHOLNPGM("?(C)alibration precision implausible (>=0).");
412+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(C)alibration precision implausible (>=0)."));
413413
return;
414414
}
415415

416416
const int8_t force_iterations = parser.intval('F', 0);
417417
if (!WITHIN(force_iterations, 0, 30)) {
418-
SERIAL_ECHOLNPGM("?(F)orce iteration implausible (0-30).");
418+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(F)orce iteration implausible (0-30)."));
419419
return;
420420
}
421421

422422
const int8_t verbose_level = parser.byteval('V', 1);
423423
if (!WITHIN(verbose_level, 0, 3)) {
424-
SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-3).");
424+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(V)erbose level implausible (0-3)."));
425425
return;
426426
}
427427

Marlin/src/gcode/calibrate/G34_M422.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,19 @@ void GcodeSuite::G34() {
110110

111111
const int8_t z_auto_align_iterations = parser.intval('I', Z_STEPPER_ALIGN_ITERATIONS);
112112
if (!WITHIN(z_auto_align_iterations, 1, 30)) {
113-
SERIAL_ECHOLNPGM("?(I)teration out of bounds (1-30).");
113+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(I)teration out of bounds (1-30)."));
114114
break;
115115
}
116116

117117
const float z_auto_align_accuracy = parser.floatval('T', Z_STEPPER_ALIGN_ACC);
118118
if (!WITHIN(z_auto_align_accuracy, 0.01f, 1.0f)) {
119-
SERIAL_ECHOLNPGM("?(T)arget accuracy out of bounds (0.01-1.0).");
119+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(T)arget accuracy out of bounds (0.01-1.0)."));
120120
break;
121121
}
122122

123123
const float z_auto_align_amplification = TERN(HAS_Z_STEPPER_ALIGN_STEPPER_XY, Z_STEPPER_ALIGN_AMP, parser.floatval('A', Z_STEPPER_ALIGN_AMP));
124124
if (!WITHIN(ABS(z_auto_align_amplification), 0.5f, 2.0f)) {
125-
SERIAL_ECHOLNPGM("?(A)mplification out of bounds (0.5-2.0).");
125+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(A)mplification out of bounds (0.5-2.0)."));
126126
break;
127127
}
128128

@@ -450,7 +450,7 @@ void GcodeSuite::M422() {
450450
const bool is_probe_point = parser.seen_test('S');
451451

452452
if (TERN0(HAS_Z_STEPPER_ALIGN_STEPPER_XY, is_probe_point && parser.seen_test('W'))) {
453-
SERIAL_ECHOLNPGM("?(S) and (W) may not be combined.");
453+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(S) and (W) may not be combined."));
454454
return;
455455
}
456456

@@ -460,7 +460,7 @@ void GcodeSuite::M422() {
460460
);
461461

462462
if (!is_probe_point && TERN1(HAS_Z_STEPPER_ALIGN_STEPPER_XY, !parser.seen_test('W'))) {
463-
SERIAL_ECHOLNPGM("?(S)" TERN_(HAS_Z_STEPPER_ALIGN_STEPPER_XY, " or (W)") " is required.");
463+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(S)" TERN_(HAS_Z_STEPPER_ALIGN_STEPPER_XY, " or (W)") " is required."));
464464
return;
465465
}
466466

@@ -490,11 +490,11 @@ void GcodeSuite::M422() {
490490

491491
if (is_probe_point) {
492492
if (!probe.can_reach(pos.x, Y_CENTER)) {
493-
SERIAL_ECHOLNPGM("?(X) out of bounds.");
493+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(X) out of bounds."));
494494
return;
495495
}
496496
if (!probe.can_reach(pos)) {
497-
SERIAL_ECHOLNPGM("?(Y) out of bounds.");
497+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(Y) out of bounds."));
498498
return;
499499
}
500500
}
@@ -503,6 +503,8 @@ void GcodeSuite::M422() {
503503
}
504504

505505
void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
506+
TERN_(MARLIN_SMALL_BUILD, return);
507+
506508
report_heading(forReplay, F(STR_Z_AUTO_ALIGN));
507509
for (uint8_t i = 0; i < NUM_Z_STEPPERS; ++i) {
508510
report_echo_start(forReplay);

Marlin/src/gcode/calibrate/M425.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ void GcodeSuite::M425() {
106106
}
107107

108108
void GcodeSuite::M425_report(const bool forReplay/*=true*/) {
109+
TERN_(MARLIN_SMALL_BUILD, return);
110+
109111
report_heading_etc(forReplay, F(STR_BACKLASH_COMPENSATION));
110112
SERIAL_ECHOLNPGM_P(
111113
PSTR(" M425 F"), backlash.get_correction()

Marlin/src/gcode/calibrate/M48.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ void GcodeSuite::M48() {
6262

6363
const int8_t verbose_level = parser.byteval('V', 1);
6464
if (!WITHIN(verbose_level, 0, 4)) {
65-
SERIAL_ECHOLNPGM("?(V)erbose level implausible (0-4).");
65+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("(V)erbose level implausible (0-4)."));
6666
return;
6767
}
6868

6969
const int8_t n_samples = parser.byteval('P', 10);
7070
if (!WITHIN(n_samples, 4, 50)) {
71-
SERIAL_ECHOLNPGM("?Sample size not plausible (4-50).");
71+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Sample size not plausible (4-50)."));
7272
return;
7373
}
7474

@@ -82,15 +82,15 @@ void GcodeSuite::M48() {
8282

8383
if (!probe.can_reach(test_position)) {
8484
LCD_MESSAGE_MAX(MSG_M48_OUT_OF_BOUNDS);
85-
SERIAL_ECHOLNPGM("? (X,Y) out of bounds.");
85+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG(" (X,Y) out of bounds."));
8686
return;
8787
}
8888

8989
// Get the number of leg moves per test-point
9090
bool seen_L = parser.seen('L');
9191
uint8_t n_legs = seen_L ? parser.value_byte() : 0;
9292
if (n_legs > 15) {
93-
SERIAL_ECHOLNPGM("?Legs of movement implausible (0-15).");
93+
SERIAL_ECHOLNPGM(GCODE_ERR_MSG("Legs of movement implausible (0-15)."));
9494
return;
9595
}
9696
if (n_legs == 1) n_legs = 2;

Marlin/src/gcode/calibrate/M665.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
}
6363

6464
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
65+
TERN_(MARLIN_SMALL_BUILD, return);
66+
6567
report_heading_etc(forReplay, F(STR_DELTA_SETTINGS));
6668
SERIAL_ECHOLNPGM_P(
6769
PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod)
@@ -132,6 +134,8 @@
132134
}
133135

134136
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
137+
TERN_(MARLIN_SMALL_BUILD, return);
138+
135139
report_heading_etc(forReplay, F(STR_SCARA_SETTINGS " (" STR_S_SEG_PER_SEC TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
136140
SERIAL_ECHOLNPGM_P(
137141
PSTR(" M665 S"), segments_per_second
@@ -170,6 +174,8 @@
170174
}
171175

172176
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
177+
TERN_(MARLIN_SMALL_BUILD, return);
178+
173179
report_heading_etc(forReplay, F(STR_POLARGRAPH_SETTINGS));
174180
SERIAL_ECHOLNPGM_P(
175181
PSTR(" M665 S"), LINEAR_UNIT(segments_per_second),
@@ -196,10 +202,11 @@
196202
}
197203

198204
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
205+
TERN_(MARLIN_SMALL_BUILD, return);
199206
report_heading_etc(forReplay, F(STR_POLAR_SETTINGS));
200207
SERIAL_ECHOLNPGM_P(PSTR(" M665 S"), segments_per_second);
201208
}
202209

203-
#endif
210+
#endif // POLAR
204211

205212
#endif // IS_KINEMATIC

0 commit comments

Comments
 (0)